specrails-desktop 2.2.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/dist/assets/ActivityFeedPage-DJJlZ3mF.js +1 -0
- package/client/dist/assets/AgentsPage-49JaEDjR.js +86 -0
- package/client/dist/assets/{AnalyticsPage-BD0paa75.js → AnalyticsPage-BUd3gWYC.js} +1 -1
- package/client/dist/assets/{BarChart-D8ZZRab3.js → BarChart-HDe_YoUD.js} +1 -1
- package/client/dist/assets/CodePage-CqPPND47.js +2 -0
- package/client/dist/assets/{DesktopAnalyticsPage-mwd8460_.js → DesktopAnalyticsPage-CgvmSvF0.js} +1 -1
- package/client/dist/assets/DocsDialog-hHFd3Ejs.js +11 -0
- package/client/dist/assets/DocsPage-B4R1aksg.js +11 -0
- package/client/dist/assets/{ExportDropdown-CLYmQhic.js → ExportDropdown-f4dwQjlT.js} +1 -1
- package/client/dist/assets/IntegrationsPage-CX2Ybxx0.js +3 -0
- package/client/dist/assets/JobDetailPage-DN2Jc8Ti.js +16 -0
- package/client/dist/assets/JobsPage-DmdpqijT.js +1 -0
- package/client/dist/assets/code-BwIz8agY.js +1 -0
- package/client/dist/assets/code-CD7yNSK0.js +1 -0
- package/client/dist/assets/code-CDFlxUFC.js +1 -0
- package/client/dist/assets/code-CY85RXZU.js +1 -0
- package/client/dist/assets/code-Cp3Fdng-.js +1 -0
- package/client/dist/assets/code-D24e1Crx.js +1 -0
- package/client/dist/assets/code-DtZBQTi9.js +1 -0
- package/client/dist/assets/code-nKa0fkm_.js +1 -0
- package/client/dist/assets/{cssMode-Cc6ozl-J.js → cssMode-DzNPAYFh.js} +1 -1
- package/client/dist/assets/{dist-js-D3MxtOYa.js → dist-js-COfIfLRE.js} +1 -1
- package/client/dist/assets/{dist-js-BOu_cXw3.js → dist-js-CvScGQU_.js} +1 -1
- package/client/dist/assets/{editor.main-CfXxHimg.js → editor.main-C7Rmw-hR.js} +2 -2
- package/client/dist/assets/{freemarker2-DP7J1gG3.js → freemarker2-Cszs4SVo.js} +1 -1
- package/client/dist/assets/{handlebars-BjRlucw6.js → handlebars-Dp7Lsuym.js} +1 -1
- package/client/dist/assets/{html-OumBQJ-U.js → html-BURidrEm.js} +1 -1
- package/client/dist/assets/{htmlMode-CStc3zXM.js → htmlMode--k5M7GjZ.js} +1 -1
- package/client/dist/assets/index-DBpvYrDK.css +2 -0
- package/client/dist/assets/index-DGIXKRHE.js +142 -0
- package/client/dist/assets/{integrations-Cublz3m6.js → integrations-2C7MkGT0.js} +1 -1
- package/client/dist/assets/{integrations-HIlUxXVs.js → integrations-BDC670cg.js} +1 -1
- package/client/dist/assets/integrations-BqUmRUef.js +1 -0
- package/client/dist/assets/{integrations-DmQYCUvN.js → integrations-C2jQtv-s.js} +1 -1
- package/client/dist/assets/{integrations-DRdbki5W.js → integrations-CB98NeH5.js} +1 -1
- package/client/dist/assets/{integrations-C3p12Ms6.js → integrations-CX4p_bij.js} +1 -1
- package/client/dist/assets/{integrations-DaC4SzzL.js → integrations-_SuVeQIG.js} +1 -1
- package/client/dist/assets/{integrations-Cr6hH7XR.js → integrations-eQPHAYsE.js} +1 -1
- package/client/dist/assets/{javascript-CMk--e7g.js → javascript-kJQz__44.js} +1 -1
- package/client/dist/assets/jira-C-ATCti0.js +1 -0
- package/client/dist/assets/jira-CmVfRM-b.js +1 -0
- package/client/dist/assets/jira-D7bkKAX8.js +1 -0
- package/client/dist/assets/jira-DKImM1YH.js +1 -0
- package/client/dist/assets/jira-DOw8bkIR.js +1 -0
- package/client/dist/assets/jira-DlA-wGp-.js +1 -0
- package/client/dist/assets/jira-Fob8EGxN.js +1 -0
- package/client/dist/assets/jira-xZA2lixb.js +1 -0
- package/client/dist/assets/{jsonMode-C2h3ZcjZ.js → jsonMode-v5JYPpnz.js} +1 -1
- package/client/dist/assets/{lib-DQ2hrj8m.js → lib-Bro9Z0gp.js} +1 -1
- package/client/dist/assets/{liquid-mI3KJrBE.js → liquid-Dl9I6gWt.js} +1 -1
- package/client/dist/assets/{lspLanguageFeatures-DU09ggWi.js → lspLanguageFeatures-CPlEe0NK.js} +1 -1
- package/client/dist/assets/{mdx-C41VDTR_.js → mdx-Byl7TtzQ.js} +1 -1
- package/client/dist/assets/{monaco.contribution-CPObAXMC.js → monaco.contribution-YMAkHQcQ.js} +2 -2
- package/client/dist/assets/{python-Y27rKQtk.js → python-jWQwT6j2.js} +1 -1
- package/client/dist/assets/{razor-Cd5-q9Bp.js → razor-BWS3sP-E.js} +1 -1
- package/client/dist/assets/setup-C0dzw8j4.js +1 -0
- package/client/dist/assets/setup-C1IA-9YS.js +1 -0
- package/client/dist/assets/setup-CpfjaNut.js +1 -0
- package/client/dist/assets/setup-D3rNZA9A.js +1 -0
- package/client/dist/assets/setup-UD2aanGs.js +1 -0
- package/client/dist/assets/setup-WP6WOYQh.js +1 -0
- package/client/dist/assets/setup-gzLG8T6F.js +1 -0
- package/client/dist/assets/setup-pjgmYHx6.js +1 -0
- package/client/dist/assets/specs-4lA_u79w.js +1 -0
- package/client/dist/assets/{specs-D2FzlLn9.js → specs-BHjxcjOf.js} +1 -1
- package/client/dist/assets/{specs-CZ1PsXsC.js → specs-CXNQzPk9.js} +1 -1
- package/client/dist/assets/{specs-Dyc5hYeE.js → specs-DFnc2Huj.js} +1 -1
- package/client/dist/assets/{specs-BFfu3u-a.js → specs-DZCLH2-l.js} +1 -1
- package/client/dist/assets/{specs-B__C8-8a.js → specs-DgmyAE3N.js} +1 -1
- package/client/dist/assets/{specs-DaUTrNF9.js → specs-DicWhvwi.js} +1 -1
- package/client/dist/assets/{specs-k0PyLDVt.js → specs-dkro6lSM.js} +1 -1
- package/client/dist/assets/{tsMode-B0y_xEci.js → tsMode-BbOGOuSV.js} +1 -1
- package/client/dist/assets/{typescript-BzK0OgwW.js → typescript-eBtFQJLs.js} +1 -1
- package/client/dist/assets/{useProjectCache-BxY4aTjd.js → useProjectCache-D9juBhsO.js} +1 -1
- package/client/dist/assets/{workers-rt--R2Qy.js → workers-BvicOoDf.js} +1 -1
- package/client/dist/assets/{xml-eX9QXAmI.js → xml-BJepAPyM.js} +1 -1
- package/client/dist/assets/{yaml-fcsNkpOt.js → yaml-DabgV-eA.js} +1 -1
- package/client/dist/index.html +13 -12
- package/docs/jira-integration-plan.md +321 -0
- package/package.json +1 -1
- package/server/dist/agent-refine-manager.js +128 -153
- package/server/dist/chat-manager.js +242 -0
- package/server/dist/code-explorer-router.js +78 -0
- package/server/dist/command-resolver.js +17 -0
- package/server/dist/contract-refine-runner.js +42 -10
- package/server/dist/db.js +86 -0
- package/server/dist/desktop-db.js +3 -0
- package/server/dist/explore-stdin-session.js +129 -0
- package/server/dist/feature-flags.js +11 -0
- package/server/dist/jira/jira-adf.js +113 -0
- package/server/dist/jira/jira-backlog-config.js +58 -0
- package/server/dist/jira/jira-client.js +279 -0
- package/server/dist/jira/jira-credential-store.js +103 -0
- package/server/dist/jira/jira-db.js +341 -0
- package/server/dist/jira/jira-issue-fields.js +428 -0
- package/server/dist/jira/jira-materializer.js +250 -0
- package/server/dist/jira/jira-status-resolver.js +211 -0
- package/server/dist/jira/jira-sync-manager.js +1014 -0
- package/server/dist/jira/types.js +9 -0
- package/server/dist/jira-router.js +304 -0
- package/server/dist/mobile/mobile-auth.js +16 -0
- package/server/dist/project-registry.js +43 -1
- package/server/dist/project-router-chat.js +218 -0
- package/server/dist/project-router-helpers.js +275 -0
- package/server/dist/project-router-jobs.js +389 -0
- package/server/dist/project-router-settings.js +312 -0
- package/server/dist/project-router-setup.js +456 -0
- package/server/dist/project-router-spending.js +320 -0
- package/server/dist/project-router-terminals.js +312 -0
- package/server/dist/project-router-tickets.js +1815 -0
- package/server/dist/project-router.js +31 -3950
- package/server/dist/providers/claude-adapter.js +23 -0
- package/server/dist/providers/codex-adapter.js +6 -0
- package/server/dist/rails-router.js +12 -0
- package/server/dist/spawn-lifecycle.js +117 -0
- package/client/dist/assets/ActivityFeedPage-BpjXuX2H.js +0 -1
- package/client/dist/assets/AgentsPage-D-7fDbTc.js +0 -86
- package/client/dist/assets/CodePage-B6q6CiYJ.js +0 -2
- package/client/dist/assets/DocsDialog-D_dyF2h9.js +0 -11
- package/client/dist/assets/DocsPage-C9-Ru8wE.js +0 -11
- package/client/dist/assets/IntegrationsPage-3WWtx9hi.js +0 -3
- package/client/dist/assets/JobDetailPage-DgN-79s-.js +0 -16
- package/client/dist/assets/JobsPage-Du8_w1ob.js +0 -1
- package/client/dist/assets/code-AL1rVIMb.js +0 -1
- package/client/dist/assets/code-C0BKpkht.js +0 -1
- package/client/dist/assets/code-C0FTS3ew.js +0 -1
- package/client/dist/assets/code-CPcHxzxw.js +0 -1
- package/client/dist/assets/code-D3ryDniw.js +0 -1
- package/client/dist/assets/code-D3zVVQTj.js +0 -1
- package/client/dist/assets/code-PCmfS3dn.js +0 -1
- package/client/dist/assets/code-exI0G5Wd.js +0 -1
- package/client/dist/assets/index-D17R4Cjc.css +0 -2
- package/client/dist/assets/index-D9G_K4L-.js +0 -142
- package/client/dist/assets/integrations-D28q1kF6.js +0 -1
- package/client/dist/assets/setup--FMCsnQS.js +0 -1
- package/client/dist/assets/setup-B19ZpBNi.js +0 -1
- package/client/dist/assets/setup-BZPmkjSN.js +0 -1
- package/client/dist/assets/setup-BqYA02rS.js +0 -1
- package/client/dist/assets/setup-ChKQDHN9.js +0 -1
- package/client/dist/assets/setup-D2n9jMfM.js +0 -1
- package/client/dist/assets/setup-P3r6YP1D.js +0 -1
- package/client/dist/assets/setup-fnfEbwlv.js +0 -1
- package/client/dist/assets/specs-cKEh2LXt.js +0 -1
- /package/client/dist/assets/{abap-Bw6f2wDG.js → abap-s65oMlhi.js} +0 -0
- /package/client/dist/assets/{activity-BdrPln96.js → activity-BqqwnH_h.js} +0 -0
- /package/client/dist/assets/{activity-BEIp_Y1A.js → activity-C8qqEIoP.js} +0 -0
- /package/client/dist/assets/{activity-CpkRS8Sx.js → activity-CZVM4nlJ.js} +0 -0
- /package/client/dist/assets/{activity-DOUVEjJi.js → activity-Cyy07Tgo.js} +0 -0
- /package/client/dist/assets/{activity-DRwkql_y.js → activity-DlbWCa4y.js} +0 -0
- /package/client/dist/assets/{activity-DKCpESPt.js → activity-Dwq0heud.js} +0 -0
- /package/client/dist/assets/{activity-DcDQ7tjw.js → activity-qFTcMyW9.js} +0 -0
- /package/client/dist/assets/{addon-image-3WCl5Vhd.js → addon-image-CpF0L0jM.js} +0 -0
- /package/client/dist/assets/{addon-ligatures-C5OdliKs.js → addon-ligatures-hXysGZrA.js} +0 -0
- /package/client/dist/assets/{addon-webgl-BbX6pSjl.js → addon-webgl-Cn1slavz.js} +0 -0
- /package/client/dist/assets/{addspec-D33ocMxf.js → addspec-B1FTtI2a.js} +0 -0
- /package/client/dist/assets/{addspec-DFswZ0jK.js → addspec-BCT9vm_c.js} +0 -0
- /package/client/dist/assets/{addspec-DVZ15Jp8.js → addspec-DeDOztDr.js} +0 -0
- /package/client/dist/assets/{addspec-Fkv91Opc.js → addspec-DpRgmfmx.js} +0 -0
- /package/client/dist/assets/{addspec-BEeF5-zc.js → addspec-Dw-0Dg-4.js} +0 -0
- /package/client/dist/assets/{addspec-B5yl4Loj.js → addspec-rp496P_F.js} +0 -0
- /package/client/dist/assets/{addspec-DRE-jZv7.js → addspec-v8j6A7CD.js} +0 -0
- /package/client/dist/assets/{agents-DK-Dlc0i.js → agents-23iPejcA.js} +0 -0
- /package/client/dist/assets/{agents-Q6Ldfpxx.js → agents-BDx1RXcl.js} +0 -0
- /package/client/dist/assets/{agents-TeOSy-ax.js → agents-BFr3kUhK.js} +0 -0
- /package/client/dist/assets/{agents-Bm9rPqnt.js → agents-B_1L9xRg.js} +0 -0
- /package/client/dist/assets/{agents-1nCDWRmP.js → agents-BlPnx-mz.js} +0 -0
- /package/client/dist/assets/{agents-iTqjRajS.js → agents-DcxZHzNr.js} +0 -0
- /package/client/dist/assets/{agents-s87sMGzL.js → agents-G3shOewU.js} +0 -0
- /package/client/dist/assets/{agentstudio-B6Wb59E7.js → agentstudio-B-CMAQqy.js} +0 -0
- /package/client/dist/assets/{agentstudio-D3I62TLJ.js → agentstudio-Bk1eZcv4.js} +0 -0
- /package/client/dist/assets/{agentstudio-DuH9TogZ.js → agentstudio-ChxNuGAu.js} +0 -0
- /package/client/dist/assets/{agentstudio-Kw88_dUF.js → agentstudio-DNlme601.js} +0 -0
- /package/client/dist/assets/{agentstudio-BdidyBzZ.js → agentstudio-DpP9caEE.js} +0 -0
- /package/client/dist/assets/{agentstudio-BSnWLR63.js → agentstudio-Y3G0ddJ2.js} +0 -0
- /package/client/dist/assets/{agentstudio-BADhZ41e.js → agentstudio-kk9RB7Se.js} +0 -0
- /package/client/dist/assets/{aiedit-DJMny-D5.js → aiedit-5ETerMK1.js} +0 -0
- /package/client/dist/assets/{aiedit-D2ji6Qy0.js → aiedit-BBCrOpHq.js} +0 -0
- /package/client/dist/assets/{aiedit-DAhZTvtk.js → aiedit-BMtcGYNE.js} +0 -0
- /package/client/dist/assets/{aiedit-DvrcbwGv.js → aiedit-D9ddlgkM.js} +0 -0
- /package/client/dist/assets/{aiedit-WBSjT_C1.js → aiedit-De0SOH6S.js} +0 -0
- /package/client/dist/assets/{aiedit-BWxHGsYA.js → aiedit-DrfzQroF.js} +0 -0
- /package/client/dist/assets/{aiedit-DOcxERkU.js → aiedit-fMltW101.js} +0 -0
- /package/client/dist/assets/{analytics-C9Zc-rkM.js → analytics-BeTyviO8.js} +0 -0
- /package/client/dist/assets/{analytics-CrPCZRJ-.js → analytics-C4eEO260.js} +0 -0
- /package/client/dist/assets/{analytics-CYj0tfj7.js → analytics-C67cIA1b.js} +0 -0
- /package/client/dist/assets/{analytics-C6EzgtdE.js → analytics-CAguvW28.js} +0 -0
- /package/client/dist/assets/{analytics-CVx3YOc0.js → analytics-DBtt8Mgk.js} +0 -0
- /package/client/dist/assets/{analytics-CnY4kNG3.js → analytics-DUPtODxX.js} +0 -0
- /package/client/dist/assets/{analytics-BIdr0YfL.js → analytics-YIpQvPAc.js} +0 -0
- /package/client/dist/assets/{apex-Cw8_REBo.js → apex-BLUBIldB.js} +0 -0
- /package/client/dist/assets/{attachments-DYHGA2Dj.js → attachments-CCWasu-P.js} +0 -0
- /package/client/dist/assets/{attachments-Dd92KpUH.js → attachments-CHaDUfjB.js} +0 -0
- /package/client/dist/assets/{attachments-DzdU6DV6.js → attachments-CVSAbGNl.js} +0 -0
- /package/client/dist/assets/{attachments-Bcf6BG6V.js → attachments-Chg5poG1.js} +0 -0
- /package/client/dist/assets/{attachments-BW4L3l2L.js → attachments-DazTVJbH.js} +0 -0
- /package/client/dist/assets/{attachments-COcrGRFz.js → attachments-Dn-JImAK.js} +0 -0
- /package/client/dist/assets/{attachments-Bke8sCU4.js → attachments-LDA9kp2X.js} +0 -0
- /package/client/dist/assets/{azcli-Cz6HAoOw.js → azcli-DuWxh9mO.js} +0 -0
- /package/client/dist/assets/{bat-CcJ-xyqL.js → bat-UKoTejQm.js} +0 -0
- /package/client/dist/assets/{bicep-z1WDCKYz.js → bicep-4sTT4B3D.js} +0 -0
- /package/client/dist/assets/{browser-DGITz3fC.js → browser-BDd1dbFa.js} +0 -0
- /package/client/dist/assets/{browser-JsAIGCEW.js → browser-BWSgbfdX.js} +0 -0
- /package/client/dist/assets/{browser-M5-rbPlw.js → browser-D2Y_UAKA.js} +0 -0
- /package/client/dist/assets/{browser-BlYF4OOq.js → browser-DH9SGVfM.js} +0 -0
- /package/client/dist/assets/{browser-Bc-YdlVg.js → browser-DWOVYMlg.js} +0 -0
- /package/client/dist/assets/{browser-CT-ReZGt.js → browser-Dxc_VIRK.js} +0 -0
- /package/client/dist/assets/{browser-5ErDlJoR.js → browser-lTQwcDCI.js} +0 -0
- /package/client/dist/assets/{cameligo-BRewOpfa.js → cameligo-CAAryRYO.js} +0 -0
- /package/client/dist/assets/{chat-DwUm6W9z.js → chat-BO9MvVID.js} +0 -0
- /package/client/dist/assets/{chat-BEGuC03z.js → chat-CPgmgZOj.js} +0 -0
- /package/client/dist/assets/{chat-CboQguCi.js → chat-CUrG1eVg.js} +0 -0
- /package/client/dist/assets/{chat-DRCa9pOt.js → chat-CvOOKB2s.js} +0 -0
- /package/client/dist/assets/{chat-BEW60P_u.js → chat-DIh3hr6y.js} +0 -0
- /package/client/dist/assets/{chat-yoXwguQu.js → chat-UVVZqA57.js} +0 -0
- /package/client/dist/assets/{chat-BQNMD0PL.js → chat-mPn3UlMl.js} +0 -0
- /package/client/dist/assets/{clojure-DBjRWN6g.js → clojure-BlMERO1w.js} +0 -0
- /package/client/dist/assets/{clsx-DnqN-uhr.js → clsx-CnH-HMk3.js} +0 -0
- /package/client/dist/assets/{coffee-Cfk_XHGR.js → coffee-Cj8D-Wl1.js} +0 -0
- /package/client/dist/assets/{commands-sqrqsxyE.js → commands-B-MVT-2F.js} +0 -0
- /package/client/dist/assets/{commands-UD1NzmwX.js → commands-B0yFTp7e.js} +0 -0
- /package/client/dist/assets/{commands-DLrvnPNg.js → commands-BR1kDkHQ.js} +0 -0
- /package/client/dist/assets/{commands-CJxCry-o.js → commands-Cb21pDlG.js} +0 -0
- /package/client/dist/assets/{commands-CfgY-_of.js → commands-DWgp-8W1.js} +0 -0
- /package/client/dist/assets/{commands-B772IyDa.js → commands-ddsl1V91.js} +0 -0
- /package/client/dist/assets/{commands-BDDp6xFG.js → commands-t4frzhB0.js} +0 -0
- /package/client/dist/assets/{common-Dmm1GhdD.js → common-5ilvMOcH.js} +0 -0
- /package/client/dist/assets/{common-DltqHaAe.js → common-B4sqsKp7.js} +0 -0
- /package/client/dist/assets/{common-GbpxfPG8.js → common-BKpVwUIf.js} +0 -0
- /package/client/dist/assets/{common-DeDELLZJ.js → common-BzEC3kJU.js} +0 -0
- /package/client/dist/assets/{common-DnjcgkPH.js → common-CALKUpYm.js} +0 -0
- /package/client/dist/assets/{common-Dard9UNH.js → common-CTEbWVZS.js} +0 -0
- /package/client/dist/assets/{common-DCr6VzJ7.js → common-DQiza2Xp.js} +0 -0
- /package/client/dist/assets/{cpp-BVob6BaP.js → cpp-BPfKnaj_.js} +0 -0
- /package/client/dist/assets/{csharp-C4fbRuOu.js → csharp-gX-x5uD6.js} +0 -0
- /package/client/dist/assets/{csp-DthFP_vT.js → csp-DKGVt8SM.js} +0 -0
- /package/client/dist/assets/{css-CGMH0hcW.js → css-CPMdnAVq.js} +0 -0
- /package/client/dist/assets/{cypher-Pnf68BRV.js → cypher-ClMDrj9S.js} +0 -0
- /package/client/dist/assets/{dart-PMMOtxZX.js → dart-C4zbzpVv.js} +0 -0
- /package/client/dist/assets/{dashboard-BZBADHSj.js → dashboard--Y6yzMlf.js} +0 -0
- /package/client/dist/assets/{dashboard-I19DXBxw.js → dashboard--a4-6oYE.js} +0 -0
- /package/client/dist/assets/{dashboard-CB6Le1yN.js → dashboard-BiJ3CDTG.js} +0 -0
- /package/client/dist/assets/{dashboard-B4ixDVk8.js → dashboard-CiXjk63Z.js} +0 -0
- /package/client/dist/assets/{dashboard-C1MfeUHs.js → dashboard-Cx5VjCea.js} +0 -0
- /package/client/dist/assets/{dashboard-C7SK6xu5.js → dashboard-D7jg25XR.js} +0 -0
- /package/client/dist/assets/{dashboard-CoTpMOBM.js → dashboard-DpGYK2s1.js} +0 -0
- /package/client/dist/assets/{dockerfile-di1nsJCc.js → dockerfile-D9xw73D1.js} +0 -0
- /package/client/dist/assets/{ecl-D_WVcB5M.js → ecl-gqO8tIR9.js} +0 -0
- /package/client/dist/assets/{editor.api2-XLGzZfbc.js → editor.api2-BPnIxMjz.js} +0 -0
- /package/client/dist/assets/{elixir-OAdJEMOn.js → elixir-DSAhVF3_.js} +0 -0
- /package/client/dist/assets/{explore-D2EFgt8J.js → explore-BE5UmlbD.js} +0 -0
- /package/client/dist/assets/{explore-BV5Xxlsn.js → explore-BmTaI8dX.js} +0 -0
- /package/client/dist/assets/{explore-A8Ltoblq.js → explore-CCwkqoWq.js} +0 -0
- /package/client/dist/assets/{explore-4mFpnrKU.js → explore-CMdEoPDx.js} +0 -0
- /package/client/dist/assets/{explore-C3FSE42C.js → explore-CtdCL4QU.js} +0 -0
- /package/client/dist/assets/{explore-B9A3iN2W.js → explore-DHjxSkqQ.js} +0 -0
- /package/client/dist/assets/{explore-BrBJvfjP.js → explore-__BeALjE.js} +0 -0
- /package/client/dist/assets/{flow9-D3QEZjgn.js → flow9-DeQCSPOd.js} +0 -0
- /package/client/dist/assets/{format-command-CwGuwzGA.js → format-command-2VNoNnMv.js} +0 -0
- /package/client/dist/assets/{fsharp-BF0k_8N8.js → fsharp-CEfaXL-S.js} +0 -0
- /package/client/dist/assets/{go-BAQO5Jsz.js → go-Xp1OkZCh.js} +0 -0
- /package/client/dist/assets/{graphql-hdFVFkiV.js → graphql-BwRXrUwe.js} +0 -0
- /package/client/dist/assets/{hcl-DWnl1o-X.js → hcl-u06DtVFk.js} +0 -0
- /package/client/dist/assets/{ini-CB-6OVu3.js → ini-AmeIpFND.js} +0 -0
- /package/client/dist/assets/{java-d1CmfiHX.js → java-CyDbRQjX.js} +0 -0
- /package/client/dist/assets/{jobs-DPPT6bV6.js → jobs-8viuHLDV.js} +0 -0
- /package/client/dist/assets/{jobs-3j3_npyo.js → jobs-AW2eB5D-.js} +0 -0
- /package/client/dist/assets/{jobs-2N3RXDAM.js → jobs-BSm89DL5.js} +0 -0
- /package/client/dist/assets/{jobs-BqEbCCxD.js → jobs-BZ3sQHjZ.js} +0 -0
- /package/client/dist/assets/{jobs-cHYInoau.js → jobs-Bd8AdOTb.js} +0 -0
- /package/client/dist/assets/{jobs-DRzjWI9u.js → jobs-CRtsq_u0.js} +0 -0
- /package/client/dist/assets/{jobs-2f6Hdc72.js → jobs-CSRwFQ6K.js} +0 -0
- /package/client/dist/assets/{jobs-vGfzIDQa.js → jobs-CbEl7WMI.js} +0 -0
- /package/client/dist/assets/{julia-Bgv08lKa.js → julia-BqialFRG.js} +0 -0
- /package/client/dist/assets/{kotlin-u98kaVTf.js → kotlin-Dzz8TWAt.js} +0 -0
- /package/client/dist/assets/{less-CjYwpgg5.js → less-DHRJD3TR.js} +0 -0
- /package/client/dist/assets/{lexon-YTjaAFBB.js → lexon-5Y3QgTmT.js} +0 -0
- /package/client/dist/assets/{lua-BzmkWv27.js → lua-sKvhfPn5.js} +0 -0
- /package/client/dist/assets/{m3-CFwk9fw0.js → m3-DWDVwkFG.js} +0 -0
- /package/client/dist/assets/{markdown-CR5iMpSZ.js → markdown-CD_aSBxW.js} +0 -0
- /package/client/dist/assets/{mips-CcEalc17.js → mips-687T03hg.js} +0 -0
- /package/client/dist/assets/{msdax-BQbkawnr.js → msdax-C1St-dIV.js} +0 -0
- /package/client/dist/assets/{mysql-GTlaaW_P.js → mysql-BG7r8oBS.js} +0 -0
- /package/client/dist/assets/{nav-C2YXcbZS.js → nav-B05EYB0b.js} +0 -0
- /package/client/dist/assets/{nav-D2bOGSEg.js → nav-BNGCq-0y.js} +0 -0
- /package/client/dist/assets/{nav-BEL3MTwK.js → nav-BRInPX8a.js} +0 -0
- /package/client/dist/assets/{nav-CtYwmMgu.js → nav-Bf87DRHD.js} +0 -0
- /package/client/dist/assets/{nav-iH1V5j6o.js → nav-BkVzzFpc.js} +0 -0
- /package/client/dist/assets/{nav-0fwkrgHt.js → nav-BzFLtS1W.js} +0 -0
- /package/client/dist/assets/{nav-ClzOE4mA.js → nav-DBDbQOYn.js} +0 -0
- /package/client/dist/assets/{nav-B_G-TJDW.js → nav-X9sVtUWC.js} +0 -0
- /package/client/dist/assets/{objective-c-Byu1T5if.js → objective-c-Ds1-m05L.js} +0 -0
- /package/client/dist/assets/{pascal-BrfzBfRm.js → pascal-BKK9FpIi.js} +0 -0
- /package/client/dist/assets/{pascaligo-BXXKFUeo.js → pascaligo-SRS3nwtO.js} +0 -0
- /package/client/dist/assets/{perl-B3OikKq-.js → perl-B2hTOlrF.js} +0 -0
- /package/client/dist/assets/{pgsql-CTsa0Acc.js → pgsql-DIQJYNpL.js} +0 -0
- /package/client/dist/assets/{php-DiQh3FUW.js → php-BEaVe8X2.js} +0 -0
- /package/client/dist/assets/{pla-92uH8Fzm.js → pla-oPLHpZ-Q.js} +0 -0
- /package/client/dist/assets/{postiats-BbeWkKUr.js → postiats-D_vzrAzD.js} +0 -0
- /package/client/dist/assets/{powerquery-DgDMzpsm.js → powerquery-BKG6w-FH.js} +0 -0
- /package/client/dist/assets/{powershell-BfdUUzaG.js → powershell-B3dLhDt4.js} +0 -0
- /package/client/dist/assets/{protobuf-BojW2ftW.js → protobuf-DC8SGjcl.js} +0 -0
- /package/client/dist/assets/{pug-BxqTg3IU.js → pug-D5E-4fI0.js} +0 -0
- /package/client/dist/assets/{qsharp-BX_A-MW9.js → qsharp-6vJAWv0x.js} +0 -0
- /package/client/dist/assets/{r-D9BMnxvJ.js → r-CDwsEcbM.js} +0 -0
- /package/client/dist/assets/{redis-5cJqEQJJ.js → redis-CuQbbESS.js} +0 -0
- /package/client/dist/assets/{redshift-d8BBqiwb.js → redshift-B9e1k-qI.js} +0 -0
- /package/client/dist/assets/{restructuredtext-C8a6yIcZ.js → restructuredtext-BiJ5IwaU.js} +0 -0
- /package/client/dist/assets/{ruby-egeh-6KX.js → ruby-B0UAHY9b.js} +0 -0
- /package/client/dist/assets/{rust-a3r9IInB.js → rust-Dg_spmFr.js} +0 -0
- /package/client/dist/assets/{sb-y8iRIDei.js → sb-DjU66I8Q.js} +0 -0
- /package/client/dist/assets/{scala-BPDK2AmK.js → scala-qvStIdfG.js} +0 -0
- /package/client/dist/assets/{scheme-BIWUEoOs.js → scheme-FstEk5Rh.js} +0 -0
- /package/client/dist/assets/{scss-CA-PSzwg.js → scss-w0U3rQLK.js} +0 -0
- /package/client/dist/assets/{settings-CTcwN9RE.js → settings-5tzo0Rn3.js} +0 -0
- /package/client/dist/assets/{settings-D_dujJZI.js → settings-BDAW3trC.js} +0 -0
- /package/client/dist/assets/{settings-Bg0A3zoS.js → settings-BEWv3VEu.js} +0 -0
- /package/client/dist/assets/{settings-BgPqg2nv.js → settings-BORg56um.js} +0 -0
- /package/client/dist/assets/{settings-BSze3_9q.js → settings-D3LurcR5.js} +0 -0
- /package/client/dist/assets/{settings-CSJ0ahZ8.js → settings-DcqWIEM6.js} +0 -0
- /package/client/dist/assets/{settings-DYIV89nV.js → settings-Dfz8QbZS.js} +0 -0
- /package/client/dist/assets/{settings-DDcfx_ca.js → settings-yMubjqYw.js} +0 -0
- /package/client/dist/assets/{shell--LiT1Bja.js → shell-DJ78wREd.js} +0 -0
- /package/client/dist/assets/{solidity-DdqZccZg.js → solidity-1aGIVsdX.js} +0 -0
- /package/client/dist/assets/{sophia-S6-YxNG_.js → sophia-40LqcGjB.js} +0 -0
- /package/client/dist/assets/{sparql-BSf5kMp2.js → sparql-Cz5dqG_g.js} +0 -0
- /package/client/dist/assets/{sql-D7KgjR8G.js → sql-64f62Ni4.js} +0 -0
- /package/client/dist/assets/{st-BnoDa-Ml.js → st-gJe2yG8J.js} +0 -0
- /package/client/dist/assets/{swift-DEUHTkUX.js → swift-C6ME22mv.js} +0 -0
- /package/client/dist/assets/{systemverilog-Tqb_KPnW.js → systemverilog-CEWz259w.js} +0 -0
- /package/client/dist/assets/{tcl-BmBFS2qq.js → tcl-CcLVIi3m.js} +0 -0
- /package/client/dist/assets/{terminal-Bje4ziIa.js → terminal-BYtreaaF.js} +0 -0
- /package/client/dist/assets/{terminal-CSONJOex.js → terminal-C0xx0SjA.js} +0 -0
- /package/client/dist/assets/{terminal-DeWzh6ys.js → terminal-CPpK58RC.js} +0 -0
- /package/client/dist/assets/{terminal-C2WYcFHF.js → terminal-CdxkpafL.js} +0 -0
- /package/client/dist/assets/{terminal-DEqzGtcr.js → terminal-Ciia0wh2.js} +0 -0
- /package/client/dist/assets/{terminal-80yDMgMF.js → terminal-DHIkiWcs.js} +0 -0
- /package/client/dist/assets/{terminal-lkZYR4wJ.js → terminal-DY42QANg.js} +0 -0
- /package/client/dist/assets/{terminal-YOlsJCQj.js → terminal-DoxtVdma.js} +0 -0
- /package/client/dist/assets/{tickets-DYvafSaY.js → tickets-0rM0lIXd.js} +0 -0
- /package/client/dist/assets/{tickets-DNOANUXr.js → tickets-1UIGf_oA.js} +0 -0
- /package/client/dist/assets/{tickets-DlpC_iTg.js → tickets-9kdPXInd.js} +0 -0
- /package/client/dist/assets/{tickets-CF2PYelu.js → tickets-C6pwZwt4.js} +0 -0
- /package/client/dist/assets/{tickets-CB7N30gm.js → tickets-DAjtxAVb.js} +0 -0
- /package/client/dist/assets/{tickets-DU1aqsbr.js → tickets-DNmXcAwu.js} +0 -0
- /package/client/dist/assets/{tickets-clefmXLv.js → tickets-n23kDqJT.js} +0 -0
- /package/client/dist/assets/{tickets-DucYgtdl.js → tickets-tGx5AR5b.js} +0 -0
- /package/client/dist/assets/{twig-BQV8igWC.js → twig-DvsO-WjW.js} +0 -0
- /package/client/dist/assets/{typespec-DlFroUGY.js → typespec-Brkt3IAA.js} +0 -0
- /package/client/dist/assets/{vb-BlrJpIMX.js → vb-r121Uzxt.js} +0 -0
- /package/client/dist/assets/{wgsl-BWgIc6FZ.js → wgsl-BRX8uYh4.js} +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-Dv6H7wEr.js","assets/chunk-CilyBKbf.js","assets/addspec-GWm4ffKl.js","assets/agents-CMxtJMLD.js","assets/agentstudio-CxlUllqI.js","assets/aiedit-TTwzL1TS.js","assets/analytics-DMCto-TF.js","assets/attachments-BIsSSnHJ.js","assets/browser-Qya9cARy.js","assets/chat-BsbNGPW9.js","assets/code-CY85RXZU.js","assets/commands-IXMOKBYt.js","assets/common-wA36jmj1.js","assets/dashboard-Duo4DDCW.js","assets/explore-hFc3HFcp.js","assets/integrations-BqUmRUef.js","assets/jira-C-ATCti0.js","assets/jobs-Bd8AdOTb.js","assets/nav-BRInPX8a.js","assets/settings-yMubjqYw.js","assets/setup-C0dzw8j4.js","assets/specs-4lA_u79w.js","assets/terminal-C0xx0SjA.js","assets/tickets-tGx5AR5b.js","assets/addon-image-CpF0L0jM.js","assets/addon-ligatures-hXysGZrA.js","assets/addon-webgl-Cn1slavz.js","assets/JobDetailPage-DN2Jc8Ti.js","assets/lib-Bro9Z0gp.js","assets/format-command-2VNoNnMv.js","assets/JobsPage-DmdpqijT.js","assets/ExportDropdown-f4dwQjlT.js","assets/useProjectCache-D9juBhsO.js","assets/AnalyticsPage-BUd3gWYC.js","assets/BarChart-HDe_YoUD.js","assets/clsx-CnH-HMk3.js","assets/ActivityFeedPage-DJJlZ3mF.js","assets/AgentsPage-49JaEDjR.js","assets/CodePage-CqPPND47.js","assets/preload-helper-DSXbuxSR.js","assets/IntegrationsPage-CX2Ybxx0.js","assets/DesktopAnalyticsPage-CgvmSvF0.js","assets/DocsPage-B4R1aksg.js","assets/atom-one-dark-B-oHczHB.css","assets/DocsDialog-hHFd3Ejs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./chunk-CilyBKbf.js";import{t as r}from"./preload-helper-DSXbuxSR.js";import{t as i}from"./activity-Dv6H7wEr.js";import{t as a}from"./addspec-GWm4ffKl.js";import{t as o}from"./agents-CMxtJMLD.js";import{t as s}from"./agentstudio-CxlUllqI.js";import{t as c}from"./aiedit-TTwzL1TS.js";import{t as l}from"./analytics-DMCto-TF.js";import{t as u}from"./attachments-BIsSSnHJ.js";import{t as d}from"./browser-Qya9cARy.js";import{t as f}from"./chat-BsbNGPW9.js";import{t as p}from"./code-CY85RXZU.js";import{t as m}from"./commands-IXMOKBYt.js";import{t as h}from"./common-wA36jmj1.js";import{t as g}from"./dashboard-Duo4DDCW.js";import{t as _}from"./explore-hFc3HFcp.js";import{t as v}from"./integrations-BqUmRUef.js";import{t as y}from"./jira-C-ATCti0.js";import{t as b}from"./jobs-Bd8AdOTb.js";import{t as x}from"./nav-BRInPX8a.js";import{t as S}from"./settings-yMubjqYw.js";import{t as C}from"./setup-C0dzw8j4.js";import{t as w}from"./specs-4lA_u79w.js";import{t as T}from"./terminal-C0xx0SjA.js";import{t as E}from"./tickets-tGx5AR5b.js";import{t as D}from"./clsx-CnH-HMk3.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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var O=n((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.4`})),k=n(((e,t)=>{t.exports=O()})),A=n((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}}}})),j=n(((e,t)=>{t.exports=A()})),M=n((e=>{var t=k();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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(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=i,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 o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.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,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,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=c(t.as,t.crossOrigin);i.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??i.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=c(n,t.crossOrigin);i.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=c(t.as,t.crossOrigin);i.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 i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),N=n(((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=M()})),P=n((e=>{var t=j(),n=k(),r=N();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(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 l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case T: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=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},te=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=te[R],te[R]=null,R--)}function V(e,t){R++,te[R]=e.current,e.current=t}var ne=z(null),H=z(null),U=z(null),re=z(null);function ie(e,t){switch(V(U,t),V(H,e),V(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(ne),V(ne,e)}function W(){B(ne),B(H),B(U)}function ae(e){e.memoizedState!==null&&V(re,e);var t=ne.current,n=Kd(t,e.type);t!==n&&(V(H,e),V(ne,n))}function oe(e){H.current===e&&(B(ne),B(H)),re.current===e&&(B(re),np._currentValue=ee)}var se,ce;function le(e){if(se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);se=t&&t[1]||``,ce=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+se+e+ce}var ue=!1;function de(e,t){if(!e||ue)return``;ue=!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{ue=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?le(n):``}function fe(e,t){switch(e.tag){case 26:case 27:case 5:return le(e.type);case 16:return le(`Lazy`);case 13:return e.child!==t&&t!==null?le(`Suspense Fallback`):le(`Suspense`);case 19:return le(`SuspenseList`);case 0:case 15:return de(e.type,!1);case 11:return de(e.type.render,!1);case 1:return de(e.type,!0);case 31:return le(`Activity`);default:return``}}function pe(e){try{var t=``,n=null;do t+=fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var me=Object.prototype.hasOwnProperty,he=t.unstable_scheduleCallback,ge=t.unstable_cancelCallback,_e=t.unstable_shouldYield,ve=t.unstable_requestPaint,ye=t.unstable_now,be=t.unstable_getCurrentPriorityLevel,xe=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Ce=t.unstable_NormalPriority,we=t.unstable_LowPriority,Te=t.unstable_IdlePriority,Ee=t.log,De=t.unstable_setDisableYieldValue,Oe=null,ke=null;function Ae(e){if(typeof Ee==`function`&&De(e),ke&&typeof ke.setStrictMode==`function`)try{ke.setStrictMode(Oe,e)}catch{}}var je=Math.clz32?Math.clz32:Pe,Me=Math.log,Ne=Math.LN2;function Pe(e){return e>>>=0,e===0?32:31-(Me(e)/Ne|0)|0}var Fe=256,Ie=262144,Le=4194304;function Re(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 ze(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=Re(n))):i=Re(o):i=Re(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Re(n))):i=Re(o)):i=Re(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 Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(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 He(){var e=Le;return Le<<=1,!(Le&62914560)&&(Le=4194304),e}function Ue(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function We(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ge(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-je(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&&Ke(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ke(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Je(e,t){var n=t&-t;return n=n&42?1:Ye(n),(n&(e.suspendedLanes|t))===0?n:0}function Ye(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 Xe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ze(){var e=L.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function Qe(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var $e=Math.random().toString(36).slice(2),et=`__reactFiber$`+$e,tt=`__reactProps$`+$e,nt=`__reactContainer$`+$e,rt=`__reactEvents$`+$e,it=`__reactListeners$`+$e,at=`__reactHandles$`+$e,ot=`__reactResources$`+$e,st=`__reactMarker$`+$e;function ct(e){delete e[et],delete e[tt],delete e[rt],delete e[it],delete e[at]}function lt(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nt]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[et])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function ut(e){if(e=e[et]||e[nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function dt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ft(e){var t=e[ot];return t||=e[ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function pt(e){e[st]=!0}var mt=new Set,ht={};function gt(e,t){_t(e,t),_t(e+`Capture`,t)}function _t(e,t){for(ht[e]=t,e=0;e<t.length;e++)mt.add(t[e])}var vt=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]*$`),yt={},bt={};function xt(e){return me.call(bt,e)?!0:me.call(yt,e)?!1:vt.test(e)?bt[e]=!0:(yt[e]=!0,!1)}function St(e,t,n){if(xt(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 Ct(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 wt(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 Tt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Et(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Dt(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 Ot(e){if(!e._valueTracker){var t=Et(e)?`checked`:`value`;e._valueTracker=Dt(e,t,``+e[t])}}function kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Et(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function At(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 jt=/[\n"\\]/g;function Mt(e){return e.replace(jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Nt(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=``+Tt(t)):e.value!==``+Tt(t)&&(e.value=``+Tt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ft(e,o,Tt(n)):Ft(e,o,Tt(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=``+Tt(s):e.removeAttribute(`name`)}function Pt(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)){Ot(e);return}n=n==null?``:``+Tt(n),t=t==null?n:``+Tt(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),Ot(e)}function Ft(e,t,n){t===`number`&&At(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function It(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=``+Tt(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 Lt(e,t,n){if(t!=null&&(t=``+Tt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Tt(n)}function Rt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Tt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ot(e)}function zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bt=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 Vt(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||Bt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ht(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(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 a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Vt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Vt(e,o,t[o])}function Ut(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 Wt=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`]]),Gt=/^[\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 Kt(e){return Gt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function qt(){}var Jt=null;function Yt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xt=null,Zt=null;function Qt(e){var t=ut(e);if(t&&(e=t.stateNode)){var n=e[tt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Nt(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="`+Mt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[tt]||null;if(!a)throw Error(i(90));Nt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&kt(r)}break a;case`textarea`:Lt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&It(e,!!n.multiple,t,!1)}}}var $t=!1;function en(e,t,n){if($t)return e(t,n);$t=!0;try{return e(t)}finally{if($t=!1,(Xt!==null||Zt!==null)&&(Cu(),Xt&&(t=Xt,e=Zt,Zt=Xt=null,Qt(t),e)))for(t=0;t<e.length;t++)Qt(e[t])}}function tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[tt]||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(i(231,t,typeof n));return n}var nn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,`passive`,{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,cn=null;function ln(){if(cn)return cn;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.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 cn=i.slice(e,1<r?1-r:void 0)}function un(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 dn(){return!0}function fn(){return!1}function pn(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)?dn:fn,this.isPropagationStopped=fn,this}return f(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=dn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=dn)},persist:function(){},isPersistent:dn}),t}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hn=pn(mn),gn=f({},mn,{view:0,detail:0}),_n=pn(gn),vn,yn,bn,xn=f({},gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mn,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!==bn&&(bn&&e.type===`mousemove`?(vn=e.screenX-bn.screenX,yn=e.screenY-bn.screenY):yn=vn=0,bn=e),vn)},movementY:function(e){return`movementY`in e?e.movementY:yn}}),Sn=pn(xn),Cn=pn(f({},xn,{dataTransfer:0})),wn=pn(f({},gn,{relatedTarget:0})),Tn=pn(f({},mn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=pn(f({},mn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Dn=pn(f({},mn,{data:0})),On={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},kn={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`},An={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=An[e])?!!t[e]:!1}function Mn(){return jn}var Nn=pn(f({},gn,{key:function(e){if(e.key){var t=On[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=un(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mn,charCode:function(e){return e.type===`keypress`?un(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?un(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Pn=pn(f({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Fn=pn(f({},gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mn})),In=pn(f({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Ln=pn(f({},xn,{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})),Rn=pn(f({},mn,{newState:0,oldState:0})),zn=[9,13,27,32],Bn=nn&&`CompositionEvent`in window,Vn=null;nn&&`documentMode`in document&&(Vn=document.documentMode);var Hn=nn&&`TextEvent`in window&&!Vn,Un=nn&&(!Bn||Vn&&8<Vn&&11>=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return zn.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 Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=ln(),cn=sn=on=null,Jn=!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 Un&&t.locale!==`ko`?null:t.data;default:return null}}var Zn={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 Qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Zn[e.type]:t===`textarea`}function $n(e,t,n,r){Xt?Zt?Zt.push(r):Zt=[r]:Xt=r,t=Ad(t,`onChange`),0<t.length&&(n=new hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var er=null,tr=null;function nr(e){Sd(e,0)}function rr(e){if(kt(dt(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(nn){var or;if(nn){var sr=`oninput`in document;if(!sr){var cr=document.createElement(`div`);cr.setAttribute(`oninput`,`return;`),sr=typeof cr.oninput==`function`}or=sr}else or=!1;ar=or&&(!document.documentMode||9<document.documentMode)}function lr(){er&&(er.detachEvent(`onpropertychange`,ur),tr=er=null)}function ur(e){if(e.propertyName===`value`&&rr(tr)){var t=[];$n(t,tr,e,Yt(e)),en(nr,t)}}function dr(e,t,n){e===`focusin`?(lr(),er=t,tr=n,er.attachEvent(`onpropertychange`,ur)):e===`focusout`&&lr()}function fr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(tr)}function pr(e,t){if(e===`click`)return rr(t)}function mr(e,t){if(e===`input`||e===`change`)return rr(t)}function hr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var gr=typeof Object.is==`function`?Object.is:hr;function _r(e,t){if(gr(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(!me.call(t,i)||!gr(e[i],t[i]))return!1}return!0}function vr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yr(e,t){var n=vr(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=vr(n)}}function br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=At(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=At(e.document)}return t}function Sr(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 Cr=nn&&`documentMode`in document&&11>=document.documentMode,wr=null,Tr=null,Er=null,Dr=!1;function Or(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Dr||wr==null||wr!==At(r)||(r=wr,`selectionStart`in r&&Sr(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}),Er&&_r(Er,r)||(Er=r,r=Ad(Tr,`onSelect`),0<r.length&&(t=new hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ar={animationend:kr(`Animation`,`AnimationEnd`),animationiteration:kr(`Animation`,`AnimationIteration`),animationstart:kr(`Animation`,`AnimationStart`),transitionrun:kr(`Transition`,`TransitionRun`),transitionstart:kr(`Transition`,`TransitionStart`),transitioncancel:kr(`Transition`,`TransitionCancel`),transitionend:kr(`Transition`,`TransitionEnd`)},jr={},Mr={};nn&&(Mr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ar.animationend.animation,delete Ar.animationiteration.animation,delete Ar.animationstart.animation),`TransitionEvent`in window||delete Ar.transitionend.transition);function Nr(e){if(jr[e])return jr[e];if(!Ar[e])return e;var t=Ar[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Mr)return jr[e]=t[n];return e}var Pr=Nr(`animationend`),Fr=Nr(`animationiteration`),Ir=Nr(`animationstart`),Lr=Nr(`transitionrun`),Rr=Nr(`transitionstart`),zr=Nr(`transitioncancel`),Br=Nr(`transitionend`),Vr=new Map,Hr=`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(` `);Hr.push(`scrollEnd`);function Ur(e,t){Vr.set(e,t),gt(t,[e])}var Wr=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)},Gr=[],Kr=0,qr=0;function Jr(){for(var e=Kr,t=qr=Kr=0;t<e;){var n=Gr[t];Gr[t++]=null;var r=Gr[t];Gr[t++]=null;var i=Gr[t];Gr[t++]=null;var a=Gr[t];if(Gr[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&&Qr(n,i,a)}}function Yr(e,t,n,r){Gr[Kr++]=e,Gr[Kr++]=t,Gr[Kr++]=n,Gr[Kr++]=r,qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xr(e,t,n,r){return Yr(e,t,n,r),$r(e)}function Zr(e,t){return Yr(e,null,null,t),$r(e)}function Qr(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-je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function $r(e){if(50<mu)throw mu=0,hu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ei={};function ti(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 ni(e,t,n,r){return new ti(e,t,n,r)}function ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ii(e,t){var n=e.alternate;return n===null?(n=ni(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 ai(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 oi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ri(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,ne.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case E:return e=ni(31,n,t,a),e.elementType=E,e.lanes=o,e;case g:return si(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=ni(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=ni(13,n,t,a),e.elementType=S,e.lanes=o,e;case C:return e=ni(19,n,t,a),e.elementType=C,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case w:s=14;break a;case T:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ni(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function si(e,t,n,r){return e=ni(7,e,r,t),e.lanes=n,e}function ci(e,t,n){return e=ni(6,e,null,t),e.lanes=n,e}function li(e){var t=ni(18,null,null,0);return t.stateNode=e,t}function ui(e,t,n){return t=ni(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var di=new WeakMap;function fi(e,t){if(typeof e==`object`&&e){var n=di.get(e);return n===void 0?(t={value:e,source:t,stack:pe(t)},di.set(e,t),t):n}return{value:e,source:t,stack:pe(t)}}var pi=[],mi=0,hi=null,gi=0,_i=[],vi=0,yi=null,bi=1,xi=``;function Si(e,t){pi[mi++]=gi,pi[mi++]=hi,hi=e,gi=t}function Ci(e,t,n){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,yi=e;var r=bi;e=xi;var i=32-je(r)-1;r&=~(1<<i),n+=1;var a=32-je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-je(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===hi;)hi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null;for(;e===yi;)yi=_i[--vi],_i[vi]=null,xi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null}function Ei(e,t){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,bi=t.id,xi=t.overflow,yi=e}var Di=null,Oi=null,ki=!1,Ai=null,ji=!1,Mi=Error(i(519));function Ni(e){throw zi(fi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Mi}function Pi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[et]=e,t[tt]=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),Pt(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),Rt(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=qt),t=!0):t=!1,t||Ni(e,!0)}function Fi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Di=Di.return}}function Ii(e){if(e!==Di)return!1;if(!ki)return Fi(e),ki=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Oi&&Ni(e),Fi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=mf(e)}else t===27?(t=Oi,tf(e.type)?(e=pf,pf=null,Oi=e):Oi=t):Oi=Di?ff(e.stateNode.nextSibling):null;return!0}function Li(){Oi=Di=null,ki=!1}function Ri(){var e=Ai;return e!==null&&(eu===null?eu=e:eu.push.apply(eu,e),Ai=null),e}function zi(e){Ai===null?Ai=[e]:Ai.push(e)}var Bi=z(null),Vi=null,Hi=null;function Ui(e,t,n){V(Bi,t._currentValue),t._currentValue=n}function Wi(e){e._currentValue=Bi.current,B(Bi)}function Gi(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 G(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Gi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Gi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ki(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;gr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===re.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}a=a.return}e!==null&&G(t,e,n,r),t.flags|=262144}function qi(e){for(e=e.firstContext;e!==null;){if(!gr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ji(e){Vi=e,Hi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yi(e){return Zi(Vi,e)}function Xi(e,t){return Vi===null&&Ji(e),Zi(e,t)}function Zi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Hi===null){if(e===null)throw Error(i(308));Hi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Hi=Hi.next=t;return n}var Qi=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()})}},$i=t.unstable_scheduleCallback,ea=t.unstable_NormalPriority,ta={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function na(){return{controller:new Qi,data:new Map,refCount:0}}function ra(e){e.refCount--,e.refCount===0&&$i(ea,function(){e.controller.abort()})}var ia=null,aa=0,K=0,oa=null;function sa(e,t){if(ia===null){var n=ia=[];aa=0,K=J(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return aa++,t.then(ca,ca),t}function ca(){if(--aa===0&&ia!==null){oa!==null&&(oa.status=`fulfilled`);var e=ia;ia=null,K=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(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 ua=I.S;I.S=function(e,t){ru=ye(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=z(null);function fa(){var e=da.current;return e===null?Rl.pooledCache:e}function pa(e,t){t===null?V(da,da.current):V(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ta._currentValue,pool:e}}var ha=Error(i(460)),ga=Error(i(474)),_a=Error(i(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qt,qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(qt,qt);else{if(e=Rl,e!==null&&100<e.shellSuspendCounter)throw Error(i(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,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(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 a(e,t){return e=ii(e,t),e.index=0,e.sibling=null,e}function o(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=ci(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===T&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=oi(n.type,n.key,n.props,null,e.mode,r),Oa(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=ui(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=si(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ci(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=oi(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case h:return t=ui(t,e.mode,n),t.return=e,t;case T:return t=xa(t),f(e,t,n)}if(F(t)||A(t))return t=si(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===b)return f(e,Xi(e,t),n);ka(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 m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case T:return n=xa(n),p(e,t,n,r)}if(F(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===b)return p(e,t,Xi(e,n),r);ka(e,n)}return null}function _(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 m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case T:return r=xa(r),_(e,t,n,r,i)}if(F(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Da(r),i);if(r.$$typeof===b)return _(e,t,n,Xi(t,r),i);ka(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),ki&&Si(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return ki&&Si(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),ki&&Si(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),ki&&Si(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return ki&&Si(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),ki&&Si(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=si(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=oi(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ui(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=xa(o),x(e,r,o,c)}if(F(o))return v(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Da(o),c);if(o.$$typeof===b)return x(e,r,Xi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ci(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=x(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(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 Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ll&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$r(e),Qr(e,null,n),t}return Yr(e,r,t,n),$r(e)}function Ra(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,qe(e,n)}}function za(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 Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!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 p=s.lane&-536870913,m=p!==s.lane;if(m?(Bl&p)===p:(r&p)===p){p!==0&&p===K&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Na=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,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 Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=z(null),Ka=z(0);function qa(e,t){e=Kl,V(Ka,e),V(Ga,t),Kl=e|t.baseLanes}function Ja(){V(Ka,Kl),V(Ga,Ga.current)}function Ya(){Kl=Ka.current,B(Ga),B(Ka)}var Xa=z(null),Za=null;function Qa(e){var t=e.alternate;V(ro,ro.current&1),V(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){V(ro,ro.current),V(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(V(ro,ro.current),V(Xa,e),Za===null&&(Za=e)):to(e)}function to(){V(ro,ro.current),V(Xa,Xa.current)}function no(e){B(Xa),Za===e&&(Za=null),B(ro)}var ro=z(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(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 ao=0,oo=null,so=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return ao=a,oo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Is:Ls,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){I.H=Fs;var t=so!==null&&so.next!==null;if(ao=0,co=so=oo=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||ec||(e=e.dependencies,e!==null&&qi(e)&&(ec=!0))}function xo(e,t,n,r){oo=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,co=so=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=Rs,o=t(n,r)}while(uo);return o}function So(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(so===null?null:so.memoizedState)!==e&&(oo.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}ao=0,co=so=oo=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?oo.memoizedState=co=e:co=co.next=e,co}function Do(){if(so===null){var e=oo.alternate;e=e===null?null:e.memoizedState}else e=so.next;var t=co===null?oo.memoizedState:co.next;if(t!==null)co=t,so=e;else{if(e===null)throw oo.alternate===null?Error(i(467)):Error(i(310));so=e,e={memoizedState:so.memoizedState,baseState:so.baseState,baseQueue:so.baseQueue,queue:so.queue,next:null},co===null?oo.memoizedState=co=e:co=co.next=e}return co}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=ba(ho,e,t),t=oo,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Is:Ls),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===b)return Yi(e)}throw Error(i(438,String(e)))}function jo(e){var t=null,n=oo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=oo.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=Oo(),oo.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]=D;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),so,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ao&f)===f:(Bl&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===K&&(d=!0);else if((ao&p)===p){u=u.next,p===K&&(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=o):l=l.next=f,oo.lanes|=p,Jl|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,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=o):l=l.next=p,oo.lanes|=f,Jl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!gr(o,e.memoizedState)&&(ec=!0,d&&(n=oa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);gr(o,t.memoizedState)||(ec=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=oo,a=Do(),o=ki;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!gr((so||a).memoizedState,n);if(s&&(a.memoizedState=n,ec=!0),a=a.queue,ss(zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),Rl===null)throw Error(i(349));o||ao&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=oo.updateQueue,t===null?(t=Oo(),oo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gr(e,n)}catch{return!0}}function Vo(e){var t=Zr(e,2);t!==null&&vu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){Ae(!0);try{n()}finally{Ae(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,so,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,a){if(Ms(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(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),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(ki){var n=Rl.formState;if(n!==null){a:{var r=oo;if(ki){if(Oi){b:{for(var i=Oi,a=ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Oi=ff(i.nextSibling),r=i.data===`F!`;break a}}Ni(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=ks.bind(null,oo,r),r.dispatch=n,r=Ho(!1),a=js.bind(null,oo,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,oo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(Do(),so,e)}function $o(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===ha?_a:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(oo.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=Do(),n=so;if(n!==null)return $o(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=oo.updateQueue,t===null&&(t=Oo(),oo.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 rs(){return Do().memoizedState}function is(e,t,n,r){var i=Eo();oo.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;so!==null&&r!==null&&vo(r,so.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(oo.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function os(e,t){is(8390656,8,e,t)}function ss(e,t){as(2048,8,e,t)}function cs(e){oo.flags|=4;var t=oo.updateQueue;if(t===null)t=Oo(),oo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ls(e){var t=Do().memoizedState;return cs({ref:t,nextImpl:e}),function(){if(Ll&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function us(e,t){return as(4,2,e,t)}function ds(e,t){return as(4,4,e,t)}function fs(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 ps(e,t,n){n=n==null?null:n.concat([e]),as(4,4,fs.bind(null,t,e),n)}function ms(){}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r}function _s(e,t,n){return n===void 0||ao&1073741824&&!(Bl&261930)?e.memoizedState=t:(e.memoizedState=n,e=_u(),oo.lanes|=e,Jl|=e,n)}function vs(e,t,n,r){return gr(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(Bl&261930)?(ec=!0,e.memoizedState=n):(e=_u(),oo.lanes|=e,Jl|=e,t):(e=_s(e,n,r),gr(e,t)||(ec=!0),e)}function ys(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,js(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,la(c,r),gu(e)):As(e,t,r,gu(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},gu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ss(e).queue;ys(e,a,t,ee,n===null?bs:function(){return Cs(e),n(r)})}function Ss(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:Mo,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},gu())}function ws(){return Yi(np)}function Ts(){return Do().memoizedState}function Es(){return Do().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gu();e=Ia(n);var r=La(t,e,n);r!==null&&(vu(r,t,n),Ra(r,t,n)),t={cache:na()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=gu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=Xr(e,t,n,r),n!==null&&(vu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,gu())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(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,gr(s,o))return Yr(e,t,i,0),Rl===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return vu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:J(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(i(479))}else t=Xr(e,n,r,2),t!==null&&vu(t,e,2)}function Ms(e){var t=e.alternate;return e===oo||t!==null&&t===oo}function Ns(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}var Fs={readContext:Yi,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Fs.useEffectEvent=_o;var Is={readContext:Yi,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Yi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){Ae(!0);try{n(t)}finally{Ae(!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=Os.bind(null,oo,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=ks.bind(null,oo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=ys.bind(null,oo,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=oo,a=Eo();if(ki){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Rl===null)throw Error(i(349));Bl&127||Lo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,os(zo.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Rl.identifierPrefix;if(ki){var n=xi,r=bi;n=(r&~(1<<32-je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ws,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,oo,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Ds.bind(null,oo)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Ll&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ls={readContext:Yi,use:Ao,useCallback:hs,useContext:Yi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:No,useRef:rs,useState:function(){return No(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){return vs(Do(),so.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Uo(Do(),so,e,t)},useMemoCache:jo,useCacheRefresh:Es};Ls.useEffectEvent=ls;var Rs={readContext:Yi,use:Ao,useCallback:hs,useContext:Yi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Fo,useRef:rs,useState:function(){return Fo(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){var n=Do();return so===null?_s(n,e,t):vs(n,so.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=Do();return so===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,so,e,t)},useMemoCache:jo,useCacheRefresh:Es};Rs.useEffectEvent=ls;function zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(vu(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(vu(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(vu(t,e,n),Ra(t,e,n))}};function Vs(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?!_r(n,r)||!_r(i,a):!0}function Hs(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&&Bs.enqueueReplaceState(t,t.state,null)}function Us(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=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ws(e){Wr(e)}function Gs(e){console.error(e)}function Ks(e){Wr(e)}function qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Js(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 Ys(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){qs(e,t)},n}function Xs(e){return e=Ia(e),e.tag=3,e}function Zs(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(){Js(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Js(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 Qs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ki(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Au():n.alternate===null&&ql===0&&(ql=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Yu(e,r,a)),!1;case 22:return n.flags|=65536,r===va?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)),Yu(e,r,a)),!1}throw Error(i(435,n.tag))}return Yu(e,r,a),Au(),!1}if(ki)return t=Xa.current,t===null?(r!==Mi&&(t=Error(i(423),{cause:r}),zi(fi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=fi(r,n),a=Ys(e.stateNode,r,a),za(e,a),ql!==4&&(ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Mi&&(e=Error(i(422),{cause:r}),zi(fi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=fi(o,n),$l===null?$l=[o]:$l.push(o),ql!==4&&(ql=2),t===null)return!0;r=fi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ys(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(ou===null||!ou.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Xs(a),Zs(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var $s=Error(i(461)),ec=!1;function tc(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function nc(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 Ji(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(ki&&s&&wi(t),t.flags|=1,tc(e,t,r,i),t.child)}function rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ic(e,t,a,r,i)):(e=oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Dc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?_r:n,n(o,r)&&e.ref===t.ref)return Ec(e,t,i)}return t.flags|=1,e=ii(a,r),e.ref=t.ref,e.return=t,t.child=e}function ic(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(_r(a,r)&&e.ref===t.ref)if(ec=!1,t.pendingProps=r=a,Dc(e,i))e.flags&131072&&(ec=!0);else return t.lanes=e.lanes,Ec(e,t,i)}return fc(e,t,n,r,i)}function ac(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 sc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,sc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),to(t)):(pa(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return tc(e,t,i,n),t.child}function oc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sc(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ta._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),eo(t),e!==null&&Ki(e,t,r,!0),t.childLanes=i,null}function cc(e,t){return t=xc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function lc(e,t,n){return ja(t,e.child,null,n),e=cc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function uc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(ki){if(r.mode===`hidden`)return e=cc(t,r),t.lanes=536870912,oc(null,e);if($a(t),(e=Oi)?(e=cf(e,ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return t.lanes=536870912,null}return cc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if($a(t),a)if(t.flags&256)t.flags&=-257,t=lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ec||Ki(e,t,n,!1),a=(n&e.childLanes)!==0,ec||a){if(r=Rl,r!==null&&(s=Je(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Zr(e,s),vu(r,e,s),$s;Au(),t=lc(e,t,n)}else e=o.treeContext,Oi=ff(s.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=cc(t,r),t.flags|=4096;return t}return e=ii(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function dc(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(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function fc(e,t,n,r,i){return Ji(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(ki&&r&&wi(t),t.flags|=1,tc(e,t,n,i),t.child)}function pc(e,t,n,r,i,a){return Ji(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!ec?(wo(e,t,a),Ec(e,t,a)):(ki&&r&&wi(t),t.flags|=1,tc(e,t,n,a),t.child)}function mc(e,t,n,r,i){if(Ji(t),t.stateNode===null){var a=ei,o=n.contextType;typeof o==`object`&&o&&(a=Yi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Bs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Yi(o):ei,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(zs(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&&Bs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),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=Us(n,s);a.props=c;var l=a.context,u=n.contextType;o=ei,typeof u==`object`&&u&&(o=Yi(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)&&Hs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(zs(t,n,d,r),l=t.memoizedState),(c=Na||Vs(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,Fa(e,t),o=t.memoizedProps,u=Us(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ei,typeof l==`object`&&l&&(c=Yi(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)&&Hs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&qi(e.dependencies)?(typeof s==`function`&&(zs(t,n,s,r),p=t.memoizedState),(u=Na||Vs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&qi(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,dc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ec(e,t,i),e}function hc(e,t,n,r){return Li(),t.flags|=256,tc(e,t,n,r),t.child}var gc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _c(e){return{baseLanes:e,cachePool:ma()}}function vc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Zl),e}function yc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(ro.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(ki){if(a?Qa(t):to(t),(e=Oi)?(e=cf(e,ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(to(t),a=t.mode,c=xc({mode:`hidden`,children:c},a),r=si(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(null,r)):(Qa(t),bc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Qa(t),t.flags&=-257,t=Sc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,a=t.mode,r=xc({mode:`visible`,children:r.children},a),c=si(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,t=oc(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,zi({value:r,source:null,stack:null}),t=Sc(e,t,n)}else if(ec||Ki(e,t,n,!1),s=(n&e.childLanes)!==0,ec||s){if(s=Rl,s!==null&&(r=Je(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Zr(e,r),vu(s,e,r),$s;lf(c)||Au(),t=Sc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Oi=ff(c.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=bc(t,r.children),t.flags|=4096);return t}return a?(to(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ii(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=si(c,a,n,null),c.flags|=2):c=ii(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,oc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=_c(n):(a=c.cachePool,a===null?a=ma():(l=ta._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ii(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 bc(e,t){return t=xc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function xc(e,t){return e=ni(22,e,null,t),e.lanes=0,e}function Sc(e,t,n){return ja(t,e.child,null,n),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gi(e.return,t,n)}function wc(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 Tc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ro.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,V(ro,o),tc(e,t,r,n),r=ki?gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cc(e,n,t);else if(e.tag===19)Cc(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&&io(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),wc(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&&io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}wc(t,!0,n,null,a,r);break;case`together`:wc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ki(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Dc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&qi(e))):!0}function Oc(e,t,n){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),Ui(t,ta,e.memoizedState.cache),Li();break;case 27:case 5:ae(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:Ui(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$a(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Qa(t),e=Ec(e,t,n),e===null?null:e.sibling):yc(e,t,n):(Qa(t),t.flags|=128,null);Qa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Ki(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Tc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),V(ro,ro.current),r)break;return null;case 22:return t.lanes=0,ac(e,t,n,t.pendingProps);case 24:Ui(t,ta,e.memoizedState.cache)}return Ec(e,t,n)}function kc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ec=!0;else{if(!Dc(e,n)&&!(t.flags&128))return ec=!1,Oc(e,t,n);ec=!!(e.flags&131072)}else ec=!1,ki&&t.flags&1048576&&Ci(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ri(e)?(r=Us(e,r),t.tag=1,t=mc(null,t,e,r,n)):(t.tag=0,t=fc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=nc(null,t,e,r,n);break a}else if(a===w){t.tag=14,t=rc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Us(r,t.pendingProps),mc(e,t,r,a,n);case 3:a:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ui(t,ta,r),r!==o.cache&&G(t,[ta],n,!0),Va(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=hc(e,t,r,n);break a}else if(r!==a){a=fi(Error(i(424)),t),zi(a),t=hc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Oi=ff(e.firstChild),Di=t,ki=!0,Ai=null,ji=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Li(),r===a){t=Ec(e,t,n);break a}tc(e,t,r,n)}t=t.child}return t;case 26:return dc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:ki||(n=t.type,e=t.pendingProps,r=Wd(U.current).createElement(n),r[et]=t,r[tt]=e,zd(r,n,e),pt(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ae(t),e===null&&ki&&(r=t.stateNode=gf(t.type,t.pendingProps,U.current),Di=t,ji=!0,a=Oi,tf(t.type)?(pf=a,Oi=ff(r.firstChild)):Oi=a),tc(e,t,t.pendingProps.children,n),dc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ki&&((a=r=Oi)&&(r=of(r,t.type,t.pendingProps,ji),r===null?a=!1:(t.stateNode=r,Di=t,Oi=ff(r.firstChild),ji=!1,a=!0)),a||Ni(t)),ae(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,qd(a,o)?r=null:s!==null&&qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),np._currentValue=a),dc(e,t),tc(e,t,r,n),t.child;case 6:return e===null&&ki&&((e=n=Oi)&&(n=sf(n,t.pendingProps,ji),n===null?e=!1:(t.stateNode=n,Di=t,Oi=null,e=!0)),e||Ni(t)),null;case 13:return yc(e,t,n);case 4:return ie(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):tc(e,t,r,n),t.child;case 11:return nc(e,t,t.type,t.pendingProps,n);case 7:return tc(e,t,t.pendingProps,n),t.child;case 8:return tc(e,t,t.pendingProps.children,n),t.child;case 12:return tc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ui(t,t.type,r.value),tc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Ji(t),a=Yi(a),r=r(a),t.flags|=1,tc(e,t,r,n),t.child;case 14:return rc(e,t,t.type,t.pendingProps,n);case 15:return ic(e,t,t.type,t.pendingProps,n);case 19:return Tc(e,t,n);case 31:return uc(e,t,n);case 22:return ac(e,t,n,t.pendingProps);case 24:return Ji(t),r=Yi(ta),e===null?(a=fa(),a===null&&(a=Rl,o=na(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),Ui(t,ta,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ui(t,ta,r),r!==a.cache&&G(t,[ta],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ui(t,ta,r))),tc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ac(e){e.flags|=4}function jc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Du())e.flags|=8192;else throw Sa=va,ga}else e.flags&=-16777217}function Mc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t))if(Du())e.flags|=8192;else throw Sa=va,ga}function Nc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:He(),e.lanes|=t,Ql|=t)}function Pc(e,t){if(!ki)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 Fc(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 Ic(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fc(t),null;case 1:return Fc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Wi(ta),W(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?Ac(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ri())),Fc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ac(t),o===null?(Fc(t),jc(t,a,null,r,n)):(Fc(t),Mc(t,o))):o?o===e.memoizedState?(Fc(t),t.flags&=-16777217):(Ac(t),Fc(t),Mc(t,o)):(e=e.memoizedProps,e!==r&&Ac(t),Fc(t),jc(t,a,e,r,n)),null;case 27:if(oe(t),n=U.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}e=ne.current,Ii(t)?Pi(t,e):(e=gf(a,r,n),t.stateNode=e,Ac(t))}return Fc(t),null;case 5:if(oe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}if(o=ne.current,Ii(t))Pi(t,o);else{var s=Wd(U.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[et]=t,o[tt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.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=o;a:switch(zd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=U.current,Ii(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Di,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||Ni(t,!0)}else e=Wd(e).createTextNode(r),e[et]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ii(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[et]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(i(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[et]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),a=!1}else a=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nc(t,t.updateQueue),Fc(t),null);case 4:return W(),e===null&&Ed(t.stateNode.containerInfo),Fc(t),null;case 10:return Wi(t.type),Fc(t),null;case 19:if(B(ro),r=t.memoizedState,r===null)return Fc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Pc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Pc(r,!1),e=o.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ai(n,e),n=n.sibling;return V(ro,ro.current&1|2),ki&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ye()>iu&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304)}else{if(!a)if(e=io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ki)return Fc(t),null}else 2*ye()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ye(),e.sibling=null,n=ro.current,V(ro,a?n&1|2:n&1),ki&&Si(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(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&&B(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(ta),Fc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Lc(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(ta),W(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return oe(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(ro),null;case 4:return W(),null;case 10:return Wi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&B(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(ta),null;case 25:return null;default:return null}}function Rc(e,t){switch(Ti(t),t.tag){case 3:Wi(ta),W();break;case 26:case 27:case 5:oe(t);break;case 4:W();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:B(ro);break;case 10:Wi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&B(da);break;case 24:Wi(ta)}}function zc(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){Ju(t,t.return,e)}}function Bc(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){Ju(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ju(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Ju(e,e.return,t)}}}function Hc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ju(e,t,n)}}function Uc(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){Ju(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ju(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){Ju(e,t,n)}else n.current=null}function Gc(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){Ju(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;Y(r,e.type,n,t),r[tt]=t}catch(t){Ju(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(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&&tf(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 Yc(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=qt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(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&&tf(e.type)&&(n=e.stateNode),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){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[et]=e,t[tt]=n}catch(t){Ju(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Hd=dp,e=xr(e),Sr(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 a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.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||a!==0&&f.nodeType!==3||(c=s+a),f!==o||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===a&&(c=s),p===o&&++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(Ud={focusedElem:e,selectionRange:n},dp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,o=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++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Us(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ju(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(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(i(163))}if(e=t.sibling,e!==null){e.return=t.return,nl=e;break}nl=t.return}}function il(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&zc(5,n);break;case 1:if(vl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ju(n,n.return,e)}else{var i=Us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ju(n,n.return,e)}}r&64&&Vc(n),r&512&&Uc(n,n.return);break;case 3:if(vl(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{Wa(e,t)}catch(e){Ju(n,n.return,e)}}break;case 27:t===null&&r&4&&Zc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Gc(n),r&512&&Uc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ul(e,n);break;case 13:vl(e,n),r&4&&dl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Qu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Qc,!r){t=t!==null&&t.memoizedState!==null||$c,i=Qc;var a=$c;Qc=r,($c=t)&&!a?bl(e,n,(n.subtreeFlags&8772)!=0):vl(e,n),Qc=i,$c=a}break;case 30:break;default:vl(e,n)}}function al(e){var t=e.alternate;t!==null&&(e.alternate=null,al(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ct(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 ol=null,sl=!1;function cl(e,t,n){for(n=n.child;n!==null;)ll(e,t,n),n=n.sibling}function ll(e,t,n){if(ke&&typeof ke.onCommitFiberUnmount==`function`)try{ke.onCommitFiberUnmount(Oe,n)}catch{}switch(n.tag){case 26:$c||Wc(n,t),cl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$c||Wc(n,t);var r=ol,i=sl;tf(n.type)&&(ol=n.stateNode,sl=!1),cl(e,t,n),_f(n.stateNode),ol=r,sl=i;break;case 5:$c||Wc(n,t);case 6:if(r=ol,i=sl,ol=null,cl(e,t,n),ol=r,sl=i,ol!==null)if(sl)try{(ol.nodeType===9?ol.body:ol.nodeName===`HTML`?ol.ownerDocument.body:ol).removeChild(n.stateNode)}catch(e){Ju(n,t,e)}else try{ol.removeChild(n.stateNode)}catch(e){Ju(n,t,e)}break;case 18:ol!==null&&(sl?(e=ol,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):nf(ol,n.stateNode));break;case 4:r=ol,i=sl,ol=n.stateNode.containerInfo,sl=!0,cl(e,t,n),ol=r,sl=i;break;case 0:case 11:case 14:case 15:Bc(2,n,t),$c||Bc(4,n,t),cl(e,t,n);break;case 1:$c||(Wc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Hc(n,t,r)),cl(e,t,n);break;case 21:cl(e,t,n);break;case 22:$c=(r=$c)||n.memoizedState!==null,cl(e,t,n),$c=r;break;default:cl(e,t,n)}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){Ju(t,t.return,e)}}}function dl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){Ju(t,t.return,e)}}function fl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tl),t;default:throw Error(i(435,e.tag))}}function pl(e,t){var n=fl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=$u.bind(null,e,t);t.then(r,r)}})}function ml(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(tf(c.type)){ol=c.stateNode,sl=!1;break a}break;case 5:ol=c.stateNode,sl=!1;break a;case 3:case 4:ol=c.stateNode.containerInfo,sl=!0;break a}c=c.return}if(ol===null)throw Error(i(160));ll(o,s,a),ol=null,sl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gl(t,e),t=t.sibling}var hl=null;function gl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ml(t,e),_l(e),r&4&&(Bc(3,e,e.return),zc(3,e),Bc(5,e,e.return));break;case 1:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&64&&Qc&&(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 a=hl;if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&4){var o=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,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[st]||o[et]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),zd(o,r,n),o[et]=e,pt(o),r=o;break a;case`link`:var s=Gf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),zd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Gf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),zd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[et]=e,pt(o),r=o}e.stateNode=r}else Kf(a,e.type,e.stateNode);else e.stateNode=Bf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Kc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Kf(a,e.type,e.stateNode):Bf(a,r,e.memoizedProps))}break;case 27:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),n!==null&&r&4&&Kc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),e.flags&32){a=e.stateNode;try{zt(a,``)}catch(t){Ju(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Kc(e,a,n===null?a:n.memoizedProps)),r&1024&&(el=!0);break;case 6:if(ml(t,e),_l(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ju(e,e.return,t)}}break;case 3:if(Wf=null,a=hl,hl=bf(t.containerInfo),ml(t,e),hl=a,_l(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){Ju(e,e.return,t)}el&&(el=!1,q(e));break;case 4:r=hl,hl=bf(e.stateNode.containerInfo),ml(t,e),_l(e),hl=r;break;case 12:ml(t,e),_l(e);break;case 31:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 13:ml(t,e),_l(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nu=ye()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Qc,d=$c;if(Qc=u||a,$c=d||l,ml(t,e),$c=d,Qc=u,_l(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Qc||$c||yl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.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){Ju(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ju(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ju(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,pl(e,n))));break;case 19:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 30:break;case 21:break;default:ml(t,e),_l(e)}}function _l(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Xc(e,Jc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(zt(o,``),n.flags&=-33),Xc(e,Jc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Yc(e,Jc(e),s);break;default:throw Error(i(161))}}catch(t){Ju(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function q(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;q(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)il(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Bc(4,t,t.return),yl(t);break;case 1:Wc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Hc(t,t.return,n),yl(t);break;case 27:_f(t.stateNode);case 26:case 5:Wc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,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:bl(i,a,n),zc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ju(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++)Ua(c[i],s)}catch(e){Ju(r,r.return,e)}}n&&o&64&&Vc(a),Uc(a,a.return);break;case 27:Zc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Gc(a),Uc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ul(i,a);break;case 13:bl(i,a,n),n&&o&4&&dl(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Uc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(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&&ra(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ra(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&zc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(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&&ra(e)));break;case 12:if(i&2048){Cl(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){Ju(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!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:Tl(a,o,s,c,i),zc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(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:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Yf(n,hl,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=hl;hl=bf(e.stateNode.containerInfo),Ol(e,t,n),hl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(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 jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,Pl(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&Bc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}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];nl=r,Pl(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Bc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function Pl(e,t){for(;nl!==null;){var n=nl;switch(n.tag){case 0:case 11:case 15:Bc(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:ra(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,nl=r;else a:for(n=e;nl!==null;){r=nl;var i=r.sibling,a=r.return;if(al(r),r===n){nl=null;break a}if(i!==null){i.return=a,nl=i;break a}nl=a}}}var Fl={getCacheForType:function(e){var t=Yi(ta),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Yi(ta).controller.signal}},Il=typeof WeakMap==`function`?WeakMap:Map,Ll=0,Rl=null,zl=null,Bl=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,uu=0,du=0,fu=null,pu=null,mu=0,hu=null;function gu(){return Ll&2&&Bl!==0?Bl&-Bl:I.T===null?Ze():J()}function _u(){if(Zl===0)if(!(Bl&536870912)||ki){var e=Ie;Ie<<=1,!(Ie&3932160)&&(Ie=262144),Zl=e}else Zl=536870912;return e=Xa.current,e!==null&&(e.flags|=32),Zl}function vu(e,t,n){(e===Rl&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)&&(Tu(e,0),Su(e,Bl,Zl,!1)),We(e,n),(!(Ll&2)||e!==Rl)&&(e===Rl&&(!(Ll&2)&&(Yl|=n),ql===4&&Su(e,Bl,Zl,!1)),sd(e))}function yu(e,t,n){if(Ll&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Be(e,t),a=r?Nu(e,t):ju(e,t,!0),o=r;do{if(a===0){Wl&&!r&&Su(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!xu(n)){a=ju(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)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;a=$l;var l=c.current.memoizedState.isDehydrated;if(l&&(Tu(c,s).flags|=256),s=ju(c,s,!1),s!==2){if(Gl&&!l){c.errorRecoveryDisabledLanes|=o,Yl|=o,a=4;break a}o=eu,eu=a,o!==null&&(eu===null?eu=o:eu.push.apply(eu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Tu(e,0),Su(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Su(r,t,Zl,!Ul);break a;case 2:eu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=nu+300-ye(),10<a)){if(Su(r,t,Zl,!Ul),ze(r,0,!0)!==0)break a;uu=t,r.timeoutHandle=Xd(bu.bind(null,r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,`Throttled`,-0,0),a);break a}bu(r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,null,-0,0)}}break}while(1);sd(e)}function bu(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:qt},kl(t,a,d);var m=(a&62914560)===a?nu-ye():(a&4194048)===a?ru-ye():0;if(m=Zf(d,m),m!==null){uu=a,e.cancelPendingCommit=m(Bu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Su(e,a,o,!l);return}}Bu(e,t,a,n,r,i,o,s,c)}function xu(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(!gr(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 Su(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-je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ke(e,n,t)}function Cu(){return Ll&6?!0:(cd(0,!1),!1)}function wu(){if(zl!==null){if(Vl===0)var e=zl.return;else e=zl,Hi=Vi=null,To(e),Ta=null,Ea=0,e=zl;for(;e!==null;)Rc(e.alternate,e),e=e.return;zl=null}}function Tu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),uu=0,wu(),Rl=e,zl=n=ii(e.current,null),Bl=t,Vl=0,Hl=null,Ul=!1,Wl=Be(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-je(r),a=1<<i;t|=e[i],r&=~a}return Kl=t,Jr(),n}function Eu(e,t){oo=null,I.H=Fs,t===ha||t===_a?(t=Ca(),Vl=3):t===ga?(t=Ca(),Vl=4):Vl=t===$s?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Hl=t,zl===null&&(ql=1,qs(e,fi(t,e.current)))}function Du(){var e=Xa.current;return e===null?!0:(Bl&4194048)===Bl?Za===null:(Bl&62914560)===Bl||Bl&536870912?e===Za:!1}function Ou(){var e=I.H;return I.H=Fs,e===null?Fs:e}function ku(){var e=I.A;return I.A=Fl,e}function Au(){ql=4,Ul||(Bl&4194048)!==Bl&&Xa.current!==null||(Wl=!0),!(Jl&134217727)&&!(Yl&134217727)||Rl===null||Su(Rl,Bl,Zl,!1)}function ju(e,t,n){var r=Ll;Ll|=2;var i=Ou(),a=ku();(Rl!==e||Bl!==t)&&(au=null,Tu(e,t)),t=!1;var o=ql;a:do try{if(Vl!==0&&zl!==null){var s=zl,c=Hl;switch(Vl){case 8:wu(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=Vl;if(Vl=0,Hl=null,Lu(e,s,c,l),n&&Wl){o=0;break a}break;default:l=Vl,Vl=0,Hl=null,Lu(e,s,c,l)}}Mu(),o=ql;break}catch(t){Eu(e,t)}while(1);return t&&e.shellSuspendCounter++,Hi=Vi=null,Ll=r,I.H=i,I.A=a,zl===null&&(Rl=null,Bl=0,Jr()),o}function Mu(){for(;zl!==null;)Fu(zl)}function Nu(e,t){var n=Ll;Ll|=2;var r=Ou(),a=ku();Rl!==e||Bl!==t?(au=null,iu=ye()+500,Tu(e,t)):Wl=Be(e,t);a:do try{if(Vl!==0&&zl!==null){t=zl;var o=Hl;b:switch(Vl){case 1:Vl=0,Hl=null,Lu(e,t,o,1);break;case 2:case 9:if(ya(o)){Vl=0,Hl=null,Iu(t);break}t=function(){Vl!==2&&Vl!==9||Rl!==e||(Vl=7),sd(e)},o.then(t,t);break a;case 3:Vl=7;break a;case 4:Vl=5;break a;case 7:ya(o)?(Vl=0,Hl=null,Iu(t)):(Vl=0,Hl=null,Lu(e,t,o,7));break;case 5:var s=null;switch(zl.tag){case 26:s=zl.memoizedState;case 5:case 27:var c=zl;if(s?Jf(s):c.stateNode.complete){Vl=0,Hl=null;var l=c.sibling;if(l!==null)zl=l;else{var u=c.return;u===null?zl=null:(zl=u,Ru(u))}break b}}Vl=0,Hl=null,Lu(e,t,o,5);break;case 6:Vl=0,Hl=null,Lu(e,t,o,6);break;case 8:wu(),ql=6;break a;default:throw Error(i(462))}}Pu();break}catch(t){Eu(e,t)}while(1);return Hi=Vi=null,I.H=r,I.A=a,Ll=n,zl===null?(Rl=null,Bl=0,Jr(),ql):0}function Pu(){for(;zl!==null&&!_e();)Fu(zl)}function Fu(e){var t=kc(e.alternate,e,Kl);e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Iu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pc(n,t,t.pendingProps,t.type,void 0,Bl);break;case 11:t=pc(n,t,t.pendingProps,t.type.render,t.ref,Bl);break;case 5:To(t);default:Rc(n,t),t=zl=ai(t,Kl),t=kc(n,t,Kl)}e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Lu(e,t,n,r){Hi=Vi=null,To(t),Ta=null,Ea=0;var i=t.return;try{if(Qs(e,i,t,n,Bl)){ql=1,qs(e,fi(n,e.current)),zl=null;return}}catch(t){if(i!==null)throw zl=i,t;ql=1,qs(e,fi(n,e.current)),zl=null;return}t.flags&32768?(ki||r===1?e=!0:Wl||Bl&536870912?e=!1:(Ul=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),zu(t,e)):Ru(t)}function Ru(e){var t=e;do{if(t.flags&32768){zu(t,Ul);return}e=t.return;var n=Ic(t.alternate,t,Kl);if(n!==null){zl=n;return}if(t=t.sibling,t!==null){zl=t;return}zl=t=e}while(t!==null);ql===0&&(ql=5)}function zu(e,t){do{var n=Lc(e.alternate,e);if(n!==null){n.flags&=32767,zl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){zl=e;return}zl=e=n}while(e!==null);ql=6,zl=null}function Bu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Gu();while(su!==0);if(Ll&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=qr,Ge(e,n,o,s,c,l),e===Rl&&(zl=Rl=null,Bl=0),lu=t,cu=e,uu=n,du=o,fu=a,pu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ed(Ce,function(){return Ku(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Ll,Ll|=4;try{rl(e,t,n)}finally{Ll=s,L.p=a,I.T=r}}su=1,Vu(),Hu(),Uu()}}function Vu(){if(su===1){su=0;var e=cu,t=lu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Ll;Ll|=4;try{gl(t,e);var a=Ud,o=xr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&br(s.ownerDocument.documentElement,s)){if(c!==null&&Sr(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 _=yr(s,h),v=yr(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}}dp=!!Hd,Ud=Hd=null}finally{Ll=i,L.p=r,I.T=n}}e.current=t,su=2}}function Hu(){if(su===2){su=0;var e=cu,t=lu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Ll;Ll|=4;try{il(e,t.alternate,t)}finally{Ll=i,L.p=r,I.T=n}}su=3}}function Uu(){if(su===4||su===3){su=0,ve();var e=cu,t=lu,n=uu,r=pu;t.subtreeFlags&10256||t.flags&10256?su=5:(su=0,lu=cu=null,Wu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ou=null),Xe(n),t=t.stateNode,ke&&typeof ke.onCommitFiberRoot==`function`)try{ke.onCommitFiberRoot(Oe,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}}uu&3&&Gu(),sd(e),i=e.pendingLanes,n&261930&&i&42?e===hu?mu++:(mu=0,hu=e):mu=0,cd(0,!1)}}function Wu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ra(t)))}function Gu(){return Vu(),Hu(),Uu(),Ku()}function Ku(){if(su!==5)return!1;var e=cu,t=du;du=0;var n=Xe(uu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=fu,fu=null;var o=cu,s=uu;if(su=0,lu=cu=null,uu=0,Ll&6)throw Error(i(331));var c=Ll;if(Ll|=4,Ml(o.current),wl(o,o.current,s,n),Ll=c,cd(0,!1),ke&&typeof ke.onPostCommitFiberRoot==`function`)try{ke.onPostCommitFiberRoot(Oe,o)}catch{}return!0}finally{L.p=a,I.T=r,Wu(e,t)}}function qu(e,t,n){t=fi(n,t),t=Ys(e.stateNode,t,2),e=La(e,t,2),e!==null&&(We(e,2),sd(e))}function Ju(e,t,n){if(e.tag===3)qu(e,e,n);else for(;t!==null;){if(t.tag===3){qu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=fi(n,e),n=Xs(2),r=La(t,n,2),r!==null&&(Zs(n,r,t,e),We(r,2),sd(r));break}}t=t.return}}function Yu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;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=Xu.bind(null,e,t,n),t.then(e,e))}function Xu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Bl&n)===n&&(ql===4||ql===3&&(Bl&62914560)===Bl&&300>ye()-nu?!(Ll&2)&&Tu(e,0):Xl|=n,Ql===Bl&&(Ql=0)),sd(e)}function Zu(e,t){t===0&&(t=He()),e=Zr(e,t),e!==null&&(We(e,t),sd(e))}function Qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zu(e,n)}function $u(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Zu(e,n)}function ed(e,t){return he(e,t)}var td=null,nd=null,rd=!1,id=!1,ad=!1,od=0;function sd(e){e!==nd&&e.next===null&&(nd===null?td=nd=e:nd=nd.next=e),id=!0,rd||(rd=!0,md())}function cd(e,t){if(!ad&&id){ad=!0;do for(var n=!1,r=td;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-je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,pd(r,a))}else a=Bl,a=ze(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Be(r,a)||(n=!0,pd(r,a));r=r.next}while(n);ad=!1}}function ld(){ud()}function ud(){id=rd=!1;var e=0;od!==0&&Yd()&&(e=od);for(var t=ye(),n=null,r=td;r!==null;){var i=r.next,a=dd(r,t);a===0?(r.next=null,n===null?td=i:n.next=i,i===null&&(nd=n)):(n=r,(e!==0||a&3)&&(id=!0)),r=i}su!==0&&su!==5||cd(e,!1),od!==0&&(od=0)}function dd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ve(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Rl,n=Bl,n=ze(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&&ge(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Be(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ge(r),Xe(n)){case 2:case 8:n=Se;break;case 32:n=Ce;break;case 268435456:n=Te;break;default:n=Ce}return r=fd.bind(null,e),n=he(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ge(r),e.callbackPriority=2,e.callbackNode=null,2}function fd(e,t){if(su!==0&&su!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Gu()&&e.callbackNode!==n)return null;var r=Bl;return r=ze(e,e===Rl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(yu(e,r,t),dd(e,ye()),e.callbackNode!=null&&e.callbackNode===n?fd.bind(null,e):null)}function pd(e,t){if(Gu())return null;yu(e,t,!0)}function md(){$d(function(){Ll&6?he(xe,ld):ud()})}function J(){if(od===0){var e=K;e===0&&(e=Fe,Fe<<=1,!(Fe&261888)&&(Fe=256)),od=e}return od}function hd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Kt(``+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[tt]||null).action),o=r.submitter;o&&(t=(t=o[tt]||null)?hd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new hn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(od!==0){var e=o?gd(i,o):new FormData(i);xs(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),xs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var vd=0;vd<Hr.length;vd++){var yd=Hr[vd];Ur(yd.toLowerCase(),`on`+(yd[0].toUpperCase()+yd.slice(1)))}Ur(Pr,`onAnimationEnd`),Ur(Fr,`onAnimationIteration`),Ur(Ir,`onAnimationStart`),Ur(`dblclick`,`onDoubleClick`),Ur(`focusin`,`onFocus`),Ur(`focusout`,`onBlur`),Ur(Lr,`onTransitionRun`),Ur(Rr,`onTransitionStart`),Ur(zr,`onTransitionCancel`),Ur(Br,`onTransitionEnd`),_t(`onMouseEnter`,[`mouseout`,`mouseover`]),_t(`onMouseLeave`,[`mouseout`,`mouseover`]),_t(`onPointerEnter`,[`pointerout`,`pointerover`]),_t(`onPointerLeave`,[`pointerout`,`pointerover`]),gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),gt(`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)!=0;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){Wr(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){Wr(e)}i.currentTarget=null,a=c}}}}function Cd(e,t){var n=t[rt];n===void 0&&(n=t[rt]=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,mt.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(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!rn||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 s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=lt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}en(function(){var r=a,i=Yt(n),s=[];a:{var c=Vr.get(e);if(c!==void 0){var l=hn,u=e;switch(e){case`keypress`:if(un(n)===0)break a;case`keydown`:case`keyup`:l=Nn;break;case`focusin`:u=`focus`,l=wn;break;case`focusout`:u=`blur`,l=wn;break;case`beforeblur`:case`afterblur`:l=wn;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`:l=Sn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Cn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Fn;break;case Pr:case Fr:case Ir:l=Tn;break;case Br:l=In;break;case`scroll`:case`scrollend`:l=_n;break;case`wheel`:l=Ln;break;case`copy`:case`cut`:case`paste`:l=En;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Pn;break;case`toggle`:case`beforetoggle`:l=Rn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;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=tn(m,p),g!=null&&d.push(kd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Jt&&(u=n.relatedTarget||n.fromElement)&&(lt(u)||u[nt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?lt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Sn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Pn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:dt(l),h=u==null?c:dt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,lt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=jd,p=l,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;l!==null&&Md(s,c,l,d,!1),u!==null&&f!==null&&Md(s,f,u,d,!0)}}a:{if(c=r?dt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ir;else if(Qn(c))if(ar)v=mr;else{v=fr;var y=dr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ut(r.elementType)&&(v=ir):v=pr;if(v&&=v(e,r)){$n(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ft(c,`number`,c.value)}switch(y=r?dt(r):window,e){case`focusin`:(Qn(y)||y.contentEditable===`true`)&&(wr=y,Tr=r,Er=null);break;case`focusout`:Er=Tr=wr=null;break;case`mousedown`:Dr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Dr=!1,Or(s,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Or(s,n,i)}var b;if(Bn)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 Jn?Kn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Un&&n.locale!==`ko`&&(Jn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Jn&&(b=ln()):(on=i,sn=`value`in on?on.value:on.textContent,Jn=!0)),y=Ad(r,x),0<y.length&&(x=new Dn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=qn(n),b!==null&&(x.data=b)))),(b=Hn?Yn(e,n):Xn(e,n))&&(x=Ad(r,`onBeforeInput`),0<x.length&&(y=new Dn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),_d(s,e,r,n,i)}Sd(s,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=tn(e,n),i!=null&&r.unshift(kd(e,i,a)),i=tn(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=tn(n,a),l!=null&&o.unshift(kd(n,l,c))):i||(l=tn(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,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&zt(e,``+r);break;case`className`:Ct(e,`class`,r);break;case`tabIndex`:Ct(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ct(e,n,r);break;case`style`:Ht(e,r,o);break;case`data`:if(t!==`object`){Ct(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=Kt(``+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}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Ld(e,t,`name`,a.name,a,null),Ld(e,t,`formEncType`,a.formEncType,a,null),Ld(e,t,`formMethod`,a.formMethod,a,null),Ld(e,t,`formTarget`,a.formTarget,a,null)):(Ld(e,t,`encType`,a.encType,a,null),Ld(e,t,`method`,a.method,a,null),Ld(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=qt);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(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(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=Kt(``+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),St(e,`popover`,r);break;case`xlinkActuate`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:St(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=Wt.get(n)||n,St(e,n,r))}}function Rd(e,t,n,r,a,o){switch(n){case`style`:Ht(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&zt(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=qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[tt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):St(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,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Ld(e,t,o,s,n,null)}}a&&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=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Ld(e,t,r,d,n,null)}}Pt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Cd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Ld(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&It(e,!!r,n,!0):It(e,!!r,t,!1);return;case`textarea`:for(s in Cd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Ld(e,t,s,c,n,null)}Rt(e,r,a,o);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(i(137,t));default:Ld(e,t,u,r,n,null)}return;default:if(Ut(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 Y(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 a=null,o=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`:o=m;break;case`name`:a=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(i(137,t));break;default:m!==f&&Ld(e,t,p,m,r,f)}}Nt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Ld(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Ld(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?It(e,!!n,n?[]:``,!1):It(e,!!n,t,!0)):It(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Ld(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Ld(e,t,s,a,r,o)}Lt(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(i(137,t));break;default:Ld(e,t,u,p,r,m)}return;default:if(Ut(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 Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){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&&Bd(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&&Bd(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 Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(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 Kd(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 qd(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 Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(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),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[st]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Lp(t)}function rf(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 af(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`:af(n),ct(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(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[st])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=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(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 ff(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 pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(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 gf(e,t,n){switch(t=Wd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ct(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=L.d;L.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=Cu();return e||t}function Cf(e){var t=ut(e);t!==null&&t.tag===5&&t.type===`form`?Cs(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),zd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),zd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),zd(r,`link`,e),pt(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=ft(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);pt(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,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=ft(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=f({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),pt(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=ft(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),pt(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,n,r){var a=(a=U.current)?bf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Pf(n.href),n=ft(a).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=Pf(n.href);var o=ft(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.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},vf.set(e,n),o||Lf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Rf(n),n=ft(a).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(i(444,e))}}function Pf(e){return`href="`+Mt(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(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),pt(t),e.head.appendChild(t))}function Rf(e){return`[src="`+Mt(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),pt(r),zd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,pt(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),pt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),zd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,pt(a),a):(r=n,(a=vf.get(o))&&(r=f({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),pt(a),zd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(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 Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,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[st]||a[et]||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 Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(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 Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(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=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,pt(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),pt(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=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.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=Qf.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 np={$$typeof:b,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function rp(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=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(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 ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function ap(e){return e?(e=ei,e):ei}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(vu(n,e,t),Ra(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&vu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=gu();t=Ye(t);var n=Zr(e,t);n!==null&&vu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function pp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Od(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=ut(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Re(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-je(o);s.entanglements[1]|=c,o&=~c}sd(a),!(Ll&6)&&(iu=ye()+500,cd(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&vu(s,a,2),Cu(),cp(a,2)}if(a=hp(r),a===null&&Od(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Od(e,t,r,null,n)}}function hp(e){return e=Yt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=lt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 gp=e,null}function vp(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(be()){case xe:return 2;case Se:return 8;case Ce:case we:return 32;case Te:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`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 Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(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=ut(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=lt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){up(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){up(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 jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Jt=r,n.target.dispatchEvent(r),Jt=null}else return t=ut(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=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(_p(r||n)===null)continue;break}var a=ut(n);a!==null&&(e.splice(t,3),t-=3,xs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.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[tt]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[tt]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){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 zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;op(n,gu(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),Cu(),t[nt]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ze();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=n.version;if(Vp!==`19.2.4`)throw Error(i(527,Vp,`19.2.4`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{Oe=Up.inject(Hp),ke=Up}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ws,s=Gs,c=Ks;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ip(e,1,!1,null,null,n,r,null,o,s,c,Rp),e[nt]=t.current,Ed(e),new zp(t)}})),F=n(((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=P()})),I=t(k(),1),L=`popstate`;function ee(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function te(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return ne(``,{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:H(t)}return re(t,n,null,e)}function R(e,t){if(e===!1||e==null)throw Error(t)}function z(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function B(){return Math.random().toString(36).substring(2,10)}function V(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ne(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?U(t):t,state:n,key:t&&t.key||r||B(),unstable_mask:i}}function H({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 U(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 re(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=ee(e)?e:ne(h.location,e,t);n&&n(r,e),l=u()+1;let d=V(r,l),f=h.createHref(r.unstable_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=ee(e)?e:ne(h.location,e,t);n&&n(r,e),l=u();let i=V(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ie(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(L,d),c=e,()=>{i.removeEventListener(L,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 ie(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),R(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:H(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function W(e,t,n=`/`){return ae(e,t,n,!1)}function ae(e,t,n,r){let i=Ce((typeof t==`string`?U(t):t).pathname||`/`,n);if(i==null)return null;let a=se(e);le(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=Se(i);o=ye(a[e],t,r)}return o}function oe(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function se(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;R(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=je([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(R(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),se(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:_e(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ce(e.path))a(e,t,!0,n)}),t}function ce(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=ce(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 le(e){e.sort((e,t)=>e.score===t.score?ve(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ue=/^:[\w-]+$/,de=3,fe=2,pe=1,me=10,he=-2,ge=e=>e===`*`;function _e(e,t){let n=e.split(`/`),r=n.length;return n.some(ge)&&(r+=he),t&&(r+=fe),n.filter(e=>!ge(e)).reduce((e,t)=>e+(ue.test(t)?de:t===``?pe:me),r)}function ve(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 ye(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=be({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=be({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:je([a,u.pathname]),pathnameBase:Me(je([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=je([a,u.pathnameBase]))}return o}function be(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=xe(e.path,e.caseSensitive,e.end),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 n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function xe(e,t=!1,n=!0){z(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 Se(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return z(!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 Ce(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)||`/`}var we=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Te(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?U(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?Ee(n.substring(1),`/`):Ee(n,t)):a=t,{pathname:a,search:Ne(r),hash:Pe(i)}}function Ee(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function De(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 Oe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ke(e){let t=Oe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ae(e,t,n,r=!1){let i;typeof e==`string`?i=U(e):(i={...e},R(!i.pathname||!i.pathname.includes(`?`),De(`?`,`pathname`,`search`,i)),R(!i.pathname||!i.pathname.includes(`#`),De(`#`,`pathname`,`hash`,i)),R(!i.search||!i.search.includes(`#`),De(`#`,`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=Te(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var je=e=>e.join(`/`).replace(/\/\/+/g,`/`),Me=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Ne=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Pe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Fe=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 Ie(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Le(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var Re=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ze(e,t){let n=e;if(typeof n!=`string`||!we.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Re)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Ce(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{z(!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 Be=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Be);var Ve=[`GET`,...Be];new Set(Ve);var He=I.createContext(null);He.displayName=`DataRouter`;var Ue=I.createContext(null);Ue.displayName=`DataRouterState`;var We=I.createContext(!1),Ge=I.createContext({isTransitioning:!1});Ge.displayName=`ViewTransition`;var Ke=I.createContext(new Map);Ke.displayName=`Fetchers`;var qe=I.createContext(null);qe.displayName=`Await`;var Je=I.createContext(null);Je.displayName=`Navigation`;var Ye=I.createContext(null);Ye.displayName=`Location`;var Xe=I.createContext({outlet:null,matches:[],isDataRoute:!1});Xe.displayName=`Route`;var Ze=I.createContext(null);Ze.displayName=`RouteError`;var Qe=`REACT_ROUTER_ERROR`,$e=`REDIRECT`,et=`ROUTE_ERROR_RESPONSE`;function tt(e){if(e.startsWith(`${Qe}:${$e}:{`))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 nt(e){if(e.startsWith(`${Qe}:${et}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Fe(t.status,t.statusText,t.data)}catch{}}function rt(e,{relative:t}={}){R(it(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=I.useContext(Je),{hash:i,pathname:a,search:o}=pt(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:je([n,a])),r.createHref({pathname:s,search:o,hash:i})}function it(){return I.useContext(Ye)!=null}function at(){return R(it(),`useLocation() may be used only in the context of a <Router> component.`),I.useContext(Ye).location}var ot=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function st(e){I.useContext(Je).static||I.useLayoutEffect(e)}function ct(){let{isDataRoute:e}=I.useContext(Xe);return e?Mt():lt()}function lt(){R(it(),`useNavigate() may be used only in the context of a <Router> component.`);let e=I.useContext(He),{basename:t,navigator:n}=I.useContext(Je),{matches:r}=I.useContext(Xe),{pathname:i}=at(),a=JSON.stringify(ke(r)),o=I.useRef(!1);return st(()=>{o.current=!0}),I.useCallback((r,s={})=>{if(z(o.current,ot),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ae(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:je([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var ut=I.createContext(null);function dt(e){let t=I.useContext(Xe).outlet;return I.useMemo(()=>t&&I.createElement(ut.Provider,{value:e},t),[t,e])}function ft(){let{matches:e}=I.useContext(Xe),t=e[e.length-1];return t?t.params:{}}function pt(e,{relative:t}={}){let{matches:n}=I.useContext(Xe),{pathname:r}=at(),i=JSON.stringify(ke(n));return I.useMemo(()=>Ae(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function mt(e,t){return ht(e,t)}function ht(e,t,n){R(it(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=I.useContext(Je),{matches:i}=I.useContext(Xe),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||``;Pt(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 u=at(),d;if(t){let e=typeof t==`string`?U(t):t;R(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.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=W(e,{pathname:p});z(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),z(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.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 h=St(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:je([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:je([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?I.createElement(Ye.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function gt(){let e=jt(),t=Ie(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=I.createElement(I.Fragment,null,I.createElement(`p`,null,`💿 Hey developer 👋`),I.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,I.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,I.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),I.createElement(I.Fragment,null,I.createElement(`h2`,null,`Unexpected Application Error!`),I.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?I.createElement(`pre`,{style:i},n):null,o)}var _t=I.createElement(gt,null),vt=class extends I.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=nt(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:I.createElement(Xe.Provider,{value:this.props.routeContext},I.createElement(Ze.Provider,{value:e,children:this.props.component}));return this.context?I.createElement(bt,{error:e},t):t}};vt.contextType=We;var yt=new WeakMap;function bt({children:e,error:t}){let{basename:n}=I.useContext(Je);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=tt(t.digest);if(e){let r=yt.get(t);if(r)throw r;let i=ze(e.location,n);if(Re&&!yt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw yt.set(t,n),n}return I.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function xt({routeContext:e,match:t,children:n}){let r=I.useContext(He);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),I.createElement(Xe.Provider,{value:e},n)}function St(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);R(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??{},unstable_pattern:Le(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||_t,o&&(s<0&&c===0?(Pt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?I.createElement(n.route.Component,null):n.route.element?n.route.element:e,I.createElement(xt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?I.createElement(vt,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Ct(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wt(e){let t=I.useContext(He);return R(t,Ct(e)),t}function Tt(e){let t=I.useContext(Ue);return R(t,Ct(e)),t}function Et(e){let t=I.useContext(Xe);return R(t,Ct(e)),t}function Dt(e){let t=Et(e),n=t.matches[t.matches.length-1];return R(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Ot(){return Dt(`useRouteId`)}function kt(){return Tt(`useNavigation`).navigation}function At(){let{matches:e,loaderData:t}=Tt(`useMatches`);return I.useMemo(()=>e.map(e=>oe(e,t)),[e,t])}function jt(){let e=I.useContext(Ze),t=Tt(`useRouteError`),n=Dt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Mt(){let{router:e}=wt(`useNavigate`),t=Dt(`useNavigate`),n=I.useRef(!1);return st(()=>{n.current=!0}),I.useCallback(async(r,i={})=>{z(n.current,ot),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Nt={};function Pt(e,t,n){!t&&!Nt[e]&&(Nt[e]=!0,z(!1,n))}I.memo(Ft);function Ft({routes:e,future:t,state:n,isStatic:r,onError:i}){return ht(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function It({to:e,replace:t,state:n,relative:r}){R(it(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=I.useContext(Je);z(!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}=I.useContext(Xe),{pathname:o}=at(),s=ct(),c=Ae(e,ke(a),o,r===`path`),l=JSON.stringify(c);return I.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Lt(e){return dt(e.context)}function Rt(e){R(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function zt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){R(!it(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=I.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=U(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=I.useMemo(()=>{let e=Ce(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return z(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:I.createElement(Je.Provider,{value:c},I.createElement(Ye.Provider,{children:t,value:h}))}function Bt({children:e,location:t}){return mt(Vt(e),t)}I.Component;function Vt(e,t=[]){let n=[];return I.Children.forEach(e,(e,r)=>{if(!I.isValidElement(e))return;let i=[...t,r];if(e.type===I.Fragment){n.push.apply(n,Vt(e.props.children,i));return}R(e.type===Rt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),R(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Vt(e.props.children,i)),n.push(a)}),n}var Ht=`get`,Ut=`application/x-www-form-urlencoded`;function Wt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Gt(e){return Wt(e)&&e.tagName.toLowerCase()===`button`}function Kt(e){return Wt(e)&&e.tagName.toLowerCase()===`form`}function qt(e){return Wt(e)&&e.tagName.toLowerCase()===`input`}function Jt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Yt(e,t){return e.button===0&&(!t||t===`_self`)&&!Jt(e)}function Xt(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 Zt(e,t){let n=Xt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Qt=null;function $t(){if(Qt===null)try{new FormData(document.createElement(`form`),0),Qt=!1}catch{Qt=!0}return Qt}var en=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function tn(e){return e!=null&&!en.has(e)?(z(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ut}"`),null):e}function nn(e,t){let n,r,i,a,o;if(Kt(e)){let o=e.getAttribute(`action`);r=o?Ce(o,t):null,n=e.getAttribute(`method`)||Ht,i=tn(e.getAttribute(`enctype`))||Ut,a=new FormData(e)}else if(Gt(e)||qt(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?Ce(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ht,i=tn(e.getAttribute(`formenctype`))||tn(o.getAttribute(`enctype`))||Ut,a=new FormData(o,e),!$t()){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(Wt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ht,r=null,i=Ut,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`);var rn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},an=/[&><\u2028\u2029]/g;function on(e){return e.replace(an,e=>rn[e])}function sn(e,t){if(e===!1||e==null)throw Error(t)}function cn(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Ce(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function ln(e,t){if(e.id in t)return t[e.id];try{let n=await r(()=>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 un(e){return e!=null&&typeof e.page==`string`}function dn(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 fn(e,t,n){return _n((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await ln(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(dn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function pn(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,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 mn(e,t,{includeHydrateFallback:n}={}){return hn(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 hn(e){return[...new Set(e)]}function gn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function _n(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!un(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(gn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function vn(){let e=I.useContext(He);return sn(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function yn(){let e=I.useContext(Ue);return sn(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var bn=I.createContext(void 0);bn.displayName=`FrameworkContext`;function xn(){let e=I.useContext(bn);return sn(e,`You must render this element inside a <HydratedRouter> element`),e}function Sn(e,t){let n=I.useContext(bn),[r,i]=I.useState(!1),[a,o]=I.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=I.useRef(null);I.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),I.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Cn(s,p),onBlur:Cn(c,m),onMouseEnter:Cn(l,p),onMouseLeave:Cn(u,m),onTouchStart:Cn(d,p)}]:[a,f,{}]:[!1,f,{}]}function Cn(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function wn({page:e,...t}){let{router:n}=vn(),r=I.useMemo(()=>W(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?I.createElement(En,{page:e,matches:r,...t}):null}function Tn(e){let{manifest:t,routeModules:n}=xn(),[r,i]=I.useState([]);return I.useEffect(()=>{let r=!1;return fn(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function En({page:e,matches:t,...n}){let r=at(),{future:i,manifest:a,routeModules:o}=xn(),{basename:s}=vn(),{loaderData:c,matches:l}=yn(),u=I.useMemo(()=>pn(e,t,l,a,r,`data`),[e,t,l,a,r]),d=I.useMemo(()=>pn(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=I.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||(!u.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 d=cn(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=I.useMemo(()=>mn(d,a),[d,a]),m=Tn(d);return I.createElement(I.Fragment,null,f.map(e=>I.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>I.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>I.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)})}}I.Component;var On=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{On&&(window.__reactRouterVersion=`7.13.1`)}catch{}function kn({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=I.useRef();i.current??=te({window:r,v5Compat:!0});let a=i.current,[o,s]=I.useState({action:a.action,location:a.location}),c=I.useCallback(e=>{n===!1?s(e):I.startTransition(()=>s(e))},[n]);return I.useLayoutEffect(()=>a.listen(c),[a,c]),I.createElement(zt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function An({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=I.useState({action:n.action,location:n.location}),o=I.useCallback(e=>{r===!1?a(e):I.startTransition(()=>a(e))},[r]);return I.useLayoutEffect(()=>n.listen(o),[n,o]),I.createElement(zt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}An.displayName=`unstable_HistoryRouter`;var jn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Mn=I.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=I.useContext(Je),v=typeof l==`string`&&jn.test(l),y=ze(l,h);l=y.to;let b=rt(l,{relative:r}),x=at(),S=null;if(o){let e=Ae(o,[],x.unstable_mask?x.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:je([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Sn(n,p),E=zn(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=I.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:Dn(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?I.createElement(I.Fragment,null,k,I.createElement(wn,{page:b})):k});Mn.displayName=`Link`;var Nn=I.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 u=pt(a,{relative:c.relative}),d=at(),f=I.useContext(Ue),{navigator:p,basename:m}=I.useContext(Je),h=f!=null&&Xn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Ce(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return I.createElement(Mn,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Nn.displayName=`NavLink`;var Pn=I.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ht,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=I.useContext(Je),g=Un(),_=Wn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&jn.test(s);return I.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?I.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Pn.displayName=`Form`;function Fn({getKey:e,storageKey:t,...n}){let r=I.useContext(bn),{basename:i}=I.useContext(Je),a=at(),o=At();Jn({getKey:e,storageKey:t});let s=I.useMemo(()=>{if(!r||!e)return null;let t=qn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return I.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${on(JSON.stringify(t||Gn))}, ${on(JSON.stringify(s))})`}})}Fn.displayName=`ScrollRestoration`;function In(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ln(e){let t=I.useContext(He);return R(t,In(e)),t}function Rn(e){let t=I.useContext(Ue);return R(t,In(e)),t}function zn(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=ct(),d=at(),f=pt(e,{relative:o});return I.useCallback(p=>{if(Yt(p,t)){p.preventDefault();let t=n===void 0?H(d)===H(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?I.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Bn(e){z(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=I.useRef(Xt(e)),n=I.useRef(!1),r=at(),i=I.useMemo(()=>Zt(r.search,n.current?null:t.current),[r.search]),a=ct();return[i,I.useCallback((e,t)=>{let r=Xt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Vn=0,Hn=()=>`__${String(++Vn)}__`;function Un(){let{router:e}=Ln(`useSubmit`),{basename:t}=I.useContext(Je),n=Ot(),r=e.fetch,i=e.navigate;return I.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=nn(e,t);a.navigate===!1?await r(a.fetcherKey||Hn(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_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}=I.useContext(Je),r=I.useContext(Xe);R(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...pt(e||`.`,{relative:t})},o=at();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:je([n,a.pathname])),H(a)}var Gn=`react-router-scroll-positions`,Kn={};function qn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Ce(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Jn({getKey:e,storageKey:t}={}){let{router:n}=Ln(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Rn(`useScrollRestoration`),{basename:a}=I.useContext(Je),o=at(),s=At(),c=kt();I.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Yn(I.useCallback(()=>{if(c.state===`idle`){let t=qn(o,s,a,e);Kn[t]=window.scrollY}try{sessionStorage.setItem(t||Gn,JSON.stringify(Kn))}catch(e){z(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(I.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Gn);e&&(Kn=JSON.parse(e))}catch{}},[t]),I.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Kn,()=>window.scrollY,e?(t,n)=>qn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),I.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{z(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Yn(e,t){let{capture:n}=t||{};I.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Xn(e,{relative:t}={}){let n=I.useContext(Ge);R(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ln(`useViewTransitionState`),i=pt(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ce(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Ce(n.nextLocation.pathname,r)||n.nextLocation.pathname;return be(i.pathname,o)!=null||be(i.pathname,a)!=null}var Zn=F(),Qn=t(N(),1),$n=e=>typeof e==`string`,er=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},tr=e=>e==null?``:String(e),nr=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},rr=/###/g,ir=e=>e&&e.includes(`###`)?e.replace(rr,`.`):e,ar=e=>!e||$n(e),or=(e,t,n)=>{let r=$n(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(ar(e))return{};let t=ir(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return ar(e)?{}:{obj:e,k:ir(r[i])}},sr=(e,t,n)=>{let{obj:r,k:i}=or(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=or(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=or(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},cr=(e,t,n,r)=>{let{obj:i,k:a}=or(e,t,Object);i[a]=i[a]||[],i[a].push(n)},lr=(e,t)=>{let{obj:n,k:r}=or(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},ur=(e,t,n)=>{let r=lr(e,n);return r===void 0?lr(t,n):r},dr=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?$n(e[r])||e[r]instanceof String||$n(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):dr(e[r],t[r],n):e[r]=t[r]);return e},fr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),pr={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},mr=e=>$n(e)?e.replace(/[&<>"'\/]/g,e=>pr[e]):e,hr=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},gr=[` `,`,`,`?`,`!`,`;`],_r=new hr(20),vr=(e,t,n)=>{t||=``,n||=``;let r=gr.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=_r.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},yr=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},br=e=>e?.replace(/_/g,`-`),xr={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Sr=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||xr,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>$n(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),$n(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Cr=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},wr=class extends Cr{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):$n(n)&&i?o.push(...n.split(i)):o.push(n)));let s=lr(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!$n(n)?s:yr(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),sr(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)($n(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=lr(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?dr(s,n,i):s={...s,...n},sr(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Tr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Er=Symbol(`i18next/PATH_KEY`);function Dr(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Er?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Or(e,t){let{[Er]:n}=e(Dr()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var kr=e=>!$n(e)&&typeof e!=`boolean`&&typeof e!=`number`,Ar=class e extends Cr{constructor(e,t={}){super(),nr([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Sr.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=kr(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!vr(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:$n(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:$n(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Or(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Or(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!$n(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=kr(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!($n(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:kr(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&$n(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=$n(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!$n(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=$n(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Tr.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return $n(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Or(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!$n(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&($n(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!$n(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},jr=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Sr.create(`languageUtils`)}getScriptPartFromCode(e){if(e=br(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=br(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if($n(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),$n(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return $n(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):$n(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},Mr={zero:0,one:1,two:2,few:3,many:4,other:5},Nr={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Pr=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Sr.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=br(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Nr;if(!e.match(/-|_/))return Nr;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Mr[e]-Mr[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Fr=(e,t,n,r=`.`,i=!0)=>{let a=ur(e,t,n);return!a&&i&&$n(n)&&(a=yr(e,n,r),a===void 0&&(a=yr(t,n,r))),a},Ir=e=>e.replace(/\$/g,`$$$$`),Lr=class{constructor(e={}){this.logger=Sr.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?mr:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?fr(i):a||`{{`,this.suffix=o?fr(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?fr(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?fr(l):``,this.nestingPrefix=d?fr(d):f||fr(`$t(`),this.nestingSuffix=p?fr(p):m||fr(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=Fr(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Fr(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ir(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ir(this.escape(e)):Ir(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=$n(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else !$n(a)&&!this.useRawValueToEscape&&(a=tr(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${fr(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!$n(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!$n(i))return i;$n(i)||(i=tr(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},Rr=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},zr=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(br(r),i),t[o]=s),s(n)}},Br=e=>(t,n,r)=>e(br(n),r)(t),Vr=class{constructor(e={}){this.logger=Sr.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?zr:Br;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=zr(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&!i[0].includes(`)`)&&i.find(e=>e.includes(`)`))){let e=i.findIndex(e=>e.includes(`)`));i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=Rr(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},Hr=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Ur=class extends Cr{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Sr.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{cr(n.loaded,[i],a),Hr(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();$n(e)&&(e=this.languageUtils.toResolveHierarchy(e)),$n(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},Wr=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),$n(e[1])&&(t.defaultValue=e[1]),$n(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Gr=e=>($n(e.ns)&&(e.ns=[e.ns]),$n(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),$n(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),Kr=()=>{},qr=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Jr=class e extends Cr{constructor(e={},t){if(super(),this.options=Gr(e),this.services={},this.logger=Sr,this.modules={external:[]},qr(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&($n(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=Wr();this.options={...n,...this.options,...Gr(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Sr.init(r(this.modules.logger),this.options):Sr.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Vr;let t=new jr(this.options);this.store=new wr(this.options.resources,this.options);let n=this.services;n.logger=Sr,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new Pr(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new Lr(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Ur(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new Ar(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=Kr,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=er(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=Kr){let n=t,r=$n(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=er();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=Kr,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Tr.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=er();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=$n(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes($n(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=Or(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=Or(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=Or(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return $n(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=er();return this.options.ns?($n(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=er();$n(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new jr(Wr());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=Kr){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new wr(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...Wr().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Lr(n)}return a.translator=new Ar(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();Jr.createInstance,Jr.dir,Jr.init,Jr.loadResources,Jr.reloadResources,Jr.use,Jr.changeLanguage,Jr.getFixedT,Jr.t,Jr.exists,Jr.setDefaultNamespace,Jr.hasLoadedNamespace,Jr.loadNamespaces,Jr.loadLanguages;var Yr=t(n(((e,t)=>{t.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}}))()),Xr=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Zr(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Yr.default[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){var r=e.indexOf(`-->`);return{type:`comment`,comment:r===-1?``:e.slice(4,r)}}for(var i=new RegExp(Xr),a=null;(a=i.exec(e))!==null;)if(a[0].trim())if(a[1]){var o=a[1].trim(),s=[o,``];o.indexOf(`=`)>-1&&(s=o.split(`=`)),t.attrs[s[0]]=s[1],i.lastIndex--}else a[2]&&(t.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return t}var Qr=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,$r=/^\s*$/,ei=Object.create(null);function ti(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:return e+=`<`+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+`="`+e[n]+`"`);return t.length?` `+t.join(` `):``}(t.attrs):``)+(t.voidElement?`/>`:`>`),t.voidElement?e:e+t.children.reduce(ti,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var ni={parse:function(e,t){t||={},t.components||=ei;var n,r=[],i=[],a=-1,o=!1;if(e.indexOf(`<`)!==0){var s=e.indexOf(`<`);r.push({type:`text`,content:s===-1?e:e.substring(0,s)})}return e.replace(Qr,function(s,c){if(o){if(s!==`</`+n.name+`>`)return;o=!1}var l,u=s.charAt(1)!==`/`,d=s.startsWith(`<!--`),f=c+s.length,p=e.charAt(f);if(d){var m=Zr(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=Zr(s)).type===`tag`&&t.components[n.name]&&(n.type=`component`,o=!0),n.voidElement||o||!p||p===`<`||n.children.push({type:`text`,content:e.slice(f,e.indexOf(`<`,f))}),a===0&&r.push(n),(l=i[a-1])&&l.children.push(n),i[a]=n),(!u||n.voidElement)&&(a>-1&&(n.voidElement||n.name===s.slice(2,-1))&&(a--,n=a===-1?r:i[a]),!o&&p!==`<`&&p)){l=a===-1?r:i[a].children;var h=e.indexOf(`<`,f),g=e.slice(f,h===-1?void 0:h);$r.test(g)&&(g=` `),(h>-1&&a+l.length>=0||g!==` `)&&l.push({type:`text`,content:g})}}),r},stringify:function(e){return e.reduce(function(e,t){return e+ti(``,t)},``)}},ri=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);ui(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},ii={},ai=(e,t,n,r)=>{ui(n)&&ii[n]||(ui(n)&&(ii[n]=new Date),ri(e,t,n,r))},oi=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},si=(e,t,n)=>{e.loadNamespaces(t,oi(e,n))},ci=(e,t,n,r)=>{if(ui(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return si(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,oi(e,r))},li=(e,t,n={})=>!t.languages||!t.languages.length?(ai(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),ui=e=>typeof e==`string`,di=e=>typeof e==`object`&&!!e,fi=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,pi={"&":`&`,"&":`&`,"<":`<`,"<":`<`,">":`>`,">":`>`,"'":`'`,"'":`'`,""":`"`,""":`"`," ":` `," ":` `,"©":`©`,"©":`©`,"®":`®`,"®":`®`,"…":`…`,"…":`…`,"/":`/`,"/":`/`},mi=e=>pi[e],hi=e=>e.replace(fi,mi),gi={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:hi,transDefaultProps:void 0},_i=(e={})=>{gi={...gi,...e}},vi=()=>gi,yi,bi=e=>{yi=e},xi=()=>yi,Si=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Ci=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?Ti(t):t},wi=e=>Array.isArray(e)&&e.every(I.isValidElement),Ti=e=>Array.isArray(e)?e:[e],Ei=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Di=e=>{let t={};if(!e)return t;let n=e=>{Ti(e).forEach(e=>{ui(e)||(Si(e)?n(Ci(e)):di(e)&&!(0,I.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},Oi=(e,t,n,r)=>{if(!e)return``;let i=``,a=Ti(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((e,a)=>{if(ui(e)){i+=`${e}`;return}if((0,I.isValidElement)(e)){let{props:s,type:c}=e,l=Object.keys(s).length,u=o.indexOf(c)>-1,d=s.children;if(!d&&u&&!l){i+=`<${c}/>`;return}if(!d&&(!u||l)||s.i18nIsDynamicList){i+=`<${a}></${a}>`;return}if(u&&l<=1){let e=ui(d)?d:Oi(d,t,n,r);i+=`<${c}>${e}</${c}>`;return}let f=Oi(d,t,n,r);i+=`<${a}>${f}</${a}>`;return}if(e===null){ri(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(di(e)){let{format:t,...a}=e,o=Object.keys(a);if(o.length===1){let e=t?`${o[0]}, ${t}`:o[0];i+=`{{${e}}}`;return}ri(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}ri(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},ki=(e,t=[],n={})=>{if(!e)return e;let r=Object.keys(n),i=[...t,...r],a=``,o=0;for(;o<e.length;)if(e[o]===`<`){let t=!1,n=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}if(!t){let n=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}}t||(a+=`<`,o+=1)}else a+=e[o],o+=1;return a},Ai=(e,t,n,r,i,a,o)=>{if(n===``)return[];let s=i.transKeepBasicHtmlNodesFor||[],c=n&&new RegExp(s.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!c&&!o)return[n];let l=t??{},u=e=>{Ti(e).forEach(e=>{ui(e)||(Si(e)?u(Ci(e)):di(e)&&!(0,I.isValidElement)(e)&&Object.assign(l,e))})};u(e);let d=ki(n,s,l),f=ni.parse(`<0>${d}</0>`),p={...l,...a},m=(e,t,n)=>{let r=Ci(e),i=g(r,t.children,n);return wi(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},h=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,I.cloneElement)(e,{key:r},i?void 0:t))):n.push(...I.Children.map([e],e=>{if(e.type===I.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),(0,I.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),(0,I.cloneElement)(e,n,i?null:t)}))},g=(e,n,a)=>{let l=Ti(e),u=Ti(n),d={};return u.reduce((e,n,u)=>{let f=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,p,r.language);if(n.type===`tag`){let _=l[parseInt(n.name,10)];!_&&t&&(_=t[n.name]),a.length===1&&!_&&(_=a[0][n.name]),_||={};let v={...n.attrs};o&&Object.keys(v).forEach(e=>{let t=v[e];ui(t)&&(v[e]=hi(t))});let y=Object.keys(v).length===0?_:Ei({props:v},_),b=(0,I.isValidElement)(y),x=b&&Si(n,!0)&&!n.voidElement,S=c&&di(y)&&y.dummy&&!b,C=di(t)&&Object.hasOwnProperty.call(t,n.name);if(ui(y)){let t=r.services.interpolator.interpolate(y,p,r.language);e.push(t)}else if(Si(y)||x)h(y,m(y,n,a),e,u);else if(S)h(y,g(l,n.children,a),e,u);else if(Number.isNaN(parseFloat(n.name)))if(C)h(y,m(y,n,a),e,u,n.voidElement);else if(i.transSupportBasicHtmlNodes&&s.indexOf(n.name)>-1)if(n.voidElement)e.push((0,I.createElement)(n.name,{key:`${n.name}-${u}`}));else{let t=d[n.name]||0;d[n.name]=t+1;let r,i=0;for(let e=0;e<l.length;e+=1){let a=l[e];if((0,I.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=g(r?Ti(Ci(r)):l,n.children,a);e.push((0,I.createElement)(n.name,{key:`${n.name}-${u}`},o))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=g(l,n.children,a);e.push(`<${n.name}>${t}</${n.name}>`)}else if(di(y)&&!b){let t=n.children[0]?f:null;t&&e.push(t)}else h(y,f,e,u,n.children.length!==1||!f)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:vi().unescape,s=o?a(r.services.interpolator.interpolate(n.content,p,r.language)):r.services.interpolator.interpolate(n.content,p,r.language);t?e.push((0,I.createElement)(t,{key:`${n.name}-${u}`},s)):e.push(s)}return e},[])};return Ci(g([{dummy:!0,children:e||[]}],f,Ti(e||[]))[0])},ji=(e,t,n)=>{let r=e.key||t,i=(0,I.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,I.createElement)(I.Fragment,null,i)}return(0,I.createElement)(a,{key:r})},Mi=(e,t)=>e.map((e,n)=>ji(e,n,t)),Ni=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:ji(e[r],r,t)})}),n},Pi=(e,t,n,r)=>e?Array.isArray(e)?Mi(e,t):di(e)?Ni(e,t):(ai(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,Fi=e=>!di(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function Ii({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let m=u||xi();if(!m)return ai(m,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using i18nextReactModule`,{i18nKey:r}),e;let h=d||m.t.bind(m)||(e=>e),g={...vi(),...m.options?.react},_=l||h.ns||m.options?.defaultNS;_=ui(_)?[_]:_||[`translation`];let{transDefaultProps:v}=g,y=v?.tOptions?{...v.tOptions,...a}:a,b=f??v?.shouldUnescape,x=v?.values?{...v.values,...o}:o,S=v?.components?{...v.components,...c}:c,C=Oi(e,g,m,r),w=s||y?.defaultValue||C||g.transEmptyNodeValue||(typeof r==`function`?Or(r):r),{hashTransKey:T}=g,E=r||(T?T(C||w):C||w);o=m.options?.interpolation?.defaultVariables?x&&Object.keys(x).length>0?{...x,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables}:x;let D=Di(e);D&&typeof D.count==`number`&&t===void 0&&(t=D.count);let O=o||t!==void 0&&!m.options?.interpolation?.alwaysFormat||!e?y.interpolation:{interpolation:{...y.interpolation,prefix:`#$?`,suffix:`?$#`}},k={...y,context:i||y.context,count:t,...o,...O,defaultValue:w,ns:_},A=E?h(E,k):w;A===E&&w&&(A=w);let j=Pi(S,A,m,r),M=j||e,N=null;Fi(j)&&(N=j,M=e);let P=Ai(M,N,A,m,g,k,b),F=n??g.defaultTransParent;return F?(0,I.createElement)(F,p,P):P}var Li={type:`3rdParty`,init(e){_i(e.options.react),bi(e)}},Ri=(0,I.createContext)(),zi=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}};function Bi({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let{i18n:m,defaultNS:h}=(0,I.useContext)(Ri)||{},g=u||m||xi(),_=d||g?.t.bind(g);return Ii({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:o,defaults:s,components:c,ns:l||_?.ns||h||g?.options?.defaultNS,i18n:g,t:d,shouldUnescape:f,...p})}var Vi=n((e=>{var t=k();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Hi=n(((e,t)=>{t.exports=Vi()})),Ui=Hi(),Wi={t:(e,t)=>{if(ui(t))return t;if(di(t)&&ui(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},Gi=()=>()=>{},G=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,I.useContext)(Ri)||{},a=n||r||xi();a&&!a.reportNamespaces&&(a.reportNamespaces=new zi),a||ai(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next`);let o=(0,I.useMemo)(()=>({...vi(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=ui(l)?[l]:l||[`translation`],d=(0,I.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,I.useRef)(0),p=(0,I.useCallback)(e=>{if(!a)return Gi;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,I.useRef)(),h=(0,I.useCallback)(()=>{if(!a)return Wi;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>li(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c,{scopeNs:d}),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,I.useState)(0),{t:v,ready:y}=(0,Ui.useSyncExternalStore)(p,h,h);(0,I.useEffect)(()=>{if(a&&!y&&!s){let e=()=>_(e=>e+1);t.lng?ci(a,t.lng,d,e):si(a,d,e)}},[a,t.lng,d,y,s,g]);let b=a||{},x=(0,I.useRef)(null),S=(0,I.useRef)(),C=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,`__original`,{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},w=(0,I.useMemo)(()=>{let e=b,t=e?.language,n=e;e&&(x.current&&x.current.__original===e&&S.current===t?n=x.current:(n=C(e),x.current=n,S.current=t));let r=!y&&!s?(...e)=>(ai(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),v(...e)):v,i=[r,n,y];return i.t=r,i.i18n=n,i.ready=y,i},[v,b,y,b.resolvedLanguage,b.language,b.languages]);if(a&&s&&!y)throw new Promise(e=>{let n=()=>e();t.lng?ci(a,t.lng,d,n):si(a,d,n)});return w};function Ki(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 qi=e=>{switch(e){case`success`:return Xi;case`info`:return Qi;case`warning`:return Zi;case`error`:return $i;default:return null}},Ji=Array(12).fill(0),Yi=({visible:e,className:t})=>I.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},I.createElement(`div`,{className:`sonner-spinner`},Ji.map((e,t)=>I.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Xi=I.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},I.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`})),Zi=I.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},I.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`})),Qi=I.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},I.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`})),$i=I.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},I.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`})),ea=I.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`},I.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),I.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),ta=()=>{let[e,t]=I.useState(document.hidden);return I.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},na=1,ra=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:na++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!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],I.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(aa(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`&&!I.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`&&!I.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`&&!I.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`&&!I.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||na++;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}},ia=(e,t)=>{let n=t?.id||na++;return ra.addToast({title:e,...t,id:n}),n},aa=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,K=Object.assign(ia,{success:ra.success,info:ra.info,warning:ra.warning,error:ra.error,custom:ra.custom,message:ra.message,promise:ra.promise,dismiss:ra.dismiss,loading:ra.loading},{getHistory:()=>ra.toasts,getToasts:()=>ra.getActiveToasts()});Ki(`[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 oa(e){return e.label!==void 0}var sa=3,ca=`24px`,la=`16px`,ua=4e3,da=356,fa=14,pa=45,ma=200;function ha(...e){return e.filter(Boolean).join(` `)}function ga(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var _a=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=I.useState(null),[O,k]=I.useState(null),[A,j]=I.useState(!1),[M,N]=I.useState(!1),[P,F]=I.useState(!1),[L,ee]=I.useState(!1),[te,R]=I.useState(!1),[z,B]=I.useState(0),[V,ne]=I.useState(0),H=I.useRef(n.duration||y||ua),U=I.useRef(null),re=I.useRef(null),ie=c===0,W=c+1<=o,ae=n.type,oe=n.dismissible!==!1,se=n.className||``,ce=n.descriptionClassName||``,le=I.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ue=I.useMemo(()=>n.closeButton??p,[n.closeButton,p]),de=I.useMemo(()=>n.duration||y||ua,[n.duration,y]),fe=I.useRef(0),pe=I.useRef(0),me=I.useRef(0),he=I.useRef(null),[ge,_e]=b.split(`-`),ve=I.useMemo(()=>s.reduce((e,t,n)=>n>=le?e:e+t.height,0),[s,le]),ye=ta(),be=n.invert||t,xe=ae===`loading`;pe.current=I.useMemo(()=>le*x+ve,[le,ve]),I.useEffect(()=>{H.current=de},[de]),I.useEffect(()=>{j(!0)},[]),I.useEffect(()=>{let e=re.current;if(e){let t=e.getBoundingClientRect().height;return ne(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),I.useLayoutEffect(()=>{if(!A)return;let e=re.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ne(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])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Se=I.useCallback(()=>{N(!0),B(pe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},ma)},[n,d,a,pe]);I.useEffect(()=>{if(n.promise&&ae===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||ye?(()=>{if(me.current<fe.current){let e=new Date().getTime()-fe.current;H.current-=e}me.current=new Date().getTime()})():H.current!==1/0&&(fe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Se()},H.current)),()=>clearTimeout(e)},[u,i,n,ae,ye,Se]),I.useEffect(()=>{n.delete&&(Se(),n.onDismiss==null||n.onDismiss.call(n,n))},[Se,n.delete]);function Ce(){return w?.loading?I.createElement(`div`,{className:ha(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ae===`loading`},w.loading):I.createElement(Yi,{className:ha(C?.loader,n?.classNames?.loader),visible:ae===`loading`})}let we=n.icon||w?.[ae]||qi(ae);return I.createElement(`li`,{tabIndex:0,ref:re,className:ha(_,se,C?.toast,n?.classNames?.toast,C?.default,C?.[ae],n?.classNames?.[ae]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":te,"data-removed":M,"data-visible":W,"data-y-position":ge,"data-x-position":_e,"data-index":c,"data-front":ie,"data-swiping":P,"data-dismissible":oe,"data-type":ae,"data-invert":be,"data-swipe-out":L,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?z:pe.current}px`,"--initial-height":S?`auto`:`${V}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),he.current=null},onPointerDown:e=>{e.button!==2&&(xe||!oe||(U.current=new Date,B(pe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),he.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(L||!oe)return;he.current=null;let e=Number(re.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(re.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-U.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=pa||a>.11){B(pe.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Se(),ee(!0);return}else{var o,s;(o=re.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=re.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}R(!1),F(!1),D(null)},onPointerMove:t=>{var n,r;if(!he.current||!oe||window.getSelection()?.toString().length>0)return;let i=t.clientY-he.current.y,a=t.clientX-he.current.x,o=e.swipeDirections??ga(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`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(E===`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)&&R(!0),(n=re.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=re.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ue&&!n.jsx&&ae!==`loading`?I.createElement(`button`,{"aria-label":T,"data-disabled":xe,"data-close-button":!0,onClick:xe||!oe?()=>{}:()=>{Se(),n.onDismiss==null||n.onDismiss.call(n,n)},className:ha(C?.closeButton,n?.classNames?.closeButton)},w?.close??ea):null,(ae||n.icon||n.promise)&&n.icon!==null&&(w?.[ae]!==null||n.icon)?I.createElement(`div`,{"data-icon":``,className:ha(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ce():null,n.type===`loading`?null:we):null,I.createElement(`div`,{"data-content":``,className:ha(C?.content,n?.classNames?.content)},I.createElement(`div`,{"data-title":``,className:ha(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?I.createElement(`div`,{"data-description":``,className:ha(v,ce,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),I.isValidElement(n.cancel)?n.cancel:n.cancel&&oa(n.cancel)?I.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{oa(n.cancel)&&oe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Se())},className:ha(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,I.isValidElement(n.action)?n.action:n.action&&oa(n.action)?I.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{oa(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Se())},className:ha(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function va(){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 ya(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?la:ca;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 ba=I.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:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=sa,toastOptions:g,dir:_=va(),gap:v=fa,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=I.useState([]),C=I.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=I.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,E]=I.useState([]),[D,O]=I.useState(!1),[k,A]=I.useState(!1),[j,M]=I.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),N=I.useRef(null),P=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),F=I.useRef(null),L=I.useRef(!1),ee=I.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||ra.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return I.useEffect(()=>ra.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Qn.flushSync(()=>{S(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)]})})})}),[x]),I.useEffect(()=>{if(d!==`system`){M(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?M(`dark`):M(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{M(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{M(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),I.useEffect(()=>{x.length<=1&&O(!1)},[x]),I.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=N.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===N.current||N.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),I.useEffect(()=>{if(N.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,L.current=!1)}},[N.current]),I.createElement(`section`,{ref:t,"aria-label":`${b} ${P}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?I.createElement(`ol`,{key:t,dir:_===`auto`?va():_,tabIndex:-1,ref:N,className:c,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${da}px`,"--gap":`${v}px`,...m,...ya(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,F.current&&=(F.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,F.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{k||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||A(!0)},onPointerUp:()=>A(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>I.createElement(_a,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:k,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:ee,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:v,expanded:D,swipeDirections:e.swipeDirections}))):null}))}),xa=null;function Sa(e){xa=e}function Ca(e,t){xa?.(e,t)}function wa(){var e=[...arguments];return(0,I.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Ta=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ea(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Da(e){return`nodeType`in e}function Oa(e){return e?Ea(e)?e:Da(e)?e.ownerDocument?.defaultView??window:window:window}function ka(e){let{Document:t}=Oa(e);return e instanceof t}function Aa(e){return Ea(e)?!1:e instanceof Oa(e).HTMLElement}function ja(e){return e instanceof Oa(e).SVGElement}function Ma(e){return e?Ea(e)?e.document:Da(e)?ka(e)?e:Aa(e)||ja(e)?e.ownerDocument:document:document:document}var Na=Ta?I.useLayoutEffect:I.useEffect;function Pa(e){let t=(0,I.useRef)(e);return Na(()=>{t.current=e}),(0,I.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Fa(){let e=(0,I.useRef)(null);return[(0,I.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,I.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Ia(e,t){t===void 0&&(t=[e]);let n=(0,I.useRef)(e);return Na(()=>{n.current!==e&&(n.current=e)},t),n}function La(e,t){let n=(0,I.useRef)();return(0,I.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Ra(e){let t=Pa(e),n=(0,I.useRef)(null);return[n,(0,I.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function za(e){let t=(0,I.useRef)();return(0,I.useEffect)(()=>{t.current=e},[e]),t.current}var Ba={};function Va(e,t){return(0,I.useMemo)(()=>{if(t)return t;let n=Ba[e]==null?0:Ba[e]+1;return Ba[e]=n,e+`-`+n},[e,t])}function Ha(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Ua=Ha(1),Wa=Ha(-1);function Ga(e){return`clientX`in e&&`clientY`in e}function Ka(e){if(!e)return!1;let{KeyboardEvent:t}=Oa(e.target);return t&&e instanceof t}function qa(e){if(!e)return!1;let{TouchEvent:t}=Oa(e.target);return t&&e instanceof t}function Ja(e){if(qa(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ga(e)?{x:e.clientX,y:e.clientY}:null}var Ya=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Ya.Translate.toString(e),Ya.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Xa=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Za(e){return e.matches(Xa)?e:e.querySelector(Xa)}var Qa={display:`none`};function $a(e){let{id:t,value:n}=e;return I.createElement(`div`,{id:t,style:Qa},n)}function eo(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return I.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function to(){let[e,t]=(0,I.useState)(``);return{announce:(0,I.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var no=(0,I.createContext)(null);function ro(e){let t=(0,I.useContext)(no);(0,I.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function io(){let[e]=(0,I.useState)(()=>new Set),t=(0,I.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,I.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var ao={draggable:`
|
|
13
|
+
To pick up a draggable item, press the space bar.
|
|
14
|
+
While dragging, use the arrow keys to move the item.
|
|
15
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
16
|
+
`},oo={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function so(e){let{announcements:t=oo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=ao}=e,{announce:a,announcement:o}=to(),s=Va(`DndLiveRegion`),[c,l]=(0,I.useState)(!1);if((0,I.useEffect)(()=>{l(!0)},[]),ro((0,I.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=I.createElement(I.Fragment,null,I.createElement($a,{id:r,value:i.draggable}),I.createElement(eo,{id:s,announcement:o}));return n?(0,Qn.createPortal)(u,n):u}var co;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(co||={});function lo(){}function uo(e,t){return(0,I.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function fo(){var e=[...arguments];return(0,I.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var po=Object.freeze({x:0,y:0});function mo(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ho(e,t){let n=Ja(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function go(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function _o(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function vo(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function yo(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function bo(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var xo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=bo(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=mo(bo(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(go)},So=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=vo(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=vo(r),o=i.reduce((e,t,r)=>e+mo(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(go)};function Co(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var wo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Co(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(_o)};function To(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var Eo=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&To(r,a)){let n=vo(a).reduce((e,t)=>e+mo(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(go)};function Do(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Oo(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:po}function ko(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Ao=ko(1);function jo(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Mo(e,t,n){let r=jo(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var No={ignoreTransform:!1};function Po(e,t){t===void 0&&(t=No);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Oa(e).getComputedStyle(e);t&&(n=Mo(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Fo(e){return Po(e,{ignoreTransform:!0})}function Io(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Lo(e,t){return t===void 0&&(t=Oa(e).getComputedStyle(e)),t.position===`fixed`}function Ro(e,t){t===void 0&&(t=Oa(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function zo(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ka(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Aa(i)||ja(i)||n.includes(i))return n;let a=Oa(e).getComputedStyle(i);return i!==e&&Ro(i,a)&&n.push(i),Lo(i,a)?n:r(i.parentNode)}return e?r(e):n}function Bo(e){let[t]=zo(e,1);return t??null}function Vo(e){return!Ta||!e?null:Ea(e)?e:Da(e)?ka(e)||e===Ma(e).scrollingElement?window:Aa(e)?e:null:null}function Ho(e){return Ea(e)?e.scrollX:e.scrollLeft}function Uo(e){return Ea(e)?e.scrollY:e.scrollTop}function Wo(e){return{x:Ho(e),y:Uo(e)}}var Go;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Go||={});function Ko(e){return!Ta||!e?!1:e===document.scrollingElement}function qo(e){let t={x:0,y:0},n=Ko(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Jo={x:.2,y:.2};function Yo(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Jo);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=qo(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Go.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Go.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Go.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Go.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Xo(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Zo(e){return e.reduce((e,t)=>Ua(e,Wo(t)),po)}function Qo(e){return e.reduce((e,t)=>e+Ho(t),0)}function $o(e){return e.reduce((e,t)=>e+Uo(t),0)}function es(e,t){if(t===void 0&&(t=Po),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Bo(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var ts=[[`x`,[`left`,`right`],Qo],[`y`,[`top`,`bottom`],$o]],ns=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=zo(t),r=Zo(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of ts)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},rs=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function is(e){let{EventTarget:t}=Oa(e);return e instanceof t?e:Ma(e)}function as(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var os;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(os||={});function ss(e){e.preventDefault()}function cs(e){e.stopPropagation()}var ls;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(ls||={});var us={start:[ls.Space,ls.Enter],cancel:[ls.Esc],end:[ls.Space,ls.Enter,ls.Tab]},ds=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ls.Right:return{...n,x:n.x+25};case ls.Left:return{...n,x:n.x-25};case ls.Down:return{...n,y:n.y+25};case ls.Up:return{...n,y:n.y-25}}},fs=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new rs(Ma(t)),this.windowListeners=new rs(Oa(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(os.Resize,this.handleCancel),this.windowListeners.add(os.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(os.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&es(n),t(po)}handleKeyDown(e){if(Ka(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=us,coordinateGetter:a=ds,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:po;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Wa(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=qo(n),p=Xo(n),m={x:Math.min(i===ls.Right?p.right-p.width/2:p.right,Math.max(i===ls.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===ls.Down?p.bottom-p.height/2:p.bottom,Math.max(i===ls.Down?p.top:p.top+p.height/2,u.y))},h=i===ls.Right&&!s||i===ls.Left&&!c,g=i===ls.Down&&!l||i===ls.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===ls.Right&&e<=d.x||i===ls.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===ls.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===ls.Down&&e<=d.y||i===ls.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===ls.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Ua(Wa(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};fs.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=us,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function ps(e){return!!(e&&`distance`in e)}function ms(e){return!!(e&&`delay`in e)}var hs=class{constructor(e,t,n){n===void 0&&(n=is(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Ma(i),this.documentListeners=new rs(this.document),this.listeners=new rs(n),this.windowListeners=new rs(Oa(i)),this.initialCoordinates=Ja(r)??po,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(os.Resize,this.handleCancel),this.windowListeners.add(os.DragStart,ss),this.windowListeners.add(os.VisibilityChange,this.handleCancel),this.windowListeners.add(os.ContextMenu,ss),this.documentListeners.add(os.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ms(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(ps(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(os.Click,cs,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(os.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Ja(e)??po,s=Wa(n,o);if(!t&&a){if(ps(a)){if(a.tolerance!=null&&as(s,a.tolerance))return this.handleCancel();if(as(s,a.distance))return this.handleStart()}if(ms(a)&&as(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===ls.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},gs={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},_s=class extends hs{constructor(e){let{event:t}=e,n=Ma(t.target);super(e,gs,n)}};_s.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var vs={move:{name:`mousemove`},end:{name:`mouseup`}},ys;(function(e){e[e.RightClick=2]=`RightClick`})(ys||={});var bs=class extends hs{constructor(e){super(e,vs,Ma(e.event.target))}};bs.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ys.RightClick?!1:(r?.({event:n}),!0)}}];var xs={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Ss=class extends hs{constructor(e){super(e,xs)}static setup(){return window.addEventListener(xs.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(xs.move.name,e)};function e(){}}};Ss.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Cs;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Cs||={});var ws;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(ws||={});function Ts(e){let{acceleration:t,activator:n=Cs.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=ws.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Ds({delta:d,disabled:!a}),[m,h]=Fa(),g=(0,I.useRef)({x:0,y:0}),_=(0,I.useRef)({x:0,y:0}),v=(0,I.useMemo)(()=>{switch(n){case Cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Cs.DraggableRect:return i}},[n,i,c]),y=(0,I.useRef)(null),b=(0,I.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,I.useMemo)(()=>s===ws.TreeOrder?[...l].reverse():l,[s,l]);(0,I.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Yo(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Es={x:{[Go.Backward]:!1,[Go.Forward]:!1},y:{[Go.Backward]:!1,[Go.Forward]:!1}};function Ds(e){let{delta:t,disabled:n}=e,r=za(t);return La(e=>{if(n||!r||!e)return Es;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Go.Backward]:e.x[Go.Backward]||i.x===-1,[Go.Forward]:e.x[Go.Forward]||i.x===1},y:{[Go.Backward]:e.y[Go.Backward]||i.y===-1,[Go.Forward]:e.y[Go.Forward]||i.y===1}}},[n,t,r])}function Os(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return La(e=>t==null?null:r??e??null,[r,t])}function ks(e,t){return(0,I.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var As;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(As||={});var js;(function(e){e.Optimized=`optimized`})(js||={});var Ms=new Map;function Ns(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,I.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,I.useRef)(e),d=g(),f=Ia(d),p=(0,I.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,I.useRef)(null),h=La(t=>{if(d&&!n)return Ms;if(!t||t===Ms||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new ns(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,I.useEffect)(()=>{u.current=e},[e]),(0,I.useEffect)(()=>{d||p()},[n,d]),(0,I.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,I.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case As.Always:return!1;case As.BeforeDragging:return n;default:return!n}}}function Ps(e,t){return La(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Fs(e,t){return Ps(e,t)}function Is(e){let{callback:t,disabled:n}=e,r=Pa(t),i=(0,I.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,I.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ls(e){let{callback:t,disabled:n}=e,r=Pa(t),i=(0,I.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,I.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Rs(e){return new ns(Po(e),e)}function zs(e,t,n){t===void 0&&(t=Rs);let[r,i]=(0,I.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Is({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Ls({callback:a});return Na(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Bs(e){return Oo(e,Ps(e))}var Vs=[];function Hs(e){let t=(0,I.useRef)(e),n=La(n=>e?n&&n!==Vs&&e&&t.current&&e.parentNode===t.current.parentNode?n:zo(e):Vs,[e]);return(0,I.useEffect)(()=>{t.current=e},[e]),n}function Us(e){let[t,n]=(0,I.useState)(null),r=(0,I.useRef)(e),i=(0,I.useCallback)(e=>{let t=Vo(e.target);t&&n(e=>e?(e.set(t,Wo(t)),new Map(e)):null)},[]);return(0,I.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Vo(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Wo(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Vo(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,I.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Ua(e,t),po):Zo(e):po,[e,t])}function Ws(e,t){t===void 0&&(t=[]);let n=(0,I.useRef)(null);return(0,I.useEffect)(()=>{n.current=null},t),(0,I.useEffect)(()=>{let t=e!==po;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Wa(e,n.current):po}function Gs(e){(0,I.useEffect)(()=>{if(!Ta)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Ks(e,t){return(0,I.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function qs(e){return(0,I.useMemo)(()=>e?Io(e):null,[e])}var Js=[];function Ys(e,t){t===void 0&&(t=Po);let[n]=e,r=qs(n?Oa(n):null),[i,a]=(0,I.useState)(Js);function o(){a(()=>e.length?e.map(e=>Ko(e)?r:new ns(t(e),e)):Js)}let s=Ls({callback:o});return Na(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Xs(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Aa(t)?t:e}function Zs(e){let{measure:t}=e,[n,r]=(0,I.useState)(null),i=Ls({callback:(0,I.useCallback)(e=>{for(let{target:n}of e)if(Aa(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Ra((0,I.useCallback)(e=>{let n=Xs(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,I.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Qs=[{sensor:_s,options:{}},{sensor:fs,options:{}}],$s={current:{}},ec={draggable:{measure:Fo},droppable:{measure:Fo,strategy:As.WhileDragging,frequency:js.Optimized},dragOverlay:{measure:Po}},tc=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},nc={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new tc,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lo},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ec,measureDroppableContainers:lo,windowRect:null,measuringScheduled:!1},rc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:lo,draggableNodes:new Map,over:null,measureDroppableContainers:lo},ic=(0,I.createContext)(rc),ac=(0,I.createContext)(nc);function oc(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new tc}}}function sc(e,t){switch(t.type){case co.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case co.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case co.DragEnd:case co.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case co.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new tc(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case co.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new tc(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case co.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new tc(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function cc(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,I.useContext)(ic),a=za(r),o=za(n?.id);return(0,I.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ka(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Za(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function lc(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function uc(e){return(0,I.useMemo)(()=>({draggable:{...ec.draggable,...e?.draggable},droppable:{...ec.droppable,...e?.droppable},dragOverlay:{...ec.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function dc(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,I.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Na(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Oo(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Bo(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var fc=(0,I.createContext)({...po,scaleX:1,scaleY:1}),pc;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(pc||={});var mc=(0,I.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Qs,collisionDetection:o=wo,measuring:s,modifiers:c,...l}=e,[u,d]=(0,I.useReducer)(sc,void 0,oc),[f,p]=io(),[m,h]=(0,I.useState)(pc.Uninitialized),g=m===pc.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,I.useRef)({initial:null,translated:null}),C=(0,I.useMemo)(()=>_==null?null:{id:_,data:x?.data??$s,rect:S},[_,x]),w=(0,I.useRef)(null),[T,E]=(0,I.useState)(null),[D,O]=(0,I.useState)(null),k=Ia(l,Object.values(l)),A=Va(`DndDescribedBy`,t),j=(0,I.useMemo)(()=>b.getEnabled(),[b]),M=uc(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Ns(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),L=Os(v,_),ee=(0,I.useMemo)(()=>D?Ja(D):null,[D]),te=Te(),R=Fs(L,M.draggable.measure);dc({activeNode:_==null?null:v.get(_),config:te.layoutShiftCompensation,initialRect:R,measure:M.draggable.measure});let z=zs(L,M.draggable.measure,R),B=zs(L?L.parentElement:null),V=(0,I.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),H=Zs({measure:M.dragOverlay.measure}),U=H.nodeRef.current??L,re=g?H.rect??z:null,ie=!!(H.nodeRef.current&&H.rect),W=Bs(ie?null:z),ae=qs(U?Oa(U):null),oe=Hs(g?ne??L:null),se=Ys(oe),ce=lc(c,{transform:{x:y.x-W.x,y:y.y-W.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:z,containerNodeRect:B,draggingNodeRect:re,over:V.current.over,overlayNodeRect:H.rect,scrollableAncestors:oe,scrollableAncestorRects:se,windowRect:ae}),le=ee?Ua(ee,y):null,ue=Us(oe),de=Ws(ue),fe=Ws(ue,[z]),pe=Ua(ce,de),me=re?Ao(re,ce):null,he=C&&me?o({active:C,collisionRect:me,droppableRects:N,droppableContainers:j,pointerCoordinates:le}):null,ge=yo(he,`id`),[_e,ve]=(0,I.useState)(null),ye=Do(ie?ce:Ua(ce,fe),_e?.rect??null,z),be=(0,I.useRef)(null),xe=(0,I.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:w.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Qn.unstable_batchedUpdates)(()=>{r?.(i),h(pc.Initializing),d({type:co.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(be.current),O(a)})},onMove(e){d({type:co.DragMove,coordinates:e})},onEnd:o(co.DragEnd),onCancel:o(co.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===co.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=co.DragCancel)}w.current=null,(0,Qn.unstable_batchedUpdates)(()=>{d({type:e}),h(pc.Uninitialized),ve(null),E(null),O(null),be.current=null;let t=e===co.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=ks(a,(0,I.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,xe(n,t))},[v,xe]));Gs(a),Na(()=>{z&&m===pc.Initializing&&h(pc.Initialized)},[z,m]),(0,I.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:i};(0,Qn.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[pe.x,pe.y]),(0,I.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Qn.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),Na(()=>{V.current={activatorEvent:D,active:C,activeNode:L,collisionRect:me,collisions:he,droppableRects:N,draggableNodes:v,draggingNode:U,draggingNodeRect:re,droppableContainers:b,over:_e,scrollableAncestors:oe,scrollAdjustedTranslate:pe},S.current={initial:re,translated:me}},[C,L,he,me,v,U,re,N,b,_e,oe,pe]),Ts({...te,delta:y,draggingRect:me,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:se});let Ce=(0,I.useMemo)(()=>({active:C,activeNode:L,activeNodeRect:z,activatorEvent:D,collisions:he,containerNodeRect:B,dragOverlay:H,draggableNodes:v,droppableContainers:b,droppableRects:N,over:_e,measureDroppableContainers:P,scrollableAncestors:oe,scrollableAncestorRects:se,measuringConfiguration:M,measuringScheduled:F,windowRect:ae}),[C,L,z,D,he,B,H,v,b,N,_e,P,oe,se,M,F,ae]),we=(0,I.useMemo)(()=>({activatorEvent:D,activators:Se,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:P}),[D,Se,C,z,d,A,v,_e,P]);return I.createElement(no.Provider,{value:p},I.createElement(ic.Provider,{value:we},I.createElement(ac.Provider,{value:Ce},I.createElement(fc.Provider,{value:ye},i)),I.createElement(cc,{disabled:n?.restoreFocus===!1})),I.createElement(so,{...n,hiddenTextDescribedById:A}));function Te(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),hc=(0,I.createContext)(null),gc=`button`,_c=`Draggable`;function vc(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Va(_c),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,I.useContext)(ic),{role:p=gc,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,I.useContext)(g?fc:hc),[v,y]=Ra(),[b,x]=Ra(),S=Ks(o,t),C=Ia(n);return Na(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,I.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===gc?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function yc(){return(0,I.useContext)(ac)}var bc=`Droppable`,xc={timeout:25};function Sc(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Va(bc),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,I.useContext)(ic),u=(0,I.useRef)({disabled:n}),d=(0,I.useRef)(!1),f=(0,I.useRef)(null),p=(0,I.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...xc,...i},_=Ia(h??r),v=Ls({callback:(0,I.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Ra((0,I.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Ia(t);return(0,I.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,I.useEffect)(()=>(s({type:co.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:co.UnregisterDroppable,key:a,id:r})),[r]),(0,I.useEffect)(()=>{n!==u.current.disabled&&(s({type:co.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Cc(e){let{animation:t,children:n}=e,[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),s=za(n);return!n&&!r&&s&&i(s),Na(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),I.createElement(I.Fragment,null,n,r?(0,I.cloneElement)(r,{ref:o}):null)}var wc={x:0,y:0,scaleX:1,scaleY:1};function Tc(e){let{children:t}=e;return I.createElement(ic.Provider,{value:rc},I.createElement(fc.Provider,{value:wc},t))}var Ec={position:`fixed`,touchAction:`none`},Dc=e=>Ka(e)?`transform 250ms ease`:void 0,Oc=(0,I.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Dc}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Ec,width:s.width,height:s.height,top:s.top,left:s.left,transform:Ya.Transform.toString(d),transformOrigin:i&&r?ho(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return I.createElement(n,{className:o,style:f,ref:t},a)}),kc={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Ya.Transform.toString(t)},{transform:Ya.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Ac(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Pa((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Xs(a);if(!c)return;let{transform:l}=Oa(a).getComputedStyle(a),u=jo(l);if(!u)return;let d=typeof t==`function`?t:jc(t);return es(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function jc(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...kc,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var Mc=0;function Nc(e){return(0,I.useMemo)(()=>{if(e!=null)return Mc++,Mc},[e])}var Pc=I.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=yc(),S=(0,I.useContext)(fc),C=Nc(d?.id),w=lc(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=Ps(f),E=Ac({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return I.createElement(Tc,null,I.createElement(Cc,{animation:E},d&&C?I.createElement(Oc,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function Fc(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ic(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Lc(e){return e!==null&&e>=0}function Rc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function zc(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Bc=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Fc(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},Vc={scaleX:1,scaleY:1},Hc=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...Vc}:null}let s=Uc(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...Vc}:r<t&&r>=a?{x:0,y:o.height+s,...Vc}:{x:0,y:0,...Vc}};function Uc(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var Wc=`Sortable`,Gc=I.createContext({activeIndex:-1,containerId:Wc,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Bc,disabled:{draggable:!1,droppable:!1}});function Kc(e){let{children:t,id:n,items:r,strategy:i=Bc,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=yc(),d=Va(Wc,n),f=s.rect!==null,p=(0,I.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,I.useRef)(p),v=!Rc(p,_.current),y=g!==-1&&h===-1||v,b=zc(a);Na(()=>{v&&m&&u(p)},[v,p,m,u]),(0,I.useEffect)(()=>{_.current=p},[p]);let x=(0,I.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:Ic(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return I.createElement(Gc.Provider,{value:x},t)}var qc=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Fc(n,r,i).indexOf(t)},Jc=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Yc={duration:200,easing:`ease`},Xc=`transform`,Zc=Ya.Transition.toString({property:Xc,duration:0,easing:`linear`}),Qc={roleDescription:`sortable`};function $c(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,I.useState)(null),s=(0,I.useRef)(n);return Na(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Po(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,I.useEffect)(()=>{a&&o(null)},[a]),a}function el(e){let{animateLayoutChanges:t=Jc,attributes:n,disabled:r,data:i,getNewIndex:a=qc,id:o,strategy:s,resizeObserverConfig:c,transition:l=Yc}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,I.useContext)(Gc),y=tl(r,p),b=u.indexOf(o),x=(0,I.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,I.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=Sc({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:L}=vc({id:o,data:x,attributes:{...Qc,...n},disabled:y.draggable}),ee=wa(E,j),te=!!D,R=te&&!m&&Lc(f)&&Lc(g),z=!_&&N,B=R?(z&&R?L:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,V=Lc(f)&&Lc(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=D?.id,H=(0,I.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),U=u!==H.current.items,re=t({active:D,containerId:d,isDragging:N,isSorting:te,id:o,index:b,items:u,newIndex:H.current.newIndex,previousItems:H.current.items,previousContainerId:H.current.containerId,transition:l,wasDragging:H.current.activeId!=null}),ie=$c({disabled:!re,index:b,node:w,rect:C});return(0,I.useEffect)(()=>{te&&H.current.newIndex!==V&&(H.current.newIndex=V),d!==H.current.containerId&&(H.current.containerId=d),u!==H.current.items&&(H.current.items=u)},[te,V,d,u]),(0,I.useEffect)(()=>{if(ne===H.current.activeId)return;if(ne!=null&&H.current.activeId==null){H.current.activeId=ne;return}let e=setTimeout(()=>{H.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:V,items:u,isOver:T,isSorting:te,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ie??B,transition:W()};function W(){if(ie||U&&H.current.newIndex===b)return Zc;if(!(z&&!Ka(O)||!l)&&(te||re))return Ya.Transition.toString({...l,property:Xc})}}function tl(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function nl(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var rl=[ls.Down,ls.Right,ls.Up,ls.Left],il=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(rl.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case ls.Down:r.top<a.top&&t.push(n);break;case ls.Up:r.top>a.top&&t.push(n);break;case ls.Left:r.left>a.left&&t.push(n);break;case ls.Right:r.left<a.left&&t.push(n);break}});let c=So({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=yo(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=zo(c).some((e,t)=>s[t]!==e),i=al(e,t),a=ol(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Wa(u,l)}}}};function al(e,t){return!nl(e)||!nl(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ol(e,t){return!nl(e)||!nl(t)||!al(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var sl=(()=>{if(typeof window>`u`)return``;if(`__TAURI_INTERNALS__`in window)return`http://localhost:4200`;let e=window.location.protocol;return e!==`http:`&&e!==`https:`?`http://localhost:4200`:``})(),cl=null;function ll(e){cl=e}function ul(){if(!cl)throw Error(`getApiBase called with no active project — call setActiveProjectId first`);return`${sl}/api/projects/${cl}`}var dl=null;async function fl(){for(let e=0;e<20;e++){try{let e=await fetch(`${sl}/api/token`);if(e.ok){dl=(await e.json()).token??null;return}}catch{}await new Promise(e=>setTimeout(e,300))}}function pl(){return dl}function ml(){return dl?`desktop-token.${dl}`:void 0}function hl(){let e=window.fetch.bind(window),t=typeof window<`u`?window.location.protocol:``,n=typeof window<`u`&&`__TAURI_INTERNALS__`in window||t!==``&&t!==`http:`&&t!==`https:`;window.fetch=function(t,r={}){let i=typeof t==`string`?t:t instanceof URL?t.href:t.url;if(n&&i.startsWith(`/`)&&(i=`http://localhost:4200${i}`,t=i),(()=>{if(i.startsWith(`/`))return!0;try{let e=new URL(i),t=sl?new URL(sl).origin:window.location.origin;return e.origin===t}catch{return!1}})()&&dl){let n=new Headers(r.headers);return n.has(`X-Desktop-Token`)||n.set(`X-Desktop-Token`,dl),e(t,{...r,headers:n})}return e(t,r)}}var gl=n((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})),_l=n(((e,t)=>{t.exports=gl()})),q=_l(),vl=[1e3,2e3,4e3,8e3,16e3],yl=(0,I.createContext)(null);function bl({url:e,children:t}){let[n,r]=(0,I.useState)(`connecting`),i=(0,I.useRef)(new Map),a=(0,I.useRef)(null),o=(0,I.useRef)(0),s=(0,I.useRef)(null);(0,I.useEffect)(()=>{let t=!1;function n(){if(t)return;let c=ml(),l=c?new WebSocket(e,[`specrails-desktop`,c]):new WebSocket(e);a.current=l,r(`connecting`),l.onopen=()=>{if(t){l.close();return}o.current=0,r(`connected`)},l.onmessage=e=>{if(t)return;let n;try{n=JSON.parse(e.data)}catch{return}for(let e of i.current.values())e(n)},l.onclose=()=>{if(t)return;a.current=null;let e=o.current;if(e>=vl.length){r(`connecting`),s.current=setTimeout(n,3e4);return}r(`connecting`);let i=vl[e];o.current+=1,s.current=setTimeout(n,i)}}return n(),()=>{t=!0,s.current&&clearTimeout(s.current);let e=a.current;if(e)if(e.onmessage=null,e.onclose=null,e.onerror=null,e.readyState===WebSocket.CONNECTING)e.onopen=()=>{try{e.close()}catch{}};else{e.onopen=null;try{e.close()}catch{}}}},[e]);let c=(0,I.useCallback)((e,t)=>{i.current.set(e,t)},[]),l=(0,I.useCallback)(e=>{i.current.delete(e)},[]),u=(0,I.useMemo)(()=>({registerHandler:c,unregisterHandler:l,connectionStatus:n}),[c,l,n]);return(0,q.jsx)(yl.Provider,{value:u,children:t})}function xl(){let e=(0,I.useContext)(yl);if(!e)throw Error(`useSharedWebSocket must be used within SharedWebSocketProvider`);return e}function Sl(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function Cl(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}function wl(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?El(s,e=>e.test(o)):Tl(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Tl(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function El(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Dl(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Ol=365.2425,kl=6048e5,Al=864e5,jl=6e4,Ml=36e5,Nl=43200,Pl=1440,Fl=3600*24;Fl*7,Fl*Ol/12*3;var Il=Symbol.for(`constructDateFrom`);function Ll(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Il in e?e[Il](t):e instanceof Date?new e.constructor(t):new Date(t)}function Rl(e,...t){let n=Ll.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}var zl={};function Bl(){return zl}function Vl(e,t){return Ll(t||e,e)}function Hl(e,t){let n=Bl(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vl(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Ul(e,t,n){let[r,i]=Rl(n?.in,e,t);return+Hl(r,n)==+Hl(i,n)}var Wl={lessThanXSeconds:{standalone:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`},withPreposition:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`}},xSeconds:{standalone:{one:`1 Sekunde`,other:`{{count}} Sekunden`},withPreposition:{one:`1 Sekunde`,other:`{{count}} Sekunden`}},halfAMinute:{standalone:`eine halbe Minute`,withPreposition:`einer halben Minute`},lessThanXMinutes:{standalone:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`},withPreposition:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`}},xMinutes:{standalone:{one:`1 Minute`,other:`{{count}} Minuten`},withPreposition:{one:`1 Minute`,other:`{{count}} Minuten`}},aboutXHours:{standalone:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`},withPreposition:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`}},xHours:{standalone:{one:`1 Stunde`,other:`{{count}} Stunden`},withPreposition:{one:`1 Stunde`,other:`{{count}} Stunden`}},xDays:{standalone:{one:`1 Tag`,other:`{{count}} Tage`},withPreposition:{one:`1 Tag`,other:`{{count}} Tagen`}},aboutXWeeks:{standalone:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`},withPreposition:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`}},xWeeks:{standalone:{one:`1 Woche`,other:`{{count}} Wochen`},withPreposition:{one:`1 Woche`,other:`{{count}} Wochen`}},aboutXMonths:{standalone:{one:`etwa 1 Monat`,other:`etwa {{count}} Monate`},withPreposition:{one:`etwa 1 Monat`,other:`etwa {{count}} Monaten`}},xMonths:{standalone:{one:`1 Monat`,other:`{{count}} Monate`},withPreposition:{one:`1 Monat`,other:`{{count}} Monaten`}},aboutXYears:{standalone:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahre`},withPreposition:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahren`}},xYears:{standalone:{one:`1 Jahr`,other:`{{count}} Jahre`},withPreposition:{one:`1 Jahr`,other:`{{count}} Jahren`}},overXYears:{standalone:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahre`},withPreposition:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahren`}},almostXYears:{standalone:{one:`fast 1 Jahr`,other:`fast {{count}} Jahre`},withPreposition:{one:`fast 1 Jahr`,other:`fast {{count}} Jahren`}}},Gl=(e,t,n)=>{let r,i=n?.addSuffix?Wl[e].withPreposition:Wl[e].standalone;return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:`vor `+r:r},Kl={date:Sl({formats:{full:`EEEE, do MMMM y`,long:`do MMMM y`,medium:`do MMM y`,short:`dd.MM.y`},defaultWidth:`full`}),time:Sl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} 'um' {{time}}`,long:`{{date}} 'um' {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},ql={lastWeek:`'letzten' eeee 'um' p`,yesterday:`'gestern um' p`,today:`'heute um' p`,tomorrow:`'morgen um' p`,nextWeek:`eeee 'um' p`,other:`P`},Jl=(e,t,n,r)=>ql[e],Yl={narrow:[`v.Chr.`,`n.Chr.`],abbreviated:[`v.Chr.`,`n.Chr.`],wide:[`vor Christus`,`nach Christus`]},Xl={narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1. Quartal`,`2. Quartal`,`3. Quartal`,`4. Quartal`]},Zl={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mär`,`Apr`,`Mai`,`Jun`,`Jul`,`Aug`,`Sep`,`Okt`,`Nov`,`Dez`],wide:[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]},Ql={narrow:Zl.narrow,abbreviated:[`Jan.`,`Feb.`,`März`,`Apr.`,`Mai`,`Juni`,`Juli`,`Aug.`,`Sep.`,`Okt.`,`Nov.`,`Dez.`],wide:Zl.wide},$l={code:`de`,formatDistance:Gl,formatLong:Kl,formatRelative:Jl,localize:{ordinalNumber:e=>Number(e)+`.`,era:Cl({values:Yl,defaultWidth:`wide`}),quarter:Cl({values:Xl,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Cl({values:Zl,formattingValues:Ql,defaultWidth:`wide`}),day:Cl({values:{narrow:[`S`,`M`,`D`,`M`,`D`,`F`,`S`],short:[`So`,`Mo`,`Di`,`Mi`,`Do`,`Fr`,`Sa`],abbreviated:[`So.`,`Mo.`,`Di.`,`Mi.`,`Do.`,`Fr.`,`Sa.`],wide:[`Sonntag`,`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`]},defaultWidth:`wide`}),dayPeriod:Cl({values:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachm.`,evening:`Abend`,night:`Nacht`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachm.`,evening:`abends`,night:`nachts`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:Dl({matchPattern:/^(\d+)(\.)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e)}),era:wl({matchPatterns:{narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^v/i,/^n/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},defaultMatchWidth:`wide`,parsePatterns:{any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},eu={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},tu=(e,t,n)=>{let r,i=eu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r},nu={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},ru=(e,t,n,r)=>nu[e],iu={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Cl({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Cl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Cl({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Cl({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Cl({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})},au={ordinalNumber:Dl({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:wl({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},ou={code:`en-US`,formatDistance:tu,formatLong:{date:Sl({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Sl({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},formatRelative:ru,localize:iu,match:au,options:{weekStartsOn:0,firstWeekContainsDate:1}},su={lessThanXSeconds:{one:`menos de un segundo`,other:`menos de {{count}} segundos`},xSeconds:{one:`1 segundo`,other:`{{count}} segundos`},halfAMinute:`medio minuto`,lessThanXMinutes:{one:`menos de un minuto`,other:`menos de {{count}} minutos`},xMinutes:{one:`1 minuto`,other:`{{count}} minutos`},aboutXHours:{one:`alrededor de 1 hora`,other:`alrededor de {{count}} horas`},xHours:{one:`1 hora`,other:`{{count}} horas`},xDays:{one:`1 día`,other:`{{count}} días`},aboutXWeeks:{one:`alrededor de 1 semana`,other:`alrededor de {{count}} semanas`},xWeeks:{one:`1 semana`,other:`{{count}} semanas`},aboutXMonths:{one:`alrededor de 1 mes`,other:`alrededor de {{count}} meses`},xMonths:{one:`1 mes`,other:`{{count}} meses`},aboutXYears:{one:`alrededor de 1 año`,other:`alrededor de {{count}} años`},xYears:{one:`1 año`,other:`{{count}} años`},overXYears:{one:`más de 1 año`,other:`más de {{count}} años`},almostXYears:{one:`casi 1 año`,other:`casi {{count}} años`}},cu=(e,t,n)=>{let r,i=su[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`en `+r:`hace `+r:r},lu={date:Sl({formats:{full:`EEEE, d 'de' MMMM 'de' y`,long:`d 'de' MMMM 'de' y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:Sl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} 'a las' {{time}}`,long:`{{date}} 'a las' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},uu={lastWeek:`'el' eeee 'pasado a la' p`,yesterday:`'ayer a la' p`,today:`'hoy a la' p`,tomorrow:`'mañana a la' p`,nextWeek:`eeee 'a la' p`,other:`P`},du={lastWeek:`'el' eeee 'pasado a las' p`,yesterday:`'ayer a las' p`,today:`'hoy a las' p`,tomorrow:`'mañana a las' p`,nextWeek:`eeee 'a las' p`,other:`P`},fu={code:`es`,formatDistance:cu,formatLong:lu,formatRelative:(e,t,n,r)=>t.getHours()===1?uu[e]:du[e],localize:{ordinalNumber:(e,t)=>Number(e)+`º`,era:Cl({values:{narrow:[`AC`,`DC`],abbreviated:[`AC`,`DC`],wide:[`antes de cristo`,`después de cristo`]},defaultWidth:`wide`}),quarter:Cl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>Number(e)-1}),month:Cl({values:{narrow:[`e`,`f`,`m`,`a`,`m`,`j`,`j`,`a`,`s`,`o`,`n`,`d`],abbreviated:[`ene`,`feb`,`mar`,`abr`,`may`,`jun`,`jul`,`ago`,`sep`,`oct`,`nov`,`dic`],wide:[`enero`,`febrero`,`marzo`,`abril`,`mayo`,`junio`,`julio`,`agosto`,`septiembre`,`octubre`,`noviembre`,`diciembre`]},defaultWidth:`wide`}),day:Cl({values:{narrow:[`d`,`l`,`m`,`m`,`j`,`v`,`s`],short:[`do`,`lu`,`ma`,`mi`,`ju`,`vi`,`sá`],abbreviated:[`dom`,`lun`,`mar`,`mié`,`jue`,`vie`,`sáb`],wide:[`domingo`,`lunes`,`martes`,`miércoles`,`jueves`,`viernes`,`sábado`]},defaultWidth:`wide`}),dayPeriod:Cl({values:{narrow:{am:`a`,pm:`p`,midnight:`mn`,noon:`md`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`},abbreviated:{am:`AM`,pm:`PM`,midnight:`medianoche`,noon:`mediodia`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`medianoche`,noon:`mediodia`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mn`,noon:`md`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`},abbreviated:{am:`AM`,pm:`PM`,midnight:`medianoche`,noon:`mediodia`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`medianoche`,noon:`mediodia`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:Dl({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:wl({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:1}},pu={lessThanXSeconds:{one:`moins d’une seconde`,other:`moins de {{count}} secondes`},xSeconds:{one:`1 seconde`,other:`{{count}} secondes`},halfAMinute:`30 secondes`,lessThanXMinutes:{one:`moins d’une minute`,other:`moins de {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`environ 1 heure`,other:`environ {{count}} heures`},xHours:{one:`1 heure`,other:`{{count}} heures`},xDays:{one:`1 jour`,other:`{{count}} jours`},aboutXWeeks:{one:`environ 1 semaine`,other:`environ {{count}} semaines`},xWeeks:{one:`1 semaine`,other:`{{count}} semaines`},aboutXMonths:{one:`environ 1 mois`,other:`environ {{count}} mois`},xMonths:{one:`1 mois`,other:`{{count}} mois`},aboutXYears:{one:`environ 1 an`,other:`environ {{count}} ans`},xYears:{one:`1 an`,other:`{{count}} ans`},overXYears:{one:`plus d’un an`,other:`plus de {{count}} ans`},almostXYears:{one:`presqu’un an`,other:`presque {{count}} ans`}},mu=(e,t,n)=>{let r,i=pu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`dans `+r:`il y a `+r:r},hu={date:Sl({formats:{full:`EEEE d MMMM y`,long:`d MMMM y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:Sl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} 'à' {{time}}`,long:`{{date}} 'à' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},gu={lastWeek:`eeee 'dernier à' p`,yesterday:`'hier à' p`,today:`'aujourd’hui à' p`,tomorrow:`'demain à' p'`,nextWeek:`eeee 'prochain à' p`,other:`P`},_u=(e,t,n,r)=>gu[e],vu={narrow:[`av. J.-C`,`ap. J.-C`],abbreviated:[`av. J.-C`,`ap. J.-C`],wide:[`avant Jésus-Christ`,`après Jésus-Christ`]},yu={narrow:[`T1`,`T2`,`T3`,`T4`],abbreviated:[`1er trim.`,`2ème trim.`,`3ème trim.`,`4ème trim.`],wide:[`1er trimestre`,`2ème trimestre`,`3ème trimestre`,`4ème trimestre`]},bu={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`janv.`,`févr.`,`mars`,`avr.`,`mai`,`juin`,`juil.`,`août`,`sept.`,`oct.`,`nov.`,`déc.`],wide:[`janvier`,`février`,`mars`,`avril`,`mai`,`juin`,`juillet`,`août`,`septembre`,`octobre`,`novembre`,`décembre`]},xu={narrow:[`D`,`L`,`M`,`M`,`J`,`V`,`S`],short:[`di`,`lu`,`ma`,`me`,`je`,`ve`,`sa`],abbreviated:[`dim.`,`lun.`,`mar.`,`mer.`,`jeu.`,`ven.`,`sam.`],wide:[`dimanche`,`lundi`,`mardi`,`mercredi`,`jeudi`,`vendredi`,`samedi`]},Su={narrow:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`mat.`,afternoon:`ap.m.`,evening:`soir`,night:`mat.`},abbreviated:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`matin`,afternoon:`après-midi`,evening:`soir`,night:`matin`},wide:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`du matin`,afternoon:`de l’après-midi`,evening:`du soir`,night:`du matin`}},Cu=(e,t)=>{let n=Number(e),r=t?.unit;if(n===0)return`0`;let i=[`year`,`week`,`hour`,`minute`,`second`],a;return a=n===1?r&&i.includes(r)?`ère`:`er`:`ème`,n+a},wu=[`MMM`,`MMMM`],Tu={code:`fr`,formatDistance:mu,formatLong:hu,formatRelative:_u,localize:{preprocessor:(e,t)=>e.getDate()===1||!t.some(e=>e.isToken&&wu.includes(e.value))?t:t.map(e=>e.isToken&&e.value===`do`?{isToken:!0,value:`d`}:e),ordinalNumber:Cu,era:Cl({values:vu,defaultWidth:`wide`}),quarter:Cl({values:yu,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Cl({values:bu,defaultWidth:`wide`}),day:Cl({values:xu,defaultWidth:`wide`}),dayPeriod:Cl({values:Su,defaultWidth:`wide`})},match:{ordinalNumber:Dl({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e)}),era:wl({matchPatterns:{narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^av/i,/^ap/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Eu={lessThanXSeconds:{one:`meno di un secondo`,other:`meno di {{count}} secondi`},xSeconds:{one:`un secondo`,other:`{{count}} secondi`},halfAMinute:`alcuni secondi`,lessThanXMinutes:{one:`meno di un minuto`,other:`meno di {{count}} minuti`},xMinutes:{one:`un minuto`,other:`{{count}} minuti`},aboutXHours:{one:`circa un'ora`,other:`circa {{count}} ore`},xHours:{one:`un'ora`,other:`{{count}} ore`},xDays:{one:`un giorno`,other:`{{count}} giorni`},aboutXWeeks:{one:`circa una settimana`,other:`circa {{count}} settimane`},xWeeks:{one:`una settimana`,other:`{{count}} settimane`},aboutXMonths:{one:`circa un mese`,other:`circa {{count}} mesi`},xMonths:{one:`un mese`,other:`{{count}} mesi`},aboutXYears:{one:`circa un anno`,other:`circa {{count}} anni`},xYears:{one:`un anno`,other:`{{count}} anni`},overXYears:{one:`più di un anno`,other:`più di {{count}} anni`},almostXYears:{one:`quasi un anno`,other:`quasi {{count}} anni`}},Du=(e,t,n)=>{let r,i=Eu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`tra `+r:r+` fa`:r},Ou={date:Sl({formats:{full:`EEEE d MMMM y`,long:`d MMMM y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:Sl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},ku=[`domenica`,`lunedì`,`martedì`,`mercoledì`,`giovedì`,`venerdì`,`sabato`];function Au(e){switch(e){case 0:return`'domenica scorsa alle' p`;default:return`'`+ku[e]+` scorso alle' p`}}function ju(e){return`'`+ku[e]+` alle' p`}function Mu(e){switch(e){case 0:return`'domenica prossima alle' p`;default:return`'`+ku[e]+` prossimo alle' p`}}var Nu={lastWeek:(e,t,n)=>{let r=e.getDay();return Ul(e,t,n)?ju(r):Au(r)},yesterday:`'ieri alle' p`,today:`'oggi alle' p`,tomorrow:`'domani alle' p`,nextWeek:(e,t,n)=>{let r=e.getDay();return Ul(e,t,n)?ju(r):Mu(r)},other:`P`},Pu={code:`it`,formatDistance:Du,formatLong:Ou,formatRelative:(e,t,n,r)=>{let i=Nu[e];return typeof i==`function`?i(t,n,r):i},localize:{ordinalNumber:(e,t)=>{let n=Number(e);return String(n)},era:Cl({values:{narrow:[`aC`,`dC`],abbreviated:[`a.C.`,`d.C.`],wide:[`avanti Cristo`,`dopo Cristo`]},defaultWidth:`wide`}),quarter:Cl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Cl({values:{narrow:[`G`,`F`,`M`,`A`,`M`,`G`,`L`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`gen`,`feb`,`mar`,`apr`,`mag`,`giu`,`lug`,`ago`,`set`,`ott`,`nov`,`dic`],wide:[`gennaio`,`febbraio`,`marzo`,`aprile`,`maggio`,`giugno`,`luglio`,`agosto`,`settembre`,`ottobre`,`novembre`,`dicembre`]},defaultWidth:`wide`}),day:Cl({values:{narrow:[`D`,`L`,`M`,`M`,`G`,`V`,`S`],short:[`dom`,`lun`,`mar`,`mer`,`gio`,`ven`,`sab`],abbreviated:[`dom`,`lun`,`mar`,`mer`,`gio`,`ven`,`sab`],wide:[`domenica`,`lunedì`,`martedì`,`mercoledì`,`giovedì`,`venerdì`,`sabato`]},defaultWidth:`wide`}),dayPeriod:Cl({values:{narrow:{am:`m.`,pm:`p.`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`},abbreviated:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`},wide:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`m.`,pm:`p.`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`},abbreviated:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`},wide:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:Dl({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:wl({matchPatterns:{narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^a/i,/^(d|e)/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Fu={lessThanXSeconds:{one:`1秒未満`,other:`{{count}}秒未満`,oneWithSuffix:`約1秒`,otherWithSuffix:`約{{count}}秒`},xSeconds:{one:`1秒`,other:`{{count}}秒`},halfAMinute:`30秒`,lessThanXMinutes:{one:`1分未満`,other:`{{count}}分未満`,oneWithSuffix:`約1分`,otherWithSuffix:`約{{count}}分`},xMinutes:{one:`1分`,other:`{{count}}分`},aboutXHours:{one:`約1時間`,other:`約{{count}}時間`},xHours:{one:`1時間`,other:`{{count}}時間`},xDays:{one:`1日`,other:`{{count}}日`},aboutXWeeks:{one:`約1週間`,other:`約{{count}}週間`},xWeeks:{one:`1週間`,other:`{{count}}週間`},aboutXMonths:{one:`約1か月`,other:`約{{count}}か月`},xMonths:{one:`1か月`,other:`{{count}}か月`},aboutXYears:{one:`約1年`,other:`約{{count}}年`},xYears:{one:`1年`,other:`{{count}}年`},overXYears:{one:`1年以上`,other:`{{count}}年以上`},almostXYears:{one:`1年近く`,other:`{{count}}年近く`}},Iu=(e,t,n)=>{n||={};let r,i=Fu[e];return r=typeof i==`string`?i:t===1?n.addSuffix&&i.oneWithSuffix?i.oneWithSuffix:i.one:n.addSuffix&&i.otherWithSuffix?i.otherWithSuffix.replace(`{{count}}`,String(t)):i.other.replace(`{{count}}`,String(t)),n.addSuffix?n.comparison&&n.comparison>0?r+`後`:r+`前`:r},Lu={date:Sl({formats:{full:`y年M月d日EEEE`,long:`y年M月d日`,medium:`y/MM/dd`,short:`y/MM/dd`},defaultWidth:`full`}),time:Sl({formats:{full:`H時mm分ss秒 zzzz`,long:`H:mm:ss z`,medium:`H:mm:ss`,short:`H:mm`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},Ru={lastWeek:`先週のeeeeのp`,yesterday:`昨日のp`,today:`今日のp`,tomorrow:`明日のp`,nextWeek:`翌週のeeeeのp`,other:`P`},zu={code:`ja`,formatDistance:Iu,formatLong:Lu,formatRelative:(e,t,n,r)=>Ru[e],localize:{ordinalNumber:(e,t)=>{let n=Number(e);switch(String(t?.unit)){case`year`:return`${n}年`;case`quarter`:return`第${n}四半期`;case`month`:return`${n}月`;case`week`:return`第${n}週`;case`date`:return`${n}日`;case`hour`:return`${n}時`;case`minute`:return`${n}分`;case`second`:return`${n}秒`;default:return`${n}`}},era:Cl({values:{narrow:[`BC`,`AC`],abbreviated:[`紀元前`,`西暦`],wide:[`紀元前`,`西暦`]},defaultWidth:`wide`}),quarter:Cl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`第1四半期`,`第2四半期`,`第3四半期`,`第4四半期`]},defaultWidth:`wide`,argumentCallback:e=>Number(e)-1}),month:Cl({values:{narrow:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`],abbreviated:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],wide:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`]},defaultWidth:`wide`}),day:Cl({values:{narrow:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],short:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],abbreviated:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],wide:[`日曜日`,`月曜日`,`火曜日`,`水曜日`,`木曜日`,`金曜日`,`土曜日`]},defaultWidth:`wide`}),dayPeriod:Cl({values:{narrow:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},abbreviated:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},wide:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},abbreviated:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},wide:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:Dl({matchPattern:/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:wl({matchPatterns:{narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},defaultMatchWidth:`wide`,parsePatterns:{any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Bu={lessThanXSeconds:{one:`menos de um segundo`,other:`menos de {{count}} segundos`},xSeconds:{one:`1 segundo`,other:`{{count}} segundos`},halfAMinute:`meio minuto`,lessThanXMinutes:{one:`menos de um minuto`,other:`menos de {{count}} minutos`},xMinutes:{one:`1 minuto`,other:`{{count}} minutos`},aboutXHours:{one:`aproximadamente 1 hora`,other:`aproximadamente {{count}} horas`},xHours:{one:`1 hora`,other:`{{count}} horas`},xDays:{one:`1 dia`,other:`{{count}} dias`},aboutXWeeks:{one:`aproximadamente 1 semana`,other:`aproximadamente {{count}} semanas`},xWeeks:{one:`1 semana`,other:`{{count}} semanas`},aboutXMonths:{one:`aproximadamente 1 mês`,other:`aproximadamente {{count}} meses`},xMonths:{one:`1 mês`,other:`{{count}} meses`},aboutXYears:{one:`aproximadamente 1 ano`,other:`aproximadamente {{count}} anos`},xYears:{one:`1 ano`,other:`{{count}} anos`},overXYears:{one:`mais de 1 ano`,other:`mais de {{count}} anos`},almostXYears:{one:`quase 1 ano`,other:`quase {{count}} anos`}},Vu=(e,t,n)=>{let r,i=Bu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`daqui a `+r:`há `+r:r},Hu={date:Sl({formats:{full:`EEEE, d 'de' MMMM 'de' y`,long:`d 'de' MMMM 'de' y`,medium:`d 'de' MMM 'de' y`,short:`dd/MM/y`},defaultWidth:`full`}),time:Sl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} 'às' {{time}}`,long:`{{date}} 'às' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Uu={lastWeek:e=>{let t=e.getDay();return`'`+(t===0||t===6?`último`:`última`)+`' eeee 'às' p`},yesterday:`'ontem às' p`,today:`'hoje às' p`,tomorrow:`'amanhã às' p`,nextWeek:`eeee 'às' p`,other:`P`},Wu={code:`pt`,formatDistance:Vu,formatLong:Hu,formatRelative:(e,t,n,r)=>{let i=Uu[e];return typeof i==`function`?i(t):i},localize:{ordinalNumber:(e,t)=>Number(e)+`º`,era:Cl({values:{narrow:[`aC`,`dC`],abbreviated:[`a.C.`,`d.C.`],wide:[`antes de Cristo`,`depois de Cristo`]},defaultWidth:`wide`}),quarter:Cl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Cl({values:{narrow:[`j`,`f`,`m`,`a`,`m`,`j`,`j`,`a`,`s`,`o`,`n`,`d`],abbreviated:[`jan`,`fev`,`mar`,`abr`,`mai`,`jun`,`jul`,`ago`,`set`,`out`,`nov`,`dez`],wide:[`janeiro`,`fevereiro`,`março`,`abril`,`maio`,`junho`,`julho`,`agosto`,`setembro`,`outubro`,`novembro`,`dezembro`]},defaultWidth:`wide`}),day:Cl({values:{narrow:[`d`,`s`,`t`,`q`,`q`,`s`,`s`],short:[`dom`,`seg`,`ter`,`qua`,`qui`,`sex`,`sáb`],abbreviated:[`dom`,`seg`,`ter`,`qua`,`qui`,`sex`,`sáb`],wide:[`domingo`,`segunda-feira`,`terça-feira`,`quarta-feira`,`quinta-feira`,`sexta-feira`,`sábado`]},defaultWidth:`wide`}),dayPeriod:Cl({values:{narrow:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`},abbreviated:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`},wide:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`},abbreviated:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`},wide:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:Dl({matchPattern:/^(\d+)(º|ª)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:wl({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Gu={lessThanXSeconds:{one:`不到 1 秒`,other:`不到 {{count}} 秒`},xSeconds:{one:`1 秒`,other:`{{count}} 秒`},halfAMinute:`半分钟`,lessThanXMinutes:{one:`不到 1 分钟`,other:`不到 {{count}} 分钟`},xMinutes:{one:`1 分钟`,other:`{{count}} 分钟`},xHours:{one:`1 小时`,other:`{{count}} 小时`},aboutXHours:{one:`大约 1 小时`,other:`大约 {{count}} 小时`},xDays:{one:`1 天`,other:`{{count}} 天`},aboutXWeeks:{one:`大约 1 个星期`,other:`大约 {{count}} 个星期`},xWeeks:{one:`1 个星期`,other:`{{count}} 个星期`},aboutXMonths:{one:`大约 1 个月`,other:`大约 {{count}} 个月`},xMonths:{one:`1 个月`,other:`{{count}} 个月`},aboutXYears:{one:`大约 1 年`,other:`大约 {{count}} 年`},xYears:{one:`1 年`,other:`{{count}} 年`},overXYears:{one:`超过 1 年`,other:`超过 {{count}} 年`},almostXYears:{one:`将近 1 年`,other:`将近 {{count}} 年`}},Ku=(e,t,n)=>{let r,i=Gu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?r+`内`:r+`前`:r},qu={date:Sl({formats:{full:`y'年'M'月'd'日' EEEE`,long:`y'年'M'月'd'日'`,medium:`yyyy-MM-dd`,short:`yy-MM-dd`},defaultWidth:`full`}),time:Sl({formats:{full:`zzzz a h:mm:ss`,long:`z a h:mm:ss`,medium:`a h:mm:ss`,short:`a h:mm`},defaultWidth:`full`}),dateTime:Sl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})};function Ju(e,t,n){let r=`eeee p`;return Ul(e,t,n)?r:e.getTime()>t.getTime()?`'下个'`+r:`'上个'`+r}var Yu={lastWeek:Ju,yesterday:`'昨天' p`,today:`'今天' p`,tomorrow:`'明天' p`,nextWeek:Ju,other:`PP p`},Xu={code:`zh-CN`,formatDistance:Ku,formatLong:qu,formatRelative:(e,t,n,r)=>{let i=Yu[e];return typeof i==`function`?i(t,n,r):i},localize:{ordinalNumber:(e,t)=>{let n=Number(e);switch(t?.unit){case`date`:return n.toString()+`日`;case`hour`:return n.toString()+`时`;case`minute`:return n.toString()+`分`;case`second`:return n.toString()+`秒`;default:return`第 `+n.toString()}},era:Cl({values:{narrow:[`前`,`公元`],abbreviated:[`前`,`公元`],wide:[`公元前`,`公元`]},defaultWidth:`wide`}),quarter:Cl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`第一季`,`第二季`,`第三季`,`第四季`],wide:[`第一季度`,`第二季度`,`第三季度`,`第四季度`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Cl({values:{narrow:[`一`,`二`,`三`,`四`,`五`,`六`,`七`,`八`,`九`,`十`,`十一`,`十二`],abbreviated:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],wide:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`]},defaultWidth:`wide`}),day:Cl({values:{narrow:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],short:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],abbreviated:[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],wide:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`]},defaultWidth:`wide`}),dayPeriod:Cl({values:{narrow:{am:`上`,pm:`下`,midnight:`凌晨`,noon:`午`,morning:`早`,afternoon:`下午`,evening:`晚`,night:`夜`},abbreviated:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`},wide:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`上`,pm:`下`,midnight:`凌晨`,noon:`午`,morning:`早`,afternoon:`下午`,evening:`晚`,night:`夜`},abbreviated:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`},wide:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:Dl({matchPattern:/^(第\s*)?\d+(日|时|分|秒)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:wl({matchPatterns:{narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^(前)/i,/^(公元)/i]},defaultParseWidth:`any`}),quarter:wl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:wl({matchPatterns:{narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},defaultParseWidth:`any`}),day:wl({matchPatterns:{narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},defaultParseWidth:`any`}),dayPeriod:wl({matchPatterns:{any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Zu=[`en`,`es`,`fr`,`de`,`pt`,`it`,`zh`,`ja`],Qu={en:{id:`en`,nativeName:`English`,englishName:`English`},es:{id:`es`,nativeName:`Español`,englishName:`Spanish`},fr:{id:`fr`,nativeName:`Français`,englishName:`French`},de:{id:`de`,nativeName:`Deutsch`,englishName:`German`},pt:{id:`pt`,nativeName:`Português`,englishName:`Portuguese`},it:{id:`it`,nativeName:`Italiano`,englishName:`Italian`},zh:{id:`zh`,nativeName:`中文`,englishName:`Chinese`},ja:{id:`ja`,nativeName:`日本語`,englishName:`Japanese`}},$u=`specrails-desktop:ui-language`;function ed(e){return typeof e==`string`&&Zu.includes(e)}function td(e){return e.split(`/`).pop().replace(/\.json$/,``)}var nd=Object.assign({"../locales/en/activity.json":i,"../locales/en/addspec.json":a,"../locales/en/agents.json":o,"../locales/en/agentstudio.json":s,"../locales/en/aiedit.json":c,"../locales/en/analytics.json":l,"../locales/en/attachments.json":u,"../locales/en/browser.json":d,"../locales/en/chat.json":f,"../locales/en/code.json":p,"../locales/en/commands.json":m,"../locales/en/common.json":h,"../locales/en/dashboard.json":g,"../locales/en/explore.json":_,"../locales/en/integrations.json":v,"../locales/en/jira.json":y,"../locales/en/jobs.json":b,"../locales/en/nav.json":x,"../locales/en/settings.json":S,"../locales/en/setup.json":C,"../locales/en/specs.json":w,"../locales/en/terminal.json":T,"../locales/en/tickets.json":E}),rd=Object.assign({"../locales/de/activity.json":()=>r(()=>import(`./activity-BqqwnH_h.js`),[]),"../locales/de/addspec.json":()=>r(()=>import(`./addspec-B1FTtI2a.js`),[]),"../locales/de/agents.json":()=>r(()=>import(`./agents-BFr3kUhK.js`),[]),"../locales/de/agentstudio.json":()=>r(()=>import(`./agentstudio-kk9RB7Se.js`),[]),"../locales/de/aiedit.json":()=>r(()=>import(`./aiedit-BBCrOpHq.js`),[]),"../locales/de/analytics.json":()=>r(()=>import(`./analytics-BeTyviO8.js`),[]),"../locales/de/attachments.json":()=>r(()=>import(`./attachments-Dn-JImAK.js`),[]),"../locales/de/browser.json":()=>r(()=>import(`./browser-lTQwcDCI.js`),[]),"../locales/de/chat.json":()=>r(()=>import(`./chat-mPn3UlMl.js`),[]),"../locales/de/code.json":()=>r(()=>import(`./code-CDFlxUFC.js`),[]),"../locales/de/commands.json":()=>r(()=>import(`./commands-t4frzhB0.js`),[]),"../locales/de/common.json":()=>r(()=>import(`./common-5ilvMOcH.js`),[]),"../locales/de/dashboard.json":()=>r(()=>import(`./dashboard-DpGYK2s1.js`),[]),"../locales/de/explore.json":()=>r(()=>import(`./explore-BmTaI8dX.js`),[]),"../locales/de/integrations.json":()=>r(()=>import(`./integrations-_SuVeQIG.js`),[]),"../locales/de/jira.json":()=>r(()=>import(`./jira-DlA-wGp-.js`),[]),"../locales/de/jobs.json":()=>r(()=>import(`./jobs-CSRwFQ6K.js`),[]),"../locales/de/nav.json":()=>r(()=>import(`./nav-Bf87DRHD.js`),[]),"../locales/de/settings.json":()=>r(()=>import(`./settings-BORg56um.js`),[]),"../locales/de/setup.json":()=>r(()=>import(`./setup-pjgmYHx6.js`),[]),"../locales/de/specs.json":()=>r(()=>import(`./specs-DicWhvwi.js`),[]),"../locales/de/terminal.json":()=>r(()=>import(`./terminal-DoxtVdma.js`),[]),"../locales/de/tickets.json":()=>r(()=>import(`./tickets-9kdPXInd.js`),[]),"../locales/en/activity.json":()=>r(()=>import(`./activity-Dv6H7wEr.js`).then(e=>e.t),__vite__mapDeps([0,1])),"../locales/en/addspec.json":()=>r(()=>import(`./addspec-GWm4ffKl.js`).then(e=>e.t),__vite__mapDeps([2,1])),"../locales/en/agents.json":()=>r(()=>import(`./agents-CMxtJMLD.js`).then(e=>e.t),__vite__mapDeps([3,1])),"../locales/en/agentstudio.json":()=>r(()=>import(`./agentstudio-CxlUllqI.js`).then(e=>e.t),__vite__mapDeps([4,1])),"../locales/en/aiedit.json":()=>r(()=>import(`./aiedit-TTwzL1TS.js`).then(e=>e.t),__vite__mapDeps([5,1])),"../locales/en/analytics.json":()=>r(()=>import(`./analytics-DMCto-TF.js`).then(e=>e.t),__vite__mapDeps([6,1])),"../locales/en/attachments.json":()=>r(()=>import(`./attachments-BIsSSnHJ.js`).then(e=>e.t),__vite__mapDeps([7,1])),"../locales/en/browser.json":()=>r(()=>import(`./browser-Qya9cARy.js`).then(e=>e.t),__vite__mapDeps([8,1])),"../locales/en/chat.json":()=>r(()=>import(`./chat-BsbNGPW9.js`).then(e=>e.t),__vite__mapDeps([9,1])),"../locales/en/code.json":()=>r(()=>import(`./code-CY85RXZU.js`).then(e=>e.t),__vite__mapDeps([10,1])),"../locales/en/commands.json":()=>r(()=>import(`./commands-IXMOKBYt.js`).then(e=>e.t),__vite__mapDeps([11,1])),"../locales/en/common.json":()=>r(()=>import(`./common-wA36jmj1.js`).then(e=>e.t),__vite__mapDeps([12,1])),"../locales/en/dashboard.json":()=>r(()=>import(`./dashboard-Duo4DDCW.js`).then(e=>e.t),__vite__mapDeps([13,1])),"../locales/en/explore.json":()=>r(()=>import(`./explore-hFc3HFcp.js`).then(e=>e.t),__vite__mapDeps([14,1])),"../locales/en/integrations.json":()=>r(()=>import(`./integrations-BqUmRUef.js`).then(e=>e.t),__vite__mapDeps([15,1])),"../locales/en/jira.json":()=>r(()=>import(`./jira-C-ATCti0.js`).then(e=>e.t),__vite__mapDeps([16,1])),"../locales/en/jobs.json":()=>r(()=>import(`./jobs-Bd8AdOTb.js`).then(e=>e.t),__vite__mapDeps([17,1])),"../locales/en/nav.json":()=>r(()=>import(`./nav-BRInPX8a.js`).then(e=>e.t),__vite__mapDeps([18,1])),"../locales/en/settings.json":()=>r(()=>import(`./settings-yMubjqYw.js`).then(e=>e.t),__vite__mapDeps([19,1])),"../locales/en/setup.json":()=>r(()=>import(`./setup-C0dzw8j4.js`).then(e=>e.t),__vite__mapDeps([20,1])),"../locales/en/specs.json":()=>r(()=>import(`./specs-4lA_u79w.js`).then(e=>e.t),__vite__mapDeps([21,1])),"../locales/en/terminal.json":()=>r(()=>import(`./terminal-C0xx0SjA.js`).then(e=>e.t),__vite__mapDeps([22,1])),"../locales/en/tickets.json":()=>r(()=>import(`./tickets-tGx5AR5b.js`).then(e=>e.t),__vite__mapDeps([23,1])),"../locales/es/activity.json":()=>r(()=>import(`./activity-C8qqEIoP.js`),[]),"../locales/es/addspec.json":()=>r(()=>import(`./addspec-BCT9vm_c.js`),[]),"../locales/es/agents.json":()=>r(()=>import(`./agents-BlPnx-mz.js`),[]),"../locales/es/agentstudio.json":()=>r(()=>import(`./agentstudio-ChxNuGAu.js`),[]),"../locales/es/aiedit.json":()=>r(()=>import(`./aiedit-DrfzQroF.js`),[]),"../locales/es/analytics.json":()=>r(()=>import(`./analytics-DBtt8Mgk.js`),[]),"../locales/es/attachments.json":()=>r(()=>import(`./attachments-LDA9kp2X.js`),[]),"../locales/es/browser.json":()=>r(()=>import(`./browser-BDd1dbFa.js`),[]),"../locales/es/chat.json":()=>r(()=>import(`./chat-UVVZqA57.js`),[]),"../locales/es/code.json":()=>r(()=>import(`./code-Cp3Fdng-.js`),[]),"../locales/es/commands.json":()=>r(()=>import(`./commands-ddsl1V91.js`),[]),"../locales/es/common.json":()=>r(()=>import(`./common-BKpVwUIf.js`),[]),"../locales/es/dashboard.json":()=>r(()=>import(`./dashboard-D7jg25XR.js`),[]),"../locales/es/explore.json":()=>r(()=>import(`./explore-DHjxSkqQ.js`),[]),"../locales/es/integrations.json":()=>r(()=>import(`./integrations-eQPHAYsE.js`),[]),"../locales/es/jira.json":()=>r(()=>import(`./jira-D7bkKAX8.js`),[]),"../locales/es/jobs.json":()=>r(()=>import(`./jobs-AW2eB5D-.js`),[]),"../locales/es/nav.json":()=>r(()=>import(`./nav-DBDbQOYn.js`),[]),"../locales/es/settings.json":()=>r(()=>import(`./settings-D3LurcR5.js`),[]),"../locales/es/setup.json":()=>r(()=>import(`./setup-gzLG8T6F.js`),[]),"../locales/es/specs.json":()=>r(()=>import(`./specs-DFnc2Huj.js`),[]),"../locales/es/terminal.json":()=>r(()=>import(`./terminal-DHIkiWcs.js`),[]),"../locales/es/tickets.json":()=>r(()=>import(`./tickets-0rM0lIXd.js`),[]),"../locales/fr/activity.json":()=>r(()=>import(`./activity-Cyy07Tgo.js`),[]),"../locales/fr/addspec.json":()=>r(()=>import(`./addspec-Dw-0Dg-4.js`),[]),"../locales/fr/agents.json":()=>r(()=>import(`./agents-DcxZHzNr.js`),[]),"../locales/fr/agentstudio.json":()=>r(()=>import(`./agentstudio-Y3G0ddJ2.js`),[]),"../locales/fr/aiedit.json":()=>r(()=>import(`./aiedit-D9ddlgkM.js`),[]),"../locales/fr/analytics.json":()=>r(()=>import(`./analytics-YIpQvPAc.js`),[]),"../locales/fr/attachments.json":()=>r(()=>import(`./attachments-CCWasu-P.js`),[]),"../locales/fr/browser.json":()=>r(()=>import(`./browser-DWOVYMlg.js`),[]),"../locales/fr/chat.json":()=>r(()=>import(`./chat-BO9MvVID.js`),[]),"../locales/fr/code.json":()=>r(()=>import(`./code-D24e1Crx.js`),[]),"../locales/fr/commands.json":()=>r(()=>import(`./commands-Cb21pDlG.js`),[]),"../locales/fr/common.json":()=>r(()=>import(`./common-DQiza2Xp.js`),[]),"../locales/fr/dashboard.json":()=>r(()=>import(`./dashboard--Y6yzMlf.js`),[]),"../locales/fr/explore.json":()=>r(()=>import(`./explore-CCwkqoWq.js`),[]),"../locales/fr/integrations.json":()=>r(()=>import(`./integrations-2C7MkGT0.js`),[]),"../locales/fr/jira.json":()=>r(()=>import(`./jira-DOw8bkIR.js`),[]),"../locales/fr/jobs.json":()=>r(()=>import(`./jobs-BZ3sQHjZ.js`),[]),"../locales/fr/nav.json":()=>r(()=>import(`./nav-BzFLtS1W.js`),[]),"../locales/fr/settings.json":()=>r(()=>import(`./settings-5tzo0Rn3.js`),[]),"../locales/fr/setup.json":()=>r(()=>import(`./setup-UD2aanGs.js`),[]),"../locales/fr/specs.json":()=>r(()=>import(`./specs-CXNQzPk9.js`),[]),"../locales/fr/terminal.json":()=>r(()=>import(`./terminal-BYtreaaF.js`),[]),"../locales/fr/tickets.json":()=>r(()=>import(`./tickets-DAjtxAVb.js`),[]),"../locales/it/activity.json":()=>r(()=>import(`./activity-CZVM4nlJ.js`),[]),"../locales/it/addspec.json":()=>r(()=>import(`./addspec-DpRgmfmx.js`),[]),"../locales/it/agents.json":()=>r(()=>import(`./agents-B_1L9xRg.js`),[]),"../locales/it/agentstudio.json":()=>r(()=>import(`./agentstudio-DNlme601.js`),[]),"../locales/it/aiedit.json":()=>r(()=>import(`./aiedit-5ETerMK1.js`),[]),"../locales/it/analytics.json":()=>r(()=>import(`./analytics-C67cIA1b.js`),[]),"../locales/it/attachments.json":()=>r(()=>import(`./attachments-DazTVJbH.js`),[]),"../locales/it/browser.json":()=>r(()=>import(`./browser-BWSgbfdX.js`),[]),"../locales/it/chat.json":()=>r(()=>import(`./chat-DIh3hr6y.js`),[]),"../locales/it/code.json":()=>r(()=>import(`./code-nKa0fkm_.js`),[]),"../locales/it/commands.json":()=>r(()=>import(`./commands-BR1kDkHQ.js`),[]),"../locales/it/common.json":()=>r(()=>import(`./common-BzEC3kJU.js`),[]),"../locales/it/dashboard.json":()=>r(()=>import(`./dashboard-Cx5VjCea.js`),[]),"../locales/it/explore.json":()=>r(()=>import(`./explore-CMdEoPDx.js`),[]),"../locales/it/integrations.json":()=>r(()=>import(`./integrations-C2jQtv-s.js`),[]),"../locales/it/jira.json":()=>r(()=>import(`./jira-DKImM1YH.js`),[]),"../locales/it/jobs.json":()=>r(()=>import(`./jobs-8viuHLDV.js`),[]),"../locales/it/nav.json":()=>r(()=>import(`./nav-BNGCq-0y.js`),[]),"../locales/it/settings.json":()=>r(()=>import(`./settings-BEWv3VEu.js`),[]),"../locales/it/setup.json":()=>r(()=>import(`./setup-WP6WOYQh.js`),[]),"../locales/it/specs.json":()=>r(()=>import(`./specs-dkro6lSM.js`),[]),"../locales/it/terminal.json":()=>r(()=>import(`./terminal-DY42QANg.js`),[]),"../locales/it/tickets.json":()=>r(()=>import(`./tickets-n23kDqJT.js`),[]),"../locales/ja/activity.json":()=>r(()=>import(`./activity-Dwq0heud.js`),[]),"../locales/ja/addspec.json":()=>r(()=>import(`./addspec-DeDOztDr.js`),[]),"../locales/ja/agents.json":()=>r(()=>import(`./agents-BDx1RXcl.js`),[]),"../locales/ja/agentstudio.json":()=>r(()=>import(`./agentstudio-DpP9caEE.js`),[]),"../locales/ja/aiedit.json":()=>r(()=>import(`./aiedit-BMtcGYNE.js`),[]),"../locales/ja/analytics.json":()=>r(()=>import(`./analytics-C4eEO260.js`),[]),"../locales/ja/attachments.json":()=>r(()=>import(`./attachments-CVSAbGNl.js`),[]),"../locales/ja/browser.json":()=>r(()=>import(`./browser-DH9SGVfM.js`),[]),"../locales/ja/chat.json":()=>r(()=>import(`./chat-CUrG1eVg.js`),[]),"../locales/ja/code.json":()=>r(()=>import(`./code-CD7yNSK0.js`),[]),"../locales/ja/commands.json":()=>r(()=>import(`./commands-B-MVT-2F.js`),[]),"../locales/ja/common.json":()=>r(()=>import(`./common-CTEbWVZS.js`),[]),"../locales/ja/dashboard.json":()=>r(()=>import(`./dashboard-BiJ3CDTG.js`),[]),"../locales/ja/explore.json":()=>r(()=>import(`./explore-BE5UmlbD.js`),[]),"../locales/ja/integrations.json":()=>r(()=>import(`./integrations-CB98NeH5.js`),[]),"../locales/ja/jira.json":()=>r(()=>import(`./jira-xZA2lixb.js`),[]),"../locales/ja/jobs.json":()=>r(()=>import(`./jobs-BSm89DL5.js`),[]),"../locales/ja/nav.json":()=>r(()=>import(`./nav-B05EYB0b.js`),[]),"../locales/ja/settings.json":()=>r(()=>import(`./settings-BDAW3trC.js`),[]),"../locales/ja/setup.json":()=>r(()=>import(`./setup-CpfjaNut.js`),[]),"../locales/ja/specs.json":()=>r(()=>import(`./specs-DZCLH2-l.js`),[]),"../locales/ja/terminal.json":()=>r(()=>import(`./terminal-Ciia0wh2.js`),[]),"../locales/ja/tickets.json":()=>r(()=>import(`./tickets-1UIGf_oA.js`),[]),"../locales/pt/activity.json":()=>r(()=>import(`./activity-qFTcMyW9.js`),[]),"../locales/pt/addspec.json":()=>r(()=>import(`./addspec-rp496P_F.js`),[]),"../locales/pt/agents.json":()=>r(()=>import(`./agents-G3shOewU.js`),[]),"../locales/pt/agentstudio.json":()=>r(()=>import(`./agentstudio-Bk1eZcv4.js`),[]),"../locales/pt/aiedit.json":()=>r(()=>import(`./aiedit-fMltW101.js`),[]),"../locales/pt/analytics.json":()=>r(()=>import(`./analytics-DUPtODxX.js`),[]),"../locales/pt/attachments.json":()=>r(()=>import(`./attachments-CHaDUfjB.js`),[]),"../locales/pt/browser.json":()=>r(()=>import(`./browser-Dxc_VIRK.js`),[]),"../locales/pt/chat.json":()=>r(()=>import(`./chat-CvOOKB2s.js`),[]),"../locales/pt/code.json":()=>r(()=>import(`./code-BwIz8agY.js`),[]),"../locales/pt/commands.json":()=>r(()=>import(`./commands-B0yFTp7e.js`),[]),"../locales/pt/common.json":()=>r(()=>import(`./common-B4sqsKp7.js`),[]),"../locales/pt/dashboard.json":()=>r(()=>import(`./dashboard--a4-6oYE.js`),[]),"../locales/pt/explore.json":()=>r(()=>import(`./explore-__BeALjE.js`),[]),"../locales/pt/integrations.json":()=>r(()=>import(`./integrations-BDC670cg.js`),[]),"../locales/pt/jira.json":()=>r(()=>import(`./jira-CmVfRM-b.js`),[]),"../locales/pt/jobs.json":()=>r(()=>import(`./jobs-CRtsq_u0.js`),[]),"../locales/pt/nav.json":()=>r(()=>import(`./nav-BkVzzFpc.js`),[]),"../locales/pt/settings.json":()=>r(()=>import(`./settings-DcqWIEM6.js`),[]),"../locales/pt/setup.json":()=>r(()=>import(`./setup-D3rNZA9A.js`),[]),"../locales/pt/specs.json":()=>r(()=>import(`./specs-DgmyAE3N.js`),[]),"../locales/pt/terminal.json":()=>r(()=>import(`./terminal-CPpK58RC.js`),[]),"../locales/pt/tickets.json":()=>r(()=>import(`./tickets-DNmXcAwu.js`),[]),"../locales/zh/activity.json":()=>r(()=>import(`./activity-DlbWCa4y.js`),[]),"../locales/zh/addspec.json":()=>r(()=>import(`./addspec-v8j6A7CD.js`),[]),"../locales/zh/agents.json":()=>r(()=>import(`./agents-23iPejcA.js`),[]),"../locales/zh/agentstudio.json":()=>r(()=>import(`./agentstudio-B-CMAQqy.js`),[]),"../locales/zh/aiedit.json":()=>r(()=>import(`./aiedit-De0SOH6S.js`),[]),"../locales/zh/analytics.json":()=>r(()=>import(`./analytics-CAguvW28.js`),[]),"../locales/zh/attachments.json":()=>r(()=>import(`./attachments-Chg5poG1.js`),[]),"../locales/zh/browser.json":()=>r(()=>import(`./browser-D2Y_UAKA.js`),[]),"../locales/zh/chat.json":()=>r(()=>import(`./chat-CPgmgZOj.js`),[]),"../locales/zh/code.json":()=>r(()=>import(`./code-DtZBQTi9.js`),[]),"../locales/zh/commands.json":()=>r(()=>import(`./commands-DWgp-8W1.js`),[]),"../locales/zh/common.json":()=>r(()=>import(`./common-CALKUpYm.js`),[]),"../locales/zh/dashboard.json":()=>r(()=>import(`./dashboard-CiXjk63Z.js`),[]),"../locales/zh/explore.json":()=>r(()=>import(`./explore-CtdCL4QU.js`),[]),"../locales/zh/integrations.json":()=>r(()=>import(`./integrations-CX4p_bij.js`),[]),"../locales/zh/jira.json":()=>r(()=>import(`./jira-Fob8EGxN.js`),[]),"../locales/zh/jobs.json":()=>r(()=>import(`./jobs-CbEl7WMI.js`),[]),"../locales/zh/nav.json":()=>r(()=>import(`./nav-X9sVtUWC.js`),[]),"../locales/zh/settings.json":()=>r(()=>import(`./settings-Dfz8QbZS.js`),[]),"../locales/zh/setup.json":()=>r(()=>import(`./setup-C1IA-9YS.js`),[]),"../locales/zh/specs.json":()=>r(()=>import(`./specs-BHjxcjOf.js`),[]),"../locales/zh/terminal.json":()=>r(()=>import(`./terminal-CdxkpafL.js`),[]),"../locales/zh/tickets.json":()=>r(()=>import(`./tickets-C6pwZwt4.js`),[])}),id={};for(let[e,t]of Object.entries(nd))id[td(e)]=t.default;var ad=Object.keys(id),od=new Set([`en`]);function sd(){if(typeof navigator<`u`){let e=navigator.languages&&navigator.languages.length>0?navigator.languages:[navigator.language];for(let t of e){if(!t)continue;let e=t.toLowerCase().split(`-`)[0];if(ed(e))return e}}return`en`}function cd(){if(typeof localStorage<`u`)try{let e=localStorage.getItem($u);if(ed(e))return e}catch{}return sd()}Jr.use(Li).init({lng:`en`,fallbackLng:`en`,defaultNS:`common`,ns:ad,resources:{en:id},interpolation:{escapeValue:!1},returnNull:!1});async function ld(e){if(od.has(e))return;let t=Object.entries(rd).filter(([t])=>t.includes(`/locales/${e}/`)),n=await Promise.all(t.map(async([e,t])=>[td(e),(await t()).default]));for(let[t,r]of n)Jr.addResourceBundle(e,t,r,!0,!0);od.add(e)}async function ud(e){await ld(e),await Jr.changeLanguage(e),typeof document<`u`&&(document.documentElement.lang=e)}async function dd(){let e=cd();if(e!==`en`)try{await ud(e)}catch{}}function fd(){return ed(Jr.language)?Jr.language:`en`}var pd={en:ou,es:fu,fr:Tu,de:$l,pt:Wu,it:Pu,zh:Xu,ja:zu};function md(e){let t=e??Jr.language;return pd[ed(t)?t:`en`]}var J=Jr;function hd(e){return e.providers&&e.providers.length>0?e.providers:[e.provider]}var gd=(0,I.createContext)(null),_d=`specrails-desktop:activeProjectId`;function vd(e){try{e?localStorage.setItem(_d,e):localStorage.removeItem(_d)}catch{}}function yd(){try{return localStorage.getItem(_d)}catch{return null}}function bd({children:e}){let[t,n]=(0,I.useState)([]),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(!0),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(new Set),d=(0,I.useRef)(null),f=(0,I.useCallback)(e=>{vd(e),ll(e),i(t=>(t!==null&&t!==e&&(d.current&&clearTimeout(d.current),c(!0),d.current=setTimeout(()=>c(!1),400)),e))},[]),{registerHandler:p,unregisterHandler:m}=xl();(0,I.useEffect)(()=>{async function e(){try{let e=await fetch(`${sl}/api/projects`);if(!e.ok)return;let t=await e.json();n(t.projects),t.setupProjectIds&&t.setupProjectIds.length>0&&u(new Set(t.setupProjectIds))}catch{}finally{o(!1)}}e()},[]);let h=(0,I.useCallback)(e=>{let t=e;if(typeof t.type==`string`){if(t.type===`desktop.projects`){let e=t.projects;n(e),i(t=>{let n;if(t&&e.find(e=>e.id===t))n=t;else{let t=yd();n=t&&e.find(e=>e.id===t)?t:e.length>0?e[0].id:null}return vd(n),ll(n),n}),o(!1)}else if(t.type===`desktop.project_added`){let e=t.project;n(t=>t.find(t=>t.id===e.id)?t:[...t,e]),K.success(J.t(`nav:projects.added`,{name:e.name})),f(e.id)}else if(t.type===`desktop.project_removed`){let e=t.projectId;K.success(J.t(`nav:projects.removed`)),n(t=>t.filter(t=>t.id!==e)),i(t=>t===e?(vd(null),ll(null),null):t)}}},[]);(0,I.useLayoutEffect)(()=>(p(`desktop`,h),()=>m(`desktop`)),[h,p,m]);let g=(0,I.useCallback)(async(e,t,r=[`claude`])=>{try{let i={path:e,providers:r.length>0?r:[`claude`]};t&&(i.name=t);let a=await fetch(`/api/projects`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});if(!a.ok){let e=await a.json();throw Error(e.error??`HTTP ${a.status}`)}let o=await a.json();return n(e=>e.find(e=>e.id===o.project.id)?e:[...e,o.project]),f(o.project.id),o}catch(e){throw console.error(`[useDesktop] addProject error:`,e),e}},[f]),_=(0,I.useCallback)(async e=>{try{let t=await fetch(`${sl}/api/projects/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}n(t=>t.filter(t=>t.id!==e)),u(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),i(t=>t===e?(vd(null),ll(null),null):t)}catch(e){throw console.error(`[useDesktop] removeProject error:`,e),e}},[]),v=(0,I.useCallback)(e=>{u(t=>new Set([...t,e]))},[]),y=(0,I.useCallback)(e=>{u(t=>{let n=new Set(t);return n.delete(e),n})},[]),b=(0,I.useMemo)(()=>({projects:t,activeProjectId:r,setActiveProjectId:f,addProject:g,removeProject:_,isLoading:a,isSwitchingProject:s,setupProjectIds:l,startSetupWizard:v,completeSetupWizard:y}),[t,r,f,g,_,a,s,l,v,y]);return(0,q.jsx)(gd.Provider,{value:b,children:e})}var xd={projects:[],activeProjectId:null,setActiveProjectId:()=>{},addProject:async()=>null,removeProject:async()=>{},isLoading:!1,isSwitchingProject:!1,setupProjectIds:new Set,startSetupWizard:()=>{},completeSetupWizard:()=>{}};function Sd(){return(0,I.useContext)(gd)??xd}var Cd=new Map,wd=2e3;function Td(e){Cd.set(e,(Cd.get(e)??0)+1)}function Ed(e){(Cd.get(e)??0)<=0||setTimeout(()=>{let t=(Cd.get(e)??0)-1;t<=0?Cd.delete(e):Cd.set(e,t)},wd)}function Dd(e){return e?(Cd.get(e)??0)>0:!1}var Od=3e3,kd=`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Contract Layer
|
|
21
|
+
|
|
22
|
+
`;function Ad(e,t){return JSON.stringify(e)===JSON.stringify(t)}function jd(e,t){let n=new Map(e.map(e=>[e.id,e])),r=t.map(e=>{let t=n.get(e.id);return t&&Ad(t,e)?t:e});return r.length===e.length&&r.every((t,n)=>t===e[n])?e:r}function Md(){let{t:e}=G(`tickets`),{activeProjectId:t}=Sd(),[n,r]=(0,I.useState)([]),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(null),[c,l]=(0,I.useState)(new Set),[u,d]=(0,I.useState)(new Set),f=(0,I.useRef)(t);(0,I.useEffect)(()=>{f.current=t},[t]);let p=(0,I.useRef)(new Set),{registerHandler:m,unregisterHandler:h,connectionStatus:g}=xl(),_=(0,I.useId)(),v=(0,I.useCallback)(async e=>{let t=ul(),n=await fetch(`${t}/tickets`,{signal:e});if(!n.ok)throw Error(`Failed to fetch tickets: ${n.status}`);let r=await n.json();return Array.isArray(r)?r:r.tickets??[]},[]),y=(0,I.useCallback)(()=>{f.current&&(a(!0),s(null),v().then(t=>{let n=p.current,i=new Set;for(let e of t)n.size>0&&!n.has(e.id)&&i.add(e.id);p.current=new Set(t.map(e=>e.id)),r(e=>jd(e,t)),i.size>0&&n.size>0&&(l(i),K.success(e(`toasts.newTicketsAdded`,{count:i.size})),setTimeout(()=>l(new Set),Od))}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||s(e.message)}).finally(()=>a(!1)))},[v,e]);(0,I.useEffect)(()=>{if(!t){r([]),s(null),p.current=new Set,l(new Set),d(new Set);return}let e=!1;a(!0),s(null),l(new Set),d(new Set);let n=new AbortController;return v(n.signal).then(t=>{e||(p.current=new Set(t.map(e=>e.id)),r(t))}).catch(t=>{e||t instanceof DOMException&&t.name===`AbortError`||s(t.message)}).finally(()=>{e||a(!1)}),()=>{e=!0,n.abort()}},[t,v]);let b=(0,I.useCallback)(t=>{let n=t;if(!n||typeof n.type!=`string`)return;let i=f.current;if(!(n.projectId&&n.projectId!==i))switch(n.type){case`ticket_created`:{if(!n.ticket)break;let t=n.ticket;r(e=>e.some(e=>e.id===t.id)?e:[...e,t]),p.current.add(t.id),l(e=>new Set([...e,t.id])),Dd(i)||K.success(e(`toasts.newTicket`,{title:t.title})),setTimeout(()=>{l(e=>{let n=new Set(e);return n.delete(t.id),n})},Od);break}case`ticket_updated`:{if(!n.ticket)break;if(n.ticket.id===0){y();break}let e=n.ticket;r(t=>t.map(t=>t.id===e.id?e:t)),typeof e.description==`string`&&e.description.includes(kd)&&d(t=>{if(!t.has(e.id))return t;let n=new Set(t);return n.delete(e.id),n});break}case`ticket_deleted`:{if(n.ticketId==null)break;let e=n.ticketId;r(t=>t.filter(t=>t.id!==e)),p.current.delete(e);break}case`explore.contract_refine_started`:if(n.ticketId==null)break;d(e=>new Set([...e,n.ticketId]));break;case`explore.contract_refine_failed`:{if(n.ticketId==null)break;let e=n.ticketId;d(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n});break}}},[y,e]);(0,I.useLayoutEffect)(()=>(m(`tickets-${_}`,b),()=>h(`tickets-${_}`)),[b,m,h,_]);let x=(0,I.useRef)(g);return(0,I.useEffect)(()=>{x.current!==`connected`&&g===`connected`&&f.current&&y(),x.current=g},[g,y]),{tickets:n,loading:i,isLoading:i,error:o,newTicketIds:c,contractRefiningIds:u,refetch:y,refresh:y,deleteTicket:(0,I.useCallback)(async e=>{let t=await fetch(`${ul()}/tickets/${e}`,{method:`DELETE`});return t.ok&&y(),t.ok},[y]),updateTicketStatus:(0,I.useCallback)(async(e,t)=>{let n=await fetch(`${ul()}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})});return n.ok&&y(),n.ok},[y]),updateTicketPriority:(0,I.useCallback)(async(e,t)=>{let n=await fetch(`${ul()}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({priority:t})});return n.ok&&y(),n.ok},[y]),createTicket:(0,I.useCallback)(async e=>{let t=await fetch(`${ul()}/tickets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return t.ok&&y(),t.ok},[y]),updateTicket:(0,I.useCallback)(async(e,t)=>{let n=await fetch(`${ul()}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return n.ok&&y(),n.ok},[y])}}var Nd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Pd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Fd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Id=e=>{let t=Fd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ld={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`},Rd=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},zd=(0,I.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,I.createElement)(`svg`,{ref:c,...Ld,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Nd(`lucide`,i),...!a&&!Rd(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,I.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Y=(e,t)=>{let n=(0,I.forwardRef)(({className:n,...r},i)=>(0,I.createElement)(zd,{ref:i,iconNode:t,className:Nd(`lucide-${Pd(Id(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Id(e),n},Bd=Y(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Vd=Y(`apple`,[[`path`,{d:`M12 6.528V3a1 1 0 0 1 1-1h0`,key:`11qiee`}],[`path`,{d:`M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21`,key:`110c12`}]]),Hd=Y(`arrow-down-up`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`m21 8-4-4-4 4`,key:`1c9v7m`}],[`path`,{d:`M17 4v16`,key:`7dpous`}]]),Ud=Y(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Wd=Y(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Gd=Y(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Kd=Y(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),qd=Y(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Jd=Y(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Yd=Y(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Xd=Y(`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`}]]),Zd=Y(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Qd=Y(`briefcase`,[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),$d=Y(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),ef=Y(`chart-no-axes-column`,[[`path`,{d:`M5 21v-6`,key:`1hz6c0`}],[`path`,{d:`M12 21V3`,key:`1lcnhd`}],[`path`,{d:`M19 21V9`,key:`unv183`}]]),tf=Y(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),nf=Y(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),rf=Y(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),af=Y(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),of=Y(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),sf=Y(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),cf=Y(`circle-alert`,[[`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`}]]),lf=Y(`circle-arrow-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m12 16 4-4-4-4`,key:`1i9zcv`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),uf=Y(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),df=Y(`circle-x`,[[`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`}]]),ff=Y(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),pf=Y(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),mf=Y(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),hf=Y(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),gf=Y(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),_f=Y(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),vf=Y(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),yf=Y(`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`}]]),bf=Y(`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`}]]),xf=Y(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Sf=Y(`crop`,[[`path`,{d:`M6 2v14a2 2 0 0 0 2 2h14`,key:`ron5a4`}],[`path`,{d:`M18 22V8a2 2 0 0 0-2-2H2`,key:`7s9ehn`}]]),Cf=Y(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),wf=Y(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Tf=Y(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ef=Y(`droplet`,[[`path`,{d:`M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z`,key:`c7niix`}]]),Df=Y(`external-link`,[[`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`}]]),Of=Y(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),kf=Y(`file-minus-corner`,[[`path`,{d:`M20 14V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12`,key:`l9p8hp`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Af=Y(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),jf=Y(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Mf=Y(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),Nf=Y(`folder-open`,[[`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`}]]),Pf=Y(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Ff=Y(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),If=Y(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),Lf=Y(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Rf=Y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),zf=Y(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),Bf=Y(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Vf=Y(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Hf=Y(`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`}]]),Uf=Y(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Wf=Y(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Gf=Y(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Kf=Y(`layout-dashboard`,[[`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`}]]),qf=Y(`link-2`,[[`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`}]]),Jf=Y(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Yf=Y(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Xf=Y(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Zf=Y(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Qf=Y(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),$f=Y(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),ep=Y(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),tp=Y(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),np=Y(`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`}]]),rp=Y(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),ip=Y(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),ap=Y(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),op=Y(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),sp=Y(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),cp=Y(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`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`}]]),lp=Y(`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`}]]),up=Y(`pipette`,[[`path`,{d:`m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12`,key:`1y3wsu`}],[`path`,{d:`m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z`,key:`110lr1`}],[`path`,{d:`m2 22 .414-.414`,key:`jhxm08`}]]),dp=Y(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),fp=Y(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),pp=Y(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),mp=Y(`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`}]]),hp=Y(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),gp=Y(`ratio`,[[`rect`,{width:`12`,height:`20`,x:`6`,y:`2`,rx:`2`,key:`1oxtiu`}],[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`2`,key:`9lu3g6`}]]),_p=Y(`receipt`,[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]),vp=Y(`redo-2`,[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]),yp=Y(`refresh-cw`,[[`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`}]]),bp=Y(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),xp=Y(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Sp=Y(`rotate-cw`,[[`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`}]]),Cp=Y(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),wp=Y(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),Tp=Y(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ep=Y(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Dp=Y(`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`}]]),Op=Y(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),kp=Y(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ap=Y(`shield-check`,[[`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`}]]),jp=Y(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Mp=Y(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Np=Y(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),Pp=Y(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Fp=Y(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),Ip=Y(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),Lp=Y(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Rp=Y(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),zp=Y(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),Bp=Y(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),Vp=Y(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Hp=Y(`triangle-alert`,[[`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`}]]),Up=Y(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Wp=Y(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Gp=Y(`wallet`,[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]),Kp=Y(`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`}]]),qp=Y(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Jp=Y(`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 Yp(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Xp(...e){return t=>{let n=!1,r=e.map(e=>{let r=Yp(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():Yp(e[t],null)}}}}function Zp(...e){return I.useCallback(Xp(...e),e)}var Qp=Symbol.for(`react.lazy`),$p=I.use;function em(e){return typeof e==`object`&&!!e&&`then`in e}function tm(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Qp&&`_payload`in e&&em(e._payload)}function nm(e){let t=im(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e;tm(r)&&typeof $p==`function`&&(r=$p(r._payload));let a=I.Children.toArray(r),o=a.find(om);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,q.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,q.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var rm=nm(`Slot`);function im(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(tm(n)&&typeof $p==`function`&&(n=$p(n._payload)),I.isValidElement(n)){let e=cm(n),i=sm(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Xp(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var am=Symbol(`radix.slottable`);function om(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===am}function sm(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 cm(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 lm=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,um=D,dm=(e,t)=>n=>{if(t?.variants==null)return um(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=lm(t)||lm(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 um(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)},fm=(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},pm=(e,t)=>({classGroupId:e,validator:t}),mm=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),hm=`-`,gm=[],_m=`arbitrary..`,vm=e=>{let t=xm(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return bm(e);let n=e.split(hm);return ym(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?fm(i,t):t:i||gm}return n[e]||gm}}},ym=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ym(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(hm):e.slice(t).join(hm),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},bm=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?_m+r:void 0})(),xm=e=>{let{theme:t,classGroups:n}=e;return Sm(n,t)},Sm=(e,t)=>{let n=mm();for(let r in e){let i=e[r];Cm(i,n,r,t)}return n},Cm=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];wm(i,t,n,r)}},wm=(e,t,n,r)=>{if(typeof e==`string`){Tm(e,t,n);return}if(typeof e==`function`){Em(e,t,n,r);return}Dm(e,t,n,r)},Tm=(e,t,n)=>{let r=e===``?t:Om(t,e);r.classGroupId=n},Em=(e,t,n,r)=>{if(km(e)){Cm(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(pm(n,e))},Dm=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Cm(o,Om(t,a),n,r)}},Om=(e,t)=>{let n=e,r=t.split(hm),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=mm(),n.nextPart.set(t,i)),n=i}return n},km=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Am=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)}}},jm=`!`,Mm=`:`,Nm=[],Pm=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Fm=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===Mm){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(jm)?(c=s.slice(0,-1),l=!0):s.startsWith(jm)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Pm(t,l,c,u)};if(t){let e=t+Mm,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Pm(Nm,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Im=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}},Lm=e=>({cache:Am(e.cacheSize),parseClassName:Fm(e),sortModifiers:Im(e),...vm(e)}),Rm=/\s+/,zm=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Rm),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+jm:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Bm=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Vm(n))&&(i&&(i+=` `),i+=r);return i},Vm=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Vm(e[r]))&&(n&&(n+=` `),n+=t);return n},Hm=(e,...t)=>{let n,r,i,a,o=o=>(n=Lm(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=zm(e,n);return i(e,a),a};return a=o,(...e)=>a(Bm(...e))},Um=[],Wm=e=>{let t=t=>t[e]||Um;return t.isThemeGetter=!0,t},Gm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Km=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qm=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Jm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ym=/\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$/,Xm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Zm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$m=e=>qm.test(e),eh=e=>!!e&&!Number.isNaN(Number(e)),th=e=>!!e&&Number.isInteger(Number(e)),nh=e=>e.endsWith(`%`)&&eh(e.slice(0,-1)),rh=e=>Jm.test(e),ih=()=>!0,ah=e=>Ym.test(e)&&!Xm.test(e),oh=()=>!1,sh=e=>Zm.test(e),ch=e=>Qm.test(e),lh=e=>!dh(e)&&!yh(e),uh=e=>Dh(e,jh,oh),dh=e=>Gm.test(e),fh=e=>Dh(e,Mh,ah),ph=e=>Dh(e,Nh,eh),mh=e=>Dh(e,Fh,ih),hh=e=>Dh(e,Ph,oh),gh=e=>Dh(e,kh,oh),_h=e=>Dh(e,Ah,ch),vh=e=>Dh(e,Ih,sh),yh=e=>Km.test(e),bh=e=>Oh(e,Mh),xh=e=>Oh(e,Ph),Sh=e=>Oh(e,kh),Ch=e=>Oh(e,jh),wh=e=>Oh(e,Ah),Th=e=>Oh(e,Ih,!0),Eh=e=>Oh(e,Fh,!0),Dh=(e,t,n)=>{let r=Gm.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Oh=(e,t,n=!1)=>{let r=Km.exec(e);return r?r[1]?t(r[1]):n:!1},kh=e=>e===`position`||e===`percentage`,Ah=e=>e===`image`||e===`url`,jh=e=>e===`length`||e===`size`||e===`bg-size`,Mh=e=>e===`length`,Nh=e=>e===`number`,Ph=e=>e===`family-name`,Fh=e=>e===`number`||e===`weight`,Ih=e=>e===`shadow`,Lh=Hm(()=>{let e=Wm(`color`),t=Wm(`font`),n=Wm(`text`),r=Wm(`font-weight`),i=Wm(`tracking`),a=Wm(`leading`),o=Wm(`breakpoint`),s=Wm(`container`),c=Wm(`spacing`),l=Wm(`radius`),u=Wm(`shadow`),d=Wm(`inset-shadow`),f=Wm(`text-shadow`),p=Wm(`drop-shadow`),m=Wm(`blur`),h=Wm(`perspective`),g=Wm(`aspect`),_=Wm(`ease`),v=Wm(`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(),yh,dh],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[yh,dh,c],T=()=>[$m,`full`,`auto`,...w()],E=()=>[th,`none`,`subgrid`,yh,dh],D=()=>[`auto`,{span:[`full`,th,yh,dh]},th,yh,dh],O=()=>[th,`auto`,yh,dh],k=()=>[`auto`,`min`,`max`,`fr`,yh,dh],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=()=>[$m,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[$m,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[$m,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,yh,dh],L=()=>[...b(),Sh,gh,{position:[yh,dh]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,Ch,uh,{size:[yh,dh]}],R=()=>[nh,bh,fh],z=()=>[``,`none`,`full`,l,yh,dh],B=()=>[``,eh,bh,fh],V=()=>[`solid`,`dashed`,`dotted`,`double`],ne=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],H=()=>[eh,nh,Sh,gh],U=()=>[``,`none`,m,yh,dh],re=()=>[`none`,eh,yh,dh],ie=()=>[`none`,eh,yh,dh],W=()=>[eh,yh,dh],ae=()=>[$m,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[rh],breakpoint:[rh],color:[ih],container:[rh],"drop-shadow":[rh],ease:[`in`,`out`,`in-out`],font:[lh],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[rh],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[rh],shadow:[rh],spacing:[`px`,eh],text:[rh],"text-shadow":[rh],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,$m,dh,yh,g]}],container:[`container`],columns:[{columns:[eh,dh,yh,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:[th,`auto`,yh,dh]}],basis:[{basis:[$m,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[eh,$m,`auto`,`initial`,`none`,dh]}],grow:[{grow:[``,eh,yh,dh]}],shrink:[{shrink:[``,eh,yh,dh]}],order:[{order:[th,`first`,`last`,`none`,yh,dh]}],"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,bh,fh]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Eh,mh]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,nh,dh]}],"font-family":[{font:[xh,hh,t]}],"font-features":[{"font-features":[dh]}],"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,yh,dh]}],"line-clamp":[{"line-clamp":[eh,`none`,yh,ph]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,yh,dh]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,yh,dh]}],"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:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[eh,`from-font`,`auto`,yh,fh]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[eh,`auto`,yh,dh]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,yh,dh]}],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`,yh,dh]}],"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`]},th,yh,dh],radial:[``,yh,dh],conic:[th,yh,dh]},wh,_h]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`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:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[eh,yh,dh]}],"outline-w":[{outline:[``,eh,bh,fh]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Th,vh]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Th,vh]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[eh,fh]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Th,vh]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[eh,yh,dh]}],"mix-blend":[{"mix-blend":[...ne(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ne()}],"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":[eh]}],"mask-image-linear-from-pos":[{"mask-linear-from":H()}],"mask-image-linear-to-pos":[{"mask-linear-to":H()}],"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":H()}],"mask-image-t-to-pos":[{"mask-t-to":H()}],"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":H()}],"mask-image-r-to-pos":[{"mask-r-to":H()}],"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":H()}],"mask-image-b-to-pos":[{"mask-b-to":H()}],"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":H()}],"mask-image-l-to-pos":[{"mask-l-to":H()}],"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":H()}],"mask-image-x-to-pos":[{"mask-x-to":H()}],"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":H()}],"mask-image-y-to-pos":[{"mask-y-to":H()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[yh,dh]}],"mask-image-radial-from-pos":[{"mask-radial-from":H()}],"mask-image-radial-to-pos":[{"mask-radial-to":H()}],"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":[eh]}],"mask-image-conic-from-pos":[{"mask-conic-from":H()}],"mask-image-conic-to-pos":[{"mask-conic-to":H()}],"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`,yh,dh]}],filter:[{filter:[``,`none`,yh,dh]}],blur:[{blur:U()}],brightness:[{brightness:[eh,yh,dh]}],contrast:[{contrast:[eh,yh,dh]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Th,vh]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,eh,yh,dh]}],"hue-rotate":[{"hue-rotate":[eh,yh,dh]}],invert:[{invert:[``,eh,yh,dh]}],saturate:[{saturate:[eh,yh,dh]}],sepia:[{sepia:[``,eh,yh,dh]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,yh,dh]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[eh,yh,dh]}],"backdrop-contrast":[{"backdrop-contrast":[eh,yh,dh]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,eh,yh,dh]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[eh,yh,dh]}],"backdrop-invert":[{"backdrop-invert":[``,eh,yh,dh]}],"backdrop-opacity":[{"backdrop-opacity":[eh,yh,dh]}],"backdrop-saturate":[{"backdrop-saturate":[eh,yh,dh]}],"backdrop-sepia":[{"backdrop-sepia":[``,eh,yh,dh]}],"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`,yh,dh]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[eh,`initial`,yh,dh]}],ease:[{ease:[`linear`,`initial`,_,yh,dh]}],delay:[{delay:[eh,yh,dh]}],animate:[{animate:[`none`,v,yh,dh]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,yh,dh]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:W()}],"skew-x":[{"skew-x":W()}],"skew-y":[{"skew-y":W()}],transform:[{transform:[yh,dh,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":[`translate-none`],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`,yh,dh]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"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`,yh,dh]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[eh,bh,fh,ph]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{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`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function X(...e){return Lh(D(e))}var Rh=dm(`inline-flex items-center justify-center whitespace-nowrap rounded-md text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 px-3 py-1.5`,sm:`h-7 rounded-md px-2`,lg:`h-10 rounded-md px-6`,icon:`h-8 w-8`}},defaultVariants:{variant:`default`,size:`default`}}),Z=I.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,q.jsx)(r?rm:`button`,{className:X(Rh({variant:t,size:n,className:e})),ref:a,...i}));Z.displayName=`Button`;var zh=dm(`inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground`,outline:`text-foreground`,success:`border-transparent bg-emerald-500/20 aurora-light:bg-accent-success/10 text-emerald-400 aurora-light:text-accent-success border-emerald-500/30 aurora-light:border-accent-success/30`,warning:`border-transparent bg-amber-500/20 aurora-light:bg-accent-warning/10 text-amber-400 aurora-light:text-accent-warning border-amber-500/30 aurora-light:border-accent-warning/30`,running:`border-transparent bg-blue-500/20 aurora-light:bg-accent-info/10 text-blue-400 aurora-light:text-accent-info border-blue-500/30 aurora-light:border-accent-info/30`,queued:`border-transparent bg-slate-500/20 aurora-light:bg-muted text-slate-400 aurora-light:text-muted-foreground border-slate-500/30 aurora-light:border-border`,failed:`border-transparent bg-red-500/20 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive border-red-500/30 aurora-light:border-destructive/30`,canceled:`border-transparent bg-slate-600/20 aurora-light:bg-muted text-slate-500 aurora-light:text-muted-foreground border-slate-600/30 aurora-light:border-border`}},defaultVariants:{variant:`default`}});function Bh({className:e,variant:t,...n}){return(0,q.jsx)(`div`,{className:X(zh({variant:t}),e),...n})}var Vh={critical:`destructive`,high:`default`,medium:`warning`,low:`outline`},Hh=700;function Uh({ticket:e,onClick:t,dragDisabled:n,contractRefining:r=!1,epicChildrenCount:i,parentEpicTitle:a,onOpenParentEpic:o,jiggleMode:s=!1,onLongPress:c,onDelete:l}){let{t:u}=G(`specs`),{attributes:d,listeners:f,setNodeRef:p,transform:m,transition:h,isDragging:g}=el({id:e.id,disabled:n||s}),_=(0,I.useRef)(null),v=(0,I.useRef)(!1),y=(0,I.useCallback)(()=>{_.current&&=(clearTimeout(_.current),null)},[]),b=(0,I.useCallback)(()=>{c&&(v.current=!1,_.current=setTimeout(()=>{v.current=!0,c(),_.current=null},Hh))},[c]),x=(0,I.useCallback)(e=>{e.target.closest(`button`)||b()},[b]),S=(0,I.useCallback)(()=>{y()},[y]),C=(0,I.useCallback)(n=>{if(v.current){n.stopPropagation(),v.current=!1;return}if(s){n.stopPropagation();return}t(e)},[s,t,e]),w=(0,I.useCallback)(t=>{t.stopPropagation(),l?.(e)},[l,e]),T=s?-(e.id*73%400):void 0,E={transform:Ya.Transform.toString(m),transition:h,opacity:g?.4:1,...T===void 0?{}:{animationDelay:`${T}ms`}},D=e.status===`draft`,O=`relative flex items-center gap-2 px-3 py-2.5 rounded-lg border transition-colors group touch-none ${s?``:`cursor-grab active:cursor-grabbing`} ${D?`border-dashed border-accent-secondary/50 bg-accent-secondary/10 hover:bg-accent-secondary/15 hover:border-accent-secondary/70`:r?`border-accent-highlight/70 bg-card/70 shadow-lg shadow-accent-highlight/20 animate-pulse`:`border-border/40 bg-card/60 hover:bg-card/80 hover:border-border/60`} ${s?`animate-jiggle`:``}`;return(0,q.jsxs)(`div`,{ref:p,"data-ticket-id":e.id,"data-draft":D||void 0,"data-contract-refining":r||void 0,"data-jiggle":s||void 0,style:E,...!n&&!s?{...d,...f}:{},className:O,onClick:C,onPointerDownCapture:x,onPointerUp:S,onPointerLeave:S,onPointerCancel:S,role:`button`,tabIndex:0,onKeyDown:n=>n.key===`Enter`&&!s&&t(e),children:[(0,q.jsxs)(`span`,{className:`text-[10px] font-mono text-foreground shrink-0`,children:[`#`,e.id]}),(0,q.jsx)(`span`,{className:`flex-1 text-sm truncate text-foreground`,children:e.title}),e.is_epic?(0,q.jsx)(Bh,{variant:`outline`,className:`text-[9px] shrink-0 border-accent-highlight/60 text-accent-highlight bg-accent-highlight/10`,"data-testid":`epic-badge-${e.id}`,children:u(`badges.epicWithCount`,{count:i??0})}):null,a&&e.parent_epic_id!=null?(0,q.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o?.(e.parent_epic_id)},onPointerDown:e=>e.stopPropagation(),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.stopPropagation(),t.preventDefault(),o?.(e.parent_epic_id))},className:`inline-flex items-center rounded-md border border-accent-secondary/40 text-accent-secondary bg-accent-secondary/5 hover:bg-accent-secondary/15 hover:border-accent-secondary/60 px-1.5 py-0.5 text-[9px] font-medium shrink-0 max-w-[12rem] truncate transition-colors cursor-pointer`,title:u(`badges.openParentEpicTitle`,{id:e.parent_epic_id,title:a}),"data-testid":`epic-child-pill-${e.id}`,children:[`↑ #`,e.parent_epic_id,` `,a]}):null,e.needs_review?(0,q.jsxs)(Bh,{variant:`outline`,className:`text-[9px] shrink-0 gap-1 border-accent-warning/60 text-accent-warning bg-accent-warning/10`,title:u(`badges.needsReviewTitle`),"data-testid":`needs-review-badge-${e.id}`,children:[(0,q.jsx)(Hp,{className:`w-2.5 h-2.5`,"aria-hidden":!0}),u(`badges.review`)]}):null,e.source===`free-prompt`?(0,q.jsx)(Bh,{variant:`outline`,className:`text-[9px] shrink-0 uppercase border-accent-info/50 text-accent-info`,title:u(`badges.rawTitle`),"data-testid":`raw-badge-${e.id}`,children:u(`badges.raw`)}):null,e.jira_key?(0,q.jsx)(Bh,{variant:`outline`,className:`text-[9px] shrink-0 font-mono border-accent-info/50 text-accent-info`,title:e.jira_key,"data-testid":`jira-badge-${e.id}`,children:e.jira_key}):null,D?(0,q.jsx)(Bh,{variant:`outline`,className:`text-[9px] shrink-0 border-accent-secondary/60 text-accent-secondary`,children:u(`common:status.draft`)}):r?(0,q.jsx)(Bh,{variant:`outline`,className:`text-[9px] shrink-0 border-accent-highlight/70 text-accent-highlight bg-accent-highlight/10`,children:u(`badges.contract`)}):e.priority?(0,q.jsx)(Bh,{variant:Vh[e.priority],className:`text-[9px] shrink-0`,children:u(`priority.${e.priority}`)}):null,s&&l&&(0,q.jsx)(`button`,{type:`button`,onClick:w,onPointerDown:e=>e.stopPropagation(),className:`absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-red-500 text-white flex items-center justify-center shadow-md hover:bg-red-600 transition-colors z-10`,title:u(`card.deleteSpec`,{id:e.id}),"aria-label":u(`card.deleteSpec`,{id:e.id}),"data-testid":`spec-card-delete-${e.id}`,children:(0,q.jsx)(Vp,{className:`w-2.5 h-2.5`})})]})}var Wh=224,Gh=8,Kh=8;function qh({rails:e,onMoveToRail:t,onClose:n,anchorRect:r}){let{t:i}=G(`tickets`),a=(0,I.useRef)(null),[o,s]=(0,I.useState)(!1);(0,I.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)},[]),(0,I.useEffect)(()=>{function e(e){a.current&&(a.current.contains(e.target)||n())}function t(e){e.key===`Escape`&&n()}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[n]);let{top:c,left:l,caretLeft:u}=(0,I.useMemo)(()=>{let e=r.left+r.width/2,t=e-Wh/2,n=window.innerWidth-Wh-Gh,i=Math.max(Gh,Math.min(n,t)),a=e-i,o=Math.max(12,Math.min(Wh-12,a));return{top:r.bottom+Kh,left:i,caretLeft:o}},[r]);return(0,q.jsxs)(`div`,{ref:a,role:`dialog`,"aria-label":i(`rail.popoverTitle`),"data-testid":`move-to-rail-popover`,style:{top:c,left:l,width:Wh,opacity:+!!o,transform:o?`translateY(0) scale(1)`:`translateY(-4px) scale(0.97)`,transformOrigin:`${u}px top`,transition:`opacity 140ms ease-out, transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1)`},className:`fixed z-50 rounded-xl border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/40 p-1`,children:[(0,q.jsx)(`div`,{"aria-hidden":!0,className:`absolute w-2 h-2 rotate-45 bg-card/95 border-l border-t border-border/60`,style:{top:-5,left:u-4}}),(0,q.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground/70 font-medium`,children:i(`rail.popoverTitle`)}),e.length===0?(0,q.jsx)(`div`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:i(`rail.noRails`)}):(0,q.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t(e.id),n()},className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-sm hover:bg-accent-info/10 hover:text-accent-info transition-colors`,children:[e.status===`running`?(0,q.jsx)(dp,{className:`w-3 h-3 text-accent-success animate-pulse shrink-0`,"aria-hidden":!0}):(0,q.jsx)(ff,{className:`w-3 h-3 text-muted-foreground/60 shrink-0`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,q.jsx)(lf,{className:`w-3.5 h-3.5 text-muted-foreground/40 shrink-0`,"aria-hidden":!0})]})},e.id))})]})}var Jh=[`title`,`description`,`labels`,`priority`,`acceptanceCriteria`],Yh={title:``,description:``,labels:[],priority:`medium`,acceptanceCriteria:[]};function Xh(e){return!e||typeof e!=`object`?!1:e.type===`spec_draft.update`}var Zh=42;function Qh(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=Zh?t:t.slice(0,Zh-1).trimEnd()+`…`}function $h({chat:e,projectName:t,onRestore:n,onClose:r}){let{t:i}=G(`chat`),a=Qh(e.label);return(0,q.jsxs)(`div`,{"data-testid":`minimized-chat-chip-${e.id}`,className:`grid items-start gap-2 w-full max-w-full`,style:{gridTemplateColumns:`auto minmax(0, 1fr) auto`},children:[(0,q.jsx)(eg,{kind:e.kind}),(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50 rounded overflow-hidden`,"aria-label":i(`chip.restore`,{label:e.label}),title:e.label,children:[(0,q.jsx)(`div`,{className:`text-sm font-medium text-foreground truncate`,children:a}),(0,q.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-0.5 truncate`,children:i(`chip.continueEditing`,{projectName:t})})]}),(0,q.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-6 h-6 rounded text-muted-foreground hover:text-foreground hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50`,"aria-label":i(`chip.close`,{label:e.label}),children:(0,q.jsx)(qp,{className:`w-3.5 h-3.5`})})]})}function eg({kind:e}){let{t}=G(`chat`);return(0,q.jsx)(e===`ai-edit`?Mp:$f,{className:`w-4 h-4 text-accent-primary flex-shrink-0 mt-0.5`,"aria-label":t(e===`ai-edit`?`chip.kindAiEdit`:`chip.kindExploreSpec`)})}function tg({chats:e,projects:t,hidden:n,onRestore:r,onClose:i}){let{t:a}=G(`chat`),o=(0,I.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.id,n.name);return e},[t]),s=(0,I.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]);return n||s.length===0?null:(0,q.jsxs)(`div`,{"data-testid":`minimized-chats-dock`,"aria-label":a(`dock.minimizedSessions`,{count:s.length}),className:`fixed bottom-4 right-14 z-[70] flex flex-col-reverse gap-2 w-[320px] max-w-[calc(100vw-15rem)] max-h-[70vh] overflow-y-auto pointer-events-none`,children:[s.map(e=>(0,q.jsx)(`div`,{className:`pointer-events-auto glass-card border border-border/30 rounded-lg p-3 shadow-lg w-full`,children:(0,q.jsx)($h,{chat:e,projectName:o.get(e.projectId)??a(`dock.unknownProject`),onRestore:()=>r(e.id),onClose:()=>i(e.id)})},e.id)),s.length>1&&(0,q.jsxs)(`div`,{className:`pointer-events-auto self-end inline-flex items-center gap-1 rounded-full bg-card/80 border border-border/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur-sm`,children:[(0,q.jsx)(sf,{className:`w-3 h-3`}),a(`dock.minimizedCount`,{count:s.length})]})]})}var ng=(0,I.createContext)(null),rg=`specrails-desktop:minimized-chats`,ig=`specrails-desktop:minimized-chats-pending`,ag=50,og=8e3;function sg(){return dg(rg)}function cg(e){pg(rg,e)}function lg(){return dg(ig)}function ug(e){pg(ig,e)}function dg(e){if(typeof window>`u`)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(mg):[]}catch{return[]}}function fg(e){return e.length<=ag?e:[...e].sort((e,t)=>e.createdAt-t.createdAt).slice(e.length-ag)}function pg(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,JSON.stringify(fg(t)))}catch{}}function mg(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.id!=`string`||typeof t.projectId!=`string`||typeof t.label!=`string`||typeof t.restoreRoute!=`string`||typeof t.createdAt!=`number`||t.kind!==`explore-spec`&&t.kind!==`ai-edit`||!t.params||typeof t.params!=`object`)}function hg(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function gg(e){return e.kind===`explore-spec`?e.params.resumeConversationId??`pending:${e.params.pendingSpecId}`:e.params.resumeRefineId??`agent:${e.params.agentId}`}function _g(e,t){return e.kind!==t.kind||e.projectId!==t.projectId?!1:gg(e)===gg(t)}function vg({children:e}){let{projects:t,activeProjectId:n,setActiveProjectId:r,setupProjectIds:i}=Sd(),a=ct(),{registerHandler:o,unregisterHandler:s}=xl(),[c,l]=(0,I.useState)(()=>sg()),[u,d]=(0,I.useState)([]),f=(0,I.useRef)(c);f.current=c;let p=(0,I.useRef)(u);p.current=u;let m=(0,I.useRef)(new Map),h=(0,I.useRef)(t);h.current=t;let g=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(g.current)return;g.current=!0;let e=lg();ug([]),e.length!==0&&l(t=>{let n=[...t];for(let t of e)n.some(e=>e.id===t.id||_g(e,t))||n.push(t);return cg(n),f.current=n,n})},[]),(0,I.useEffect)(()=>{let e=m.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]),(0,I.useEffect)(()=>{cg(c)},[c]),(0,I.useEffect)(()=>{ug(u)},[u]);let _=(0,I.useRef)(()=>{}),v=(0,I.useRef)(()=>{});(0,I.useEffect)(()=>{let e=`minimized-chats:spec-draft`;return o(e,e=>{if(!Xh(e))return;let t=e.conversationId,n=f.current.find(e=>e.kind===`explore-spec`&&e.params.resumeConversationId===t);if(!n)return;let r=e.draft;r.title?.trim()&&_.current(n.id,r.title);let i={};r.title!==void 0&&(i.title=r.title),r.description!==void 0&&(i.description=r.description),r.priority!==void 0&&(i.priority=r.priority),r.labels!==void 0&&(i.labels=r.labels),r.acceptanceCriteria!==void 0&&(i.acceptanceCriteria=r.acceptanceCriteria),Object.keys(i).length>0&&v.current(n.id,i)}),()=>s(e)},[o,s]),(0,I.useEffect)(()=>{if(t.length===0)return;let e=new Set(t.map(e=>e.id));l(t=>{let n=t.filter(t=>e.has(t.projectId));return n.length===t.length?t:(cg(n),f.current=n,n)}),d(t=>{let n=t.filter(t=>e.has(t.projectId));return n.length===t.length?t:(ug(n),p.current=n,n)})},[t]);let y=(0,I.useCallback)(e=>{let t=hg(),n={...e,id:t,createdAt:Date.now()};if(l(e=>{let t=fg([...e.filter(e=>!_g(e,n)),n]);return cg(t),f.current=t,t}),e.kind===`explore-spec`){let t=e.params.resumeConversationId;t&&fetch(`/api/projects/${e.projectId}/chat/conversations/${t}/minimize`,{method:`POST`}).catch(()=>{})}return t},[]),b=(0,I.useCallback)(e=>{let t=m.current.get(e);t&&(clearTimeout(t),m.current.delete(e))},[]),x=(0,I.useCallback)(e=>{b(e),l(t=>{let n=t.filter(t=>t.id!==e);return cg(n),f.current=n,n}),d(t=>{let n=t.filter(t=>t.id!==e);return n.length===t.length?t:(ug(n),p.current=n,n)})},[b]),S=(0,I.useCallback)((e,t)=>{let n=t.trim();n&&l(t=>{let r=t.map(t=>t.id===e&&t.label!==n?{...t,label:n}:t);return r===t?t:(f.current=r,r)})},[]),C=(0,I.useCallback)((e,t)=>{l(n=>{let r=n.map(n=>{if(n.id!==e||n.kind!==`explore-spec`)return n;let r={...n.params.draftOverrides??{},...t};return{...n,params:{...n.params,draftOverrides:r}}});return f.current=r,r})},[]),w=(0,I.useCallback)(e=>{let t=f.current.find(t=>t.id===e);if(!t||h.current.length>0&&!h.current.some(e=>e.id===t.projectId))return;if(t.kind===`explore-spec`){let e=t.params.resumeConversationId;e&&fetch(`/api/projects/${t.projectId}/chat/conversations/${e}/restore`,{method:`POST`}).catch(()=>{})}n!==t.projectId&&r(t.projectId),a(t.restoreRoute),d(n=>{let r=[...n.filter(t=>t.id!==e),t];return ug(r),p.current=r,r}),l(t=>{let n=t.filter(t=>t.id!==e);return cg(n),f.current=n,n}),b(e);let i=setTimeout(()=>{m.current.delete(e),p.current.some(t=>t.id===e)&&(d(t=>{let n=t.filter(t=>t.id!==e);return ug(n),p.current=n,n}),l(n=>{if(n.some(n=>n.id===e||_g(n,t)))return n;let r=[...n,t];return cg(r),f.current=r,r}))},og);m.current.set(e,i)},[n,r,a,b]),T=(0,I.useRef)(w);T.current=w;let E=(0,I.useRef)(x);E.current=x,_.current=S,v.current=C;let D=(0,I.useCallback)((e,t)=>{let n=p.current,r=n.findIndex(n=>n.kind===e&&n.projectId===t);if(r===-1)return null;let i=n[r];return b(i.id),d(e=>{let t=e.filter(e=>e.id!==i.id);return ug(t),t}),p.current=n.filter(e=>e.id!==i.id),i},[b]),O=(0,I.useCallback)(e=>{let t=hg(),i={...e,id:t,createdAt:Date.now()};n!==e.projectId&&r(e.projectId),a(e.restoreRoute),d(e=>{let t=[...e,i];return ug(t),p.current=t,t}),b(t);let o=setTimeout(()=>{m.current.delete(t),p.current.some(e=>e.id===t)&&(d(e=>{let n=e.filter(e=>e.id!==t);return ug(n),p.current=n,n}),l(e=>{if(e.some(e=>e.id===t||_g(e,i)))return e;let n=[...e,i];return cg(n),f.current=n,n}))},og);m.current.set(t,o)},[n,r,a,b]),k=(0,I.useMemo)(()=>({chats:c,pendingRestores:u,minimize:y,updateLabel:S,patchExploreSpecDraft:C,close:x,restore:w,takePendingRestore:D,triggerResume:O}),[c,u,y,S,C,x,w,D,O]),A=n!==null&&i.has(n);return(0,q.jsxs)(ng.Provider,{value:k,children:[e,(0,q.jsx)(tg,{chats:c,projects:t,hidden:A,onRestore:w,onClose:x})]})}function yg(){return(0,I.useContext)(ng)||{chats:[],pendingRestores:[],minimize:()=>``,updateLabel:()=>{},patchExploreSpecDraft:()=>{},close:()=>{},restore:()=>{},takePendingRestore:()=>null,triggerResume:()=>{}}}function bg(e,t,n){let{pendingRestores:r,takePendingRestore:i}=yg(),a=(0,I.useRef)(n);a.current=n,(0,I.useEffect)(()=>{if(!t)return;let n=i(e,t);n&&a.current(n)},[r,e,t,i])}var xg=/\n*##\s*Acceptance Criteria\s*\n([\s\S]*?)(?=\n##\s|\n*$)/i;function Sg(e){if(!e)return{body:``,criteria:[]};let t=xg.exec(e);if(!t)return{body:e.replace(/\s+$/,``),criteria:[]};let n=t[1],r=e.slice(0,t.index),i=e.slice(t.index+t[0].length),a=`${r.replace(/\s+$/,``)}${i?`\n\n${i.replace(/^\s+/,``)}`:``}`,o=n.split(/\r?\n/).map(e=>e.replace(/^\s*[-*+]\s+/,``).trim()).filter(e=>e.length>0);return{body:a.replace(/\s+$/,``),criteria:o}}var Cg=new Set([`draft`,`todo`]),wg={critical:`destructive`,high:`default`,medium:`warning`,low:`outline`},Tg=700;function Eg({ticket:e,rails:t,onClick:n,onMoveToRail:r,epicChildrenCount:i,parentEpicTitle:a,onOpenParentEpic:o,contractRefining:s=!1,jiggleMode:c=!1,onLongPress:l,onDelete:u}){let{t:d}=G(`specs`),{attributes:f,listeners:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=el({id:e.id,disabled:c}),[v,y]=(0,I.useState)(null),b=(0,I.useRef)(null),x=(0,I.useRef)(null),S=(0,I.useRef)(!1),C=(0,I.useCallback)(()=>{x.current&&=(clearTimeout(x.current),null)},[]),w=(0,I.useCallback)(()=>{l&&(S.current=!1,x.current=setTimeout(()=>{S.current=!0,l(),x.current=null},Tg))},[l]),T=(0,I.useCallback)(e=>{e.target.closest(`button`)||w()},[w]),E=(0,I.useCallback)(()=>{C()},[C]),D=(0,I.useCallback)(t=>{if(S.current){t.stopPropagation(),S.current=!1;return}c||n(e)},[c,n,e]),O=(0,I.useCallback)(e=>{e.stopPropagation(),b.current&&y(b.current.getBoundingClientRect())},[]),k=e.status===`draft`,A=e.is_epic===!0,j=e.parent_epic_id!=null,M=(e.prerequisites?.length??0)>0,N=e.short_summary&&e.short_summary.trim().length>0?e.short_summary:null,{triggerResume:P}=yg(),{activeProjectId:F}=Sd(),L=Cg.has(e.status)&&!!F,ee=(0,I.useCallback)(t=>{if(t.stopPropagation(),!F)return;let{body:n,criteria:r}=Sg(e.description??``);P({kind:`explore-spec`,projectId:F,label:e.title||d(`card.ticketFallbackLabel`,{id:e.id}),restoreRoute:`/`,params:{initialIdea:``,pendingSpecId:``,initialAttachmentIds:[],resumeConversationId:e.origin_conversation_id??void 0,editTicket:{id:e.id,title:e.title,description:n,labels:e.labels??[],priority:e.priority??`medium`,acceptanceCriteria:r,status:e.status}}})},[F,e,P,d]),te=c?-(e.id*73%400):void 0,R={transform:Ya.Translate.toString(h),transition:g,opacity:_?.4:void 0,...te===void 0?{}:{animationDelay:`${te}ms`}},z=k?`bg-accent-secondary/10 border-accent-secondary/40`:s?`bg-card/70 border-accent-highlight/70 shadow-lg shadow-accent-highlight/20 animate-pulse`:A?`bg-card/80 border-accent-highlight/40`:`bg-card/80 border-border/40`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{ref:m,...f,...p,style:R,onClick:D,onPointerDownCapture:T,onPointerUp:E,onPointerLeave:E,onPointerCancel:E,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),D(e))},"data-ticket-id":e.id,"data-tier":`postit`,className:`group relative flex flex-col gap-2 rounded-xl border ${z} backdrop-blur p-3 cursor-pointer transition-[transform,box-shadow,border-color] duration-150 ease-out hover:border-accent-info/40 hover:shadow-md hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-info/60 min-h-[180px] ${c?`animate-jiggle`:``} ${s?`ring-1 ring-accent-info/30`:``}`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground/60 shrink-0`,children:[`#`,e.id]}),j&&a&&e.parent_epic_id!=null&&(0,q.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o?.(e.parent_epic_id)},onPointerDown:e=>e.stopPropagation(),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.stopPropagation(),t.preventDefault(),o?.(e.parent_epic_id))},disabled:!o,title:d(`badges.openParentEpicTitle`,{id:e.parent_epic_id,title:a}),"data-testid":`postit-epic-child-pill-${e.id}`,className:`inline-flex items-center gap-1 rounded-md border border-accent-secondary/40 text-accent-secondary bg-accent-secondary/5 hover:bg-accent-secondary/15 hover:border-accent-secondary/60 disabled:hover:bg-accent-secondary/5 disabled:hover:border-accent-secondary/40 disabled:cursor-default px-1.5 py-0.5 text-[10px] font-medium max-w-[160px] truncate transition-colors`,children:[(0,q.jsx)(Cf,{className:`w-2.5 h-2.5 shrink-0`,"aria-hidden":!0}),(0,q.jsxs)(`span`,{className:`truncate`,children:[`↑ #`,e.parent_epic_id,` `,a]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[e.needs_review&&(0,q.jsxs)(Bh,{variant:`outline`,className:`h-4 gap-1 px-1.5 text-[9px] uppercase border-accent-warning/60 text-accent-warning bg-accent-warning/10`,title:d(`badges.needsReviewTitle`),"data-testid":`needs-review-badge-${e.id}`,children:[(0,q.jsx)(Hp,{className:`w-2.5 h-2.5`,"aria-hidden":!0}),d(`badges.review`)]}),A&&(0,q.jsxs)(Bh,{variant:`outline`,className:`h-4 gap-1 px-1.5 text-[9px] border-accent-highlight/40 text-accent-highlight`,children:[(0,q.jsx)(Cf,{className:`w-2.5 h-2.5`,"aria-hidden":!0}),i?d(`badges.epicWithCount`,{count:i}):d(`badges.epic`)]}),e.source===`free-prompt`&&(0,q.jsx)(Bh,{variant:`outline`,className:`h-4 px-1.5 text-[9px] uppercase border-accent-info/50 text-accent-info`,title:d(`badges.rawTitle`),"data-testid":`raw-badge-${e.id}`,children:d(`badges.raw`)}),e.jira_key&&(0,q.jsx)(Bh,{variant:`outline`,className:`h-4 px-1.5 text-[9px] font-mono border-accent-info/50 text-accent-info`,title:e.jira_key,"data-testid":`jira-badge-${e.id}`,children:e.jira_key}),e.priority&&!k&&(0,q.jsx)(Bh,{variant:wg[e.priority],className:`h-4 px-1.5 text-[9px] uppercase`,children:d(`priority.${e.priority}`)}),k&&(0,q.jsx)(Bh,{variant:`outline`,className:`h-4 px-1.5 text-[9px] uppercase border-accent-secondary/50 text-accent-secondary`,children:d(`common:status.draft`)})]})]}),(0,q.jsx)(`h3`,{className:`text-sm font-medium leading-snug line-clamp-2 text-foreground`,children:e.title}),N&&(0,q.jsx)(`p`,{"data-testid":`postit-short-summary`,className:`text-xs text-muted-foreground/80 leading-relaxed line-clamp-3 italic`,children:N}),M&&(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground/70`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(qf,{className:`w-2.5 h-2.5`,"aria-hidden":!0}),d(`card.dependsOn`,{count:e.prerequisites.length})]})}),(0,q.jsx)(`div`,{className:`flex-1`}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-1 border-t border-border/30`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[L&&(0,q.jsxs)(`button`,{type:`button`,onClick:ee,onPointerDown:e=>e.stopPropagation(),"data-testid":`postit-continue-editing`,title:d(`card.continueEditingTitle`),className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[10px] font-medium text-accent-primary/90 hover:bg-accent-primary/10 hover:text-accent-primary transition-colors`,children:[(0,q.jsx)(Qf,{className:`w-2.5 h-2.5`,"aria-hidden":!0}),d(`card.continueEditing`)]}),(0,q.jsxs)(`button`,{ref:b,type:`button`,onClick:O,"data-testid":`move-to-rail-button`,className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[10px] font-medium text-accent-info/90 hover:bg-accent-info/10 hover:text-accent-info transition-colors`,children:[d(`card.moveToRail`),(0,q.jsx)(Gd,{className:`w-2.5 h-2.5`,"aria-hidden":!0})]})]}),c&&u&&(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),u(e)},className:`p-1 rounded-md text-destructive/70 hover:bg-destructive/10 hover:text-destructive transition-colors`,"aria-label":d(`card.deleteTicket`,{id:e.id}),children:(0,q.jsx)(Vp,{className:`w-3 h-3`})})]})]}),v&&(0,q.jsx)(qh,{rails:t,anchorRect:v,onMoveToRail:t=>r(e.id,t),onClose:()=>y(null)})]})}typeof window<`u`&&window.document&&window.document.createElement;function Dg(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Og(e,t){let n=I.createContext(t),r=e=>{let{children:t,...r}=e,i=I.useMemo(()=>r,Object.values(r));return(0,q.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=I.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function kg(e,t=[]){let n=[];function r(t,r){let i=I.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=I.useMemo(()=>o,Object.values(o));return(0,q.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=I.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>I.createContext(e));return function(n){let r=n?.[e]||t;return I.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Ag(i,...t)]}function Ag(...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 I.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var jg=globalThis?.document?I.useLayoutEffect:()=>{},Mg=I.useId||(()=>void 0),Ng=0;function Pg(e){let[t,n]=I.useState(Mg());return jg(()=>{e||n(e=>e??String(Ng++))},[e]),e||(t?`radix-${t}`:``)}var Fg=I.useInsertionEffect||jg;function Ig({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Lg({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=I.useRef(e!==void 0);I.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,I.useCallback(t=>{if(s){let n=Rg(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Lg({defaultProp:e,onChange:t}){let[n,r]=I.useState(e),i=I.useRef(n),a=I.useRef(t);return Fg(()=>{a.current=t},[t]),I.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Rg(e){return typeof e==`function`}function zg(e){let t=Bg(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e,a=I.Children.toArray(r),o=a.find(Hg);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,q.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,q.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Bg(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(I.isValidElement(n)){let e=Wg(n),i=Ug(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Xp(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Vg=Symbol(`radix.slottable`);function Hg(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Vg}function Ug(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 Wg(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 Gg=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=zg(`Primitive.${t}`),r=I.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,q.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Kg(e,t){e&&Qn.flushSync(()=>e.dispatchEvent(t))}function qg(e){let t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>(...e)=>t.current?.(...e),[])}function Jg(e,t=globalThis?.document){let n=qg(e);I.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Yg=`DismissableLayer`,Xg=`dismissableLayer.update`,Zg=`dismissableLayer.pointerDownOutside`,Qg=`dismissableLayer.focusOutside`,$g,e_=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),t_=I.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=I.useContext(e_),[u,d]=I.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=I.useState({}),m=Zp(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=i_(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=a_(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Jg(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),I.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&($g=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),o_(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=$g)}},[u,f,n,l]),I.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),o_())},[u,l]),I.useEffect(()=>{let e=()=>p({});return document.addEventListener(Xg,e),()=>document.removeEventListener(Xg,e)},[]),(0,q.jsx)(Gg.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:Dg(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Dg(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Dg(e.onPointerDownCapture,x.onPointerDownCapture)})});t_.displayName=Yg;var n_=`DismissableLayerBranch`,r_=I.forwardRef((e,t)=>{let n=I.useContext(e_),r=I.useRef(null),i=Zp(t,r);return I.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,q.jsx)(Gg.div,{...e,ref:i})});r_.displayName=n_;function i_(e,t=globalThis?.document){let n=qg(e),r=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){s_(Zg,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function a_(e,t=globalThis?.document){let n=qg(e),r=I.useRef(!1);return I.useEffect(()=>{let e=e=>{e.target&&!r.current&&s_(Qg,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 o_(){let e=new CustomEvent(Xg);document.dispatchEvent(e)}function s_(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?Kg(i,a):i.dispatchEvent(a)}var c_=`focusScope.autoFocusOnMount`,l_=`focusScope.autoFocusOnUnmount`,u_={bubbles:!1,cancelable:!0},d_=`FocusScope`,f_=I.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=I.useState(null),l=qg(i),u=qg(a),d=I.useRef(null),f=Zp(t,e=>c(e)),p=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:y_(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||y_(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&y_(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,p.paused]),I.useEffect(()=>{if(s){b_.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(c_,u_);s.addEventListener(c_,l),s.dispatchEvent(t),t.defaultPrevented||(p_(C_(h_(s)),{select:!0}),document.activeElement===e&&y_(s))}return()=>{s.removeEventListener(c_,l),setTimeout(()=>{let t=new CustomEvent(l_,u_);s.addEventListener(l_,u),s.dispatchEvent(t),t.defaultPrevented||y_(e??document.body,{select:!0}),s.removeEventListener(l_,u),b_.remove(p)},0)}}},[s,l,u,p]);let m=I.useCallback(e=>{if(!n&&!r||p.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]=m_(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&y_(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&y_(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,q.jsx)(Gg.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});f_.displayName=d_;function p_(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(y_(r,{select:t}),document.activeElement!==n)return}function m_(e){let t=h_(e);return[g_(t,e),g_(t.reverse(),e)]}function h_(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 g_(e,t){for(let n of e)if(!__(n,{upTo:t}))return n}function __(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 v_(e){return e instanceof HTMLInputElement&&`select`in e}function y_(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&v_(e)&&t&&e.select()}}var b_=x_();function x_(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=S_(e,t),e.unshift(t)},remove(t){e=S_(e,t),e[0]?.resume()}}}function S_(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function C_(e){return e.filter(e=>e.tagName!==`A`)}var w_=`Portal`,T_=I.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=I.useState(!1);jg(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Qn.createPortal((0,q.jsx)(Gg.div,{...r,ref:t}),o):null});T_.displayName=w_;function E_(e,t){return I.useReducer((e,n)=>t[e][n]??e,e)}var D_=e=>{let{present:t,children:n}=e,r=O_(t),i=typeof n==`function`?n({present:r.isPresent}):I.Children.only(n),a=Zp(r.ref,A_(i));return typeof n==`function`||r.isPresent?I.cloneElement(i,{ref:a}):null};D_.displayName=`Presence`;function O_(e){let[t,n]=I.useState(),r=I.useRef(null),i=I.useRef(e),a=I.useRef(`none`),[o,s]=E_(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return I.useEffect(()=>{let e=k_(r.current);a.current=o===`mounted`?e:`none`},[o]),jg(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=k_(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),jg(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=k_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=k_(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:I.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function k_(e){return e?.animationName||`none`}function A_(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 j_=0;function M_(){I.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??N_()),document.body.insertAdjacentElement(`beforeend`,e[1]??N_()),j_++,()=>{j_===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),j_--}},[])}function N_(){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 P_=function(){return P_=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},P_.apply(this,arguments)};function F_(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 I_(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 L_=`right-scroll-bar-position`,R_=`width-before-scroll-bar`,z_=`with-scroll-bars-hidden`,B_=`--removed-body-scroll-bar-size`;function V_(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function H_(e,t){var n=(0,I.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 U_=typeof window<`u`?I.useLayoutEffect:I.useEffect,W_=new WeakMap;function G_(e,t){var n=H_(t||null,function(t){return e.forEach(function(e){return V_(e,t)})});return U_(function(){var t=W_.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||V_(e,null)}),i.forEach(function(e){r.has(e)||V_(e,a)})}W_.set(n,e)},[e]),n}function K_(e){return e}function q_(e,t){t===void 0&&(t=K_);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 J_(e){e===void 0&&(e={});var t=q_(null);return t.options=P_({async:!0,ssr:!1},e),t}var Y_=function(e){var t=e.sideCar,n=F_(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 I.createElement(r,P_({},n))};Y_.isSideCarExport=!0;function X_(e,t){return e.useMedium(t),Y_}var Z_=J_(),Q_=function(){},$_=I.forwardRef(function(e,t){var n=I.useRef(null),r=I.useState({onScrollCapture:Q_,onWheelCapture:Q_,onTouchMoveCapture:Q_}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=F_(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=G_([n,t]),C=P_(P_({},b),i);return I.createElement(I.Fragment,null,u&&I.createElement(x,{sideCar:Z_,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?I.cloneElement(I.Children.only(s),P_(P_({},C),{ref:S})):I.createElement(v,P_({},C,{className:c,ref:S}),s))});$_.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},$_.classNames={fullWidth:R_,zeroRight:L_};var ev,tv=function(){if(ev)return ev;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function nv(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=tv();return t&&e.setAttribute(`nonce`,t),e}function rv(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iv(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var av=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nv())&&(rv(t,n),iv(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ov=function(){var e=av();return function(t,n){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sv=function(){var e=ov();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},cv={left:0,top:0,right:0,gap:0},lv=function(e){return parseInt(e||``,10)||0},uv=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[lv(n),lv(r),lv(i)]},dv=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return cv;var t=uv(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])}},fv=sv(),pv=`data-scroll-locked`,mv=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
23
|
+
.${z_} {
|
|
24
|
+
overflow: hidden ${r};
|
|
25
|
+
padding-right: ${s}px ${r};
|
|
26
|
+
}
|
|
27
|
+
body[${pv}] {
|
|
28
|
+
overflow: hidden ${r};
|
|
29
|
+
overscroll-behavior: contain;
|
|
30
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
31
|
+
padding-left: ${i}px;
|
|
32
|
+
padding-top: ${a}px;
|
|
33
|
+
padding-right: ${o}px;
|
|
34
|
+
margin-left:0;
|
|
35
|
+
margin-top:0;
|
|
36
|
+
margin-right: ${s}px ${r};
|
|
37
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.${L_} {
|
|
41
|
+
right: ${s}px ${r};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.${R_} {
|
|
45
|
+
margin-right: ${s}px ${r};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.${L_} .${L_} {
|
|
49
|
+
right: 0 ${r};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.${R_} .${R_} {
|
|
53
|
+
margin-right: 0 ${r};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
body[${pv}] {
|
|
57
|
+
${B_}: ${s}px;
|
|
58
|
+
}
|
|
59
|
+
`},hv=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},gv=function(){I.useEffect(function(){return document.body.setAttribute(pv,(hv()+1).toString()),function(){var e=hv()-1;e<=0?document.body.removeAttribute(pv):document.body.setAttribute(pv,e.toString())}},[])},_v=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;gv();var a=I.useMemo(function(){return dv(i)},[i]);return I.createElement(fv,{styles:mv(a,!t,i,n?``:`!important`)})},vv=!1;if(typeof window<`u`)try{var yv=Object.defineProperty({},`passive`,{get:function(){return vv=!0,!0}});window.addEventListener(`test`,yv,yv),window.removeEventListener(`test`,yv,yv)}catch{vv=!1}var bv=vv?{passive:!1}:!1,xv=function(e){return e.tagName===`TEXTAREA`},Sv=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!xv(e)&&n[t]===`visible`)},Cv=function(e){return Sv(e,`overflowY`)},wv=function(e){return Sv(e,`overflowX`)},Tv=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Ov(e,r)){var i=kv(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ev=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Dv=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Ov=function(e,t){return e===`v`?Cv(t):wv(t)},kv=function(e,t){return e===`v`?Ev(t):Dv(t)},Av=function(e,t){return e===`h`&&t===`rtl`?-1:1},jv=function(e,t,n,r,i){var a=Av(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=kv(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Ov(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},Mv=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Nv=function(e){return[e.deltaX,e.deltaY]},Pv=function(e){return e&&`current`in e?e.current:e},Fv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Iv=function(e){return`
|
|
60
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
61
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
62
|
+
`},Lv=0,Rv=[];function zv(e){var t=I.useRef([]),n=I.useRef([0,0]),r=I.useRef(),i=I.useState(Lv++)[0],a=I.useState(sv)[0],o=I.useRef(e);I.useEffect(function(){o.current=e},[e]),I.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=I_([e.lockRef.current],(e.shards||[]).map(Pv),!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=I.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Mv(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=Tv(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Tv(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 jv(h,t,e,h===`h`?s:c,!0)},[]),c=I.useCallback(function(e){var n=e;if(!(!Rv.length||Rv[Rv.length-1]!==a)){var r=`deltaY`in n?Nv(n):Mv(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Fv(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Pv).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=I.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Bv(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=I.useCallback(function(e){n.current=Mv(e),r.current=void 0},[]),d=I.useCallback(function(t){l(t.type,Nv(t),t.target,s(t,e.lockRef.current))},[]),f=I.useCallback(function(t){l(t.type,Mv(t),t.target,s(t,e.lockRef.current))},[]);I.useEffect(function(){return Rv.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,bv),document.addEventListener(`touchmove`,c,bv),document.addEventListener(`touchstart`,u,bv),function(){Rv=Rv.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,bv),document.removeEventListener(`touchmove`,c,bv),document.removeEventListener(`touchstart`,u,bv)}},[]);var p=e.removeScrollBar,m=e.inert;return I.createElement(I.Fragment,null,m?I.createElement(a,{styles:Iv(i)}):null,p?I.createElement(_v,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Vv=X_(Z_,zv),Hv=I.forwardRef(function(e,t){return I.createElement($_,P_({},e,{ref:t,sideCar:Vv}))});Hv.classNames=$_.classNames;var Uv=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Wv=new WeakMap,Gv=new WeakMap,Kv={},qv=0,Jv=function(e){return e&&(e.host||Jv(e.parentNode))},Yv=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Jv(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})},Xv=function(e,t,n,r){var i=Yv(t,Array.isArray(e)?e:[e]);Kv[n]||(Kv[n]=new WeakMap);var a=Kv[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=(Wv.get(e)||0)+1,l=(a.get(e)||0)+1;Wv.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Gv.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(),qv++,function(){o.forEach(function(e){var t=Wv.get(e)-1,i=a.get(e)-1;Wv.set(e,t),a.set(e,i),t||(Gv.has(e)||e.removeAttribute(r),Gv.delete(e)),i||e.removeAttribute(n)}),qv--,qv||(Wv=new WeakMap,Wv=new WeakMap,Gv=new WeakMap,Kv={})}},Zv=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Uv(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Xv(r,i,n,`aria-hidden`)):function(){return null}};function Qv(e){let t=$v(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e,a=I.Children.toArray(r),o=a.find(ty);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,q.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,q.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function $v(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(I.isValidElement(n)){let e=ry(n),i=ny(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Xp(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ey=Symbol(`radix.slottable`);function ty(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ey}function ny(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 ry(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 iy=`Dialog`,[ay,oy]=kg(iy),[sy,cy]=ay(iy),ly=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=I.useRef(null),c=I.useRef(null),[l,u]=Ig({prop:r,defaultProp:i??!1,onChange:a,caller:iy});return(0,q.jsx)(sy,{scope:t,triggerRef:s,contentRef:c,contentId:Pg(),titleId:Pg(),descriptionId:Pg(),open:l,onOpenChange:u,onOpenToggle:I.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};ly.displayName=iy;var uy=`DialogTrigger`,dy=I.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=cy(uy,n),a=Zp(t,i.triggerRef);return(0,q.jsx)(Gg.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":jy(i.open),...r,ref:a,onClick:Dg(e.onClick,i.onOpenToggle)})});dy.displayName=uy;var fy=`DialogPortal`,[py,my]=ay(fy,{forceMount:void 0}),hy=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=cy(fy,t);return(0,q.jsx)(py,{scope:t,forceMount:n,children:I.Children.map(r,e=>(0,q.jsx)(D_,{present:n||a.open,children:(0,q.jsx)(T_,{asChild:!0,container:i,children:e})}))})};hy.displayName=fy;var gy=`DialogOverlay`,_y=I.forwardRef((e,t)=>{let n=my(gy,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=cy(gy,e.__scopeDialog);return a.modal?(0,q.jsx)(D_,{present:r||a.open,children:(0,q.jsx)(yy,{...i,ref:t})}):null});_y.displayName=gy;var vy=Qv(`DialogOverlay.RemoveScroll`),yy=I.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=cy(gy,n);return(0,q.jsx)(Hv,{as:vy,allowPinchZoom:!0,shards:[i.contentRef],children:(0,q.jsx)(Gg.div,{"data-state":jy(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),by=`DialogContent`,xy=I.forwardRef((e,t)=>{let n=my(by,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=cy(by,e.__scopeDialog);return(0,q.jsx)(D_,{present:r||a.open,children:a.modal?(0,q.jsx)(Sy,{...i,ref:t}):(0,q.jsx)(Cy,{...i,ref:t})})});xy.displayName=by;var Sy=I.forwardRef((e,t)=>{let n=cy(by,e.__scopeDialog),r=I.useRef(null),i=Zp(t,n.contentRef,r);return I.useEffect(()=>{let e=r.current;if(e)return Zv(e)},[]),(0,q.jsx)(wy,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Dg(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Dg(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Dg(e.onFocusOutside,e=>e.preventDefault())})}),Cy=I.forwardRef((e,t)=>{let n=cy(by,e.__scopeDialog),r=I.useRef(!1),i=I.useRef(!1);return(0,q.jsx)(wy,{...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()}})}),wy=I.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=cy(by,n),c=I.useRef(null),l=Zp(t,c);return M_(),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f_,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,q.jsx)(t_,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":jy(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Fy,{titleId:s.titleId}),(0,q.jsx)(Ly,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Ty=`DialogTitle`,Ey=I.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=cy(Ty,n);return(0,q.jsx)(Gg.h2,{id:i.titleId,...r,ref:t})});Ey.displayName=Ty;var Dy=`DialogDescription`,Oy=I.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=cy(Dy,n);return(0,q.jsx)(Gg.p,{id:i.descriptionId,...r,ref:t})});Oy.displayName=Dy;var ky=`DialogClose`,Ay=I.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=cy(ky,n);return(0,q.jsx)(Gg.button,{type:`button`,...r,ref:t,onClick:Dg(e.onClick,()=>i.onOpenChange(!1))})});Ay.displayName=ky;function jy(e){return e?`open`:`closed`}var My=`DialogTitleWarning`,[Ny,Py]=Og(My,{contentName:by,titleName:Ty,docsSlug:`dialog`}),Fy=({titleId:e})=>{let t=Py(My),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
63
|
+
|
|
64
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
65
|
+
|
|
66
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return I.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Iy=`DialogDescriptionWarning`,Ly=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Py(Iy).contentName}}.`;return I.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ry=ly,zy=hy,By=_y,Vy=xy,Hy=Ey,Uy=Oy,Wy=Ay,Gy=Ry,Ky=zy,qy=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(By,{ref:n,className:X(`fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));qy.displayName=By.displayName;var Jy=I.forwardRef(({className:e,children:t,showCloseButton:n=!0,...r},i)=>{let{t:a}=G(`common`);return(0,q.jsxs)(Ky,{children:[(0,q.jsx)(qy,{}),(0,q.jsxs)(Vy,{ref:i,className:X(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-2xl max-h-[85vh] translate-x-[-50%] translate-y-[-50%] gap-4 border border-border/30 bg-popover p-6 shadow-xl backdrop-blur-md duration-200 overflow-y-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-xl`,e),...r,children:[t,n&&(0,q.jsxs)(Wy,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,q.jsx)(qp,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`sr-only`,children:a(`actions.close`)})]})]})]})});Jy.displayName=Vy.displayName;var Yy=({className:e,...t})=>(0,q.jsx)(`div`,{className:X(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Yy.displayName=`DialogHeader`;var Xy=({className:e,...t})=>(0,q.jsx)(`div`,{className:X(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Xy.displayName=`DialogFooter`;var Zy=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(Hy,{ref:n,className:X(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Zy.displayName=Hy.displayName;var Qy=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(Uy,{ref:n,className:X(`text-xs text-muted-foreground`,e),...t}));Qy.displayName=Uy.displayName;var $y=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_FEATURE_TERMINAL_PANEL;return typeof e==`string`?e!==`false`:!0})(),eb=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_FEATURE_AGENTS_SECTION;return typeof e==`string`?e!==`false`:!0})(),tb=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_FEATURE_CODE_EXPLORER;return typeof e==`string`?e!==`false`:!0})(),nb=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_FEATURE_JIRA;return typeof e==`string`?e!==`false`:!0})();async function rb(e){let t=await e.text(),n=t?JSON.parse(t):{};if(!e.ok)throw Error(n.error||`Request failed (${e.status})`);return n}function ib(e){return e??ul()}var ab=e=>({method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),ob={getConnection(e){return fetch(`${ib(e)}/jira/connection`).then(e=>rb(e))},test(e,t){return fetch(`${ib(t)}/jira/test`,ab(e)).then(e=>rb(e))},discoverProjects(e,t){return fetch(`${ib(t)}/jira/discover-projects`,ab(e)).then(e=>rb(e))},discoverStatuses(e,t){return fetch(`${ib(t)}/jira/discover-statuses`,ab(e)).then(e=>rb(e))},connect(e,t){return fetch(`${ib(t)}/jira/connect`,ab(e)).then(e=>rb(e))},setEnabled(e,t){return fetch(`${ib(t)}/jira/connection`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>rb(e))},patchConnection(e,t){return fetch(`${ib(t)}/jira/connection`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}).then(e=>rb(e))},listStatuses(e){return fetch(`${ib(e)}/jira/statuses`).then(e=>rb(e))},discardSpec(e,t,n){return fetch(`${ib(n)}/jira/specs/${e}/discard`,ab({comment:t})).then(e=>rb(e))},getSpecDetails(e,t){return fetch(`${ib(t)}/jira/specs/${e}/details`).then(e=>rb(e))},disconnect(e){return fetch(`${ib(e)}/jira/connection`,{method:`DELETE`}).then(e=>rb(e))},syncNow(e){return fetch(`${ib(e)}/jira/sync`,{method:`POST`}).then(e=>rb(e))},resume(e){return fetch(`${ib(e)}/jira/resume`,{method:`POST`}).then(e=>rb(e))},listOutbox(e,t){let n=e?`?state=${e}`:``;return fetch(`${ib(t)}/jira/outbox${n}`).then(e=>rb(e))},retryOutbox(e,t){return fetch(`${ib(t)}/jira/outbox/${e}/retry`,{method:`POST`}).then(e=>rb(e))}};function sb(){let{activeProjectId:e}=Sd(),[t,n]=(0,I.useState)({connected:!1,key:null,discardStatus:null}),[r,i]=(0,I.useState)(!0);return(0,I.useEffect)(()=>{if(!nb||!e){n({connected:!1,key:null,discardStatus:null}),i(!1);return}let t=!1;return i(!0),ob.getConnection().then(e=>{if(t)return;let r=!!(e.connected&&e.connection?.enabled);n({connected:r,key:e.connection?.jiraProjectKey??null,discardStatus:r?e.connection?.discardStatus??null:null})}).catch(()=>{t||n({connected:!1,key:null,discardStatus:null})}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),{connected:t.connected,jiraProjectKey:t.key,discardStatus:t.discardStatus,loading:r}}var cb=(0,I.createContext)({discardStatus:null});function lb({children:e}){let t=sb(),n=t.connected?t.discardStatus:null,r=(0,I.useMemo)(()=>({discardStatus:n}),[n]);return(0,q.jsx)(cb.Provider,{value:r,children:e})}function ub(){return(0,I.useContext)(cb)}function db({open:e,onOpenChange:t,ticket:n,discardStatus:r,onDiscarded:i}){let{t:a}=G(`jira`),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(!1);async function u(){l(!0);try{await ob.discardSpec(n.id,o.trim()||null),K.success(a(`discard.movedToast`,{status:r,key:n.jira_key??`#${n.id}`})),t(!1),s(``),i?.()}catch(e){K.error(e instanceof Error?e.message:a(`errors.generic`))}finally{l(!1)}}return(0,q.jsx)(Gy,{open:e,onOpenChange:e=>{c||t(e)},children:(0,q.jsxs)(Jy,{className:`max-w-md`,"data-testid":`jira-discard-dialog`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:a(`discard.title`,{status:r})}),(0,q.jsx)(Qy,{children:a(`discard.body`,{status:r,key:n.jira_key??`#${n.id}`})})]}),(0,q.jsxs)(`label`,{className:`block space-y-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:a(`discard.commentLabel`)}),(0,q.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:a(`discard.commentPlaceholder`),rows:3,className:`w-full rounded-md border border-border bg-input px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground resize-none`,"data-testid":`jira-discard-comment`})]}),(0,q.jsxs)(Xy,{children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>t(!1),disabled:c,children:a(`wizard.cancel`)}),(0,q.jsxs)(Z,{size:`sm`,onClick:u,disabled:c,"data-testid":`jira-discard-confirm`,children:[(0,q.jsx)(Gd,{className:`w-3.5 h-3.5 mr-1.5`}),c?a(`discard.moving`):a(`discard.confirm`,{status:r})]})]})]})})}var fb=[{value:`todo`,labelKey:`ticketStatus.todo`,icon:(0,q.jsx)(ff,{className:`w-3.5 h-3.5 text-slate-400 aurora-light:text-muted-foreground`}),className:`text-slate-400 aurora-light:text-muted-foreground`},{value:`done`,labelKey:`ticketStatus.done`,icon:(0,q.jsx)(uf,{className:`w-3.5 h-3.5 text-emerald-400 aurora-light:text-accent-success`}),className:`text-emerald-400 aurora-light:text-accent-success`}],pb=[{value:`critical`,labelKey:`priority.critical`,icon:(0,q.jsx)(cf,{className:`w-3.5 h-3.5 text-red-400 aurora-light:text-destructive`}),className:`text-red-400 aurora-light:text-destructive`},{value:`high`,labelKey:`priority.high`,icon:(0,q.jsx)(qd,{className:`w-3.5 h-3.5 text-orange-400 aurora-light:text-accent-warning`}),className:`text-orange-400 aurora-light:text-accent-warning`},{value:`medium`,labelKey:`priority.medium`,icon:(0,q.jsx)(Gd,{className:`w-3.5 h-3.5 text-yellow-400 aurora-light:text-accent-warning`}),className:`text-yellow-400 aurora-light:text-accent-warning`},{value:`low`,labelKey:`priority.low`,icon:(0,q.jsx)(Ud,{className:`w-3.5 h-3.5 text-slate-400 aurora-light:text-muted-foreground`}),className:`text-slate-400 aurora-light:text-muted-foreground`}];function mb({position:e,ticket:t,activeSubmenu:n,onSetSubmenu:r,onStatusChange:i,onPriorityChange:a,onDeleteRequest:o,discardLabel:s,onDiscardRequest:c,onClose:l}){let{t:u}=G(`tickets`),d=(0,I.useRef)(null),[f,p]=(0,I.useState)(e);(0,I.useEffect)(()=>{if(!d.current)return;let t=d.current.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight;p({x:t.right>n?Math.max(0,e.x-t.width):e.x,y:t.bottom>r?Math.max(0,e.y-t.height):e.y})},[e]);let m=(0,I.useCallback)(e=>{e(),l()},[l]);return(0,q.jsxs)(`div`,{ref:d,role:`menu`,"aria-label":u(`contextMenu.ariaLabel`),style:{left:f.x,top:f.y},className:`fixed z-[200] min-w-[180px] rounded-lg border border-border/50 bg-popover shadow-xl text-xs py-1`,children:[s&&c?(0,q.jsxs)(`button`,{role:`menuitem`,type:`button`,onClick:()=>{c(),l()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-accent-info hover:bg-accent-info/10 transition-colors`,"data-testid":`jira-move-to-menuitem`,children:[(0,q.jsx)(Gd,{className:`w-3.5 h-3.5 shrink-0`}),s]}):(0,q.jsxs)(`button`,{role:`menuitem`,type:`button`,onClick:()=>{o(),l()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-red-400 aurora-light:text-destructive hover:bg-red-500/10 transition-colors`,children:[(0,q.jsx)(Vp,{className:`w-3.5 h-3.5 shrink-0`}),u(`contextMenu.deleteTicket`)]}),(0,q.jsx)(`div`,{className:`my-1 h-px bg-border/40`,role:`separator`}),(0,q.jsxs)(`div`,{role:`menuitem`,tabIndex:-1,"aria-haspopup":`menu`,"aria-expanded":n===`status`,className:X(`relative flex w-full items-center justify-between gap-2 px-3 py-2 cursor-pointer select-none text-foreground/80 hover:bg-accent/50 hover:text-foreground transition-colors`,n===`status`&&`bg-accent/50 text-foreground`),onMouseEnter:()=>r(`status`),onClick:e=>{e.stopPropagation(),r(n===`status`?null:`status`)},children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ff,{className:`w-3.5 h-3.5 shrink-0 text-muted-foreground`}),u(`contextMenu.changeStatus`)]}),(0,q.jsx)(of,{className:`w-3 h-3 text-muted-foreground`}),n===`status`&&(0,q.jsx)(`div`,{role:`menu`,"aria-label":u(`contextMenu.statusOptions`),className:`absolute left-full top-0 ml-1 min-w-[150px] rounded-lg border border-border/50 bg-popover shadow-xl py-1 z-[201]`,children:fb.map(e=>(0,q.jsxs)(`button`,{role:`menuitem`,type:`button`,onClick:()=>m(()=>i(e.value)),className:X(`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-accent/50 transition-colors`,e.className,t.status===e.value&&`bg-accent/30 font-semibold`),children:[e.icon,u(e.labelKey)]},e.value))})]}),(0,q.jsxs)(`div`,{role:`menuitem`,tabIndex:-1,"aria-haspopup":`menu`,"aria-expanded":n===`priority`,className:X(`relative flex w-full items-center justify-between gap-2 px-3 py-2 cursor-pointer select-none text-foreground/80 hover:bg-accent/50 hover:text-foreground transition-colors`,n===`priority`&&`bg-accent/50 text-foreground`),onMouseEnter:()=>r(`priority`),onClick:e=>{e.stopPropagation(),r(n===`priority`?null:`priority`)},children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Mf,{className:`w-3.5 h-3.5 shrink-0 text-muted-foreground`}),u(`contextMenu.setPriority`)]}),(0,q.jsx)(of,{className:`w-3 h-3 text-muted-foreground`}),n===`priority`&&(0,q.jsx)(`div`,{role:`menu`,"aria-label":u(`contextMenu.priorityOptions`),className:`absolute left-full top-0 ml-1 min-w-[140px] rounded-lg border border-border/50 bg-popover shadow-xl py-1 z-[201]`,children:pb.map(e=>(0,q.jsxs)(`button`,{role:`menuitem`,type:`button`,onClick:()=>m(()=>a(e.value)),className:X(`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-accent/50 transition-colors`,e.className,t.priority===e.value&&`bg-accent/30 font-semibold`),children:[e.icon,u(e.labelKey)]},e.value))})]})]})}function hb({ticket:e,onDelete:t,onStatusChange:n,onPriorityChange:r,children:i,className:a}){let{t:o}=G(`tickets`),{t:s}=G(`jira`),[c,l]=(0,I.useState)(!1),[u,d]=(0,I.useState)({x:0,y:0}),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),{discardStatus:v}=ub(),y=!!v&&e.source===`jira`&&!!e.jira_key,b=(0,I.useCallback)(()=>{l(!1),p(null)},[]);(0,I.useEffect)(()=>{if(!c)return;function e(e){e.key===`Escape`&&b()}function t(e){e.target.closest(`[role="menu"]`)||b()}return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[c,b]);function x(e){e.preventDefault(),d({x:e.clientX,y:e.clientY}),p(null),l(!0)}function S(){t(e.id),h(!1)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{onContextMenu:x,className:a,"data-ticket-id":e.id,children:i}),c&&(0,Qn.createPortal)((0,q.jsx)(mb,{position:u,ticket:e,activeSubmenu:f,onSetSubmenu:p,onStatusChange:t=>n(e.id,t),onPriorityChange:t=>r(e.id,t),onDeleteRequest:()=>h(!0),discardLabel:y?s(`discard.moveButton`,{status:v}):void 0,onDiscardRequest:y?()=>_(!0):void 0,onClose:b}),document.body),y&&v&&(0,q.jsx)(db,{open:g,onOpenChange:_,ticket:{id:e.id,title:e.title,jira_key:e.jira_key},discardStatus:v}),(0,q.jsx)(Gy,{open:m,onOpenChange:h,children:(0,q.jsxs)(Jy,{className:`max-w-sm`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:o(`deleteDialog.title`)}),(0,q.jsx)(Qy,{children:(0,q.jsx)(Bi,{t:o,i18nKey:`deleteDialog.body`,values:{id:e.id,title:e.title},components:{strong:(0,q.jsx)(`span`,{className:`font-semibold text-foreground`})}})})]}),(0,q.jsxs)(Xy,{children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>h(!1),children:o(`common:actions.cancel`)}),(0,q.jsxs)(Z,{variant:`destructive`,size:`sm`,onClick:S,children:[(0,q.jsx)(Vp,{className:`w-3.5 h-3.5 mr-1.5`}),o(`common:actions.delete`)]})]})]})})]})}var gb=[`accent-primary`,`accent-info`,`accent-success`,`accent-secondary`,`accent-warning`,`accent-highlight`];function _b(e){let t=2166136261,n=e.toLowerCase();for(let e=0;e<n.length;e+=1)t^=n.charCodeAt(e),t=Math.imul(t,16777619)>>>0;return gb[t%gb.length]}var vb={"accent-primary":`bg-accent-primary/20 text-accent-primary`,"accent-info":`bg-accent-info/20 text-accent-info`,"accent-success":`bg-accent-success/20 text-accent-success`,"accent-secondary":`bg-accent-secondary/20 text-accent-secondary`,"accent-warning":`bg-accent-warning/20 text-accent-warning`,"accent-highlight":`bg-accent-highlight/20 text-accent-highlight`};function yb({tickets:e,active:t,onChange:n,className:r}){let{t:i}=G(`specs`),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),c=(0,I.useRef)(null),l=(0,I.useMemo)(()=>{let t=new Map;for(let n of e)for(let e of n.labels??[]){let n=e.trim();n&&t.set(n,(t.get(n)??0)+1)}return Array.from(t.entries()).sort((e,t)=>t[1]===e[1]?e[0].localeCompare(t[0]):t[1]-e[1])},[e]);(0,I.useEffect)(()=>{if(!a)return;function e(e){c.current?.contains(e.target)||s.current?.contains(e.target)||o(!1)}function t(e){e.key===`Escape`&&o(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[a]);function u(e){let r=new Set(t);r.has(e)?r.delete(e):r.add(e),n(r)}function d(){n(new Set)}let f=t.size===0?i(`labelFilter.all`):t.size===1?Array.from(t)[0]:i(`labelFilter.selected`,{count:t.size});return(0,q.jsxs)(`div`,{className:X(`relative shrink-0`,r),children:[(0,q.jsxs)(`button`,{ref:s,type:`button`,"aria-haspopup":`listbox`,"aria-expanded":a,"aria-label":i(`labelFilter.ariaLabel`),"data-testid":`spec-label-filter-dropdown`,onClick:()=>o(e=>!e),className:`flex items-center gap-1.5 h-7 px-2 rounded-md text-xs bg-accent-secondary/10 border border-accent-secondary/30 hover:bg-accent-secondary/20 text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-secondary/50`,children:[(0,q.jsx)(Lp,{className:`w-3 h-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate max-w-[120px]`,children:f}),t.size>0&&(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/80`,children:[`·\xA0`,t.size]})]}),a&&(0,q.jsxs)(`div`,{ref:c,role:`listbox`,"aria-multiselectable":`true`,"data-testid":`spec-label-filter-panel`,className:`absolute z-40 left-0 mt-1 w-56 max-h-72 overflow-y-auto rounded-xl border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/30 p-1`,children:[(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t.size===0,onClick:d,"data-testid":`spec-label-filter-all`,className:X(`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-xs hover:bg-accent-info/10 transition-colors`,t.size===0&&`bg-accent-info/10 text-accent-info`),children:[(0,q.jsx)(`span`,{className:`inline-flex w-4 h-4 items-center justify-center`,children:t.size===0&&(0,q.jsx)(nf,{className:`w-3 h-3 text-accent-info`})}),(0,q.jsx)(`span`,{className:`flex-1`,children:i(`labelFilter.all`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:e.length})]}),l.length===0&&(0,q.jsx)(`div`,{className:`px-2 py-2 text-[11px] text-muted-foreground/60 italic`,children:i(`labelFilter.empty`)}),l.length>0&&(0,q.jsx)(`div`,{className:`my-1 h-px bg-border/40`,"aria-hidden":!0}),l.map(([e,n])=>{let r=t.has(e),i=vb[_b(e)]??`bg-muted/40 text-foreground`;return(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,onClick:()=>u(e),className:X(`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-xs hover:bg-muted/30 transition-colors`,r&&`bg-accent-info/5`),children:[(0,q.jsx)(`span`,{className:`inline-flex w-4 h-4 items-center justify-center`,children:r&&(0,q.jsx)(nf,{className:`w-3 h-3 text-accent-info`})}),(0,q.jsx)(`span`,{className:X(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium`,i),children:e}),(0,q.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground/60`,children:n})]},e)})]})]})}function bb({tickets:e,active:t,onChange:n,className:r}){let{t:i}=G(`specs`),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),c=(0,I.useRef)(null),l=(0,I.useMemo)(()=>{let t=new Map;for(let n of e){if(!n.jira_epic_key)continue;let e=t.get(n.jira_epic_key);e?e.count+=1:t.set(n.jira_epic_key,{key:n.jira_epic_key,name:n.jira_epic_name??n.jira_epic_key,count:1})}return Array.from(t.values()).sort((e,t)=>t.count===e.count?e.name.localeCompare(t.name):t.count-e.count)},[e]);(0,I.useEffect)(()=>{if(!a)return;function e(e){c.current?.contains(e.target)||s.current?.contains(e.target)||o(!1)}function t(e){e.key===`Escape`&&o(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[a]);function u(e){n(e),o(!1)}let d=t?l.find(e=>e.key===t):null,f=d?d.name:i(`epicFilter.all`);return(0,q.jsxs)(`div`,{className:X(`relative shrink-0`,r),children:[(0,q.jsxs)(`button`,{ref:s,type:`button`,"aria-haspopup":`listbox`,"aria-expanded":a,"aria-label":i(`epicFilter.ariaLabel`),"data-testid":`spec-epic-filter-dropdown`,onClick:()=>o(e=>!e),className:`flex items-center gap-1.5 h-7 px-2 rounded-md text-xs bg-accent-highlight/10 border border-accent-highlight/30 hover:bg-accent-highlight/20 text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-highlight/50`,children:[(0,q.jsx)(Gf,{className:`w-3 h-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate max-w-[140px]`,children:f})]}),a&&(0,q.jsxs)(`div`,{ref:c,role:`listbox`,"data-testid":`spec-epic-filter-panel`,className:`absolute z-40 left-0 mt-1 w-64 max-h-72 overflow-y-auto rounded-xl border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/30 p-1`,children:[(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===null,onClick:()=>u(null),"data-testid":`spec-epic-filter-all`,className:X(`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-xs hover:bg-accent-info/10 transition-colors`,t===null&&`bg-accent-info/10 text-accent-info`),children:[(0,q.jsx)(`span`,{className:`inline-flex w-4 h-4 items-center justify-center`,children:t===null&&(0,q.jsx)(nf,{className:`w-3 h-3 text-accent-info`})}),(0,q.jsx)(`span`,{className:`flex-1`,children:i(`epicFilter.all`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:e.length})]}),l.length>0&&(0,q.jsx)(`div`,{className:`my-1 h-px bg-border/40`,"aria-hidden":!0}),l.map(e=>{let n=t===e.key;return(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,onClick:()=>u(e.key),className:X(`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-xs hover:bg-muted/30 transition-colors`,n&&`bg-accent-info/5`),children:[(0,q.jsx)(`span`,{className:`inline-flex w-4 h-4 items-center justify-center`,children:n&&(0,q.jsx)(nf,{className:`w-3 h-3 text-accent-info`})}),(0,q.jsx)(`span`,{className:`font-mono text-[10px] text-accent-highlight shrink-0`,children:e.key}),(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.name}),(0,q.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground/60`,children:e.count})]},e.key)})]})]})}function xb({tickets:e,active:t,onChange:n,className:r}){let{t:i}=G(`specs`),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),c=(0,I.useRef)(null),l=(0,I.useMemo)(()=>{let t=new Map;for(let n of e){if(!n.jira_sprint_id)continue;let e=n.jira_sprint_state===`active`,r=t.get(n.jira_sprint_id);r?(r.count+=1,e&&(r.active=!0)):t.set(n.jira_sprint_id,{id:n.jira_sprint_id,name:n.jira_sprint_name??n.jira_sprint_id,count:1,active:e})}return Array.from(t.values()).sort((e,t)=>e.active===t.active?t.count===e.count?e.name.localeCompare(t.name):t.count-e.count:e.active?-1:1)},[e]);(0,I.useEffect)(()=>{if(!a)return;function e(e){c.current?.contains(e.target)||s.current?.contains(e.target)||o(!1)}function t(e){e.key===`Escape`&&o(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[a]);function u(e){n(e),o(!1)}let d=t?l.find(e=>e.id===t):null,f=d?d.name:i(`sprintFilter.all`);return(0,q.jsxs)(`div`,{className:X(`relative shrink-0`,r),children:[(0,q.jsxs)(`button`,{ref:s,type:`button`,"aria-haspopup":`listbox`,"aria-expanded":a,"aria-label":i(`sprintFilter.ariaLabel`),"data-testid":`spec-sprint-filter-dropdown`,onClick:()=>o(e=>!e),className:`flex items-center gap-1.5 h-7 px-2 rounded-md text-xs bg-accent-success/10 border border-accent-success/30 hover:bg-accent-success/20 text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-success/50`,children:[(0,q.jsx)(Bp,{className:`w-3 h-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate max-w-[140px]`,children:f})]}),a&&(0,q.jsxs)(`div`,{ref:c,role:`listbox`,"data-testid":`spec-sprint-filter-panel`,className:`absolute z-40 left-0 mt-1 w-64 max-h-72 overflow-y-auto rounded-xl border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/30 p-1`,children:[(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===null,onClick:()=>u(null),"data-testid":`spec-sprint-filter-all`,className:X(`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-xs hover:bg-accent-info/10 transition-colors`,t===null&&`bg-accent-info/10 text-accent-info`),children:[(0,q.jsx)(`span`,{className:`inline-flex w-4 h-4 items-center justify-center`,children:t===null&&(0,q.jsx)(nf,{className:`w-3 h-3 text-accent-info`})}),(0,q.jsx)(`span`,{className:`flex-1`,children:i(`sprintFilter.all`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:e.length})]}),l.length>0&&(0,q.jsx)(`div`,{className:`my-1 h-px bg-border/40`,"aria-hidden":!0}),l.map(e=>{let n=t===e.id;return(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,onClick:()=>u(e.id),className:X(`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-xs hover:bg-muted/30 transition-colors`,n&&`bg-accent-info/5`),children:[(0,q.jsx)(`span`,{className:`inline-flex w-4 h-4 items-center justify-center`,children:n&&(0,q.jsx)(nf,{className:`w-3 h-3 text-accent-info`})}),(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.name}),e.active&&(0,q.jsx)(`span`,{"data-testid":`spec-sprint-current-badge`,className:`shrink-0 rounded-full bg-accent-success/15 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-accent-success`,children:i(`sprintFilter.current`)}),(0,q.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground/60`,children:e.count})]},e.id)})]})]})}function Sb(e,[t,n]){return Math.min(n,Math.max(t,e))}function Cb(e){let t=wb(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e,a=I.Children.toArray(r),o=a.find(Eb);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,q.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,q.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function wb(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(I.isValidElement(n)){let e=Ob(n),i=Db(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Xp(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Tb=Symbol(`radix.slottable`);function Eb(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Tb}function Db(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 Ob(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 kb(e){let t=e+`CollectionProvider`,[n,r]=kg(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=I.useRef(null),a=I.useRef(new Map).current;return(0,q.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Cb(s),l=I.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,q.jsx)(c,{ref:Zp(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Cb(u),p=I.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=I.useRef(null),s=Zp(t,o),c=a(u,n);return I.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,q.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return I.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));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:p},m,r]}var Ab=I.createContext(void 0);function jb(e){let t=I.useContext(Ab);return e||t||`ltr`}var Mb=[`top`,`right`,`bottom`,`left`],Nb=Math.min,Pb=Math.max,Fb=Math.round,Ib=Math.floor,Lb=e=>({x:e,y:e}),Rb={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function zb(e,t,n){return Pb(e,Nb(t,n))}function Bb(e,t){return typeof e==`function`?e(t):e}function Vb(e){return e.split(`-`)[0]}function Hb(e){return e.split(`-`)[1]}function Ub(e){return e===`x`?`y`:`x`}function Wb(e){return e===`y`?`height`:`width`}function Gb(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Kb(e){return Ub(Gb(e))}function qb(e,t,n){n===void 0&&(n=!1);let r=Hb(e),i=Kb(e),a=Wb(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=nx(o)),[o,nx(o)]}function Jb(e){let t=nx(e);return[Yb(e),t,Yb(t)]}function Yb(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Xb=[`left`,`right`],Zb=[`right`,`left`],Qb=[`top`,`bottom`],$b=[`bottom`,`top`];function ex(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Zb:Xb:t?Xb:Zb;case`left`:case`right`:return t?Qb:$b;default:return[]}}function tx(e,t,n,r){let i=Hb(e),a=ex(Vb(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Yb)))),a}function nx(e){let t=Vb(e);return Rb[t]+e.slice(t.length)}function rx(e){return{top:0,right:0,bottom:0,left:0,...e}}function ix(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:rx(e)}function ax(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 ox(e,t,n){let{reference:r,floating:i}=e,a=Gb(t),o=Kb(t),s=Wb(o),c=Vb(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(Hb(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function sx(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}=Bb(t,e),p=ix(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ax(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=ax(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 cx=50,lx=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:sx},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ox(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<cx&&(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}=ox(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ux=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}=Bb(e,t)||{};if(l==null)return{};let d=ix(u),f={x:n,y:r},p=Kb(i),m=Wb(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=Nb(d[_],T),D=Nb(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=zb(O,A,k),M=!c.arrow&&Hb(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}}}),dx=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}=Bb(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Vb(r),_=Gb(o),v=Vb(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[nx(o)]:Jb(o)),x=p!==`none`;!d&&x&&b.push(...tx(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=qb(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`&&_!==Gb(t))||T.every(e=>Gb(e.placement)===_?e.overflows[0]>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=Gb(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;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function fx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function px(e){return Mb.some(t=>e[t]>=0)}var mx=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Bb(e,t);switch(i){case`referenceHidden`:{let e=fx(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:px(e)}}}case`escaped`:{let e=fx(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:px(e)}}}default:return{}}}}},hx=new Set([`left`,`top`]);async function gx(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Vb(n),s=Hb(n),c=Gb(n)===`y`,l=hx.has(o)?-1:1,u=a&&c?-1:1,d=Bb(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 _x=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 gx(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}}}}},vx=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}=Bb(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Gb(Vb(i)),p=Ub(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=zb(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=zb(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}}}}}},yx=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}=Bb(e,t),u={x:n,y:r},d=Gb(i),f=Ub(d),p=u[f],m=u[d],h=Bb(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=hx.has(Vb(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}}}},bx=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}=Bb(e,t),u=await o.detectOverflow(t,l),d=Vb(i),f=Hb(i),p=Gb(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=Nb(h-u[g],v),x=Nb(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=Pb(u.left,0),t=Pb(u.right,0),n=Pb(u.top,0),r=Pb(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Pb(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Pb(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 xx(){return typeof window<`u`}function Sx(e){return Tx(e)?(e.nodeName||``).toLowerCase():`#document`}function Cx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wx(e){return((Tx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Tx(e){return xx()?e instanceof Node||e instanceof Cx(e).Node:!1}function Ex(e){return xx()?e instanceof Element||e instanceof Cx(e).Element:!1}function Dx(e){return xx()?e instanceof HTMLElement||e instanceof Cx(e).HTMLElement:!1}function Ox(e){return!xx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Cx(e).ShadowRoot}function kx(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Bx(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ax(e){return/^(table|td|th)$/.test(Sx(e))}function jx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Mx=/transform|translate|scale|rotate|perspective|filter/,Nx=/paint|layout|strict|content/,Px=e=>!!e&&e!==`none`,Fx;function Ix(e){let t=Ex(e)?Bx(e):e;return Px(t.transform)||Px(t.translate)||Px(t.scale)||Px(t.rotate)||Px(t.perspective)||!Rx()&&(Px(t.backdropFilter)||Px(t.filter))||Mx.test(t.willChange||``)||Nx.test(t.contain||``)}function Lx(e){let t=Hx(e);for(;Dx(t)&&!zx(t);){if(Ix(t))return t;if(jx(t))return null;t=Hx(t)}return null}function Rx(){return Fx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Fx}function zx(e){return/^(html|body|#document)$/.test(Sx(e))}function Bx(e){return Cx(e).getComputedStyle(e)}function Vx(e){return Ex(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hx(e){if(Sx(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ox(e)&&e.host||wx(e);return Ox(t)?t.host:t}function Ux(e){let t=Hx(e);return zx(t)?e.ownerDocument?e.ownerDocument.body:e.body:Dx(t)&&kx(t)?t:Ux(t)}function Wx(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ux(e),i=r===e.ownerDocument?.body,a=Cx(r);if(i){let e=Gx(a);return t.concat(a,a.visualViewport||[],kx(r)?r:[],e&&n?Wx(e):[])}else return t.concat(r,Wx(r,[],n))}function Gx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Kx(e){let t=Bx(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Dx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Fb(n)!==a||Fb(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qx(e){return Ex(e)?e:e.contextElement}function Jx(e){let t=qx(e);if(!Dx(t))return Lb(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Kx(t),o=(a?Fb(n.width):n.width)/r,s=(a?Fb(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Yx=Lb(0);function Xx(e){let t=Cx(e);return!Rx()||!t.visualViewport?Yx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zx(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Cx(e)?!1:t}function Qx(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qx(e),o=Lb(1);t&&(r?Ex(r)&&(o=Jx(r)):o=Jx(e));let s=Zx(a,n,r)?Xx(a):Lb(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=Cx(a),t=r&&Ex(r)?Cx(r):r,n=e,i=Gx(n);for(;i&&r&&t!==n;){let e=Jx(i),t=i.getBoundingClientRect(),r=Bx(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=Cx(i),i=Gx(n)}}return ax({width:u,height:d,x:c,y:l})}function $x(e,t){let n=Vx(e).scrollLeft;return t?t.left+n:Qx(wx(e)).left+n}function eS(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$x(e,n),y:n.top+t.scrollTop}}function tS(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=wx(r),s=t?jx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Lb(1),u=Lb(0),d=Dx(r);if((d||!d&&!a)&&((Sx(r)!==`body`||kx(o))&&(c=Vx(r)),d)){let e=Qx(r);l=Jx(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?eS(o,c):Lb(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 nS(e){return Array.from(e.getClientRects())}function rS(e){let t=wx(e),n=Vx(e),r=e.ownerDocument.body,i=Pb(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Pb(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+$x(e),s=-n.scrollTop;return Bx(r).direction===`rtl`&&(o+=Pb(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var iS=25;function aS(e,t){let n=Cx(e),r=wx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Rx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=$x(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<=iS&&(a-=o)}else l<=iS&&(a+=l);return{width:a,height:o,x:s,y:c}}function oS(e,t){let n=Qx(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Dx(e)?Jx(e):Lb(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function sS(e,t,n){let r;if(t===`viewport`)r=aS(e,n);else if(t===`document`)r=rS(wx(e));else if(Ex(t))r=oS(t,n);else{let n=Xx(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ax(r)}function cS(e,t){let n=Hx(e);return n===t||!Ex(n)||zx(n)?!1:Bx(n).position===`fixed`||cS(n,t)}function lS(e,t){let n=t.get(e);if(n)return n;let r=Wx(e,[],!1).filter(e=>Ex(e)&&Sx(e)!==`body`),i=null,a=Bx(e).position===`fixed`,o=a?Hx(e):e;for(;Ex(o)&&!zx(o);){let t=Bx(o),n=Ix(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||kx(o)&&!n&&cS(e,o))?r=r.filter(e=>e!==o):i=t,o=Hx(o)}return t.set(e,r),r}function uS(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?jx(t)?[]:lS(t,this._c):[].concat(n),r],o=sS(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=sS(t,a[e],i);s=Pb(n.top,s),c=Nb(n.right,c),l=Nb(n.bottom,l),u=Pb(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dS(e){let{width:t,height:n}=Kx(e);return{width:t,height:n}}function fS(e,t,n){let r=Dx(t),i=wx(t),a=n===`fixed`,o=Qx(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Lb(0);function l(){c.x=$x(i)}if(r||!r&&!a)if((Sx(t)!==`body`||kx(i))&&(s=Vx(t)),r){let e=Qx(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?eS(i,s):Lb(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 pS(e){return Bx(e).position===`static`}function mS(e,t){if(!Dx(e)||Bx(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return wx(e)===n&&(n=n.ownerDocument.body),n}function hS(e,t){let n=Cx(e);if(jx(e))return n;if(!Dx(e)){let t=Hx(e);for(;t&&!zx(t);){if(Ex(t)&&!pS(t))return t;t=Hx(t)}return n}let r=mS(e,t);for(;r&&Ax(r)&&pS(r);)r=mS(r,t);return r&&zx(r)&&pS(r)&&!Ix(r)?n:r||Lx(e)||n}var gS=async function(e){let t=this.getOffsetParent||hS,n=this.getDimensions,r=await n(e.floating);return{reference:fS(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _S(e){return Bx(e).direction===`rtl`}var vS={convertOffsetParentRelativeRectToViewportRelativeRect:tS,getDocumentElement:wx,getClippingRect:uS,getOffsetParent:hS,getElementRects:gS,getClientRects:nS,getDimensions:dS,getScale:Jx,isElement:Ex,isRTL:_S};function yS(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bS(e,t){let n=null,r,i=wx(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=Ib(d),h=Ib(i.clientWidth-(u+f)),g=Ib(i.clientHeight-(d+p)),_=Ib(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Pb(0,Nb(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&&!yS(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 xS(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=qx(e),u=i||a?[...l?Wx(l):[],...t?Wx(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?bS(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?Qx(e):null;c&&g();function g(){let t=Qx(e);h&&!yS(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 SS=_x,CS=vx,wS=dx,TS=bx,ES=mx,DS=ux,OS=yx,kS=(e,t,n)=>{let r=new Map,i={platform:vS,...n},a={...i.platform,_c:r};return lx(e,t,{...i,platform:a})},AS=typeof document<`u`?I.useLayoutEffect:function(){};function jS(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(!jS(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)&&!jS(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function MS(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function NS(e,t){let n=MS(e);return Math.round(t*n)/n}function PS(e){let t=I.useRef(e);return AS(()=>{t.current=e}),t}function FS(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,[u,d]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=I.useState(r);jS(f,r)||p(r);let[m,h]=I.useState(null),[g,_]=I.useState(null),v=I.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=I.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=I.useRef(null),C=I.useRef(null),w=I.useRef(u),T=c!=null,E=PS(c),D=PS(i),O=PS(l),k=I.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),kS(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!jS(w.current,t)&&(w.current=t,Qn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);AS(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=I.useRef(!1);AS(()=>(A.current=!0,()=>{A.current=!1}),[]),AS(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=I.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=I.useMemo(()=>({reference:b,floating:x}),[b,x]),N=I.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=NS(M.floating,u.x),r=NS(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...MS(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return I.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var IS=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?{}:DS({element:r.current,padding:i}).fn(n):r?DS({element:r,padding:i}).fn(n):{}}}},LS=(e,t)=>{let n=SS(e);return{name:n.name,fn:n.fn,options:[e,t]}},RS=(e,t)=>{let n=CS(e);return{name:n.name,fn:n.fn,options:[e,t]}},zS=(e,t)=>({fn:OS(e).fn,options:[e,t]}),BS=(e,t)=>{let n=wS(e);return{name:n.name,fn:n.fn,options:[e,t]}},VS=(e,t)=>{let n=TS(e);return{name:n.name,fn:n.fn,options:[e,t]}},HS=(e,t)=>{let n=ES(e);return{name:n.name,fn:n.fn,options:[e,t]}},US=(e,t)=>{let n=IS(e);return{name:n.name,fn:n.fn,options:[e,t]}},WS=`Arrow`,GS=I.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,q.jsx)(Gg.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});GS.displayName=WS;var KS=GS;function qS(e){let[t,n]=I.useState(void 0);return jg(()=>{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)}else n(void 0)},[e]),t}var JS=`Popper`,[YS,XS]=kg(JS),[ZS,QS]=YS(JS),$S=e=>{let{__scopePopper:t,children:n}=e,[r,i]=I.useState(null);return(0,q.jsx)(ZS,{scope:t,anchor:r,onAnchorChange:i,children:n})};$S.displayName=JS;var eC=`PopperAnchor`,tC=I.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=QS(eC,n),o=I.useRef(null),s=Zp(t,o),c=I.useRef(null);return I.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,q.jsx)(Gg.div,{...i,ref:s})});tC.displayName=eC;var nC=`PopperContent`,[rC,iC]=YS(nC),aC=I.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:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=QS(nC,n),[_,v]=I.useState(null),y=Zp(t,e=>v(e)),[b,x]=I.useState(null),S=qS(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(lC),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=FS({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>xS(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[LS({mainAxis:i+w,alignmentAxis:o}),c&&RS({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?zS():void 0,...k}),c&&BS({...k}),VS({...k,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`)}}),b&&US({element:b,padding:s}),uC({arrowWidth:C,arrowHeight:w}),f&&HS({strategy:`referenceHidden`,...k})]}),[F,L]=dC(M),ee=qg(m);jg(()=>{N&&ee?.()},[N,ee]);let te=P.arrow?.x,R=P.arrow?.y,z=P.arrow?.centerOffset!==0,[B,V]=I.useState();return jg(()=>{_&&V(window.getComputedStyle(_).zIndex)},[_]),(0,q.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:B,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,q.jsx)(rC,{scope:n,placedSide:F,onArrowChange:x,arrowX:te,arrowY:R,shouldHideArrow:z,children:(0,q.jsx)(Gg.div,{"data-side":F,"data-align":L,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});aC.displayName=nC;var oC=`PopperArrow`,sC={top:`bottom`,right:`left`,bottom:`top`,left:`right`},cC=I.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=iC(oC,n),a=sC[i.placedSide];return(0,q.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,q.jsx)(KS,{...r,ref:t,style:{...r.style,display:`block`}})})});cC.displayName=oC;function lC(e){return e!==null}var uC=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]=dC(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 dC(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var fC=$S,pC=tC,mC=aC,hC=cC;function gC(e){let t=_C(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e,a=I.Children.toArray(r),o=a.find(yC);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,q.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,q.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function _C(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(I.isValidElement(n)){let e=xC(n),i=bC(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Xp(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vC=Symbol(`radix.slottable`);function yC(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===vC}function bC(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 xC(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 SC(e){let t=I.useRef({value:e,previous:e});return I.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var CC=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`}),wC=`VisuallyHidden`,TC=I.forwardRef((e,t)=>(0,q.jsx)(Gg.span,{...e,ref:t,style:{...CC,...e.style}}));TC.displayName=wC;var EC=TC,DC=[` `,`Enter`,`ArrowUp`,`ArrowDown`],OC=[` `,`Enter`],kC=`Select`,[AC,jC,MC]=kb(kC),[NC,PC]=kg(kC,[MC,XS]),FC=XS(),[IC,LC]=NC(kC),[RC,zC]=NC(kC),BC=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=FC(t),[g,_]=I.useState(null),[v,y]=I.useState(null),[b,x]=I.useState(!1),S=jb(l),[C,w]=Ig({prop:r,defaultProp:i??!1,onChange:a,caller:kC}),[T,E]=Ig({prop:o,defaultProp:s,onChange:c,caller:kC}),D=I.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,A]=I.useState(new Set),j=Array.from(k).map(e=>e.props.value).join(`;`);return(0,q.jsx)(fC,{...h,children:(0,q.jsxs)(IC,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:Pg(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,q.jsx)(AC.Provider,{scope:t,children:(0,q.jsx)(RC,{scope:e.__scopeSelect,onNativeOptionAdd:I.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:I.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,q.jsxs)(Fw,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,q.jsx)(`option`,{value:``}):null,Array.from(k)]},j):null]})})};BC.displayName=kC;var VC=`SelectTrigger`,HC=I.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=FC(n),o=LC(VC,n),s=o.disabled||r,c=Zp(t,o.onTriggerChange),l=jC(n),u=I.useRef(`touch`),[d,f,p]=Lw(e=>{let t=l().filter(e=>!e.disabled),n=Rw(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,q.jsx)(pC,{asChild:!0,...a,children:(0,q.jsx)(Gg.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"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":Iw(o.value)?``:void 0,...i,ref:c,onClick:Dg(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:Dg(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:Dg(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&DC.includes(e.key)&&(m(),e.preventDefault())})})})});HC.displayName=VC;var UC=`SelectValue`,WC=I.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=LC(UC,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Zp(t,c.onValueNodeChange);return jg(()=>{l(u)},[l,u]),(0,q.jsx)(Gg.span,{...s,ref:d,style:{pointerEvents:`none`},children:Iw(c.value)?(0,q.jsx)(q.Fragment,{children:o}):a})});WC.displayName=UC;var GC=`SelectIcon`,KC=I.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,q.jsx)(Gg.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});KC.displayName=GC;var qC=`SelectPortal`,JC=e=>(0,q.jsx)(T_,{asChild:!0,...e});JC.displayName=qC;var YC=`SelectContent`,XC=I.forwardRef((e,t)=>{let n=LC(YC,e.__scopeSelect),[r,i]=I.useState();if(jg(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Qn.createPortal((0,q.jsx)(QC,{scope:e.__scopeSelect,children:(0,q.jsx)(AC.Slot,{scope:e.__scopeSelect,children:(0,q.jsx)(`div`,{children:e.children})})}),t):null}return(0,q.jsx)(nw,{...e,ref:t})});XC.displayName=YC;var ZC=10,[QC,$C]=NC(YC),ew=`SelectContentImpl`,tw=gC(`SelectContent.RemoveScroll`),nw=I.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=LC(YC,n),[y,b]=I.useState(null),[x,S]=I.useState(null),C=Zp(t,e=>b(e)),[w,T]=I.useState(null),[E,D]=I.useState(null),O=jC(n),[k,A]=I.useState(!1),j=I.useRef(!1);I.useEffect(()=>{if(y)return Zv(y)},[y]),M_();let M=I.useCallback(e=>{let[t,...n]=O().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&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=I.useCallback(()=>M([w,y]),[M,w,y]);I.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;I.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),I.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[L,ee]=Lw(e=>{let t=O().filter(e=>!e.disabled),n=Rw(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),te=I.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),R=I.useCallback(()=>y?.focus(),[y]),z=I.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),B=r===`popper`?ow:iw,V=B===ow?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,q.jsx)(QC,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:te,selectedItem:w,onItemLeave:R,itemTextRefCallback:z,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:L,children:(0,q.jsx)(Hv,{as:tw,allowPinchZoom:!0,children:(0,q.jsx)(f_,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Dg(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,q.jsx)(t_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,q.jsx)(B,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...V,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:Dg(_.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=O().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(()=>M(t)),e.preventDefault()}})})})})})})});nw.displayName=ew;var rw=`SelectItemAlignedPosition`,iw=I.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=LC(YC,n),o=$C(YC,n),[s,c]=I.useState(null),[l,u]=I.useState(null),d=Zp(t,e=>u(e)),f=jC(n),p=I.useRef(!1),m=I.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=I.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.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-ZC,d=Sb(a,[ZC,Math.max(ZC,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-ZC,d=Sb(a,[ZC,Math.max(ZC,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-ZC*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-ZC,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${ZC}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);jg(()=>y(),[y]);let[b,x]=I.useState();return jg(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,q.jsx)(sw,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:I.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,q.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,q.jsx)(Gg.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});iw.displayName=rw;var aw=`SelectPopperPosition`,ow=I.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=ZC,...a}=e,o=FC(n);return(0,q.jsx)(mC,{...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)`}})});ow.displayName=aw;var[sw,cw]=NC(YC,{}),lw=`SelectViewport`,uw=I.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=$C(lw,n),o=cw(lw,n),s=Zp(t,a.onViewportChange),c=I.useRef(0);return(0,q.jsxs)(q.Fragment,{children:[(0,q.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,q.jsx)(AC.Slot,{scope:n,children:(0,q.jsx)(Gg.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:Dg(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-ZC*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})})})]})});uw.displayName=lw;var dw=`SelectGroup`,[fw,pw]=NC(dw),mw=I.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pg();return(0,q.jsx)(fw,{scope:n,id:i,children:(0,q.jsx)(Gg.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});mw.displayName=dw;var hw=`SelectLabel`,gw=I.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=pw(hw,n);return(0,q.jsx)(Gg.div,{id:i.id,...r,ref:t})});gw.displayName=hw;var _w=`SelectItem`,[vw,yw]=NC(_w),bw=I.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=LC(_w,n),c=$C(_w,n),l=s.value===r,[u,d]=I.useState(a??``),[f,p]=I.useState(!1),m=Zp(t,e=>c.itemRefCallback?.(e,r,i)),h=Pg(),g=I.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,q.jsx)(vw,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:I.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,q.jsx)(AC.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,q.jsx)(Gg.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:Dg(o.onFocus,()=>p(!0)),onBlur:Dg(o.onBlur,()=>p(!1)),onClick:Dg(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:Dg(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:Dg(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:Dg(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Dg(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Dg(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(OC.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});bw.displayName=_w;var xw=`SelectItemText`,Sw=I.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=LC(xw,n),s=$C(xw,n),c=yw(xw,n),l=zC(xw,n),[u,d]=I.useState(null),f=Zp(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=I.useMemo(()=>(0,q.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return jg(()=>(h(m),()=>g(m)),[h,g,m]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Gg.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Qn.createPortal(a.children,o.valueNode):null]})});Sw.displayName=xw;var Cw=`SelectItemIndicator`,ww=I.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return yw(Cw,n).isSelected?(0,q.jsx)(Gg.span,{"aria-hidden":!0,...r,ref:t}):null});ww.displayName=Cw;var Tw=`SelectScrollUpButton`,Ew=I.forwardRef((e,t)=>{let n=$C(Tw,e.__scopeSelect),r=cw(Tw,e.__scopeSelect),[i,a]=I.useState(!1),o=Zp(t,r.onScrollButtonChange);return jg(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,q.jsx)(kw,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ew.displayName=Tw;var Dw=`SelectScrollDownButton`,Ow=I.forwardRef((e,t)=>{let n=$C(Dw,e.__scopeSelect),r=cw(Dw,e.__scopeSelect),[i,a]=I.useState(!1),o=Zp(t,r.onScrollButtonChange);return jg(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,q.jsx)(kw,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ow.displayName=Dw;var kw=I.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=$C(`SelectScrollButton`,n),o=I.useRef(null),s=jC(n),c=I.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return I.useEffect(()=>()=>c(),[c]),jg(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,q.jsx)(Gg.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Dg(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Dg(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Dg(i.onPointerLeave,()=>{c()})})}),Aw=`SelectSeparator`,jw=I.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,q.jsx)(Gg.div,{"aria-hidden":!0,...r,ref:t})});jw.displayName=Aw;var Mw=`SelectArrow`,Nw=I.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=FC(n),a=LC(Mw,n),o=$C(Mw,n);return a.open&&o.position===`popper`?(0,q.jsx)(hC,{...i,...r,ref:t}):null});Nw.displayName=Mw;var Pw=`SelectBubbleInput`,Fw=I.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=I.useRef(null),a=Zp(r,i),o=SC(t);return I.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,q.jsx)(Gg.select,{...n,style:{...CC,...n.style},ref:a,defaultValue:t})});Fw.displayName=Pw;function Iw(e){return e===``||e===void 0}function Lw(e){let t=qg(e),n=I.useRef(``),r=I.useRef(0),i=I.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=I.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return I.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Rw(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=zw(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 zw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Bw=BC,Vw=HC,Hw=WC,Uw=KC,Ww=JC,Gw=XC,Kw=uw,qw=gw,Jw=bw,Yw=Sw,Xw=ww,Zw=Ew,Qw=Ow,$w=jw,eT=Bw,tT=Hw,nT=I.forwardRef(({className:e,children:t,...n},r)=>(0,q.jsxs)(Vw,{ref:r,className:X(`flex h-8 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-1 text-xs ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,q.jsx)(Uw,{asChild:!0,children:(0,q.jsx)(rf,{className:`h-3 w-3 opacity-50`})})]}));nT.displayName=Vw.displayName;var rT=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(Zw,{ref:n,className:X(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,q.jsx)(sf,{className:`h-3 w-3`})}));rT.displayName=Zw.displayName;var iT=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(Qw,{ref:n,className:X(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,q.jsx)(rf,{className:`h-3 w-3`})}));iT.displayName=Qw.displayName;var aT=I.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,q.jsx)(Ww,{children:(0,q.jsxs)(Gw,{ref:i,className:X(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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`&&`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),position:n,...r,children:[(0,q.jsx)(rT,{}),(0,q.jsx)(Kw,{className:X(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,q.jsx)(iT,{})]})}));aT.displayName=Gw.displayName;var oT=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(qw,{ref:n,className:X(`py-1.5 pl-8 pr-2 text-xs font-semibold`,e),...t}));oT.displayName=qw.displayName;var sT=I.forwardRef(({className:e,children:t,...n},r)=>(0,q.jsxs)(Jw,{ref:r,className:X(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-xs outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,q.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,q.jsx)(Xw,{children:(0,q.jsx)(nf,{className:`h-3 w-3`})})}),(0,q.jsx)(Yw,{children:t})]}));sT.displayName=Jw.displayName;var cT=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)($w,{ref:n,className:X(`-mx-1 my-1 h-px bg-muted`,e),...t}));cT.displayName=$w.displayName;var lT=Symbol(`radix.slottable`);function uT(e){let t=({children:e})=>(0,q.jsx)(q.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=lT,t}var[dT,fT]=kg(`Tooltip`,[XS]),pT=XS(),mT=`TooltipProvider`,hT=700,gT=`tooltip.open`,[_T,vT]=dT(mT),yT=e=>{let{__scopeTooltip:t,delayDuration:n=hT,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=I.useRef(!0),s=I.useRef(!1),c=I.useRef(0);return I.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,q.jsx)(_T,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:I.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};yT.displayName=mT;var bT=`Tooltip`,[xT,ST]=dT(bT),CT=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=vT(bT,e.__scopeTooltip),l=pT(t),[u,d]=I.useState(null),f=Pg(),p=I.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=I.useRef(!1),[_,v]=Ig({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(gT))):c.onClose(),a?.(e)},caller:bT}),y=I.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=I.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=I.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=I.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return I.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,q.jsx)(fC,{...l,children:(0,q.jsx)(xT,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:I.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:I.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};CT.displayName=bT;var wT=`TooltipTrigger`,TT=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ST(wT,n),a=vT(wT,n),o=pT(n),s=Zp(t,I.useRef(null),i.onTriggerChange),c=I.useRef(!1),l=I.useRef(!1),u=I.useCallback(()=>c.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,q.jsx)(pC,{asChild:!0,...o,children:(0,q.jsx)(Gg.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Dg(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Dg(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Dg(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Dg(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Dg(e.onBlur,i.onClose),onClick:Dg(e.onClick,i.onClose)})})});TT.displayName=wT;var ET=`TooltipPortal`,[DT,OT]=dT(ET,{forceMount:void 0}),kT=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=ST(ET,t);return(0,q.jsx)(DT,{scope:t,forceMount:n,children:(0,q.jsx)(D_,{present:n||a.open,children:(0,q.jsx)(T_,{asChild:!0,container:i,children:r})})})};kT.displayName=ET;var AT=`TooltipContent`,jT=I.forwardRef((e,t)=>{let n=OT(AT,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ST(AT,e.__scopeTooltip);return(0,q.jsx)(D_,{present:r||o.open,children:o.disableHoverableContent?(0,q.jsx)(IT,{side:i,...a,ref:t}):(0,q.jsx)(MT,{side:i,...a,ref:t})})}),MT=I.forwardRef((e,t)=>{let n=ST(AT,e.__scopeTooltip),r=vT(AT,e.__scopeTooltip),i=I.useRef(null),a=Zp(t,i),[o,s]=I.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=I.useCallback(()=>{s(null),d(!1)},[d]),p=I.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=BT(r,zT(r,n.getBoundingClientRect())),a=VT(t.getBoundingClientRect());s(UT([...i,...a])),d(!0)},[d]);return I.useEffect(()=>()=>f(),[f]),I.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),I.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!HT(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,q.jsx)(IT,{...e,ref:a})}),[NT,PT]=dT(bT,{isInside:!1}),FT=uT(`TooltipContent`),IT=I.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ST(AT,n),l=pT(n),{onClose:u}=c;return I.useEffect(()=>(document.addEventListener(gT,u),()=>document.removeEventListener(gT,u)),[u]),I.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,q.jsx)(t_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,q.jsxs)(mC,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,q.jsx)(FT,{children:r}),(0,q.jsx)(NT,{scope:n,isInside:!0,children:(0,q.jsx)(EC,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});jT.displayName=AT;var LT=`TooltipArrow`,RT=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=pT(n);return PT(LT,n).isInside?null:(0,q.jsx)(hC,{...i,...r,ref:t})});RT.displayName=LT;function zT(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function BT(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function VT(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function HT(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 UT(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),WT(t)}function WT(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var GT=yT,KT=CT,qT=TT,JT=jT,YT=GT,XT=KT,ZT=qT,QT=I.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,q.jsx)(JT,{ref:r,sideOffset:t,className:X(`z-50 overflow-hidden rounded-md border border-border bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-md animate-in fade-in-0 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),...n}));QT.displayName=JT.displayName;var $T={default:`sortControl.modes.default`,"ticket-id":`sortControl.modes.ticketId`,priority:`sortControl.modes.priority`};function eE({mode:e,dir:t,onChange:n,className:r}){let{t:i}=G(`specs`),a=e!==`default`;return(0,q.jsx)(YT,{delayDuration:300,children:(0,q.jsxs)(`div`,{className:X(`flex items-center gap-1 shrink-0`,r),children:[(0,q.jsxs)(XT,{children:[(0,q.jsx)(ZT,{asChild:!0,children:(0,q.jsx)(`div`,{children:(0,q.jsxs)(eT,{value:e,onValueChange:e=>n(e,t),children:[(0,q.jsxs)(nT,{"aria-label":i(`sortControl.modeAriaLabel`),className:`h-7 w-auto gap-1.5 px-2 text-xs bg-accent-secondary/10 border-accent-secondary/30 hover:bg-accent-secondary/20`,children:[(0,q.jsx)(Hd,{className:`w-3 h-3 text-muted-foreground`}),(0,q.jsx)(tT,{children:i($T[e])})]}),(0,q.jsxs)(aT,{children:[(0,q.jsx)(sT,{value:`default`,children:i(`sortControl.modes.default`)}),(0,q.jsx)(sT,{value:`ticket-id`,children:i(`sortControl.modes.ticketId`)}),(0,q.jsx)(sT,{value:`priority`,children:i(`sortControl.modes.priority`)})]})]})})}),(0,q.jsx)(QT,{children:i(`sortControl.tooltip`,{mode:i($T[e])})})]}),a&&(0,q.jsxs)(XT,{children:[(0,q.jsx)(ZT,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,"aria-label":i(`sortControl.toggleDirAriaLabel`),onClick:()=>n(e,t===`asc`?`desc`:`asc`),className:`inline-flex items-center justify-center h-7 w-7 rounded-md border border-accent-secondary/30 bg-accent-secondary/10 hover:bg-accent-secondary/20 text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,children:t===`asc`?(0,q.jsx)(qd,{className:`w-3 h-3`}):(0,q.jsx)(Ud,{className:`w-3 h-3`})})}),(0,q.jsx)(QT,{children:i(t===`asc`?`sortControl.ascending`:`sortControl.descending`)})]})]})})}var tE=[{value:`row`,Icon:Jf,labelKey:`viewTier.listView`},{value:`postit`,Icon:Fp,labelKey:`viewTier.postitView`}];function nE({tier:e,onChange:t,className:n}){let{t:r}=G(`specs`);return(0,q.jsx)(YT,{delayDuration:300,children:(0,q.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`viewTier.ariaLabel`),className:X(`inline-flex items-center rounded-md border border-accent-secondary/30 bg-accent-secondary/10 p-0.5 shrink-0`,n),children:tE.map(({value:n,Icon:i,labelKey:a})=>{let o=e===n;return(0,q.jsxs)(XT,{children:[(0,q.jsx)(ZT,{asChild:!0,children:(0,q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":o,"aria-label":r(a),onClick:()=>t(n),className:X(`inline-flex items-center justify-center h-6 w-6 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1`,o?`bg-accent-secondary/40 text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent-secondary/20`),"data-testid":`specs-view-tier-${n}`,children:(0,q.jsx)(i,{className:`w-3.5 h-3.5`})})}),(0,q.jsx)(QT,{children:r(a)})]},n)})})})}var rE=`default`,iE=`desc`,aE=e=>`specrails-desktop:spec-sort-mode:${e}`,oE=e=>`specrails-desktop:spec-sort-dir:${e}`;function sE(e){return e===`default`||e===`ticket-id`||e===`priority`}function cE(e){return e===`asc`||e===`desc`}function lE(e){if(!e)return{mode:rE,dir:iE};let t=rE,n=iE;try{let n=localStorage.getItem(aE(e));sE(n)&&(t=n)}catch{}try{let t=localStorage.getItem(oE(e));cE(t)&&(n=t)}catch{}return{mode:t,dir:n}}function uE(e,t,n){if(e)try{localStorage.setItem(aE(e),t),localStorage.setItem(oE(e),n)}catch{}}var dE={critical:4,high:3,medium:2,low:1,null:0};function fE(e){return e===null?dE.null:dE[e]}function pE(e,t,n){return n===`asc`?e.id-t.id:t.id-e.id}function mE(e,t,n){let r=fE(e.priority),i=fE(t.priority),a=n===`asc`?r-i:i-r;return a===0?e.id-t.id:a}function hE(e,t,n){return t===`ticket-id`?[...e].sort((e,t)=>pE(e,t,n)):t===`priority`?[...e].sort((e,t)=>mE(e,t,n)):e}function gE(e){let t=Math.floor(e/1e3),n=Math.floor(t/60);return n>0?`${n}:${(t%60).toString().padStart(2,`0`)}`:`${t}s`}var _E=`specrails-desktop:pending-specs`;function vE(){try{return JSON.parse(localStorage.getItem(_E)??`[]`)}catch{return[]}}function yE(e){try{let t=vE().filter(t=>t.id!==e.id);t.push(e),localStorage.setItem(_E,JSON.stringify(t))}catch{}}function bE(e){try{let t=vE().filter(t=>t.id!==e);localStorage.setItem(_E,JSON.stringify(t))}catch{}}var xE=(0,I.createContext)(null),SE=40,CE=3e3;function wE({children:e}){let{registerHandler:t,unregisterHandler:n}=xl(),{setActiveProjectId:r}=Sd(),i=ct(),[a,o]=(0,I.useState)(null),s=(0,I.useRef)(new Map),c=(0,I.useRef)(new Map),l=(0,I.useRef)(null),{activeProjectId:u}=Sd();(0,I.useEffect)(()=>{l.current=u},[u]);let d=(0,I.useCallback)(e=>{e.timerId=setInterval(()=>{K.loading(`${e.projectName} · ${e.truncated}`,{id:e.toastId,description:J.t(`activity:specGen.generating`,{elapsed:gE(Date.now()-e.startTime)})})},1e3)},[]),f=(0,I.useCallback)(e=>{clearInterval(e.timerId),bE(e.persistId),Ed(e.projectId)},[]),p=(0,I.useCallback)((e,t)=>{e.projectId===l.current?(o({ticket:t,projectId:e.projectId}),window.location.pathname!==`/`&&i(`/`)):(Ca(e.projectId,`/`),o({ticket:t,projectId:e.projectId}),r(e.projectId))},[r,i]),m=(0,I.useCallback)((e,t)=>{f(e);let n=gE(Date.now()-e.startTime);K.success(`${e.projectName} · ${t.title||J.t(`activity:specGen.specCreated`)}`,{id:e.toastId,duration:1e4,description:J.t(`activity:specGen.generatedIn`,{elapsed:n}),action:{label:J.t(`activity:specGen.view`),onClick:()=>p(e,t)}})},[f,p]),h=(0,I.useCallback)((e,t)=>{f(e),K.error(`${e.projectName} · ${t??J.t(`activity:specGen.errorGenerating`)}`,{id:e.toastId})},[f]),g=(0,I.useCallback)((e,t)=>{let n=0;async function r(){try{let n=await fetch(`${sl}/api/projects/${e.projectId}/tickets`);if(!n.ok)throw Error(`fetch failed`);let r=await n.json(),i=(Array.isArray(r)?r:r.tickets??[]).find(t=>!e.knownTicketIds.has(t.id));if(i){t&&c.current.delete(t),m(e,i);return}}catch{}n++,n<5?setTimeout(r,1e3):(t&&c.current.delete(t),h(e,J.t(`activity:specGen.couldNotFind`)))}r()},[m,h]),_=(0,I.useCallback)(e=>{let t={...e,timerId:0};return Td(e.projectId),d(t),yE({id:e.persistId,knownTicketIds:[...e.knownTicketIds],projectId:e.projectId,projectName:e.projectName,startTime:e.startTime,truncated:e.truncated}),t},[d]),v=(0,I.useCallback)((e,t)=>{let n=_(t);s.current.set(e,n)},[_]),y=(0,I.useCallback)((e,t)=>{let n=_(t);c.current.set(e,n)},[_]),b=(0,I.useCallback)(e=>{let t=e;if(!t||typeof t.type!=`string`||t.type!==`spec_gen_done`&&t.type!==`spec_gen_error`)return;let n=t.requestId;if(!n)return;let r=s.current.get(n);r&&(s.current.delete(n),t.type===`spec_gen_done`?m(r,t.ticket):h(r))},[m,h]),x=(0,I.useCallback)(e=>{let t=e;if(!t||typeof t.type!=`string`)return;let n=t.conversationId;if(!n)return;let r=c.current.get(n);if(r){if(t.type===`chat_error`){c.current.delete(n),h(r);return}t.type===`chat_done`&&g(r,n)}},[g,h]),S=(0,I.useCallback)(e=>{let t=e;if(!t||typeof t.type!=`string`||t.type!==`ticket_created`&&t.type!==`ticket_updated`)return;let n=t.ticket;if(n)for(let[e,t]of c.current.entries())t.knownTicketIds.has(n.id)||g(t,e)},[g]);(0,I.useLayoutEffect)(()=>(t(`_tracker_spec_gen`,b),t(`_tracker_chat_done`,x),t(`_tracker_tickets`,S),()=>{n(`_tracker_spec_gen`),n(`_tracker_chat_done`),n(`_tracker_tickets`)}),[b,x,S,t,n]);let C=(0,I.useRef)(new Set);(0,I.useEffect)(()=>{let e=vE();if(e.length!==0)for(let t of e){if(C.current.has(t.id))continue;C.current.add(t.id);let e=`spec-restore-${t.id}`,n=new Set(t.knownTicketIds),r=()=>{K.loading(`${t.projectName} · ${t.truncated}`,{id:e,description:J.t(`activity:specGen.generating`,{elapsed:gE(Date.now()-t.startTime)})})};r();let i=setInterval(r,1e3);Td(t.projectId);let a=0,o={toastId:e,truncated:t.truncated,knownTicketIds:n,projectId:t.projectId,projectName:t.projectName,startTime:t.startTime,persistId:t.id,timerId:i};async function s(){try{let r=await fetch(`${sl}/api/projects/${t.projectId}/tickets`);if(!r.ok)throw Error();let a=await r.json(),s=(Array.isArray(a)?a:a.tickets??[]).find(e=>!n.has(e.id));if(s){clearInterval(i),bE(t.id),Ed(t.projectId);let n=gE(Date.now()-t.startTime);K.success(`${t.projectName} · ${s.title||J.t(`activity:specGen.specCreated`)}`,{id:e,duration:1e4,description:J.t(`activity:specGen.generatedIn`,{elapsed:n}),action:{label:J.t(`activity:specGen.view`),onClick:()=>p(o,s)}});return}}catch{}a++,a<SE?setTimeout(s,CE):(clearInterval(i),bE(t.id),Ed(t.projectId),K.error(`${t.projectName} · ${J.t(`activity:specGen.couldNotConfirm`)}`,{id:e}))}s()}},[p]);let w=(0,I.useCallback)(()=>o(null),[]),T=(0,I.useMemo)(()=>({registerFastSpec:v,registerExploreSpec:y,specToOpen:a,clearSpecToOpen:w}),[v,y,a,w]);return(0,q.jsx)(xE.Provider,{value:T,children:e})}var TE={registerFastSpec:()=>{},registerExploreSpec:()=>{},specToOpen:null,clearSpecToOpen:()=>{}};function EE(){return(0,I.useContext)(xE)??TE}async function DE(e,t,n){let r=new FormData;r.append(`file`,t);let i=await fetch(`${ul()}/tickets/${e}/attachments`,{method:`POST`,body:r,signal:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??J.t(`attachments:errors.uploadFailed`,{status:i.status}))}return(await i.json()).attachment}async function OE(e,t){let n=await fetch(`${ul()}/tickets/${e}/attachments/${t}`,{method:`DELETE`});if(!n.ok&&n.status!==404)throw Error(J.t(`attachments:errors.deleteFailed`,{status:n.status}))}async function kE(e){let t=await fetch(`${ul()}/tickets/${e}/attachments`,{method:`DELETE`});if(!t.ok&&t.status!==404)throw Error(J.t(`attachments:errors.bulkDeleteFailed`,{status:t.status}))}async function AE(e){let t=await fetch(`${ul()}/tickets/${e}/attachments`);if(!t.ok)throw Error(J.t(`attachments:errors.listFailed`,{status:t.status}));return(await t.json()).attachments}function jE(e,t){return`${ul()}/tickets/${e}/attachments/${t}`}async function ME(e,t){let n=await fetch(jE(e,t));if(!n.ok)throw Error(J.t(`attachments:errors.fetchFailed`,{status:n.status}));return n.blob()}var NE=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/csv,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/sql,application/x-sql,text/sql,text/x-sql,.sql`,PE=new Set(NE.split(`,`).filter(e=>!e.startsWith(`.`))),FE=/\.sql$/i;function IE(e){return PE.has(e.type)||FE.test(e.name)}function LE(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function RE(e){return e.startsWith(`image/`)?`🖼`:e===`application/pdf`?`📄`:e===`text/csv`||e.includes(`spreadsheetml`)||e===`application/vnd.ms-excel`?`📊`:e===`application/json`?`{ }`:e===`text/plain`||e.includes(`sql`)?`📝`:`📎`}function zE({attachment:e,uploading:t,onRemove:n,onClick:r,index:i=0,className:a}){let{t:o}=G(`attachments`),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let e=Math.min(i*50,250),t=setTimeout(()=>c(!0),e);return()=>clearTimeout(t)},[i]);let d=e?.filename??t?.name??o(`chip.genericFile`),f=e?.mimeType??`application/octet-stream`,p=t?o(`chip.uploading`):e?LE(e.size):``;function m(e){e.stopPropagation(),u(!0),setTimeout(()=>n?.(),180)}return(0,q.jsxs)(`div`,{role:r?`button`:void 0,tabIndex:r?0:void 0,onClick:r,onKeyDown:e=>r&&e.key===`Enter`&&r(),className:X(`group/chip relative inline-flex items-center gap-2 pl-2 pr-1 py-1.5 rounded-lg border border-border bg-card/70 backdrop-blur-sm text-xs shadow-sm`,`transition-all duration-200 ease-out origin-left`,s&&!l?`opacity-100 scale-100 translate-y-0`:`opacity-0 scale-[0.85] translate-y-1`,l&&`max-w-0 overflow-hidden pl-0 pr-0 py-0 border-transparent ml-0 mr-0`,r&&`cursor-pointer hover:border-primary/50`,t&&`animate-pulse`,a),style:l?{maxWidth:0}:void 0,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-sm leading-none shrink-0 w-5 text-center`,children:RE(f)}),(0,q.jsxs)(`div`,{className:`flex flex-col min-w-0 mr-1`,children:[(0,q.jsx)(`span`,{className:`font-medium truncate max-w-[160px] text-foreground`,children:d}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground leading-tight`,children:p})]}),n&&!t&&(0,q.jsx)(`button`,{type:`button`,onClick:m,"aria-label":o(`removeFile`,{name:d}),className:`ml-0.5 w-5 h-5 inline-flex items-center justify-center rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:`×`})]})}function BE(e){let t=[];for(let n=0;n<e.files.length;n++){let r=e.files.item(n);r&&t.push(r)}return t}function VE(e){return`paste-${new Date().toISOString().slice(0,10)}-${e}.png`}function HE(e){let t=document.createElement(`span`);t.setAttribute(`contenteditable`,`false`),t.dataset.attachmentId=e.id,t.dataset.filename=e.filename,t.className=`inline-flex items-center gap-1 px-1.5 py-0.5 mx-0.5 rounded bg-accent/80 hover:bg-accent text-accent-foreground text-xs font-medium align-baseline select-none border border-border shadow-sm transition-all`;let n=document.createElement(`span`);n.textContent=`@${e.filename}`,n.className=`max-w-[180px] truncate`;let r=document.createElement(`button`);return r.type=`button`,r.setAttribute(`aria-label`,J.t(`attachments:removeFile`,{name:e.filename})),r.dataset.role=`pill-remove`,r.className=`text-accent-foreground/60 hover:text-destructive transition-colors leading-none`,r.textContent=`×`,t.appendChild(n),t.appendChild(r),t}function UE(e){return!!e&&e.nodeType===Node.ELEMENT_NODE}function WE(e,t){if(e.nodeType===Node.TEXT_NODE){t.push(e.nodeValue??``);return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e;if(n.dataset.attachmentId&&n.dataset.filename){t.push(`@[${n.dataset.filename}](${n.dataset.attachmentId})`);return}if(n.tagName===`BR`){t.push(`
|
|
67
|
+
`);return}if(n.tagName===`DIV`||n.tagName===`P`){t.length&&!t[t.length-1].endsWith(`
|
|
68
|
+
`)&&t.push(`
|
|
69
|
+
`),e.childNodes.forEach(e=>WE(e,t));return}e.childNodes.forEach(e=>WE(e,t))}var GE=(0,I.forwardRef)(function({ticketKey:e,placeholder:t,minHeight:n=120,maxHeight:r=320,ariaLabel:i,autoFocus:a,className:o,disabled:s,onAttachmentAdded:c,onAttachmentRemoved:l,onUnsupportedFile:u,onUploadError:d,onChange:f,onSubmit:p,footerExtra:m},h){let{t:g}=G(`attachments`),_=(0,I.useRef)(null),v=(0,I.useRef)(null),y=(0,I.useRef)(null),b=(0,I.useRef)(!1),x=(0,I.useRef)([]),S=(0,I.useRef)(0),C=(0,I.useRef)(0),[w,T]=(0,I.useState)(!1),[E,D]=(0,I.useState)([]),[O,k]=(0,I.useState)([]),[A,j]=(0,I.useState)(!0),M=(0,I.useCallback)(()=>{let e=_.current;e&&j(e.textContent?.trim().length===0&&e.querySelectorAll(`[data-attachment-id]`).length===0),f?.()},[f]),N=(0,I.useCallback)(()=>{let e=window.getSelection();if(!e||e.rangeCount===0)return;let t=_.current;if(!t)return;let n=e.getRangeAt(0);t.contains(n.commonAncestorContainer)&&(y.current=n.cloneRange())},[]),P=(0,I.useCallback)(()=>{let e=_.current;if(!e)return null;let t=window.getSelection();if(!t)return null;let n;return y.current&&e.contains(y.current.commonAncestorContainer)?n=y.current.cloneRange():(n=document.createRange(),n.selectNodeContents(e),n.collapse(!1)),t.removeAllRanges(),t.addRange(n),n},[]),F=(0,I.useCallback)(e=>{if(!_.current)return;let t=P();if(!t)return;let n=HE(e),r=document.createTextNode(` `),i=document.createTextNode(` `);t.deleteContents(),t.insertNode(i),t.insertNode(n),t.insertNode(r);let a=document.createRange();a.setStartAfter(i),a.collapse(!0);let o=window.getSelection();o?.removeAllRanges(),o?.addRange(a),y.current=a.cloneRange(),M()},[M,P]),L=(0,I.useCallback)(e=>{k(t=>t.some(t=>t.id===e.id)?t:[...t,e]),b.current?x.current.push(e):F(e)},[F]),ee=(0,I.useCallback)(e=>{let t=_.current;if(!t)return null;let n=t.querySelector(`[data-attachment-id="${CSS.escape(e)}"]`),r=n?.dataset.filename;return n?.remove(),k(t=>t.find(t=>t.id===e)?t.filter(t=>t.id!==e):t),M(),!n&&!r?O.find(t=>t.id===e)||null:{id:e,filename:r??``}},[O,M]),te=(0,I.useCallback)(async t=>{if(!IE(t)){u?.(t);return}let n=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;D(e=>[...e,{id:n,name:t.name}]);try{let n=await DE(e,t);L(n),c?.(n)}catch(e){let n=e instanceof Error?e:Error(String(e));d?.(n,t)}finally{D(e=>e.filter(e=>e.id!==n))}},[c,u,d,L,e]),R=(0,I.useCallback)(async e=>{N(),await Promise.all(e.map(te))},[N,te]);(0,I.useImperativeHandle)(h,()=>({getPlainText:()=>{let e=_.current;if(!e)return``;let t=[];return e.childNodes.forEach(e=>WE(e,t)),t.join(``).replace(//g,``).trim()},getAttachmentIds:()=>{let e=_.current;return e?Array.from(e.querySelectorAll(`[data-attachment-id]`)).map(e=>e.dataset.attachmentId):[]},insertPill:F,focus:()=>_.current?.focus(),resetHeight:()=>{let e=_.current;e&&(e.style.height=``)},clear:()=>{let e=_.current;e&&(e.innerHTML=``,y.current=null,k([]),M())},setPlainText:e=>{let t=_.current;t&&(t.textContent=e,y.current=null,M())}}),[F,M]);let z=(0,I.useCallback)(e=>{if(!_.current)return;if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)){e.preventDefault(),p?.();return}if(e.key!==`Backspace`&&e.key!==`Delete`)return;let t=window.getSelection();if(!t||t.rangeCount===0)return;let n=t.getRangeAt(0);if(!n.collapsed)return;let r=e.key===`Backspace`?(()=>{let e=n.startContainer;return e.nodeType===Node.TEXT_NODE&&n.startOffset>0?null:UE(e)?e.childNodes[n.startOffset-1]??null:e.previousSibling})():(()=>{let e=n.startContainer;return e.nodeType===Node.TEXT_NODE&&n.startOffset<(e.nodeValue?.length??0)?null:UE(e)?e.childNodes[n.startOffset]??null:e.nextSibling})(),i=UE(r)?r:null;if(i&&i.dataset.attachmentId){e.preventDefault();let t=ee(i.dataset.attachmentId);t&&l?.(t)}},[l,p,ee]),B=(0,I.useCallback)(e=>{let t=e.clipboardData;if(!t)return;let n=(t.items?Array.from(t.items):[]).find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(n){let t=n.getAsFile();if(t){e.preventDefault(),S.current+=1,te(t.name&&t.name!==`image.png`?t:new File([t],VE(S.current),{type:t.type}));return}}e.preventDefault();let r=t.getData(`text/plain`);if(!r)return;let i=window.getSelection();if(!i||i.rangeCount===0)return;let a=i.getRangeAt(0);a.deleteContents(),a.insertNode(document.createTextNode(r)),a.collapse(!1),M()},[M,te]),V=(0,I.useCallback)(e=>{let t=e.target;if(t.dataset.role===`pill-remove`){e.preventDefault();let n=t.closest(`[data-attachment-id]`);if(n?.dataset.attachmentId){let e=ee(n.dataset.attachmentId);e&&l?.(e)}}},[l,ee]),ne=(0,I.useCallback)(()=>M(),[M]),H=(0,I.useCallback)(()=>N(),[N]),U=(0,I.useCallback)(()=>{b.current=!0},[]),re=(0,I.useCallback)(()=>{if(b.current=!1,x.current.length>0){let e=x.current;x.current=[],e.forEach(e=>F(e))}},[F]),ie=(0,I.useCallback)(e=>{e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),C.current+=1,T(!0))},[]),W=(0,I.useCallback)(e=>{e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)},[]),ae=(0,I.useCallback)(e=>{e.dataTransfer?.types.includes(`Files`)&&(--C.current,C.current<=0&&(C.current=0,T(!1)))},[]),oe=(0,I.useCallback)(e=>{if(!e.dataTransfer?.types.includes(`Files`))return;e.preventDefault(),C.current=0,T(!1);let t=BE(e.dataTransfer);t.length>0&&R(t)},[R]),se=(0,I.useCallback)(()=>{v.current?.click()},[]),ce=(0,I.useCallback)(e=>{let t=e.target.files?Array.from(e.target.files):[];t.length>0&&R(t),e.target.value=``},[R]);return(0,I.useEffect)(()=>{a&&_.current?.focus()},[a]),(0,q.jsxs)(`div`,{className:X(`relative group`,o),onDragEnter:ie,onDragOver:W,onDragLeave:ae,onDrop:oe,children:[(0,q.jsx)(`div`,{ref:_,contentEditable:!s,role:`textbox`,"aria-multiline":`true`,"aria-label":i,spellCheck:!0,suppressContentEditableWarning:!0,onInput:ne,onPaste:B,onKeyDown:z,onClick:V,onBlur:H,onCompositionStart:U,onCompositionEnd:re,"data-empty":A?`true`:`false`,className:X(`w-full rounded-lg border border-border bg-background px-3 py-2 text-sm leading-relaxed`,`outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/60`,`transition-colors whitespace-pre-wrap break-words`,`data-[empty=true]:before:content-[attr(data-placeholder)]`,`data-[empty=true]:before:text-muted-foreground data-[empty=true]:before:pointer-events-none`,`data-[empty=true]:before:absolute data-[empty=true]:before:top-2 data-[empty=true]:before:left-3`),style:{minHeight:n,maxHeight:r,resize:`vertical`,overflow:`auto`},"data-placeholder":t??``}),(O.length>0||E.length>0)&&(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mt-2`,children:[O.map((e,t)=>(0,q.jsx)(zE,{attachment:e,index:t,onRemove:()=>{let t=ee(e.id);t&&l?.(t)}},e.id)),E.map((e,t)=>(0,q.jsx)(zE,{uploading:{name:e.name},index:O.length+t},e.id))]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-[11px] text-muted-foreground`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:se,disabled:s,className:`inline-flex items-center gap-1 px-2 py-1 rounded-md border border-border hover:bg-accent/40 transition-colors disabled:opacity-50`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,children:`📎`}),(0,q.jsx)(`span`,{children:g(`editor.attachFiles`)})]}),m]}),E.length>0&&(0,q.jsx)(`span`,{className:`animate-pulse`,children:g(`editor.uploadingFiles`,{count:E.length})})]}),(0,q.jsx)(`input`,{ref:v,type:`file`,multiple:!0,accept:NE,className:`hidden`,onChange:ce}),(0,q.jsx)(`div`,{"aria-hidden":!0,className:X(`pointer-events-none absolute inset-0 rounded-lg border-2 border-dashed transition-all duration-150`,w?`border-primary bg-primary/10 opacity-100 scale-100`:`border-transparent opacity-0 scale-[0.98]`),children:(0,q.jsx)(`div`,{className:X(`absolute inset-0 flex items-center justify-center text-sm font-medium text-primary`,w?`opacity-100`:`opacity-0`,`transition-opacity`),children:g(`editor.dropToAddContext`)})})]})});function KE({value:e,allowed:t,loading:n,onChange:r,ariaLabel:i}){let{t:a}=G(`explore`);return(0,q.jsxs)(eT,{value:e??``,onValueChange:r,disabled:n||t.length===0,children:[(0,q.jsx)(nT,{className:`h-8 w-[160px] text-xs gap-1.5`,"aria-label":i??a(`modelPicker.ariaLabel`),"data-testid":`spec-model-picker`,children:n?(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted-foreground`,children:[(0,q.jsx)(Yf,{className:`w-3 h-3 animate-spin`}),a(`common:states.loading`)]}):(0,q.jsx)(tT,{placeholder:a(`modelPicker.placeholder`)})}),(0,q.jsx)(aT,{children:t.map(e=>(0,q.jsx)(sT,{value:e.value,children:e.label},e.value))})]})}function qE(e,t,n){let[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)([]),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)([]),[d,f]=(0,I.useState)(!1),[p,m]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!t||!e)return;let r=!1;f(!0),m(null);let a=n?`?provider=${encodeURIComponent(n)}`:``;return fetch(`${ul()}/default-spec-model${a}`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{r||(i(typeof e?.model==`string`?e.model:`sonnet`),o(Array.isArray(e?.allowed)&&e.allowed.length>0?e.allowed:[{value:`sonnet`,label:`Claude Sonnet`}]),c(e?.provider??`claude`),u(Array.isArray(e?.providers)&&e.providers.length>0?e.providers:[e?.provider??`claude`]))}).catch(e=>{r||(m(e.message),i(`sonnet`),o([{value:`sonnet`,label:`Claude Sonnet`}]),c(`claude`),u([`claude`]))}).finally(()=>{r||f(!1)}),()=>{r=!0}},[t,e,n]),{model:r,setModel:i,allowed:a,provider:s,providers:l,loading:d,error:p}}function JE(e){return e===`claude`}var YE=new Set([`agents`]);function XE(e,t){return YE.has(t)?e===`claude`:!0}function ZE(e,t){return(t&&t.length>0?t:[`claude`]).every(t=>XE(t,e))}function QE(e){return e===`codex`?`Codex`:e===`claude`?`Claude`:e??`Claude`}function $E({value:e,providers:t,onChange:n,disabled:r,ariaLabel:i,className:a}){let{t:o}=G(`addspec`);return!t||t.length<=1?null:(0,q.jsxs)(eT,{value:e,onValueChange:e=>n(e),disabled:r,children:[(0,q.jsx)(nT,{className:a??`h-8 w-[130px] text-xs gap-1.5`,"aria-label":i??o(`aiEngine.label`),"data-testid":`ai-engine-selector`,children:(0,q.jsx)(tT,{placeholder:o(`aiEngine.label`)})}),(0,q.jsx)(aT,{children:t.map(e=>(0,q.jsx)(sT,{value:e,children:QE(e)},e))})]})}function eD(e){return{specrails:!0,openspec:!1,full:e===`explore`,mcp:!1,contractRefine:!1,userMcp:!1}}function tD(e){let t=+!!e.specrails+(e.openspec?2:0)+(e.mcp?2:0)+(e.full?4:0)+(e.contractRefine?4:0);return t===0?`Light`:t<=2?`Medium`:t<=5?`Heavy`:`Deep`}function nD(e){switch(e){case`Light`:return`bg-accent-success text-white hover:bg-accent-success/90`;case`Medium`:return`bg-accent-info text-white hover:bg-accent-info/90`;case`Heavy`:return`bg-accent-warning text-white hover:bg-accent-warning/90`;case`Deep`:return`bg-accent-secondary text-white hover:bg-accent-secondary/90`}}var rD={sonnet:.003,opus:.015,haiku:8e-4,"gpt-5.5":.0015,"gpt-5.4-mini":6e-4,"gpt-5.4":.005};function iD(e,t){let n=0;return e.specrails&&(n+=t.specrailsTicketsTokens??0),e.openspec&&(n+=t.openspecSpecsTokens??0),e.full&&(n+=Math.min(t.codebaseEstimatedTokens??0,5e4)),n}function aD(e,t,n){let r=iD(e,t),i=rD[n]??.003;return r/1e3*i}function oD(e){switch(e){case`Light`:return`~15s`;case`Medium`:return`~30s`;case`Heavy`:return`~60s`;case`Deep`:return`~120s`}}function sD(e){return e.full?`~45s`:`~15s`}function cD({id:e,label:t,hint:n,checked:r,disabled:i,tooltip:a,onChange:o}){return(0,q.jsxs)(`div`,{title:a,className:`flex items-center justify-between gap-3 px-3 py-2 rounded-md border border-border/40 ${i?`opacity-50 cursor-not-allowed`:`cursor-pointer hover:bg-card/60`}`,children:[(0,q.jsxs)(`label`,{htmlFor:e,className:`flex flex-col gap-0.5 text-xs`,children:[(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:n})]}),(0,q.jsx)(`button`,{id:e,type:`button`,role:`switch`,"aria-label":t,"aria-checked":r,disabled:i,onClick:()=>o(!r),className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 ${r?`bg-primary`:`bg-input`}`,children:(0,q.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${r?`translate-x-4`:`translate-x-0.5`}`})})]})}function lD({scope:e,onChange:t,defaultOpen:n=!1,label:r,showSummary:i=!0}){let{t:a}=G(`addspec`),o=r??a(`contextScope.defaultLabel`),[s,c]=(0,I.useState)(n),l=[e.specrails&&a(`contextScope.tags.specrails`),e.openspec&&a(`contextScope.tags.openspec`),e.full&&a(`contextScope.tags.codebase`),e.mcp&&a(`contextScope.tags.mcp`),e.userMcp&&a(`contextScope.tags.myMcp`),e.contractRefine&&a(`contextScope.tags.contract`)].filter(Boolean),u=l.length===0?a(`contextScope.summaryMinimal`):l.join(`, `),d=tD(e);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":s,"aria-controls":`ctx-scope-body`,"data-testid":`context-scope-toggle`,onClick:()=>c(e=>!e),className:`flex items-center justify-between gap-2 text-[11px] uppercase tracking-wider text-muted-foreground font-semibold hover:text-foreground transition-colors`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[s?(0,q.jsx)(rf,{className:`w-3 h-3`}):(0,q.jsx)(of,{className:`w-3 h-3`}),o]}),!s&&i?(0,q.jsxs)(`span`,{className:`text-[10px] normal-case tracking-normal text-muted-foreground/80`,children:[u,` · `,d]}):null]}),s?(0,q.jsxs)(`div`,{id:`ctx-scope-body`,className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:[(0,q.jsx)(cD,{id:`ctx-specrails`,label:a(`contextScope.checks.specrailsLabel`),hint:`.specrails/local-tickets.json`,checked:e.specrails,onChange:n=>t({...e,specrails:n})}),(0,q.jsx)(cD,{id:`ctx-openspec`,label:a(`contextScope.checks.openspecLabel`),hint:`openspec/specs/*`,checked:e.openspec,onChange:n=>t({...e,openspec:n})}),(0,q.jsx)(cD,{id:`ctx-full`,label:a(`contextScope.checks.fullLabel`),hint:`Read · Grep · Glob`,checked:e.full,onChange:n=>t({...e,full:n})}),(0,q.jsx)(cD,{id:`ctx-mcp`,label:a(`contextScope.checks.mcpLabel`),hint:a(`contextScope.checks.mcpHint`),checked:e.mcp&&!0,disabled:!1,tooltip:void 0,onChange:n=>t({...e,mcp:n})}),(0,q.jsx)(cD,{id:`ctx-user-mcp`,label:a(`contextScope.checks.userMcpLabel`),hint:a(`contextScope.checks.userMcpHint`),checked:!!e.userMcp&&!0,disabled:!1,tooltip:a(`contextScope.checks.userMcpTooltip`),onChange:n=>t({...e,userMcp:n})}),(0,q.jsx)(cD,{id:`ctx-contract-refine`,label:a(`contextScope.checks.contractLabel`),hint:a(`contextScope.checks.contractHint`),checked:e.contractRefine,onChange:n=>t({...e,contractRefine:n})})]}):null]})}var uD=[{id:`minimal`,scope:{specrails:!1,openspec:!1,full:!1,mcp:!1,contractRefine:!1}},{id:`light`,scope:{specrails:!0,openspec:!1,full:!1,mcp:!1,contractRefine:!1}},{id:`standard`,scope:{specrails:!0,openspec:!0,full:!1,mcp:!1,contractRefine:!1}},{id:`rich`,scope:{specrails:!0,openspec:!0,full:!0,mcp:!1,contractRefine:!1}},{id:`max`,scope:{specrails:!0,openspec:!0,full:!0,mcp:!1,contractRefine:!0}},{id:`desktop`,scope:{specrails:!0,openspec:!0,full:!0,mcp:!0,contractRefine:!0,userMcp:!0}}];function dD(e,t){return e.specrails===t.specrails&&e.openspec===t.openspec&&e.full===t.full&&e.mcp===t.mcp&&e.contractRefine===t.contractRefine&&(e.userMcp??!1)===(t.userMcp??!1)}function fD(e){return uD.findIndex(t=>dD(t.scope,e))}function pD(e){let t={specrails:1,openspec:1,full:1,contractRefine:1,mcp:1,userMcp:1},n=0;return e.specrails&&(n+=t.specrails),e.openspec&&(n+=t.openspec),e.full&&(n+=t.full),e.contractRefine&&(n+=t.contractRefine),e.mcp&&(n+=t.mcp),e.userMcp&&(n+=t.userMcp),Math.max(0,Math.min(5,n))}function mD(e){return e>=1e3?`~${(e/1e3).toFixed(e>=1e4?0:1)}k tok`:`~${e} tok`}function hD(e){return e<.01?`~$${e.toFixed(4)}`:`~$${e.toFixed(2)}`}function gD({value:e,onChange:t,budget:n=null,budgetError:r=!1,model:i=`sonnet`,maxPresetId:a=`desktop`,onPresetChange:o,smashCapable:s=!0}){let{t:c}=G(`addspec`),l=(0,I.useRef)(null),[u,d]=(0,I.useState)(!1),[f,p]=(0,I.useState)(null),m=Math.max(0,uD.findIndex(e=>e.id===a)),h=uD.slice(0,m+1),g=fD(e),_=g<0,v=g>=0?uD[g]:null,y=Math.min(_?pD(e):g,m);(0,I.useEffect)(()=>{o?.(v?.id??`custom`)},[v,o]);let b=(0,I.useCallback)(e=>{t(uD[Math.max(0,Math.min(m,e))].scope)},[m,t]),x=(0,I.useCallback)(e=>{let t=m;e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),b((g<0?Math.round(y):g)+1)):e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),b((g<0?Math.round(y):g)-1)):e.key===`Home`?(e.preventDefault(),b(0)):e.key===`End`&&(e.preventDefault(),b(t))},[g,y,m,b]),S=(0,I.useCallback)(e=>{let t=l.current;if(!t)return 0;let n=t.getBoundingClientRect(),r=(e-n.left)/Math.max(1,n.width);return Math.max(0,Math.min(1,r))},[]),C=(0,I.useCallback)(e=>{let t=S(e);return Math.round(t*m)},[m,S]),w=(0,I.useCallback)(e=>{e.preventDefault(),d(!0),p(S(e.clientX)),e.target.setPointerCapture?.(e.pointerId)},[S]),T=(0,I.useCallback)(e=>{u&&p(S(e.clientX))},[u,S]),E=(0,I.useCallback)(e=>{u&&(d(!1),p(null),b(C(e.clientX)))},[u,C,b]),D=(0,I.useMemo)(()=>u&&f!==null?f:m===0?0:y/m,[u,f,m,y]),O=_?c(`contextScope.customMix`):v?c(`contextScope.presetCost.${v.id}`):``,k=tD(e),A=r||!n?c(`contextScope.estimateUnavailable`,{tier:k}):`${k} · ${mD(iD(e,n))} · ${hD(aD(e,n,i))} · ${oD(k)}`;return(0,q.jsxs)(`div`,{className:`space-y-2 select-none`,"data-testid":`context-scope-slider`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground font-semibold`,children:c(`contextScope.heading`)}),_?(0,q.jsx)(`span`,{className:`rounded-full bg-accent-warning/15 px-2 py-0.5 text-[10px] font-semibold text-accent-warning`,"data-testid":`scope-custom-pill`,children:c(`contextScope.custom`)}):null]}),(0,q.jsx)(`span`,{className:`text-[11px] font-medium text-foreground`,"data-testid":`context-awareness-tier`,children:k})]}),(0,q.jsx)(`div`,{className:`flex justify-between text-[10px] font-medium text-muted-foreground`,children:h.map((e,t)=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>b(t),className:`px-1 cursor-pointer hover:text-foreground transition-colors ${g===t?`text-foreground font-semibold`:``}`,"data-testid":`scope-stop-${e.id}`,children:c(`contextScope.preset.${e.id}`)},e.id))}),(0,q.jsxs)(`div`,{ref:l,role:`slider`,"aria-valuemin":0,"aria-valuemax":m,"aria-valuenow":g<0?Math.round(y):g,"aria-valuetext":_?c(`contextScope.custom`):v?c(`contextScope.preset.${v.id}`):``,tabIndex:0,onKeyDown:x,onPointerDown:w,onPointerMove:T,onPointerUp:E,className:`relative h-2 rounded-full bg-muted/40 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[h.map((e,t)=>(0,q.jsx)(`span`,{className:`absolute top-1/2 -translate-y-1/2 -translate-x-1/2 h-2 w-2 rounded-full bg-muted-foreground/70 pointer-events-none`,style:{left:`${m===0?0:t/m*100}%`}},t)),(0,q.jsx)(`div`,{className:`absolute left-0 top-0 h-full rounded-full bg-primary/60 pointer-events-none`,style:{width:`${D*100}%`}}),(0,q.jsx)(`div`,{"data-testid":`scope-thumb`,className:`absolute top-1/2 -translate-y-1/2 -translate-x-1/2 h-4 w-4 rounded-full bg-background border-2 ${_?`border-accent-warning`:`border-primary`} shadow-sm pointer-events-none ${u?``:`transition-[left] duration-150`}`,style:{left:`${D*100}%`}})]}),(0,q.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,"data-testid":`scope-cost-line`,children:[O,` · `,A]}),e.contractRefine&&s&&(0,q.jsxs)(`div`,{className:`flex items-start gap-1.5 rounded-md border border-accent-highlight/40 bg-accent-highlight/10 px-2 py-1.5 text-[10px] text-foreground/80`,"data-testid":`scope-smash-hint`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-accent-highlight`,children:`⊢→`}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`strong`,{className:`text-accent-highlight`,children:c(`contextScope.smashCapable`)}),` · `,c(`contextScope.smashHint`)]})]})]})}var _D=`specrails-desktop:last-engine:`;function vD(e){return`${_D}${e}`}function yD(e,t,n){if(!e)return n;try{let n=window.localStorage.getItem(vD(e));if(n&&t.includes(n))return n}catch{}return n}function bD(e,t){if(e)try{window.localStorage.setItem(vD(e),t)}catch{}}function xD(e,t,n){let[r,i]=(0,I.useState)({scope:eD(t),loaded:!1}),a=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!n||!e)return;let o=`${e}:${t}`;if(a.current===o&&r.loaded)return;a.current=o;let s=!1;return(async()=>{if(t===`quick`){s||i({scope:eD(`quick`),loaded:!0});return}let n=eD(t);try{let r=await fetch(`${sl}/api/projects/${e}/context-scope-last`);if(r.ok){let e=await r.json();e.scope&&(n={...eD(t),...e.scope})}}catch{}s||i({scope:n,loaded:!0})})(),()=>{s=!0}},[e,n,t]);let o=(0,I.useCallback)(e=>{i(t=>({scope:typeof e==`function`?e(t.scope):e,loaded:t.loaded}))},[]),s=(0,I.useCallback)(async t=>{if(e)try{await fetch(`${sl}/api/projects/${e}/context-scope-last`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}catch{}},[e]);return{scope:r.scope,setScope:o,persist:s,loaded:r.loaded}}function SD(e,t){let[n,r]=(0,I.useState)({data:null,isError:!1}),i=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(!t||!e||i.current===e&&n.data)return;i.current=e;let a=!1,o=new AbortController,s=setTimeout(()=>o.abort(),5e3);return fetch(`${sl}/api/projects/${e}/context-budget`,{signal:o.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{a||r({data:e,isError:!1})}).catch(()=>{a||r({data:null,isError:!0})}).finally(()=>clearTimeout(s)),()=>{a=!0,o.abort(),clearTimeout(s)}},[e,t]),n}function CD(e,t){let[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{if(!t||!e)return;let n=!1;return(async()=>{let t=!1;try{let n=await fetch(`${sl}/api/projects/${e}/add-spec-quick-contract-refine-last`);if(n.ok){let e=await n.json();(e.configured===!0||e.configured===void 0)&&(t=e.enabled===!0)}}catch{}n||(r(t),a(!0))})(),()=>{n=!0}},[e,t]),{value:n,setValue:r,loaded:i,persist:(0,I.useCallback)(async t=>{e&&await fetch(`${sl}/api/projects/${e}/add-spec-quick-contract-refine-last`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:t})})},[e])}}function wD(){return typeof window<`u`&&`__TAURI_INTERNALS__`in window||typeof window<`u`&&window.location.protocol!==`http:`&&window.location.protocol!==`https:`?`ws://localhost:4200`:`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`}var TD=wD();function ED(){let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_FEATURE_BROWSER_CAPTURE;return typeof e==`string`?e!==`false`:!0}var DD={desktop:{width:1280,height:800},tablet:{width:768,height:1024},mobile:{width:375,height:667}},OD=class extends Error{},kD=class extends Error{};async function AD(e){let t=await fetch(`${ul()}/browser/sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({initialUrl:e})});if(t.status===409)throw new OD(`Too many open browser sessions`);if(t.status===502)throw new kD(`The browser failed to launch`);if(!t.ok)throw Error(`Failed to open browser (${t.status})`);return(await t.json()).session}async function jD(e,t,n){let r=await fetch(`${ul()}/browser/sessions/${e}/navigate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,url:n})});if(!r.ok)throw Error(`Navigation failed (${r.status})`);return await r.json()}async function MD(e,t,n,r){let i=await fetch(`${ul()}/browser/sessions/${e}/capture`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({rect:t,pendingSpecId:n,captureNetwork:r?.captureNetwork??!0})});if(!i.ok)throw Error(`Capture failed (${i.status})`);return await i.json()}async function ND(e,t,n,r,i=DD){let a=await fetch(`${ul()}/browser/sessions/${e}/capture-breakpoints`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({rect:t,anchorPoint:n,pendingSpecId:r,breakpoints:i})});if(!a.ok)throw Error(`Capture failed (${a.status})`);return await a.json()}async function PD(e,t,n){let r=new FormData;r.append(`file`,t,n);let i=await fetch(`${ul()}/tickets/${e}/attachments`,{method:`POST`,body:r});if(!i.ok)throw Error(`Upload failed (${i.status})`);return(await i.json()).attachment}async function FD(e,t,n){let r=await fetch(`${ul()}/browser/sessions/${e}/clipboard`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,text:n})});if(!r.ok)throw Error(`Clipboard failed (${r.status})`);return await r.json()}async function ID(e,t,n){let r=await fetch(`${ul()}/browser/sessions/${e}/element`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selector:t,direction:n})});if(!r.ok)throw Error(`Element navigate failed (${r.status})`);return(await r.json()).probe}async function LD(e){try{await fetch(`${ul()}/browser/sessions/${e}`,{method:`DELETE`})}catch{}}function RD(e,t){return`${TD||(typeof window<`u`?`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`:`ws://localhost:4200`)}/ws/browser/${e}?projectId=${encodeURIComponent(t)}`}function zD(e,t){let n=RD(e,t),r=ml(),i=r?new WebSocket(n,[`specrails-desktop`,r]):new WebSocket(n);return i.binaryType=`arraybuffer`,i}function BD(e,t,n){let r=t.width>0?(e.x-t.left)/t.width:0,i=t.height>0?(e.y-t.top)/t.height:0,a=Math.min(Math.max(r,0),1)*n.width,o=Math.min(Math.max(i,0),1)*n.height;return{x:Math.round(a),y:Math.round(o)}}function VD(e,t,n){let r=n.width>0?t.width/n.width:0,i=n.height>0?t.height/n.height:0;return{left:t.left+e.x*r,top:t.top+e.y*i,width:e.width*r,height:e.height*i}}function HD(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}function UD(e,t=8){return e.width>=t&&e.height>=t}function WD(e){return{nodeCount:e.nodes.length,htmlBytes:e.html.length,truncated:e.htmlTruncated,networkCount:e.networkRequests?.length??0}}function GD(e){let{projectId:t,open:n,initialUrl:r}=e,i=(0,I.useRef)(null),a=(0,I.useRef)(null),o=(0,I.useRef)(null),s=(0,I.useRef)(!1),[c,l]=(0,I.useState)({status:`connecting`,errorMsg:null,url:null,title:null,viewport:{width:1280,height:800},hoverRect:null,hoverSelector:null,hoverPath:null}),u=(0,I.useCallback)(async e=>{if(s.current)return;let t=i.current;if(t){s.current=!0;try{let n=new Blob([e],{type:`image/jpeg`}),r=await createImageBitmap(n);t.width!==r.width&&(t.width=r.width),t.height!==r.height&&(t.height=r.height);let i=t.getContext(`2d`);i&&i.drawImage(r,0,0),r.close()}catch{}finally{s.current=!1}}},[]);(0,I.useEffect)(()=>{if(!n||!t)return;let e=!1;return l(e=>({...e,status:`connecting`,errorMsg:null})),(async()=>{try{let n=await AD(r);if(e){LD(n.id);return}o.current=n.id,l(e=>({...e,url:n.url,title:n.title,viewport:{width:n.viewportWidth,height:n.viewportHeight}}));let i=zD(n.id,t);a.current=i,i.onmessage=e=>{if(typeof e.data==`string`){try{let t=JSON.parse(e.data);t.type===`ready`?l(e=>({...e,status:`ready`,url:t.url??e.url,title:t.title??e.title,viewport:t.viewport??e.viewport})):t.type===`nav`?l(e=>({...e,url:t.url??e.url,title:t.title??e.title})):t.type===`hover`&&l(e=>({...e,hoverRect:t.rect??null,hoverSelector:t.selector??null,hoverPath:t.path??null}))}catch{}return}u(e.data)},i.onopen=()=>{e||l(e=>({...e,status:`ready`}))},i.onerror=()=>{e||l(e=>({...e,status:`error`,errorMsg:J.t(`browser:session.connectionError`)}))},i.onclose=()=>{e||l(e=>e.status===`ready`?{...e,status:`error`,errorMsg:J.t(`browser:session.lostConnection`)}:e)}}catch(t){if(e)return;let n=t instanceof OD?J.t(`browser:session.tooManySessions`):t instanceof kD?J.t(`browser:session.launchFailed`):J.t(`browser:session.openFailed`);l(e=>({...e,status:`error`,errorMsg:n}))}})(),()=>{e=!0;let t=a.current;if(t){t.onmessage=null,t.onopen=null,t.onerror=null,t.onclose=null;try{t.close()}catch{}}a.current=null;let n=o.current;o.current=null,n&&LD(n)}},[n,t,r,u]);let d=(0,I.useCallback)(e=>{let t=a.current;if(t&&t.readyState===WebSocket.OPEN)try{t.send(JSON.stringify({type:`input`,event:e}))}catch{}},[]),f=(0,I.useCallback)(async(e,t)=>{let n=o.current;if(n)try{let r=await jD(n,e,t);l(e=>({...e,url:r.url,title:r.title}))}catch{}},[]),p=(0,I.useCallback)(async(e,t,n)=>{let r=o.current;if(!r)throw Error(`No active browser session`);return MD(r,e,t,n)},[]),m=(0,I.useCallback)(async(e,t,n,r)=>{let i=o.current;if(!i)throw Error(`No active browser session`);return ND(i,e,t,n,r)},[]),h=(0,I.useCallback)(async(e,t)=>{let n=o.current;return n?FD(n,e,t):{text:``}},[]),g=(0,I.useCallback)((e,t)=>{let n=Math.max(1,Math.round(e)),r=Math.max(1,Math.round(t));l(e=>({...e,viewport:{width:n,height:r}})),d({type:`resize`,width:n,height:r})},[d]),_=(0,I.useCallback)(e=>{let t=a.current;if(t&&t.readyState===WebSocket.OPEN)try{t.send(JSON.stringify({type:`probe`,x:e.x,y:e.y}))}catch{}},[]),v=(0,I.useCallback)(()=>{l(e=>e.hoverRect||e.hoverPath?{...e,hoverRect:null,hoverSelector:null,hoverPath:null}:e)},[]),y=(0,I.useCallback)(async(e,t)=>{let n=o.current;return n?ID(n,e,t):null},[]);return{...c,canvasRef:i,forwardInput:d,navigate:f,capture:p,captureBreakpoints:m,clipboard:h,navigateElement:y,setViewport:g,probe:_,clearHover:v}}var KD={objects:[],past:[],future:[]};function qD(e,t){switch(t.type){case`add`:return{objects:[...e.objects,t.obj],past:[...e.past,e.objects],future:[]};case`delete`:return e.objects.some(e=>e.id===t.id)?{objects:e.objects.filter(e=>e.id!==t.id),past:[...e.past,e.objects],future:[]}:e;case`undo`:return e.past.length===0?e:{objects:e.past[e.past.length-1],past:e.past.slice(0,-1),future:[e.objects,...e.future]};case`redo`:return e.future.length===0?e:{objects:e.future[0],past:[...e.past,e.objects],future:e.future.slice(1)};case`clear`:return e.objects.length===0?e:{objects:[],past:[...e.past,e.objects],future:[]};default:return e}}function JD(e){let t=e.filter(e=>e.kind===`step`).map(e=>e.n);return t.length===0?1:Math.max(...t)+1}function YD(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function XD(e,t,n=.04){let r=Math.atan2(t.y-e.y,t.x-e.x),i=r-Math.PI/7,a=r+Math.PI/7;return{left:{x:t.x-n*Math.cos(i),y:t.y-n*Math.sin(i)},right:{x:t.x-n*Math.cos(a),y:t.y-n*Math.sin(a)}}}function ZD(e,t,n=.01){return Math.abs(e.x-t.x)>=n||Math.abs(e.y-t.y)>=n}function QD(e,t=.05){let n=e=>Math.min(1+t,Math.max(-t,e));return{x:n(e.x),y:n(e.y)}}function $D(e,t,n){return{schemaVersion:1,objects:e,baseWidth:t,baseHeight:n}}var eO=[`#ef4444`,`#f59e0b`,`#3b82f6`,`#22c55e`,`#ffffff`],tO=[{tool:`arrow`,icon:Kd,labelKey:`editor.tools.arrow`,key:`a`},{tool:`box`,icon:Pp,labelKey:`editor.tools.box`,key:`r`},{tool:`text`,icon:Up,labelKey:`editor.tools.text`,key:`t`},{tool:`blur`,icon:Ef,labelKey:`editor.tools.blur`,key:`b`},{tool:`step`,icon:Vf,labelKey:`editor.tools.step`,key:`n`}],nO=0,rO=()=>`a${++nO}-${Date.now().toString(36)}`;function iO({result:e,pendingSpecId:t,macOverlay:n,onConfirm:r,onReselect:i,onCancel:a}){let{t:o}=G(`browser`),[s,c]=(0,I.useReducer)(qD,KD),[l,u]=(0,I.useState)(`arrow`),[d,f]=(0,I.useState)(eO[0]),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)({w:1,h:1}),[_,v]=(0,I.useState)(!1),y=(0,I.useRef)(null),b=s.objects,x=(0,I.useCallback)(()=>{let e=y.current;if(!e)return;let t=e.getBoundingClientRect();t.width>0&&t.height>0&&g({w:t.width,h:t.height})},[]);(0,I.useEffect)(()=>(x(),window.addEventListener(`resize`,x),()=>window.removeEventListener(`resize`,x)),[x]);let S=(0,I.useCallback)((e,t)=>{let n=y.current;if(!n)return{x:0,y:0};let r=n.getBoundingClientRect();return QD({x:r.width>0?(e-r.left)/r.width:0,y:r.height>0?(t-r.top)/r.height:0})},[]),C=(0,I.useCallback)(e=>{if(_)return;e.target.setPointerCapture?.(e.pointerId);let t=S(e.clientX,e.clientY);if(l===`text`){let e=window.prompt(o(`editor.notePrompt`))?.trim();e&&c({type:`add`,obj:{id:rO(),kind:`text`,x:t.x,y:t.y,text:e,color:d}});return}if(l===`step`){c({type:`add`,obj:{id:rO(),kind:`step`,x:t.x,y:t.y,n:JD(b),color:d}});return}m({start:t,cur:t})},[_,l,d,b,S,o]),w=(0,I.useCallback)(e=>{p&&m(t=>t&&{...t,cur:S(e.clientX,e.clientY)})},[p,S]),T=(0,I.useCallback)(()=>{if(!p)return;let{start:e,cur:t}=p;if(m(null),ZD(e,t)){if(l===`arrow`)c({type:`add`,obj:{id:rO(),kind:`arrow`,from:e,to:t,color:d}});else if(l===`box`){let n=YD(e,t);c({type:`add`,obj:{id:rO(),kind:`box`,...n,color:d}})}else if(l===`blur`){let n=YD(e,t);c({type:`add`,obj:{id:rO(),kind:`blur`,...n}})}}},[p,l,d]);(0,I.useEffect)(()=>{let e=e=>{if(_)return;let t=e.metaKey||e.ctrlKey;if(t&&e.key.toLowerCase()===`z`){e.preventDefault(),c({type:e.shiftKey?`redo`:`undo`});return}if(t&&e.key===`Enter`){e.preventDefault(),D();return}if(t)return;let n=tO.find(t=>t.key===e.key.toLowerCase());if(n){u(n.tool);return}e.key===`Escape`&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,b,d,l]);let E=(0,I.useCallback)(async()=>{let e=y.current;if(!e||!e.naturalWidth)return null;let t=e.naturalWidth,n=e.naturalHeight,r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)return null;i.drawImage(e,0,0,t,n);for(let r of b)r.kind===`blur`&&(i.save(),i.beginPath(),i.rect(r.x*t,r.y*n,r.w*t,r.h*n),i.clip(),i.filter=`blur(${Math.max(6,t*.012)}px)`,i.drawImage(e,0,0,t,n),i.restore());i.filter=`none`;let a=Math.max(2,t*.004);for(let e of b)if(e.kind===`box`)i.strokeStyle=e.color,i.lineWidth=a,i.strokeRect(e.x*t,e.y*n,e.w*t,e.h*n);else if(e.kind===`arrow`){let r={x:e.from.x*t,y:e.from.y*n},o={x:e.to.x*t,y:e.to.y*n},s=XD(e.from,e.to,.035);i.strokeStyle=e.color,i.lineWidth=a,i.lineCap=`round`,i.beginPath(),i.moveTo(r.x,r.y),i.lineTo(o.x,o.y),i.moveTo(s.left.x*t,s.left.y*n),i.lineTo(o.x,o.y),i.lineTo(s.right.x*t,s.right.y*n),i.stroke()}else if(e.kind===`text`){let r=Math.max(12,n*.03);i.font=`600 ${r}px sans-serif`,i.textBaseline=`top`,i.lineWidth=Math.max(2,r*.18),i.strokeStyle=`rgba(0,0,0,0.55)`,i.strokeText(e.text,e.x*t,e.y*n),i.fillStyle=e.color,i.fillText(e.text,e.x*t,e.y*n)}else if(e.kind===`step`){let r=Math.max(10,n*.025);i.beginPath(),i.arc(e.x*t,e.y*n,r,0,Math.PI*2),i.fillStyle=e.color,i.fill(),i.fillStyle=`#000`,i.font=`700 ${r*1.1}px sans-serif`,i.textAlign=`center`,i.textBaseline=`middle`,i.fillText(String(e.n),e.x*t,e.y*n),i.textAlign=`start`}let o=r.toDataURL(`image/png`),s=await new Promise(e=>r.toBlob(t=>e(t),`image/png`));return s?{blob:s,dataUrl:o}:null},[b]),D=(0,I.useCallback)(async()=>{if(!_){if(b.length===0){r(e);return}v(!0);try{let n=await E(),i=y.current;if(!n||!i){r(e);return}let a=await PD(t,n.blob,`screen-annotated-${Date.now()}.png`);r({...e,rawScreenshot:e.screenshot,screenshot:a,screenshotDataUrl:n.dataUrl,annotations:$D(b,i.naturalWidth,i.naturalHeight)})}catch{r(e)}finally{v(!1)}}},[_,b,E,t,e,r]),O=(0,I.useCallback)(()=>{b.length>0&&!window.confirm(o(`editor.discardConfirm`))||a()},[b.length,a,o]),k=(e,t)=>e*(t===`w`?h.w:h.h),A=p?YD(p.start,p.cur):null;return(0,q.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col items-center justify-center overflow-hidden p-3 gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-lg border border-border/60 bg-surface/90 px-1.5 py-1 shadow-xl ${n?`ml-[80px]`:``}`,children:[tO.map(({tool:e,icon:t,labelKey:n})=>(0,q.jsx)(`button`,{type:`button`,title:o(n),"aria-label":o(n),"aria-pressed":l===e,onClick:()=>u(e),className:`h-7 w-7 inline-flex items-center justify-center rounded transition-colors ${l===e?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-card/60`}`,children:(0,q.jsx)(t,{className:`w-3.5 h-3.5`})},e)),(0,q.jsx)(`span`,{className:`w-px h-5 bg-border/60 mx-0.5`}),eO.map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-label":o(`editor.colorLabel`,{color:e}),onClick:()=>f(e),className:`h-5 w-5 rounded-full border transition-transform ${d===e?`scale-110 border-foreground`:`border-border/60`}`,style:{background:e}},e)),(0,q.jsx)(`span`,{className:`w-px h-5 bg-border/60 mx-0.5`}),(0,q.jsx)(`button`,{type:`button`,"aria-label":o(`editor.undo`),title:o(`editor.undoTitle`),disabled:s.past.length===0,onClick:()=>c({type:`undo`}),className:`h-7 w-7 inline-flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-card/60 disabled:opacity-40`,children:(0,q.jsx)(Wp,{className:`w-3.5 h-3.5`})}),(0,q.jsx)(`button`,{type:`button`,"aria-label":o(`editor.redo`),title:o(`editor.redoTitle`),disabled:s.future.length===0,onClick:()=>c({type:`redo`}),className:`h-7 w-7 inline-flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-card/60 disabled:opacity-40`,children:(0,q.jsx)(vp,{className:`w-3.5 h-3.5`})})]}),(0,q.jsxs)(`div`,{className:`relative inline-block max-w-full max-h-full`,children:[(0,q.jsx)(`img`,{ref:y,src:e.screenshotDataUrl,alt:o(`editor.capturedAlt`),onLoad:x,draggable:!1,className:`block max-w-full max-h-full select-none rounded shadow-2xl`}),b.map(e=>e.kind===`blur`?(0,q.jsx)(`div`,{className:`absolute backdrop-blur-md bg-background-deep/10 border border-border/40 pointer-events-none rounded-sm`,style:{left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.w*100}%`,height:`${e.h*100}%`}},e.id):null),p&&l===`blur`&&A&&(0,q.jsx)(`div`,{className:`absolute backdrop-blur-md bg-background-deep/10 border border-accent-info pointer-events-none rounded-sm`,style:{left:`${A.x*100}%`,top:`${A.y*100}%`,width:`${A.w*100}%`,height:`${A.h*100}%`}}),(0,q.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full ${l===`text`||l===`step`?`cursor-pointer`:`cursor-crosshair`}`,viewBox:`0 0 ${h.w} ${h.h}`,preserveAspectRatio:`none`,onPointerDown:C,onPointerMove:w,onPointerUp:T,children:[b.map(e=>{if(e.kind===`box`)return(0,q.jsx)(`rect`,{x:k(e.x,`w`),y:k(e.y,`h`),width:k(e.w,`w`),height:k(e.h,`h`),fill:`none`,stroke:e.color,strokeWidth:Math.max(2,h.w*.004)},e.id);if(e.kind===`arrow`){let t=XD(e.from,e.to,.035),n=Math.max(2,h.w*.004);return(0,q.jsxs)(`g`,{stroke:e.color,strokeWidth:n,strokeLinecap:`round`,fill:`none`,children:[(0,q.jsx)(`line`,{x1:k(e.from.x,`w`),y1:k(e.from.y,`h`),x2:k(e.to.x,`w`),y2:k(e.to.y,`h`)}),(0,q.jsx)(`polyline`,{points:`${k(t.left.x,`w`)},${k(t.left.y,`h`)} ${k(e.to.x,`w`)},${k(e.to.y,`h`)} ${k(t.right.x,`w`)},${k(t.right.y,`h`)}`})]},e.id)}if(e.kind===`text`)return(0,q.jsx)(`text`,{x:k(e.x,`w`),y:k(e.y,`h`),dominantBaseline:`hanging`,fontSize:Math.max(12,h.h*.03),fontWeight:600,fill:e.color,stroke:`rgba(0,0,0,0.55)`,strokeWidth:1,paintOrder:`stroke`,children:e.text},e.id);if(e.kind===`step`){let t=Math.max(10,h.h*.025);return(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`circle`,{cx:k(e.x,`w`),cy:k(e.y,`h`),r:t,fill:e.color}),(0,q.jsx)(`text`,{x:k(e.x,`w`),y:k(e.y,`h`),textAnchor:`middle`,dominantBaseline:`central`,fontSize:t*1.1,fontWeight:700,fill:`#000`,children:e.n})]},e.id)}return null}),p&&l===`box`&&A&&(0,q.jsx)(`rect`,{x:k(A.x,`w`),y:k(A.y,`h`),width:k(A.w,`w`),height:k(A.h,`h`),fill:`none`,stroke:d,strokeDasharray:`4 3`,strokeWidth:Math.max(2,h.w*.004)}),p&&l===`arrow`&&(0,q.jsx)(`line`,{x1:k(p.start.x,`w`),y1:k(p.start.y,`h`),x2:k(p.cur.x,`w`),y2:k(p.cur.y,`h`),stroke:d,strokeWidth:Math.max(2,h.w*.004),strokeLinecap:`round`})]}),_&&(0,q.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center gap-2 bg-background-deep/50 text-sm text-foreground`,children:[(0,q.jsx)(Yf,{className:`w-4 h-4 animate-spin`}),` `,o(`common:states.saving`)]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(Z,{size:`sm`,variant:`ghost`,className:`gap-1.5`,onClick:i,disabled:_,children:[(0,q.jsx)(Wd,{className:`w-3.5 h-3.5`}),` `,o(`editor.reselect`)]}),(0,q.jsxs)(Z,{size:`sm`,variant:`ghost`,className:`gap-1.5`,onClick:O,disabled:_,children:[(0,q.jsx)(qp,{className:`w-3.5 h-3.5`}),` `,o(`common:actions.cancel`)]}),(0,q.jsxs)(Z,{size:`sm`,className:`gap-1.5`,onClick:()=>void D(),disabled:_,"data-testid":`annotation-confirm`,children:[(0,q.jsx)(nf,{className:`w-3.5 h-3.5`}),` `,b.length>0?o(`editor.createSpec`):o(`editor.skipContinue`)]})]})]})}function aO(){return typeof window>`u`||!(`__TAURI_INTERNALS__`in window)?!1:/mac/i.test(navigator.platform)}var oO={desktop:{w:1280,h:800},tablet:{w:768,h:1024},mobile:{w:375,h:667}};function sO({open:e,onClose:t,projectId:n,pendingSpecId:r,onCaptured:i}){let{t:a}=G(`browser`),o=GD({projectId:n,open:e}),{canvasRef:s,viewport:c,status:l,errorMsg:u,url:d,title:f,hoverRect:p,hoverSelector:m,hoverPath:h}=o,[g,_]=(0,I.useState)(``),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(null),[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(`fit`),[E,D]=(0,I.useState)(!0),[O,k]=(0,I.useState)(!1),[A,j]=(0,I.useState)(null),[M,N]=(0,I.useState)(null),P=(0,I.useRef)(null),F=(0,I.useRef)(null),L=(0,I.useRef)(null),ee=(0,I.useRef)(`fit`),te=(0,I.useRef)(null),R=(0,I.useRef)(0),z=(0,I.useRef)(null),B=(0,I.useRef)(null),V=(0,I.useRef)(o.navigateElement);(0,I.useEffect)(()=>{z.current=M},[M]),(0,I.useEffect)(()=>{B.current=m},[m]),V.current=o.navigateElement,(0,I.useEffect)(()=>{_(d??``)},[d]);let ne=(0,I.useCallback)(()=>{let e=g.trim();e&&o.navigate(`goto`,e)},[g,o]),H=(0,I.useCallback)(()=>{let e=P.current;if(!e)return;let t=e.getBoundingClientRect();t.width>0&&t.height>0&&o.setViewport(t.width,t.height)},[o]),U=(0,I.useCallback)(e=>{T(e),ee.current=e,e===`fit`?H():o.setViewport(oO[e].w,oO[e].h)},[H,o]);(0,I.useEffect)(()=>{if(!e)return;let t=P.current;if(!t||typeof ResizeObserver>`u`)return;let n=null,r=new ResizeObserver(()=>{ee.current===`fit`&&(n&&clearTimeout(n),n=setTimeout(()=>{let e=t.getBoundingClientRect();e.width>0&&e.height>0&&o.setViewport(e.width,e.height)},150))});return r.observe(t),()=>{n&&clearTimeout(n),r.disconnect()}},[e,o]),(0,I.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(v?(y(!1),x(null),N(null)):t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,v,t]),(0,I.useEffect)(()=>{if(!e||!v)return;let t=e=>{if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;let t=z.current?.selector??B.current;t&&(e.preventDefault(),V.current(t,e.key===`ArrowUp`?`parent`:`child`).then(e=>{e&&N(e)}))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,v]);let re=(0,I.useCallback)(()=>{let e=s.current?.getBoundingClientRect()??null;return e&&(te.current={left:e.left,top:e.top,width:e.width,height:e.height}),e},[s]),ie=(0,I.useCallback)((e,t)=>{let n=re();return n?BD({x:e,y:t},{left:n.left,top:n.top,width:n.width,height:n.height},c):{x:0,y:0}},[re,c]),W=(0,I.useCallback)(()=>{L.current=null;let e=F.current;e&&(F.current=null,o.forwardInput({type:`mouse`,action:`move`,x:e.x,y:e.y}))},[o]),ae=(0,I.useCallback)(e=>{v||(F.current=ie(e.clientX,e.clientY),L.current??=requestAnimationFrame(W))},[v,ie,W]),oe=e=>e===2?`right`:e===1?`middle`:`left`,se=(0,I.useCallback)(e=>{if(v)return;let t=ie(e.clientX,e.clientY);o.forwardInput({type:`mouse`,action:`down`,x:t.x,y:t.y,button:oe(e.button),clickCount:e.detail||1})},[v,ie,o]),ce=(0,I.useCallback)(e=>{if(v)return;let t=ie(e.clientX,e.clientY);o.forwardInput({type:`mouse`,action:`up`,x:t.x,y:t.y,button:oe(e.button),clickCount:e.detail||1})},[v,ie,o]),le=(0,I.useCallback)(e=>{if(v)return;let t=ie(e.clientX,e.clientY);o.forwardInput({type:`wheel`,x:t.x,y:t.y,deltaX:e.deltaX,deltaY:e.deltaY})},[v,ie,o]),ue=(0,I.useCallback)(e=>{if(v||e.key===`Escape`)return;let t=e.metaKey||e.ctrlKey;if(t&&(e.key===`c`||e.key===`v`||e.key===`x`)){e.preventDefault();let t=e.key;(async()=>{try{if(t===`v`){let e=await navigator.clipboard.readText();e&&await o.clipboard(`paste`,e)}else{let{text:e}=await o.clipboard(t===`x`?`cut`:`copy`);e&&await navigator.clipboard.writeText(e)}}catch{}})();return}let n={type:`key`,action:`down`,key:e.key,code:e.code,text:!t&&e.key.length===1?e.key:void 0};o.forwardInput(n),(e.key===`Tab`||e.key===` `||e.key.startsWith(`Arrow`))&&e.preventDefault()},[v,o]),de=(0,I.useCallback)(e=>{v||e.key===`Escape`||o.forwardInput({type:`key`,action:`up`,key:e.key,code:e.code})},[v,o]),fe=(0,I.useCallback)(async e=>{C(!0);try{if(O){let n={x:e.x+e.width/2,y:e.y+e.height/2};i(await o.captureBreakpoints(e,n,r,DD)),K.success(a(`modal.toast.captured`)),t()}else j(await o.capture(e,r,{captureNetwork:E}))}catch{K.error(a(`modal.toast.captureFailed`))}finally{C(!1),y(!1),x(null),N(null),o.clearHover()}},[o,r,E,O,i,t,a]),pe=(0,I.useCallback)(e=>{o.navigateElement(e.selector,`self`).then(e=>{e&&N(e)})},[o]),me=(0,I.useCallback)(e=>{e.target.setPointerCapture?.(e.pointerId),x({startX:e.clientX,startY:e.clientY,curX:e.clientX,curY:e.clientY})},[]),he=(0,I.useCallback)(e=>{if(b){let t=e.clientX,n=e.clientY;x(e=>e&&{...e,curX:t,curY:n});return}z.current&&N(null),F.current=ie(e.clientX,e.clientY),L.current??=requestAnimationFrame(()=>{L.current=null;let e=typeof performance<`u`?performance.now():Date.now();if(e-R.current<40)return;R.current=e;let t=F.current;t&&o.probe(t)})},[b,ie,o]),ge=(0,I.useCallback)(e=>{let t=z.current;x(n=>{if(n){let r=HD(ie(n.startX,n.startY),ie(e.clientX,e.clientY));UD(r)?fe(r):t?fe(t.rect):p&&fe(p)}return null})},[ie,p,fe]),_e=(0,I.useCallback)(e=>{e.target===e.currentTarget&&t()},[t]);if(!e||typeof document>`u`)return null;let ve=b?{left:Math.min(b.startX,b.curX),top:Math.min(b.startY,b.curY),width:Math.abs(b.startX-b.curX),height:Math.abs(b.startY-b.curY)}:null,ye=te.current,be=M?.rect??p,xe=M?.path??h,Se=v&&be&&!b&&ye?VD(be,ye,c):null,Ce=aO();return(0,Qn.createPortal)((0,q.jsx)(`div`,{className:`fixed inset-0 z-[80] bg-background-deep/50 backdrop-blur-sm pointer-events-auto`,onClick:_e,children:(0,q.jsx)(`div`,{className:`absolute inset-2 flex flex-col border border-border rounded-lg bg-background-deep overflow-hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":a(`modal.dialogLabel`),onClick:e=>e.stopPropagation(),children:A?(0,q.jsx)(iO,{result:A,pendingSpecId:r,macOverlay:Ce,onConfirm:e=>{i(e),t()},onReselect:()=>{j(null),y(!0)},onCancel:()=>{j(null),t()}}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5 border-b border-border/50 bg-surface/80 shrink-0 ${Ce?`pr-3`:`px-3`}`,children:[Ce&&(0,q.jsx)(`div`,{"data-tauri-drag-region":!0,className:`w-20 self-stretch shrink-0`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":a(`common:actions.back`),onClick:()=>o.navigate(`back`),children:(0,q.jsx)(Wd,{className:`w-4 h-4`})}),(0,q.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":a(`modal.nav.forward`),onClick:()=>o.navigate(`forward`),children:(0,q.jsx)(Gd,{className:`w-4 h-4`})}),(0,q.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":a(`modal.nav.reload`),onClick:()=>o.navigate(`reload`),children:(0,q.jsx)(Sp,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`form`,{className:`flex-1 flex items-center gap-2 min-w-0`,onSubmit:e=>{e.preventDefault(),ne()},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0 rounded-md border border-border bg-background px-2.5 py-1`,children:[(0,q.jsx)(Rf,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),(0,q.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ne())},placeholder:a(`modal.address.placeholder`),"aria-label":a(`modal.address.label`),className:`flex-1 min-w-0 bg-transparent outline-none text-sm`})]}),(0,q.jsx)(Z,{type:`submit`,size:`sm`,variant:`secondary`,className:`shrink-0`,disabled:l===`error`,children:a(`modal.address.go`)})]}),(0,q.jsx)(`div`,{className:`hidden md:flex items-center gap-0.5 rounded-md border border-border/50 p-0.5 shrink-0`,role:`group`,"aria-label":a(`modal.viewport.groupLabel`),children:[[`fit`,Zf],[`desktop`,np],[`tablet`,Ip],[`mobile`,jp]].map(([e,t])=>(0,q.jsx)(`button`,{type:`button`,"aria-label":a(`modal.viewport.presetLabel`,{preset:a(`modal.viewport.${e}`)}),"aria-pressed":w===e,title:a(`modal.viewport.presetTitle`,{preset:a(`modal.viewport.${e}`)}),onClick:()=>U(e),className:`h-7 w-7 inline-flex items-center justify-center rounded transition-colors ${w===e?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-card/60`}`,children:(0,q.jsx)(t,{className:`w-3.5 h-3.5`})},e))}),(0,q.jsxs)(`button`,{type:`button`,"aria-label":a(`modal.network.ariaLabel`),"aria-pressed":E,title:a(E?`modal.network.titleOn`:`modal.network.titleOff`),onClick:()=>D(e=>!e),className:`hidden md:inline-flex items-center gap-1 h-7 px-2 rounded-md border text-[11px] shrink-0 transition-colors ${E?`border-accent-info/40 bg-accent-info/10 text-accent-info`:`border-border/50 text-muted-foreground hover:text-foreground hover:bg-card/60`}`,children:[(0,q.jsx)(rp,{className:`w-3.5 h-3.5`}),a(`modal.network.button`)]}),(0,q.jsxs)(`button`,{type:`button`,"aria-label":a(`modal.allSizes.ariaLabel`),"aria-pressed":O,title:a(O?`modal.allSizes.titleOn`:`modal.allSizes.titleOff`),onClick:()=>k(e=>!e),className:`hidden md:inline-flex items-center gap-1 h-7 px-2 rounded-md border text-[11px] shrink-0 transition-colors ${O?`border-accent-highlight/40 bg-accent-highlight/10 text-accent-highlight`:`border-border/50 text-muted-foreground hover:text-foreground hover:bg-card/60`}`,children:[(0,q.jsx)(gp,{className:`w-3.5 h-3.5`}),a(`modal.allSizes.button`)]}),(0,q.jsxs)(Z,{size:`sm`,variant:v?`default`:`secondary`,className:`gap-1.5`,onClick:()=>{y(e=>!e),x(null),N(null),o.clearHover()},disabled:l!==`ready`||S,"data-testid":`browser-select-toggle`,children:[(0,q.jsx)(Sf,{className:`w-3.5 h-3.5`}),a(v?`modal.select.active`:`modal.select.start`)]}),(0,q.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":a(`modal.closeBrowser`),onClick:t,children:(0,q.jsx)(qp,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`div`,{className:`px-3 py-1 text-[11px] text-muted-foreground truncate shrink-0 flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full shrink-0 ${l===`ready`?`bg-accent-success`:l===`error`?`bg-destructive`:`bg-accent-warning animate-pulse`}`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`truncate`,children:l===`connecting`?a(`modal.status.connecting`):l===`error`?u??a(`modal.status.unavailable`):f||``})]}),(0,q.jsxs)(`div`,{ref:P,className:`relative flex-1 min-h-0 overflow-hidden flex items-center justify-center outline-none`,tabIndex:0,onKeyDown:ue,onKeyUp:de,children:[l===`error`?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center max-w-md px-6`,children:[(0,q.jsx)(Hp,{className:`w-8 h-8 text-accent-warning`}),(0,q.jsx)(`p`,{className:`text-sm text-foreground/90`,children:u??a(`modal.error.unavailable`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,q.jsx)(Bi,{i18nKey:`modal.error.devHint`,t:a,components:{cmd:(0,q.jsx)(`code`,{className:`font-mono`})}})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`canvas`,{ref:s,className:`max-w-full max-h-full block shadow-2xl ${v?`cursor-crosshair`:`cursor-default`}`,onPointerMove:ae,onPointerDown:se,onPointerUp:ce,onContextMenu:e=>e.preventDefault(),onWheel:le}),v&&(0,q.jsx)(`div`,{className:`absolute inset-0 cursor-crosshair`,onPointerDown:me,onPointerMove:he,onPointerUp:ge}),l===`connecting`&&(0,q.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,q.jsx)(Yf,{className:`w-4 h-4 animate-spin`}),` `,a(`modal.status.opening`)]}),S&&(0,q.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center gap-2 text-sm text-foreground bg-background-deep/40`,children:[(0,q.jsx)(Yf,{className:`w-4 h-4 animate-spin`}),` `,a(`modal.status.capturing`)]})]}),Se&&(0,q.jsx)(`div`,{className:`fixed border-2 border-accent-info bg-accent-info/10 pointer-events-none z-[81]`,style:{left:Se.left,top:Se.top,width:Se.width,height:Se.height}}),ve&&(0,q.jsx)(`div`,{className:`fixed border-2 border-accent-primary bg-accent-primary/10 pointer-events-none z-[81]`,style:ve})]}),v&&xe&&xe.length>0&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-1.5 border-t border-border/40 bg-surface/70 shrink-0 overflow-x-auto text-[11px]`,children:[M?(0,q.jsx)(Xf,{className:`w-3 h-3 shrink-0 text-accent-info`}):null,xe.map((e,t)=>(0,q.jsxs)(I.Fragment,{children:[t>0&&(0,q.jsx)(of,{className:`w-3 h-3 text-muted-foreground/50 shrink-0`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>pe(e),title:e.selector,className:`shrink-0 font-mono px-1 rounded hover:bg-card/60 transition-colors ${t===xe.length-1?`text-accent-info font-medium`:`text-foreground/70`}`,children:e.label})]},`${e.selector}-${t}`)),(0,q.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0 ml-auto pl-2 hidden md:inline`,children:a(`modal.breadcrumb.hint`)})]}),v&&(0,q.jsx)(`div`,{className:`px-3 py-1.5 text-center text-[11px] text-muted-foreground border-t border-border/40 shrink-0`,children:a(`modal.select.hint`)})]})})}),document.body)}function cO(e,t){t.push({type:`punct`,text:`<`});let n=1;e[n]===`/`&&(t.push({type:`punct`,text:`/`}),n++);let r=/^[a-zA-Z][a-zA-Z0-9-]*/.exec(e.slice(n));r&&(t.push({type:`tag`,text:r[0]}),n+=r[0].length);let i=e.slice(n,e.length-1),a=/(\s+)|([a-zA-Z_:][-a-zA-Z0-9_:.]*)|(=)|("[^"]*"|'[^']*')|(\/)/g,o;for(;(o=a.exec(i))!==null;)o[1]?t.push({type:`text`,text:o[1]}):o[2]?t.push({type:`attr`,text:o[2]}):o[3]?t.push({type:`punct`,text:`=`}):o[4]?t.push({type:`value`,text:o[4]}):o[5]&&t.push({type:`punct`,text:`/`});t.push({type:`punct`,text:`>`})}function lO(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`<`,n);if(r===-1){n<e.length&&t.push({type:`text`,text:e.slice(n)});break}r>n&&t.push({type:`text`,text:e.slice(n,r)});let i=e.indexOf(`>`,r);if(i===-1){t.push({type:`text`,text:e.slice(r)});break}cO(e.slice(r,i+1),t),n=i+1}return t}var uO={tag:`text-accent-info`,attr:`text-accent-secondary`,value:`text-accent-success`,punct:`text-muted-foreground`,text:`text-foreground/80`};function dO(e){try{let t=new URL(e);return t.host+t.pathname}catch{return e}}var fO=4e4;function pO({html:e}){let t=(0,I.useMemo)(()=>e.length>fO?null:lO(e),[e]);return t?(0,q.jsx)(q.Fragment,{children:t.map((e,t)=>(0,q.jsx)(`span`,{className:uO[e.type],children:e.text},t))}):(0,q.jsx)(q.Fragment,{children:e})}function mO({dom:e,onRemove:t}){let{t:n}=G(`browser`),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(!1),p=WD(e),m=e.designTokens,h=m?Object.entries(m.anchor):[],g=!!m&&(m.palette.length>0||h.length>0),_=e.networkRequests??[],v=_.length>0,y=(()=>{try{return new URL(e.url).host}catch{return e.url}})();return(0,q.jsxs)(`div`,{className:`rounded-lg border border-accent-secondary/40 bg-accent-secondary/5 text-xs`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:`flex items-center gap-2 flex-1 min-w-0 text-left text-foreground/90 hover:text-foreground transition-colors`,children:[(0,q.jsx)(of,{className:`w-3.5 h-3.5 shrink-0 transition-transform ${r?`rotate-90`:``}`}),(0,q.jsx)(hf,{className:`w-3.5 h-3.5 shrink-0 text-accent-secondary`}),(0,q.jsx)(`span`,{className:`truncate font-medium`,children:n(`domPanel.header`,{title:e.title||y})})]}),(0,q.jsxs)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground tabular-nums`,children:[n(`domPanel.badge.elements`,{count:p.nodeCount}),e.css?` · CSS`:``,g?` · ${n(`domPanel.badge.tokens`)}`:``,v?` · ${n(`domPanel.badge.requests`,{count:_.length})}`:``,p.truncated?` · ${n(`domPanel.badge.truncated`)}`:``]}),t&&(0,q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`domPanel.removeLabel`),className:`shrink-0 text-muted-foreground/60 hover:text-destructive transition-colors`,children:(0,q.jsx)(qp,{className:`w-3.5 h-3.5`})})]}),r&&(0,q.jsxs)(`div`,{className:`border-t border-accent-secondary/30`,children:[(0,q.jsx)(`div`,{className:`px-3 py-1.5 text-[10px] text-muted-foreground truncate`,title:e.url,children:e.url}),(0,q.jsx)(`pre`,{className:`max-h-64 overflow-auto px-3 pb-3 text-[11px] leading-relaxed whitespace-pre-wrap break-words font-mono`,"data-testid":`captured-dom-html`,children:e.html?(0,q.jsx)(pO,{html:e.html}):n(`domPanel.noMarkup`)}),e.css&&(0,q.jsxs)(`div`,{className:`border-t border-accent-secondary/30`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":a,className:`flex items-center gap-2 w-full px-3 py-2 text-left text-foreground/90 hover:text-foreground transition-colors`,children:[(0,q.jsx)(of,{className:`w-3.5 h-3.5 shrink-0 transition-transform ${a?`rotate-90`:``}`}),(0,q.jsx)(ap,{className:`w-3.5 h-3.5 shrink-0 text-accent-highlight`}),(0,q.jsx)(`span`,{className:`font-medium`,children:e.cssTruncated?n(`domPanel.appliedCssTruncated`):n(`domPanel.appliedCss`)})]}),a&&(0,q.jsx)(`pre`,{className:`max-h-64 overflow-auto px-3 pb-3 text-[11px] leading-relaxed whitespace-pre-wrap break-words font-mono text-accent-success/90`,"data-testid":`captured-dom-css`,children:e.css})]}),g&&m&&(0,q.jsxs)(`div`,{className:`border-t border-accent-secondary/30`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>c(e=>!e),"aria-expanded":s,className:`flex items-center gap-2 w-full px-3 py-2 text-left text-foreground/90 hover:text-foreground transition-colors`,children:[(0,q.jsx)(of,{className:`w-3.5 h-3.5 shrink-0 transition-transform ${s?`rotate-90`:``}`}),(0,q.jsx)(up,{className:`w-3.5 h-3.5 shrink-0 text-accent-highlight`}),(0,q.jsx)(`span`,{className:`font-medium`,children:n(`domPanel.designTokens`)})]}),s&&(0,q.jsxs)(`div`,{className:`px-3 pb-3 space-y-2`,"data-testid":`captured-dom-tokens`,children:[m.palette.length>0&&(0,q.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:m.palette.map((e,t)=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-border/50 px-1.5 py-0.5 font-mono text-[10px] text-foreground/80`,children:[(0,q.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-sm border border-border/40`,style:{background:e},"aria-hidden":!0}),e]},t))}),h.length>0&&(0,q.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 font-mono text-[11px]`,children:h.map(([e,t])=>(0,q.jsxs)(I.Fragment,{children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,q.jsx)(`dd`,{className:`text-accent-success/90 break-all`,children:t})]},e))}),m.fonts.length>0&&(0,q.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[n(`domPanel.fonts`),` `,(0,q.jsx)(`span`,{className:`font-mono text-foreground/80 break-all`,children:m.fonts.join(`, `)})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{try{navigator.clipboard?.writeText(JSON.stringify(m,null,2)),f(!0),setTimeout(()=>f(!1),1500)}catch{}},className:`text-[10px] text-accent-info hover:underline`,children:n(d?`domPanel.copied`:`domPanel.copyJson`)})]})]}),v&&(0,q.jsxs)(`div`,{className:`border-t border-accent-secondary/30`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),"aria-expanded":l,className:`flex items-center gap-2 w-full px-3 py-2 text-left text-foreground/90 hover:text-foreground transition-colors`,children:[(0,q.jsx)(of,{className:`w-3.5 h-3.5 shrink-0 transition-transform ${l?`rotate-90`:``}`}),(0,q.jsx)(rp,{className:`w-3.5 h-3.5 shrink-0 text-accent-info`}),(0,q.jsx)(`span`,{className:`font-medium`,children:n(`domPanel.network`,{count:_.length})})]}),l&&(0,q.jsx)(`div`,{className:`max-h-64 overflow-auto px-3 pb-3 space-y-1.5`,"data-testid":`captured-dom-network`,children:_.map((e,t)=>(0,q.jsxs)(`div`,{className:`font-mono text-[11px] leading-snug`,children:[(0,q.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,q.jsx)(`span`,{className:`text-accent-highlight shrink-0`,children:e.method}),(0,q.jsx)(`span`,{className:`shrink-0 tabular-nums ${e.failed?`text-destructive`:(e.status??0)>=400?`text-accent-warning`:`text-accent-success/90`}`,children:e.failed?`ERR`:e.status??`…`}),(0,q.jsx)(`span`,{className:`truncate flex-1 text-foreground/80`,title:e.url,children:dO(e.url)}),e.durationMs!=null&&(0,q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.durationMs,`ms`]})]}),e.responseShape&&(0,q.jsxs)(`div`,{className:`pl-4 text-accent-info/80 break-all whitespace-pre-wrap`,children:[`→ `,e.responseShape]})]},t))})]})]})]})}var hO={critical:`bg-destructive/15 text-destructive`,high:`bg-accent-warning/15 text-accent-warning`,medium:`bg-accent-info/15 text-accent-info`,low:`bg-muted text-muted-foreground`},gO=[`critical`,`high`,`medium`,`low`];function _O(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function vO({open:e,onClose:t,tickets:n,onExploreLaunch:r}){let{t:i}=G(`addspec`),{t:a}=G(`jira`),o=sb(),{activeProjectId:s,projects:c}=Sd(),l=EE(),[u,d]=(0,I.useState)(`quick`),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(0),[v,y]=(0,I.useState)(()=>_O()),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)([]),w=ED(),T=(0,I.useRef)(null),E=(0,I.useRef)(!1),D=(0,I.useRef)(!1),[O,k]=(0,I.useState)(``),A=(0,I.useRef)(!1),[j,M]=(0,I.useState)(`medium`),[N,P]=(0,I.useState)([]),[F,L]=(0,I.useState)(null),{model:ee,setModel:te,allowed:R,loading:z,provider:B,providers:V}=qE(s,e,F);(0,I.useEffect)(()=>{!e||F||V.length===0||L(yD(s,V,B??`claude`))},[e,F,V,B,s]);let ne=(0,I.useCallback)(e=>{L(e),bD(s,e)},[s]),H=F??B,{scope:U,setScope:re,persist:ie}=xD(s,u,e),W=CD(s,e),{data:ae,isError:oe}=SD(s,e),se=(0,I.useMemo)(()=>tD(U),[U]),ce=JE(H);(0,I.useEffect)(()=>{u!==`quick`||!W.loaded||D.current||re(e=>({...e,contractRefine:W.value}))},[u,W.loaded,W.value,re]);let le=(0,I.useCallback)(e=>{D.current=!0,re(e)},[re]);(0,I.useEffect)(()=>{D.current=!1},[u]);let ue=(0,I.useRef)(s);(0,I.useEffect)(()=>{ue.current=s},[s]);let de=(0,I.useRef)(c);(0,I.useEffect)(()=>{de.current=c},[c]),(0,I.useEffect)(()=>{e&&(y(_O()),d(`quick`),p(!1),h(!1),_(0),L(null),x(!1),C([]),k(``),M(`medium`),P([]),E.current=!1,D.current=!1,A.current=!1,setTimeout(()=>{T.current?.resetHeight(),T.current?.focus()},50))},[e]),(0,I.useEffect)(()=>{!e&&!E.current&&g>0&&kE(v).catch(e=>console.warn(`[ProposeSpec] cleanup failed:`,e))},[e]);let fe=(0,I.useMemo)(()=>(m||S.length>0)&&!f,[m,S.length,f]),pe=(0,I.useCallback)(e=>{if(e.rawScreenshot&&e.rawScreenshot.id!==e.screenshot.id){let t=ue.current;fetch(`${sl}/api/projects/${t}/tickets/${v}/attachments/${e.rawScreenshot.id}`,{method:`DELETE`}).catch(()=>{})}let t=e.breakpoints?Object.entries(e.breakpoints).map(([e,t])=>({key:e,attachmentId:t.attachment.id,dataUrl:t.dataUrl,width:t.viewport.width})):void 0;C(n=>[...n,{screenshotId:e.screenshot.id,screenshotName:e.screenshot.filename,screenshotDataUrl:e.screenshotDataUrl,domAttachmentId:e.domAttachment.id,dom:e.dom,breakpoints:t}]),_(e=>e+1+(t?t.length:1))},[v]),me=(0,I.useCallback)(e=>{C(t=>t.filter(t=>t.domAttachmentId!==e.domAttachmentId));let t=new Set([e.screenshotId,e.domAttachmentId,...e.breakpoints?.map(e=>e.attachmentId)??[]]);_(e=>Math.max(0,e-t.size));let n=ue.current;for(let e of t)fetch(`${sl}/api/projects/${n}/tickets/${v}/attachments/${e}`,{method:`DELETE`}).catch(()=>{})},[v]),he=(0,I.useCallback)(async()=>{let e=(T.current?.getPlainText().trim()??``)||(S.length>0?`Create a spec based on the captured browser selection (a screenshot and the page DOM are attached for reference).`:``);if(!e)return;let a=S.find(e=>e.breakpoints&&e.breakpoints.length>1);if(a){let t=a.breakpoints.map(e=>`${e.width}px`).join(`, `);e+=`${e?`
|
|
70
|
+
|
|
71
|
+
`:``}This element must be responsive: reference screenshots are attached at ${t}.`}let o=[...T.current?.getAttachmentIds()??[],...S.flatMap(e=>[...e.breakpoints?e.breakpoints.map(e=>e.attachmentId):[e.screenshotId],e.domAttachmentId])],s=ue.current;if(!s)return;if(u===`free`){let e=T.current?.getPlainText().trim()??``;if(!e)return;let n=T.current?.getAttachmentIds()??[];E.current=!0,p(!0);try{let r=await fetch(`${sl}/api/projects/${s}/tickets/from-prompt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({description:e,title:O.trim()||void 0,labels:N.length>0?N:void 0,priority:j,structured:!1,attachmentIds:n,pendingSpecId:v})});if(!r.ok){E.current=!1,K.error(i(`proposeModal.toast.createFailed`));return}let a=(await r.json().catch(()=>({}))).ticket?.id;K.success(a?i(`proposeModal.toast.rawSavedWithId`,{id:a}):i(`proposeModal.toast.rawCreated`)),t()}catch(e){E.current=!1,console.error(`[ProposeSpec] from-prompt failed:`,e),K.error(i(`proposeModal.toast.createFailed`))}finally{p(!1)}return}if(u===`explore`){if(!r){K.error(i(`proposeModal.toast.exploreNotWired`));return}E.current=!0,ie(U),r({idea:e,pendingSpecId:v,initialAttachmentIds:o,model:ee??`sonnet`,provider:H??void 0,contextScope:U}),t();return}let c=de.current.find(e=>e.id===s)?.name??`Project`,d=`spec-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,f=e.length>45?e.slice(0,45)+`…`:e,m=new Set(n.map(e=>e.id)),g=Date.now();K.loading(`${c} · ${f}`,{id:d,description:i(`proposeModal.toast.generating`)}),E.current=!0,W.persist(U.contractRefine),p(!0),T.current?.clear(),_(0),h(!1),C([]);let y={toastId:d,truncated:f,knownTicketIds:m,projectId:s,projectName:c,startTime:g,persistId:d};try{let t;try{t=await fetch(`${sl}/api/projects/${s}/tickets/generate-spec`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({idea:e,attachmentIds:o,pendingSpecId:v,model:ee??void 0,aiEngine:H??void 0,contextScope:{specrails:U.specrails,openspec:U.openspec,full:U.full,mcp:U.mcp,userMcp:U.userMcp,contractRefine:U.contractRefine},contractRefine:U.contractRefine})})}catch(e){console.error(`[ProposeSpec] generate-spec fetch threw:`,e),K.error(i(`proposeModal.toast.failedToStart`,{projectName:c}),{id:d});return}if(!t.ok){K.error(i(`proposeModal.toast.failedToStart`,{projectName:c}),{id:d});return}let n=await t.json();l.registerFastSpec(n.requestId,y)}finally{p(!1)}},[u,n,l,v,t,r,ee,W,U,H,S,O,j,N,i]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Gy,{open:e,modal:!b,onOpenChange:e=>{!e&&!b&&t()},children:(0,q.jsxs)(Jy,{className:`max-w-4xl flex flex-col gap-0 p-0 overflow-hidden`,children:[(0,q.jsxs)(Yy,{className:`px-5 py-4 border-b border-border/40 shrink-0`,children:[(0,q.jsxs)(Zy,{className:`text-sm flex items-center gap-2`,children:[(0,q.jsx)(Mp,{className:`w-4 h-4 text-primary/70`}),i(`proposeModal.title`)]}),(0,q.jsx)(Qy,{className:`sr-only`,children:i(`proposeModal.dialogDescription`)})]}),(0,q.jsxs)(`div`,{className:`flex flex-col p-5 gap-4 flex-1 min-h-0 overflow-y-auto`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(yO,{value:u,onChange:d,fullCodebase:U.full}),u!==`free`&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)($E,{value:H??`claude`,providers:V,onChange:ne,disabled:z,ariaLabel:i(`proposeModal.engineAriaLabel`)}),(0,q.jsx)(KE,{value:ee,allowed:R,loading:z,onChange:te})]})]}),u!==`free`&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(gD,{value:U,onChange:le,budget:ae,budgetError:oe,model:ee??`sonnet`,maxPresetId:u===`quick`?`max`:`desktop`,smashCapable:ce}),(0,q.jsx)(lD,{scope:U,mode:u,onChange:le,label:i(`contextScope.fineTune`),showSummary:!1})]}),u===`free`&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 animate-in fade-in slide-in-from-bottom-1 duration-150`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`label`,{htmlFor:`raw-spec-title`,className:`text-xs font-medium text-muted-foreground whitespace-nowrap`,children:i(`proposeModal.raw.titleLabel`)}),(0,q.jsx)(`input`,{id:`raw-spec-title`,type:`text`,value:O,onChange:e=>{A.current=!0,k(e.target.value)},placeholder:i(`proposeModal.raw.titlePlaceholder`),"data-testid":`raw-title-input`,className:`flex-1 h-8 px-2.5 rounded-md bg-card/40 border border-border/40 text-sm text-foreground placeholder-muted-foreground/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-info/40 focus-visible:border-accent-info/60 transition-colors`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4 flex-wrap`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:i(`proposeModal.raw.priorityLabel`)}),(0,q.jsx)(`div`,{role:`radiogroup`,"aria-label":i(`proposeModal.raw.priorityLabel`),"data-testid":`raw-priority-group`,className:`inline-flex items-center gap-1 p-1 rounded-lg border border-border/50 bg-card/40`,children:gO.map(e=>(0,q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":j===e,tabIndex:j===e?0:-1,onClick:()=>M(e),onKeyDown:e=>{let t=gO.indexOf(j);e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),M(gO[Math.min(t+1,gO.length-1)])):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&(e.preventDefault(),M(gO[Math.max(t-1,0)]))},className:`px-2 py-1 rounded-md text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-info/40 ${j===e?hO[e]:`text-muted-foreground hover:text-foreground hover:bg-card/60`}`,children:i(`proposeModal.priority.${e}`)},e))})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-[12rem]`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:i(`proposeModal.raw.labelsLabel`)}),(0,q.jsxs)(`div`,{className:`flex-1 flex items-center flex-wrap gap-1 px-2 py-1 rounded-md border border-border/40 bg-card/40`,children:[N.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info text-[10px] font-medium`,children:[e,(0,q.jsx)(`button`,{type:`button`,"aria-label":i(`proposeModal.raw.removeLabel`,{label:e}),onClick:()=>P(t=>t.filter(t=>t!==e)),className:`text-accent-info/60 hover:text-accent-info`,children:`×`})]},e)),(0,q.jsx)(`input`,{type:`text`,"aria-label":i(`proposeModal.raw.addLabelAria`),"data-testid":`raw-label-input`,placeholder:N.length?``:i(`proposeModal.raw.labelPlaceholder`),className:`flex-1 min-w-[4rem] bg-transparent text-xs text-foreground placeholder-muted-foreground/50 focus-visible:outline-none`,onKeyDown:e=>{let t=e.target,n=t.value.trim();e.key===`Enter`&&n?(e.preventDefault(),P(e=>e.includes(n)?e:[...e,n]),t.value=``):e.key===`Backspace`&&!n&&N.length&&P(e=>e.slice(0,-1))}})]})]})]})]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(u===`quick`?`proposeModal.modeDescription.quick`:u===`explore`?`proposeModal.modeDescription.explore`:`proposeModal.modeDescription.raw`)}),(0,q.jsx)(GE,{ref:T,ticketKey:v,placeholder:i(u===`quick`?`proposeModal.editorPlaceholder.quick`:u===`explore`?`proposeModal.editorPlaceholder.explore`:`proposeModal.editorPlaceholder.raw`),minHeight:u===`free`?220:160,autoFocus:!0,ariaLabel:i(u===`free`?`proposeModal.raw.bodyAriaLabel`:`proposeModal.ideaAriaLabel`),onChange:()=>{let e=T.current?.getPlainText()??``;h(e.trim().length>0),u===`free`&&!A.current&&k(e.split(`
|
|
72
|
+
`).find(e=>e.trim().length>0)?.trim().slice(0,120)??``)},onAttachmentAdded:()=>_(e=>e+1),onAttachmentRemoved:e=>{_(e=>Math.max(0,e-1)),fetch(`${sl}/api/projects/${ue.current}/tickets/${v}/attachments/${e.id}`,{method:`DELETE`}).catch(()=>{})},onUnsupportedFile:e=>K.error(i(`proposeModal.toast.unsupportedFileType`,{name:e.name})),onUploadError:(e,t)=>K.error(i(`proposeModal.toast.uploadFailed`,{name:t.name,message:e.message})),onSubmit:he,footerExtra:u!==`free`&&w&&s?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>x(!0),"data-testid":`from-browser-btn`,title:i(`proposeModal.fromWebsiteTitle`),className:`inline-flex items-center gap-1 px-2 py-1 rounded-md border border-accent-info/50 text-accent-info hover:bg-accent-info/10 transition-colors font-medium`,children:[(0,q.jsx)(Rf,{className:`w-3.5 h-3.5`}),(0,q.jsx)(`span`,{children:i(`proposeModal.fromWebsite`)})]}):void 0}),u!==`free`&&S.length>0&&(0,q.jsx)(`div`,{className:`space-y-3`,"data-testid":`captured-dom-list`,children:S.map(e=>(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`rounded-lg border border-accent-secondary/40 bg-accent-secondary/5 p-2 space-y-1.5`,children:[e.breakpoints?(0,q.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":`capture-breakpoints`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium text-accent-highlight`,children:[(0,q.jsx)(gp,{className:`w-3 h-3 shrink-0`}),i(`proposeModal.capture.responsiveSizes`,{count:e.breakpoints.length})]}),(0,q.jsx)(`div`,{className:`flex items-end justify-center gap-2 flex-wrap`,children:e.breakpoints.map(e=>(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,q.jsx)(`img`,{src:e.dataUrl,alt:`${e.key} (${e.width}px)`,className:`max-h-36 w-auto max-w-[10rem] object-contain rounded border border-border/60 bg-background-deep block`}),(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[e.key,` · `,e.width,`px`]})]},e.key))})]}):(0,q.jsx)(`img`,{src:e.screenshotDataUrl,alt:e.screenshotName,className:`max-h-44 w-auto max-w-full object-contain rounded border border-border/60 bg-background-deep mx-auto block`}),e.dom.url&&e.dom.url!==`about:blank`&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground`,title:e.dom.url,children:[(0,q.jsx)(Rf,{className:`w-3 h-3 shrink-0`}),(0,q.jsx)(`span`,{className:`truncate`,children:e.dom.url})]})]}),(0,q.jsx)(mO,{dom:e.dom,onRemove:()=>me(e)})]},e.domAttachmentId))}),o.connected&&u===`quick`&&(0,q.jsx)(`div`,{className:`flex items-center justify-end text-[11px]`,"data-testid":`jira-create-indicator`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-info`,children:[(0,q.jsx)(fp,{className:`w-3 h-3`}),a(`addSpec.willCreate`,{key:o.jiraProjectKey??``})]})}),(0,q.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,q.jsxs)(Z,{size:`sm`,onClick:he,disabled:!fe,title:fe?void 0:i(`proposeModal.submit.disabledTitle`),className:`gap-1.5 ${u===`free`?`bg-accent-info text-white hover:bg-accent-info/90`:nD(se)}`,"data-testid":`propose-submit`,children:[u===`free`?(0,q.jsx)(cp,{className:`w-3.5 h-3.5`}):(0,q.jsx)(Dp,{className:`w-3.5 h-3.5`}),i(u===`quick`?`proposeModal.submit.quick`:u===`explore`?`proposeModal.submit.explore`:`proposeModal.submit.raw`)]})})]})]})}),w&&b&&s&&(0,q.jsx)(sO,{open:b,onClose:()=>x(!1),projectId:s,pendingSpecId:v,onCaptured:pe})]})}function yO({value:e,onChange:t,fullCodebase:n}){let{t:r}=G(`addspec`);return(0,q.jsxs)(`div`,{role:`tablist`,"aria-label":r(`proposeModal.modeTablistLabel`),className:`inline-flex items-center gap-1 p-1 rounded-lg border border-border/50 bg-card/40 self-start`,children:[(0,q.jsx)(bO,{active:e===`quick`,icon:(0,q.jsx)(Jp,{className:`w-3.5 h-3.5`}),label:r(`proposeModal.mode.quick`),hint:sD({specrails:!1,openspec:!1,full:n,mcp:!1,contractRefine:!1}),onClick:()=>t(`quick`)}),(0,q.jsx)(bO,{active:e===`explore`,icon:(0,q.jsx)($f,{className:`w-3.5 h-3.5`}),label:r(`proposeModal.mode.explore`),hint:r(`proposeModal.mode.exploreHint`),onClick:()=>t(`explore`)}),(0,q.jsx)(bO,{active:e===`free`,icon:(0,q.jsx)(cp,{className:`w-3.5 h-3.5`}),label:r(`proposeModal.mode.raw`),hint:r(`proposeModal.mode.rawHint`),onClick:()=>t(`free`)})]})}function bO({active:e,icon:t,label:n,hint:r,onClick:i}){return(0,q.jsxs)(`button`,{role:`tab`,type:`button`,"aria-selected":e,onClick:i,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${e?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-card/60`}`,children:[t,n,(0,q.jsx)(`span`,{className:`text-[10px] ${e?`text-primary/60`:`text-muted-foreground/60`}`,children:r})]})}function xO(){}function SO(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var CO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TO={};function EO(e,t){return((t||TO).jsx?wO:CO).test(e)}var DO=/[ \t\n\f\r]/g;function OO(e){return typeof e==`object`?e.type===`text`?kO(e.value):!1:kO(e)}function kO(e){return e.replace(DO,``)===``}var AO=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};AO.prototype.normal={},AO.prototype.property={},AO.prototype.space=void 0;function jO(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new AO(n,r,t)}function MO(e){return e.toLowerCase()}var NO=class{constructor(e,t){this.attribute=t,this.property=e}};NO.prototype.attribute=``,NO.prototype.booleanish=!1,NO.prototype.boolean=!1,NO.prototype.commaOrSpaceSeparated=!1,NO.prototype.commaSeparated=!1,NO.prototype.defined=!1,NO.prototype.mustUseProperty=!1,NO.prototype.number=!1,NO.prototype.overloadedBoolean=!1,NO.prototype.property=``,NO.prototype.spaceSeparated=!1,NO.prototype.space=void 0;var PO=e({boolean:()=>IO,booleanish:()=>LO,commaOrSpaceSeparated:()=>VO,commaSeparated:()=>BO,number:()=>Q,overloadedBoolean:()=>RO,spaceSeparated:()=>zO}),FO=0,IO=HO(),LO=HO(),RO=HO(),Q=HO(),zO=HO(),BO=HO(),VO=HO();function HO(){return 2**++FO}var UO=Object.keys(PO),WO=class extends NO{constructor(e,t,n,r){let i=-1;if(super(e,t),GO(this,`space`,r),typeof n==`number`)for(;++i<UO.length;){let e=UO[i];GO(this,UO[i],(n&PO[e])===PO[e])}}};WO.prototype.defined=!0;function GO(e,t,n){n&&(e[t]=n)}function KO(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new WO(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[MO(r)]=r,n[MO(a.attribute)]=r}return new AO(t,n,e.space)}var qO=KO({properties:{ariaActiveDescendant:null,ariaAtomic:LO,ariaAutoComplete:null,ariaBusy:LO,ariaChecked:LO,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:zO,ariaCurrent:null,ariaDescribedBy:zO,ariaDetails:null,ariaDisabled:LO,ariaDropEffect:zO,ariaErrorMessage:null,ariaExpanded:LO,ariaFlowTo:zO,ariaGrabbed:LO,ariaHasPopup:null,ariaHidden:LO,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zO,ariaLevel:Q,ariaLive:null,ariaModal:LO,ariaMultiLine:LO,ariaMultiSelectable:LO,ariaOrientation:null,ariaOwns:zO,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:LO,ariaReadOnly:LO,ariaRelevant:null,ariaRequired:LO,ariaRoleDescription:zO,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:LO,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function JO(e,t){return t in e?e[t]:t}function YO(e,t){return JO(e,t.toLowerCase())}var XO=KO({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:BO,acceptCharset:zO,accessKey:zO,action:null,allow:null,allowFullScreen:IO,allowPaymentRequest:IO,allowUserMedia:IO,alt:null,as:null,async:IO,autoCapitalize:null,autoComplete:zO,autoFocus:IO,autoPlay:IO,blocking:zO,capture:null,charSet:null,checked:IO,cite:null,className:zO,cols:Q,colSpan:null,content:null,contentEditable:LO,controls:IO,controlsList:zO,coords:Q|BO,crossOrigin:null,data:null,dateTime:null,decoding:null,default:IO,defer:IO,dir:null,dirName:null,disabled:IO,download:RO,draggable:LO,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:IO,formTarget:null,headers:zO,height:Q,hidden:RO,high:Q,href:null,hrefLang:null,htmlFor:zO,httpEquiv:zO,id:null,imageSizes:null,imageSrcSet:null,inert:IO,inputMode:null,integrity:null,is:null,isMap:IO,itemId:null,itemProp:zO,itemRef:zO,itemScope:IO,itemType:zO,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:IO,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:IO,muted:IO,name:null,nonce:null,noModule:IO,noValidate:IO,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:IO,optimum:Q,pattern:null,ping:zO,placeholder:null,playsInline:IO,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:IO,referrerPolicy:null,rel:zO,required:IO,reversed:IO,rows:Q,rowSpan:Q,sandbox:zO,scope:null,scoped:IO,seamless:IO,selected:IO,shadowRootClonable:IO,shadowRootDelegatesFocus:IO,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:LO,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:IO,useMap:null,value:LO,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zO,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:IO,declare:IO,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:IO,noHref:IO,noShade:IO,noWrap:IO,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:LO,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:IO,disableRemotePlayback:IO,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:YO}),ZO=KO({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,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`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,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`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,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`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:VO,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:zO,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:IO,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:BO,g2:BO,glyphName:BO,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:VO,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zO,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:VO,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:VO,rev:VO,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:VO,requiredFeatures:VO,requiredFonts:VO,requiredFormats:VO,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:VO,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:VO,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:VO,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:JO}),QO=KO({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),$O=KO({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:YO}),ek=KO({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),tk={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},nk=/[A-Z]/g,rk=/-[a-z]/g,ik=/^data[-\w.:]+$/i;function ak(e,t){let n=MO(t),r=t,i=NO;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ik.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(rk,sk);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!rk.test(e)){let n=e.replace(nk,ok);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=WO}return new i(r,t)}function ok(e){return`-`+e.toLowerCase()}function sk(e){return e.charAt(1).toUpperCase()}var ck=jO([qO,XO,QO,$O,ek],`html`),lk=jO([qO,ZO,QO,$O,ek],`svg`);function uk(e){return e.join(` `).trim()}var dk=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
73
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),fk=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(dk());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),pk=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),mk=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(fk()),r=pk();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),hk=_k(`end`),gk=_k(`start`);function _k(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function vk(e){let t=gk(e),n=hk(e);if(t&&n)return{start:t,end:n}}function yk(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?xk(e.position):`start`in e||`end`in e?xk(e):`line`in e||`column`in e?bk(e):``}function bk(e){return Sk(e&&e.line)+`:`+Sk(e&&e.column)}function xk(e){return bk(e&&e.start)+`-`+bk(e&&e.end)}function Sk(e){return e&&typeof e==`number`?e:1}var Ck=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=yk(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Ck.prototype.file=``,Ck.prototype.name=``,Ck.prototype.reason=``,Ck.prototype.message=``,Ck.prototype.stack=``,Ck.prototype.column=void 0,Ck.prototype.line=void 0,Ck.prototype.ancestors=void 0,Ck.prototype.cause=void 0,Ck.prototype.fatal=void 0,Ck.prototype.place=void 0,Ck.prototype.ruleId=void 0,Ck.prototype.source=void 0;var wk=t(mk(),1),Tk={}.hasOwnProperty,Ek=new Map,Dk=/[A-Z]/g,Ok=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),kk=new Set([`td`,`th`]),Ak=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function jk(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Hk(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Vk(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?lk:ck,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Mk(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Mk(e,t,n){if(t.type===`element`)return Nk(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Pk(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ik(e,t,n);if(t.type===`mdxjsEsm`)return Fk(e,t);if(t.type===`root`)return Lk(e,t,n);if(t.type===`text`)return Rk(e,t)}function Nk(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=lk,e.schema=i),e.ancestors.push(t);let a=Jk(e,t.tagName,!1),o=Uk(e,t),s=Gk(e,t);return Ok.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!OO(e):!0})),zk(e,o,a,t),Bk(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Pk(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Yk(e,t.position)}function Fk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Yk(e,t.position)}function Ik(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=lk,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Jk(e,t.name,!0),o=Wk(e,t),s=Gk(e,t);return zk(e,o,a,t),Bk(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Lk(e,t,n){let r={};return Bk(r,Gk(e,t)),e.create(t,e.Fragment,r,n)}function Rk(e,t){return t.value}function zk(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Bk(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Vk(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Hk(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=gk(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Uk(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Tk.call(t.properties,i)){let a=Kk(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&kk.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Wk(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Yk(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Yk(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Gk(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ek;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Mk(e,a,o);s!==void 0&&n.push(s)}return n}function Kk(e,t,n){let r=ak(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?SO(n):uk(n)),r.property===`style`){let t=typeof n==`object`?n:qk(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Xk(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?tk[r.property]||r.property:r.attribute,n]}}function qk(e,t){try{return(0,wk.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Ck("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Ak+`#cannot-parse-style-attribute`,r}}function Jk(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=EO(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=EO(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Tk.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Yk(e)}function Yk(e,t){let n=new Ck("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Ak+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Xk(e){let t={},n;for(n in e)Tk.call(e,n)&&(t[Zk(n)]=e[n]);return t}function Zk(e){let t=e.replace(Dk,Qk);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Qk(e){return`-`+e.toLowerCase()}var $k={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},eA={};function tA(e,t){let n=t||eA;return nA(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function nA(e,t,n){if(iA(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return rA(e.children,t,n)}return Array.isArray(e)?rA(e,t,n):``}function rA(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=nA(e[i],t,n);return r.join(``)}function iA(e){return!!(e&&typeof e==`object`)}var aA=document.createElement(`i`);function oA(e){let t=`&`+e+`;`;aA.innerHTML=t;let n=aA.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function sA(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function cA(e,t){return e.length>0?(sA(e,e.length,0,t),e):t}var lA={}.hasOwnProperty;function uA(e){let t={},n=-1;for(;++n<e.length;)dA(t,e[n]);return t}function dA(e,t){let n;for(n in t){let r=(lA.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){lA.call(r,a)||(r[a]=[]);let e=i[a];fA(r[a],Array.isArray(e)?e:e?[e]:[])}}}function fA(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);sA(e,0,0,r)}function pA(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function mA(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var hA=DA(/[A-Za-z]/),gA=DA(/[\dA-Za-z]/),_A=DA(/[#-'*+\--9=?A-Z^-~]/);function vA(e){return e!==null&&(e<32||e===127)}var yA=DA(/\d/),bA=DA(/[\dA-Fa-f]/),xA=DA(/[!-/:-@[-`{-~]/);function SA(e){return e!==null&&e<-2}function CA(e){return e!==null&&(e<0||e===32)}function wA(e){return e===-2||e===-1||e===32}var TA=DA(/\p{P}|\p{S}/u),EA=DA(/\s/);function DA(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function OA(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&gA(e.charCodeAt(n+1))&&gA(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function kA(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return wA(r)?(e.enter(n),s(r)):t(r)}function s(r){return wA(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var AA={tokenize:jA};function jA(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),kA(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return SA(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var MA={tokenize:PA},NA={tokenize:FA};function PA(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return sA(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(NA,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(NA,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return SA(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;sA(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function FA(e,t,n){return kA(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function IA(e){if(e===null||CA(e)||EA(e))return 1;if(TA(e))return 2}function LA(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var RA={name:`attention`,resolveAll:zA,tokenize:BA};function zA(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};VA(d,-c),VA(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=cA(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=cA(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=cA(l,LA(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=cA(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=cA(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,sA(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function BA(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=IA(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=IA(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function VA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var HA={name:`autolink`,tokenize:UA};function UA(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return hA(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||gA(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||gA(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||vA(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):_A(t)?(e.consume(t),l):n(t)}function u(e){return gA(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||gA(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var WA={partial:!0,tokenize:GA};function GA(e,t,n){return r;function r(t){return wA(t)?kA(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||SA(e)?t(e):n(e)}}var KA={continuation:{tokenize:JA},exit:YA,name:`blockQuote`,tokenize:qA};function qA(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return wA(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function JA(e,t,n){let r=this;return i;function i(t){return wA(t)?kA(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(KA,t,n)(r)}}function YA(e){e.exit(`blockQuote`)}var XA={name:`characterEscape`,tokenize:ZA};function ZA(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return xA(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var QA={name:`characterReference`,tokenize:$A};function $A(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=gA,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=bA,u):(e.enter(`characterReferenceValue`),a=7,o=yA,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===gA&&!oA(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var ej={partial:!0,tokenize:rj},tj={concrete:!0,name:`codeFenced`,tokenize:nj};function nj(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),wA(t)?kA(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||SA(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(ej,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||SA(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):wA(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),kA(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||SA(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||SA(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&wA(t)?kA(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||SA(t)?e.check(ej,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||SA(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),wA(t)?kA(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),wA(t)?kA(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||SA(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function rj(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ij={name:`codeIndented`,tokenize:oj},aj={partial:!0,tokenize:sj};function oj(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),kA(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):SA(t)?e.attempt(aj,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||SA(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function sj(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):SA(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):kA(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):SA(e)?i(e):n(e)}}var cj={name:`codeText`,previous:uj,resolve:lj,tokenize:dj};function lj(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function uj(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function dj(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):SA(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||SA(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var fj=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&pj(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),pj(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),pj(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);pj(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);pj(this.left,t.reverse())}}};function pj(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function mj(e){let t={},n=-1,r,i,a,o,s,c,l,u=new fj(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,hj(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return sA(e,0,1/0,u.slice(0)),!l}function hj(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var gj={resolve:vj,tokenize:yj},_j={partial:!0,tokenize:bj};function vj(e){return mj(e),e}function yj(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):SA(t)?e.check(_j,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function bj(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),kA(e,a,`linePrefix`)}function a(i){if(i===null||SA(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function xj(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||vA(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||SA(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||CA(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||vA(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Sj(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):SA(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||SA(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!wA(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Cj(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):SA(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),kA(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||SA(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function wj(e,t){let n;return r;function r(i){return SA(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):wA(i)?kA(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Tj={name:`definition`,tokenize:Dj},Ej={partial:!0,tokenize:Oj};function Dj(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Sj.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=mA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return CA(t)?wj(e,l)(t):l(t)}function l(t){return xj(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ej,d,d)(t)}function d(t){return wA(t)?kA(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||SA(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Oj(e,t,n){return r;function r(t){return CA(t)?wj(e,i)(t):n(t)}function i(t){return Cj(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return wA(t)?kA(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||SA(e)?t(e):n(e)}}var kj={name:`hardBreakEscape`,tokenize:Aj};function Aj(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return SA(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var jj={name:`headingAtx`,resolve:Mj,tokenize:Nj};function Mj(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},sA(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Nj(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||CA(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||SA(n)?(e.exit(`atxHeading`),t(n)):wA(n)?kA(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||CA(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Pj=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Fj=[`pre`,`script`,`style`,`textarea`],Ij={concrete:!0,name:`htmlFlow`,resolveTo:zj,tokenize:Bj},Lj={partial:!0,tokenize:Hj},Rj={partial:!0,tokenize:Vj};function zj(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Bj(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):hA(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):hA(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return hA(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||CA(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Fj.includes(l)?(i=1,r.interrupt?t(s):O(s)):Pj.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||gA(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return wA(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||hA(t)?(e.consume(t),b):wA(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||gA(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):wA(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):wA(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||SA(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||CA(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||wA(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||SA(t)?O(t):wA(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):SA(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Lj,ee,k)(t)):t===null||SA(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Rj,A,ee)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||SA(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Fj.includes(n)?(e.consume(t),L):O(t)}return hA(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||SA(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),L)}function ee(n){return e.exit(`htmlFlow`),t(n)}}function Vj(e,t,n){let r=this;return i;function i(t){return SA(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Hj(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(WA,t,n)}}var Uj={name:`htmlText`,tokenize:Wj};function Wj(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):hA(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):hA(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):SA(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):SA(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):SA(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):SA(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return hA(t)?(e.consume(t),S):n(t)}function S(t){return t===45||gA(t)?(e.consume(t),S):C(t)}function C(t){return SA(t)?(o=C,N(t)):wA(t)?(e.consume(t),C):M(t)}function w(t){return t===45||gA(t)?(e.consume(t),w):t===47||t===62||CA(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||hA(t)?(e.consume(t),E):SA(t)?(o=T,N(t)):wA(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||gA(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):SA(t)?(o=D,N(t)):wA(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):SA(t)?(o=O,N(t)):wA(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):SA(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||CA(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||CA(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return wA(t)?kA(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Gj={name:`labelEnd`,resolveAll:Yj,resolveTo:Xj,tokenize:Zj},Kj={tokenize:Qj},qj={tokenize:$j},Jj={tokenize:eM};function Yj(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&sA(e,0,e.length,n),e}function Xj(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=cA(s,e.slice(a+1,a+r+3)),s=cA(s,[[`enter`,u,t]]),s=cA(s,LA(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=cA(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=cA(s,e.slice(o+1)),s=cA(s,[[`exit`,c,t]]),sA(e,a,e.length,s),e}function Zj(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(mA(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Kj,u,o?u:d)(t):t===91?e.attempt(qj,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Jj,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Qj(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return CA(t)?wj(e,a)(t):a(t)}function a(t){return t===41?u(t):xj(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return CA(t)?wj(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Cj(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return CA(t)?wj(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function $j(e,t,n){let r=this;return i;function i(t){return Sj.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(mA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function eM(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var tM={name:`labelStartImage`,resolveAll:Gj.resolveAll,tokenize:nM};function nM(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var rM={name:`labelStartLink`,resolveAll:Gj.resolveAll,tokenize:iM};function iM(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var aM={name:`lineEnding`,tokenize:oM};function oM(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),kA(e,t,`linePrefix`)}}var sM={name:`thematicBreak`,tokenize:cM};function cM(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||SA(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),wA(t)?kA(e,s,`whitespace`)(t):s(t))}}var lM={continuation:{tokenize:pM},exit:hM,name:`list`,tokenize:fM},uM={partial:!0,tokenize:gM},dM={partial:!0,tokenize:mM};function fM(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:yA(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(sM,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return yA(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(WA,r.interrupt?n:u,e.attempt(uM,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return wA(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function pM(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(WA,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,kA(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!wA(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(dM,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,kA(e,e.attempt(lM,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function mM(e,t,n){let r=this;return kA(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function hM(e){e.exit(this.containerState.type)}function gM(e,t,n){let r=this;return kA(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!wA(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var _M={name:`setextUnderline`,resolveTo:vM,tokenize:yM};function vM(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function yM(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),wA(t)?kA(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||SA(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var bM={tokenize:xM};function xM(e){let t=this,n=e.attempt(WA,r,e.attempt(this.parser.constructs.flowInitial,i,kA(e,e.attempt(this.parser.constructs.flow,i,e.attempt(gj,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var SM={resolveAll:EM()},CM=TM(`string`),wM=TM(`text`);function TM(e){return{resolveAll:EM(e===`text`?DM:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function EM(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function DM(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var OM=e({attentionMarkers:()=>IM,contentInitial:()=>AM,disable:()=>LM,document:()=>kM,flow:()=>MM,flowInitial:()=>jM,insideSpan:()=>FM,string:()=>NM,text:()=>PM}),kM={42:lM,43:lM,45:lM,48:lM,49:lM,50:lM,51:lM,52:lM,53:lM,54:lM,55:lM,56:lM,57:lM,62:KA},AM={91:Tj},jM={[-2]:ij,[-1]:ij,32:ij},MM={35:jj,42:sM,45:[_M,sM],60:Ij,61:_M,95:sM,96:tj,126:tj},NM={38:QA,92:XA},PM={[-5]:aM,[-4]:aM,[-3]:aM,33:tM,38:QA,42:RA,60:[HA,Uj],91:rM,92:[kj,XA],93:Gj,95:RA,96:cj},FM={null:[RA,SM]},IM={null:[42,95]},LM={null:[]};function RM(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=cA(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=LA(a,l.events,l),l.events):[]}function f(e,t){return BM(p(e),t)}function p(e){return zM(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){SA(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&sA(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function zM(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function BM(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
74
|
+
`;break;case-3:o=`\r
|
|
75
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function VM(e){let t={constructs:uA([OM,...(e||{}).extensions||[]]),content:n(AA),defined:[],document:n(MA),flow:n(bM),lazy:{},string:n(CM),text:n(wM)};return t;function n(e){return n;function n(n){return RM(t,e,n)}}}function HM(e){for(;!mj(e););return e}var UM=/[\0\t\n\r]/g;function WM(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(UM.lastIndex=u,c=UM.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var GM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function KM(e){return e.replace(GM,qM)}function qM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return pA(n.slice(t?2:1),t?16:10)}return oA(n)||e}var JM={}.hasOwnProperty;function YM(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),XM(n)(HM(VM(n).document().write(WM()(e,t,!0))))}function XM(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ue),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(oe),blockQuote:a(U),characterEscape:T,characterReference:T,codeFenced:a(re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(re,o),codeText:a(ie,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(W),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ae),hardBreakEscape:a(se),hardBreakTrailing:a(se),htmlFlow:a(ce,o),htmlFlowData:T,htmlText:a(ce,o),htmlTextData:T,image:a(le),label:o,link:a(ue),listItem:a(fe),listItemValue:f,listOrdered:a(de,d),listUnordered:a(de),paragraph:a(pe),reference:te,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(oe),strong:a(me),thematicBreak:a(ge)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:H,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:B,characterReference:V,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:R,resourceDestinationString:I,resourceTitleString:L,resource:ee,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};QM(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];JM.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||eN).call(a,void 0,e[0])}for(r.position={start:ZM(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ZM(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:ZM(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||eN).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+yk({start:e.start,end:e.end})+`): it’s not open`);n.position.end=ZM(e.end)}function u(){return tA(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=mA(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=he(),n.position={start:ZM(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ZM(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=ZM(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=KM(t),n.identifier=mA(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){this.data.inReference=void 0}function te(){this.data.referenceType=`collapsed`}function R(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=mA(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function z(e){this.data.characterReferenceType=e.type}function B(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=pA(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=oA(t);let i=this.stack[this.stack.length-1];i.value+=r}function V(e){let t=this.stack.pop();t.position.end=ZM(e.end)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function H(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function U(){return{type:`blockquote`,children:[]}}function re(){return{type:`code`,lang:null,meta:null,value:``}}function ie(){return{type:`inlineCode`,value:``}}function W(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ae(){return{type:`emphasis`,children:[]}}function oe(){return{type:`heading`,depth:0,children:[]}}function se(){return{type:`break`}}function ce(){return{type:`html`,value:``}}function le(){return{type:`image`,title:null,url:``,alt:null}}function ue(){return{type:`link`,title:null,url:``,children:[]}}function de(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function fe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function pe(){return{type:`paragraph`,children:[]}}function me(){return{type:`strong`,children:[]}}function he(){return{type:`text`,value:``}}function ge(){return{type:`thematicBreak`}}}function ZM(e){return{line:e.line,column:e.column,offset:e.offset}}function QM(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?QM(e,r):$M(e,r)}}function $M(e,t){let n;for(n in t)if(JM.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function eN(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+yk({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yk({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+yk({start:t.start,end:t.end})+`) is still open`)}function tN(e){let t=this;t.parser=n;function n(n){return YM(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function nN(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function rN(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
76
|
+
`}]}function iN(e,t){let n=t.value?t.value+`
|
|
77
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function aN(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oN(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sN(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=OA(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function cN(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lN(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function uN(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function dN(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uN(e,t);let i={src:OA(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function fN(e,t){let n={src:OA(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function pN(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function mN(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uN(e,t);let i={href:OA(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function hN(e,t){let n={href:OA(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gN(e,t,n){let r=e.all(t),i=n?_N(n):vN(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
78
|
+
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
79
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function _N(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=vN(n[r])}return t}function vN(e){return e.spread??e.children.length>1}function yN(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function bN(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xN(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function SN(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CN(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=gk(t.children[1]),o=hk(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function wN(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function TN(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var EN=9,DN=32;function ON(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(kN(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(kN(t.slice(i),i>0,!1)),a.join(``)}function kN(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===EN||t===DN;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===EN||t===DN;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function AN(e,t){let n={type:`text`,value:ON(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function jN(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var MN={blockquote:nN,break:rN,code:iN,delete:aN,emphasis:oN,footnoteReference:sN,heading:cN,html:lN,imageReference:dN,image:fN,inlineCode:pN,linkReference:mN,link:hN,listItem:gN,list:yN,paragraph:bN,root:xN,strong:SN,table:CN,tableCell:TN,tableRow:wN,text:AN,thematicBreak:jN,toml:NN,yaml:NN,definition:NN,footnoteDefinition:NN};function NN(){}var PN=typeof self==`object`?self:globalThis,FN=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new PN[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new PN[a](o),i)};return r},IN=e=>FN(new Map,e)(0),LN=``,{toString:RN}={},{keys:zN}=Object,BN=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=RN.call(e).slice(8,-1);switch(n){case`Array`:return[1,LN];case`Object`:return[2,LN];case`Date`:return[3,LN];case`RegExp`:return[4,LN];case`Map`:return[5,LN];case`Set`:return[6,LN];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},VN=([e,t])=>e===0&&(t===`function`||t===`symbol`),HN=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=BN(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of zN(r))(e||!VN(BN(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(VN(BN(n))||VN(BN(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!VN(BN(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},UN=(e,{json:t,lossy:n}={})=>{let r=[];return HN(!(t||n),!!t,new Map,r)(e),r},WN=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?IN(UN(e,t)):structuredClone(e):(e,t)=>IN(UN(e,t));function GN(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function KN(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function qN(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||GN,r=e.options.footnoteBackLabel||KN,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=OA(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...WN(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
80
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
81
|
+
`}]}}var JN=(function(e){if(e==null)return $N;if(typeof e==`function`)return QN(e);if(typeof e==`object`)return Array.isArray(e)?YN(e):XN(e);if(typeof e==`string`)return ZN(e);throw Error(`Expected function, string, or object as test`)});function YN(e){let t=[],n=-1;for(;++n<e.length;)t[n]=JN(e[n]);return QN(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function XN(e){let t=e;return QN(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ZN(e){return QN(t);function t(t){return t&&t.type===e}}function QN(e){return t;function t(t,n,r){return!!(eP(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function $N(){return!0}function eP(e){return typeof e==`object`&&!!e&&`type`in e}function tP(e){return e}var nP=[];function rP(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=JN(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+tP(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=nP,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=iP(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function iP(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?nP:[e]}function aP(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),rP(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var oP={}.hasOwnProperty,sP={};function cP(e,t){let n=t||sP,r=new Map,i=new Map,a={all:s,applyData:uP,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...MN,...n.handlers},one:o,options:n,patch:lP,wrap:fP};return aP(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(oP.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=WN(n);return r.children=a.all(e),r}return WN(e)}return(a.options.unknownHandler||dP)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=pP(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=pP(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function lP(e,t){e.position&&(t.position=vk(e))}function uP(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,WN(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function dP(e,t){let n=t.data||{},r=`value`in t&&!(oP.call(n,`hProperties`)||oP.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function fP(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
82
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
83
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
84
|
+
`}),n}function pP(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function mP(e,t){let n=cP(e,t),r=n.one(e,void 0),i=qN(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
85
|
+
`},i)),a}function hP(e,t){return e&&`run`in e?async function(n,r){let i=mP(n,{file:r,...t});await e.run(i,r)}:function(n,r){return mP(n,{file:r,...e||t})}}function gP(e){if(e)throw e}var _P=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function vP(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function yP(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?bP(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function bP(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var xP={basename:SP,dirname:CP,extname:wP,join:TP,sep:`/`};function SP(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);OP(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function CP(e){if(OP(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function wP(e){OP(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function TP(...e){let t=-1,n;for(;++t<e.length;)OP(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:EP(n)}function EP(e){OP(e);let t=e.codePointAt(0)===47,n=DP(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function DP(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function OP(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var kP={cwd:AP};function AP(){return`/`}function jP(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function MP(e){if(typeof e==`string`)e=new URL(e);else if(!jP(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return NP(e)}function NP(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var PP=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],FP=class{constructor(e){let t;t=e?jP(e)?{path:e}:typeof e==`string`||zP(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:kP.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<PP.length;){let e=PP[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)PP.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?xP.basename(this.path):void 0}set basename(e){LP(e,`basename`),IP(e,`basename`),this.path=xP.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?xP.dirname(this.path):void 0}set dirname(e){RP(this.basename,`dirname`),this.path=xP.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?xP.extname(this.path):void 0}set extname(e){if(IP(e,`extname`),RP(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=xP.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){jP(e)&&(e=MP(e)),LP(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?xP.basename(this.path,this.extname):void 0}set stem(e){LP(e,`stem`),IP(e,`stem`),this.path=xP.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Ck(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function IP(e,t){if(e&&e.includes(xP.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+xP.sep+"`")}function LP(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function RP(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function zP(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var BP=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),VP=t(_P(),1),HP={}.hasOwnProperty,UP=new class e extends BP{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=yP()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,VP.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(KP(`data`,this.frozen),this.namespace[e]=t,this):HP.call(this.namespace,e)&&this.namespace[e]||void 0:e?(KP(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=YP(e),n=this.parser||this.Parser;return WP(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),WP(`process`,this.parser||this.Parser),GP(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=YP(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);ZP(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),WP(`processSync`,this.parser||this.Parser),GP(`processSync`,this.compiler||this.Compiler),this.process(e,r),JP(`processSync`,`process`,t),n;function r(e,r){t=!0,gP(e),n=r}}run(e,t,n){qP(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=YP(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),JP(`runSync`,`run`,n),r;function i(e,t){gP(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=YP(t),r=this.compiler||this.Compiler;return GP(`stringify`,r),qP(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(KP(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,VP.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];vP(o)&&vP(r)&&(r=(0,VP.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function WP(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function GP(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function KP(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function qP(e){if(!vP(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function JP(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function YP(e){return XP(e)?e:new FP(e)}function XP(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function ZP(e){return typeof e==`string`||QP(e)}function QP(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var $P=[],eF={allowDangerousHtml:!0},tF=/^(https?|ircs?|mailto|xmpp)$/i,nF=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function rF(e){let t=iF(e),n=aF(e);return oF(t.runSync(t.parse(n),n),e)}function iF(e){let t=e.rehypePlugins||$P,n=e.remarkPlugins||$P,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...eF}:eF;return UP().use(tN).use(n).use(hP,r).use(t)}function aF(e){let t=e.children||``,n=new FP;return typeof t==`string`?n.value=t:``+t,n}function oF(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||sF;for(let e of nF)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return aP(e,l),jk(e,{Fragment:q.Fragment,components:i,ignoreInvalidStyle:!0,jsx:q.jsx,jsxs:q.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in $k)if(Object.hasOwn($k,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=$k[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function sF(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||tF.test(e.slice(0,t))?e:``}function cF(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function lF(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function uF(e,t,n){let r=JN((n||{}).ignore||[]),i=dF(t),a=-1;for(;++a<i.length;)rP(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function dF(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([fF(e[0]),pF(e[1])])}return t}function fF(e){return typeof e==`string`?new RegExp(lF(e),`g`):e}function pF(e){return typeof e==`function`?e:function(){return e}}var mF=`phrasing`,hF=[`autolink`,`link`,`image`,`label`];function gF(){return{transforms:[wF],enter:{literalAutolink:vF,literalAutolinkEmail:yF,literalAutolinkHttp:yF,literalAutolinkWww:yF},exit:{literalAutolink:CF,literalAutolinkEmail:SF,literalAutolinkHttp:bF,literalAutolinkWww:xF}}}function _F(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:mF,notInConstruct:hF},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:mF,notInConstruct:hF},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:mF,notInConstruct:hF}]}}function vF(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function yF(e){this.config.enter.autolinkProtocol.call(this,e)}function bF(e){this.config.exit.autolinkProtocol.call(this,e)}function xF(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function SF(e){this.config.exit.autolinkEmail.call(this,e)}function CF(e){this.exit(e)}function wF(e){uF(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,TF],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,EF]],{ignore:[`link`,`linkReference`]})}function TF(e,t,n,r,i){let a=``;if(!kF(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!DF(n)))return!1;let o=OF(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function EF(e,t,n,r){return!kF(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function DF(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function OF(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=cF(e,`(`),a=cF(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function kF(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||EA(n)||TA(n))&&(!t||n!==47)}zF.peek=RF;function AF(){this.buffer()}function jF(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function MF(){this.buffer()}function NF(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function PF(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=mA(this.sliceSerialize(e)).toLowerCase(),n.label=t}function FF(e){this.exit(e)}function IF(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=mA(this.sliceSerialize(e)).toLowerCase(),n.label=t}function LF(e){this.exit(e)}function RF(){return`[`}function zF(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function BF(){return{enter:{gfmFootnoteCallString:AF,gfmFootnoteCall:jF,gfmFootnoteDefinitionLabelString:MF,gfmFootnoteDefinition:NF},exit:{gfmFootnoteCallString:PF,gfmFootnoteCall:FF,gfmFootnoteDefinitionLabelString:IF,gfmFootnoteDefinition:LF}}}function VF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:zF},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
86
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?UF:HF))),s(),o}}function HF(e,t,n){return t===0?e:UF(e,t,n)}function UF(e,t,n){return(n?``:` `)+e}var WF=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];YF.peek=XF;function GF(){return{canContainEols:[`delete`],enter:{strikethrough:qF},exit:{strikethrough:JF}}}function KF(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:WF}],handlers:{delete:YF}}}function qF(e){this.enter({type:`delete`,children:[]},e)}function JF(e){this.exit(e)}function YF(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function XF(){return`~`}function ZF(e){return e.length}function QF(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||ZF,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=$F(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=eI(r[d]);else{let e=eI(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
87
|
+
`)}function $F(e){return e==null?``:String(e)}function eI(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function tI(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),nI);return i(),o}function nI(e,t,n){return`>`+(n?``:` `)+e}function rI(e,t){return iI(e,t.inConstruct,!0)&&!iI(e,t.notInConstruct,!1)}function iI(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function aI(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
88
|
+
`&&rI(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
89
|
+
`}function oI(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function sI(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function cI(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function lI(e,t,n,r){let i=cI(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(sI(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,uI);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(oI(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
90
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
91
|
+
`),a&&(u+=s.move(a+`
|
|
92
|
+
`)),u+=s.move(c),l(),u}function uI(e,t,n){return(n?``:` `)+e}function dI(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fI(e,t,n,r){let i=dI(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
93
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function pI(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function mI(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function hI(e,t,n){let r=IA(e),i=IA(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}gI.peek=_I;function gI(e,t,n,r){let i=pI(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=hI(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=mI(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=hI(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+mI(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function _I(e,t,n){return n.options.emphasis||`*`}function vI(e,t){let n=!1;return aP(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&tA(e)&&(t.options.setext||n))}function yI(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(vI(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
94
|
+
`,after:`
|
|
95
|
+
`});return r(),t(),o+`
|
|
96
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
97
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
98
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=mI(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}bI.peek=xI;function bI(e){return e.value||``}function xI(){return`<`}SI.peek=CI;function SI(e,t,n,r){let i=dI(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function CI(){return`!`}wI.peek=TI;function wI(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function TI(){return`!`}EI.peek=DI;function EI(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function DI(){return"`"}function OI(e,t){let n=tA(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}kI.peek=AI;function kI(e,t,n,r){let i=dI(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(OI(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function AI(e,t,n){return OI(e,n)?`<`:`[`}jI.peek=MI;function jI(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function MI(){return`[`}function NI(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function PI(e){let t=NI(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function FI(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function II(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function LI(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?FI(n):NI(n),s=e.ordered?o===`.`?`)`:`.`:PI(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),II(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function RI(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function zI(e,t,n,r){let i=RI(n),a=n.bulletCurrent||NI(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function BI(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var VI=JN([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function HI(e,t,n,r){return(e.children.some(function(e){return VI(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function UI(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}WI.peek=GI;function WI(e,t,n,r){let i=UI(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=hI(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=mI(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=hI(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+mI(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function GI(e,t,n){return n.options.strong||`*`}function KI(e,t,n,r){return n.safe(e.value,r)}function qI(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function JI(e,t,n){let r=(II(n)+(n.options.ruleSpaces?` `:``)).repeat(qI(n));return n.options.ruleSpaces?r.slice(0,-1):r}var YI={blockquote:tI,break:aI,code:lI,definition:fI,emphasis:gI,hardBreak:aI,heading:yI,html:bI,image:SI,imageReference:wI,inlineCode:EI,link:kI,linkReference:jI,list:LI,listItem:zI,paragraph:BI,root:HI,strong:WI,text:KI,thematicBreak:JI};function XI(){return{enter:{table:ZI,tableData:tL,tableHeader:tL,tableRow:$I},exit:{codeText:nL,table:QI,tableData:eL,tableHeader:eL,tableRow:eL}}}function ZI(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function QI(e){this.exit(e),this.data.inTable=void 0}function $I(e){this.enter({type:`tableRow`,children:[]},e)}function eL(e){this.exit(e)}function tL(e){this.enter({type:`tableCell`,children:[]},e)}function nL(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,rL));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function rL(e,t){return t===`|`?t:e}function iL(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
99
|
+
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
100
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return QF(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=YI.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function aL(){return{exit:{taskListCheckValueChecked:sL,taskListCheckValueUnchecked:sL,paragraph:cL}}}function oL(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:lL}}}function sL(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function cL(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function lL(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=YI.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function uL(){return[gF(),BF(),GF(),XI(),aL()]}function dL(e){return{extensions:[_F(),VF(e),KF(),iL(e),oL()]}}var fL={tokenize:EL,partial:!0},pL={tokenize:DL,partial:!0},mL={tokenize:OL,partial:!0},hL={tokenize:kL,partial:!0},gL={tokenize:AL,partial:!0},_L={name:`wwwAutolink`,tokenize:wL,previous:jL},vL={name:`protocolAutolink`,tokenize:TL,previous:ML},yL={name:`emailAutolink`,tokenize:CL,previous:NL},bL={};function xL(){return{text:bL}}for(var SL=48;SL<123;)bL[SL]=yL,SL++,SL===58?SL=65:SL===91&&(SL=97);bL[43]=yL,bL[45]=yL,bL[46]=yL,bL[95]=yL,bL[72]=[yL,vL],bL[104]=[yL,vL],bL[87]=[yL,_L],bL[119]=[yL,_L];function CL(e,t,n){let r=this,i,a;return o;function o(t){return!PL(t)||!NL.call(r,r.previous)||FL(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return PL(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(gL,u,l)(t):t===45||t===95||gA(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&hA(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function wL(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!jL.call(r,r.previous)||FL(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(fL,e.attempt(pL,e.attempt(mL,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function TL(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&ML.call(r,r.previous)&&!FL(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(hA(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||vA(t)||CA(t)||EA(t)||TA(t)?n(t):e.attempt(pL,e.attempt(mL,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function EL(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function DL(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(hL,c,s)(t):t===null||CA(t)||EA(t)||t!==45&&TA(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function OL(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(hL,t,a)(o):o===null||CA(o)||EA(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function kL(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||CA(o)||EA(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||CA(e)||EA(e)?t(e):r(e)}function a(e){return hA(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):hA(t)?(e.consume(t),o):n(t)}}function AL(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return gA(e)?n(e):t(e)}}function jL(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||CA(e)}function ML(e){return!hA(e)}function NL(e){return!(e===47||PL(e))}function PL(e){return e===43||e===45||e===46||e===95||gA(e)}function FL(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var IL={tokenize:WL,partial:!0};function LL(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:VL,continuation:{tokenize:HL},exit:UL}},text:{91:{name:`gfmFootnoteCall`,tokenize:BL},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:RL,resolveTo:zL}}}}function RL(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=mA(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function zL(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function BL(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||CA(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(mA(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return CA(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function VL(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||CA(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=mA(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return CA(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),kA(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function HL(e,t,n){return e.check(WA,t,e.attempt(IL,t,n))}function UL(e){e.exit(`gfmFootnoteDefinition`)}function WL(e,t,n){let r=this;return kA(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function GL(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&sA(o,o.length,0,LA(s,e.slice(r+1,n),t)),sA(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),sA(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=IA(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=IA(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var KL=class{constructor(){this.map=[]}add(e,t,n){qL(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function qL(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function JL(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function YL(){return{flow:{null:{name:`table`,tokenize:XL,resolveAll:ZL}}}}function XL(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):SA(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):wA(t)?kA(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||CA(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,wA(t)?kA(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return wA(t)?kA(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||SA(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return wA(t)?kA(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||SA(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||SA(n)?(e.exit(`tableRow`),t(n)):wA(n)?kA(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||CA(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function ZL(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new KL;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&($L(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=QL(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=QL(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=QL(f,t,o,i,n,d)):(o[0]=o[1],d=QL(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&$L(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=JL(t.events,n))}return e}function QL(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},eR(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=eR(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=eR(t.events,n[2]),a=eR(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},eR(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function $L(e,t,n,r,i){let a=[],o=eR(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function eR(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var tR={name:`tasklistCheck`,tokenize:rR};function nR(){return{text:{91:tR}}}function rR(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return CA(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return SA(r)?t(r):wA(r)?e.check({tokenize:iR},t,n)(r):n(r)}}function iR(e,t,n){return kA(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function aR(e){return uA([xL(),LL(),GL(e),YL(),nR()])}var oR={};function sR(e){let t=this,n=e||oR,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(aR(n)),a.push(uL()),o.push(dL(n))}var cR=`specrails.chatPanelOpen`,lR=(0,I.createContext)(null);function uR(){return(0,I.useContext)(lR)}function dR(){let{activeProjectId:e}=Sd(),[t,n]=(0,I.useState)([]),[r,i]=(0,I.useState)(0),[a,o]=(0,I.useState)(()=>{try{return localStorage.getItem(cR)===`true`}catch{return!1}}),{registerHandler:s,unregisterHandler:c}=xl(),l=(0,I.useRef)(new Map),u=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(u.current&&u.current!==e&&l.current.set(u.current,t),u.current=e,e){let t=l.current.get(e);t?(n(t),i(0)):(n([]),i(0))}async function r(){try{let t=ul(),r=await fetch(`${t}/chat/conversations`);if(!r.ok)return;let i=(await r.json()).conversations.slice(0,3),a=await Promise.all(i.map(async e=>{try{let t=await fetch(`${ul()}/chat/conversations/${e.id}/messages`),n=t.ok?await t.json():{messages:[]};return{id:e.id,title:e.title,model:e.model,messages:n.messages,isStreaming:!1,streamingText:``,commandProposals:[]}}catch{return{id:e.id,title:e.title,model:e.model,messages:[],isStreaming:!1,streamingText:``,commandProposals:[]}}}));n(a),e&&l.current.set(e,a)}catch{}}r()},[e]);let d=(0,I.useCallback)(e=>{let t=e;if(typeof t.type!=`string`)return;let r=ul(),i=r.startsWith(`/api/projects/`)?r.split(`/api/projects/`)[1]:null;if(!(i&&t.projectId&&t.projectId!==i)){if(t.type===`chat_stream`){let e=t.conversationId,r=t.delta;n(t=>t.map(t=>t.id===e?{...t,isStreaming:!0,streamingText:t.streamingText+r}:t))}else if(t.type===`chat_done`){let e=t.conversationId,r=t.fullText;n(t=>t.map(t=>{if(t.id!==e)return t;let n={id:Date.now(),conversation_id:e,role:`assistant`,content:r,created_at:new Date().toISOString()};return{...t,isStreaming:!1,streamingText:``,messages:[...t.messages,n]}}))}else if(t.type===`chat_error`){let e=t.conversationId;n(t=>t.map(t=>t.id===e?{...t,isStreaming:!1,streamingText:``}:t))}else if(t.type===`chat_command_proposal`){let e=t.conversationId,r=t.command;n(t=>t.map(t=>t.id===e&&!t.commandProposals.includes(r)?{...t,commandProposals:[...t.commandProposals,r]}:t))}else if(t.type===`chat_title_update`){let e=t.conversationId,r=t.title;n(t=>t.map(t=>t.id===e?{...t,title:r}:t))}}},[]);(0,I.useLayoutEffect)(()=>(s(`chat`,d),()=>c(`chat`)),[d,s,c]);let f=(0,I.useCallback)(()=>{o(e=>{let t=!e;try{localStorage.setItem(cR,String(t))}catch{}return t})},[]),p=(0,I.useCallback)(async(e=`sonnet`)=>{try{let t=await fetch(`${ul()}/chat/conversations`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:e})});if(!t.ok)return;let r=await t.json(),a={id:r.conversation.id,title:r.conversation.title,model:r.conversation.model,messages:[],isStreaming:!1,streamingText:``,commandProposals:[]};n(e=>{let t=[...e,a].slice(0,3);return i(Math.min(e.length,2)),t})}catch{}},[]),m=(0,I.useCallback)(async e=>{try{await fetch(`${ul()}/chat/conversations/${e}`,{method:`DELETE`})}catch{}n(t=>t.filter(t=>t.id!==e)),i(e=>Math.max(0,e-1))},[]),h=(0,I.useCallback)(async(e,t,r)=>{let i={id:Date.now(),conversation_id:e,role:`user`,content:t,created_at:new Date().toISOString()};n(t=>t.map(t=>t.id===e?{...t,messages:[...t.messages,i],isStreaming:!0}:t));try{let n={text:t};r?.lightweight&&(n.lightweight=!0),r?.maxTurns!=null&&(n.maxTurns=r.maxTurns),r?.attachments&&r.attachments.ids.length>0&&(n.attachments=r.attachments),await fetch(`${ul()}/chat/conversations/${e}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})}catch{n(t=>t.map(t=>t.id===e?{...t,isStreaming:!1,messages:t.messages.filter(e=>e.id!==i.id)}:t)),K.error(J.t(`chat:errors.sendFailed`))}},[]),g=(0,I.useCallback)(async e=>{try{await fetch(`${ul()}/chat/conversations/${e}/messages/stream`,{method:`DELETE`})}catch{}},[]),_=(0,I.useCallback)(async e=>{try{await fetch(`${ul()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:e})})}catch{}},[]),v=(0,I.useCallback)((e,t)=>{n(n=>n.map(n=>n.id===e?{...n,commandProposals:n.commandProposals.filter(e=>e!==t)}:n))},[]),y=(0,I.useCallback)(async(e,t)=>{n(n=>n.map(n=>n.id===e?{...n,model:t}:n));try{await fetch(`${ul()}/chat/conversations/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:t})})}catch{}},[]);return{conversations:t,activeTabIndex:r,isPanelOpen:a,setActiveTabIndex:i,togglePanel:f,createConversation:p,deleteConversation:m,sendMessage:h,startWithMessage:(0,I.useCallback)(async(e,t,r,a,o,s)=>{try{let c={model:r??void 0,kind:a??void 0};o&&a===`explore`&&(c.contextScope=o),s&&(c.aiEngine=s);let l=await fetch(`${ul()}/chat/conversations`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)});if(!l.ok)return null;let u=await l.json(),d={id:u.conversation.id,title:u.conversation.title,model:u.conversation.model,messages:[],isStreaming:!1,streamingText:``,commandProposals:[]};return n(e=>{let t=[...e,d].slice(-3);return i(t.length-1),t}),h(u.conversation.id,e,t),u.conversation.id}catch{return null}},[h]),hydrateConversation:(0,I.useCallback)(async e=>{if(!t.some(t=>t.id===e))try{let t=await fetch(`${ul()}/chat/conversations/${e}`);if(!t.ok)return;let r=await t.json(),i={id:r.conversation.id,title:r.conversation.title,model:r.conversation.model,messages:r.messages,isStreaming:!1,streamingText:``,commandProposals:[]};n(t=>t.some(t=>t.id===e)?t:[...t,i])}catch{}},[t]),abortStream:g,confirmCommand:_,dismissCommandProposal:v,changeConversationModel:y}}function fR(e,t){let{registerHandler:n,unregisterHandler:r}=xl(),i=(0,I.useRef)(t?Object.keys(t).filter(e=>t[e]!==void 0):[]),a=(0,I.useRef)({...Yh,...t??{}}),[o,s]=(0,I.useState)(a.current),[c,l]=(0,I.useState)(!1),[u,d]=(0,I.useState)([]),[f,p]=(0,I.useState)([]),m=(0,I.useRef)(new Set(i.current)),[h,g]=(0,I.useState)(i.current.length>0);return(0,I.useEffect)(()=>{if(s(a.current),l(!1),d([]),p([]),m.current=new Set(i.current),g(i.current.length>0),!e)return;let t=!1;return(async()=>{try{let n=await fetch(`${ul()}/chat/conversations/${e}/spec-draft`);if(!n.ok)return;let r=await n.json();if(t||!r.draft)return;let i=m.current;s(e=>{let t={...e};for(let e of Jh){if(i.has(e))continue;let n=r.draft[e];n!==void 0&&(t[e]=n)}return t}),l(r.ready),d(r.chips.slice(0,3))}catch{}})(),()=>{t=!0}},[e]),(0,I.useEffect)(()=>{if(!e)return;let t=`spec-draft-stream:${e}`;return n(t,t=>{if(!Xh(t)||t.conversationId!==e)return;let n=m.current,r=[];s(e=>{let i={...e};for(let e of Jh){if(n.has(e))continue;let a=t.draft[e];if(a===void 0)continue;let o=!pR(i[e],a);i[e]=a,o&&r.push(e)}return i}),l(t.ready),d(t.chips.slice(0,3)),p(r)}),()=>r(t)},[e,n,r]),{draft:o,ready:c,chips:u,lastChangedFields:f,hasManualOverrides:h,setField:(0,I.useCallback)((e,t)=>{m.current.add(e),g(!0),s(n=>({...n,[e]:t}))},[]),clearManualOverrides:(0,I.useCallback)(()=>{m.current.size!==0&&(m.current=new Set,g(!1))},[])}}function pR(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}var mR=[`low`,`medium`,`high`,`critical`];function hR({draft:e,ready:t,flashFields:n,onFieldChange:r,attachments:i=[],onRemoveAttachment:a}){let{t:o}=G(`explore`);return(0,q.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex-shrink-0 px-5 py-3 border-b border-border/40 flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Mp,{className:`w-4 h-4 text-primary/70`}),(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:o(`common:status.draft`)})]}),t&&(0,q.jsxs)(`span`,{role:`status`,"aria-live":`polite`,className:`text-[10px] text-primary/80 bg-primary/10 rounded-full px-2 py-0.5 flex items-center gap-1`,children:[(0,q.jsx)(Mp,{className:`w-3 h-3`}),o(`draftPanel.ready`)]})]}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 pb-32 space-y-4`,children:[(0,q.jsx)(gR,{label:o(`draftPanel.titleLabel`),flash:n.includes(`title`),children:(0,q.jsx)(`input`,{type:`text`,value:e.title,onChange:e=>r(`title`,e.target.value),placeholder:o(`draftPanel.titlePlaceholder`),className:`w-full px-3 py-2 text-sm rounded-md border border-border/50 bg-background focus:outline-none focus:ring-2 focus:ring-primary/40`,"aria-label":o(`draftPanel.titleAriaLabel`)})}),(0,q.jsx)(gR,{label:o(`draftPanel.priorityLabel`),flash:n.includes(`priority`),children:(0,q.jsx)(`select`,{value:e.priority,onChange:e=>r(`priority`,e.target.value),className:`w-full px-3 py-2 text-sm rounded-md border border-border/50 bg-background focus:outline-none focus:ring-2 focus:ring-primary/40`,"aria-label":o(`draftPanel.priorityAriaLabel`),children:mR.map(e=>(0,q.jsx)(`option`,{value:e,children:o(`priority.${e}`)},e))})}),(0,q.jsx)(gR,{label:o(`draftPanel.labelsLabel`),flash:n.includes(`labels`),children:(0,q.jsx)(_R,{labels:e.labels,onChange:e=>r(`labels`,e)})}),(0,q.jsx)(gR,{label:o(`draftPanel.descriptionLabel`),flash:n.includes(`description`),children:(0,q.jsx)(`textarea`,{value:e.description,onChange:e=>r(`description`,e.target.value),rows:5,placeholder:o(`draftPanel.descriptionPlaceholder`),className:`w-full px-3 py-2 text-sm rounded-md border border-border/50 bg-background focus:outline-none focus:ring-2 focus:ring-primary/40 resize-none`,"aria-label":o(`draftPanel.descriptionAriaLabel`)})}),(0,q.jsx)(gR,{label:o(`draftPanel.acceptanceCriteriaLabel`),flash:n.includes(`acceptanceCriteria`),children:(0,q.jsx)(bR,{items:e.acceptanceCriteria,onChange:e=>r(`acceptanceCriteria`,e)})})]}),i.length>0&&(0,q.jsxs)(`div`,{className:`flex-shrink-0 px-5 py-3 border-t border-border/40 bg-card/40`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,q.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground/80 font-medium`,children:o(`draftPanel.attachmentsHeading`,{count:i.length})}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:o(`draftPanel.linkedOnCreate`)})]}),(0,q.jsx)(vR,{items:i,onRemove:a})]})]})}function gR({label:e,flash:t,children:n}){let[r,i]=(0,I.useState)(!1),a=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(t)return i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),700),()=>{a.current&&clearTimeout(a.current)}},[t]),(0,q.jsxs)(`div`,{className:`space-y-1.5 transition-colors duration-200 ${r?`bg-primary/[0.06] -mx-2 px-2 py-1 rounded`:``}`,children:[(0,q.jsx)(`label`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground/80 font-medium`,children:e}),n]})}function _R({labels:e,onChange:t}){let{t:n}=G(`explore`),[r,i]=(0,I.useState)(``);function a(){let n=r.trim();if(!n||e.includes(n)){i(``);return}t([...e,n]),i(``)}function o(n){t(e.filter(e=>e!==n))}return(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 p-1.5 rounded-md border border-border/50 bg-background min-h-[36px]`,children:[e.map(e=>(0,q.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] px-2 py-0.5 rounded-full bg-primary/10 text-primary/90`,children:[e,(0,q.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`hover:text-foreground`,"aria-label":n(`draftPanel.removeLabelAriaLabel`,{label:e}),children:(0,q.jsx)(qp,{className:`w-3 h-3`})})]},e)),(0,q.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:n=>{n.key===`Enter`||n.key===`,`?(n.preventDefault(),a()):n.key===`Backspace`&&!r&&e.length>0&&t(e.slice(0,-1))},onBlur:a,placeholder:e.length===0?n(`draftPanel.addLabelsPlaceholder`):``,className:`flex-1 min-w-[80px] bg-transparent text-xs focus:outline-none`,"aria-label":n(`draftPanel.addLabelAriaLabel`)})]})}function vR({items:e,onRemove:t}){let{t:n}=G(`explore`);return(0,q.jsx)(`ul`,{className:`space-y-1`,"aria-label":n(`draftPanel.attachmentsListAriaLabel`),children:e.map(e=>(0,q.jsxs)(`li`,{className:`flex items-center gap-2 px-2 py-1.5 rounded-md border border-border/40 bg-card/40 text-xs`,children:[(0,q.jsx)(e.mimeType.startsWith(`image/`)?Hf:jf,{className:`w-3.5 h-3.5 text-primary/70 flex-shrink-0`}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,title:`${e.filename} · ${yR(e.size)}`,children:e.filename}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60 flex-shrink-0`,children:yR(e.size)}),t&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),className:`text-muted-foreground hover:text-destructive flex-shrink-0`,"aria-label":n(`draftPanel.removeAttachmentAriaLabel`,{filename:e.filename}),children:(0,q.jsx)(qp,{className:`w-3 h-3`})})]},e.id))})}function yR(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function bR({items:e,onChange:t}){let{t:n}=G(`explore`);function r(n,r){let i=e.slice();i[n]=r,t(i)}function i(n){t(e.filter((e,t)=>t!==n))}function a(){t([...e,``])}return(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[e.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`•`}),(0,q.jsx)(`input`,{value:e,onChange:e=>r(t,e.target.value),placeholder:n(`draftPanel.criterionPlaceholder`),className:`flex-1 px-2 py-1 text-xs rounded border border-border/50 bg-background focus:outline-none focus:ring-1 focus:ring-primary/40`,"aria-label":n(`draftPanel.criterionAriaLabel`,{number:t+1})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(t),className:`text-muted-foreground hover:text-destructive`,"aria-label":n(`draftPanel.removeCriterionAriaLabel`,{number:t+1}),children:(0,q.jsx)(qp,{className:`w-3.5 h-3.5`})})]},t)),(0,q.jsxs)(`button`,{type:`button`,onClick:a,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,"aria-label":n(`draftPanel.addCriterionAriaLabel`),children:[(0,q.jsx)(pp,{className:`w-3 h-3`}),` `,n(`draftPanel.addCriterion`)]})]})}var xR=!0,SR=150,CR={connecting:`statusPills.connecting`,thinking:`statusPills.thinking`,tool:`statusPills.tool`};function wR({active:e,hasSystemEvent:t,hasToolUse:n,hasText:r,minDisplayMs:i=SR}){let{t:a}=G(`explore`),[o,s]=(0,I.useState)(`connecting`),c=(0,I.useRef)(Date.now()),l=(0,I.useRef)(null),u=r?`streaming`:n?`tool`:t?`thinking`:`connecting`;if((0,I.useEffect)(()=>{if(u===o)return;let e=Date.now()-c.current,t=Math.max(0,i-e);return l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(u),c.current=Date.now(),l.current=null},t),()=>{l.current&&clearTimeout(l.current)}},[u,o,i]),!xR||!e||o===`streaming`)return null;let d=a(CR[o]);return(0,q.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-accent-info/10 text-accent-info px-3 py-1 text-[11px] font-medium`,role:`status`,"aria-live":`polite`,"data-testid":`explore-status-pill`,"data-stage":o,children:[(0,q.jsx)(Yf,{className:`h-3 w-3 animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:d})]})}var TR=4096,ER=250;function DR(e,t){let[n,r]=(0,I.useState)(``),i=(0,I.useRef)(``),a=(0,I.useRef)(e),o=(0,I.useRef)(0),s=(0,I.useRef)(null);return(0,I.useEffect)(()=>{a.current=e},[e]),(0,I.useEffect)(()=>{i.current=n},[n]),(0,I.useEffect)(()=>{if(!t&&e.length<=i.current.length){s.current!=null&&(cancelAnimationFrame(s.current),s.current=null),n!==e&&r(e);return}let c=e=>{let t=i.current,n=a.current,l=n.length-t.length;if(l<=0){s.current=null;return}if(l>TR){r(n),i.current=n,s.current=null;return}let u=o.current||e,d=Math.max(0,e-u);o.current=e;let f=l/ER,p=Math.max(1,Math.ceil(f*d)),m=n.slice(0,Math.min(n.length,t.length+p));r(m),i.current=m,s.current=requestAnimationFrame(c)};return s.current??=(o.current=0,requestAnimationFrame(c)),()=>{s.current!=null&&(cancelAnimationFrame(s.current),s.current=null)}},[e,t,n]),n}var OR=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends OR{};function kR(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function AR(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function jR(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function MR(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function NR(e,t){return jR(e,t,``)}function PR(e,t){return MR(e,t,``)}function FR(e,t){return t.slice(0,IR(e,t))}function IR(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function LR(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function RR(e,t){if(t)return BR(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function zR(e,t){if(t)return BR(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function BR(e,t){if(!t)return[zR(e),RR(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=LR(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var VR=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,HR=RegExp(`[${VR}]+|\\s+|[^${VR}]`,`ug`),UR=new class extends OR{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=LR(e,r)}else n=e.match(HR)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&GR(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&GR(n,i,r,null,t.intlSegmenter),e}};function WR(e,t,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?qR(e,t,n):UR.diff(e,t,n)}function GR(e,t,n,r,i){if(t&&n){let[a,o]=BR(t.value,i),[s,c]=BR(n.value,i);if(e){let r=kR(a,s);e.value=MR(e.value,s,r),t.value=NR(t.value,r),n.value=NR(n.value,r)}if(r){let e=AR(o,c);r.value=jR(r.value,c,e),t.value=PR(t.value,e),n.value=PR(n.value,e)}}else if(n){if(e){let e=zR(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=zR(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=zR(r.value,i),[a,o]=BR(t.value,i),s=kR(n,a);t.value=NR(t.value,s);let c=AR(NR(n,s),o);t.value=PR(t.value,c),r.value=jR(r.value,n,c),e.value=MR(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=zR(r.value,i),n=FR(RR(t.value,i),e);t.value=PR(t.value,n)}else if(e){let n=FR(RR(e.value,i),zR(t.value,i));t.value=NR(t.value,n)}}var KR=new class extends OR{tokenize(e){let t=RegExp(`(\\r?\\n)|[${VR}]+|[^\\S\\n\\r]+|[^${VR}]`,`ug`);return e.match(t)||[]}};function qR(e,t,n){return KR.diff(e,t,n)}new class extends OR{constructor(){super(...arguments),this.tokenize=JR}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
101
|
+
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
102
|
+
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
103
|
+
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
104
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function JR(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
105
|
+
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function YR(e){return e==`.`||e==`!`||e==`?`}new class extends OR{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(YR(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends OR{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends OR{constructor(){super(...arguments),this.tokenize=JR}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(XR(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function XR(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=XR(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=XR(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends OR{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function ZR(e,t){return WR(e,t).map(e=>({value:e.value,...e.added?{added:!0}:{},...e.removed?{removed:!0}:{}}))}function QR(e,t,n=(e,t)=>e===t){let r=t=>e.some(e=>n(e,t)),i=e=>t.some(t=>n(t,e)),a=[],o=[],s=[];for(let e of t)a.some(t=>n(t.value,e))||(r(e)?(s.push(e),a.push({value:e,status:`unchanged`})):(o.push(e),a.push({value:e,status:`added`})));let c=[];for(let t of e)c.some(e=>n(e,t))||i(t)||(c.push(t),a.push({value:t,status:`removed`}));return{added:o,removed:c,unchanged:s,ordered:a}}var $R={title:``,description:``,labels:[],priority:null,acceptanceCriteria:[]};function ez({baseline:e,proposed:t,isCommitting:n,mode:r=`create`,onBack:i,onCommit:a}){let{t:o}=G(`explore`),s=(0,I.useMemo)(()=>ZR(e.title,t.title),[e.title,t.title]),c=(0,I.useMemo)(()=>ZR(e.description,t.description),[e.description,t.description]),l=(0,I.useMemo)(()=>QR(e.labels,t.labels),[e.labels,t.labels]),u=(0,I.useMemo)(()=>QR(e.acceptanceCriteria,t.acceptanceCriteria),[e.acceptanceCriteria,t.acceptanceCriteria]),d=e.priority!==t.priority;return(0,I.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,q.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":o(`reviewOverlay.dialogAriaLabel`),"data-testid":`explore-review-overlay`,className:`fixed inset-0 z-[60] flex items-stretch justify-center bg-black/70 backdrop-blur-sm`,children:(0,q.jsxs)(`div`,{className:`flex flex-col w-full max-w-5xl h-full bg-background border-x border-border/30 shadow-2xl`,children:[(0,q.jsx)(`header`,{className:`flex items-center justify-between px-6 py-4 border-b border-border/30`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground/60 font-semibold`,children:o(`reviewOverlay.eyebrow`)}),(0,q.jsx)(`h2`,{className:`text-base font-semibold mt-0.5`,children:o(`reviewOverlay.heading`)})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,q.jsxs)(`section`,{"data-testid":`review-title`,className:`space-y-2`,children:[(0,q.jsx)(tz,{label:o(`reviewOverlay.titleLabel`)}),(0,q.jsx)(`div`,{className:`text-sm whitespace-pre-wrap break-words rounded-lg bg-card/40 border border-border/30 px-3 py-2`,children:(0,q.jsx)(nz,{parts:s})})]}),(0,q.jsxs)(`section`,{"data-testid":`review-priority`,className:`space-y-2`,children:[(0,q.jsx)(tz,{label:o(`reviewOverlay.priorityLabel`)}),(0,q.jsx)(`div`,{className:`flex items-center gap-2`,children:d?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(az,{value:e.priority,removed:!0}),(0,q.jsx)(of,{className:`w-3 h-3 text-muted-foreground/60`,"aria-hidden":`true`}),(0,q.jsx)(az,{value:t.priority,added:!0})]}):(0,q.jsx)(az,{value:t.priority})})]}),(0,q.jsxs)(`section`,{"data-testid":`review-description`,className:`lg:col-span-2 space-y-2`,children:[(0,q.jsx)(tz,{label:o(`reviewOverlay.descriptionLabel`)}),(0,q.jsx)(`div`,{className:`text-xs font-mono whitespace-pre-wrap break-words rounded-lg bg-card/40 border border-border/30 px-3 py-3 leading-relaxed`,children:(0,q.jsx)(nz,{parts:c})})]}),(0,q.jsxs)(`section`,{"data-testid":`review-labels`,className:`space-y-2`,children:[(0,q.jsx)(tz,{label:o(`reviewOverlay.labelsLabel`)}),l.ordered.length===0?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/60 italic`,children:o(`reviewOverlay.noLabels`)}):(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:l.ordered.map((e,t)=>(0,q.jsx)(rz,{entry:e},`${e.status}-${t}`))})]}),(0,q.jsxs)(`section`,{"data-testid":`review-criteria`,className:`space-y-2`,children:[(0,q.jsx)(tz,{label:o(`reviewOverlay.acceptanceCriteriaLabel`)}),u.ordered.length===0?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/60 italic`,children:o(`reviewOverlay.noCriteria`)}):(0,q.jsx)(`ul`,{className:`space-y-1 text-sm`,children:u.ordered.map((e,t)=>(0,q.jsx)(iz,{entry:e},`${e.status}-${t}`))})]})]})}),(0,q.jsxs)(`footer`,{className:`flex items-center justify-between gap-3 px-6 py-4 border-t border-border/30`,children:[(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,disabled:n,"data-testid":`review-back`,children:[(0,q.jsx)(Wd,{className:`w-3.5 h-3.5`}),o(`reviewOverlay.backToEdit`)]}),(0,q.jsxs)(Z,{type:`button`,size:`sm`,onClick:a,disabled:n||!t.title.trim(),"data-testid":`review-commit`,className:`gap-1.5`,children:[(0,q.jsx)(nf,{className:`w-3.5 h-3.5`}),o(r===`edit`?`reviewOverlay.updateSpec`:`reviewOverlay.createSpec`)]})]})]})})}function tz({label:e}){return(0,q.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground/60 font-semibold`,children:e})}function nz({parts:e}){let{t}=G(`explore`);return(0,q.jsx)(q.Fragment,{children:e.map((e,n)=>e.added?(0,q.jsx)(`span`,{className:`diff-added`,"aria-label":t(`reviewOverlay.inserted`),children:e.value},n):e.removed?e.value.trim()?(0,q.jsx)(`span`,{className:`diff-removed`,"aria-label":t(`reviewOverlay.removed`),children:e.value},n):null:(0,q.jsx)(`span`,{children:e.value},n))})}function rz({entry:e}){let{t}=G(`explore`),n=`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px]`;return e.status===`added`?(0,q.jsxs)(`span`,{className:`${n} diff-chip-added`,"aria-label":t(`reviewOverlay.added`),children:[`+ `,e.value]}):e.status===`removed`?(0,q.jsxs)(`span`,{className:`${n} diff-chip-removed`,"aria-label":t(`reviewOverlay.removed`),children:[`− `,e.value]}):(0,q.jsx)(`span`,{className:`${n} bg-card/60 text-muted-foreground border border-border/40`,"aria-label":t(`reviewOverlay.unchanged`),children:e.value})}function iz({entry:e}){let{t}=G(`explore`);return e.status===`added`?(0,q.jsxs)(`li`,{className:`diff-bullet-added rounded px-2 py-1 list-none`,"aria-label":t(`reviewOverlay.added`),children:[(0,q.jsx)(`span`,{className:`mr-1 font-mono`,children:`+`}),e.value]}):e.status===`removed`?(0,q.jsxs)(`li`,{className:`diff-bullet-removed rounded px-2 py-1 list-none`,"aria-label":t(`reviewOverlay.removed`),children:[(0,q.jsx)(`span`,{className:`mr-1 font-mono`,children:`−`}),e.value]}):(0,q.jsx)(`li`,{className:`text-foreground/90 list-disc list-inside`,"aria-label":t(`reviewOverlay.unchanged`),children:e.value})}function az({value:e,added:t,removed:n}){let{t:r}=G(`explore`);if(!e)return(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground/60 italic`,children:r(`reviewOverlay.noPriority`)});let i=`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] capitalize border`;return t?(0,q.jsx)(`span`,{className:`${i} diff-chip-added`,"aria-label":r(`reviewOverlay.added`),children:r(`priority.${e}`)}):n?(0,q.jsx)(`span`,{className:`${i} diff-chip-removed`,"aria-label":r(`reviewOverlay.removed`),children:r(`priority.${e}`)}):(0,q.jsx)(`span`,{className:`${i} bg-card/60 text-muted-foreground border-border/40`,children:r(`priority.${e}`)})}function oz(){return typeof window>`u`||!(`__TAURI_INTERNALS__`in window)?!1:/mac/i.test(navigator.platform)}function sz({initialIdea:e,pendingSpecId:t,initialAttachmentIds:n,initialModel:r,initialProvider:i,resumeConversationId:a,seedDraftTitle:o,seedComposerText:s,seedDraftOverrides:c,onClose:l,onMinimize:u,onStateChange:d,editTicket:f,onTicketCreated:p,contextScope:m}){let{t:h}=G(`explore`),{t:g}=G(`jira`),_=sb(),v=uR(),{activeProjectId:y}=Sd(),[b,x]=(0,I.useState)(a??null),[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(!1),[E,D]=(0,I.useState)(!1),[O,k]=(0,I.useState)(!1),[A,j]=(0,I.useState)(!1),[M,N]=(0,I.useState)([]),P=(0,I.useRef)(null),F=(0,I.useRef)(!1),L=(0,I.useRef)(!1),ee=!!f&&f.status!==`draft`,te=(0,I.useRef)(null),R=(0,I.useRef)(null),z=(0,I.useRef)(null),B=(0,I.useRef)(!1),V=(0,I.useCallback)(()=>{let e=R.current;e&&(B.current=e.scrollHeight-e.scrollTop-e.clientHeight>100)},[]),ne=(0,I.useCallback)(async()=>{if(y)try{let e=await fetch(`${sl}/api/projects/${y}/tickets/${t}/attachments`);if(!e.ok)return;N((await e.json()).attachments)}catch{}},[y,t]);(0,I.useEffect)(()=>{ne()},[ne]),(0,I.useEffect)(()=>{b&&ne()},[b,ne]),(0,I.useEffect)(()=>{if(F.current)return;if(a){F.current=!0,v?.hydrateConversation?.(a);return}if(!v||(F.current=!0,f))return;let o=`/specrails:explore-spec\n\n${e.trim()}`,s=n.length>0?{ticketKey:t,ids:n}:void 0;v.startWithMessage(o,{lightweight:!0,maxTurns:20,attachments:s},r,`explore`,m,i).then(e=>{e&&x(e)})},[v,e,t,n,a,r,i,f,m]),(0,I.useEffect)(()=>(P.current=document.activeElement,()=>{let e=P.current;e&&e instanceof HTMLElement&&e.focus()}),[]);let H=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(H.current||!s)return;let e=setTimeout(()=>{te.current?.setPlainText(s),T(s.trim().length>0),H.current=!0},0);return()=>clearTimeout(e)},[s]);let U=(0,I.useMemo)(()=>{if(!(!v||!b))return v.conversations.find(e=>e.id===b)},[v,b]),re=U?.messages.length??0,ie=DR(U?.streamingText??``,!!U?.isStreaming);(0,I.useEffect)(()=>{if(B.current)return;let e=R.current;e&&(U?.isStreaming||O?e.scrollTop=e.scrollHeight:z.current?.scrollIntoView({behavior:`smooth`,block:`end`}))},[re,ie,U?.isStreaming,O]),(0,I.useEffect)(()=>{B.current=!1;let e=null,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>{let e=R.current;e&&(e.scrollTop=e.scrollHeight)})});return()=>{cancelAnimationFrame(t),e!=null&&cancelAnimationFrame(e)}},[]);let{draft:W,ready:ae,chips:oe,lastChangedFields:se,setField:ce,clearManualOverrides:le}=fR(b,f?{title:f.title,description:f.description,labels:f.labels,priority:f.priority??`medium`,acceptanceCriteria:f.acceptanceCriteria}:void 0),ue=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(ue.current)return;if(f){ue.current=!0;return}if(!c)return;ue.current=!0;let e=c;e.title&&e.title.trim()&&ce(`title`,e.title),e.description&&e.description.trim()&&ce(`description`,e.description),e.priority&&e.priority!==`medium`&&ce(`priority`,e.priority),e.labels&&e.labels.length>0&&ce(`labels`,e.labels);let t=e.acceptanceCriteria?.filter(e=>e.trim().length>0)??[];t.length>0&&ce(`acceptanceCriteria`,t)},[c,ce,f]);let de=(0,I.useCallback)(()=>{re>1?C(!0):l()},[re,l]),fe=(0,I.useCallback)(async e=>{let n=e.trim();if(!n||!v)return;if(f&&!L.current){L.current=!0;let e=te.current?.getAttachmentIds()??[];te.current?.clear(),T(!1),ve(``),k(!0),le();let a=`/specrails:explore-spec\n\n${[`## Spec context`,`Ticket #${f.id}: ${f.title}`,``,f.description||`(no description)`].join(`
|
|
106
|
+
`)}\n\n---\n\n## Instruction\n\n${n}`,o=e.length>0?{ticketKey:t,ids:e}:void 0;U?await v.sendMessage(U.id,a,{lightweight:!0,maxTurns:20,attachments:o}):v.startWithMessage(a,{lightweight:!0,maxTurns:20,attachments:o},r,`explore`,void 0,i).then(e=>{e&&x(e)});return}if(!U||U.isStreaming)return;let a=te.current?.getAttachmentIds()??[];te.current?.clear(),T(!1),ve(``),k(!0),le(),a.length>0&&ne(),await v.sendMessage(U.id,n,{lightweight:!0,maxTurns:20,attachments:a.length>0?{ticketKey:t,ids:a}:void 0})},[U,v,le,t,ne,f,r]);(0,I.useEffect)(()=>{U?.isStreaming&&k(!1)},[U?.isStreaming]);let pe=(0,I.useCallback)(()=>{if(U?.isStreaming){(U.messages?.length??0)>1&&v&&v.abortStream(U.id);return}let e=te.current?.getPlainText().trim()??``;e&&fe(e)},[U,v,fe]),me=(0,I.useCallback)(async()=>{if(!b||!y)return!1;try{let e={conversationId:b,title:W.title?.trim()||void 0,description:W.description||void 0,labels:W.labels};f&&(e.editTicketId=f.id);let t=await fetch(`${ul()}/tickets/save-as-draft`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));return K.error(e.error||h(`shell.toasts.saveDraftFailed`)),!1}let n=await t.json();return K.success(h(`shell.toasts.draftSaved`,{id:n.ticket.id,title:n.ticket.title})),!0}catch{return K.error(h(`shell.toasts.draftNetworkError`)),!1}},[b,y,W.title,W.description,W.labels,f,h]),he=(0,I.useCallback)(async()=>{if(!E&&!(!W.title.trim()||!y)){D(!0),Td(y);try{if(ee&&f){let e=await fetch(`${ul()}/tickets/${f.id}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:W.title.trim(),description:W.description,labels:W.labels,priority:W.priority,acceptanceCriteria:W.acceptanceCriteria.filter(e=>e.trim().length>0)})});if(!e.ok){let t=await e.json().catch(()=>({}));K.error(t.error||h(`shell.toasts.updateSpecFailed`));return}let t=await e.json();K.success(h(`shell.toasts.specUpdated`,{id:t.ticket.id,title:t.ticket.title})),p?.(t.ticket),l();return}let e=await fetch(`${ul()}/tickets/from-draft`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:W.title.trim(),description:W.description,labels:W.labels,priority:W.priority,acceptanceCriteria:W.acceptanceCriteria.filter(e=>e.trim().length>0),pendingSpecId:t,conversationId:b,...f?{draftTicketId:f.id}:{}})});if(!e.ok){let t=await e.json().catch(()=>({}));K.error(t.error||h(`shell.toasts.createSpecFailed`));return}let n=await e.json();K.success(h(`shell.toasts.specCreated`,{id:n.ticket.id,title:n.ticket.title})),p?.(n.ticket),l()}catch{K.error(h(`shell.toasts.createNetworkError`))}finally{D(!1),Ed(y)}}},[E,W,y,p,l,t,f,ee,b,h]);(0,I.useEffect)(()=>{function e(e){e.key===`Escape`&&(e.preventDefault(),de())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[de]);let ge=(0,I.useRef)(d);ge.current=d;let[_e,ve]=(0,I.useState)(s??``);(0,I.useEffect)(()=>{ge.current?.({conversationId:b,draftTitle:W.title,composerText:_e,draftOverrides:{title:W.title,description:W.description,priority:W.priority,labels:W.labels,acceptanceCriteria:W.acceptanceCriteria}})},[b,W.title,W.description,W.priority,W.labels,W.acceptanceCriteria,_e]);let ye=oz()?`pl-[88px]`:`pl-4`;return(0,q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex p-3 pt-10 sm:p-6 sm:pt-12 bg-black/40 backdrop-blur-sm animate-in fade-in duration-150`,"data-testid":`explore-spec-backdrop`,children:[(0,q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":h(`shell.dialogAriaLabel`),className:`m-auto w-full h-full max-w-[1600px] flex flex-col bg-background rounded-xl border border-border/40 shadow-2xl overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex-shrink-0 flex items-center justify-between ${ye} pr-4 h-14 border-b border-border bg-card/60 backdrop-blur-sm`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:de,className:`flex items-center gap-2 group p-1 -ml-1 rounded hover:bg-accent focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:outline-none`,"aria-label":h(`shell.backAriaLabel`),children:[(0,q.jsx)(Wd,{className:`w-4 h-4 text-muted-foreground group-hover:text-foreground`}),(0,q.jsxs)(`div`,{className:`text-left min-w-0`,children:[(0,q.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground/70 leading-none`,children:f?h(`shell.editingEyebrow`,{id:f.id}):h(`shell.exploreEyebrow`)}),(0,q.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate block`,children:W.title||o||h(`shell.newSpecPlaceholder`)})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m?(0,q.jsx)(`span`,{"data-testid":`explore-context-pill`,title:h(`shell.contextPillTitle`),className:`hidden md:inline-flex items-center gap-1 px-2 py-1 rounded-full border border-border/50 bg-card/60 text-[10px] text-muted-foreground`,children:h(`shell.contextPill`,{scopes:[m.specrails&&`specrails`,m.openspec&&`openspec`,m.full&&h(`shell.contextScopeCodebase`),m.mcp&&`mcp`].filter(Boolean).join(`, `)||h(`shell.contextScopeMinimal`)})}):null,(0,q.jsx)(Z,{size:`sm`,variant:`outline`,onClick:async()=>{await me()&&l()},disabled:re<2||E,className:`gap-1.5`,"aria-label":h(`shell.saveAsDraftAriaLabel`),"data-testid":`explore-spec-save-draft`,title:re<2?h(`shell.saveAsDraftDisabledTitle`):void 0,children:h(`shell.saveAsDraft`)}),W.title.trim()&&(0,q.jsx)(Z,{size:`sm`,variant:`outline`,onClick:()=>j(!0),disabled:E,className:`gap-1.5`,"aria-label":h(`shell.reviewAriaLabel`),"data-testid":`explore-spec-review`,children:h(`shell.review`)}),_.connected&&!ee&&(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] text-accent-info mr-1`,"data-testid":`jira-create-indicator`,title:g(`addSpec.willCreate`,{key:_.jiraProjectKey??``}),children:[(0,q.jsx)(fp,{className:`w-3 h-3 shrink-0`}),(0,q.jsx)(`span`,{className:`hidden lg:inline`,children:g(`addSpec.willCreate`,{key:_.jiraProjectKey??``})})]}),(0,q.jsxs)(Z,{size:`sm`,onClick:he,disabled:!W.title.trim()||E,className:`gap-1.5`,"aria-label":h(ee?`shell.updateSpecAriaLabel`:`shell.createSpecAriaLabel`),"data-testid":`explore-spec-create`,title:W.title.trim()?void 0:h(`shell.createSpecDisabledTitle`),children:[E?(0,q.jsx)(Yf,{className:`w-3.5 h-3.5 animate-spin`}):ae?(0,q.jsx)(Mp,{className:`w-3.5 h-3.5`}):(0,q.jsx)(nf,{className:`w-3.5 h-3.5`}),h(ee?`shell.updateSpec`:`shell.createSpec`)]}),u&&(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>u(b,W.title||o||``),"aria-label":h(`common:actions.minimize`),"data-testid":`explore-spec-minimize`,children:(0,q.jsx)(tp,{className:`w-4 h-4`})}),(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:de,"aria-label":h(`common:actions.close`),children:(0,q.jsx)(qp,{className:`w-4 h-4`})})]})]}),(0,q.jsxs)(`div`,{className:`flex-1 min-h-0 grid grid-cols-[1fr_360px] divide-x divide-border/40`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col min-h-0`,children:[(0,q.jsxs)(`div`,{ref:R,onScroll:V,className:`flex-1 overflow-y-auto px-5 py-4 pb-24 space-y-3`,"data-testid":`explore-conversation`,children:[!U&&f&&(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground/70 italic px-1 py-2`,children:h(`shell.editModeIntro`)}),!U&&!f&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,q.jsx)(Yf,{className:`w-4 h-4 animate-spin`}),h(`shell.startingConversation`)]}),U?.messages.map((e,t)=>(0,q.jsx)(uz,{role:e.role,content:e.content,timestamp:e.created_at},t)),(O||U?.isStreaming)&&(U?.streamingText?(0,q.jsx)(uz,{role:`assistant`,content:ie,streaming:!0}):(0,q.jsx)(`div`,{className:`px-5 pb-1`,children:(0,q.jsx)(wR,{active:!0,hasSystemEvent:!!U?.isStreaming,hasToolUse:!1,hasText:!1})})),(0,q.jsx)(`div`,{ref:z})]}),oe.length>0&&U&&!U.isStreaming&&(0,q.jsx)(`div`,{role:`group`,"aria-label":h(`shell.suggestedRepliesAriaLabel`),className:`flex-shrink-0 flex gap-1.5 px-5 pb-2 flex-wrap`,children:oe.map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>fe(e),className:`text-[11px] px-2.5 py-1 rounded-full border border-border/60 bg-card/40 hover:bg-card/80 hover:border-primary/40 transition-colors`,children:e},e))}),(0,q.jsxs)(`div`,{className:`flex-shrink-0 px-5 py-3 border-t border-border/40 bg-card/30`,children:[(0,q.jsx)(GE,{ref:te,ticketKey:t,placeholder:U?.isStreaming?``:h(`shell.composerPlaceholder`),minHeight:72,ariaLabel:h(`shell.composerAriaLabel`),onChange:()=>{let e=te.current?.getPlainText()??``;T(e.length>0),ve(e)},onUnsupportedFile:e=>K.error(h(`shell.toasts.unsupportedFileType`,{name:e.name})),onUploadError:(e,t)=>K.error(h(`shell.toasts.uploadFailed`,{name:t.name,message:e.message})),onAttachmentRemoved:e=>{fetch(`${sl}/api/projects/${y}/tickets/${t}/attachments/${e.id}`,{method:`DELETE`}).catch(()=>{}),N(t=>t.filter(t=>t.id!==e.id))},onAttachmentAdded:()=>{ne()},onSubmit:pe}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between mt-2 gap-3`,children:[(0,q.jsx)(`span`,{}),U?.isStreaming&&re>1?(0,q.jsxs)(Z,{size:`sm`,variant:`ghost`,onClick:()=>{U&&v&&v.abortStream(U.id)},className:`gap-1.5 text-destructive hover:text-destructive`,"data-testid":`explore-stop-button`,children:[h(`shell.stop`),(0,q.jsx)(`span`,{className:`text-[10px] opacity-70 ml-1`,children:`⌘⏎`})]}):(0,q.jsxs)(Z,{size:`sm`,onClick:pe,disabled:!w||!U&&!f||O,className:`gap-1.5`,children:[(0,q.jsx)(Dp,{className:`w-3.5 h-3.5`}),h(`shell.send`),(0,q.jsx)(`span`,{className:`text-[10px] opacity-70 ml-1`,children:`⌘⏎`})]})]})]})]}),(0,q.jsxs)(`div`,{className:`relative min-h-0 transition-opacity duration-500 ${U?.isStreaming?`opacity-90`:`opacity-100`}`,children:[U?.isStreaming&&(0,q.jsx)(`div`,{className:`absolute top-0 inset-x-0 h-0.5 overflow-hidden pointer-events-none z-10`,children:(0,q.jsx)(`div`,{className:`h-full bg-primary/40 animate-pulse`})}),(0,q.jsx)(hR,{draft:W,ready:ae,flashFields:se,onFieldChange:ce,attachments:M,onRemoveAttachment:async e=>{try{await fetch(`${sl}/api/projects/${y}/tickets/${t}/attachments/${e}`,{method:`DELETE`})}catch{}N(t=>t.filter(t=>t.id!==e))}})]})]}),(0,q.jsx)(Gy,{open:S,onOpenChange:e=>!e&&C(!1),children:(0,q.jsxs)(Jy,{className:`max-w-sm`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:h(`shell.closePrompt.title`)}),(0,q.jsx)(Qy,{children:h(`shell.closePrompt.description`)})]}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2`,children:[(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>C(!1),"data-testid":`close-prompt-cancel`,children:h(`common:actions.cancel`)}),(0,q.jsx)(Z,{variant:`destructive`,size:`sm`,onClick:l,"data-testid":`close-prompt-discard`,children:h(`common:actions.discard`)}),(0,q.jsx)(Z,{size:`sm`,onClick:async()=>{let e=await me();C(!1),e&&l()},autoFocus:!0,"data-testid":`close-prompt-save-draft`,children:h(`shell.saveAsDraft`)})]})]})})]}),A&&(0,q.jsx)(ez,{baseline:f?{title:f.title,description:f.description,labels:f.labels,priority:f.priority,acceptanceCriteria:f.acceptanceCriteria}:$R,proposed:{title:W.title??``,description:W.description??``,labels:W.labels??[],priority:W.priority??null,acceptanceCriteria:W.acceptanceCriteria??[]},mode:ee?`edit`:`create`,isCommitting:E,onBack:()=>j(!1),onCommit:async()=>{await he(),j(!1)}})]})}function cz(e){let t=e.trimStart();if(t.startsWith(`/specrails:explore-spec`)){let e=t.indexOf(`
|
|
107
|
+
`);if(e===-1)return``;t=t.slice(e+1).replace(/^\s+/,``)}if(t.startsWith(`## Spec context`)){let e=t.indexOf(`## Instruction
|
|
108
|
+
|
|
109
|
+
`);if(e!==-1)return t.slice(e+16).trimStart()}return t}function lz(e){if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function uz({role:e,content:t,streaming:n,timestamp:r}){let{t:i}=G(`explore`);if(e===`system`)return null;let a=e===`user`,o=a?cz(t):t;if(!o.trim()&&!n)return null;let s=lz(r);return(0,q.jsx)(`div`,{className:`flex ${a?`justify-end`:`justify-start`}`,children:(0,q.jsxs)(`div`,{className:`max-w-[85%] rounded-lg px-3 py-2 text-sm ${a?`bg-primary/10 text-foreground`:`bg-card/60 border border-border/40`}`,children:[(0,q.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 mb-1`,children:[(0,q.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground/60 font-semibold`,children:a?i(`shell.you`):`Claude`}),s&&(0,q.jsx)(`div`,{className:`text-[10px] text-muted-foreground/50 font-mono tabular-nums`,children:s})]}),a?(0,q.jsxs)(`div`,{className:`whitespace-pre-wrap break-words`,children:[o,n&&(0,q.jsx)(`span`,{className:`inline-block w-1 h-3 bg-primary/60 ml-0.5 animate-pulse align-baseline`})]}):(0,q.jsxs)(`div`,{className:[`prose prose-sm max-w-none break-words`,`text-foreground`,`[&_p]:text-foreground [&_li]:text-foreground`,`[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5`,`[&_p:first-child]:mt-0 [&_p:last-child]:mb-0`,`[&_strong]:text-accent-primary [&_strong]:font-semibold`,`[&_code]:rounded [&_code]:bg-background/60 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-accent-primary [&_code]:text-[12px]`,`[&_pre]:rounded [&_pre]:bg-background/60 [&_pre]:p-2 [&_pre]:my-2`,`[&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_a]:text-accent-primary [&_a]:underline`,`[&_h1]:text-foreground [&_h2]:text-foreground [&_h3]:text-foreground`,`[&_h1]:text-base [&_h2]:text-sm [&_h3]:text-sm [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold`].join(` `),children:[(0,q.jsx)(rF,{remarkPlugins:[sR],children:o}),n&&(0,q.jsx)(`span`,{className:`inline-block w-1 h-3 bg-primary/60 ml-0.5 animate-pulse align-baseline`})]})]})})}function dz({errorMessage:e,onRetry:t,onClose:n}){let{t:r}=G(`nav`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 p-8`,children:[(0,q.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:r(`errorBoundary.title`)}),e&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/60 font-mono max-w-md break-words`,children:e})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,children:[(0,q.jsx)(yp,{className:`w-3.5 h-3.5`}),r(`common:actions.retry`)]}),n&&(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium border border-border hover:bg-muted/40 transition-colors`,children:[(0,q.jsx)(qp,{className:`w-3.5 h-3.5`}),r(`common:actions.close`)]})]})]})}var fz=class extends I.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[ShellErrorBoundary]`,e,t.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?(0,q.jsx)(dz,{errorMessage:this.state.error?.message??null,onRetry:this.handleRetry,onClose:this.props.onClose}):this.props.children}},pz=`specrails-desktop:active-explore-spec`;function mz(){if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(pz);if(!e)return null;let t=JSON.parse(e);return _z(t)?t:null}catch{return null}}function hz(e){if(!(typeof window>`u`))try{window.localStorage.setItem(pz,JSON.stringify(e))}catch{}}function gz(){if(!(typeof window>`u`))try{window.localStorage.removeItem(pz)}catch{}}function _z(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.projectId==`string`&&typeof t.idea==`string`&&typeof t.pendingSpecId==`string`&&Array.isArray(t.initialAttachmentIds)&&t.initialAttachmentIds.every(e=>typeof e==`string`)}var vz=e=>`specrails-desktop:spec-status-tab:${e}`;function yz(e){if(!e)return`todo`;try{return localStorage.getItem(vz(e))===`done`?`done`:`todo`}catch{return`todo`}}function bz(e,t){if(e)try{localStorage.setItem(vz(e),t)}catch{}}function xz(e){return!!(e.title?.trim()||e.description?.trim()||e.priority&&e.priority!==`medium`||e.labels&&e.labels.length>0||e.acceptanceCriteria&&e.acceptanceCriteria.some(e=>e.trim()))}function Sz(e,t,n){let r=e?.trim();if(r)return r;let i=t?.trim();if(i)return i;let a=n.trim();return a?a.length>60?a.slice(0,57)+`…`:a:J.t(`specs:board.untitledSpec`)}function Cz({tickets:e,allTickets:t,doneTickets:n=[],isLoading:r,onTicketClick:i,onTicketCreated:a,onTicketDelete:o,contractRefiningIds:s=new Set,sortMode:c=`default`,sortDir:l=`desc`,onSortChange:u=()=>{},viewTier:d=`postit`,onViewTierChange:f,rails:p=[],onMoveToRail:m,onTicketStatusChange:h,onTicketPriorityChange:g}){let{t:_}=G(`specs`),[v,y]=(0,I.useState)(!1);(0,I.useEffect)(()=>{if(!v)return;let e=e=>{e.key===`Escape`&&y(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]);let b=(0,I.useCallback)(()=>{v&&y(!1)},[v]),x=(0,I.useCallback)(()=>y(!0),[]),S=(0,I.useCallback)(e=>{o&&o(e.id)},[o]),[C,w]=(0,I.useState)(!1),[T,E]=(0,I.useState)(null),[D,O]=(0,I.useState)(new Set),[k,A]=(0,I.useState)(null),[j,M]=(0,I.useState)(null),{activeProjectId:N}=Sd(),[P,F]=(0,I.useState)(()=>yz(N)),L=(0,I.useCallback)(e=>{F(e),bz(N,e)},[N]),{minimize:ee}=yg(),te=(0,I.useMemo)(()=>{let e=new Map;for(let n of t??[])n.parent_epic_id!=null&&e.set(n.parent_epic_id,(e.get(n.parent_epic_id)??0)+1);return e},[t]),R=(0,I.useMemo)(()=>{let e=new Map;for(let n of t??[])n.is_epic&&e.set(n.id,n.title);return e},[t]),z=(0,I.useMemo)(()=>{let e=new Map;for(let n of t??[])e.set(n.id,n);return e},[t]),B=(0,I.useCallback)(e=>{let t=z.get(e);t&&i(t)},[z,i]);(0,I.useEffect)(()=>{O(new Set),A(null),M(null),F(yz(N))},[N]);let V=(0,I.useCallback)(e=>{O(e)},[]),ne=(0,I.useCallback)(e=>!(k!==null&&e.jira_epic_key!==k||j!==null&&e.jira_sprint_id!==j||D.size>0&&!(e.labels??[]).some(e=>D.has(e))),[D,k,j]),H=D.size===0&&k===null&&j===null,U=(0,I.useMemo)(()=>H?e:e.filter(ne),[e,H,ne]),re=(0,I.useMemo)(()=>H?n:n.filter(ne),[n,H,ne]),ie=(0,I.useMemo)(()=>e.some(e=>e.jira_epic_key)||n.some(e=>e.jira_epic_key),[e,n]),W=(0,I.useMemo)(()=>e.some(e=>e.jira_sprint_id)||n.some(e=>e.jira_sprint_id),[e,n]),ae=(0,I.useMemo)(()=>c===`default`?re:hE(re,c,l),[re,c,l]),[oe,se]=(0,I.useState)({conversationId:null,draftTitle:``,composerText:``,draftOverrides:{}}),ce=(0,I.useRef)(oe);ce.current=oe;let le=(0,I.useRef)(T);le.current=T;let ue=(0,I.useCallback)(()=>{let e=le.current;!e||!e.projectId||(ee({kind:`explore-spec`,projectId:e.projectId,label:Sz(ce.current.draftTitle,e.seedDraftTitle,e.idea),restoreRoute:`/`,params:{initialIdea:e.idea,pendingSpecId:e.pendingSpecId,initialAttachmentIds:e.initialAttachmentIds,resumeConversationId:ce.current.conversationId??e.resumeConversationId,composerText:ce.current.composerText||void 0,draftOverrides:xz(ce.current.draftOverrides)?ce.current.draftOverrides:void 0,editTicket:e.editTicket}}),gz())},[ee]);(0,I.useEffect)(()=>{if(!N)return;let e=mz();!e||e.projectId!==N||(se({conversationId:e.resumeConversationId??null,draftTitle:e.seedDraftTitle??``,composerText:e.composerText??``,draftOverrides:e.draftOverrides??{}}),E({projectId:e.projectId,idea:e.idea,pendingSpecId:e.pendingSpecId,initialAttachmentIds:e.initialAttachmentIds,resumeConversationId:e.resumeConversationId,seedDraftTitle:e.seedDraftTitle,seedComposerText:e.composerText,seedDraftOverrides:e.draftOverrides}))},[N]),(0,I.useEffect)(()=>{!T||!N||hz({projectId:N,idea:T.idea,pendingSpecId:T.pendingSpecId,initialAttachmentIds:T.initialAttachmentIds,resumeConversationId:oe.conversationId??T.resumeConversationId,seedDraftTitle:oe.draftTitle||T.seedDraftTitle,composerText:oe.composerText||void 0,draftOverrides:xz(oe.draftOverrides)?oe.draftOverrides:void 0})},[T,N,oe]);let de=(0,I.useCallback)(e=>{ue(),se({conversationId:null,draftTitle:``,composerText:``,draftOverrides:{}}),N&&E({projectId:N,idea:e.idea,pendingSpecId:e.pendingSpecId,initialAttachmentIds:e.initialAttachmentIds,initialModel:e.model,initialProvider:e.provider,contextScope:e.contextScope})},[ue,N]);bg(`explore-spec`,N,e=>{e.kind===`explore-spec`&&(ue(),se({conversationId:e.params.resumeConversationId??null,draftTitle:e.label,composerText:e.params.composerText??``,draftOverrides:e.params.draftOverrides??{}}),E({projectId:e.projectId,idea:e.params.initialIdea,pendingSpecId:e.params.pendingSpecId,initialAttachmentIds:e.params.initialAttachmentIds,resumeConversationId:e.params.resumeConversationId,seedDraftTitle:e.label,seedComposerText:e.params.composerText,seedDraftOverrides:e.params.draftOverrides,editTicket:e.params.editTicket}))}),(0,I.useEffect)(()=>{function e(e){if(!(e.metaKey||e.ctrlKey)||e.key!==`Enter`)return;let t=e.target?.tagName;t===`INPUT`||t===`TEXTAREA`||e.target?.isContentEditable||(e.preventDefault(),w(!0))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let{isOver:fe,setNodeRef:pe}=Sc({id:`specs`}),{isOver:me,setNodeRef:he}=Sc({id:`done-specs`}),ge=P===`all`||P===`todo`,_e=P===`all`||P===`done`;return(0,q.jsxs)(`div`,{className:`flex flex-col h-full`,onClick:b,children:[(0,q.jsxs)(`div`,{className:`flex items-center px-4 h-12 border-b border-border/40 shrink-0 gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,q.jsx)(jf,{className:`w-4 h-4 text-muted-foreground`}),(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-accent-primary`,children:_(`board.title`)}),e.length+n.length>0&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground bg-muted/30 rounded-full px-1.5 py-0.5`,children:H?e.length+n.length:`${U.length+re.length}/${e.length+n.length}`})]}),(0,q.jsx)(`div`,{className:`flex items-center gap-1 shrink-0`,role:`tablist`,children:[`todo`,`done`].map(e=>{let t=P===e;return(0,q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,onClick:()=>L(e),"data-testid":`specs-tab-${e}`,className:X(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors`,t?`bg-accent-primary/15 text-accent-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/40`),children:[_(`statusFilter.${e}`),(0,q.jsx)(`span`,{className:`text-[10px] tabular-nums opacity-70`,children:e===`todo`?U.length:re.length})]},e)})}),(0,q.jsx)(`div`,{className:`h-5 w-px bg-border/60 shrink-0`,"aria-hidden":!0}),(0,q.jsx)(yb,{tickets:[...e,...n],active:D,onChange:V}),ie&&(0,q.jsx)(bb,{tickets:[...e,...n],active:k,onChange:A}),W&&(0,q.jsx)(xb,{tickets:[...e,...n],active:j,onChange:M}),(0,q.jsx)(`div`,{className:`h-5 w-px bg-border/60 shrink-0 ml-auto`,"aria-hidden":!0}),(0,q.jsx)(eE,{mode:c,dir:l,onChange:u,className:`shrink-0`}),f&&(0,q.jsx)(`div`,{className:`shrink-0`,children:(0,q.jsx)(nE,{tier:d,onChange:f})}),(0,q.jsx)(`div`,{className:`h-5 w-px bg-border/60 shrink-0`,"aria-hidden":!0}),(0,q.jsxs)(Z,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1 shrink-0 border-accent-primary/50 text-accent-primary hover:bg-accent-primary/10 hover:text-accent-primary`,onClick:()=>w(!0),"data-tour":`add-spec-btn`,children:[(0,q.jsx)(pp,{className:`w-3.5 h-3.5`}),_(`common:actions.add`)]})]}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:[ge&&(0,q.jsx)(`div`,{ref:pe,"data-tour":`specs-list`,className:`px-4 pt-3 pb-2 space-y-1.5 transition-colors duration-150 ${fe?`bg-primary/[0.04]`:``}`,children:r?(0,q.jsx)(`div`,{className:`space-y-1.5`,children:[0,1,2].map(e=>(0,q.jsx)(`div`,{className:`h-10 rounded-lg border border-border/40 bg-card/50 animate-pulse`},e))}):U.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center transition-colors ${fe?`text-primary/50`:`text-muted-foreground`}`,children:[(0,q.jsx)(jf,{className:`w-8 h-8 mb-3 opacity-20`}),(0,q.jsx)(`p`,{className:`text-sm`,children:fe?_(`board.dropHere`):e.length===0?_(`board.emptyNoSpecs`):D.size>0?_(`board.emptyNoLabelMatch`):_(`board.emptyNoActiveSpecs`)}),!fe&&e.length===0&&(0,q.jsx)(`p`,{className:`text-xs mt-1 opacity-60`,children:_(`board.emptyHint`)})]}):d===`postit`&&m?(0,q.jsx)(Kc,{items:U.map(e=>e.id),strategy:Hc,children:(0,q.jsx)(`div`,{"data-testid":`specs-board-postit-grid`,className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(240px, 1fr))`},children:U.map(e=>(0,q.jsx)(wz,{ticket:e,onTicketDelete:o,onTicketStatusChange:h,onTicketPriorityChange:g,children:(0,q.jsx)(Eg,{ticket:e,rails:p,onClick:i,onMoveToRail:m,contractRefining:s.has(e.id),epicChildrenCount:e.is_epic?te.get(e.id)??0:void 0,parentEpicTitle:e.parent_epic_id==null?null:R.get(e.parent_epic_id)??null,onOpenParentEpic:B,jiggleMode:v,onLongPress:o?x:void 0,onDelete:o?S:void 0})},e.id))})}):(0,q.jsx)(Kc,{items:U.map(e=>e.id),strategy:Hc,children:(0,q.jsx)(`div`,{"data-testid":`specs-board-list`,"data-tier":`row`,className:`space-y-1.5`,children:U.map(e=>(0,q.jsx)(wz,{ticket:e,onTicketDelete:o,onTicketStatusChange:h,onTicketPriorityChange:g,children:(0,q.jsx)(Uh,{ticket:e,onClick:i,contractRefining:s.has(e.id),epicChildrenCount:e.is_epic?te.get(e.id)??0:void 0,parentEpicTitle:e.parent_epic_id==null?null:R.get(e.parent_epic_id)??null,onOpenParentEpic:B,jiggleMode:v,onLongPress:o?x:void 0,onDelete:o?S:void 0})},e.id))})})}),_e&&(0,q.jsx)(`div`,{ref:he,"data-testid":`specs-board-done-bucket`,className:`px-4 pt-2 pb-3 space-y-1.5 transition-colors duration-150 ${me?`bg-emerald-500/[0.04] aurora-light:bg-accent-success/10`:``} ${ge?`border-t border-border/30 mt-1`:``}`,children:ae.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-6 text-center text-muted-foreground`,children:[(0,q.jsx)(uf,{className:`w-6 h-6 mb-2 opacity-15`}),(0,q.jsx)(`p`,{className:`text-xs opacity-60`,children:me?_(`board.dropToMarkDone`):D.size>0&&n.length>0?_(`board.emptyNoDoneLabelMatch`):_(`board.emptyNoCompleted`)})]}):d===`postit`&&m?(0,q.jsx)(Kc,{items:ae.map(e=>e.id),strategy:Hc,children:(0,q.jsx)(`div`,{"data-testid":`specs-board-done-postit-grid`,className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(240px, 1fr))`},children:ae.map(e=>(0,q.jsx)(wz,{ticket:e,onTicketDelete:o,onTicketStatusChange:h,onTicketPriorityChange:g,children:(0,q.jsx)(Eg,{ticket:e,rails:p,onClick:i,onMoveToRail:m,contractRefining:s.has(e.id),epicChildrenCount:e.is_epic?te.get(e.id)??0:void 0,parentEpicTitle:e.parent_epic_id==null?null:R.get(e.parent_epic_id)??null,onOpenParentEpic:B,jiggleMode:v,onLongPress:o?x:void 0,onDelete:o?S:void 0})},e.id))})}):(0,q.jsx)(Kc,{items:ae.map(e=>e.id),strategy:Hc,children:ae.map(e=>(0,q.jsx)(wz,{ticket:e,onTicketDelete:o,onTicketStatusChange:h,onTicketPriorityChange:g,children:(0,q.jsx)(Uh,{ticket:e,onClick:i,contractRefining:s.has(e.id),epicChildrenCount:e.is_epic?te.get(e.id)??0:void 0,parentEpicTitle:e.parent_epic_id==null?null:R.get(e.parent_epic_id)??null,onOpenParentEpic:B,jiggleMode:v,onLongPress:o?x:void 0,onDelete:o?S:void 0})},e.id))})})]}),(0,q.jsx)(vO,{open:C,onClose:()=>w(!1),tickets:t??e,onExploreLaunch:de}),T&&N&&(0,q.jsx)(fz,{onClose:()=>E(null),children:(0,q.jsx)(sz,{initialIdea:T.idea,pendingSpecId:T.pendingSpecId,initialAttachmentIds:T.initialAttachmentIds,initialModel:T.initialModel,initialProvider:T.initialProvider,resumeConversationId:T.resumeConversationId,seedDraftTitle:T.seedDraftTitle,seedComposerText:T.seedComposerText,seedDraftOverrides:T.seedDraftOverrides,editTicket:T.editTicket,contextScope:T.contextScope,onStateChange:e=>se(e),onClose:()=>{kE(T.pendingSpecId).catch(()=>{}),E(null),gz()},onMinimize:(e,t)=>{let n=ce.current;ee({kind:`explore-spec`,projectId:T.projectId,label:Sz(t,T.seedDraftTitle,T.idea),restoreRoute:`/`,params:{initialIdea:T.idea,pendingSpecId:T.pendingSpecId,initialAttachmentIds:T.initialAttachmentIds,resumeConversationId:e??void 0,composerText:n.composerText||void 0,draftOverrides:xz(n.draftOverrides)?n.draftOverrides:void 0}}),E(null),gz()},onTicketCreated:e=>{E(null),gz(),a?.(e)}},`${T.pendingSpecId}:${T.resumeConversationId??`fresh`}`)})]})}function wz({ticket:e,onTicketDelete:t,onTicketStatusChange:n,onTicketPriorityChange:r,children:i}){return!t||!n||!r?(0,q.jsx)(q.Fragment,{children:i}):(0,q.jsx)(hb,{ticket:e,onDelete:t,onStatusChange:n,onPriorityChange:r,children:i})}function Tz({mode:e,status:t,activeJobId:n,ticketCount:r,ultracodeAvailable:i,onModeChange:a,onToggle:o}){let{t:s}=G(`dashboard`),c=ct(),l=r>0;return(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t===`running`&&n&&(0,q.jsxs)(Z,{size:`sm`,variant:`ghost`,className:`group h-6 px-2 gap-1 rounded-md border border-accent-info/20 bg-accent-info/5 text-[10px] font-semibold text-accent-info transition-all duration-200 hover:-translate-y-px hover:border-accent-info/50 hover:bg-accent-info/15 hover:text-accent-info hover:shadow-[0_0_14px_hsl(191_97%_77%/0.22)] active:translate-y-0 active:scale-[0.98]`,onClick:()=>c(`/jobs/${n}`),title:s(`railControls.viewJobLog`),children:[(0,q.jsx)(Tp,{className:`w-3 h-3 transition-transform duration-200 group-hover:scale-110`}),(0,q.jsx)(`span`,{children:s(`railControls.log`)})]}),(0,q.jsxs)(`div`,{className:`flex items-center rounded-md border border-border/40 bg-muted/20 overflow-hidden text-[10px]`,children:[(0,q.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 transition-colors ${e===`implement`?`bg-primary/15 text-primary font-medium`:`text-muted-foreground hover:text-foreground hover:bg-muted/30`}`,onClick:()=>a(`implement`),children:s(`railControls.implement`)}),(0,q.jsx)(`div`,{className:`w-px h-3 bg-border/40 shrink-0`}),(0,q.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 transition-colors ${e===`batch-implement`?`bg-primary/15 text-primary font-medium`:`text-muted-foreground hover:text-foreground hover:bg-muted/30`}`,onClick:()=>a(`batch-implement`),children:s(`railControls.batch`)}),i&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`w-px h-3 bg-border/40 shrink-0`}),(0,q.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 transition-colors ${e===`ultracode`?`bg-accent-highlight/20 text-accent-highlight font-semibold`:`text-muted-foreground hover:text-foreground hover:bg-muted/30`}`,onClick:()=>a(`ultracode`),title:s(`railControls.ultraTitle`),children:s(`railControls.ultra`)})]})]}),(0,q.jsx)(Z,{size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 rounded-full transition-all duration-200 ${t===`running`?`text-red-400 aurora-light:text-destructive hover:text-red-300 aurora-light:hover:text-destructive hover:bg-red-400/10 aurora-light:hover:bg-destructive/10`:t===`failed`?`text-amber-400 aurora-light:text-accent-warning hover:text-emerald-300 aurora-light:hover:text-accent-success hover:bg-emerald-400/10 aurora-light:hover:bg-accent-success/10`:l?`text-emerald-400 aurora-light:text-accent-success hover:text-emerald-300 aurora-light:hover:text-accent-success hover:bg-emerald-400/10 aurora-light:hover:bg-accent-success/10`:`text-muted-foreground/30 cursor-not-allowed`}`,onClick:o,disabled:!l&&t!==`running`,title:s(t===`running`?`railControls.stop`:t===`failed`?`railControls.failedRetry`:l?`railControls.play`:`railControls.addSpecsFirst`),children:t===`running`?(0,q.jsx)(Pp,{className:`w-2.5 h-2.5 fill-current`}):t===`failed`?(0,q.jsx)(Hp,{className:`w-2.5 h-2.5`}):(0,q.jsx)(dp,{className:`w-2.5 h-2.5 fill-current`})})]})}var Ez=`__legacy__`;function Dz({value:e,onChange:t}){let{t:n}=G(`agents`),[r,i]=(0,I.useState)([]),[a,o]=(0,I.useState)(!1);if((0,I.useEffect)(()=>{let e=!1;return fetch(`${ul()}/profiles`).then(e=>e.ok?e.json():{profiles:[]}).then(t=>{e||i(t.profiles)}).catch(()=>{e||i([])}).finally(()=>{e||o(!0)}),()=>{e=!0}},[]),!a||r.length===0)return null;let s=e??Ez;return(0,q.jsxs)(`div`,{className:`inline-flex items-center`,title:n(`railSelectors.profileTitle`),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(Xd,{className:`w-3 h-3 text-muted-foreground mr-1`}),(0,q.jsxs)(`select`,{value:s,onChange:e=>{let n=e.target.value;t(n===Ez?null:n)},className:`h-5 text-[10px] rounded border border-border/50 bg-transparent text-muted-foreground hover:text-foreground pr-4 pl-1 focus:outline-none focus:ring-1 focus:ring-primary/40`,children:[r.map(e=>(0,q.jsx)(`option`,{value:e.name,children:e.name},e.name)),(0,q.jsx)(`option`,{value:Ez,children:n(`railSelectors.noProfile`)})]})]})}function Oz({value:e,providers:t,onChange:n}){let{t:r}=G(`agents`);if(!t||t.length<=1)return null;let i=e??t[0];return(0,q.jsxs)(`div`,{className:`inline-flex items-center`,title:r(`railSelectors.engineTitle`),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(xf,{className:`w-3 h-3 text-muted-foreground mr-1`}),(0,q.jsx)(`select`,{value:i,"aria-label":r(`railSelectors.engineTitle`),"data-testid":`rail-engine-selector`,onChange:e=>n(e.target.value),className:`h-5 text-[10px] rounded border border-border/50 bg-transparent text-muted-foreground hover:text-foreground pr-4 pl-1 focus:outline-none focus:ring-1 focus:ring-primary/40`,children:t.map(e=>(0,q.jsx)(`option`,{value:e,children:QE(e)},e))})]})}var kz=[`haiku`,`sonnet`,`opus`],Az={haiku:`Haiku`,sonnet:`Sonnet`,opus:`Opus`};function jz({value:e,onChange:t}){let{t:n}=G(`agents`),r=e??`sonnet`;return(0,q.jsxs)(`div`,{className:`inline-flex items-center`,title:n(`railSelectors.modelTitle`),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(Mp,{className:`w-3 h-3 text-accent-highlight mr-1`}),(0,q.jsx)(`select`,{value:r,"aria-label":n(`railSelectors.modelTitle`),"data-testid":`rail-model-selector`,onChange:e=>t(e.target.value),className:`h-5 text-[10px] rounded border border-border/50 bg-transparent text-muted-foreground hover:text-foreground pr-4 pl-1 focus:outline-none focus:ring-1 focus:ring-primary/40`,children:kz.map(e=>(0,q.jsx)(`option`,{value:e,children:Az[e]},e))})]})}var Mz=800,Nz=60;function Pz({id:e,label:t,tickets:n,mode:r,status:i,activeJobId:a,profileName:o,aiEngine:s,ultracodeModel:c,providers:l,jiggleMode:u,dragHandleListeners:d,dragHandleAttributes:f,density:p=`normal`,onModeChange:m,onProfileChange:h,onEngineChange:g,onUltracodeModelChange:_,onToggle:v,onTicketClick:y,onDelete:b,onLongPress:x,onRename:S,onTicketMoveToSpecs:C}){let{t:w}=G(`dashboard`),T=(s??l?.[0])!==`codex`,E=(s??l?.[0]??`claude`)===`claude`,D=!!g&&i!==`running`&&(l?.length??0)>1,O=!!h&&i!==`running`&&T,k=!!_&&i!==`running`&&r===`ultracode`&&E,A=D||k,[j,M]=(0,I.useState)(null);(0,I.useEffect)(()=>{if(!j)return;function e(e){e.target?.closest(`[role="menu"]`)||M(null)}function t(e){e.key===`Escape`&&M(null)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[j]);let{isOver:N,setNodeRef:P}=Sc({id:e}),{active:F}=yc(),L=typeof F?.id==`number`,[ee,te]=(0,I.useState)(0),[R,z]=(0,I.useState)(!1),[B,V]=(0,I.useState)(!1),[ne,H]=(0,I.useState)(!1),[U,re]=(0,I.useState)(``),ie=(0,I.useRef)(null),W=(0,I.useRef)(null),ae=(0,I.useRef)(null),oe=(0,I.useRef)(!1),se=i===`running`,ce=!se,le=(0,I.useCallback)(()=>{ae.current&&=(clearTimeout(ae.current),null)},[]),ue=(0,I.useCallback)(()=>{ce&&(oe.current=!1,ae.current=setTimeout(()=>{oe.current=!0,x(),ae.current=null},Mz))},[ce,x]),de=(0,I.useCallback)(e=>{let t=e.touches[0];W.current={x:t.clientX,y:t.clientY},z(!1),V(!1),ue()},[ue]),fe=(0,I.useCallback)(e=>{if(!W.current)return;let t=e.touches[0],n=t.clientX-W.current.x,r=t.clientY-W.current.y;(Math.abs(n)>10||Math.abs(r)>10)&&le(),ce&&n<-10&&Math.abs(n)>Math.abs(r)*1.5&&(z(!0),te(Math.max(n,-150)))},[ce,le]),pe=(0,I.useCallback)(()=>{le(),R&&(ee<-Nz&&ce?(V(!0),te(-80)):(te(0),V(!1)),z(!1)),W.current=null},[ee,R,ce,le]),me=(0,I.useCallback)(e=>{e.target.closest(`button`)||ue()},[ue]),he=(0,I.useCallback)(()=>{le()},[le]),ge=(0,I.useCallback)(e=>{if(oe.current){e.stopPropagation(),oe.current=!1;return}B&&(V(!1),te(0))},[B]),_e=(0,I.useCallback)(e=>{e.stopPropagation(),V(!1),te(0),b()},[b]),ve=u&&ce?-(Array.from(e).reduce((e,t)=>e+t.charCodeAt(0),0)*53%400):void 0,ye=ve===void 0?void 0:{animationDelay:`${ve}ms`};return p===`compact`?(0,q.jsxs)(`div`,{ref:P,"data-testid":`rail-row-compact-${e}`,"data-density":`compact`,onMouseDown:me,onMouseUp:he,onMouseLeave:he,onClick:ge,style:ye,className:`group relative flex flex-col gap-1.5 rounded-xl border bg-card p-2.5 transition-all ${N?`border-accent-info/60 shadow-[0_0_0_1px_hsl(var(--accent-info)/0.35),0_0_14px_hsl(var(--accent-info)/0.18)]`:L?`border-dashed border-accent-info/35`:se?`border-accent-success/40 shadow-sm`:`border-border/40 hover:border-accent-info/30 hover:shadow-md`} ${u&&ce?`animate-jiggle`:``}`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,q.jsx)(`button`,{type:`button`,className:`touch-none cursor-grab active:cursor-grabbing text-muted-foreground/30 hover:text-muted-foreground/70 transition-colors shrink-0`,...d,...f,children:(0,q.jsx)(Bf,{className:`w-3 h-3`})}),(0,q.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full shrink-0 transition-all duration-300 ${se?`bg-accent-success shadow-[0_0_4px_hsl(var(--accent-success)/0.8)] animate-pulse`:i===`failed`?`bg-accent-warning shadow-[0_0_4px_hsl(var(--accent-warning)/0.6)]`:`bg-muted-foreground/25`}`,"aria-hidden":!0}),ne?(0,q.jsx)(`form`,{className:`flex items-center gap-0.5 min-w-0 flex-1`,onSubmit:e=>{e.preventDefault();let t=U.trim();t&&S(t),H(!1)},children:(0,q.jsx)(`input`,{ref:ie,type:`text`,value:U,onChange:e=>re(e.target.value),onBlur:()=>{let e=U.trim();e&&S(e),H(!1)},onKeyDown:e=>{e.key===`Escape`&&H(!1)},className:`flex-1 min-w-0 text-xs font-medium bg-transparent border-b border-accent-info/60 outline-none text-foreground/90 px-0.5`,autoFocus:!0})}):(0,q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(t.startsWith(`Rail `)?t.slice(5):t),H(!0),setTimeout(()=>ie.current?.select(),0)},className:`flex-1 min-w-0 text-left text-xs font-medium text-foreground/90 hover:text-foreground truncate`,title:t,children:t})]}),n.length>0&&(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1`,"data-testid":`rail-row-compact-tickets-${e}`,children:n.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),y(e)},onMouseDown:t=>{t.button===2&&C&&(t.preventDefault(),t.stopPropagation(),M({ticketId:e.id,x:t.clientX,y:t.clientY}))},onContextMenu:e=>{C&&(e.preventDefault(),e.stopPropagation())},onPointerDown:e=>e.stopPropagation(),title:`#${e.id} ${e.title}`,className:`inline-flex items-center px-1.5 py-0.5 rounded-md text-[10px] font-mono font-medium border border-accent-info/30 bg-accent-info/10 text-accent-info hover:bg-accent-info/20 hover:border-accent-info/60 transition-colors`,children:[`#`,e.id]},e.id))}),j&&C&&(0,Qn.createPortal)((0,q.jsx)(`div`,{role:`menu`,"data-testid":`rail-row-compact-context-menu-${e}`,className:`fixed z-[200] min-w-[160px] rounded-lg border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/40 p-1`,style:{top:Math.min(j.y,window.innerHeight-60),left:Math.min(j.x,window.innerWidth-180)},onPointerDown:e=>e.stopPropagation(),children:(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{e.stopPropagation(),C(j.ticketId),M(null)},className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left text-xs text-accent-warning hover:bg-accent-warning/10 transition-colors`,children:[(0,q.jsx)(Wd,{className:`w-3 h-3`,"aria-hidden":!0}),w(`railRow.moveToSpecs`)]})}),document.body),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[g&&!se&&(0,q.jsx)(Oz,{value:s??null,providers:l??[],onChange:g}),h&&!se&&T&&(0,q.jsx)(Dz,{value:o??null,onChange:h}),_&&!se&&r===`ultracode`&&E&&(0,q.jsx)(jz,{value:c??null,onChange:_}),(0,q.jsx)(Tz,{mode:r,status:i,activeJobId:a,ticketCount:n.length,ultracodeAvailable:E,onModeChange:m,onToggle:v})]}),u&&ce&&(0,q.jsx)(`button`,{type:`button`,onClick:_e,className:`absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center rounded-full bg-destructive text-destructive-foreground shadow-sm hover:opacity-90 transition-opacity`,"aria-label":w(`railRow.deleteRail`,{label:t}),children:(0,q.jsx)(Vp,{className:`w-3 h-3`})})]}):(0,q.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl`,onClick:ge,onTouchStart:de,onTouchMove:fe,onTouchEnd:pe,onMouseDown:me,onMouseUp:he,onMouseLeave:he,children:[ce&&(B||ee<0)&&(0,q.jsx)(`div`,{className:`absolute inset-y-0 right-0 w-20 flex items-center justify-center bg-red-500/90 rounded-r-xl z-0`,children:(0,q.jsxs)(`button`,{type:`button`,onClick:_e,className:`flex flex-col items-center gap-1 text-white`,children:[(0,q.jsx)(Vp,{className:`w-5 h-5`}),(0,q.jsx)(`span`,{className:`text-[9px] font-medium`,children:w(`common:actions.delete`)})]})}),(0,q.jsxs)(`div`,{className:`relative z-10 flex flex-col rounded-xl border overflow-hidden bg-card ${u&&ce?`animate-jiggle`:``} ${N?`border-primary/50 shadow-[0_0_0_1px_hsl(var(--primary)/0.25),0_0_12px_hsl(var(--primary)/0.08)]`:`border-border/40 hover:border-border/60`}`,style:{transform:ee<0?`translateX(${ee}px)`:void 0,transition:R?`none`:`transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1)`,...ve===void 0?{}:{animationDelay:`${ve}ms`}},children:[(0,q.jsxs)(`div`,{className:`flex flex-col border-b border-border/30 bg-gradient-to-r from-muted/30 to-transparent shrink-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,q.jsx)(`button`,{type:`button`,className:`touch-none cursor-grab active:cursor-grabbing text-muted-foreground/30 hover:text-muted-foreground/60 transition-colors -ml-1`,...d,...f,children:(0,q.jsx)(Bf,{className:`w-3.5 h-3.5`})}),(0,q.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full shrink-0 transition-all duration-300 ${i===`running`?`bg-emerald-400 shadow-[0_0_4px_hsl(142_70%_56%/0.8)] animate-pulse`:i===`failed`?`bg-amber-400 shadow-[0_0_4px_hsl(38_92%_50%/0.6)]`:`bg-muted-foreground/25`}`}),ne?(0,q.jsxs)(`form`,{className:`flex items-center gap-0.5`,onSubmit:e=>{e.preventDefault();let t=U.trim();t&&S(t),H(!1)},children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground/50`,children:`Rail `}),(0,q.jsx)(`input`,{ref:ie,type:`text`,value:U,onChange:e=>re(e.target.value),onBlur:()=>{let e=U.trim();e&&S(e),H(!1)},onKeyDown:e=>{e.key===`Escape`&&H(!1)},className:`w-24 text-xs font-medium bg-transparent border-b border-primary/50 outline-none text-foreground/80 px-0.5`,autoFocus:!0})]}):(0,q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(t.startsWith(`Rail `)?t.slice(5):t),H(!0),setTimeout(()=>ie.current?.select(),0)},className:`text-xs font-medium text-foreground/80 hover:text-foreground hover:underline decoration-dotted underline-offset-2 cursor-text transition-colors`,children:t}),n.length>0&&(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground bg-muted/30 rounded-full px-1.5 py-0.5 leading-none`,children:n.length})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[!A&&O&&h&&(0,q.jsx)(Dz,{value:o??null,onChange:h}),(0,q.jsx)(Tz,{mode:r,status:i,activeJobId:a,ticketCount:n.length,ultracodeAvailable:E,onModeChange:m,onToggle:v}),u&&ce&&(0,q.jsx)(`button`,{type:`button`,onClick:_e,className:`w-5 h-5 flex items-center justify-center rounded-full bg-red-500 text-white shadow-sm hover:bg-red-600 transition-colors`,children:(0,q.jsx)(Vp,{className:`w-3 h-3`})})]})]}),A&&(0,q.jsxs)(`div`,{className:`flex items-center flex-wrap gap-x-3 gap-y-1 px-3 py-1.5 border-t border-border/20 bg-background/20`,children:[D&&g&&(0,q.jsx)(Oz,{value:s??null,providers:l??[],onChange:g}),A&&O&&h&&(0,q.jsx)(Dz,{value:o??null,onChange:h}),k&&_&&(0,q.jsx)(jz,{value:c??null,onChange:_})]})]}),(0,q.jsx)(`div`,{ref:P,"data-drop-target":L?`available`:void 0,className:`min-h-[56px] px-3 py-2 space-y-1.5 transition-colors duration-150 ${N?`bg-accent-info/[0.06]`:L?`bg-accent-info/[0.02]`:`bg-card/20`}`,children:n.length===0?(0,q.jsx)(`div`,{className:`h-10 flex items-center justify-center rounded-lg border border-dashed transition-all duration-150 ${N?`border-accent-info/60 text-accent-info/80 bg-accent-info/[0.06]`:L?`border-accent-info/35 text-accent-info/60`:`border-border/25 text-muted-foreground/30`}`,children:(0,q.jsx)(`span`,{className:`text-[10px] select-none`,children:w(N?`railRow.dropHere`:L?`railRow.dropOnThisRail`:`railRow.dragSpecsHere`)})}):(0,q.jsx)(Kc,{items:n.map(e=>e.id),strategy:Hc,children:n.map(e=>(0,q.jsx)(`div`,{onMouseDown:t=>{t.button===2&&C&&(t.preventDefault(),t.stopPropagation(),M({ticketId:e.id,x:t.clientX,y:t.clientY}))},onContextMenu:e=>{C&&(e.preventDefault(),e.stopPropagation())},children:(0,q.jsx)(Uh,{ticket:e,onClick:y,dragDisabled:i===`running`})},e.id))})}),j&&C&&p===`normal`&&(0,Qn.createPortal)((0,q.jsx)(`div`,{role:`menu`,"data-testid":`rail-row-normal-context-menu-${e}`,className:`fixed z-[200] min-w-[160px] rounded-lg border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/40 p-1`,style:{top:Math.min(j.y,window.innerHeight-60),left:Math.min(j.x,window.innerWidth-180)},onPointerDown:e=>e.stopPropagation(),children:(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{e.stopPropagation(),C(j.ticketId),M(null)},className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left text-xs text-accent-warning hover:bg-accent-warning/10 transition-colors`,children:[(0,q.jsx)(Wd,{className:`w-3 h-3`,"aria-hidden":!0}),w(`railRow.moveToSpecs`)]})}),document.body)]})]})}var Fz=`__rail:`;function Iz(e){return`${Fz}${e}`}function Lz(e){return typeof e==`string`&&e.startsWith(`__rail:`)}function Rz(e){return e.slice(7)}function zz(e,t,n){let r=new Set(n);return e.map((e,n)=>n===t?{...e,status:`idle`,activeJobId:void 0,ticketIds:r.size>0?e.ticketIds.filter(e=>!r.has(e)):[]}:e)}function Bz({railId:e,children:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=el({id:Iz(e)});return(0,q.jsx)(`div`,{ref:i,style:{transform:Ya.Translate.toString(a),transition:o,opacity:s?.4:void 0,position:`relative`,zIndex:s?50:void 0},children:t({listeners:r??{},attributes:n,isDragging:s})})}function Vz({rails:e,ticketMap:t,providers:n,onModeChange:r,onProfileChange:i,onEngineChange:a,onUltracodeModelChange:o,onToggle:s,onTicketClick:c,onAddRail:l,onDeleteRail:u,onRenameRail:d,onTicketMoveToSpecs:f}){let{t:p}=G(`dashboard`),m=e.filter(e=>e.status===`running`).length,[h,g]=(0,I.useState)(!1),_=(0,I.useRef)(null),[v,y]=(0,I.useState)(`normal`);(0,I.useEffect)(()=>{if(typeof ResizeObserver>`u`)return;let e=_.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width;y(e<320?`compact`:`normal`)}});return t.observe(e),()=>t.disconnect()},[]);let b=(0,I.useCallback)(()=>{h&&g(!1)},[h]);(0,I.useEffect)(()=>{if(!h)return;let e=e=>{e.key===`Escape`&&g(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let x=e.map(e=>Iz(e.id));return(0,q.jsxs)(`div`,{ref:_,className:`flex flex-col h-full`,"data-density":v,onClick:b,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 h-12 border-b border-border/40 shrink-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Gf,{className:`w-4 h-4 text-muted-foreground`}),(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-accent-secondary`,children:p(`railsBoard.title`)}),m>0&&(0,q.jsx)(`span`,{className:`text-[10px] text-emerald-400 aurora-light:text-accent-success bg-emerald-400/10 aurora-light:bg-accent-success/10 rounded-full px-1.5 py-0.5 font-medium whitespace-nowrap`,children:p(`railsBoard.runningCount`,{count:m})})]}),(0,q.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),l()},className:`flex items-center gap-1 h-7 px-2.5 text-xs font-medium rounded-md border border-accent-primary/50 text-accent-primary hover:bg-accent-primary/10 transition-colors`,children:[(0,q.jsx)(pp,{className:`w-3.5 h-3.5`}),p(`common:actions.add`)]})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-2.5`,children:(0,q.jsx)(Kc,{items:x,strategy:Hc,children:e.map((e,l)=>(0,q.jsx)(Bz,{railId:e.id,children:({listeners:p,attributes:m})=>(0,q.jsx)(`div`,{"data-tour":l===0?`rail-1`:void 0,children:(0,q.jsx)(Pz,{id:e.id,label:e.label,tickets:e.ticketIds.map(e=>t.get(e)).filter(e=>e!==void 0),mode:e.mode,status:e.status,activeJobId:e.activeJobId,profileName:e.profileName??null,aiEngine:e.aiEngine??null,ultracodeModel:e.ultracodeModel??null,providers:n,jiggleMode:h,density:v,dragHandleListeners:p,dragHandleAttributes:m,onModeChange:t=>r(e.id,t),onProfileChange:i?t=>i(e.id,t):void 0,onEngineChange:a?t=>a(e.id,t):void 0,onUltracodeModelChange:o?t=>o(e.id,t):void 0,onToggle:()=>s(e.id),onTicketClick:c,onDelete:()=>u(e.id),onLongPress:()=>g(!0),onRename:t=>d(e.id,t),onTicketMoveToSpecs:f})})},e.id))})})]})}function Hz(e){return e?`specrails-desktop:dashboard-split:${e}`:null}function Uz(e){let t=Hz(e);if(!t)return null;try{let e=localStorage.getItem(t);if(!e)return null;let n=Number.parseInt(e,10);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function Wz(e,t){let n=Hz(e);if(n)try{localStorage.setItem(n,String(Math.round(t)))}catch{}}function Gz(e,t){let n=Math.max(320,t-280);return Math.min(Math.max(e,320),n)}var Kz=.7;function qz(e){return Gz(Math.round(e*Kz),e)}function Jz(e,t){let n=qz(t);return Math.abs(e-n)<=48?n:e}function Yz(e,t){let[n,r]=(0,I.useState)(()=>typeof window<`u`?window.innerWidth:1200),i=(0,I.useRef)(n),[a,o]=(0,I.useState)(()=>{if(typeof window>`u`)return null;let e=window.innerWidth;return e<900?null:qz(e)}),s=(0,I.useRef)(null),c=(0,I.useRef)(null),l=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(typeof window>`u`)return;let e=t?.current?.clientWidth||window.innerWidth;if(r(e),i.current=e,e<900){o(null);return}o(qz(e))},[e,t]),(0,I.useEffect)(()=>{function n(t){if(r(t),t<900){i.current=t,o(null);return}let n=t-i.current;i.current=t,o(r=>{let i=r??Uz(e)??qz(t),a=Gz(r!==null&&Number.isFinite(n)?i+n:i,t);return a!==r&&Wz(e,a),a})}let a=t?.current;if(a&&typeof ResizeObserver<`u`){let e=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;typeof t==`number`&&n(t)});return e.observe(a),n(a.clientWidth||window.innerWidth),()=>e.disconnect()}function s(){n(window.innerWidth)}return window.addEventListener(`resize`,s),()=>window.removeEventListener(`resize`,s)},[e,t]);let u=(0,I.useCallback)(()=>{if(c.current=null,l.current===null)return;let e=Gz(l.current,n);l.current=null,o(e)},[n]),d=(0,I.useCallback)(e=>{if(!s.current)return;let t=e.clientX-s.current.startClientX;l.current=s.current.startLeftWidth+t,c.current===null&&(c.current=requestAnimationFrame(u))},[u]),f=(0,I.useCallback)(t=>{if(!s.current)return;let{pointerId:r,element:i}=s.current;try{i.releasePointerCapture(r)}catch{}s.current=null,window.removeEventListener(`pointermove`,d),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,f),o(t=>{if(t===null)return t;let r=Gz(Jz(t,n),n);return Wz(e,r),r})},[d,e,n]),p=(0,I.useCallback)(e=>{let t=e.nativeEvent??e,n=e.currentTarget??t.target;try{n.setPointerCapture(t.pointerId)}catch{}s.current={pointerId:t.pointerId,element:n,startClientX:t.clientX,startLeftWidth:a??0},window.addEventListener(`pointermove`,d),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,f)},[d,f,a]),m=(0,I.useCallback)(()=>{if(typeof window>`u`)return;let n=t?.current?.clientWidth||window.innerWidth;if(n<900)return;let r=qz(n);o(r),Wz(e,r)},[e,t]);return{leftWidth:a,enabled:a!==null&&n>=900,beginDrag:p,resetToDefault:m}}function Xz({leftWidth:e,onPointerDown:t,onReset:n,viewport:r}){let i=(0,I.useCallback)(t=>{let n=t.shiftKey?64:16;t.key===`ArrowLeft`&&(t.preventDefault(),e-n)},[e]);return(0,q.jsxs)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-valuenow":e,"aria-valuemin":320,"aria-valuemax":Math.max(320,r-280),tabIndex:0,onPointerDown:t,onDoubleClick:n,onKeyDown:i,className:`relative w-1.5 shrink-0 cursor-col-resize group select-none touch-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-info/60`,"data-testid":`dashboard-splitter`,children:[(0,q.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border/40 group-hover:bg-accent-info/40 group-focus-visible:bg-accent-info/60 transition-colors`}),(0,q.jsxs)(`div`,{className:`absolute inset-y-0 left-1/2 -translate-x-1/2 flex flex-col items-center justify-center gap-1 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,q.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-accent-info/60`}),(0,q.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-accent-info/60`}),(0,q.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-accent-info/60`})]})]})}function Zz(e){let t=Vl(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Qz(e,t){let n=Vl(e)-+Vl(t);return n<0?-1:n>0?1:n}function $z(e){return Ll(e,Date.now())}function eB(e,t,n){let[r,i]=Rl(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function tB(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function nB(e,t){return Vl(e)-+Vl(t)}function rB(e,t){let n=Vl(e,t?.in);return n.setHours(23,59,59,999),n}function iB(e,t){let n=Vl(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function aB(e,t){let n=Vl(e,t?.in);return+rB(n,t)==+iB(n,t)}function oB(e,t,n){let[r,i,a]=Rl(n?.in,e,e,t),o=Qz(i,a),s=Math.abs(eB(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=Qz(i,a)===-o;aB(r)&&s===1&&Qz(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function sB(e,t,n){let r=nB(e,t)/1e3;return tB(n?.roundingMethod)(r)}function cB(e,t,n){let r=Bl(),i=n?.locale??r.locale??ou,a=Qz(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Rl(n?.in,...a>0?[t,e]:[e,t]),l=sB(c,s),u=(Zz(c)-Zz(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}else if(d<2520)return i.formatDistance(`xDays`,1,o);else if(d<43200){let e=Math.round(d/Pl);return i.formatDistance(`xDays`,e,o)}else if(d<43200*2)return f=Math.round(d/Nl),i.formatDistance(`aboutXMonths`,f,o);if(f=oB(c,s),f<12){let e=Math.round(d/Nl);return i.formatDistance(`xMonths`,e,o)}else{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function lB(e,t){return cB(e,$z(e),t)}function uB(e,t){let n=()=>Ll(t?.in,NaN),r=t?.additionalDigits??2,i=hB(e),a;if(i.date){let e=gB(i.date,r);a=_B(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=yB(i.time),isNaN(s)))return n();if(i.timezone){if(c=xB(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=Vl(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return Vl(o+s+c,t?.in)}var dB={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},fB=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,pB=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,mB=/^([+-])(\d{2})(?::?(\d{2}))?$/;function hB(e){let t={},n=e.split(dB.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],dB.timeZoneDelimiter.test(t.date)&&(t.date=e.split(dB.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=dB.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function gB(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function _B(e,t){if(t===null)return new Date(NaN);let n=e.match(fB);if(!n)return new Date(NaN);let r=!!n[4],i=vB(n[1]),a=vB(n[2])-1,o=vB(n[3]),s=vB(n[4]),c=vB(n[5])-1;if(r)return DB(t,s,c)?SB(t,s,c):new Date(NaN);{let e=new Date(0);return!TB(t,a,o)||!EB(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function vB(e){return e?parseInt(e):1}function yB(e){let t=e.match(pB);if(!t)return NaN;let n=bB(t[1]),r=bB(t[2]),i=bB(t[3]);return OB(n,r,i)?n*Ml+r*jl+i*1e3:NaN}function bB(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function xB(e){if(e===`Z`)return 0;let t=e.match(mB);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return kB(r,i)?n*(r*Ml+i*jl):NaN}function SB(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var CB=[31,null,31,30,31,30,31,31,30,31,30,31];function wB(e){return e%400==0||e%4==0&&e%100!=0}function TB(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(CB[t]||(wB(e)?29:28))}function EB(e,t){return t>=1&&t<=(wB(e)?366:365)}function DB(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function OB(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function kB(e,t){return t>=0&&t<=59}function AB(){return typeof window<`u`&&window.__TAURI_INTERNALS__!==void 0}function jB(e){return Function(`s`,`return import(s)`)(e).catch(()=>null)}async function MB(e){if(AB()){try{let t=await jB(`@tauri-apps/plugin-opener`);if(t?.revealItemInDir){await t.revealItemInDir(e);return}}catch{}try{await(await jB(`@tauri-apps/api/shell`))?.open?.(e)}catch{}}}async function NB(e){if(AB())try{let t=await r(()=>import(`./dist-js-COfIfLRE.js`),[]);if(typeof t.open==`function`){await t.open(e);return}}catch(e){console.warn(`[openExternalUrl] tauri shell open failed:`,e)}try{window.open(e,`_blank`,`noopener,noreferrer`)}catch{}}function PB({ticketKey:e,attachment:t,onClose:n}){let{t:r}=G(`attachments`),[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(null);if((0,I.useEffect)(()=>{if(!t)return;function e(e){e.key===`Escape`&&n()}document.addEventListener(`keydown`,e);let r=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,e),document.body.style.overflow=r}},[t,n]),(0,I.useEffect)(()=>{if(!t){a(null),s(null);return}let n=!1;return a(null),s(null),ME(e,t.id).then(e=>{n||a(URL.createObjectURL(e))}).catch(e=>{n||s(e instanceof Error?e.message:r(`errors.loadFailed`))}),()=>{n=!0}},[t,e]),(0,I.useEffect)(()=>()=>{i&&URL.revokeObjectURL(i)},[i]),!t)return null;let c=t.mimeType.startsWith(`image/`),l=t.mimeType===`application/pdf`;return(0,q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":r(`lightbox.preview`,{name:t.filename}),className:`fixed inset-0 z-[100] flex flex-col bg-black/85 backdrop-blur-sm animate-in fade-in-0 duration-200`,onClick:n,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-white/10 bg-black/40`,onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":r(`lightbox.backToDesktop`),className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-sm text-white/85 hover:bg-white/10 hover:text-white transition-colors`,children:[(0,q.jsx)(Wd,{className:`w-4 h-4`}),r(`common:actions.back`)]}),(0,q.jsxs)(`div`,{className:`flex-1 text-center min-w-0 px-4`,children:[(0,q.jsx)(`div`,{className:`text-sm font-medium text-white/95 truncate`,children:t.filename}),(0,q.jsx)(`div`,{className:`text-[11px] text-white/50`,children:t.mimeType})]}),(0,q.jsxs)(`a`,{href:i??`#`,download:t.filename,onClick:e=>{e.stopPropagation(),i||e.preventDefault()},className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-sm text-white/85 hover:bg-white/10 hover:text-white transition-colors`,"aria-label":r(`lightbox.download`),children:[(0,q.jsx)(Tf,{className:`w-4 h-4`}),r(`lightbox.download`)]})]}),(0,q.jsx)(`div`,{className:X(`flex-1 flex items-center justify-center overflow-auto p-6`),onClick:n,children:o?(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/80 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:(0,q.jsx)(`p`,{className:`text-sm`,children:r(`lightbox.loadError`,{error:o})})}):i?c?(0,q.jsx)(`img`,{src:i,alt:t.filename,onClick:e=>e.stopPropagation(),className:`max-h-full max-w-full rounded-lg shadow-2xl animate-in zoom-in-95 duration-200`}):l?(0,q.jsx)(`iframe`,{src:i,title:t.filename,onClick:e=>e.stopPropagation(),className:`w-full h-full max-w-5xl bg-white rounded-lg shadow-2xl`}):(0,q.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/80 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:[(0,q.jsx)(`p`,{className:`text-sm mb-3`,children:r(`lightbox.previewUnavailable`)}),(0,q.jsxs)(`a`,{href:i,download:t.filename,className:`inline-flex items-center gap-2 px-4 py-2 rounded-md bg-white/10 hover:bg-white/20 text-white transition-colors`,children:[(0,q.jsx)(Tf,{className:`w-4 h-4`}),r(`lightbox.downloadFile`,{name:t.filename})]})]}):(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/70 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:(0,q.jsx)(`p`,{className:`text-sm`,children:r(`lightbox.loading`)})})})]})}function FB(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r}function IB(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function LB(e){return e.startsWith(`image/`)?`🖼`:e===`application/pdf`?`📄`:e===`text/csv`||e.includes(`spreadsheetml`)||e===`application/vnd.ms-excel`?`📊`:e===`application/json`?`{ }`:e===`text/plain`||e.includes(`sql`)?`📝`:`📎`}function RB(e){try{return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}catch{return e}}function zB({ticketKey:e,attachments:t,onChange:n,className:r}){let{t:i}=G(`attachments`),[a,o]=(0,I.useState)(new Set),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null);if((0,I.useEffect)(()=>{let r=!1;return AE(e).then(e=>{if(r)return;let i=FB(t,e);i.length!==t.length&&n?.(i)}).catch(()=>{}),()=>{r=!0}},[e]),!t||t.length===0)return null;let d=[...t].sort((e,t)=>e.addedAt<t.addedAt?1:-1);async function f(r){c(null),o(e=>{let t=new Set(e);return t.add(r.id),t});try{await OE(e,r.id),await new Promise(e=>setTimeout(e,160)),n?.(t.filter(e=>e.id!==r.id))}catch(e){c(e instanceof Error?e.message:i(`errors.removeFailed`)),o(e=>{let t=new Set(e);return t.delete(r.id),t})}}return(0,q.jsxs)(`section`,{className:X(`mt-4`,r),"aria-label":i(`section.ariaLabel`),children:[(0,q.jsxs)(`header`,{className:`flex items-center justify-between mb-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:i(`section.title`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:i(`section.fileCount`,{count:d.length})})]}),(0,q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:d.map(e=>{let t=a.has(e.id);return(0,q.jsxs)(`li`,{className:X(`flex items-center gap-3 px-2.5 py-2 rounded-md border border-border bg-card/60 hover:bg-card transition-all duration-200`,t&&`opacity-0 scale-95 max-h-0 py-0 border-transparent overflow-hidden`),children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`w-6 text-center text-sm shrink-0`,children:LB(e.mimeType)}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:`flex-1 min-w-0 flex flex-col text-sm text-left hover:text-primary transition-colors`,children:[(0,q.jsx)(`span`,{className:`font-medium truncate text-foreground`,children:e.filename}),(0,q.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[IB(e.size),` · `,RB(e.addedAt)]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`text-[11px] text-primary hover:underline shrink-0`,children:i(`common:actions.open`)}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-label":i(`removeFile`,{name:e.filename}),disabled:t,className:`w-6 h-6 inline-flex items-center justify-center rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50`,children:`×`})]},e.id)})}),s&&(0,q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:s}),(0,q.jsx)(PB,{ticketKey:e,attachment:l,onClose:()=>u(null)})]})}function BB({ticketId:e,onClose:t}){let{t:n}=G(`code`),r=ct(),{activeProjectId:i}=Sd(),[a,o]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!tb)return;let t=new AbortController;return o(null),fetch(`${ul()}/code/provenance?ticketId=${e}`,{signal:t.signal}).then(e=>e.ok?e.json():[]).then(e=>{o(Array.isArray(e)?e:[])}).catch(e=>{e?.name!==`AbortError`&&o([])}),()=>t.abort()},[e,i]),!tb||!a||a.length===0?null:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:n(`ticketFiles.title`)}),(0,q.jsx)(`ul`,{className:`space-y-1`,children:a.map((e,i)=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t(),r(`/code?path=${encodeURIComponent(e.path)}`)},className:`w-full text-left flex items-center gap-2 rounded px-2 py-1 text-xs hover:bg-muted/40`,children:[(0,q.jsx)(e.kind===`created`?Af:e.kind===`deleted`?kf:jf,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`font-mono truncate flex-1`,children:e.path}),e.jobId&&(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground font-mono shrink-0`,title:n(`ticketFiles.jobTitle`,{jobId:e.jobId}),children:[(0,q.jsx)(If,{className:`h-3 w-3`}),e.jobId.length>10?e.jobId.slice(0,10):e.jobId]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wider shrink-0`,children:n(`kind.${e.kind}`)})]})},`${e.path}-${i}`))})]})}var VB={draft:{dotClass:`bg-accent-secondary/60`,textClass:`text-accent-secondary`,borderClass:`border-l-[3px] border-dashed border-accent-secondary/50 pl-3`,labelKey:`common:status.draft`,pulsing:!1},todo:{dotClass:`bg-slate-500/70`,textClass:`text-muted-foreground`,borderClass:`border-l-[3px] border-dashed border-slate-500/40 pl-3`,labelKey:`status.todo`,pulsing:!1},in_progress:{dotClass:`bg-blue-400 aurora-light:bg-accent-info`,textClass:`text-foreground font-semibold`,borderClass:`border-l-[3px] border-solid border-blue-500 pl-3`,labelKey:`status.inProgress`,pulsing:!0},done:{dotClass:`text-emerald-400 aurora-light:text-accent-success`,textClass:`text-emerald-400/80 aurora-light:text-accent-success`,borderClass:`border-l-[3px] border-solid border-emerald-500 pl-3`,labelKey:`status.done`,pulsing:!1},cancelled:{dotClass:`text-red-400/60 aurora-light:text-destructive/70`,textClass:`text-muted-foreground/50`,borderClass:`pl-3`,labelKey:`status.cancelled`,pulsing:!1}};function HB({status:e,className:t}){let{t:n}=G(`specs`),r=VB[e];return e===`done`?(0,q.jsx)(nf,{className:X(`w-3.5 h-3.5 shrink-0`,r.dotClass,t),"aria-label":n(`status.done`)}):e===`cancelled`?(0,q.jsx)(qp,{className:X(`w-3.5 h-3.5 shrink-0`,r.dotClass,t),"aria-label":n(`status.cancelled`)}):r.pulsing?(0,q.jsxs)(`span`,{className:X(`relative flex shrink-0 h-2.5 w-2.5`,t),"aria-label":n(`status.inProgress`),children:[(0,q.jsx)(`span`,{className:X(`animate-ping absolute inline-flex h-full w-full rounded-full opacity-60`,r.dotClass)}),(0,q.jsx)(`span`,{className:X(`relative inline-flex rounded-full h-2.5 w-2.5`,r.dotClass)})]}):(0,q.jsx)(`span`,{className:X(`inline-flex rounded-full h-2.5 w-2.5 shrink-0`,r.dotClass,t),"aria-label":n(`status.todo`)})}var UB={critical:`bg-red-500/15 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive border-red-500/30 aurora-light:border-destructive/30`,high:`bg-orange-500/15 aurora-light:bg-accent-warning/10 text-orange-400 aurora-light:text-accent-warning border-orange-500/30 aurora-light:border-accent-warning/30`,medium:``,low:`bg-gray-500/15 aurora-light:bg-muted text-gray-400 aurora-light:text-muted-foreground border-gray-500/30 aurora-light:border-border`};function WB(e){try{return lB(new Date(e),{addSuffix:!0,locale:md()})}catch{return e}}function GB({tickets:e,excludeIds:t,onSelect:n}){let{t:r}=G(`tickets`),[i,a]=(0,I.useState)(``),o=(0,I.useMemo)(()=>{let n=new Set(t),r=e.filter(e=>e.status===`todo`&&!n.has(e.id));if(!i.trim())return r;let a=i.toLowerCase();return r.filter(e=>e.title.toLowerCase().includes(a)||e.description.toLowerCase().includes(a))},[e,t,i]);return(0,q.jsxs)(`div`,{"data-testid":`spec-compare-picker`,className:`h-full flex flex-col rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`px-4 py-3 border-b border-border/30 flex items-center gap-2`,children:[(0,q.jsx)(zp,{className:`w-3.5 h-3.5 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:r(`comparePicker.title`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(`comparePicker.todoCount`,{n:o.length})})]}),(0,q.jsx)(`div`,{className:`px-4 py-2 border-b border-border/20`,children:(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(Ep,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,q.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:r(`comparePicker.searchPlaceholder`),className:`w-full h-7 rounded border border-border bg-input pl-7 pr-2 text-[11px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent-primary/60`})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`spec-compare-picker-list`,children:o.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center px-4 py-8 gap-2`,children:[(0,q.jsx)(zp,{className:`w-6 h-6 text-muted-foreground/40`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.trim()?r(`comparePicker.noMatches`):r(`comparePicker.empty`)})]}):(0,q.jsx)(`ul`,{className:`divide-y divide-border/10`,children:o.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,"data-testid":`spec-compare-card-${e.id}`,onClick:()=>n(e.id),className:`w-full text-left px-4 py-2.5 hover:bg-accent/30 transition-colors flex items-start gap-2 group`,children:[(0,q.jsx)(HB,{status:e.status}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[`#`,e.id]}),e.priority&&UB[e.priority]&&(0,q.jsx)(`span`,{className:`inline-flex items-center rounded px-1 py-0.5 text-[9px] font-medium border ${UB[e.priority]}`,children:r(`priority.${e.priority}`)})]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title||r(`untitled`)}),e.description&&(0,q.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground line-clamp-1`,children:e.description.slice(0,120)}),e.labels&&e.labels.length>0&&(0,q.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[e.labels.slice(0,3).map(e=>(0,q.jsx)(`span`,{className:`inline-flex items-center rounded px-1 py-0.5 text-[9px] bg-accent/40 text-foreground/60`,children:e},e)),e.labels.length>3&&(0,q.jsxs)(`span`,{className:`text-[9px] text-muted-foreground`,children:[`+`,e.labels.length-3]})]}),(0,q.jsx)(`p`,{className:`mt-1 text-[9px] text-muted-foreground`,children:r(`meta.updatedAgo`,{time:WB(e.updated_at)})})]})]})},e.id))})})]})}var KB=.25,qB=.75;function JB({state:e,leftTicket:t,rightTicket:n,allTickets:r,allLabels:i,onSave:a,onDelete:o,onOpenTicket:s,onCloseAll:c,onSetCompared:l,onSetRatio:u,onExitSplit:d}){let f=(0,I.useRef)(null),p=(0,I.useRef)(null),[m,h]=(0,I.useState)(!0);(0,I.useEffect)(()=>{let e=setTimeout(()=>h(!1),320);return()=>clearTimeout(e)},[]);let g=(0,I.useCallback)(e=>{if(!p.current)return;let t=window.innerWidth,n=e.clientX/t;u(Math.min(qB,Math.max(KB,n)))},[u]),_=(0,I.useCallback)(e=>{if(!p.current)return;let{pointerId:t,element:n}=p.current;try{n.releasePointerCapture(t)}catch{}p.current=null,window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_)},[g]),v=(0,I.useCallback)(e=>{let t=e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch{}p.current={pointerId:e.pointerId,element:t},window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,_),window.addEventListener(`pointercancel`,_)},[g,_]),y=(0,I.useCallback)(t=>{let n=.04;t.key===`ArrowLeft`?(t.preventDefault(),u(Math.max(KB,e.splitRatio-n))):t.key===`ArrowRight`?(t.preventDefault(),u(Math.min(qB,e.splitRatio+n))):t.key===`Home`?(t.preventDefault(),u(KB)):t.key===`End`?(t.preventDefault(),u(qB)):t.key===`0`&&(t.preventDefault(),u(.5))},[u,e.splitRatio]),b=e=>{e.target===e.currentTarget&&c()},x=u=>{let d=u===e.originSide,f=u===`left`?t:n;return f?(0,q.jsx)(VV,{ticket:f,allLabels:i,allTickets:r,onClose:d?c:()=>l(null,u),onOpenTicket:s,onSave:a,onDelete:o,embedded:!0},`${u}-${f.id}`):(0,q.jsx)(GB,{tickets:r,excludeIds:[t?.id,n?.id].filter(e=>e!=null),onSelect:e=>l(e,u)})},S=(e.splitRatio*100).toFixed(2),C=((1-e.splitRatio)*100).toFixed(2);return(0,q.jsxs)(`div`,{ref:f,"data-testid":`split-view-shell`,className:`fixed inset-0 z-50 flex`,onClick:b,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/70 pointer-events-none`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`relative flex w-full h-full`,style:{transition:m?`opacity 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:[(0,q.jsx)(`div`,{"data-testid":`split-panel-left`,className:`relative h-full overflow-hidden`,style:{width:`${S}%`,transition:m?`width 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:(0,q.jsx)(`div`,{className:`h-full flex items-center justify-center p-2`,children:(0,q.jsx)(`div`,{className:`w-full h-full max-h-[95vh]`,children:x(`left`)})})}),(0,q.jsx)(`div`,{"data-testid":`split-divider`,role:`separator`,"aria-orientation":`vertical`,"aria-valuenow":Math.round(e.splitRatio*100),"aria-valuemin":Math.round(KB*100),"aria-valuemax":Math.round(qB*100),tabIndex:0,onPointerDown:v,onKeyDown:y,className:`relative z-10 w-2 cursor-col-resize bg-border/40 hover:bg-accent-primary/40 transition-colors focus:outline-none focus:bg-accent-primary/60`}),(0,q.jsx)(`div`,{"data-testid":`split-panel-right`,className:`relative h-full overflow-hidden`,style:{width:`${C}%`,transition:m?`width 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:(0,q.jsx)(`div`,{className:`h-full flex items-center justify-center p-2`,children:(0,q.jsx)(`div`,{className:`w-full h-full max-h-[95vh]`,children:x(`right`)})})})]})]})}var YB=.5,XB=.25,ZB=.75,QB={leftId:null,rightId:null,originSide:null,splitRatio:YB};function $B(e){return Number.isFinite(e)?Math.min(ZB,Math.max(XB,e)):YB}function eV(e,t){switch(t.type){case`openCentered`:return e.originSide!==null&&e.leftId!==t.id&&e.rightId!==t.id?{leftId:t.id,rightId:null,originSide:null,splitRatio:YB}:e.originSide!==null&&(e.leftId===t.id||e.rightId===t.id)?e:{...QB,leftId:t.id};case`closeAll`:return QB;case`enterSplit`:{let n=t.ticketId??e.leftId;return n===null||e.originSide!==null?e:t.side===`left`?{leftId:n,rightId:null,originSide:`left`,splitRatio:YB}:{leftId:null,rightId:n,originSide:`right`,splitRatio:YB}}case`setComparedTicket`:{if(e.originSide===null)return e;let n=e.originSide===`left`?`right`:`left`;return t.side===n?t.side===`left`?{...e,leftId:t.id}:{...e,rightId:t.id}:e}case`exitSplit`:{if(e.originSide===null)return e;let t=e.originSide===`left`?e.leftId:e.rightId;return{...QB,leftId:t}}case`setSplitRatio`:return{...e,splitRatio:$B(t.ratio)};default:return e}}var tV=(0,I.createContext)(null),nV=900;function rV({children:e}){let[t,n]=(0,I.useReducer)(eV,QB),{tickets:r,updateTicket:i,deleteTicket:a}=Md(),{activeProjectId:o}=Sd();(0,I.useEffect)(()=>{n({type:`closeAll`})},[o]);let s=(0,I.useCallback)(e=>n({type:`openCentered`,id:e}),[]),c=(0,I.useCallback)(()=>n({type:`closeAll`}),[]),l=(0,I.useCallback)((e,t)=>n({type:`enterSplit`,side:e,ticketId:t}),[]),u=(0,I.useCallback)((e,t)=>n({type:`setComparedTicket`,id:e,side:t}),[]),d=(0,I.useCallback)(()=>n({type:`exitSplit`}),[]),f=(0,I.useCallback)(e=>n({type:`setSplitRatio`,ratio:e}),[]);(0,I.useEffect)(()=>{if(typeof window>`u`)return;function e(){window.innerWidth<nV&&n({type:`exitSplit`})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let p=(0,I.useMemo)(()=>{let e=new Set;for(let t of r)for(let n of t.labels??[])e.add(n);return Array.from(e).sort()},[r]),m=t.leftId==null?null:r.find(e=>e.id===t.leftId)??null,h=t.rightId==null?null:r.find(e=>e.id===t.rightId)??null,g=(0,I.useMemo)(()=>({openTicketDetail:s,closeTicketDetail:c,enterSplit:l,setComparedTicket:u,exitSplit:d,setSplitRatio:f,state:t}),[s,c,l,u,d,f,t]),_=t.originSide!==null;return(0,q.jsxs)(tV.Provider,{value:g,children:[e,!_&&m&&(0,q.jsx)(VV,{ticket:m,allLabels:p,allTickets:r,onClose:c,onOpenTicket:s,onSave:i,onDelete:e=>{a(e),c()}},m.id),_&&(0,q.jsx)(JB,{state:t,leftTicket:m,rightTicket:h,allTickets:r,allLabels:p,onSave:i,onDelete:e=>{a(e),c()},onOpenTicket:s,onCloseAll:c,onSetCompared:u,onSetRatio:f,onExitSplit:d})]})}function iV(){return(0,I.useContext)(tV)||{openTicketDetail:()=>{typeof console<`u`&&console.warn(`[TicketDetailModalContext] openTicketDetail called without provider`)},closeTicketDetail:()=>{},enterSplit:()=>{},setComparedTicket:()=>{},exitSplit:()=>{},setSplitRatio:()=>{},state:QB}}var aV={job:`analytics:surfaces.job`,"quick-spec":`analytics:surfaces.quickSpec`,"explore-spec":`analytics:surfaces.exploreSpec`,"ai-edit":`analytics:surfaces.aiEdit`,smash:`analytics:surfaces.smash`,"file-summary":`analytics:surfaces.fileSummary`},oV=Object.defineProperties({},Object.fromEntries(Object.keys(aV).map(e=>[e,{get:()=>J.t(aV[e]),enumerable:!0}]))),sV={job:{bg:`bg-accent-info/15`,text:`text-accent-info`,ring:`ring-accent-info/40`,dot:`bg-accent-info`},"quick-spec":{bg:`bg-accent-secondary/15`,text:`text-accent-secondary`,ring:`ring-accent-secondary/40`,dot:`bg-accent-secondary`},"explore-spec":{bg:`bg-accent-highlight/15`,text:`text-accent-highlight`,ring:`ring-accent-highlight/40`,dot:`bg-accent-highlight`},"ai-edit":{bg:`bg-accent-success/15`,text:`text-accent-success`,ring:`ring-accent-success/40`,dot:`bg-accent-success`},smash:{bg:`bg-accent-highlight/15`,text:`text-accent-highlight`,ring:`ring-accent-highlight/40`,dot:`bg-accent-highlight`},"file-summary":{bg:`bg-accent-warning/15`,text:`text-accent-warning`,ring:`ring-accent-warning/40`,dot:`bg-accent-warning`}};function cV(e){return e<.005?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function lV(e){return e<1e3?`${e} ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function uV({ticketId:e}){let{t}=G(`tickets`),[n,r]=(0,I.useState)(null),i=ct(),{activeProjectId:a}=Sd(),{closeTicketDetail:o}=iV();if((0,I.useEffect)(()=>{let t=new AbortController;return r(null),fetch(`${ul()}/tickets/${e}/spending-summary`,{signal:t.signal}).then(e=>e.ok?e.json():null).then(e=>{e&&r(e)}).catch(()=>{}),()=>t.abort()},[e,a]),!n||!n.bySurface||!n.totalRuns||n.totalRuns===0)return null;let s=Object.entries(n.bySurface).filter(([,e])=>e.count>0).map(([e,n])=>t(`spendingLine.breakdownItem`,{n:n.count,label:oV[e].toLowerCase()})).join(` + `);return(0,q.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o(),i(`/analytics?ticketId=${e}`)},className:`mt-1.5 group inline-flex items-center gap-1.5 text-[11px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,"aria-label":t(`spendingLine.ariaLabel`),children:[(0,q.jsx)(`span`,{className:`tabular-nums font-medium text-foreground`,children:cV(n.totalCostUsd)}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:t(`spendingLine.turns`,{count:n.totalTurns})}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:t(`spendingLine.active`,{duration:lV(n.activeDurationMs)})}),s&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{children:s})]}),(0,q.jsx)(Gd,{className:`w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity`})]})}var dV=/^\d{4}-\d{2}-\d{2}T/;function fV(e){if(dV.test(e))try{return{text:lB(uB(e),{addSuffix:!0,locale:md()}),title:e}}catch{}return{text:e}}function pV({localId:e}){let{t}=G(`jira`),{activeProjectId:n}=Sd(),r=sb(),[i,a]=(0,I.useState)(null);if((0,I.useEffect)(()=>{if(!nb||!r.connected)return;let t=!1;return a(null),ob.getSpecDetails(e).then(e=>{t||a(e)}).catch(()=>{t||a(null)}),()=>{t=!0}},[e,n,r.connected]),!nb||!r.connected||!i)return null;let o=i.development,s=i.fields.length>0,c=o.pullRequests.length>0,l=o.branches.length>0,u=(o.commits?.length??0)>0;return!s&&!c&&!l&&!u?null:(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-details-panel`,children:[s&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:t(`detail.detailsTitle`)}),(0,q.jsx)(`div`,{className:`space-y-1.5`,children:i.fields.map((e,t)=>{let n=fV(e.value);return(0,q.jsxs)(`div`,{className:`text-xs`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block`,children:e.label}),e.href?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{NB(e.href)},className:`inline-flex items-center gap-1 text-accent-info hover:underline text-left`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.value}),(0,q.jsx)(Df,{className:`w-3 h-3 shrink-0`})]}):(0,q.jsx)(`span`,{className:`text-foreground/80 whitespace-pre-line`,title:n.title,children:n.text})]},`${e.label}-${t}`)})})]}),(c||l||u)&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:t(`detail.developmentTitle`)}),c&&(0,q.jsxs)(`div`,{className:`mb-2`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.pullRequests`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.pullRequests.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{NB(e.url)},className:`w-full flex items-start gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-pr`,children:[(0,q.jsx)(Lf,{className:`w-3 h-3 mt-0.5 shrink-0 text-accent-info`}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`truncate text-foreground/80 block`,children:e.title}),(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.status,e.sourceBranch?` · ${e.sourceBranch} → ${e.destBranch??``}`:``]})]})]},e.url))})]}),l&&(0,q.jsxs)(`div`,{className:`mb-2`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.branches`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.branches.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{NB(e.url)},className:`w-full flex items-center gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-branch`,children:[(0,q.jsx)(Ff,{className:`w-3 h-3 shrink-0 text-accent-info`}),(0,q.jsx)(`span`,{className:`truncate font-mono text-foreground/80`,children:e.name}),e.repo&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.repo})]},e.url))})]}),u&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.commits`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.commits.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{NB(e.url)},className:`w-full flex items-center gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-commit`,children:[(0,q.jsx)(If,{className:`w-3 h-3 shrink-0 text-accent-info`}),(0,q.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground shrink-0`,children:e.displayId}),(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.message})]},e.url))})]})]})]})}var mV={analyzing:`activity:smash.stage.analyzing`,identifying:`activity:smash.stage.identifying`,ordering:`activity:smash.stage.ordering`},hV=(0,I.createContext)(null);function gV(e){return`smash:${e}`}async function _V(e,t){try{let n=await fetch(`${sl}/api/projects/${e}/tickets/${t}/smash`,{method:`POST`});if(n.ok)K.loading(J.t(`activity:smash.retrying`),{id:gV(t)});else{let e=await n.json().catch(()=>({}));K.error(e.reason?J.t(`activity:smash.couldNotRetryWithReason`,{reason:e.reason}):J.t(`activity:smash.couldNotRetry`),{id:gV(t)})}}catch(e){K.error(J.t(`activity:smash.retryFailed`,{message:e.message}),{id:gV(t)})}}async function vV(e,t,n){try{let r=await fetch(`${sl}/api/projects/${e}/tickets/${t}/smash/undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({smashedAt:n})});if(r.ok)K.success(J.t(`activity:smash.undone`),{id:gV(t),duration:3e3});else{let e=await r.json().catch(()=>({}));K.error(e.reason?J.t(`activity:smash.undoFailedWithReason`,{reason:e.reason}):J.t(`activity:smash.undoFailed`),{id:gV(t)})}}catch(e){K.error(J.t(`activity:smash.undoFailedWithReason`,{reason:e.message}),{id:gV(t)})}}function yV({children:e}){let{registerHandler:t,unregisterHandler:n}=xl(),[r,i]=(0,I.useState)({}),a=(0,I.useRef)(new Map),o=(0,I.useRef)(new Map),s=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.started`)return;let n=t.ticketId,r=t.runId,o=t.projectId,s=t.timestamp,c=t.ticketTitle;typeof n!=`number`||!r||!o||(a.current.set(n,o),i(e=>({...e,[n]:{ticketId:n,runId:r,stage:`analyzing`,startedAt:s??new Date().toISOString(),ticketTitle:c}})),K.loading(J.t(mV.analyzing),{id:gV(n),description:c?J.t(`activity:smash.onTitled`,{title:c}):J.t(`activity:smash.onThisSpec`)}))},[]),c=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.progress`)return;let n=t.ticketId,r=t.stage;if(typeof n!=`number`||!r)return;let a;i(e=>{let t=e[n];return t?(a=t.ticketTitle,{...e,[n]:{...t,stage:r}}):e}),K.loading(J.t(mV[r]),{id:gV(n),description:a?J.t(`activity:smash.onTitled`,{title:a}):J.t(`activity:smash.onThisSpec`)})},[]),l=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.completed`)return;let n=t.ticketId,r=t.runId,a=t.projectId,s=t.smashedAt,c=t.childrenIds;typeof n!=`number`||!r||!a||!s||!c||(o.current.set(r,s),i(e=>{let t={...e};return delete t[n],t}),K.success(J.t(`activity:smash.split`,{count:c.length}),{id:gV(n),duration:1e4,action:{label:J.t(`activity:smash.undoAction`),onClick:()=>void vV(a,n,s)}}))},[]),u=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.failed`)return;let n=t.ticketId,r=t.projectId,o=t.reason??`unknown`;if(typeof n!=`number`||!r)return;a.current.set(n,r),i(e=>{let t={...e};return delete t[n],t});let s=o===`invalid-output`?J.t(`activity:smash.failReason.invalidOutput`):o===`timeout`?J.t(`activity:smash.failReason.timeout`):o===`model_error`?J.t(`activity:smash.failReason.modelError`):o===`crashed`?J.t(`activity:smash.failReason.crashed`):J.t(`activity:smash.failReason.generic`,{reason:o});K.error(J.t(`activity:smash.couldNotComplete`),{id:gV(n),description:s,action:{label:J.t(`common:actions.retry`),onClick:()=>void _V(r,n)},duration:15e3})},[]),d=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.undone`)return;let n=t.ticketId;typeof n==`number`&&(K.dismiss(gV(n)),K.success(J.t(`activity:smash.undone`),{id:gV(n),duration:3e3}))},[]);(0,I.useLayoutEffect)(()=>(t(`_smash_started`,s),t(`_smash_progress`,c),t(`_smash_completed`,l),t(`_smash_failed`,u),t(`_smash_undone`,d),()=>{n(`_smash_started`),n(`_smash_progress`),n(`_smash_completed`),n(`_smash_failed`),n(`_smash_undone`)}),[t,n,s,c,l,u,d]),(0,I.useEffect)(()=>()=>{a.current.clear(),o.current.clear()},[]);let f=(0,I.useMemo)(()=>({inflight:r}),[r]);return(0,q.jsx)(hV.Provider,{value:f,children:e})}function bV(e){let t=(0,I.useContext)(hV);return!t||e==null?null:t.inflight[e]??null}var xV=150,SV={analyzing:0,identifying:1,ordering:2},CV={analyzing:`smash.stage.analyzing`,identifying:`smash.stage.identifying`,ordering:`smash.stage.ordering`};function wV({stage:e,minDisplayMs:t=xV}){let{t:n}=G(`activity`),[r,i]=(0,I.useState)(e),a=(0,I.useRef)(Date.now()),o=(0,I.useRef)(null);if((0,I.useEffect)(()=>{if(e===r)return;let n=Date.now()-a.current,s=Math.max(0,t-n);return o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{i(e),a.current=Date.now(),o.current=null},s),()=>{o.current&&clearTimeout(o.current)}},[e,r,t]),!r)return null;let s=SV[r];return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-accent-highlight/40 bg-accent-highlight/10 text-sm text-foreground`,role:`status`,"aria-live":`polite`,"data-testid":`smash-status-pills`,children:[(0,q.jsx)(Yf,{className:`h-4 w-4 animate-spin text-accent-highlight`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`flex items-center gap-1.5`,children:[`analyzing`,`identifying`,`ordering`].map(e=>(0,q.jsx)(`span`,{className:[`inline-block w-1.5 h-1.5 rounded-full transition-all`,SV[e]<=s?`bg-accent-highlight`:`bg-muted`,e===r?`scale-125`:`scale-100`].join(` `),"aria-hidden":!0},e))}),(0,q.jsx)(`span`,{className:`font-medium`,children:n(CV[r])})]})}var TV={simple:{titleKey:`smashModal.modes.simple.title`,bulletKeys:[`smashModal.modes.simple.bullet1`,`smashModal.modes.simple.bullet2`,`smashModal.modes.simple.bullet3`],etaKey:`smashModal.modes.simple.eta`},full:{titleKey:`smashModal.modes.full.title`,bulletKeys:[`smashModal.modes.full.bullet1`,`smashModal.modes.full.bullet2`,`smashModal.modes.full.bullet3`,`smashModal.modes.full.bullet4`],etaKey:`smashModal.modes.full.eta`}};function EV({open:e,ticketTitle:t,isReSmash:n,childrenCount:r,submitting:i=!1,onCancel:a,onConfirm:o}){let{t:s}=G(`activity`),[c,l]=(0,I.useState)(`simple`);return e?(0,q.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"data-testid":`smash-confirm-modal`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:a}),(0,q.jsxs)(`div`,{className:`relative w-full max-w-lg m-4 rounded-xl glass-card border border-border/30 animate-in fade-in zoom-in-95 duration-150`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-5 py-4 border-b border-border/30`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0`,children:[(0,q.jsx)(Np,{className:`w-5 h-5 text-accent-highlight shrink-0 mt-0.5`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:s(`smashModal.title`)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground truncate`,title:t,children:t})]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:a,className:`h-7 w-7 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors shrink-0`,"aria-label":s(`common:actions.close`),children:(0,q.jsx)(qp,{className:`w-4 h-4`})})]}),n&&r>0&&(0,q.jsx)(`div`,{className:`mx-5 mt-4 rounded-md border border-accent-warning/40 bg-accent-warning/10 px-3 py-2 text-xs text-foreground`,children:(0,q.jsx)(Bi,{t:s,i18nKey:`smashModal.reSmashWarning`,count:r})}),(0,q.jsxs)(`div`,{className:`px-5 py-4 space-y-3`,children:[(0,q.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:s(`smashModal.modePickerLabel`)}),[`simple`,`full`].map(e=>{let t=TV[e],n=c===e;return(0,q.jsx)(`button`,{type:`button`,onClick:()=>l(e),disabled:i,className:`w-full text-left rounded-lg border px-3 py-3 transition-colors ${n?`border-accent-highlight/60 bg-accent-highlight/10`:`border-border/40 bg-card/40 hover:bg-card/60 hover:border-border/60`}`,"data-testid":`smash-mode-${e}`,children:(0,q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 h-3.5 w-3.5 rounded-full border-2 shrink-0 ${n?`border-accent-highlight bg-accent-highlight`:`border-muted-foreground/60`}`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[e===`full`&&(0,q.jsx)(Jp,{className:`w-3.5 h-3.5 text-accent-highlight`,"aria-hidden":!0}),s(t.titleKey)]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:s(t.etaKey)})]}),(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:t.bulletKeys.map(e=>(0,q.jsxs)(`li`,{className:`text-[11px] text-foreground/70 leading-snug`,children:[`• `,s(e)]},e))})]})]})},e)})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-5 py-3 border-t border-border/30 bg-surface/20`,children:[(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:a,disabled:i,children:s(`common:actions.cancel`)}),(0,q.jsxs)(Z,{size:`sm`,onClick:()=>o(c),disabled:i,"data-testid":`smash-confirm-modal-continue`,children:[(0,q.jsx)(Np,{className:`w-3.5 h-3.5 mr-1.5`}),s(i?`smashModal.starting`:n?`smashModal.confirmReSmash`:`smashModal.smash`)]})]})]})]}):null}var DV=`## Contract Layer`;function OV(e,t){return!(!t||e.status===`draft`||e.parent_epic_id!=null||!e.description?.includes(DV))}function kV({ticket:e,projectId:t,featureFlagOn:n,childrenCount:r}){let{t:i}=G(`activity`),a=bV(e.id),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(!1),u=e.is_epic===!0,d=!u&&OV(e,n),f=u&&n,p=u&&r>0,m=(0,I.useCallback)(async n=>{l(!0);try{let r=await fetch(`${sl}/api/projects/${t}/tickets/${e.id}/smash`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:n})});if(!r.ok){let e=await r.json().catch(()=>({}));K.error(e.reason?i(`smash.couldNotStartWithReason`,{reason:e.reason}):i(`smash.couldNotStart`));return}s(!1)}catch(e){K.error(i(`smash.smashFailed`,{message:e.message}))}finally{l(!1)}},[t,e.id,i]),h=(0,I.useCallback)(async n=>{if(p){l(!0);try{if(!(await fetch(`${sl}/api/projects/${t}/tickets/${e.id}/children`,{method:`DELETE`})).ok){K.error(i(`smash.couldNotDeleteChildren`)),l(!1);return}}catch(e){K.error(i(`smash.deleteFailed`,{message:e.message})),l(!1);return}}await m(n)},[p,m,t,e.id,i]);return!d&&!f?null:a?(0,q.jsx)(`div`,{className:`flex flex-col gap-2`,"data-testid":`smash-actions-streaming`,children:(0,q.jsx)(wV,{stage:a.stage})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:()=>s(!0),className:`border-accent-highlight/40 text-accent-highlight hover:bg-accent-highlight/10`,"data-testid":f?`resmash-button`:`smash-button`,children:[(0,q.jsx)(Np,{className:`w-3.5 h-3.5 mr-1.5`}),i(f?`smash.reSmashButton`:`smash.smashButton`)]}),(0,q.jsx)(EV,{open:o,ticketTitle:e.title,isReSmash:p,childrenCount:r,submitting:c,onCancel:()=>s(!1),onConfirm:h})]})}function AV({epic:e,childExecutionOrder:t,totalChildren:n,onOpenEpic:r}){let{t:i}=G(`activity`);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-accent-secondary/30 bg-accent-secondary/10 px-3 py-1.5 text-xs`,"data-testid":`epic-breadcrumb`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:r,className:`text-accent-secondary hover:underline font-medium`,children:[`← `,e.title]}),t!=null&&n>0&&(0,q.jsx)(`span`,{className:`text-foreground/60`,children:i(`epicChildren.step`,{order:t,total:n})})]})}var jV={critical:`bg-red-400`,high:`bg-orange-400`,medium:`bg-yellow-400`,low:`bg-slate-400`};function MV(e){return e?jV[e]:`bg-muted`}function NV(e){return[...e].sort((e,t)=>{let n=e.execution_order??1/0,r=t.execution_order??1/0;return n===r?e.id-t.id:n-r})}function PV({ticket:e,allTickets:t,onOpenTicket:n}){let{t:r}=G(`activity`),i=e.is_epic===!0,a=e.parent_epic_id!=null;if(!i&&!a)return null;if(i){let i=NV(t.filter(t=>t.parent_epic_id===e.id));return(0,q.jsx)(FV,{header:r(`family.subSpecsHeader`,{count:i.length}),rows:i,currentId:e.id,onOpenTicket:n,emptyMessage:r(`family.emptySubSpecs`)})}let o=t.find(t=>t.id===e.parent_epic_id)??null,s=NV(t.filter(t=>t.parent_epic_id===e.parent_epic_id)),c=o?[o,...s]:s;return(0,q.jsx)(FV,{header:r(`family.familyHeader`,{count:s.length}),rows:c,currentId:e.id,onOpenTicket:n,emptyMessage:r(`family.noSiblings`)})}function FV({header:e,rows:t,currentId:n,onOpenTicket:r,emptyMessage:i}){let{t:a}=G(`activity`);return(0,q.jsxs)(`div`,{"data-testid":`epic-family-sidebar`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,q.jsx)(Np,{className:`w-3 h-3 text-accent-highlight`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:e})]}),t.length===0?(0,q.jsx)(`p`,{className:`text-[10px] text-foreground/50 italic`,children:i}):(0,q.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:t.map(e=>{let t=e.id===n,i=e.is_epic===!0;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t||r(e.id)},disabled:t,"aria-label":a(i?`family.openParentEpic`:`family.openSubSpec`,{title:e.title}),"aria-current":t?`page`:void 0,className:[`w-full flex items-center gap-1.5 rounded px-1.5 py-1 text-left transition-colors`,t?`bg-accent-highlight/15 cursor-default`:`hover:bg-muted/30 cursor-pointer`].join(` `),"data-testid":`epic-family-row-${e.id}`,children:[i?(0,q.jsx)(qd,{className:`w-3 h-3 text-accent-highlight flex-shrink-0`,"aria-hidden":!0}):(0,q.jsx)(`span`,{className:`text-[9px] tabular-nums text-foreground/40 w-3 text-center flex-shrink-0`,children:e.execution_order??`–`}),(0,q.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full flex-shrink-0 ${MV(e.priority)}`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`text-[11px] truncate ${t?`text-foreground font-medium`:`text-foreground/80`}`,title:e.title,children:e.title})]})},e.id)})})]})}var IV=900,LV=.2,RV=[{value:`critical`,labelKey:`priority.critical`,className:`text-red-400`},{value:`high`,labelKey:`priority.high`,className:`text-orange-400`},{value:`medium`,labelKey:`priority.medium`,className:`text-yellow-400`},{value:`low`,labelKey:`priority.low`,className:`text-slate-400`}];function zV(e){return e.jira_epic_key&&e.jira_url?e.jira_url.replace(/\/browse\/[^/]+$/,`/browse/${e.jira_epic_key}`):null}var BV={manual:`source.manual`,"product-backlog":`source.productBacklog`,"propose-spec":`source.proposeSpec`,"get-backlog-specs":`source.getBacklogSpecs`,"free-prompt":`source.freePrompt`};function VV({ticket:e,allLabels:t,allTickets:n,onClose:r,onOpenTicket:i,onSave:a,onDelete:o,rails:s,onMoveToRail:c,onRemoveFromRail:l,embedded:u=!1}){let{t:d}=G(`tickets`),{t:f}=G(`jira`),{activeProjectId:p,projects:m}=Sd(),{enterSplit:h,state:g}=iV(),_=g.originSide!==null,v=m.find(e=>e.id===p)?.provider!==`codex`,y=(0,I.useMemo)(()=>(n??[]).filter(t=>t.parent_epic_id===e.id),[n,e.id]),b=(0,I.useMemo)(()=>e.parent_epic_id==null?null:(n??[]).find(t=>t.id===e.parent_epic_id)??null,[n,e.parent_epic_id]),x=(0,I.useMemo)(()=>b?(n??[]).filter(e=>e.parent_epic_id===b.id).length:0,[n,b]),[S,C]=(0,I.useState)(e.title),[w,T]=(0,I.useState)(e.description),[E,D]=(0,I.useState)(e.priority??`medium`),[O,k]=(0,I.useState)([...e.labels??[]]),[A,j]=(0,I.useState)(!1),[M,N]=(0,I.useState)(!1),[P,F]=(0,I.useState)(``),[L,ee]=(0,I.useState)(!1),[te,R]=(0,I.useState)(!1),[z,B]=(0,I.useState)(!1),[V,ne]=(0,I.useState)(!1),[H,U]=(0,I.useState)(!1),re=sb(),ie=re.connected&&!!re.discardStatus&&e.source===`jira`&&!!e.jira_key,W=re.connected&&e.source===`jira`&&!!e.jira_key,[ae,oe]=(0,I.useState)(e.attachments??[]);(0,I.useEffect)(()=>{oe(e.attachments??[])},[e.attachments,e.id]);let se=(0,I.useRef)(null),ce=(0,I.useRef)(null),le=(0,I.useRef)(null),ue=(0,I.useMemo)(()=>S!==e.title||w!==e.description||E!==e.priority||JSON.stringify(O)!==JSON.stringify(e.labels),[S,w,E,O,e]);(0,I.useEffect)(()=>{A&&se.current?.focus()},[A]),(0,I.useEffect)(()=>{if(M){let e=ce.current;e&&(e.focus(),e.selectionStart=e.value.length)}},[M]),(0,I.useEffect)(()=>{L&&le.current?.focus()},[L]),(0,I.useEffect)(()=>{function e(e){e.key===`Escape`&&!A&&!M&&!te&&r()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,A,M,te]);let de=(0,I.useMemo)(()=>{if(!P.trim())return[];let e=P.toLowerCase();return t.filter(t=>t.toLowerCase().includes(e)&&!O.includes(t)).slice(0,5)},[P,t,O]),fe=(0,I.useCallback)(e=>{let t=e.trim();t&&!O.includes(t)&&k(e=>[...e,t]),F(``)},[O]),pe=(0,I.useCallback)(e=>{k(t=>t.filter(t=>t!==e))},[]),me=(0,I.useCallback)(async()=>{let t={};if(S!==e.title&&(t.title=S),w!==e.description&&(t.description=w),E!==e.priority&&(t.priority=E),JSON.stringify(O)!==JSON.stringify(e.labels)&&(t.labels=O),Object.keys(t).length===0){r();return}U(!0);let n=await a(e.id,t);U(!1),n?(K.success(d(`detailModal.toast.updated`)),r()):K.error(d(`detailModal.toast.updateFailed`))},[S,w,E,O,e,a,r,d]),he=(0,I.useCallback)(()=>{o(e.id),R(!1),r()},[e.id,o,r]),[ge,_e]=(0,I.useState)(0),ve=(0,I.useRef)(null),ye=!u&&!_&&typeof window<`u`&&window.innerWidth>=IV,be=(0,I.useCallback)(e=>{ve.current&&_e(e.clientX-ve.current.startX)},[]),xe=(0,I.useCallback)(t=>{if(!ve.current)return;let n=t.clientX-ve.current.startX,i=window.innerWidth*LV;if(window.removeEventListener(`pointermove`,be),window.removeEventListener(`pointerup`,xe),window.removeEventListener(`pointercancel`,xe),ve.current=null,_e(0),Math.abs(n)>=i){let t=g.leftId===e.id;h(n<0?`left`:`right`,e.id),t||r()}},[h,be,g.leftId,e.id,r]),Se=(0,I.useCallback)(e=>{ye&&e.button===0&&(e.target.closest(`button, input, textarea, select, [contenteditable="true"]`)||(ve.current={startX:e.clientX,pointerId:e.pointerId},window.addEventListener(`pointermove`,be),window.addEventListener(`pointerup`,xe),window.addEventListener(`pointercancel`,xe)))},[ye,be,xe]);(0,I.useEffect)(()=>()=>{ve.current&&(window.removeEventListener(`pointermove`,be),window.removeEventListener(`pointerup`,xe),window.removeEventListener(`pointercancel`,xe))},[be,xe]);let Ce=(0,I.useCallback)(()=>{if(!ye)return;let t=g.leftId===e.id;h(`right`,e.id),t||r()},[ye,h,g.leftId,e.id,r]),we=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:u?`relative w-full h-full rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 flex flex-col overflow-hidden`:`relative w-full max-w-[67rem] m-4 rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 flex flex-col animate-in fade-in zoom-in-95 duration-200 h-[90vh]`,style:ge===0?{transition:`transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1)`}:{transform:`translateX(${ge}px)`,transition:`none`},children:[b&&(0,q.jsx)(`div`,{className:`px-5 pt-3`,children:(0,q.jsx)(AV,{epic:b,childExecutionOrder:e.execution_order??null,totalChildren:x,onOpenEpic:()=>i?.(b.id)})}),(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-5 py-4 border-b border-border/30 ${ye?`cursor-grab active:cursor-grabbing`:``}`,onPointerDown:Se,"data-testid":`ticket-modal-header`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[A?(0,q.jsx)(`input`,{ref:se,value:S,onChange:e=>C(e.target.value),onBlur:()=>j(!1),onKeyDown:t=>{t.key===`Enter`&&j(!1),t.key===`Escape`&&(C(e.title),j(!1))},className:`w-full bg-transparent border-b border-accent-primary/50 text-sm font-semibold text-foreground outline-none pb-0.5`}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>j(!0),className:`group flex items-center gap-1.5 text-left w-full`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:S||d(`untitled`)}),(0,q.jsx)(lp,{className:`w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0`})]}),(0,q.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:(0,q.jsxs)(`span`,{className:`text-[10px] text-foreground font-mono`,children:[`#`,e.id]})}),(0,q.jsx)(uV,{ticketId:e.id})]}),p&&(0,q.jsx)(`div`,{className:`shrink-0`,children:(0,q.jsx)(kV,{ticket:e,projectId:p,featureFlagOn:v,childrenCount:y.length})}),(0,q.jsx)(WV,{ticket:e,title:S,description:w,priority:E,labels:O,onClose:r}),s&&(c||l)&&(0,q.jsx)(GV,{ticket:e,rails:s,onMoveToRail:c,onRemoveFromRail:l}),ye&&(0,q.jsxs)(Z,{variant:`outline`,size:`sm`,className:`shrink-0 mr-1 gap-1.5`,"data-testid":`ticket-modal-compare`,onClick:Ce,title:d(`detailModal.compareTooltip`),children:[(0,q.jsx)(vf,{className:`w-3.5 h-3.5`}),d(`detailModal.compare`)]}),(0,q.jsx)(`button`,{onClick:r,className:`h-7 w-7 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors cursor-pointer shrink-0`,"data-testid":`ticket-modal-close`,children:(0,q.jsx)(qp,{className:`w-4 h-4`})})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,q.jsxs)(`div`,{className:`flex flex-col sm:flex-row h-full`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0 px-5 py-4 space-y-4 flex flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex-1 flex flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-1.5`,children:d(`fields.description`)}),!M&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,q.jsx)(lp,{className:`w-2.5 h-2.5`}),d(`common:actions.edit`)]})]}),M?(0,q.jsxs)(`div`,{className:`space-y-1.5 flex-1 flex flex-col`,children:[(0,q.jsx)(`textarea`,{ref:ce,value:w,onChange:e=>T(e.target.value),className:`w-full flex-1 rounded-lg border border-border bg-input px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground resize-none min-h-[300px]`,placeholder:d(`fields.markdownPlaceholder`)}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-6 text-[10px]`,onClick:()=>N(!1),children:d(`detailModal.doneEditing`)}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:d(`fields.supportsMarkdown`)})]})]}):w?(0,q.jsx)(YV,{description:w,onEdit:()=>N(!0)}):(0,q.jsx)(`button`,{type:`button`,onClick:()=>N(!0),className:`w-full rounded-lg border border-dashed border-border/40 bg-muted/10 px-3 py-4 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/20 transition-colors text-center`,children:d(`detailModal.addDescription`)})]}),(0,q.jsx)(zB,{ticketKey:e.id,attachments:ae,onChange:oe}),(0,q.jsx)(BB,{ticketId:e.id,onClose:r}),e.prerequisites&&e.prerequisites.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`detailModal.prerequisites`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.prerequisites.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-mono bg-accent/60 text-foreground/70`,children:[`#`,e]},e))})]})]}),(0,q.jsxs)(`div`,{className:`sm:w-56 sm:border-l border-t sm:border-t-0 border-border/30 px-4 py-4 space-y-4 bg-muted/5`,children:[e.jira_url&&e.jira_key&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{NB(e.jira_url)},"data-testid":`jira-go-to-ticket`,className:`w-full inline-flex items-center justify-center gap-1.5 h-7 rounded border border-accent-info/50 bg-accent-info/10 px-2 text-xs font-medium text-accent-info hover:bg-accent-info/20 transition-colors`,children:[(0,q.jsx)(Df,{className:`w-3.5 h-3.5 shrink-0`}),f(`detail.goToTicket`,{key:e.jira_key})]}),e.jira_epic_key&&(0,q.jsxs)(`div`,{"data-testid":`jira-epic`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:f(`detail.epic`)}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{let t=zV(e);t&&NB(t)},title:e.jira_epic_name??e.jira_epic_key,className:`w-full inline-flex items-center gap-1.5 rounded border border-accent-highlight/40 bg-accent-highlight/5 px-2 py-1.5 text-left text-xs hover:bg-accent-highlight/10 transition-colors`,children:[(0,q.jsx)(`span`,{className:`font-mono text-accent-highlight shrink-0`,children:e.jira_epic_key}),e.jira_epic_name&&(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.jira_epic_name})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`fields.priority`)}),(0,q.jsx)(`select`,{value:E,onChange:e=>D(e.target.value),className:`w-full h-7 rounded border border-border bg-input px-2 text-xs text-foreground`,children:RV.map(e=>(0,q.jsx)(`option`,{value:e.value,children:d(e.labelKey)},e.value))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`fields.labels`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-1.5`,children:O.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] font-medium bg-accent/60 text-foreground/70 group`,children:[e,(0,q.jsx)(`button`,{type:`button`,onClick:()=>pe(e),className:`text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,q.jsx)(df,{className:`w-2.5 h-2.5`})})]},e))}),L?(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`input`,{ref:le,value:P,onChange:e=>F(e.target.value),onKeyDown:e=>{e.key===`Enter`&&P.trim()&&(e.preventDefault(),fe(P)),e.key===`Escape`&&(ee(!1),F(``))},onBlur:()=>{P.trim()&&fe(P),ee(!1),F(``)},placeholder:d(`detailModal.addLabelPlaceholder`),className:`w-full h-6 rounded border border-border bg-input px-2 text-[10px] text-foreground placeholder:text-muted-foreground`}),de.length>0&&(0,q.jsx)(`div`,{className:`absolute left-0 right-0 top-full mt-0.5 rounded border border-border/50 bg-popover shadow-lg z-10 py-0.5`,children:de.map(e=>(0,q.jsx)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),fe(e)},className:`w-full text-left px-2 py-1 text-[10px] hover:bg-accent/50 text-foreground/80`,children:e},e))})]}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>ee(!0),className:`flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,q.jsx)(pp,{className:`w-2.5 h-2.5`}),d(`detailModal.addLabel`)]})]}),(0,q.jsx)(PV,{ticket:e,allTickets:n??[],onOpenTicket:e=>i?.(e)}),e.source===`jira`&&e.jira_key&&(0,q.jsx)(pV,{localId:e.id}),e.metadata?.effort_level&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-0.5`,children:d(`detailModal.effort`)}),(0,q.jsx)(`span`,{className:`text-xs text-foreground/70`,children:e.metadata.effort_level})]}),e.assignee&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-0.5`,children:d(`detailModal.assignee`)}),(0,q.jsx)(`span`,{className:`text-xs text-foreground/70`,children:e.assignee})]})]})]})}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3 border-t border-border/30`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground`,children:[(0,q.jsx)(`span`,{children:d(`meta.createdAgo`,{time:HV(e.created_at)})}),(0,q.jsx)(`span`,{children:d(`meta.updatedAgo`,{time:HV(e.updated_at)})}),e.source&&(0,q.jsx)(`span`,{className:`bg-muted/30 rounded px-1.5 py-0.5`,children:BV[e.source]?d(BV[e.source]):e.source})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ie?(0,q.jsxs)(Z,{variant:`ghost`,size:`sm`,className:`h-7 text-xs text-accent-info hover:bg-accent-info/10`,onClick:()=>B(!0),"data-testid":`jira-move-to-button`,children:[(0,q.jsx)(Gd,{className:`w-3 h-3 mr-1`}),f(`discard.moveButton`,{status:re.discardStatus})]}):(0,q.jsxs)(Z,{variant:`ghost`,size:`sm`,className:`h-7 text-xs text-red-400 aurora-light:text-destructive hover:text-red-300 aurora-light:hover:text-destructive hover:bg-red-500/10 aurora-light:hover:bg-destructive/10`,onClick:()=>R(!0),children:[(0,q.jsx)(Vp,{className:`w-3 h-3 mr-1`}),d(`common:actions.delete`)]}),ue&&(0,q.jsxs)(Z,{size:`sm`,className:`h-7 text-xs`,onClick:()=>{W?ne(!0):me()},disabled:H||!S.trim(),children:[(0,q.jsx)(Cp,{className:`w-3 h-3 mr-1`}),d(H?`common:states.saving`:`common:actions.save`)]})]})]})]}),(0,q.jsx)(Gy,{open:te,onOpenChange:R,children:(0,q.jsxs)(Jy,{className:`max-w-sm`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:d(`deleteDialog.title`)}),(0,q.jsx)(Qy,{children:(0,q.jsx)(Bi,{t:d,i18nKey:`deleteDialog.body`,values:{id:e.id,title:e.title},components:{strong:(0,q.jsx)(`span`,{className:`font-semibold text-foreground`})}})})]}),(0,q.jsxs)(Xy,{children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>R(!1),children:d(`common:actions.cancel`)}),(0,q.jsxs)(Z,{variant:`destructive`,size:`sm`,onClick:he,children:[(0,q.jsx)(Vp,{className:`w-3.5 h-3.5 mr-1.5`}),d(`common:actions.delete`)]})]})]})}),ie&&re.discardStatus&&(0,q.jsx)(db,{open:z,onOpenChange:B,ticket:{id:e.id,title:e.title,jira_key:e.jira_key},discardStatus:re.discardStatus,onDiscarded:r}),(0,q.jsx)(Gy,{open:V,onOpenChange:ne,children:(0,q.jsxs)(Jy,{className:`max-w-md`,"data-testid":`jira-save-confirm`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:f(`detail.saveTitle`)}),(0,q.jsx)(Qy,{children:f(`detail.saveBody`,{key:e.jira_key??`#${e.id}`})})]}),(0,q.jsxs)(Xy,{children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>ne(!1),children:d(`common:actions.cancel`)}),(0,q.jsxs)(Z,{size:`sm`,onClick:()=>{ne(!1),me()},disabled:H,"data-testid":`jira-save-confirm-btn`,children:[(0,q.jsx)(Cp,{className:`w-3.5 h-3.5 mr-1.5`}),f(`detail.saveConfirm`)]})]})]})})]});return u?we:(0,q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/70`,onClick:r}),we]})}function HV(e){try{return lB(new Date(e),{addSuffix:!0,locale:md()})}catch{return e}}var UV=new Set([`draft`,`todo`,`backlog`]);function WV({ticket:e,title:t,description:n,priority:r,labels:i,onClose:a}){let{t:o}=G(`tickets`),{triggerResume:s}=yg(),{activeProjectId:c}=Sd(),{closeTicketDetail:l}=iV();return UV.has(e.status)?(0,q.jsxs)(Z,{variant:`default`,size:`sm`,onClick:()=>{if(!c)return;let{body:u,criteria:d}=Sg(n);s({kind:`explore-spec`,projectId:c,label:t||e.title||o(`detailModal.ticketFallbackLabel`,{id:e.id}),restoreRoute:`/`,params:{initialIdea:``,pendingSpecId:``,initialAttachmentIds:[],resumeConversationId:e.origin_conversation_id??void 0,editTicket:{id:e.id,title:t,description:u,labels:i,priority:r,acceptanceCriteria:d,status:e.status}}}),l(),a()},className:`shrink-0 mr-2`,"data-testid":`continue-editing`,children:[(0,q.jsx)(Qf,{className:`w-3.5 h-3.5 mr-1.5`}),o(`detailModal.continueEditing`)]}):null}function GV({ticket:e,rails:t,onMoveToRail:n,onRemoveFromRail:r}){let{t:i}=G(`tickets`),[a,o]=(0,I.useState)(null),s=(0,I.useRef)(null),c=t.find(t=>t.ticketIds.includes(e.id));return c?r?(0,q.jsxs)(Z,{variant:`outline`,size:`sm`,className:`shrink-0 mr-2 gap-1.5 border-accent-warning/30 text-accent-warning hover:bg-accent-warning/10 hover:text-accent-warning`,"data-testid":`modal-remove-from-rail`,onClick:()=>r(e.id),title:i(`rail.currentlyOn`,{rail:c.label}),children:[(0,q.jsx)(Wd,{className:`w-3.5 h-3.5`,"aria-hidden":!0}),i(`rail.removeFromRail`)]}):null:n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Z,{ref:s,variant:`outline`,size:`sm`,className:`shrink-0 mr-2 gap-1.5 border-accent-info/30 text-accent-info hover:bg-accent-info/10 hover:text-accent-info`,"data-testid":`modal-move-to-rail`,onClick:()=>{s.current&&o(s.current.getBoundingClientRect())},children:[i(`rail.moveToRail`),(0,q.jsx)(Gd,{className:`w-3.5 h-3.5`,"aria-hidden":!0})]}),a&&(0,q.jsx)(qh,{rails:t,anchorRect:a,onMoveToRail:t=>n(e.id,t),onClose:()=>o(null)})]}):null}var KV=`
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Contract Layer
|
|
114
|
+
|
|
115
|
+
`;function qV(e){let t=e.indexOf(KV);return t<0?{user:e,contract:null}:{user:e.slice(0,t),contract:e.slice(t+26)}}function JV(e){let t=[`### Naming Contract`,`### Data Shapes`,`### State Machine`,`### Invariants`,`### File Touch List`],n=0;for(let r of t){let t=e.indexOf(r);if(t<0)continue;let i=e.slice(t+r.length),a=i.indexOf(`N/A — model did not produce items`),o=i.indexOf(`### `);a>=0&&(o<0||a<o)||n++}return n}function YV({description:e,onEdit:t}){let{t:n}=G(`tickets`),{user:r,contract:i}=qV(e);return(0,q.jsxs)(`div`,{className:`flex-1 rounded-lg bg-muted/20 px-3 py-2 overflow-y-auto transition-colors`,onClick:e=>{e.target.closest(`details, summary`)||t()},role:`button`,style:{cursor:`pointer`},children:[(0,q.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none prose-p:my-1 prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded text-foreground/80 text-xs`,children:(0,q.jsx)(rF,{remarkPlugins:[sR],children:r||e})}),i&&(0,q.jsxs)(`details`,{"data-testid":`contract-layer-disclosure`,className:`mt-3 rounded-md border border-border/40 bg-muted/10 px-2 py-1`,onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer text-[10px] font-medium text-foreground/80 select-none flex items-center gap-2`,children:[n(`contractLayer.title`),(0,q.jsx)(`span`,{className:`rounded-full bg-muted/40 px-1.5 text-[9px] text-foreground/60`,children:n(`contractLayer.populated`,{n:JV(i)})})]}),(0,q.jsx)(`div`,{className:`mt-2 prose prose-invert prose-xs max-w-none prose-p:my-1 prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded text-foreground/80 text-xs`,children:(0,q.jsx)(rF,{remarkPlugins:[sR],children:i})})]})]})}function XV({open:e,allLabels:t,onClose:n,onCreate:r}){let{t:i}=G(`tickets`),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(`todo`),[d,f]=(0,I.useState)(`medium`),[p,m]=(0,I.useState)([]),[h,g]=(0,I.useState)(``),[_,v]=(0,I.useState)(!1),y=(0,I.useRef)(null),b=(0,I.useRef)(null);(0,I.useEffect)(()=>{e&&setTimeout(()=>y.current?.focus(),100)},[e]),(0,I.useEffect)(()=>{e||(o(``),c(``),u(`todo`),f(`medium`),m([]),g(``))},[e]);let x=(0,I.useMemo)(()=>{if(!h.trim())return[];let e=h.toLowerCase();return t.filter(t=>t.toLowerCase().includes(e)&&!p.includes(t)).slice(0,5)},[h,t,p]),S=(0,I.useCallback)(e=>{let t=e.trim();t&&!p.includes(t)&&m(e=>[...e,t]),g(``)},[p]),C=(0,I.useCallback)(async()=>{if(!a.trim())return;v(!0);let e=await r({title:a.trim(),description:s.trim()||void 0,status:l,priority:d,labels:p.length>0?p:void 0});v(!1),e?(K.success(i(`createModal.toast.created`)),n()):K.error(i(`createModal.toast.createFailed`))},[a,s,l,d,p,r,n,i]);return(0,q.jsx)(Gy,{open:e,onOpenChange:e=>!e&&n(),children:(0,q.jsxs)(Jy,{className:`max-w-lg glass-card`,children:[(0,q.jsx)(Yy,{children:(0,q.jsx)(Zy,{children:i(`createModal.title`)})}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`label`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1`,children:[i(`fields.title`),` `,(0,q.jsx)(`span`,{className:`text-red-400 aurora-light:text-destructive`,children:`*`})]}),(0,q.jsx)(`input`,{ref:y,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&a.trim()&&C()},placeholder:i(`createModal.titlePlaceholder`),className:`w-full h-8 rounded border border-border bg-input px-3 text-xs text-foreground placeholder:text-muted-foreground`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1`,children:i(`fields.description`)}),(0,q.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:4,placeholder:i(`fields.markdownPlaceholder`),className:`w-full rounded border border-border bg-input px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground resize-y min-h-[80px]`}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground mt-0.5 block`,children:i(`fields.supportsMarkdown`)})]}),(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`label`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1`,children:i(`fields.status`)}),(0,q.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`w-full h-7 rounded border border-border bg-input px-2 text-xs text-foreground`,children:[(0,q.jsx)(`option`,{value:`todo`,children:i(`ticketStatus.todo`)}),(0,q.jsx)(`option`,{value:`in_progress`,children:i(`ticketStatus.inProgress`)}),(0,q.jsx)(`option`,{value:`done`,children:i(`ticketStatus.done`)}),(0,q.jsx)(`option`,{value:`cancelled`,children:i(`ticketStatus.cancelled`)})]})]}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`label`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1`,children:i(`fields.priority`)}),(0,q.jsxs)(`select`,{value:d,onChange:e=>f(e.target.value),className:`w-full h-7 rounded border border-border bg-input px-2 text-xs text-foreground`,children:[(0,q.jsx)(`option`,{value:`critical`,children:i(`priority.critical`)}),(0,q.jsx)(`option`,{value:`high`,children:i(`priority.high`)}),(0,q.jsx)(`option`,{value:`medium`,children:i(`priority.medium`)}),(0,q.jsx)(`option`,{value:`low`,children:i(`priority.low`)})]})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1`,children:i(`fields.labels`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-1.5`,children:p.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] font-medium bg-accent/60 text-foreground/70`,children:[e,(0,q.jsx)(`button`,{type:`button`,onClick:()=>m(t=>t.filter(t=>t!==e)),className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,q.jsx)(df,{className:`w-2.5 h-2.5`})})]},e))}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`input`,{ref:b,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h.trim()&&(e.preventDefault(),S(h))},placeholder:i(`createModal.labelsPlaceholder`),className:`w-full h-6 rounded border border-border bg-input px-2 text-[10px] text-foreground placeholder:text-muted-foreground`}),x.length>0&&(0,q.jsx)(`div`,{className:`absolute left-0 right-0 top-full mt-0.5 rounded border border-border/50 bg-popover shadow-lg z-10 py-0.5`,children:x.map(e=>(0,q.jsx)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),S(e)},className:`w-full text-left px-2 py-1 text-[10px] hover:bg-accent/50 text-foreground/80`,children:e},e))})]})]})]}),(0,q.jsxs)(Xy,{children:[(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:n,children:i(`common:actions.cancel`)}),(0,q.jsxs)(Z,{size:`sm`,onClick:C,disabled:_||!a.trim(),children:[(0,q.jsx)(pp,{className:`w-3.5 h-3.5 mr-1`}),i(_?`createModal.creating`:`createModal.create`)]})]})]})})}function ZV({open:e,railLabel:t,specCount:n,model:r,onConfirm:i,onCancel:a}){let{t:o}=G(`dashboard`),s=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(!e)return;function t(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),i())}return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,i]),(0,q.jsx)(Gy,{open:e,onOpenChange:e=>{e||a()},children:(0,q.jsxs)(Jy,{showCloseButton:!1,className:`max-w-md gap-5`,onOpenAutoFocus:e=>{e.preventDefault(),s.current?.focus()},children:[(0,q.jsx)(Yy,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,q.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center rounded-xl bg-accent-highlight/15 text-accent-highlight ring-1 ring-accent-highlight/30`,children:(0,q.jsx)(Mp,{className:`h-4.5 w-4.5`})}),(0,q.jsxs)(`div`,{className:`text-left`,children:[(0,q.jsx)(Zy,{className:`text-base`,children:o(`ultracodeDialog.title`)}),(0,q.jsxs)(Qy,{children:[o(`ultracodeDialog.context`,{rail:t,count:n}),r?` · ${r}`:``]})]})]})}),(0,q.jsxs)(`ul`,{className:`space-y-2.5 text-xs text-muted-foreground`,children:[(0,q.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,q.jsx)(Ff,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-warning`}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:o(`ultracodeDialog.noPipelineTitle`)}),` `,o(`ultracodeDialog.noPipelineBody`)]})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,q.jsx)(Xd,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-info`}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:o(`ultracodeDialog.autonomyTitle`)}),` `,o(`ultracodeDialog.autonomyBody`)]})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,q.jsx)(wf,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-success`}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:o(`ultracodeDialog.costTitle`)}),` `,o(`ultracodeDialog.costBody`)]})]})]}),(0,q.jsxs)(Xy,{className:`gap-2 sm:gap-2`,children:[(0,q.jsx)(Z,{variant:`ghost`,className:`h-9`,onClick:a,children:o(`common:actions.cancel`)}),(0,q.jsxs)(Z,{ref:s,className:`h-9 gap-2 bg-emerald-500 text-white hover:bg-emerald-400 focus-visible:ring-emerald-400`,onClick:i,children:[o(`ultracodeDialog.continue`),(0,q.jsx)(`kbd`,{className:`hidden sm:inline-flex items-center rounded border border-white/30 bg-white/10 px-1 text-[9px] font-medium leading-4`,children:`⌘↵`})]})]})]})})}var QV=`postit`,$V=e=>`specrails-desktop:specs-view-tier:${e}`;function eH(e){return e===`row`||e===`postit`}function tH(e){if(!e)return QV;try{let t=localStorage.getItem($V(e));if(eH(t))return t}catch{}return QV}function nH(e,t){if(e)try{localStorage.setItem($V(e),t)}catch{}}function rH(e,t,n){if(typeof n==`number`&&n===t)return e;if(typeof n==`number`&&e.includes(n)){let r=e.indexOf(n),i=[...e];return i.splice(r,0,t),i}return[...e,t]}function iH(e,t,n,r,i){if(typeof e==`string`){if(r(e)){let n=i(e);return t.has(n)?n:null}return t.has(e)?e:null}if(typeof e==`number`){let r=n(e);return r&&t.has(r)?r:null}return null}var aH=[{id:`rail-1`,label:`Rail 1`,ticketIds:[],mode:`implement`,status:`idle`},{id:`rail-2`,label:`Rail 2`,ticketIds:[],mode:`implement`,status:`idle`},{id:`rail-3`,label:`Rail 3`,ticketIds:[],mode:`implement`,status:`idle`}];function oH(e){if(!e)return null;try{let t=localStorage.getItem(`specrails-desktop:spec-order:${e}`);if(!t)return null;let n=JSON.parse(t);return Array.isArray(n)?n:null}catch{return null}}function sH(e,t){if(e)try{t?localStorage.setItem(`specrails-desktop:spec-order:${e}`,JSON.stringify(t)):localStorage.removeItem(`specrails-desktop:spec-order:${e}`)}catch{}}function cH(e){if(!e)return null;try{let t=localStorage.getItem(`specrails-desktop:rails:${e}`);if(!t)return null;let n=JSON.parse(t);return!Array.isArray(n)||n.length===0?null:n}catch{return null}}function lH(e,t){if(e)try{localStorage.setItem(`specrails-desktop:rails:${e}`,JSON.stringify(t))}catch{}}function uH(){let{t:e}=G(`dashboard`),{activeProjectId:t,projects:n}=Sd(),r=(()=>{let e=n.find(e=>e.id===t);return e?hd(e):[`claude`]})(),{tickets:i,isLoading:a,updateTicket:o,updateTicketStatus:s,updateTicketPriority:c,deleteTicket:l,createTicket:u,refetch:d,contractRefiningIds:f}=Md(),{registerHandler:p,unregisterHandler:m,connectionStatus:h}=xl(),{specToOpen:g,clearSpecToOpen:_}=EE(),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(null);(0,I.useEffect)(()=>{!g||g.projectId!==t||(y(g.ticket),d(),_())},[g,t,d,_]);let[w,T]=(0,I.useState)(null),[E,D]=(0,I.useState)(null),[O,k]=(0,I.useState)(()=>oH(t)),[A,j]=(0,I.useState)(()=>cH(t)??aH),M=lE(t),[N,P]=(0,I.useState)(M.mode),[F,L]=(0,I.useState)(M.dir),[ee,te]=(0,I.useState)(()=>tH(t));(0,I.useEffect)(()=>{k(oH(t)),j(cH(t)??aH);let e=lE(t);P(e.mode),L(e.dir),te(tH(t))},[t]);let R=(0,I.useCallback)((e,n)=>{P(e),L(n),uE(t,e,n)},[t]),z=(0,I.useCallback)(e=>{te(e),nH(t,e)},[t]);(0,I.useEffect)(()=>{if(h!==`connected`||!(cH(t)??aH).some(e=>e.status===`running`)||!t)return;let e=!1;return fetch(`${ul()}/rails`).then(e=>e.ok?e.json():null).then(n=>{if(e||!n)return;let r=n.activeJobs??{},i=new Set(Object.keys(r).map(Number));j(e=>{let n=e.map((e,t)=>{if(e.status!==`running`)return e;if(i.has(t)){let n=r[String(t)]?.jobId;return n&&!e.activeJobId?{...e,activeJobId:n}:e}return{...e,status:`idle`,activeJobId:void 0,ticketIds:[]}});return lH(t,n),n})}).catch(()=>{}),()=>{e=!0}},[t,h]),(0,I.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`${ul()}/rails`).then(e=>e.ok?e.json():null).then(n=>{if(e||!n?.rails)return;let r=new Map;for(let e of n.rails)r.set(e.railIndex,e.name??null);j(e=>{let n=!1,i=e.map(e=>{let t=parseInt(e.id.replace(`rail-`,``),10);if(t<1||t>3)return e;let i=r.get(t-1)??null;if(!i)return e;let a=`Rail ${i}`;return a===e.label?e:(n=!0,{...e,label:a})});return n?(lH(t,i),i):e})}).catch(()=>{}),()=>{e=!0}},[t]),(0,I.useEffect)(()=>{let e=new Set(i.filter(e=>e.status===`done`).map(e=>e.id));e.size!==0&&j(n=>{let r=n.map(t=>{let n=t.ticketIds.filter(t=>!e.has(t));return n.length===t.ticketIds.length?t:{...t,ticketIds:n}});return r.every((e,t)=>e===n[t])?n:(lH(t,r),r)})},[i,t]);let B=(0,I.useCallback)(e=>{k(n=>{let r=e(n);return sH(t,r),r})},[t]),V=(0,I.useCallback)(e=>{j(n=>{let r=e(n);return lH(t,r),r})},[t]),ne=(0,I.useMemo)(()=>{let e=new Set([`specs`,`done-specs`]);for(let t of A)e.add(t.id);return e},[A]),H=(0,I.useCallback)(()=>{let t=A.map(e=>parseInt(e.id.replace(`rail-`,``),10)),n=t.length>0?Math.max(...t)+1:1,r={id:`rail-${n}`,label:`Rail ${n}`,ticketIds:[],mode:`implement`,status:`idle`};V(e=>[...e,r]),K.success(e(`toasts.railAdded`,{n}))},[A,V,e]),U=(0,I.useCallback)(t=>{let n=A.find(e=>e.id===t);!n||n.status===`running`||(n.ticketIds.length>0&&B(e=>[...e??[],...n.ticketIds]),V(e=>e.filter(e=>e.id!==t)),K.info(e(`toasts.railRemoved`,{rail:n.label})))},[A,V,B,e]),re=(0,I.useCallback)((e,t)=>{V(n=>n.map(n=>n.id===e?{...n,label:`Rail ${t}`}:n));let n=parseInt(e.replace(`rail-`,``),10);n>=1&&n<=3&&fetch(`${ul()}/rails/${n-1}/name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t})}).catch(()=>{})},[V]),ie=(0,I.useRef)(t);(0,I.useEffect)(()=>{ie.current=t},[t]);let W=(0,I.useCallback)(t=>{let n=t;if(n.projectId===ie.current){if(n.type===`rail.updated`){let e=n.railIndex??0,t=`rail-${e+1}`,r=n.ticketIds??[],i=n.name?`Rail ${n.name}`:`Rail ${e+1}`;V(e=>e.map(e=>e.id===t?n.changed!==`tickets`||e.status===`running`?{...e,label:i}:{...e,label:i,ticketIds:r}:e));return}if(n.type===`rail.job_completed`){let t=n.railIndex??0;V(e=>zz(e,t,n.ticketIds??[])),n.status===`completed`?K.info(e(`toasts.railCompleted`,{n:t+1})):n.status===`failed`||n.status===`zombie_terminated`?K.error(e(`toasts.railFailed`,{n:t+1})):K.info(e(`toasts.railEnded`,{n:t+1,status:n.status??`finished`}))}}},[V,e]);(0,I.useEffect)(()=>(p(`dashboard-rails`,W),()=>m(`dashboard-rails`)),[W,p,m]);let ae=fo(uo(_s,{activationConstraint:{distance:5}}),uo(fs)),oe=(0,I.useCallback)(e=>{let t=typeof e.active.id==`string`&&Lz(e.active.id),n=e.droppableContainers.filter(e=>{let n=e.id;return typeof n==`string`&&Lz(n)?t:!t}),r={...e,droppableContainers:n};if(t)return So(r);let i=Eo(r);if(yo(i))return i;let a=wo(r);return yo(a)?a:So(r)},[]),se=(0,I.useMemo)(()=>new Map(i.map(e=>[e.id,e])),[i]),ce=(0,I.useMemo)(()=>{let e=new Set;for(let t of i)for(let n of t.labels)e.add(n);return Array.from(e).sort()},[i]),le=(0,I.useMemo)(()=>{let e=new Set;for(let t of A)for(let n of t.ticketIds)e.add(n);return e},[A]),ue=(0,I.useMemo)(()=>i.filter(e=>(e.source===`propose-spec`||e.source===`product-backlog`||e.source===`get-backlog-specs`||e.source===`explore-draft`||e.source===`specs-smash`||e.source===`free-prompt`||e.source===`jira`)&&!le.has(e.id)),[i,le]),de=(0,I.useMemo)(()=>{let e=ue.filter(e=>e.status!==`done`);if(N!==`default`)return hE(e,N,F);if(!O)return e;let t=new Map(e.map(e=>[e.id,e])),n=[];for(let e of O){let r=t.get(e);r&&n.push(r)}for(let t of e)O.includes(t.id)||n.push(t);return n},[ue,O,N,F]),fe=(0,I.useMemo)(()=>ue.filter(e=>e.status===`done`),[ue]),pe=(0,I.useCallback)((t,n)=>{let r=A.find(e=>e.id===n);if(r){if(r.ticketIds.includes(t)){K.info(e(`toasts.alreadyOnRail`,{rail:r.label}));return}B(e=>(e??de.map(e=>e.id)).filter(e=>e!==t)),V(e=>e.map(e=>e.id===n?{...e,ticketIds:[...e.ticketIds.filter(e=>e!==t),t]}:e.ticketIds.includes(t)?{...e,ticketIds:e.ticketIds.filter(e=>e!==t)}:e)),K.success(e(`toasts.movedToRail`,{rail:r.label}))}},[A,de,V,B,e]),me=(0,I.useCallback)(t=>{let n=A.find(e=>e.ticketIds.includes(t));if(n){if(n.status===`running`){K.error(e(`toasts.railRunningStopFirst`,{rail:n.label}));return}V(e=>e.map(e=>e.id===n.id?{...e,ticketIds:e.ticketIds.filter(e=>e!==t)}:e)),B(e=>{let n=e??de.map(e=>e.id);return n.includes(t)?n:[...n,t]}),K.success(e(`toasts.removedFromRail`,{rail:n.label}))}},[A,de,V,B,e]),he=(0,I.useCallback)(e=>{if(de.some(t=>t.id===e))return`specs`;if(fe.some(t=>t.id===e))return`done-specs`;for(let t of A)if(t.ticketIds.includes(e))return t.id;return null},[de,fe,A]);function ge({active:e}){if(Lz(e.id)){let t=Rz(e.id);D(A.find(e=>e.id===t)?.label??t);return}T(e.id)}function _e({active:n,over:r}){if(T(null),D(null),!r)return;if(Lz(n.id)){if(!Lz(r.id))return;let e=Rz(n.id),t=Rz(r.id);if(e===t)return;V(n=>{let r=n.findIndex(t=>t.id===e),i=n.findIndex(e=>e.id===t);return r===-1||i===-1?n:Fc(n,r,i)});return}let i=n.id,a=r.id,s=he(i);if(!s)return;let c=iH(a,ne,he,Lz,Rz)??s;if(ne.has(c))if(s===c)if(c===`specs`){let e=de.map(e=>e.id),n=e.indexOf(i),r=e.indexOf(a);if(n!==-1&&r!==-1&&n!==r){let i=Fc(e,n,r);B(()=>i),N!==`default`&&(P(`default`),uE(t,`default`,F))}}else V(e=>e.map(e=>{if(e.id!==c)return e;let t=e.ticketIds.indexOf(i),n=e.ticketIds.indexOf(a);return t!==-1&&n!==-1&&t!==n?{...e,ticketIds:Fc(e.ticketIds,t,n)}:e}));else if(s===`specs`&&c===`done-specs`)B(e=>(e??de.map(e=>e.id)).filter(e=>e!==i)),o(i,{status:`done`});else if(s===`done-specs`&&c===`specs`)o(i,{status:`todo`}),B(e=>rH(e??de.map(e=>e.id),i,a));else if(s===`specs`){let t=A.find(e=>e.id===c);B(e=>(e??de.map(e=>e.id)).filter(e=>e!==i)),V(e=>e.map(e=>e.id===c?{...e,ticketIds:rH(e.ticketIds,i,a)}:e)),t&&(t.status===`running`?K.info(e(`toasts.queuedOnRail`,{rail:t.label}),{description:e(`toasts.queuedOnRailDescription`)}):K.success(e(`toasts.movedToRail`,{rail:t.label})))}else if(c===`specs`){let t=A.find(e=>e.id===s);if(t?.status===`running`){K.error(e(`toasts.railRunningStopFirst`,{rail:t.label}));return}V(e=>e.map(e=>e.id===s?{...e,ticketIds:e.ticketIds.filter(e=>e!==i)}:e)),B(e=>rH(e??de.map(e=>e.id),i,a)),t&&K.success(e(`toasts.removedFromRail`,{rail:t.label}))}else s===`done-specs`?(o(i,{status:`todo`}),V(e=>e.map(e=>e.id===c?{...e,ticketIds:rH(e.ticketIds,i,a)}:e))):c===`done-specs`?(V(e=>e.map(e=>e.id===s?{...e,ticketIds:e.ticketIds.filter(e=>e!==i)}:e)),o(i,{status:`done`})):V(e=>e.map(e=>e.id===s?{...e,ticketIds:e.ticketIds.filter(e=>e!==i)}:e.id===c?{...e,ticketIds:rH(e.ticketIds,i,a)}:e))}function ve(e,t){V(n=>n.map(n=>n.id===e?{...n,mode:t}:n))}async function ye(e,t){V(n=>n.map(n=>n.id===e?{...n,profileName:t}:n));let n=A.findIndex(t=>t.id===e);if(n!==-1)try{await fetch(`${ul()}/rails/${n}/profile`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profileName:t})})}catch{}}function be(e,t){V(n=>n.map(n=>n.id===e?{...n,ultracodeModel:t}:n))}async function xe(e,t){V(n=>n.map(n=>n.id===e?{...n,aiEngine:t,mode:t!==`claude`&&n.mode===`ultracode`?`implement`:n.mode}:n));let n=A.findIndex(t=>t.id===e);if(n!==-1)try{await fetch(`${ul()}/rails/${n}/engine`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({aiEngine:t})})}catch{}}async function Se(t){let n=A.findIndex(e=>e.id===t);if(n===-1)return;let r=A[n];if(r.status===`running`){try{await fetch(`${ul()}/rails/${n}/stop`,{method:`POST`}),V(e=>e.map(e=>e.id===t?{...e,status:`idle`,activeJobId:void 0}:e)),K.info(e(`toasts.railStopped`,{rail:r.label}))}catch{K.error(e(`toasts.stopFailed`))}return}if(r.ticketIds.length!==0){if(r.mode===`ultracode`){C({railId:t});return}await Ce(t)}}async function Ce(t){let n=A.findIndex(e=>e.id===t);if(n===-1)return;let r=A[n];if(r.ticketIds.length===0)return;let i=ul();try{await fetch(`${i}/rails/${n}/tickets`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ticketIds:r.ticketIds})})}catch{K.error(e(`toasts.syncTicketsFailed`));return}try{let a=await fetch(`${i}/rails/${n}/launch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:r.mode,...r.profileName===void 0?{}:{profileName:r.profileName},...r.aiEngine==null?{}:{aiEngine:r.aiEngine},...r.mode===`ultracode`&&r.ultracodeModel?{model:r.ultracodeModel}:{}})});if(!a.ok){let t=await a.json().catch(()=>({error:``}));K.error(t.error||e(`toasts.launchFailed`));return}let{jobId:o}=await a.json();V(e=>e.map(e=>e.id===t?{...e,status:`running`,activeJobId:o}:e)),K.success(e(`toasts.railLaunched`,{rail:r.label}),{description:e(`toasts.launchDescription`,{mode:r.mode,count:r.ticketIds.length})})}catch{K.error(e(`toasts.launchNetworkError`))}}let we=w===null?void 0:se.get(w),Te=(0,I.useRef)(null),{leftWidth:Ee,enabled:De,beginDrag:Oe,resetToDefault:ke}=Yz(t,Te),Ae=typeof window<`u`?window.innerWidth:1200;return(0,q.jsx)(lb,{children:(0,q.jsxs)(mc,{sensors:ae,collisionDetection:oe,onDragStart:ge,onDragEnd:_e,children:[(0,q.jsxs)(`div`,{ref:Te,className:`flex h-full overflow-hidden`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex flex-col overflow-hidden`,style:De&&Ee!==null?{width:`${Ee}px`,flex:`0 0 auto`}:{flex:`1 1 0%`},children:(0,q.jsx)(Cz,{tickets:de,allTickets:i,doneTickets:fe,isLoading:a,onTicketClick:y,onTicketCreated:e=>{y(e),d()},onTicketDelete:e=>l(e),onTicketStatusChange:(e,t)=>{s(e,t)},onTicketPriorityChange:(e,t)=>{c(e,t)},contractRefiningIds:f,sortMode:N,sortDir:F,onSortChange:R,viewTier:ee,onViewTierChange:z,rails:A,onMoveToRail:pe})}),De&&Ee!==null&&(0,q.jsx)(Xz,{leftWidth:Ee,viewport:Ae,onPointerDown:Oe,onReset:ke}),(0,q.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col overflow-hidden`,children:(0,q.jsx)(Vz,{rails:A,ticketMap:se,providers:r,onModeChange:ve,onProfileChange:ye,onEngineChange:xe,onUltracodeModelChange:be,onToggle:Se,onTicketClick:y,onAddRail:H,onDeleteRail:U,onRenameRail:re,onTicketMoveToSpecs:me})})]}),(0,q.jsx)(Pc,{dropAnimation:{duration:180,easing:`ease`},children:we?ee===`postit`?(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-accent-info/40 bg-card/95 shadow-xl shadow-black/30 backdrop-blur-sm p-3 rotate-1 scale-[1.02] pointer-events-none w-[260px] min-h-[180px]`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:[`#`,we.id]}),we.priority&&(0,q.jsx)(`span`,{className:`h-4 px-1.5 rounded-full text-[9px] font-medium uppercase bg-muted/40 text-foreground`,children:we.priority})]}),(0,q.jsx)(`h3`,{className:`text-sm font-medium leading-snug line-clamp-2 text-foreground`,children:we.title}),we.short_summary&&we.short_summary.trim().length>0&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/80 leading-relaxed line-clamp-3 italic`,children:we.short_summary})]}):(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2.5 rounded-lg border border-primary/40 bg-card/95 shadow-xl shadow-black/20 backdrop-blur-sm rotate-1 scale-[1.03] pointer-events-none`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground/50 shrink-0`,children:[`#`,we.id]}),(0,q.jsx)(`span`,{className:`flex-1 text-sm truncate max-w-[240px]`,children:we.title})]}):E?(0,q.jsx)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-xl border border-primary/40 bg-card/95 shadow-xl shadow-black/20 backdrop-blur-sm rotate-[0.5deg] scale-[1.02] pointer-events-none`,children:(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:E})}):null}),v&&(()=>{let e=i.find(e=>e.id===v.id)??v;return(0,q.jsx)(VV,{ticket:e,allLabels:ce,allTickets:i,onClose:()=>y(null),onOpenTicket:e=>{let t=i.find(t=>t.id===e);t&&y(t)},onSave:o,onDelete:e=>{l(e),y(null)},rails:A,onMoveToRail:pe,onRemoveFromRail:me},e.id)})(),(0,q.jsx)(XV,{open:b,allLabels:ce,onClose:()=>x(!1),onCreate:u}),(()=>{let e=S?A.find(e=>e.id===S.railId):void 0;return(0,q.jsx)(ZV,{open:!!S&&!!e,railLabel:e?.label??``,specCount:e?.ticketIds.length??0,model:e?.ultracodeModel??`sonnet`,onCancel:()=>C(null),onConfirm:()=>{let e=S?.railId;C(null),e&&Ce(e)}})})()]})})}var dH=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`div`,{ref:n,className:X(`rounded-lg border border-border bg-card text-card-foreground shadow-sm`,e),...t}));dH.displayName=`Card`;var fH=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`div`,{ref:n,className:X(`flex flex-col space-y-1 p-4`,e),...t}));fH.displayName=`CardHeader`;var pH=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`h3`,{ref:n,className:X(`text-sm font-semibold leading-none tracking-tight`,e),...t}));pH.displayName=`CardTitle`;var mH=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`p`,{ref:n,className:X(`text-xs text-muted-foreground`,e),...t}));mH.displayName=`CardDescription`;var hH=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`div`,{ref:n,className:X(`p-4 pt-0`,e),...t}));hH.displayName=`CardContent`;var gH=I.forwardRef(({className:e,...t},n)=>(0,q.jsx)(`div`,{ref:n,className:X(`flex items-center p-4 pt-0`,e),...t}));gH.displayName=`CardFooter`;var _H=I.forwardRef(({className:e,type:t,...n},r)=>(0,q.jsx)(`input`,{type:t,className:X(`flex h-8 w-full rounded-md border border-input bg-background px-3 py-1 text-xs ring-offset-background file:border-0 file:bg-transparent file:text-xs file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));_H.displayName=`Input`;var vH={fontFamily:`'DM Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace`,fontSize:12,renderMode:`auto`,copyOnSelect:!1,shellIntegrationEnabled:!0,notifyOnCompletion:!0,imageRendering:!0,longCommandThresholdMs:6e4,browserShortcutUrl:`https://specrails.dev`,quickScript:`echo "Hello World!"`};function yH(e){return Number.isFinite(e)?Math.min(32,Math.max(8,Math.round(e))):vH.fontSize}var bH=`specrails:terminal-settings-updated`;function xH(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(bH,{detail:e}))}var SH=[`auto`,`canvas`,`webgl`];function CH({mode:e}){let{t}=G(`settings`),{activeProjectId:n}=Sd(),[r,i]=(0,I.useState)(vH),[a,o]=(0,I.useState)({}),[s,c]=(0,I.useState)(vH),[l,u]=(0,I.useState)(vH),[d,f]=(0,I.useState)(new Set),[p,m]=(0,I.useState)(!0),[h,g]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let t=!1;if(e===`project`&&!n){m(!1);return}return(async()=>{try{if(e===`desktop`){let e=await fetch(`/api/terminal-settings`);if(!e.ok)throw Error(`desktop settings fetch failed`);let n=await e.json();!t&&n&&typeof n==`object`&&`fontSize`in n&&(i(n),c(n),u(n),f(new Set)),t||m(!1)}else if(n){let e=await fetch(`/api/projects/${n}/terminal-settings`);if(!e.ok)throw Error(`project fetch failed`);let r=await e.json();!t&&r&&typeof r==`object`&&r.resolved&&r.desktopDefaults&&(i(r.desktopDefaults),o(r.override??{}),c(r.resolved),u(r.resolved),f(new Set)),t||m(!1)}}catch(e){t||(m(!1),console.error(e))}})(),()=>{t=!0}},[e,n]);let _=(0,I.useMemo)(()=>d.size>0?!0:Object.keys(l).some(e=>l[e]!==s[e]),[l,s,d]);function v(e,t){u(n=>({...n,[e]:t})),d.has(e)&&f(t=>{let n=new Set(t);return n.delete(e),n})}function y(t){e===`project`&&(f(e=>{let n=new Set(e);return n.add(t),n}),u(e=>({...e,[t]:r[t]})))}function b(){u(s),f(new Set)}async function x(){g(!0);try{let r={};for(let e of Object.keys(l)){if(d.has(e)){r[e]=null;continue}l[e]!==s[e]&&(r[e]=l[e])}if(Object.keys(r).length===0){K(t(`terminal.nothingToSave`)),g(!1);return}if(e===`desktop`){let e=await fetch(`/api/terminal-settings`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!e.ok)throw Error(await e.text()||`patch failed`);let n=await e.json();i(n),c(n),u(n),f(new Set),xH({mode:`desktop`,projectId:null}),K.success(t(`terminal.saved`))}else if(n){let e=await fetch(`/api/projects/${n}/terminal-settings`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!e.ok)throw Error(await e.text()||`patch failed`);let a=await e.json();i(a.desktopDefaults),o(a.override),c(a.resolved),u(a.resolved),f(new Set),xH({mode:`project`,projectId:n}),K.success(t(`terminal.saved`))}}catch(e){K.error(t(`errors.saveFailed`,{message:e.message}))}finally{g(!1)}}function S(t){return e!==`project`||d.has(t)?!1:a[t]!==void 0}return p?(0,q.jsx)(dH,{children:(0,q.jsx)(hH,{children:t(`common:states.loading`)})}):(0,q.jsxs)(dH,{children:[(0,q.jsxs)(fH,{children:[(0,q.jsx)(pH,{children:t(`terminal.title`)}),(0,q.jsx)(mH,{children:t(e===`desktop`?`terminal.desktopDescription`:`terminal.projectDescription`)})]}),(0,q.jsxs)(hH,{className:`space-y-4`,children:[(0,q.jsx)(wH,{label:t(`terminal.fontFamily`),overridden:S(`fontFamily`),onClear:()=>y(`fontFamily`),mode:e,children:(0,q.jsx)(_H,{value:l.fontFamily,onChange:e=>v(`fontFamily`,e.target.value)})}),(0,q.jsx)(wH,{label:t(`terminal.fontSize`,{min:8,max:32}),overridden:S(`fontSize`),onClear:()=>y(`fontSize`),mode:e,children:(0,q.jsx)(_H,{type:`number`,min:8,max:32,value:l.fontSize,onChange:e=>v(`fontSize`,parseInt(e.target.value,10)||l.fontSize)})}),(0,q.jsx)(wH,{label:t(`terminal.renderMode`),overridden:S(`renderMode`),onClear:()=>y(`renderMode`),mode:e,children:(0,q.jsx)(`select`,{value:l.renderMode,onChange:e=>v(`renderMode`,e.target.value),className:`border rounded px-2 py-1 bg-transparent`,children:SH.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))})}),(0,q.jsx)(TH,{label:t(`terminal.copyOnSelect`),checked:l.copyOnSelect,overridden:S(`copyOnSelect`),onClear:()=>y(`copyOnSelect`),onChange:e=>v(`copyOnSelect`,e),mode:e}),(0,q.jsx)(TH,{label:t(`terminal.shellIntegration`),checked:l.shellIntegrationEnabled,overridden:S(`shellIntegrationEnabled`),onClear:()=>y(`shellIntegrationEnabled`),onChange:e=>v(`shellIntegrationEnabled`,e),mode:e}),(0,q.jsx)(TH,{label:t(`terminal.notifyLongRunning`),checked:l.notifyOnCompletion,overridden:S(`notifyOnCompletion`),onClear:()=>y(`notifyOnCompletion`),onChange:e=>v(`notifyOnCompletion`,e),mode:e}),(0,q.jsx)(wH,{label:t(`terminal.longCommandThreshold`),overridden:S(`longCommandThresholdMs`),onClear:()=>y(`longCommandThresholdMs`),mode:e,children:(0,q.jsx)(_H,{type:`number`,min:1e3,value:l.longCommandThresholdMs,onChange:e=>v(`longCommandThresholdMs`,parseInt(e.target.value,10)||l.longCommandThresholdMs)})}),(0,q.jsx)(TH,{label:t(`terminal.imageRendering`),checked:l.imageRendering,overridden:S(`imageRendering`),onClear:()=>y(`imageRendering`),onChange:e=>v(`imageRendering`,e),mode:e}),(0,q.jsx)(wH,{id:`terminal-browser-shortcut-url`,label:t(`terminal.browserShortcutUrl`),overridden:S(`browserShortcutUrl`),onClear:()=>y(`browserShortcutUrl`),mode:e,children:(0,q.jsx)(_H,{type:`url`,value:l.browserShortcutUrl,placeholder:`https://specrails.dev`,onChange:e=>v(`browserShortcutUrl`,e.target.value)})}),(0,q.jsx)(wH,{id:`terminal-quick-script`,label:t(`terminal.quickScript`),overridden:S(`quickScript`),onClear:()=>y(`quickScript`),mode:e,children:(0,q.jsx)(`textarea`,{value:l.quickScript,placeholder:`echo "Hello World!"`,onChange:e=>v(`quickScript`,e.target.value),rows:3,className:`w-full border rounded px-2 py-1 bg-transparent font-mono text-xs`})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 border-t`,children:[(0,q.jsx)(Z,{onClick:x,disabled:!_||h,children:t(h?`common:states.saving`:`common:actions.save`)}),(0,q.jsx)(Z,{variant:`ghost`,onClick:b,disabled:!_||h,children:t(`terminal.reset`)}),_&&(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`terminal.unsavedChanges`)})]})]})]})}function wH({id:e,label:t,overridden:n,onClear:r,mode:i,children:a}){let{t:o}=G(`settings`);return(0,q.jsxs)(`div`,{id:e,"data-terminal-settings-anchor":e?``:void 0,className:e?`scroll-mt-4`:void 0,children:[(0,q.jsxs)(`div`,{className:`flex justify-between items-center mb-1`,children:[(0,q.jsx)(`label`,{className:`text-sm font-medium`,children:t}),i===`project`&&n&&(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:r,children:o(`terminal.clearOverride`)})]}),a,i===`project`&&!n&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:o(`terminal.inheritingDefault`)})]})}function TH({label:e,checked:t,overridden:n,onClear:r,onChange:i,mode:a}){let{t:o}=G(`settings`);return(0,q.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,q.jsx)(`label`,{className:`text-sm font-medium`,children:e}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a===`project`&&n&&(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:r,children:o(`terminal.clear`)}),(0,q.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":e,"aria-checked":t,onClick:()=>i(!t),className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${t?`bg-primary`:`bg-input`}`,children:(0,q.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${t?`translate-x-4`:`translate-x-0.5`}`})})]})]})}function EH(){let{t:e}=G(`settings`),{activeProjectId:t}=Sd(),n=at(),r=t!==null;(0,I.useEffect)(()=>{if(!n.hash)return;let e=n.hash.slice(1),t=!1,r=Date.now()+3e3,i=()=>{if(t)return;let n=document.getElementById(e);if(n){n.scrollIntoView({behavior:`smooth`,block:`center`}),n.classList.add(`ring-2`,`ring-accent-primary/60`,`rounded`),window.setTimeout(()=>{n.classList.remove(`ring-2`,`ring-accent-primary/60`,`rounded`)},1800);return}Date.now()<r&&window.setTimeout(i,80)};return i(),()=>{t=!0}},[n.hash,n.key]);let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(!0),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(!1),[f,p]=(0,I.useState)(``),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(``),[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(``),[E,D]=(0,I.useState)(!1),O=(0,I.useRef)(new Map);(0,I.useEffect)(()=>{if(t){let e=O.current.get(t);e?(a(e),l(e.dailyBudgetUsd==null?``:String(e.dailyBudgetUsd)),s(!1)):s(!0)}async function e(){try{let e=await fetch(`${ul()}/config`);if(!e.ok)return;let n=await e.json();a(n),l(n.dailyBudgetUsd==null?``:String(n.dailyBudgetUsd)),t&&O.current.set(t,n)}catch{}finally{s(!1)}}e()},[t]),(0,I.useEffect)(()=>{if(!t)return;async function e(){try{let e=await fetch(`${ul()}/budget`);if(!e.ok)return;let t=await e.json();t.dailyBudgetUsd!=null&&l(String(t.dailyBudgetUsd)),t.jobCostThresholdUsd==null?p(``):p(String(t.jobCostThresholdUsd))}catch{}}e()},[t]),(0,I.useEffect)(()=>{if(!t||!r)return;async function e(){try{let e=await fetch(`${ul()}/settings`);if(!e.ok)return;let t=await e.json();_(t.pipelineTelemetryEnabled??!1),x(t.prePrompt??``),T(t.ultraPrePrompt??``)}catch{}}e()},[t,r]);async function k(){d(!0);try{let t=c.trim()===``?null:parseFloat(c);if(t!==null&&(isNaN(t)||t<=0)){K.error(e(`budget.invalidNumber`));return}if(!(await fetch(`${ul()}/budget`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dailyBudgetUsd:t})})).ok)throw Error(`Failed to save`);K.success(t==null?e(`budget.dailyRemoved`):e(`budget.dailySet`,{amount:t}))}catch(t){K.error(e(`budget.saveBudgetFailed`),{description:t.message})}finally{d(!1)}}async function A(){h(!0);try{let t=f.trim()===``?null:parseFloat(f);if(t!==null&&(isNaN(t)||t<=0)){K.error(e(`budget.invalidNumber`));return}if(!(await fetch(`${ul()}/budget`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobCostThresholdUsd:t})})).ok)throw Error(`Failed to save`);K.success(t==null?e(`budget.perJobAlertDisabled`):e(`budget.alertSet`,{amount:t}))}catch(t){K.error(e(`budget.saveThresholdFailed`),{description:t.message})}finally{h(!1)}}async function j(t){y(!0);let n=g;_(t);try{if(!(await fetch(`${ul()}/settings`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pipelineTelemetryEnabled:t})})).ok)throw Error(`Failed to save`);K.success(e(t?`telemetry.enabled`:`telemetry.disabled`))}catch(t){_(n),K.error(e(`telemetry.saveFailed`),{description:t.message})}finally{y(!1)}}async function M(){C(!0);try{let t=await fetch(`${ul()}/settings`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prePrompt:b})});if(!t.ok)throw Error(`Failed to save`);let n=(await t.json()).settings?.prePrompt??``;x(n),K.success(n.trim()===``?e(`prePrompt.cleared`):e(`prePrompt.saved`))}catch(t){K.error(e(`prePrompt.saveFailed`),{description:t.message})}finally{C(!1)}}async function N(){D(!0);try{let t=await fetch(`${ul()}/settings`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ultraPrePrompt:w})});if(!t.ok)throw Error(`Failed to save`);let n=(await t.json()).settings?.ultraPrePrompt??``;T(n),K.success(n.trim()===``?e(`ultraPrePrompt.resetToDefault`):e(`ultraPrePrompt.saved`))}catch(t){K.error(e(`ultraPrePrompt.saveFailed`),{description:t.message})}finally{D(!1)}}return o?(0,q.jsx)(`div`,{className:`max-w-2xl mx-auto px-4 py-6 space-y-3`,children:[0,1,2].map(e=>(0,q.jsx)(`div`,{className:`h-32 bg-muted/30 rounded-lg animate-pulse`},e))}):(0,q.jsxs)(`div`,{className:`max-w-2xl mx-auto px-4 py-6 space-y-6`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-base font-semibold`,children:e(`page.title`)}),i&&(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[i.project.name,i.project.repo&&` · ${i.project.repo}`]})]}),r&&(0,q.jsxs)(dH,{children:[(0,q.jsxs)(fH,{children:[(0,q.jsx)(pH,{children:e(`telemetry.title`)}),(0,q.jsx)(mH,{children:e(`telemetry.description`)})]}),(0,q.jsx)(hH,{className:`space-y-4`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:e(`telemetry.toggleLabel`)}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:(0,q.jsx)(Bi,{ns:`settings`,i18nKey:`telemetry.toggleDescription`,components:{mono:(0,q.jsx)(`span`,{className:`font-mono`})}})})]}),(0,q.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":e(`telemetry.toggleLabel`),"aria-checked":g,disabled:v,onClick:()=>j(!g),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 ${g?`bg-primary`:`bg-input`}`,children:(0,q.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${g?`translate-x-4`:`translate-x-0.5`}`})})]})})]}),(0,q.jsxs)(dH,{children:[(0,q.jsxs)(fH,{children:[(0,q.jsx)(pH,{children:e(`prePrompt.title`)}),(0,q.jsx)(mH,{children:e(`prePrompt.description`)})]}),(0,q.jsxs)(hH,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`label`,{htmlFor:`project-pre-prompt`,className:`text-xs font-medium`,children:e(`prePrompt.label`)}),(0,q.jsx)(`textarea`,{id:`project-pre-prompt`,value:b,onChange:e=>x(e.target.value),placeholder:e(`prePrompt.placeholder`),className:`min-h-32 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`prePrompt.helper`)})]}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs`,disabled:S,onClick:M,children:e(S?`common:states.saving`:`prePrompt.saveButton`)})})]})]}),(0,q.jsxs)(dH,{children:[(0,q.jsxs)(fH,{children:[(0,q.jsx)(pH,{children:e(`ultraPrePrompt.title`)}),(0,q.jsx)(mH,{children:e(`ultraPrePrompt.description`)})]}),(0,q.jsxs)(hH,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`label`,{htmlFor:`project-ultra-pre-prompt`,className:`text-xs font-medium`,children:e(`ultraPrePrompt.label`)}),(0,q.jsx)(`textarea`,{id:`project-ultra-pre-prompt`,value:w,onChange:e=>T(e.target.value),placeholder:e(`ultraPrePrompt.placeholder`),className:`min-h-32 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`ultraPrePrompt.helper`)})]}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs`,disabled:E,onClick:N,children:e(E?`common:states.saving`:`ultraPrePrompt.saveButton`)})})]})]}),(0,q.jsxs)(dH,{children:[(0,q.jsxs)(fH,{children:[(0,q.jsx)(pH,{children:e(`budget.title`)}),(0,q.jsx)(mH,{children:e(`budget.description`)})]}),(0,q.jsx)(hH,{children:(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-xs font-medium`,children:e(`budget.dailyLabel`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`budget.dailyHelper`)})]}),(0,q.jsx)(_H,{type:`number`,min:`0`,step:`0.01`,value:c,onChange:e=>l(e.target.value),placeholder:e(`budget.dailyPlaceholder`),className:`h-8 text-xs font-mono`}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs`,disabled:u,onClick:k,children:e(u?`common:states.saving`:`common:actions.save`)})})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`text-xs font-medium`,children:e(`budget.perJobLabel`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`budget.perJobHelper`)})]}),(0,q.jsx)(_H,{type:`number`,min:`0`,step:`0.01`,value:f,onChange:e=>p(e.target.value),placeholder:e(`budget.perJobPlaceholder`),className:`h-8 text-xs font-mono`}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs`,disabled:m,onClick:A,children:e(m?`common:states.saving`:`common:actions.save`)})})]})]})})]}),(0,q.jsx)(CH,{mode:`project`})]})}var DH=[`dracula`,`aurora-light`,`obsidian-dark`,`matrix`,`specrails`];function OH(e){return typeof e==`string`&&DH.includes(e)}var kH=`specrails`,AH={bg:`hsl(231 15% 18%)`,fg:`hsl(60 30% 96%)`,current:`hsl(232 14% 31%)`,comment:`hsl(225 27% 51%)`,purple:`hsl(265 89% 78%)`,cyan:`hsl(191 97% 77%)`,green:`hsl(135 94% 65%)`,pink:`hsl(326 100% 74%)`,orange:`hsl(31 100% 71%)`,red:`hsl(0 100% 67%)`,yellow:`hsl(65 92% 76%)`},jH={id:`dracula`,displayName:`Dracula`,tagline:`The original — dark purple-tinted with vivid neon accents`,scheme:`dark`,previewSwatches:{background:AH.bg,foreground:AH.fg,accents:[AH.purple,AH.pink,AH.cyan,AH.green]},xterm:{background:AH.bg,foreground:AH.fg,cursor:AH.purple,cursorAccent:AH.bg,selectionBackground:`hsl(232 14% 36%)`,black:`hsl(232 14% 24%)`,red:AH.red,green:AH.green,yellow:AH.yellow,blue:AH.purple,magenta:AH.pink,cyan:AH.cyan,white:AH.fg,brightBlack:AH.comment,brightRed:`hsl(0 100% 78%)`,brightGreen:`hsl(135 94% 78%)`,brightYellow:`hsl(65 92% 86%)`,brightBlue:`hsl(265 89% 88%)`,brightMagenta:`hsl(326 100% 84%)`,brightCyan:`hsl(191 97% 87%)`,brightWhite:`hsl(60 30% 100%)`},chart:[AH.purple,AH.cyan,AH.green,AH.pink,AH.orange],status:{completed:AH.purple,failed:AH.pink,canceled:AH.orange,running:AH.cyan,queued:AH.comment}},MH={bg:`hsl(220 25% 99%)`,fg:`hsl(230 28% 14%)`,surface:`hsl(220 22% 96%)`,muted:`hsl(225 14% 42%)`,primary:`hsl(255 75% 56%)`,info:`hsl(195 80% 42%)`,success:`hsl(150 65% 36%)`,secondary:`hsl(330 75% 52%)`,warning:`hsl(35 90% 48%)`,destructive:`hsl(0 72% 50%)`,highlight:`hsl(45 95% 48%)`},NH={id:`aurora-light`,displayName:`Aurora Light`,tagline:`Premium light — Linear-inspired indigo on warm off-white`,scheme:`light`,previewSwatches:{background:MH.bg,foreground:MH.fg,accents:[MH.primary,MH.secondary,MH.info,MH.success]},xterm:{background:MH.bg,foreground:MH.fg,cursor:MH.primary,cursorAccent:MH.bg,selectionBackground:`hsl(255 75% 90%)`,black:`hsl(225 14% 18%)`,red:MH.destructive,green:MH.success,yellow:MH.warning,blue:MH.primary,magenta:MH.secondary,cyan:MH.info,white:MH.fg,brightBlack:MH.muted,brightRed:`hsl(0 72% 38%)`,brightGreen:`hsl(150 65% 26%)`,brightYellow:`hsl(35 90% 38%)`,brightBlue:`hsl(255 75% 42%)`,brightMagenta:`hsl(330 75% 38%)`,brightCyan:`hsl(195 80% 32%)`,brightWhite:`hsl(230 28% 8%)`},chart:[MH.primary,MH.info,MH.success,MH.secondary,MH.warning],status:{completed:MH.primary,failed:MH.secondary,canceled:MH.warning,running:MH.info,queued:MH.muted}},PH={bg:`hsl(222 18% 8%)`,fg:`hsl(220 18% 92%)`,surface:`hsl(222 16% 12%)`,muted:`hsl(220 12% 60%)`,primary:`hsl(265 80% 72%)`,info:`hsl(192 90% 62%)`,success:`hsl(150 70% 55%)`,secondary:`hsl(330 80% 68%)`,warning:`hsl(35 95% 62%)`,destructive:`hsl(0 78% 62%)`,highlight:`hsl(50 95% 65%)`},FH={id:`obsidian-dark`,displayName:`Obsidian Dark`,tagline:`Premium dark — near-black blue-tinted with electric accents`,scheme:`dark`,previewSwatches:{background:PH.bg,foreground:PH.fg,accents:[PH.primary,PH.info,PH.secondary,PH.success]},xterm:{background:PH.bg,foreground:PH.fg,cursor:PH.primary,cursorAccent:PH.bg,selectionBackground:`hsl(222 16% 22%)`,black:`hsl(222 16% 14%)`,red:PH.destructive,green:PH.success,yellow:PH.warning,blue:PH.primary,magenta:PH.secondary,cyan:PH.info,white:PH.fg,brightBlack:PH.muted,brightRed:`hsl(0 78% 78%)`,brightGreen:`hsl(150 70% 70%)`,brightYellow:`hsl(35 95% 78%)`,brightBlue:`hsl(265 80% 86%)`,brightMagenta:`hsl(330 80% 80%)`,brightCyan:`hsl(192 90% 78%)`,brightWhite:`hsl(220 18% 100%)`},chart:[PH.primary,PH.info,PH.success,PH.secondary,PH.warning],status:{completed:PH.primary,failed:PH.secondary,canceled:PH.warning,running:PH.info,queued:PH.muted}},IH={bg:`hsl(154 30% 5%)`,fg:`hsl(150 100% 86%)`,surface:`hsl(154 28% 9%)`,muted:`hsl(150 40% 55%)`,primary:`hsl(144 100% 50%)`,info:`hsl(174 56% 56%)`,success:`hsl(145 100% 70%)`,secondary:`hsl(153 100% 33%)`,warning:`hsl(35 100% 64%)`,highlight:`hsl(51 100% 50%)`,destructive:`hsl(351 100% 65%)`},LH={id:`matrix`,displayName:`Matrix`,tagline:`Phosphor terminal — soft mint on green-tinted near-black`,scheme:`dark`,previewSwatches:{background:IH.bg,foreground:IH.fg,accents:[IH.primary,IH.info,IH.highlight,IH.destructive]},xterm:{background:IH.bg,foreground:IH.fg,cursor:IH.primary,cursorAccent:IH.bg,selectionBackground:`hsl(154 40% 22%)`,black:`hsl(154 30% 10%)`,red:IH.destructive,green:IH.primary,yellow:IH.warning,blue:IH.info,magenta:IH.highlight,cyan:IH.info,white:IH.fg,brightBlack:IH.muted,brightRed:`hsl(351 100% 78%)`,brightGreen:IH.success,brightYellow:`hsl(35 100% 78%)`,brightBlue:`hsl(174 56% 72%)`,brightMagenta:`hsl(51 100% 70%)`,brightCyan:`hsl(174 56% 78%)`,brightWhite:`hsl(150 100% 96%)`},chart:[IH.primary,IH.info,IH.warning,IH.highlight,IH.destructive],status:{completed:IH.primary,failed:IH.destructive,canceled:IH.warning,running:IH.info,queued:IH.muted}},RH={bg:`hsl(240 33% 4%)`,card:`hsl(240 30% 8%)`,bgDeep:`hsl(240 40% 2%)`,fg:`hsl(240 20% 95%)`,muted:`hsl(240 13% 62%)`,primary:`hsl(187 100% 44%)`,secondary:`hsl(280 45% 62%)`,success:`hsl(152 78% 48%)`,info:`hsl(191 97% 55%)`,warning:`hsl(42 92% 58%)`,highlight:`hsl(248 75% 67%)`,destructive:`hsl(12 80% 55%)`},zH={dracula:jH,"aurora-light":NH,"obsidian-dark":FH,matrix:LH,specrails:{id:`specrails`,displayName:`SpecRails`,tagline:`Brand theme — deep navy-indigo with saturated cyan accents`,scheme:`dark`,previewSwatches:{background:RH.bg,foreground:RH.fg,accents:[RH.primary,RH.highlight,RH.secondary,RH.success]},xterm:{background:RH.bg,foreground:RH.fg,cursor:RH.primary,cursorAccent:RH.bg,selectionBackground:`hsl(240 30% 22%)`,black:`hsl(240 35% 8%)`,red:RH.destructive,green:RH.success,yellow:RH.warning,blue:RH.highlight,magenta:RH.secondary,cyan:RH.primary,white:RH.fg,brightBlack:RH.muted,brightRed:`hsl(12 78% 66%)`,brightGreen:`hsl(152 80% 58%)`,brightYellow:`hsl(42 90% 70%)`,brightBlue:`hsl(248 70% 76%)`,brightMagenta:`hsl(280 38% 70%)`,brightCyan:`hsl(191 97% 65%)`,brightWhite:`hsl(240 20% 100%)`},chart:[RH.primary,RH.info,RH.success,RH.secondary,RH.warning],status:{completed:RH.primary,failed:RH.destructive,canceled:RH.warning,running:RH.info,queued:RH.muted}}},BH=`specrails-desktop:ui-theme`;function VH(){if(typeof document>`u`)return kH;let e=document.documentElement.dataset.theme;return OH(e)?e:kH}function HH(){return zH[VH()]}function UH(e={}){let t={...e},n=pl();return n&&(t[`X-Desktop-Token`]=n),t}var WH=(0,I.createContext)(null);function GH(){if(typeof document>`u`)return kH;let e=document.documentElement.dataset.theme;if(OH(e))return e;if(typeof localStorage<`u`)try{let e=localStorage.getItem(BH);if(OH(e))return e}catch{}return kH}function KH(e){typeof document>`u`||(document.documentElement.dataset.theme=e)}function qH(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(BH,e)}catch{}}function JH({children:e,endpoint:t=`/api/theme`}){let[n,r]=(0,I.useState)(()=>GH()),[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(o.current)return;o.current=!0;let e=!1;return(async()=>{try{let i=await fetch(t,{headers:UH()});if(!i.ok)return;let a=await i.json();if(e)return;OH(a.theme)&&a.theme!==n&&(KH(a.theme),qH(a.theme),r(a.theme))}catch{}})(),()=>{e=!0}},[t]);let s=(0,I.useCallback)(async e=>{if(e===n)return;let i=n;KH(e),qH(e),r(e),a(!0);try{let n=await fetch(t,{method:`PATCH`,headers:UH({"Content-Type":`application/json`}),body:JSON.stringify({theme:e})});if(!n.ok)throw Error(`server rejected theme: ${n.status}`)}catch(e){throw KH(i),qH(i),r(i),e}finally{a(!1)}},[n,t]),c=(0,I.useMemo)(()=>({theme:zH[n],themeId:n,setTheme:s,isUpdating:i}),[n,s,i]);return(0,q.jsx)(WH.Provider,{value:c,children:e})}function YH(){let e=(0,I.useContext)(WH);if(!e)throw Error(`useTheme must be used within a ThemeProvider`);return e}function XH(){return(0,I.useContext)(WH)}function ZH(){let e=(0,I.useContext)(WH);return e?e.theme:HH()}function QH(){let{t:e}=G(`settings`),t=XH();if(!t)return null;let{themeId:n,setTheme:r,isUpdating:i}=t;async function a(t){if(t!==n)try{await r(t)}catch(t){K.error(e(`appearance.updateFailed`),{description:t instanceof Error?t.message:void 0})}}return(0,q.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-2`,role:`radiogroup`,"aria-label":e(`appearance.themeGroupLabel`),children:DH.map(t=>{let r=zH[t],o=t===n;return(0,q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":o,disabled:i,onClick:()=>void a(t),className:`group relative overflow-hidden rounded-lg border text-left transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/60 disabled:opacity-60 disabled:cursor-not-allowed `+(o?`border-accent-primary ring-1 ring-accent-primary shadow-[0_0_0_1px_var(--color-accent-primary)] `:`border-border hover:border-accent-primary/40 hover:shadow-md `),"data-testid":`theme-card-${t}`,"data-selected":o?`true`:`false`,children:[(0,q.jsx)(`div`,{className:`h-20 w-full flex items-end gap-1 p-2`,style:{background:`linear-gradient(135deg, ${r.previewSwatches.background} 0%, ${r.previewSwatches.background} 60%, color-mix(in srgb, ${r.previewSwatches.accents[0]} 18%, ${r.previewSwatches.background}) 100%)`},"aria-hidden":`true`,children:r.previewSwatches.accents.map((e,t)=>(0,q.jsx)(`span`,{className:`h-3 w-3 rounded-full ring-1 ring-black/10`,style:{background:e}},t))}),(0,q.jsxs)(`div`,{className:`p-3 space-y-1 bg-card`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-semibold`,children:r.displayName}),o&&(0,q.jsx)(nf,{className:`w-3.5 h-3.5 text-accent-primary shrink-0`,"aria-label":e(`appearance.currentlyActive`)})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground leading-tight`,children:e(`appearance.taglines.${t}`,{defaultValue:r.tagline})})]})]},t)})})}function $H(){let{t:e}=G(`settings`);return XH()?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e(`appearance.heading`)}),(0,q.jsx)(QH,{})]}):null}function eU(e={}){let t={...e},n=pl();return n&&(t[`X-Desktop-Token`]=n),t}var tU=(0,I.createContext)(null);function nU(e){if(!(typeof localStorage>`u`))try{localStorage.setItem($u,e)}catch{}}function rU(){if(!(typeof localStorage>`u`))try{localStorage.removeItem($u)}catch{}}function iU({children:e,endpoint:t=`/api/language`}){let[n,r]=(0,I.useState)(()=>fd()),[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(o.current)return;o.current=!0;let e=!1;return(async()=>{try{let n=await fetch(t,{headers:eU()});if(!n.ok)return;let i=await n.json();if(e)return;ed(i.language)&&i.language!==fd()&&(await ud(i.language),nU(i.language),e||r(i.language))}catch{}})(),()=>{e=!0}},[t]);let s=(0,I.useCallback)(async e=>{if(e===n)return;let i=n,o=typeof localStorage<`u`&&ed(localStorage.getItem(`specrails-desktop:ui-language`));await ud(e),nU(e),r(e),a(!0);try{let n=await fetch(t,{method:`PATCH`,headers:eU({"Content-Type":`application/json`}),body:JSON.stringify({language:e})});if(!n.ok)throw Error(`server rejected language: ${n.status}`)}catch(e){throw await ud(i),o?nU(i):rU(),r(i),e}finally{a(!1)}},[n,t]),c=(0,I.useMemo)(()=>({languageId:n,language:Qu[n],setLanguage:s,isUpdating:i}),[n,s,i]);return(0,q.jsx)(tU.Provider,{value:c,children:e})}function aU(){return(0,I.useContext)(tU)}function oU(){let{t:e}=G(`settings`),t=aU();if(!t)return null;let{languageId:n,setLanguage:r,isUpdating:i}=t;async function a(t){if(t!==n)try{await r(t)}catch(t){K.error(e(`language.updateFailed`),{description:t instanceof Error?t.message:void 0})}}return(0,q.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,role:`radiogroup`,"aria-label":e(`language.selectLabel`),children:Zu.map(e=>{let t=Qu[e],r=e===n;return(0,q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,disabled:i,onClick:()=>void a(e),className:`flex items-center justify-between gap-2 rounded-lg border bg-card px-3 py-2 text-left transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/60 disabled:opacity-60 disabled:cursor-not-allowed `+(r?`border-accent-primary ring-1 ring-accent-primary `:`border-border hover:border-accent-primary/40 hover:shadow-md `),"data-testid":`language-card-${e}`,"data-selected":r?`true`:`false`,children:[(0,q.jsxs)(`span`,{className:`min-w-0`,children:[(0,q.jsx)(`span`,{className:`block text-xs font-semibold truncate`,children:t.nativeName}),(0,q.jsx)(`span`,{className:`block text-[10px] text-muted-foreground truncate`,children:t.englishName})]}),r&&(0,q.jsx)(nf,{className:`w-3.5 h-3.5 text-accent-primary shrink-0`,"aria-hidden":`true`})]},e)})})}function sU(){let{t:e}=G(`settings`);return aU()?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e(`language.title`)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`language.description`)}),(0,q.jsx)(oU,{})]}):null}function cU(){if(!tb)return null;let{t:e}=G(`settings`),[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let e=!1;return fetch(`/api/code-explorer-settings`).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(t=>{e||n(t)}).catch(()=>{e||n({language:`en`,monthlyBudgetUsd:5})}),()=>{e=!0}},[]);async function a(r){if(t){n({...t,...r}),i(!0);try{let e=await fetch(`/api/code-explorer-settings`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!e.ok)throw Error(`HTTP ${e.status}`);n(await e.json())}catch(r){K.error(e(`errors.saveFailed`,{message:r.message})),n(t)}finally{i(!1)}}}return t?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e(`codeSection.heading`)}),(0,q.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-3`,children:[(0,q.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e(`codeSection.summaryLanguage`)}),(0,q.jsxs)(`select`,{value:t.language,disabled:r,onChange:e=>a({language:e.target.value}),className:`bg-background border border-border rounded px-2 py-1 text-xs`,children:[(0,q.jsx)(`option`,{value:`en`,children:`English`}),(0,q.jsx)(`option`,{value:`es`,children:`Español`})]})]}),(0,q.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e(`codeSection.monthlyBudget`)}),(0,q.jsx)(`input`,{type:`number`,min:0,step:.5,value:t.monthlyBudgetUsd,disabled:r,onChange:e=>{let t=parseFloat(e.target.value);!isNaN(t)&&t>=0&&a({monthlyBudgetUsd:t})},className:`bg-background border border-border rounded px-2 py-1 text-xs w-24 text-right`})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground/70`,children:e(`codeSection.budgetHelper`)})]})]}):(0,q.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`})}var lU=Object.defineProperty,uU=Object.getOwnPropertySymbols,dU=Object.prototype.hasOwnProperty,fU=Object.prototype.propertyIsEnumerable,pU=(e,t,n)=>t in e?lU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mU=(e,t)=>{for(var n in t||={})dU.call(t,n)&&pU(e,n,t[n]);if(uU)for(var n of uU(t))fU.call(t,n)&&pU(e,n,t[n]);return e},hU=(e,t)=>{var n={};for(var r in e)dU.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&uU)for(var r of uU(e))t.indexOf(r)<0&&fU.call(e,r)&&(n[r]=e[r]);return n},gU;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(gU||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(gU||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(gU||={});var _U=gU,vU={L:_U.QrCode.Ecc.LOW,M:_U.QrCode.Ecc.MEDIUM,Q:_U.QrCode.Ecc.QUARTILE,H:_U.QrCode.Ecc.HIGH},yU=128,bU=`L`,xU=`#FFFFFF`,SU=`#000000`,CU=!1,wU=1,TU=4,EU=0,DU=.1;function OU(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function kU(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function AU(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*DU),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function jU(e,t){return t==null?e?TU:EU:Math.max(Math.floor(t),0)}function MU({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=I.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(..._U.QrSegment.makeSegments(t)),e),[]);return _U.QrCode.encodeSegments(r,vU[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=I.useMemo(()=>{let e=c.getModules(),t=jU(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:AU(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var NU=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),PU=I.forwardRef(function(e,t){let n=e,{value:r,size:i=yU,level:a=bU,bgColor:o=xU,fgColor:s=SU,includeMargin:c=CU,minVersion:l=wU,boostLevel:u,marginSize:d,imageSettings:f}=n,p=hU(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=hU(p,[`style`]),g=f?.src,_=I.useRef(null),v=I.useRef(null),y=I.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=I.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=MU({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});I.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=kU(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,NU?t.fill(new Path2D(OU(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),I.useEffect(()=>{x(!1)},[g]);let E=mU({height:i,width:i},m),D=null;return g!=null&&(D=I.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),I.createElement(I.Fragment,null,I.createElement(`canvas`,mU({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});PU.displayName=`QRCodeCanvas`;var FU=I.forwardRef(function(e,t){let n=e,{value:r,size:i=yU,level:a=bU,bgColor:o=xU,fgColor:s=SU,includeMargin:c=CU,minVersion:l=wU,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=hU(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=MU({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=kU(g,v.excavation)),b=I.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=OU(y,h);return I.createElement(`svg`,mU({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&I.createElement(`title`,null,d),I.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),I.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});FU.displayName=`QRCodeSVG`;function IU(e){return btoa(unescape(encodeURIComponent(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function LU({open:e,onClose:t,onPaired:n}){let{t:r}=G(`settings`),[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)({status:`none`}),[c,l]=(0,I.useState)(null),u=(0,I.useRef)(null),d=(0,I.useCallback)(()=>{u.current&&=(clearInterval(u.current),null)},[]),f=(0,I.useCallback)(()=>{d(),fetch(`/api/mobile/pairing-session`,{method:`DELETE`}).catch(()=>{}),a(null),s({status:`none`}),l(null),t()},[t,d]);(0,I.useEffect)(()=>{if(!e)return;let t=!1;return l(null),fetch(`/api/mobile/pairing-session`,{method:`POST`}).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>{t||(a(e.qr),s({status:`pending`}),u.current=setInterval(async()=>{try{let e=await fetch(`/api/mobile/pairing-session`);if(!e.ok)return;let t=await e.json();s(t),(t.status===`expired`||t.status===`denied`)&&d()}catch{}},2e3))}).catch(e=>{t||l(e.message)}),()=>{t=!0,d()}},[e,d]);async function p(){try{let e=await fetch(`/api/mobile/pairing-session/approve`,{method:`POST`});if(!e.ok)throw Error(`HTTP ${e.status}`);s({status:`approved`}),d(),K.success(r(`pairDevice.pairedToast`)),n(),setTimeout(f,1200)}catch(e){K.error(r(`pairDevice.approveFailed`,{message:e.message}))}}async function m(){await fetch(`/api/mobile/pairing-session/deny`,{method:`POST`}).catch(()=>{}),f()}let h=i?`specrails://pair?d=${IU(JSON.stringify(i))}`:``;return(0,q.jsx)(Gy,{open:e,onOpenChange:e=>{e||f()},children:(0,q.jsxs)(Jy,{className:`max-w-md`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:r(`pairDevice.title`)}),(0,q.jsx)(Qy,{children:r(`pairDevice.description`)})]}),c&&(0,q.jsx)(`p`,{className:`text-sm text-destructive`,children:r(`pairDevice.startFailed`,{error:c})}),o.status===`claimed`&&o.device?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-center`,children:(0,q.jsx)(Bi,{ns:`settings`,i18nKey:`pairDevice.wantsToPair`,values:{name:o.device.name,platform:o.device.platform},components:{b:(0,q.jsx)(`span`,{className:`font-semibold`})}})}),(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,q.jsx)(Z,{variant:`outline`,onClick:m,children:r(`pairDevice.deny`)}),(0,q.jsx)(Z,{onClick:p,children:r(`pairDevice.approve`)})]})]}):o.status===`approved`?(0,q.jsx)(`p`,{className:`py-6 text-center text-accent-success font-medium`,children:r(`pairDevice.paired`)}):i?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-2`,children:[(0,q.jsx)(`div`,{className:`bg-white p-3 rounded-lg`,children:(0,q.jsx)(FU,{value:h,size:220})}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground text-center`,children:r(`pairDevice.waiting`,{host:i.addrs[0]??r(`pairDevice.thisDesktop`),port:i.port})}),(0,q.jsx)(`button`,{type:`button`,className:`text-xs text-accent-info underline`,onClick:()=>{navigator.clipboard?.writeText(h),K.success(r(`pairDevice.codeCopied`))},children:r(`pairDevice.copyCode`)})]}):(0,q.jsx)(`div`,{className:`h-56 bg-muted/30 rounded-lg animate-pulse`})]})})}var RU=typeof navigator<`u`&&/Win/i.test(navigator.platform);function zU(e){return!e||e.length<16?e??`—`:`${e.slice(0,8)}…${e.slice(-8)}`}function BU(){let{t:e}=G(`settings`),[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)([]),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),l=(0,I.useCallback)(async()=>{try{let e=await fetch(`/api/mobile/status`);e.ok&&n(await e.json())}catch{}},[]),u=(0,I.useCallback)(async()=>{try{let e=await fetch(`/api/mobile/devices`);e.ok&&i((await e.json()).devices)}catch{}},[]);(0,I.useEffect)(()=>{l(),u()},[l,u]);async function d(){if(t){o(!0);try{let e=t.enabled?`disable`:`enable`,r=await fetch(`/api/mobile/${e}`,{method:`POST`});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`HTTP ${r.status}`)}n(await r.json())}catch(n){K.error(t.enabled?e(`mobile.disableFailed`,{message:n.message}):e(`mobile.enableFailed`,{message:n.message}))}finally{o(!1)}}}async function f(e){await fetch(`/api/mobile/devices/${e}`,{method:`DELETE`}).catch(()=>{}),u()}async function p(){if(window.confirm(e(`mobile.resetConfirm`))){o(!0);try{let t=await fetch(`/api/mobile/cert/rotate`,{method:`POST`});t.ok&&n(await t.json()),u(),K.success(e(`mobile.identityReset`))}finally{o(!1)}}}return t?(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2`,children:[(0,q.jsx)(jp,{className:`h-3.5 w-3.5`}),` `,e(`mobile.heading`)]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`mobile.description`)}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border p-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-sm font-medium`,children:t.enabled?e(`mobile.accessOn`):e(`mobile.accessOff`)}),(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.running?e(`mobile.listeningOnPort`,{port:t.port}):e(`mobile.notListening`)})]}),(0,q.jsx)(Z,{variant:t.enabled?`outline`:`default`,disabled:a,onClick:d,children:t.enabled?e(`mobile.turnOff`):e(`mobile.turnOn`)})]}),t.enabled&&t.running&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(Z,{onClick:()=>c(!0),className:`gap-2`,children:[(0,q.jsx)(jp,{className:`h-4 w-4`}),` `,e(`mobile.pairDevice`)]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,q.jsx)(Ap,{className:`h-3.5 w-3.5 text-accent-success`}),(0,q.jsx)(`span`,{title:t.certFingerprint??``,children:zU(t.certFingerprint)}),(0,q.jsx)(`button`,{type:`button`,className:`underline`,onClick:p,disabled:a,children:e(`mobile.reset`)})]})]}),RU&&(0,q.jsx)(`p`,{className:`text-xs text-accent-warning`,children:e(`mobile.windowsFirewall`)}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground`,children:e(`mobile.pairedDevices`)}),r.filter(e=>!e.revoked).length===0?(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e(`mobile.noDevices`)}):r.filter(e=>!e.revoked).map(t=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-muted/30 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`text-sm`,children:[t.name,` `,(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,t.platform]})]}),(0,q.jsx)(`button`,{type:`button`,"aria-label":e(`mobile.revokeDevice`,{name:t.name}),className:`text-muted-foreground hover:text-destructive`,onClick:()=>f(t.id),children:(0,q.jsx)(Vp,{className:`h-4 w-4`})})]},t.id))]})]}),(0,q.jsx)(LU,{open:s,onClose:()=>c(!1),onPaired:u})]}):(0,q.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`})}var VU=`specrails-os-notifications`,HU={enabled:!0,filter:`all`};function UU(){try{let e=localStorage.getItem(VU);if(!e)return HU;let t=JSON.parse(e);return{enabled:typeof t.enabled==`boolean`?t.enabled:HU.enabled,filter:t.filter===`completed`||t.filter===`failed`?t.filter:HU.filter}}catch{return HU}}function WU(e){localStorage.setItem(VU,JSON.stringify(e))}function GU({setActiveProjectId:e,projectsById:t}={}){let n=ct(),r=(0,I.useRef)(n);(0,I.useEffect)(()=>{r.current=n},[n]);let i=(0,I.useRef)(e);(0,I.useEffect)(()=>{i.current=e},[e]);let a=(0,I.useRef)(t);(0,I.useEffect)(()=>{a.current=t},[t]);let o=(0,I.useRef)(new Map),s=(0,I.useRef)(new Map),{registerHandler:c,unregisterHandler:l}=xl(),u=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`queue`||!Array.isArray(t.jobs))return;let n=t.projectId??null;for(let e of t.jobs){let t=o.current.get(e.id),r=e.status;n&&s.current.set(e.id,n),t===`running`&&(r===`completed`||r===`failed`)&&d(e,n),o.current.set(e.id,r)}},[]);function d(e,t){if(typeof Notification>`u`||typeof document<`u`&&!document.hidden)return;let n=UU();if(!n.enabled||n.filter===`completed`&&e.status!==`completed`||n.filter===`failed`&&e.status!==`failed`)return;function o(){let n=e.status===`completed`?J.t(`commands:notifications.jobCompleted`):J.t(`commands:notifications.jobFailed`),o=t?a.current?.get(t)??``:``,s=e.command?e.command.slice(0,80):J.t(`commands:notifications.unknownCommand`),c=o?`[${o}] ${s}`:s,l=new Notification(n,{body:c,tag:`specrails-job:${e.id}:${e.status}`}),u=e.id,d=t;l.onclick=()=>{window.focus(),d&&i.current?(i.current(d),setTimeout(()=>{r.current(`/jobs/${u}`)},100)):r.current(`/jobs/${u}`),l.close()}}Notification.permission===`granted`?o():Notification.permission===`default`&&Notification.requestPermission().then(e=>{e===`granted`&&o()})}(0,I.useLayoutEffect)(()=>(c(`os-notifications`,u),()=>l(`os-notifications`)),[u,c,l])}var KU=[{value:`job.completed`,labelKey:`webhooks.eventJobCompleted`},{value:`job.failed`,labelKey:`webhooks.eventJobFailed`},{value:`daily_budget_exceeded`,labelKey:`webhooks.eventDailyBudgetExceeded`}];function qU({project:e,onRemove:t}){let{t:n}=G(`settings`);return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 p-2.5 rounded-md border border-border`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground truncate`,children:e.path})]}),(0,q.jsx)(Z,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-[10px] text-muted-foreground hover:text-destructive shrink-0`,onClick:()=>t(e.id),children:n(`common:actions.remove`)})]})}function JU({open:e,onClose:t,onOpenOnboarding:n}){let{t:r}=G(`settings`),{projects:i,removeProject:a}=Sd(),[o,s]=(0,I.useState)(null),[c,l]=(0,I.useState)(!0),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(``),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(``),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)([]),[w,T]=(0,I.useState)(``),[E,D]=(0,I.useState)(``),[O,k]=(0,I.useState)([`job.completed`,`job.failed`]),[A,j]=(0,I.useState)(!1),[M,N]=(0,I.useState)(()=>UU().enabled),[P,F]=(0,I.useState)(()=>UU().filter);function L(e){N(e),WU({enabled:e,filter:P}),K.success(r(e?`notifications.enabledToast`:`notifications.disabledToast`))}function ee(e){F(e),WU({enabled:M,filter:e})}let te=(0,I.useCallback)(async()=>{try{let e=await fetch(`/api/webhooks`);e.ok&&C((await e.json()).webhooks)}catch{}},[]);(0,I.useEffect)(()=>{if(!e)return;l(!0);async function t(){try{let e=await fetch(`/api/settings`);if(e.ok){let t=await e.json();s(t),d(t.specrailsTechUrl??`http://localhost:3000`),h(t.costAlertThresholdUsd==null?``:String(t.costAlertThresholdUsd))}}catch{}finally{l(!1)}}t(),te()},[e,te]),(0,I.useEffect)(()=>{e&&fetch(`/api/budget`).then(e=>e.json()).then(e=>{e.desktopDailyBudgetUsd==null?y(``):y(String(e.desktopDailyBudgetUsd))}).catch(()=>{})},[e]);async function R(){if(u.trim()){p(!0);try{(await fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({specrailsTechUrl:u.trim()})})).ok?K.success(r(`desktop.techUrlSaved`)):K.error(r(`desktop.techUrlSaveFailed`))}catch{K.error(r(`desktop.techUrlSaveFailed`))}finally{p(!1)}}}async function z(){_(!0);try{let e=m.trim()===``?null:parseFloat(m);if(e!==null&&(isNaN(e)||e<=0)){K.error(r(`budget.invalidNumber`));return}(await fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({costAlertThresholdUsd:e})})).ok?K.success(e==null?r(`desktop.costAlertsDisabled`):r(`budget.alertSet`,{amount:e})):K.error(r(`budget.saveThresholdFailed`))}catch{K.error(r(`budget.saveThresholdFailed`))}finally{_(!1)}}async function B(){x(!0);try{let e=v.trim()===``?null:parseFloat(v);if(e!==null&&(isNaN(e)||e<=0)){K.error(r(`budget.invalidNumber`));return}(await fetch(`/api/budget`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({desktopDailyBudgetUsd:e})})).ok?K.success(e==null?r(`desktop.dailyBudgetRemoved`):r(`desktop.dailyBudgetSet`,{amount:e})):K.error(r(`desktop.dailyBudgetSaveFailed`))}catch{K.error(r(`desktop.dailyBudgetSaveFailed`))}finally{x(!1)}}async function V(e){try{await a(e),K.success(r(`desktop.projectRemoved`))}catch(e){K.error(r(`desktop.projectRemoveFailed`),{description:e.message})}}async function ne(){if(!w.trim()){K.error(r(`webhooks.urlRequired`));return}if(O.length===0){K.error(r(`webhooks.selectEvent`));return}j(!0);try{let e=await fetch(`/api/webhooks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:w.trim(),secret:E.trim(),events:O})});if(e.ok)K.success(r(`webhooks.added`)),T(``),D(``),k([`job.completed`,`job.failed`]),await te();else{let t=await e.json();K.error(t.error??r(`webhooks.addFailed`))}}catch{K.error(r(`webhooks.addFailed`))}finally{j(!1)}}async function H(e,t){try{await fetch(`/api/webhooks/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:t})}),await te()}catch{K.error(r(`webhooks.updateFailed`))}}async function U(e){try{(await fetch(`/api/webhooks/${e}`,{method:`DELETE`})).ok&&(K.success(r(`webhooks.removed`)),await te())}catch{K.error(r(`webhooks.removeFailed`))}}async function re(e){try{(await fetch(`/api/webhooks/${e}/test`,{method:`POST`})).ok&&K.success(r(`webhooks.testPingSent`))}catch{K.error(r(`webhooks.testPingFailed`))}}function ie(e){k(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}return(0,q.jsx)(Gy,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(Jy,{className:`max-w-2xl max-h-[85vh] overflow-x-hidden`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsxs)(Zy,{className:`flex items-center gap-2`,children:[(0,q.jsx)(kp,{className:`w-4 h-4`}),r(`desktop.title`)]}),(0,q.jsx)(Qy,{children:r(`desktop.description`)})]}),c?(0,q.jsxs)(`div`,{className:`space-y-3 py-2`,children:[(0,q.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`}),(0,q.jsx)(`div`,{className:`h-16 bg-muted/30 rounded-lg animate-pulse`})]}):(0,q.jsxs)(`div`,{className:`space-y-5 py-2`,children:[(0,q.jsx)($H,{}),(0,q.jsx)(sU,{}),(0,q.jsx)(cU,{}),(0,q.jsx)(BU,{}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:r(`desktop.registeredProjects`)}),i.length===0?(0,q.jsx)(`div`,{className:`rounded-md border border-dashed border-border p-4 text-center`,children:(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`desktop.noProjects`)})}):(0,q.jsx)(`div`,{className:`space-y-1.5`,children:i.map(e=>(0,q.jsx)(qU,{project:e,onRemove:V},e.id))})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`specrails-tech`}),(0,q.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-2`,children:[(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:r(`desktop.techUrlDescription`)}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(_H,{value:u,onChange:e=>d(e.target.value),placeholder:`http://localhost:3000`,className:`h-7 text-xs font-mono`}),(0,q.jsx)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs shrink-0`,disabled:f,onClick:R,children:r(`common:actions.save`)})]})]})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:r(`desktop.budgetAlertsHeading`)}),(0,q.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:r(`desktop.dailyBudgetLabel`)}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:r(`desktop.dailyBudgetHelper`)}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(_H,{type:`number`,min:`0`,step:`0.01`,value:v,onChange:e=>y(e.target.value),placeholder:r(`desktop.dailyBudgetPlaceholder`),className:`h-7 text-xs font-mono`}),(0,q.jsx)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs shrink-0`,disabled:b,onClick:()=>void B(),children:r(`common:actions.save`)})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:r(`budget.perJobLabel`)}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:r(`desktop.perJobHelper`)}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(_H,{type:`number`,min:`0`,step:`0.01`,value:m,onChange:e=>h(e.target.value),placeholder:r(`budget.perJobPlaceholder`),className:`h-7 text-xs font-mono`}),(0,q.jsx)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs shrink-0`,disabled:g,onClick:z,children:r(`common:actions.save`)})]})]})]})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:r(`notifications.heading`)}),(0,q.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-3`,children:[(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:r(`notifications.description`)}),(0,q.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:M,onChange:e=>L(e.target.checked),className:`w-3.5 h-3.5`,"data-testid":`notif-toggle`}),(0,q.jsx)(Jd,{className:`w-3.5 h-3.5 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-xs`,children:r(`notifications.enableLabel`)})]}),M&&(0,q.jsxs)(`div`,{className:`space-y-1.5 pl-6`,children:[(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:r(`notifications.notifyOn`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:[{value:`all`,label:r(`notifications.filterAll`)},{value:`completed`,label:r(`notifications.filterCompleted`)},{value:`failed`,label:r(`notifications.filterFailed`)}].map(({value:e,label:t})=>(0,q.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[10px] cursor-pointer`,children:[(0,q.jsx)(`input`,{type:`radio`,name:`notif-filter`,checked:P===e,onChange:()=>ee(e),className:`w-3 h-3`}),t]},e))})]})]})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:r(`webhooks.heading`)}),(0,q.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-3`,children:[(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:(0,q.jsx)(Bi,{ns:`settings`,i18nKey:`webhooks.description`,components:{code:(0,q.jsx)(`code`,{className:`font-mono`})}})}),S.length>0&&(0,q.jsx)(`div`,{className:`space-y-1.5`,children:S.map(e=>{let t=(()=>{try{return JSON.parse(e.events)}catch{return[]}})();return(0,q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border p-2`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-mono truncate`,children:e.url}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:t.join(`, `)})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,q.jsx)(`button`,{onClick:()=>void H(e.id,!e.enabled),className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${e.enabled?`bg-green-500/10 aurora-light:bg-accent-success/10 text-green-600 aurora-light:text-accent-success dark:text-green-400`:`bg-muted text-muted-foreground`}`,title:e.enabled?r(`webhooks.disable`):r(`webhooks.enable`),children:e.enabled?r(`webhooks.statusOn`):r(`webhooks.statusOff`)}),(0,q.jsx)(`button`,{onClick:()=>void re(e.id),className:`text-muted-foreground hover:text-foreground p-0.5`,title:r(`webhooks.sendTestPing`),children:(0,q.jsx)(Jp,{className:`w-3 h-3`})}),(0,q.jsx)(`button`,{onClick:()=>void U(e.id),className:`text-muted-foreground hover:text-destructive p-0.5`,title:r(`common:actions.remove`),children:(0,q.jsx)(Vp,{className:`w-3 h-3`})})]})]},e.id)})}),(0,q.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-2`,children:[(0,q.jsx)(`p`,{className:`text-[10px] font-medium text-muted-foreground`,children:r(`webhooks.addHeading`)}),(0,q.jsx)(_H,{value:w,onChange:e=>T(e.target.value),placeholder:`https://hooks.example.com/...`,className:`h-7 text-xs font-mono`}),(0,q.jsx)(_H,{value:E,onChange:e=>D(e.target.value),placeholder:r(`webhooks.secretPlaceholder`),className:`h-7 text-xs font-mono`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:KU.map(({value:e,labelKey:t})=>(0,q.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[10px] cursor-pointer`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:O.includes(e),onChange:()=>ie(e),className:`w-3 h-3`}),r(t)]},e))}),(0,q.jsxs)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs w-full`,disabled:A||!w.trim(),onClick:()=>void ne(),children:[(0,q.jsx)(pp,{className:`w-3 h-3 mr-1`}),r(`webhooks.addButton`)]})]})]})]}),n&&(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:r(`desktop.onboardingHeading`)}),(0,q.jsx)(`div`,{className:`rounded-md border border-border p-3`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:r(`desktop.platformTour`)}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:r(`desktop.platformTourDescription`)})]}),(0,q.jsxs)(Z,{size:`sm`,variant:`secondary`,className:`h-7 text-xs shrink-0`,onClick:n,"data-testid":`replay-onboarding`,children:[(0,q.jsx)(zf,{className:`w-3 h-3 mr-1`}),r(`desktop.replayTour`)]})]})})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:r(`desktop.terminalPanelHeading`)}),(0,q.jsx)(CH,{mode:`desktop`})]}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:r(`desktop.infoHeading`)}),(0,q.jsxs)(`div`,{className:`rounded-md border border-border p-3 space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:r(`desktop.infoPort`)}),(0,q.jsx)(`span`,{className:`font-mono`,children:o?.port??4200})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:r(`desktop.infoProjects`)}),(0,q.jsx)(`span`,{className:`font-mono`,children:i.length})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:r(`desktop.infoDb`)}),(0,q.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:`~/.specrails/desktop.sqlite`})]})]})]})]})]})})}var YU=[{keys:`?`,descriptionKey:`shortcuts.items.showCheatsheet`,category:`general`},{keys:`Esc`,descriptionKey:`shortcuts.items.closeModal`,category:`general`},{keys:`⌘B`,descriptionKey:`shortcuts.items.toggleRightSidebar`,category:`general`},{keys:`⌥⌘B`,descriptionKey:`shortcuts.items.toggleLeftSidebar`,category:`general`},{keys:`⌘J`,descriptionKey:`shortcuts.items.toggleTerminal`,category:`general`},{keys:eb?`⌘1–5`:`⌘1–4`,descriptionKey:eb?`shortcuts.items.navigateProjectPageWithAgents`:`shortcuts.items.navigateProjectPage`,category:`general`},{keys:`⌥⌘1–9`,descriptionKey:`shortcuts.items.switchProject`,category:`general`},{keys:`G D`,descriptionKey:`shortcuts.items.goDashboard`,category:`navigation`},{keys:`G J`,descriptionKey:`shortcuts.items.goActivity`,category:`navigation`},{keys:`G A`,descriptionKey:`shortcuts.items.goAnalytics`,category:`navigation`},{keys:`G S`,descriptionKey:`shortcuts.items.goSettings`,category:`navigation`},{keys:`J`,descriptionKey:`shortcuts.items.nextItem`,category:`actions`},{keys:`K`,descriptionKey:`shortcuts.items.prevItem`,category:`actions`}];function XU(e){let t=e.target;if(!t)return!1;let n=t.tagName;return!!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable)}function ZU(e){let t=e.target;return!t||typeof t.closest!=`function`?!1:!!t.closest(`[role="dialog"]`)}function QU(e){let t=e.target;return!t||typeof t.closest!=`function`?!1:!!t.closest(`.specrails-xterm-container, .xterm`)}function $U({onOpenCheatsheet:e,onListNavigate:t,onToggleLeftSidebar:n,onToggleRightSidebar:r,onSwitchProject:i,onSwitchProjectPage:a,onToggleTerminalPanel:o}){let s=ct(),c=at(),l=(0,I.useRef)(null),u=(0,I.useRef)(null),d=(0,I.useRef)(e);d.current=e;let f=(0,I.useRef)(t);f.current=t;let p=(0,I.useRef)(n);p.current=n;let m=(0,I.useRef)(r);m.current=r;let h=(0,I.useRef)(i);h.current=i;let g=(0,I.useRef)(a);g.current=a;let _=(0,I.useRef)(o);_.current=o;let v=(0,I.useRef)(c);v.current=c,(0,I.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.code===`KeyJ`){if(ZU(e))return;e.preventDefault(),_.current?.();return}if(XU(e)||QU(e)||ZU(e))return;if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.code===`KeyB`){e.preventDefault(),m.current?.();return}if((e.metaKey||e.ctrlKey)&&e.altKey&&e.code===`KeyB`){e.preventDefault(),p.current?.();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey){let t=e.code.match(/^Digit([1-9])$/);if(t){e.preventDefault(),g.current?.(parseInt(t[1],10));return}}if((e.metaKey||e.ctrlKey)&&e.altKey&&!e.shiftKey){let t=e.code.match(/^Digit([1-9])$/);if(t){e.preventDefault(),h.current?.(parseInt(t[1],10));return}}if(e.metaKey||e.ctrlKey||e.altKey)return;let t=e.key;if(l.current===`g`){u.current&&clearTimeout(u.current),l.current=null;let n=t.toUpperCase(),r={D:`/`,P:`/`,J:`/activity`,A:`/analytics`,S:`/settings`};if(r[n]){e.preventDefault(),s(r[n]);return}return}if(t===`?`){e.preventDefault(),d.current();return}if(t===`g`){e.preventDefault(),l.current=`g`,u.current=setTimeout(()=>{l.current=null},800);return}if(t===`j`){f.current?.(`down`);return}if(t===`k`){f.current?.(`up`);return}}return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e),u.current&&clearTimeout(u.current)}},[s])}function eW(){let[e,t]=(0,I.useState)(!1);return{cheatsheetOpen:e,setCheatsheetOpen:t,openCheatsheet:(0,I.useCallback)(()=>t(!0),[]),closeCheatsheet:(0,I.useCallback)(()=>t(!1),[])}}var tW={general:`shortcuts.categories.general`,navigation:`shortcuts.categories.navigation`,actions:`shortcuts.categories.actions`},nW=[`general`,`navigation`,`actions`];function rW({children:e}){return(0,q.jsx)(`kbd`,{className:`inline-flex items-center justify-center min-w-[1.5rem] h-6 px-1.5 rounded border border-border/50 bg-card/80 font-mono text-xs text-foreground`,children:e})}function iW({shortcut:e}){let{t}=G(`commands`),n=e.keys.split(` `);return(0,q.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t(e.descriptionKey)}),(0,q.jsx)(`div`,{className:`flex items-center gap-1 ml-4 shrink-0`,children:n.map((e,t)=>(0,q.jsx)(rW,{children:e},t))})]})}function aW({open:e,onOpenChange:t}){let{t:n}=G(`commands`),r=nW.map(e=>({category:e,label:n(tW[e]),shortcuts:YU.filter(t=>t.category===e)})).filter(e=>e.shortcuts.length>0);return(0,q.jsx)(Gy,{open:e,onOpenChange:t,children:(0,q.jsxs)(Jy,{className:`max-w-md`,"data-testid":`shortcuts-cheatsheet`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:n(`shortcuts.title`)}),(0,q.jsx)(Qy,{children:(0,q.jsxs)(Bi,{i18nKey:`shortcuts.subtitle`,ns:`commands`,children:[`Press `,(0,q.jsx)(rW,{children:`?`}),` anywhere to toggle this panel`]})})]}),(0,q.jsx)(`div`,{className:`space-y-4 mt-2`,children:r.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-accent-primary mb-2`,children:e.label}),(0,q.jsx)(`div`,{className:`divide-y divide-border/30`,children:e.shortcuts.map(e=>(0,q.jsx)(iW,{shortcut:e},e.keys))})]},e.category))})]})})}function oW(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function sW(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var cW,lW,uW,dW,fW,pW=`__TAURI_TO_IPC_KEY__`;function mW(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}var hW=class{constructor(e){cW.set(this,void 0),lW.set(this,0),uW.set(this,[]),dW.set(this,void 0),sW(this,cW,e||(()=>{}),`f`),this.id=mW(e=>{let t=e.index;if(`end`in e){t==oW(this,lW,`f`)?this.cleanupCallback():sW(this,dW,t,`f`);return}let n=e.message;if(t==oW(this,lW,`f`)){for(oW(this,cW,`f`).call(this,n),sW(this,lW,oW(this,lW,`f`)+1,`f`);oW(this,lW,`f`)in oW(this,uW,`f`);){let e=oW(this,uW,`f`)[oW(this,lW,`f`)];oW(this,cW,`f`).call(this,e),delete oW(this,uW,`f`)[oW(this,lW,`f`)],sW(this,lW,oW(this,lW,`f`)+1,`f`)}oW(this,lW,`f`)===oW(this,dW,`f`)&&this.cleanupCallback()}else oW(this,uW,`f`)[t]=n})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){sW(this,cW,e,`f`)}get onmessage(){return oW(this,cW,`f`)}[(cW=new WeakMap,lW=new WeakMap,uW=new WeakMap,dW=new WeakMap,pW)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[pW]()}};async function $(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}var gW=class{get rid(){return oW(this,fW,`f`)}constructor(e){fW.set(this,void 0),sW(this,fW,e,`f`)}async close(){return $(`plugin:resources|close`,{rid:this.rid})}};fW=new WeakMap;var _W=class{constructor(...e){this.type=`Logical`,e.length===1?`Logical`in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new vW(this.width*e,this.height*e)}[pW](){return{width:this.width,height:this.height}}toJSON(){return this[pW]()}},vW=class{constructor(...e){this.type=`Physical`,e.length===1?`Physical`in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new _W(this.width/e,this.height/e)}[pW](){return{width:this.width,height:this.height}}toJSON(){return this[pW]()}},yW=class{constructor(e){this.size=e}toLogical(e){return this.size instanceof _W?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof vW?this.size:this.size.toPhysical(e)}[pW](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[pW]()}},bW=class{constructor(...e){this.type=`Logical`,e.length===1?`Logical`in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new xW(this.x*e,this.y*e)}[pW](){return{x:this.x,y:this.y}}toJSON(){return this[pW]()}},xW=class{constructor(...e){this.type=`Physical`,e.length===1?`Physical`in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new bW(this.x/e,this.y/e)}[pW](){return{x:this.x,y:this.y}}toJSON(){return this[pW]()}},SW=class{constructor(e){this.position=e}toLogical(e){return this.position instanceof bW?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof xW?this.position:this.position.toPhysical(e)}[pW](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[pW]()}},CW;(function(e){e.WINDOW_RESIZED=`tauri://resize`,e.WINDOW_MOVED=`tauri://move`,e.WINDOW_CLOSE_REQUESTED=`tauri://close-requested`,e.WINDOW_DESTROYED=`tauri://destroyed`,e.WINDOW_FOCUS=`tauri://focus`,e.WINDOW_BLUR=`tauri://blur`,e.WINDOW_SCALE_FACTOR_CHANGED=`tauri://scale-change`,e.WINDOW_THEME_CHANGED=`tauri://theme-changed`,e.WINDOW_CREATED=`tauri://window-created`,e.WEBVIEW_CREATED=`tauri://webview-created`,e.DRAG_ENTER=`tauri://drag-enter`,e.DRAG_OVER=`tauri://drag-over`,e.DRAG_DROP=`tauri://drag-drop`,e.DRAG_LEAVE=`tauri://drag-leave`})(CW||={});async function wW(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await $(`plugin:event|unlisten`,{event:e,eventId:t})}async function TW(e,t,n){return $(`plugin:event|listen`,{event:e,target:typeof n?.target==`string`?{kind:`AnyLabel`,label:n.target}:n?.target??{kind:`Any`},handler:mW(t)}).then(t=>async()=>wW(e,t))}async function EW(e,t,n){return TW(e,n=>{wW(e,n.id),t(n)},n)}async function DW(e,t){await $(`plugin:event|emit`,{event:e,payload:t})}async function OW(e,t,n){await $(`plugin:event|emit_to`,{target:typeof e==`string`?{kind:`AnyLabel`,label:e}:e,event:t,payload:n})}var kW=class e extends gW{constructor(e){super(e)}static async new(t,n,r){return $(`plugin:image|new`,{rgba:AW(t),width:n,height:r}).then(t=>new e(t))}static async fromBytes(t){return $(`plugin:image|from_bytes`,{bytes:AW(t)}).then(t=>new e(t))}static async fromPath(t){return $(`plugin:image|from_path`,{path:t}).then(t=>new e(t))}async rgba(){return $(`plugin:image|rgba`,{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return $(`plugin:image|size`,{rid:this.rid})}};function AW(e){return e==null?null:typeof e==`string`?e:e instanceof kW?e.rid:e}var jW;(function(e){e[e.Critical=1]=`Critical`,e[e.Informational=2]=`Informational`})(jW||={});var MW=class{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}},NW;(function(e){e.None=`none`,e.Normal=`normal`,e.Indeterminate=`indeterminate`,e.Paused=`paused`,e.Error=`error`})(NW||={});function PW(){return new LW(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function FW(){return $(`plugin:window|get_all_windows`).then(e=>e.map(e=>new LW(e,{skip:!0})))}var IW=[`tauri://created`,`tauri://error`],LW=class{constructor(e,t={}){this.label=e,this.listeners=Object.create(null),t?.skip||$(`plugin:window|create`,{options:{...t,parent:typeof t.parent==`string`?t.parent:t.parent?.label,label:e}}).then(async()=>this.emit(`tauri://created`)).catch(async e=>this.emit(`tauri://error`,e))}static async getByLabel(e){return(await FW()).find(t=>t.label===e)??null}static getCurrent(){return PW()}static async getAll(){return FW()}static async getFocusedWindow(){for(let e of await FW())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:TW(e,t,{target:{kind:`Window`,label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:EW(e,t,{target:{kind:`Window`,label:this.label}})}async emit(e,t){if(IW.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return}return DW(e,t)}async emitTo(e,t,n){if(IW.includes(t)){for(let e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return}return OW(e,t,n)}_handleTauriEvent(e,t){return IW.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}async scaleFactor(){return $(`plugin:window|scale_factor`,{label:this.label})}async innerPosition(){return $(`plugin:window|inner_position`,{label:this.label}).then(e=>new xW(e))}async outerPosition(){return $(`plugin:window|outer_position`,{label:this.label}).then(e=>new xW(e))}async innerSize(){return $(`plugin:window|inner_size`,{label:this.label}).then(e=>new vW(e))}async outerSize(){return $(`plugin:window|outer_size`,{label:this.label}).then(e=>new vW(e))}async isFullscreen(){return $(`plugin:window|is_fullscreen`,{label:this.label})}async isMinimized(){return $(`plugin:window|is_minimized`,{label:this.label})}async isMaximized(){return $(`plugin:window|is_maximized`,{label:this.label})}async isFocused(){return $(`plugin:window|is_focused`,{label:this.label})}async isDecorated(){return $(`plugin:window|is_decorated`,{label:this.label})}async isResizable(){return $(`plugin:window|is_resizable`,{label:this.label})}async isMaximizable(){return $(`plugin:window|is_maximizable`,{label:this.label})}async isMinimizable(){return $(`plugin:window|is_minimizable`,{label:this.label})}async isClosable(){return $(`plugin:window|is_closable`,{label:this.label})}async isVisible(){return $(`plugin:window|is_visible`,{label:this.label})}async title(){return $(`plugin:window|title`,{label:this.label})}async theme(){return $(`plugin:window|theme`,{label:this.label})}async isAlwaysOnTop(){return $(`plugin:window|is_always_on_top`,{label:this.label})}async center(){return $(`plugin:window|center`,{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===jW.Critical?{type:`Critical`}:{type:`Informational`}),$(`plugin:window|request_user_attention`,{label:this.label,value:t})}async setResizable(e){return $(`plugin:window|set_resizable`,{label:this.label,value:e})}async setEnabled(e){return $(`plugin:window|set_enabled`,{label:this.label,value:e})}async isEnabled(){return $(`plugin:window|is_enabled`,{label:this.label})}async setMaximizable(e){return $(`plugin:window|set_maximizable`,{label:this.label,value:e})}async setMinimizable(e){return $(`plugin:window|set_minimizable`,{label:this.label,value:e})}async setClosable(e){return $(`plugin:window|set_closable`,{label:this.label,value:e})}async setTitle(e){return $(`plugin:window|set_title`,{label:this.label,value:e})}async maximize(){return $(`plugin:window|maximize`,{label:this.label})}async unmaximize(){return $(`plugin:window|unmaximize`,{label:this.label})}async toggleMaximize(){return $(`plugin:window|toggle_maximize`,{label:this.label})}async minimize(){return $(`plugin:window|minimize`,{label:this.label})}async unminimize(){return $(`plugin:window|unminimize`,{label:this.label})}async show(){return $(`plugin:window|show`,{label:this.label})}async hide(){return $(`plugin:window|hide`,{label:this.label})}async close(){return $(`plugin:window|close`,{label:this.label})}async destroy(){return $(`plugin:window|destroy`,{label:this.label})}async setDecorations(e){return $(`plugin:window|set_decorations`,{label:this.label,value:e})}async setShadow(e){return $(`plugin:window|set_shadow`,{label:this.label,value:e})}async setEffects(e){return $(`plugin:window|set_effects`,{label:this.label,value:e})}async clearEffects(){return $(`plugin:window|set_effects`,{label:this.label,value:null})}async setAlwaysOnTop(e){return $(`plugin:window|set_always_on_top`,{label:this.label,value:e})}async setAlwaysOnBottom(e){return $(`plugin:window|set_always_on_bottom`,{label:this.label,value:e})}async setContentProtected(e){return $(`plugin:window|set_content_protected`,{label:this.label,value:e})}async setSize(e){return $(`plugin:window|set_size`,{label:this.label,value:e instanceof yW?e:new yW(e)})}async setMinSize(e){return $(`plugin:window|set_min_size`,{label:this.label,value:e instanceof yW?e:e?new yW(e):null})}async setMaxSize(e){return $(`plugin:window|set_max_size`,{label:this.label,value:e instanceof yW?e:e?new yW(e):null})}async setSizeConstraints(e){function t(e){return e?{Logical:e}:null}return $(`plugin:window|set_size_constraints`,{label:this.label,value:{minWidth:t(e?.minWidth),minHeight:t(e?.minHeight),maxWidth:t(e?.maxWidth),maxHeight:t(e?.maxHeight)}})}async setPosition(e){return $(`plugin:window|set_position`,{label:this.label,value:e instanceof SW?e:new SW(e)})}async setFullscreen(e){return $(`plugin:window|set_fullscreen`,{label:this.label,value:e})}async setSimpleFullscreen(e){return $(`plugin:window|set_simple_fullscreen`,{label:this.label,value:e})}async setFocus(){return $(`plugin:window|set_focus`,{label:this.label})}async setFocusable(e){return $(`plugin:window|set_focusable`,{label:this.label,value:e})}async setIcon(e){return $(`plugin:window|set_icon`,{label:this.label,value:AW(e)})}async setSkipTaskbar(e){return $(`plugin:window|set_skip_taskbar`,{label:this.label,value:e})}async setCursorGrab(e){return $(`plugin:window|set_cursor_grab`,{label:this.label,value:e})}async setCursorVisible(e){return $(`plugin:window|set_cursor_visible`,{label:this.label,value:e})}async setCursorIcon(e){return $(`plugin:window|set_cursor_icon`,{label:this.label,value:e})}async setBackgroundColor(e){return $(`plugin:window|set_background_color`,{color:e})}async setCursorPosition(e){return $(`plugin:window|set_cursor_position`,{label:this.label,value:e instanceof SW?e:new SW(e)})}async setIgnoreCursorEvents(e){return $(`plugin:window|set_ignore_cursor_events`,{label:this.label,value:e})}async startDragging(){return $(`plugin:window|start_dragging`,{label:this.label})}async startResizeDragging(e){return $(`plugin:window|start_resize_dragging`,{label:this.label,value:e})}async setBadgeCount(e){return $(`plugin:window|set_badge_count`,{label:this.label,value:e})}async setBadgeLabel(e){return $(`plugin:window|set_badge_label`,{label:this.label,value:e})}async setOverlayIcon(e){return $(`plugin:window|set_overlay_icon`,{label:this.label,value:e?AW(e):void 0})}async setProgressBar(e){return $(`plugin:window|set_progress_bar`,{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return $(`plugin:window|set_visible_on_all_workspaces`,{label:this.label,value:e})}async setTitleBarStyle(e){return $(`plugin:window|set_title_bar_style`,{label:this.label,value:e})}async setTheme(e){return $(`plugin:window|set_theme`,{label:this.label,value:e})}async onResized(e){return this.listen(CW.WINDOW_RESIZED,t=>{t.payload=new vW(t.payload),e(t)})}async onMoved(e){return this.listen(CW.WINDOW_MOVED,t=>{t.payload=new xW(t.payload),e(t)})}async onCloseRequested(e){return this.listen(CW.WINDOW_CLOSE_REQUESTED,async t=>{let n=new MW(t);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){let t=await this.listen(CW.DRAG_ENTER,t=>{e({...t,payload:{type:`enter`,paths:t.payload.paths,position:new xW(t.payload.position)}})}),n=await this.listen(CW.DRAG_OVER,t=>{e({...t,payload:{type:`over`,position:new xW(t.payload.position)}})}),r=await this.listen(CW.DRAG_DROP,t=>{e({...t,payload:{type:`drop`,paths:t.payload.paths,position:new xW(t.payload.position)}})}),i=await this.listen(CW.DRAG_LEAVE,t=>{e({...t,payload:{type:`leave`}})});return()=>{t(),r(),n(),i()}}async onFocusChanged(e){let t=await this.listen(CW.WINDOW_FOCUS,t=>{e({...t,payload:!0})}),n=await this.listen(CW.WINDOW_BLUR,t=>{e({...t,payload:!1})});return()=>{t(),n()}}async onScaleChanged(e){return this.listen(CW.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(CW.WINDOW_THEME_CHANGED,e)}},RW;(function(e){e.Disabled=`disabled`,e.Throttle=`throttle`,e.Suspend=`suspend`})(RW||={});var zW;(function(e){e.Default=`default`,e.FluentOverlay=`fluentOverlay`})(zW||={});var BW;(function(e){e.AppearanceBased=`appearanceBased`,e.Light=`light`,e.Dark=`dark`,e.MediumLight=`mediumLight`,e.UltraDark=`ultraDark`,e.Titlebar=`titlebar`,e.Selection=`selection`,e.Menu=`menu`,e.Popover=`popover`,e.Sidebar=`sidebar`,e.HeaderView=`headerView`,e.Sheet=`sheet`,e.WindowBackground=`windowBackground`,e.HudWindow=`hudWindow`,e.FullScreenUI=`fullScreenUI`,e.Tooltip=`tooltip`,e.ContentBackground=`contentBackground`,e.UnderWindowBackground=`underWindowBackground`,e.UnderPageBackground=`underPageBackground`,e.Mica=`mica`,e.Blur=`blur`,e.Acrylic=`acrylic`,e.Tabbed=`tabbed`,e.TabbedDark=`tabbedDark`,e.TabbedLight=`tabbedLight`})(BW||={});var VW;(function(e){e.FollowsWindowActiveState=`followsWindowActiveState`,e.Active=`active`,e.Inactive=`inactive`})(VW||={});function HW(){return typeof window<`u`&&`__TAURI_INTERNALS__`in window}function UW(){return HW()&&/mac/i.test(navigator.platform)}function WW({onClick:e,icon:t,hoverColor:n=`var(--color-accent)`,hoverTextColor:r=`var(--color-accent-foreground)`,ariaLabel:i}){let[a,o]=(0,I.useState)(!1);return(0,q.jsx)(`button`,{onClick:e,"aria-label":i,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{width:34,height:28,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:7,border:`none`,cursor:`pointer`,background:a?n:`transparent`,color:a?r:`var(--color-muted-foreground)`,transition:`background 0.12s ease, color 0.12s ease`,WebkitAppRegion:`no-drag`},children:t})}function GW({projectName:e}){let{t}=G(`nav`),[n,r]=(0,I.useState)(!1);function i(){window.dispatchEvent(new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0,bubbles:!0}))}return(0,q.jsxs)(`button`,{onClick:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),"aria-label":t(`titleBar.searchShortcut`),style:{position:`absolute`,left:`50%`,top:`50%`,transform:`translate(-50%, -50%)`,width:`40%`,maxWidth:360,minWidth:160,height:20,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:5,paddingLeft:8,paddingRight:8,borderRadius:9999,border:`1px solid color-mix(in srgb, var(--color-border) 70%, transparent)`,cursor:`pointer`,background:n?`color-mix(in srgb, var(--color-accent) 82%, transparent)`:`color-mix(in srgb, var(--color-surface) 72%, transparent)`,color:e?`var(--color-foreground)`:`var(--color-muted-foreground)`,fontSize:12,fontWeight:400,letterSpacing:0,transition:`background 0.12s ease`,WebkitAppRegion:`no-drag`,overflow:`hidden`,whiteSpace:`nowrap`},children:[(0,q.jsx)(Ep,{size:11,style:{flexShrink:0,opacity:e?.72:.48}}),(0,q.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e??t(`titleBar.searchPlaceholder`)})]})}function KW(){return HW()?UW()?(0,q.jsx)(qW,{}):(0,q.jsx)(JW,{}):null}function qW(){let{projects:e,activeProjectId:t}=Sd();return(0,q.jsx)(`div`,{"data-tauri-drag-region":!0,style:{position:`relative`,height:28,minHeight:28,background:`var(--color-background-deep)`,display:`flex`,alignItems:`center`,userSelect:`none`,flexShrink:0,borderBottom:`1px solid var(--color-border)`},children:(0,q.jsx)(GW,{projectName:(e.find(e=>e.id===t)??null)?.name??null})})}function JW(){let{t:e}=G(`nav`),{projects:t,activeProjectId:n}=Sd(),r=t.find(e=>e.id===n)??null,i=PW(),a=(0,I.useCallback)(()=>{i.minimize()},[i]),o=(0,I.useCallback)(()=>{i.toggleMaximize()},[i]),s=(0,I.useCallback)(()=>{i.close()},[i]);return(0,q.jsxs)(`div`,{"data-tauri-drag-region":!0,style:{position:`relative`,height:36,minHeight:36,background:`var(--color-background-deep)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`0 10px`,userSelect:`none`,flexShrink:0,borderBottom:`1px solid var(--color-border)`},children:[(0,q.jsx)(GW,{projectName:r?.name??null}),(0,q.jsx)(`div`,{"data-tauri-drag-region":!0,style:{minWidth:116,height:`100%`}}),(0,q.jsxs)(`div`,{style:{minWidth:116,display:`flex`,justifyContent:`flex-end`,gap:2,alignItems:`center`,WebkitAppRegion:`no-drag`},children:[(0,q.jsx)(WW,{onClick:a,icon:(0,q.jsx)(tp,{size:14,strokeWidth:1.8}),ariaLabel:e(`titleBar.minimizeWindow`)}),(0,q.jsx)(WW,{onClick:o,icon:(0,q.jsx)(Pp,{size:12,strokeWidth:1.8}),ariaLabel:e(`titleBar.maximizeWindow`)}),(0,q.jsx)(WW,{onClick:s,icon:(0,q.jsx)(qp,{size:15,strokeWidth:1.8}),hoverColor:`var(--color-destructive)`,hoverTextColor:`var(--color-destructive-foreground)`,ariaLabel:e(`titleBar.closeWindow`)})]})]})}var YW=`アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン0123456789ABCDEF`,XW=16,ZW=XW,QW=XW*1.1,$W=180,eG=340,tG=.07,nG=.22,rG=18,iG=600,aG=48,oG=160,sG=360;function cG(){return YW[Math.floor(Math.random()*61)]??` `}function lG(e){return{head:-Math.random()*Math.max(e,12),speed:tG+Math.random()*(nG-tG),glyphs:Array.from({length:rG},()=>cG()),nextSwapAt:0}}function uG(){let e=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(typeof window>`u`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=e.current;if(!t)return;let n=t.getContext(`2d`,{alpha:!0});if(!n)return;let r=t,i=n,a=[],o=null,s=[],c=0,l=0,u=!document.hidden;function d(){let e=window.devicePixelRatio||1,t=window.innerWidth,n=window.innerHeight;r.width=Math.max(1,Math.floor(t*e)),r.height=Math.max(1,Math.floor(n*e)),r.style.width=`${t}px`,r.style.height=`${n}px`,i.setTransform(e,0,0,e,0,0),i.font=`${XW}px "DM Mono", "JetBrains Mono", "Fira Code", ui-monospace, monospace`,i.textBaseline=`top`;let o=Math.ceil(t/ZW),s=Math.ceil(n/QW);if(a.length===0)a=Array.from({length:o},()=>lG(s));else if(a.length<o){let e=Array.from({length:o-a.length},()=>lG(s));a=a.concat(e)}else a.length>o&&(a=a.slice(0,o))}function f(e){let t=performance.now();o&&(Math.abs(o.x-e.clientX)>=2||Math.abs(o.y-e.clientY)>=2)&&(s.push({x:o.x,y:o.y,t}),s.length>aG&&s.splice(0,s.length-aG)),o={x:e.clientX,y:e.clientY}}function p(){o=null}function m(){u=!document.hidden,u?(l=0,c=requestAnimationFrame(h)):cancelAnimationFrame(c)}function h(e){if(!u)return;let t=l===0?1:Math.min(2.5,(e-l)/16.67);l=e;let n=performance.now();for(;s.length>0&&n-s[0].t>iG;)s.shift();let r=window.innerWidth,d=window.innerHeight;i.clearRect(0,0,r,d);let f=Math.ceil(d/QW),p=o!==null||s.length>0;for(let r=0;r<a.length;r++){let c=a[r];if(c.head+=c.speed*t,c.head-rG>f+4&&(c.head=-Math.random()*12,c.speed=tG+Math.random()*(nG-tG)),e>c.nextSwapAt&&(c.glyphs[Math.floor(Math.random()*rG)]=cG(),c.nextSwapAt=e+oG+Math.random()*sG),!p)continue;let l=r*ZW+ZW/2,u=o===null?1/0:Math.abs(l-o.x);for(let e of s){let t=Math.abs(l-e.x);if(t<u&&(u=t),u===0)break}if(!(u>eG))for(let e=0;e<rG;e++){let t=c.head-e;if(t<-1||t>f+2)continue;let a=t*QW,u=0;if(o!==null){let e=l-o.x,t=a-o.y,n=Math.sqrt(e*e+t*t);if(n<=eG){let e=n<$W?1:1-(n-$W)/(eG-$W);e>u&&(u=e)}}if(u<.999)for(let e of s){let t=l-e.x,r=a-e.y,i=Math.sqrt(t*t+r*r);if(i>eG)continue;let o=i<$W?1:1-(i-$W)/(eG-$W),s=n-e.t,c=o*(s>iG?0:1-s/iG);if(c>u&&(u=c),u>=.999)break}if(u<.02)continue;let d=1-e/rG,p=u*d*.85;p<.02||(i.fillStyle=e===0?`hsla(150, 100%, 92%, ${p.toFixed(3)})`:`hsla(144, 100%, 55%, ${p.toFixed(3)})`,i.fillText(c.glyphs[e],r*ZW,a))}}c=requestAnimationFrame(h)}return d(),window.addEventListener(`resize`,d),window.addEventListener(`pointermove`,f),document.addEventListener(`mouseleave`,p),document.addEventListener(`visibilitychange`,m),c=requestAnimationFrame(h),()=>{cancelAnimationFrame(c),window.removeEventListener(`resize`,d),window.removeEventListener(`pointermove`,f),document.removeEventListener(`mouseleave`,p),document.removeEventListener(`visibilitychange`,m)}},[]),(0,q.jsx)(`canvas`,{ref:e,"aria-hidden":!0,className:`fixed inset-0 pointer-events-none`,style:{zIndex:-1}})}var dG={matrix:uG};function fG(){let e=dG[ZH().id];return e?(0,q.jsx)(e,{}):null}function pG({connectionStatus:e,rightSlot:t}){let{t:n}=G(`nav`),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(`connecting`),c=(0,I.useRef)(!0);return(0,I.useEffect)(()=>{let t=s.current;if(e===`connected`&&!c.current&&t!==`connected`){K.success(n(`statusBar.connectionRestored`)),o(!0);let e=setTimeout(()=>o(!1),2e3);return()=>clearTimeout(e)}c.current&&e===`connected`&&(c.current=!1),s.current=e},[e]),(0,I.useEffect)(()=>{c.current&&=!1},[]),(0,I.useEffect)(()=>{async function e(){try{let e=await fetch(`${ul()}/stats`);e.ok&&i(await e.json())}catch{}}e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[e]),(0,q.jsxs)(`footer`,{className:`h-7 flex items-center justify-between px-4 border-t border-border/30 bg-background/80 backdrop-blur-sm text-[10px] text-muted-foreground`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:X(`w-1.5 h-1.5 rounded-full transition-colors`,e===`connected`&&!a&&`bg-accent-success`,e===`connected`&&a&&`bg-accent-info animate-pulse`,e===`connecting`&&`bg-accent-warning animate-[pulse_0.75s_ease-in-out_infinite]`,e===`disconnected`&&`bg-destructive`)}),(0,q.jsxs)(`span`,{className:X(`transition-colors`,e===`connected`&&!a&&`text-accent-success`,e===`connected`&&a&&`text-accent-info`,e===`connecting`&&`text-accent-warning`,e===`disconnected`&&`text-destructive`),children:[e===`connected`&&!a&&n(`statusBar.connected`),e===`connected`&&a&&n(`statusBar.syncing`),e===`connecting`&&n(`statusBar.reconnecting`),e===`disconnected`&&n(`statusBar.disconnected`)]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&r.totalCostUsd>0&&(0,q.jsxs)(`span`,{children:[`$`,r.totalCostUsd.toFixed(2)]}),t]})]})}var mG={jobs:[],activeJobId:null,paused:!1};function hG(e){let[t,n]=(0,I.useState)([]),[r,i]=(0,I.useState)({}),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)([]),[l,u]=(0,I.useState)([]),[d,f]=(0,I.useState)(mG),p=(0,I.useRef)(e);p.current=e;let m=(0,I.useRef)(new Map),h=(0,I.useRef)(void 0);(0,I.useEffect)(()=>{if(h.current&&h.current,h.current=e,e){let t=m.current.get(e);t?(n(t.phaseDefinitions),i(t.phases),o(t.projectName),u(t.recentJobs),f(t.queueState)):(n([]),i({}),o(``),u([]),f(mG))}c([])},[e]);let g=(0,I.useCallback)(e=>{let t=e,r=p.current;if(!(r&&t.projectId&&t.projectId!==r))if(t.type===`init`){let e=t.projectName??``,a=t.phaseDefinitions??[],s={};for(let e of a)s[e.key]=t.phases?.[e.key]??`idle`;let l=t.recentJobs??[],d=t.queue??mG;o(e),n(a),i(s),c(t.logBuffer??[]),u(l),f(d),r&&m.current.set(r,{phaseDefinitions:a,phases:s,projectName:e,recentJobs:l,queueState:d})}else t.type===`phase`?i(e=>({...e,[t.phase]:t.state})):t.type===`log`?c(e=>[...e,{source:t.source,line:t.line,timestamp:t.timestamp,processId:t.processId}]):t.type===`queue`&&f({jobs:t.jobs??[],activeJobId:t.activeJobId??null,paused:t.paused??!1})},[]),{registerHandler:_,unregisterHandler:v,connectionStatus:y}=xl();return(0,I.useLayoutEffect)(()=>(_(`pipeline`,g),()=>v(`pipeline`)),[g,_,v]),(0,I.useEffect)(()=>{if(!e)return;async function t(){try{let e=await fetch(`${ul()}/state`);if(!e.ok)return;let t=await e.json();if(t.projectName&&o(t.projectName),t.phaseDefinitions){n(t.phaseDefinitions);let e={};for(let n of t.phaseDefinitions)e[n.key]=t.phases?.[n.key]??`idle`;i(e)}t.recentJobs&&u(t.recentJobs),t.queue&&f(t.queue)}catch{}}t()},[e]),{phases:r,phaseDefinitions:t,projectName:a,logLines:s,connectionStatus:y,recentJobs:l,queueState:d}}var gG=n(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{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=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.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._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(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(`
|
|
116
|
+
`)))),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((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
117
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_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.innerText=`\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._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=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);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){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}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])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(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()}Object.defineProperty(t,`__esModule`,{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}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()}}},3656:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}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 o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_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)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);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===this._currentLink&&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,(0,s.disposeArray)(this._linkCacheDisposables))}_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}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=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)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: 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`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=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._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();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=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{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}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),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((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_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=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.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(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.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(D.C0.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((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(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)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));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._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(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),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,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(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,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(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,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=1&t.buttons?0:4&t.buttons?1:2&t.buttons?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&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&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},a={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()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(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((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{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,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(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}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&&!1===this._customKeyEventHandler(e))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(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(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)}return 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)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.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?this.cancel(e,!0):void(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&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))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)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(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){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}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(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),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.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){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=Date.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=Date.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)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{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((0,o.toDisposable)((()=>{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.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,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()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=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))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return 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,void this._zones.push(this._zonePool[this._zonePoolIndex++]);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)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,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);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.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);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.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;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}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[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})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}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=``}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===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){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):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(`${s.C0.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)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(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]}Object.defineProperty(t,`__esModule`,{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(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 o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)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 c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),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(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),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=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+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((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(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} .${g} 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} .${g} { 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} .${g} .xterm-dim { color: ${d.color.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} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { 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(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),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)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let 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._optionsService.rawOptions.cursorBlink,o=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`.${h}${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))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=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 s.CellData,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,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),ee=n&&N===s,te=M&&N>=m&&N<=g,R=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{R=!0}));let z=I.getChars()||o.WHITESPACE_CELL_CHAR;if(z===` `&&(I.isUnderline()||I.isOverline())&&(z=`\xA0`),A=x*u-f.get(z,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&te===D&&A===O&&!ee&&!P&&!R){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=z,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=te,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&ee&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),te&&(b.style.textDecoration=`underline`);let B=I.getFgColor(),V=I.getFgColorMode(),ne=I.getBgColor(),H=I.getBgColorMode(),U=!!I.isInverse();if(U){let e=B;B=ne,ne=e;let t=V;V=H,H=t}let re,ie,W,ae=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&ae||(e.backgroundColorRGB&&(H=50331648,ne=e.backgroundColorRGB.rgba>>8&16777215,re=e.backgroundColorRGB),e.foregroundColorRGB&&(V=50331648,B=e.foregroundColorRGB.rgba>>8&16777215,ie=e.foregroundColorRGB),ae=e.options.layer===`top`)})),!ae&&L&&(re=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ne=re.rgba>>8&16777215,H=50331648,ae=!0,y.selectionForeground&&(V=50331648,B=y.selectionForeground.rgba>>8&16777215,ie=y.selectionForeground)),ae&&j.push(`xterm-decoration-top`),H){case 16777216:case 33554432:W=y.ansi[ne],j.push(`xterm-bg-${ne}`);break;case 50331648:W=l.channels.toColor(ne>>16,ne>>8&255,255&ne),this._addStyle(b,`background-color:#${h((ne>>>0).toString(16),`0`,6)}`);break;default:U?(W=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):W=y.background}switch(re||I.isDim()&&(re=l.color.multiplyOpacity(W,.5)),V){case 16777216:case 33554432:I.isBold()&&B<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(B+=8),this._applyMinimumContrast(b,W,y.ansi[B],I,re,void 0)||j.push(`xterm-fg-${B}`);break;case 50331648:let e=l.channels.toColor(B>>16&255,B>>8&255,255&B);this._applyMinimumContrast(b,W,e,I,re,ie)||this._addStyle(b,`color:#${h(B.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,W,y.foreground,I,re,ie)||U&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),ee||P||R?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(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=l.color.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)}_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)&&(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])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WidthCache=void 0,t.WidthCache=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}}},2223:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(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}Object.defineProperty(t,`__esModule`,{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createSelectionRenderModel=void 0;class n{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])return void this.clear();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);s>=e.rows||c<0?this.clear():(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)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SelectionModel=void 0,t.SelectionModel=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.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)&&(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)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}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())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{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)}}class u extends l{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}}class d extends l{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}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{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()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}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,s=0,c=t.getFg(0),l=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!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[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)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`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}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(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)}}},779:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>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)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(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=(0,o.getCoordsRelativeToElement)(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])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),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 s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_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=(0,c.toDisposable)((()=>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){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(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()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),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 s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}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||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(h,` `))).join(d.isWindows?`\r
|
|
118
|
+
`:`
|
|
119
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&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)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&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=(0,f.getRangeLength)(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)}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=(0,a.getCoordsRelativeToElement)(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,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?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()),50)}_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&&!(d.isMac&&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)return void this.refresh(!0);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<500&&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=(0,o.moveToCellSequence)(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]);n?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)):this._oldHasSelection&&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=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`),t.ILinkProviderService=(0,r.createDecorator)(`LinkProviderService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.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:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.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))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=g(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+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)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]}else for(let e=0;e<this._restoreColors.ansi.length;++e)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()}}};function g(e,t){if(e!==void 0)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=h=r([i(0,l.IOptionsService)],h)},6349:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),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}}t.CircularList=a},1439:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);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 c=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(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(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,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(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,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},8969:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),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]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!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,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){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(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(1480),_=n(6242),v=n(6351),y=n(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S(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 C;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(C||(t.WindowsOptionsReportType=C={}));let w=0;class T extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),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 E(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(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new _.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new _.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new _.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new _.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new _.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new _.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new _.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new _.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new _.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new _.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new _.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new _.OscHandler((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 o.CHARSETS)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 v.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_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<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 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>x&&(a=this._parseStack.position+x)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(e.length,x))),o||this._dirtyRowTracker.clearRange(),e.length>x)for(let t=a;t<e.length;t+=x){let a=t+x<e.length?t+x: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(Math.min(c,this._bufferService.rows-1),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,d=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let h=this._parser.precedingJoinState;for(let _=t;_<n;++_){if(r=e[_],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,h);i=g.UnicodeService.extractWidth(t);let n=g.UnicodeService.extractShouldJoin(t),v=n?g.UnicodeService.extractWidth(h):0;if(h=t,o&&this._onA11yChar.fire((0,l.stringFromCodePoint)(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-v>s){if(c){let e=m,t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,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),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&m instanceof u.BufferLine&&m.copyCellsFrom(e,t,0,v,!1);t<s;)e.setCellFromCodepoint(t++,0,1,p)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-v;--e>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}else if(d&&(m.insertCells(this._activeBuffer.x,i-v,this._activeBuffer.getNullCell(p)),m.getWidth(s-1)===2&&m.setCellFromCodepoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=h,this._activeBuffer.x<s&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!S(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new _.OscHandler(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){let n;switch(this._restrictCursor(this._bufferService.cols),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: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(u.DEFAULT_ATTR_DATA));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=g.UnicodeService.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(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.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,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!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:case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=e=>e?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),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=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.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|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):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|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):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|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.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(`${a.C0.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=u.DEFAULT_ATTR_DATA.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.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!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(!S(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(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&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(D(n))if(r===`?`)t.push({type:0,index:n});else{let e=(0,y.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&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=(0,y.parseColor)(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]);D(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,o.DEFAULT_CHARSET),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(b[e[0]],o.CHARSETS[e[1]]||o.DEFAULT_CHARSET),!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=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;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=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=T;let E=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&&(w=e,e=t,t=w),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}E=r([i(0,h.IBufferService)],E)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,`__esModule`,{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{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={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===t);return!1}*getKeyIterator(e){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===e)}forEachByKey(e,t){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===e)}values(){return[...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)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{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=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(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[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=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=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(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 a.ExtendedAttrs),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 a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(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 n=e+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);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 r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),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 o.BufferLine(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 o.BufferLine(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=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=[],i=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u<a+l.length)continue;let d=l[l.length-1].getTrimmedLength(),f=(0,s.reflowSmallerGetNewLineLengths)(l,this._cols,e),p=f.length-l.length,m;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+p):Math.max(0,this.lines.length-this.lines.maxLength+p);let h=[];for(let e=0;e<p;e++){let e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);h.push(e)}h.length>0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t<l.length;t++)f[t]<e&&l[t].setCell(f[t],n);let b=p-m;for(;b-- >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+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(r.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,a=n-1,o=0,s=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+i-1);l>=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);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+i-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.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new u.Marker(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)}}},8437:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?(0,o.stringFromCodePoint)(n):``,t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&r?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&r)+(0,o.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[3*e+0]=r}insertCells(e,t,n){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new i.CellData;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 i.CellData;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++;else 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 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)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,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<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);else{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 e=new c(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+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<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(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[3*t+0],n=2097151&e,s=2097152&e?this._combined[t]:n?(0,o.stringFromCodePoint)(n):a.WHITESPACE_CELL_CHAR;if(i+=s,r)for(let e=0;e<s.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(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)}},4634:(e,t)=>{function n(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}Object.defineProperty(t,`__esModule`,{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,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(i>=s&&i<c){s+=u.length-1;continue}let d=0,f=n(u,d,t),p=1,m=0;for(;p<u.length;){let e=n(u,p,t),i=e-m,o=r-f,s=Math.min(i,o);u[d].copyCellsFrom(u[p],m,f,s,!1),f+=s,f===r&&(d++,f=0),m+=s,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(r-1)===2&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,a))}u[d].replaceCells(f,r,a);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},t.reflowLargerCreateNewLayout=function(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}},t.reflowLargerApplyNewLayout=function(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},t.reflowSmallerGetNewLineLengths=function(e,t,r){let i=[],a=e.map(((r,i)=>n(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;c<a;){if(a-c<r){i.push(a-c);break}o+=r;let l=n(e,s,t);o>l&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),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 a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!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)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,`__esModule`,{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(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=`
|
|
120
|
+
`,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=``}(n||(t.C0=n={})),function(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=``}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={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:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.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()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(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(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=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++]=1024*(this._interim-55296)+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++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=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,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[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]],a=[[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]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{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 r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;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>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.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=>Date.now()-n>=12?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,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\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})$/,r=/^[\da-f]+$/;function i(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}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.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),r.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}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}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=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){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&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);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}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(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=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{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}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(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(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){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 i.Params,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((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),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(255&e)),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,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=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,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=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 r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,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=a}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=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(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)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+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){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&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);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}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=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+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(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}}},8742:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)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}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];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;else{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>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];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=255&this._subParamsIdx[t];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 r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.AddonManager=void 0,t.AddonManager=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)}}},8771:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=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 r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=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 r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(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)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ParserApi=void 0,t.ParserApi=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)}}},7090:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=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}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}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,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CharsetService=void 0,t.CharsetService=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)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===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 l(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|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`[M${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[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}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:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_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}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{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 o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}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}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{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=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=r.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=r.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),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`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{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)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(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}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[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?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{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 t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=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)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}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(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),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(u.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 c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(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 s.BufferNamespaceApi(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,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
|
|
121
|
+
`,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 t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),_G=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,`__esModule`,{value:!0}),t.FitAddon=void 0,t.FitAddon=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,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),vG=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebLinksAddon=r():n.WebLinksAddon=r()})(self,(()=>(()=>{var e={6:(e,t)=>{function n(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}}Object.defineProperty(t,`__esModule`,{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=r.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)))}};class r{static computeLink(e,t,i,a){let o=new RegExp(t.source,(t.flags||``)+`g`),[s,c]=r._getWindowedLineStrings(e-1,i),l=s.join(``),u,d=[];for(;u=o.exec(l);){let e=u[0];if(!n(e))continue;let[t,o]=r._mapStrIdx(i,c,0,u.index),[s,l]=r._mapStrIdx(i,t,o,e.length);if(t===-1||o===-1||s===-1||l===-1)continue;let f={start:{x:o+1,y:t+1},end:{x:l,y:s+1}};d.push({range:f,text:e,activate:a})}return d}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]}}t.LinkComputer=r}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.WebLinksAddon=void 0;let t=n(6),i=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a(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`)}e.WebLinksAddon=class{constructor(e=a,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let n=this._options,r=n.urlRegex||i;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,r,this._handler,n))}dispose(){this._linkProvider?.dispose()}}})(),r})()))})),yG=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.SearchAddon=r():n.SearchAddon=r()})(self,(()=>(()=>{var e={345:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,`__esModule`,{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.SearchAddon=void 0;let t=n(345),i=n(859),a=` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`;class o extends i.Disposable{constructor(e){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new i.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new i.MutableDisposable,this._onDidChangeResults=this.register(new t.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=e?.highlightLimit??1e3}activate(e){this._terminal=e,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,i.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let e=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(e,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(e){this._selectedDecoration.clear(),(0,i.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),e||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let n=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||n)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);if(!e||e.length===0)return void this.clearDecorations();t||={},this.clearDecorations(!0);let n=[],r,i=this._find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);for(let e of n){let n=this._createResultDecoration(e,t.decorations);n&&(this._highlightedLines.add(n.marker.line),this._highlightDecorations.push({decoration:n,match:e,dispose(){n.dispose()}}))}}_find(e,t,n,r){if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let a={startRow:t,startCol:n};if(i=this._findInLine(e,a,r),!i)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=n,a.startCol=0,i=this._findInLine(e,a,r),!i);n++);return i}_findNextAndSelect(e,t){if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,i=0;n&&(this._cachedSearchTerm===e?(r=n.end.x,i=n.end.y):(r=n.start.x,i=n.start.y)),this._initLinesCache();let a={startRow:i,startCol:r},o=this._findInLine(e,a,t);if(!o)for(let n=i+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=n,a.startCol=0,o=this._findInLine(e,a,t),!o);n++);if(!o&&i!==0)for(let n=0;n<i&&(a.startRow=n,a.startCol=0,o=this._findInLine(e,a,t),!o);n++);return!o&&n&&(a.startRow=n.start.y,a.startCol=0,o=this._findInLine(e,a,t)),this._selectResult(o,t?.decorations,t?.noScroll)}findPrevious(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let n=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||n)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,r}_didOptionsChange(e,t){return!!t&&(e.caseSensitive!==t.caseSensitive||e.regex!==t.regex||e.wholeWord!==t.wholeWord)}_fireResults(e){if(e?.decorations){let e=-1;if(this._selectedDecoration.value){let t=this._selectedDecoration.value.match;for(let n=0;n<this._highlightDecorations.length;n++){let r=this._highlightDecorations[n].match;if(r.row===t.row&&r.col===t.col&&r.size===t.size){e=n;break}}}this._onDidChangeResults.fire({resultIndex:e,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols;this._initLinesCache();let a={startRow:r,startCol:i},o;if(n&&(a.startRow=r=n.start.y,a.startCol=i=n.start.x,this._cachedSearchTerm!==e&&(o=this._findInLine(e,a,t,!1),o||(a.startRow=r=n.end.y,a.startCol=i=n.end.x))),o||=this._findInLine(e,a,t,!0),!o){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let n=r-1;n>=0&&(a.startRow=n,o=this._findInLine(e,a,t,!0),!o);n--);}if(!o&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=r&&(a.startRow=n,o=this._findInLine(e,a,t,!0),!o);n--);return this._selectResult(o,t?.decorations,t?.noScroll)}_initLinesCache(){let e=this._terminal;this._linesCache||(this._linesCache=Array(e.buffer.active.length),this._linesCacheDisposables.value=(0,i.getDisposeArrayDisposable)([e.onLineFeed((()=>this._destroyLinesCache())),e.onCursorMove((()=>this._destroyLinesCache())),e.onResize((()=>this._destroyLinesCache()))])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout((()=>this._destroyLinesCache()),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&=(window.clearTimeout(this._linesCacheTimeoutId),0)}_isWholeWord(e,t,n){return(e===0||a.includes(t[e-1]))&&(e+n.length===t.length||a.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=this._terminal,a=t.startRow,o=t.startCol;if(i.buffer.active.getLine(a)?.isWrapped)return r?void(t.startCol+=i.cols):(t.startRow--,t.startCol+=i.cols,this._findInLine(e,t,n));let s=this._linesCache?.[a];s||(s=this._translateBufferLineToStringWithWrap(a,!0),this._linesCache&&(this._linesCache[a]=s));let[c,l]=s,u=this._bufferColsToStringOffset(a,o),d=n.caseSensitive?e:e.toLowerCase(),f=n.caseSensitive?c:c.toLowerCase(),p=-1;if(n.regex){let t=RegExp(d,`g`),n;if(r)for(;n=t.exec(f.slice(0,u));)p=t.lastIndex-n[0].length,e=n[0],t.lastIndex-=e.length-1;else n=t.exec(f.slice(u)),n&&n[0].length>0&&(p=u+(t.lastIndex-n[0].length),e=n[0])}else r?u-d.length>=0&&(p=f.lastIndexOf(d,u-d.length)):p=f.indexOf(d,u);if(p>=0){if(n.wholeWord&&!this._isWholeWord(p,f,e))return;let t=0;for(;t<l.length-1&&p>=l[t+1];)t++;let r=t;for(;r<l.length-1&&p+e.length>=l[r+1];)r++;let o=p-l[t],s=p+e.length-l[r],c=this._stringLengthToBufferSize(a+t,o);return{term:e,col:c,row:a+t,size:this._stringLengthToBufferSize(a+r,s)-c+i.cols*(r-t)}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=this._terminal,r=e,i=0,a=n.buffer.active.getLine(r);for(;t>0&&a;){for(let e=0;e<t&&e<n.cols;e++){let t=a.getCell(e);if(!t)break;t.getWidth()&&(i+=t.getCode()===0?1:t.getChars().length)}if(r++,a=n.buffer.active.getLine(r),a&&!a.isWrapped)break;t-=n.cols}return i}_translateBufferLineToStringWithWrap(e,t){let n=this._terminal,r=[],i=[0],a=n.buffer.active.getLine(e);for(;a;){let o=n.buffer.active.getLine(e+1),s=!!o&&o.isWrapped,c=a.translateToString(!s&&t);if(s&&o){let e=a.getCell(a.length-1);e&&e.getCode()===0&&e.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(c=c.slice(0,-1))}if(r.push(c),!s)break;i.push(i[i.length-1]+c.length),e++,a=o}return[r.join(``),i]}_selectResult(e,t,n){let r=this._terminal;if(this._selectedDecoration.clear(),!e)return r.clearSelection(),!1;if(r.select(e.col,e.row,e.size),t){let n=r.registerMarker(-r.buffer.active.baseY-r.buffer.active.cursorY+e.row);if(n){let a=r.registerDecoration({marker:n,x:e.col,width:e.size,backgroundColor:t.activeMatchBackground,layer:`top`,overviewRulerOptions:{color:t.activeMatchColorOverviewRuler}});if(a){let r=[];r.push(n),r.push(a.onRender((e=>this._applyStyles(e,t.activeMatchBorder,!0)))),r.push(a.onDispose((()=>(0,i.disposeArray)(r)))),this._selectedDecoration.value={decoration:a,match:e,dispose(){a.dispose()}}}}}if(!n&&(e.row>=r.buffer.active.viewportY+r.rows||e.row<r.buffer.active.viewportY)){let t=e.row-r.buffer.active.viewportY;t-=Math.floor(r.rows/2),r.scrollLines(t)}return!0}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecoration(e,t){let n=this._terminal,r=n.registerMarker(-n.buffer.active.baseY-n.buffer.active.cursorY+e.row);if(!r)return;let a=n.registerDecoration({marker:r,x:e.col,width:e.size,backgroundColor:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:t.matchOverviewRuler,position:`center`}});if(a){let e=[];e.push(r),e.push(a.onRender((e=>this._applyStyles(e,t.matchBorder,!1)))),e.push(a.onDispose((()=>(0,i.disposeArray)(e))))}return a}}e.SearchAddon=o})(),r})()))})),bG=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.Unicode11Addon=r():n.Unicode11Addon=r()})(e,(()=>(()=>{var e={433:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV11=void 0;let r=n(938),i=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],a=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],o=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],s=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],c;function l(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}t.UnicodeV11=class{constructor(){if(this.version=`11`,!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160);for(let e=0;e<i.length;++e)c.fill(0,i[e][0],i[e][1]+1);for(let e=0;e<o.length;++e)c.fill(2,o[e][0],o[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?c[e]:l(e,a)?0:l(e,s)?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},345:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},490:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV6=void 0;let r=n(938),i=[[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]],a=[[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]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},938:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeService=void 0;let r=n(345),i=n(490);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}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(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.Unicode11Addon=void 0;let t=n(433);e.Unicode11Addon=class{activate(e){e.unicode.register(new t.UnicodeV11)}dispose(){}}})(),r})()))})),xG=gG(),SG=_G(),CG=vG(),wG=yG(),TG=bG(),EG=new Map,DG=new Map;function OG(e){let t=EG.get(e);return t||(t={openPreExec:null,completed:[],cwd:null,promptRows:[]},EG.set(e,t)),t}function kG(e){let t=DG.get(e);if(!t)return;let n=OG(e);for(let e of t)try{e(n)}catch{}}function AG(e,t,n){let r=OG(e);switch(t.kind){case`prompt-start`:r.promptRows.push({ts:t.ts,row:n?.row??null,exitCode:null}),r.promptRows.length>1e3&&r.promptRows.shift();break;case`pre-exec`:r.openPreExec={startedAt:t.ts};break;case`post-exec`:{let e=t.payload?.exitCode??null,n=r.openPreExec?.startedAt??t.ts;r.completed.push({startedAt:n,finishedAt:t.ts,exitCode:e});let i=r.promptRows[r.promptRows.length-1];i&&(i.exitCode=e),r.openPreExec=null,r.completed.length>1e3&&r.completed.shift();break}case`cwd`:r.cwd=t.payload?.path??null;break}kG(e)}function jG(e,t){let n=DG.get(e);return n||(n=new Set,DG.set(e,n)),n.add(t),()=>{n.delete(t)}}function MG(e){return OG(e)}function NG(e){EG.delete(e),DG.delete(e)}var PG=new Map,FG=5e3;function IG(){return typeof document<`u`&&!document.hasFocus()}async function LG(e,t){let n=`${e}:${t.command??``}`,r=Date.now();if(r-(PG.get(n)??0)<FG)return;PG.set(n,r);let i=t.command?J.t(`terminal:notifications.commandFinishedNamed`,{command:RG(t.command,50)}):J.t(`terminal:notifications.commandFinished`),a=J.t(`terminal:notifications.finishedBody`,{code:t.exitCode??`?`,elapsed:zG(t.elapsedMs)});if(AB())try{let e=await jB(`@tauri-apps/plugin-notification`);if(e?.sendNotification){let t=await e.isPermissionGranted?.()??!0;if(t||=await e.requestPermission?.()===`granted`,t){await e.sendNotification({title:i,body:a});return}}}catch{}try{if(typeof Notification>`u`||Notification.permission===`default`&&await Notification.requestPermission().catch(()=>`denied`)!==`granted`||Notification.permission!==`granted`)return;new Notification(i,{body:a})}catch{}}function RG(e,t){return e.length<=t?e:e.slice(0,t-1)+`…`}function zG(e){if(e<6e4)return J.t(`terminal:duration.seconds`,{seconds:(e/1e3).toFixed(1)});let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return J.t(`terminal:duration.minutesSeconds`,{minutes:t,seconds:n})}async function BG(e,t){await $(`plugin:clipboard-manager|write_text`,{label:t?.label,text:e})}async function VG(){return await $(`plugin:clipboard-manager|read_text`)}async function HG(){if(AB())try{let e=await VG();return typeof e==`string`?e:null}catch{return null}try{if(typeof navigator<`u`&&navigator.clipboard?.readText)return await navigator.clipboard.readText()||null}catch{}return null}async function UG(e){if(AB())try{return await BG(e),!0}catch{return!1}try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return!1}var WG=(0,I.createContext)(null);function GG(e){return`specrails-desktop:terminal-panel:${e}`}function KG(e){try{let t=localStorage.getItem(GG(e));if(!t)return null;let n=JSON.parse(t);if(!n)return null;let r=n.visibility,i=n.userHeight;return r!==`hidden`&&r!==`restored`&&r!==`maximized`||typeof i!=`number`||!Number.isFinite(i)?null:{visibility:r,userHeight:i}}catch{return null}}function qG(e,t){try{localStorage.setItem(GG(e),JSON.stringify(t))}catch{}}function JG(e){return{visibility:e?.visibility??`hidden`,userHeight:e?.userHeight??320,sessions:[],activeId:null}}function YG(){let e=document.getElementById(`specrails-terminal-host`);return e||(e=document.createElement(`div`),e.id=`specrails-terminal-host`,e.style.position=`fixed`,e.style.left=`0`,e.style.top=`0`,e.style.width=`0`,e.style.height=`0`,e.style.overflow=`hidden`,e.style.visibility=`hidden`,e.style.pointerEvents=`none`,e.setAttribute(`aria-hidden`,`true`),document.body.appendChild(e),e)}function XG({children:e,activeProjectId:t}){let[n,r]=(0,I.useState)({}),i=(0,I.useRef)(n);i.current=n;let a=(0,I.useRef)(new Map),o=(0,I.useRef)(new Map),s=(0,I.useRef)(null);(0,I.useEffect)(()=>(s.current=YG(),()=>{for(let e of a.current.values())sK(e);a.current.clear(),o.current.clear()}),[]);let c=XH()?.theme??null;(0,I.useEffect)(()=>{if(c)for(let e of a.current.values())try{e.term.options.theme=c.xterm}catch{}},[c]);let l=(0,I.useCallback)((e,t)=>{r(n=>{let r=n[e]??JG(KG(e)),i=t(r);return i===r?n:((i.visibility!==r.visibility||i.userHeight!==r.userHeight)&&qG(e,{visibility:i.visibility,userHeight:i.userHeight}),{...n,[e]:i})})},[]),u=(0,I.useCallback)(e=>{r(t=>t[e]?t:{...t,[e]:JG(KG(e))})},[]),d=(0,I.useCallback)(e=>i.current[e]??JG(KG(e)),[]),f=(0,I.useCallback)((e,t)=>{l(e,e=>e.visibility===t?e:{...e,visibility:t})},[l]),p=(0,I.useCallback)(e=>{l(e,e=>({...e,visibility:e.visibility===`hidden`?`restored`:`hidden`}))},[l]),m=(0,I.useCallback)((e,t)=>{l(e,e=>e.userHeight===t?e:{...e,userHeight:t})},[l]),h=(0,I.useCallback)((e,t)=>{l(e,e=>e.activeId===t?e:{...e,activeId:t})},[l]),g=(0,I.useRef)(t);g.current=t,(0,I.useEffect)(()=>{if(!t)return;u(t);let e=!1;return(async()=>{try{let n=await fetch(`${sl}/api/projects/${t}/terminals`);if(!n.ok)return;let r=await n.json();if(e)return;l(t,e=>{let t=new Set(r.sessions.map(e=>e.id));for(let n of e.sessions.map(e=>e.id))if(!t.has(n)){let e=a.current.get(n);e&&(sK(e),a.current.delete(n),o.current.delete(n),NG(n))}let n=r.sessions.map(t=>{let n=e.sessions.find(e=>e.id===t.id);return n?{...n,...t}:t}),i=n.find(t=>t.id===e.activeId)?.id??n[0]?.id??null;for(let e of n)a.current.has(e.id)||nK(e.projectId,e.id,e.cols,e.rows,a.current,o.current,s.current);return{...e,sessions:n,activeId:i}})}catch{}})(),()=>{e=!0}},[t,u,l]);let _=(0,I.useCallback)(async(e,t)=>{let n=t?.cols??80,r=t?.rows??24;try{let i=await fetch(`${sl}/api/projects/${e}/terminals`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:n,rows:r,name:t?.name})});if(!i.ok){let e=``;try{e=(await i.json())?.error??``}catch{}return K.error(e===`terminal_limit_exceeded`?J.t(`terminal:errors.limitReached`,{max:10}):e===`terminal_spawn_failed`?J.t(`terminal:errors.spawnFailed`):e===`terminal_name_invalid`?J.t(`terminal:errors.invalidName`):J.t(`terminal:errors.openFailed`)),null}let c=(await i.json()).session;return nK(e,c.id,c.cols,c.rows,a.current,o.current,s.current,vH,void 0,void 0,!0),l(e,e=>({...e,sessions:[...e.sessions,c],activeId:c.id})),c}catch{return K.error(J.t(`terminal:errors.serverUnreachable`)),null}},[l]),v=(0,I.useCallback)(async(e,t,n)=>{let r=await _(e,n);if(!r)return null;let i=a.current.get(r.id);if(!i)return r;let o=()=>{let e=i.ws;if(e)try{e.send(new TextEncoder().encode(t))}catch{}};return i.ws&&i.ws.readyState===WebSocket.OPEN?setTimeout(o,50):i.ws&&i.ws.addEventListener(`open`,()=>setTimeout(o,50),{once:!0}),r},[]),y=(0,I.useCallback)((e,t)=>{let n=a.current.get(e);if(!n?.ws||n.ws.readyState!==WebSocket.OPEN)return!1;try{n.ws.send(new TextEncoder().encode(t));try{n.term.focus()}catch{}return!0}catch{return!1}},[]),b=(0,I.useCallback)(async(e,t,n)=>{try{let r=await fetch(`${sl}/api/projects/${e}/terminals/${t}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:n})});if(!r.ok)return!1;let i=await r.json();return l(e,e=>({...e,sessions:e.sessions.map(e=>e.id===t?{...e,name:i.session.name}:e)})),!0}catch{return!1}},[l]),x=(0,I.useCallback)(async(e,t)=>{let n=a.current.get(t);n&&(sK(n),a.current.delete(t),o.current.delete(t),NG(t)),l(e,e=>{let n=e.sessions.filter(e=>e.id!==t),r=e.activeId===t?n[0]?.id??null:e.activeId;return{...e,sessions:n,activeId:r}});try{await fetch(`${sl}/api/projects/${e}/terminals/${t}`,{method:`DELETE`})}catch{}},[l]),S=(0,I.useCallback)(e=>{let t=i.current[e];if(!t?.activeId)return;let n=a.current.get(t.activeId);if(n?.attached)try{n.term.focus()}catch{}},[]),C=(0,I.useCallback)(e=>{for(let[t,n]of o.current.entries()){if(n!==e)continue;let r=a.current.get(t);r&&(sK(r),a.current.delete(t)),o.current.delete(t)}r(t=>{if(!t[e])return t;let{[e]:n,...r}=t;return r});try{localStorage.removeItem(GG(e))}catch{}},[]),w=(0,I.useCallback)(e=>a.current.get(e)?.container??null,[]),T=(0,I.useCallback)(e=>{let t=a.current.get(e);if(!t)return;let n=!t.term.element||t.term.element.parentElement!==t.container;if(t.attached=!0,n){try{t.term.open(t.container)}catch{}let e=t.settings.renderMode;(e===`webgl`||e===`auto`&&oK())&&!t.webgl&&aK(t.term).then(e=>{e&&(t.webgl=e)})}try{t.fit.fit()}catch{}try{t.term.focus()}catch{}let r=t.term.cols,i=t.term.rows;if(t.ws&&t.ws.readyState===WebSocket.OPEN)try{t.ws.send(JSON.stringify({type:`resize`,cols:r,rows:i}))}catch{}},[]),E=(0,I.useCallback)(e=>{let t=a.current.get(e);if(!(!t||!t.attached)){try{t.fit.fit()}catch{}if(t.ws&&t.ws.readyState===WebSocket.OPEN)try{t.ws.send(JSON.stringify({type:`resize`,cols:t.term.cols,rows:t.term.rows}))}catch{}}},[]),D=(0,I.useCallback)((e,t)=>{let n=a.current.get(e);return n?(n.markListeners.add(t),()=>{n.markListeners.delete(t)}):()=>{}},[]),O=(0,I.useCallback)(e=>a.current.get(e)?.currentCwd??null,[]),k=(0,I.useCallback)(e=>a.current.get(e)?.search??null,[]),A=(0,I.useCallback)(e=>a.current.get(e)?.term??null,[]),j=(0,I.useCallback)((e,t)=>{let n=a.current.get(e);return n?(n.openSearchListeners.add(t),()=>{n.openSearchListeners.delete(t)}):()=>{}},[]),M=(0,I.useMemo)(()=>({states:n,getState:d,ensureProject:u,setVisibility:f,togglePanel:p,setUserHeight:m,setActive:h,create:_,createAndType:v,writeToSession:y,rename:b,kill:x,focusActive:S,disposeProject:C,getContainer:w,notifyAdopted:T,refitActive:E,subscribeMarks:D,getCwd:O,getSearchAddon:k,subscribeOpenSearch:j,getTerminalInstance:A}),[n,d,u,f,p,m,h,_,v,y,b,x,S,C,w,T,E,D,O,k,j,A]);return(0,q.jsx)(WG.Provider,{value:M,children:e})}var ZG={states:{},getState:e=>JG(null),ensureProject:()=>{},setVisibility:()=>{},togglePanel:()=>{},setUserHeight:()=>{},setActive:()=>{},create:async()=>null,createAndType:async()=>null,writeToSession:()=>!1,rename:async()=>!1,kill:async()=>{},focusActive:()=>{},disposeProject:()=>{},getContainer:()=>null,notifyAdopted:()=>{},refitActive:()=>{},subscribeMarks:()=>()=>{},getCwd:()=>null,getSearchAddon:()=>null,subscribeOpenSearch:()=>()=>{},getTerminalInstance:()=>null};function QG(){return(0,I.useContext)(WG)??ZG}function $G(e){let t=QG();return e?t.states[e]??JG(KG(e)):JG(null)}function eK(e,t,n,r,i){let a=e.get(t);if(!a)return;let o=a.term.options.fontSize??vH.fontSize,s;if(r===`reset`)s=a.settings.fontSize,i&&i(n,{fontSize:null});else{let e=o+r;if(e<8||e>32)return;s=yH(e),i&&i(n,{fontSize:s})}if(s!==o)try{a.term.options.fontSize=s,a.fit.fit()}catch{}}function tK(e,t,n){let r=e.get(t);if(!r)return;let{promptRows:i}=MG(t);if(i.length===0)return;let a=r.term.buffer.active.viewportY,o=null;if(n===`prev`)for(let e=i.length-1;e>=0;e--){let t=i[e].row;if(t!=null&&t<a){o=t;break}}else for(let e of i){let t=e.row;if(t!=null&&t>a){o=t;break}}if(o!=null)try{r.term.scrollToLine(o)}catch{}}function nK(e,t,n,r,i,a,o,s=vH,c,l,u=!1){let d=i.get(t);if(d)return d;let f=document.createElement(`div`);f.style.width=`100%`,f.style.height=`100%`,f.className=`specrails-xterm-container`;let p=new xG.Terminal({cols:n,rows:r,fontFamily:s.fontFamily,fontSize:s.fontSize,theme:HH().xterm,cursorBlink:!0,scrollback:1e4,allowProposedApi:!0}),m=new SG.FitAddon,h=new CG.WebLinksAddon,g=new wG.SearchAddon;p.loadAddon(m),p.loadAddon(h),p.loadAddon(g),p.attachCustomKeyEventHandler(n=>{if(n.type!==`keydown`||!(typeof navigator<`u`&&/Mac/i.test(navigator.platform||``)?n.metaKey:n.ctrlKey))return!0;let r=n.key;if(r===`c`||r===`C`){let e=p.getSelection();return e.length===0?!0:(UG(e),n.preventDefault(),!1)}if(r===`v`||r===`V`)return HG().then(e=>{if(e)try{p.paste(e)}catch{}}),n.preventDefault(),!1;if(r===`k`||r===`K`){try{p.clear()}catch{}return n.preventDefault(),!1}if(r===`f`||r===`F`){n.preventDefault();let e=i.get(t);if(e)for(let t of e.openSearchListeners)try{t()}catch{}return!1}return r===`=`||r===`+`?(n.preventDefault(),eK(i,t,e,1,l),!1):r===`-`||r===`_`?(n.preventDefault(),eK(i,t,e,-1,l),!1):r===`0`?(n.preventDefault(),eK(i,t,e,`reset`,l),!1):r===`ArrowUp`||r===`ArrowDown`?(n.preventDefault(),tK(i,t,r===`ArrowUp`?`prev`:`next`),!1):!0});try{let e=new TG.Unicode11Addon;p.loadAddon(e),p.unicode.activeVersion=`11`}catch{}s.imageRendering&&rK(p),iK(p),o&&o.appendChild(f);let _=`${TD||(typeof window<`u`?`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`:`ws://localhost:4200`)}/ws/terminal/${t}?projectId=${encodeURIComponent(e)}`,v=ml(),y=v?new WebSocket(_,[`specrails-desktop`,v]):new WebSocket(_);y.binaryType=`arraybuffer`;let b=[];y.onmessage=e=>{if(typeof e.data==`string`){try{let n=JSON.parse(e.data);if(n?.type===`ready`)return;if(n?.type===`exit`){let e=i.get(t);e&&x(e,n.code??null,!!n.early);return}if(n?.type===`mark`&&typeof n.kind==`string`&&typeof n.ts==`number`){let e=i.get(t);if(e){n.kind===`cwd`&&n.payload?.path&&(e.currentCwd=n.payload.path);let r={type:`mark`,kind:n.kind,payload:n.payload,ts:n.ts,sessionId:t},i=e.term.buffer.active,a=n.kind===`prompt-start`?i.cursorY+i.viewportY:null,o=n.kind===`post-exec`?MG(t).openPreExec?.startedAt??null:null;if(AG(t,n,{row:a}),n.kind===`post-exec`&&o!=null&&IG()){let r=n.ts-o,i=e.settings.longCommandThresholdMs;e.settings.notifyOnCompletion&&r>=i&&LG(t,{command:null,exitCode:n.payload?.exitCode??null,elapsedMs:r})}for(let t of e.markListeners)try{t(r)}catch{}c&&c(r)}}}catch{}return}let n=i.get(t);n&&(n.gotData=!0);let r=new Uint8Array(e.data);try{p.write(r)}catch{}};let x=(e,t,n)=>{if(!e.exitShown){e.exitShown=!0;try{let n=t===null?J.t(`terminal:session.processExited`):J.t(`terminal:session.processExitedWithCode`,{code:t});e.term.write(`\r\n\x1b[2m${n}\x1b[0m\r\n`)}catch{}n&&!e.gotUserInput&&K.error(J.t(`terminal:errors.exitedImmediately`))}};y.onclose=e=>{let n=i.get(t);if(!n||n.disposing||n.exitShown)return;let r=(typeof e?.reason==`string`?e.reason:``)===`pty_exit_early`,a=n.openedAt>0&&Date.now()-n.openedAt<3e3&&!n.gotData&&!n.gotUserInput;x(n,null,r||a)};let S=p.onData(e=>{let n=i.get(t);if(n&&(n.gotUserInput=!0),y.readyState===WebSocket.OPEN)try{y.send(new TextEncoder().encode(e))}catch{}});b.push(()=>S.dispose());let C=null,w=()=>{if(f.isConnected){try{m.fit()}catch{return}if(y.readyState===WebSocket.OPEN)try{y.send(JSON.stringify({type:`resize`,cols:p.cols,rows:p.rows}))}catch{}}},T=()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=null,w()},120)};y.onopen=()=>{let e=i.get(t);e&&(e.openedAt=Date.now()),w()};let E=new ResizeObserver(T);E.observe(f),b.push(()=>{C&&clearTimeout(C),E.disconnect()});let D={term:p,fit:m,webLinks:h,search:g,webgl:null,settings:s,container:f,ws:y,attached:!1,disposers:b,openedAt:0,gotData:!1,gotUserInput:!1,disposing:!1,exitShown:!1,currentCwd:null,markListeners:new Set,openSearchListeners:new Set};return i.set(t,D),a.set(t,e),D}async function rK(e){try{let n=(await r(()=>import(`./addon-image-CpF0L0jM.js`).then(e=>t(e.default,1)),__vite__mapDeps([24,1]))).ImageAddon,i=new n({pixelLimit:8e6});e.loadAddon(i)}catch{}}async function iK(e){try{let n=(await r(()=>import(`./addon-ligatures-hXysGZrA.js`).then(e=>t(e.default,1)),__vite__mapDeps([25,1]))).LigaturesAddon;e.loadAddon(new n)}catch{}}async function aK(e){try{let n=(await r(()=>import(`./addon-webgl-Cn1slavz.js`).then(e=>t(e.default,1)),__vite__mapDeps([26,1]))).WebglAddon,i=new n;return i.onContextLoss(()=>{try{i.dispose()}catch{}}),e.loadAddon(i),i}catch{return null}}function oK(){try{let e=document.createElement(`canvas`);return!!(e.getContext(`webgl2`)||e.getContext(`experimental-webgl2`))}catch{return!1}}function sK(e){e.disposing=!0;for(let t of e.disposers)try{t()}catch{}e.disposers=[],e.markListeners.clear(),e.openSearchListeners.clear();try{e.ws?.close(1e3,`client_dispose`)}catch{}e.ws=null;try{e.webgl?.dispose()}catch{}e.webgl=null;try{e.term.dispose()}catch{}try{e.container.remove()}catch{}}function cK(){return new dK(PW(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function lK(){return $(`plugin:webview|get_all_webviews`).then(e=>e.map(e=>new dK(new LW(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}var uK=[`tauri://created`,`tauri://error`],dK=class{constructor(e,t,n){this.window=e,this.label=t,this.listeners=Object.create(null),n?.skip||$(`plugin:webview|create_webview`,{windowLabel:e.label,options:{...n,label:t}}).then(async()=>this.emit(`tauri://created`)).catch(async e=>this.emit(`tauri://error`,e))}static async getByLabel(e){return(await lK()).find(t=>t.label===e)??null}static getCurrent(){return cK()}static async getAll(){return lK()}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:TW(e,t,{target:{kind:`Webview`,label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:EW(e,t,{target:{kind:`Webview`,label:this.label}})}async emit(e,t){if(uK.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return}return DW(e,t)}async emitTo(e,t,n){if(uK.includes(t)){for(let e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return}return OW(e,t,n)}_handleTauriEvent(e,t){return uK.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}async position(){return $(`plugin:webview|webview_position`,{label:this.label}).then(e=>new xW(e))}async size(){return $(`plugin:webview|webview_size`,{label:this.label}).then(e=>new vW(e))}async close(){return $(`plugin:webview|webview_close`,{label:this.label})}async setSize(e){return $(`plugin:webview|set_webview_size`,{label:this.label,value:e instanceof yW?e:new yW(e)})}async setPosition(e){return $(`plugin:webview|set_webview_position`,{label:this.label,value:e instanceof SW?e:new SW(e)})}async setFocus(){return $(`plugin:webview|set_webview_focus`,{label:this.label})}async setAutoResize(e){return $(`plugin:webview|set_webview_auto_resize`,{label:this.label,value:e})}async hide(){return $(`plugin:webview|webview_hide`,{label:this.label})}async show(){return $(`plugin:webview|webview_show`,{label:this.label})}async setZoom(e){return $(`plugin:webview|set_webview_zoom`,{label:this.label,value:e})}async reparent(e){return $(`plugin:webview|reparent`,{label:this.label,window:typeof e==`string`?e:e.label})}async clearAllBrowsingData(){return $(`plugin:webview|clear_all_browsing_data`)}async setBackgroundColor(e){return $(`plugin:webview|set_webview_background_color`,{color:e})}async onDragDropEvent(e){let t=await this.listen(CW.DRAG_ENTER,t=>{e({...t,payload:{type:`enter`,paths:t.payload.paths,position:new xW(t.payload.position)}})}),n=await this.listen(CW.DRAG_OVER,t=>{e({...t,payload:{type:`over`,position:new xW(t.payload.position)}})}),r=await this.listen(CW.DRAG_DROP,t=>{e({...t,payload:{type:`drop`,paths:t.payload.paths,position:new xW(t.payload.position)}})}),i=await this.listen(CW.DRAG_LEAVE,t=>{e({...t,payload:{type:`leave`}})});return()=>{t(),r(),n(),i()}}};function fK(e){return`'${e.replace(/'/g,`'\\''`)}'`}function pK(e){return`'${e.replace(/'/g,`''`)}'`}function mK(e,t){return t?pK(e):fK(e)}function hK(e,t){return e.map(e=>mK(e,t)).join(` `)}async function gK(e){if(!AB())return{dispose:()=>{}};try{let t=[],n=``,r=0,i=typeof navigator<`u`&&/Win/i.test(navigator.platform||``),a=t=>{let a=t.payload;if(!a||a.type!==`drop`)return;let o=a.paths;if(!o||o.length===0)return;let s=a.position;if(!s)return;let c=`${o.join(`\0`)}@${s.x},${s.y}`,l=Date.now();if(c===n&&l-r<250)return;n=c,r=l;let u=e();if(!u||!vK(s,u.viewportEl.getBoundingClientRect(),window.devicePixelRatio||1))return;let d=hK(o,i);try{u.writeText(d)}catch{}},o=_K((()=>{try{return cK()}catch{return null}})());o&&t.push(await o(a));let s=_K((()=>{try{return PW()}catch{return null}})());return s&&t.push(await s(a)),t.length===0?{dispose:()=>{}}:{dispose:()=>{for(let e of t)try{e()}catch{}}}}catch{return{dispose:()=>{}}}}function _K(e){let t=e?.onDragDropEvent;return typeof t==`function`?t.bind(e):null}function vK(e,t,n){if(yK(e.x,e.y,t))return!0;let r=Number.isFinite(n)&&n>0?n:1;return yK(e.x/r,e.y/r,t)}function yK(e,t,n){return e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom}function bK({x:e,y:t,label:n,onSelect:r,onClose:i}){let a=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&i()},t=e=>{e.key===`Escape`&&i()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,q.jsx)(`div`,{ref:a,role:`menu`,"data-shortcut-context-menu":!0,style:{position:`fixed`,left:typeof window<`u`&&e+220>window.innerWidth?e-220:e,top:typeof window<`u`&&t+60>window.innerHeight?t-60:t,minWidth:200},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:(0,q.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(),i()},className:`w-full text-left px-3 py-1.5 text-[#f8f8f2] hover:bg-[#44475a]`,children:n})})}function xK({x:e,y:t,providers:n,onSelect:r,onClose:i}){let{t:a}=G(`terminal`),o=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i()},t=e=>{e.key===`Escape`&&i()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=typeof window<`u`&&e+200>window.innerWidth?e-200:e,c=8+n.length*32;return(0,q.jsx)(`div`,{ref:o,role:`menu`,"data-cli-launch-menu":!0,style:{position:`fixed`,left:s,top:typeof window<`u`&&t+c>window.innerHeight?t-c:t,minWidth:180},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:n.map(e=>(0,q.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(e),i()},className:`w-full text-left px-3 py-1.5 text-[#f8f8f2] hover:bg-[#44475a]`,children:a(`cliMenu.open`,{name:QE(e)})},e))})}var SK=(0,I.forwardRef)(function({isOpen:e,className:t,...n},r){let{t:i}=G(`terminal`);return(0,q.jsx)(`button`,{ref:r,type:`button`,"aria-label":i(e?`panelChevron.collapse`:`panelChevron.expand`),"aria-expanded":e,className:X(`panel-chevron`,`inline-flex items-center justify-center`,`h-5 w-6 mr-1.5`,`rounded text-muted-foreground`,`hover:bg-border/40 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent-primary/60`,`transition-colors duration-120`,t),...n,children:(0,q.jsxs)(`svg`,{width:`14`,height:`10`,viewBox:`0 0 14 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,q.jsx)(`rect`,{x:`1`,y:`1`,width:`12`,height:`8`,rx:`1.5`}),e?(0,q.jsx)(`path`,{d:`M5 3.5 L7 5.5 L9 3.5`}):(0,q.jsx)(`path`,{d:`M5 6.5 L7 4.5 L9 6.5`})]})})});function CK({visibility:e,canCreate:t,hasActive:n,provider:r=`claude`,providers:i,onCreate:a,onOpenCli:o,onOpenBrowser:s,onPasteScript:c,pasteScriptDisabled:l,onConfigureBrowser:u,onConfigureScript:d,onKillActive:f,onToggleMaximize:p,onCollapse:m}){let{t:h}=G(`terminal`),g=!!i&&i.length>1,_=r===`codex`?`Codex`:`Claude`,v=h(`topBar.maxTerminals`,{max:10}),y=t?g?h(`topBar.openCliMulti`):h(`topBar.openCli`,{cli:_}):v;return(0,q.jsxs)(`div`,{className:X(`flex items-center justify-between h-7 px-2 shrink-0`,`bg-background/95 backdrop-blur-sm`,`border-b border-border/40`,`text-[10px] uppercase tracking-wide text-muted-foreground select-none`),children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2 pl-1`,children:(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:h(`topBar.title`)})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,q.jsx)(wK,{label:y,disabled:!t,onClick:e=>o(e?{x:e.clientX,y:e.clientY}:void 0),children:(0,q.jsx)(Mp,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(wK,{label:h(`topBar.openInBrowser`),onClick:s,onContextMenu:e=>{e.preventDefault(),u({x:e.clientX,y:e.clientY})},children:(0,q.jsx)(Rf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(wK,{label:h(l?`topBar.pasteScriptNoActive`:`topBar.pasteScript`),disabled:l,onClick:c,onContextMenu:e=>{e.preventDefault(),d({x:e.clientX,y:e.clientY})},children:(0,q.jsx)(hf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(wK,{label:t?h(`topBar.newTerminal`):v,disabled:!t,onClick:a,children:(0,q.jsx)(pp,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(wK,{label:h(`topBar.killActive`),disabled:!n,onClick:f,children:(0,q.jsx)(Vp,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(wK,{label:h(e===`maximized`?`topBar.restorePanel`:`topBar.maximizePanel`),onClick:p,children:e===`maximized`?(0,q.jsx)(ep,{className:`h-3.5 w-3.5`}):(0,q.jsx)(Zf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(SK,{isOpen:!0,onClick:m})]})]})}function wK({label:e,disabled:t,onClick:n,onContextMenu:r,children:i}){return(0,q.jsx)(`button`,{type:`button`,onClick:e=>n(e),onContextMenu:r,disabled:t,title:e,"aria-label":e,className:X(`inline-flex items-center justify-center h-5 w-6 rounded`,`text-muted-foreground transition-colors duration-120`,t?`opacity-40 cursor-not-allowed`:`hover:bg-border/40 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent-primary/60`),children:i})}function TK({sessions:e,activeId:t,onActivate:n,onRename:r,onKill:i}){return(0,q.jsx)(`aside`,{className:X(`w-44 shrink-0 border-l border-border/40 bg-background/70`,`overflow-y-auto`),children:(0,q.jsx)(`ul`,{className:`py-1`,children:e.map(e=>(0,q.jsx)(EK,{session:e,active:e.id===t,onActivate:()=>n(e.id),onRename:t=>r(e.id,t),onKill:()=>i(e.id)},e.id))})})}function EK({session:e,active:t,onActivate:n,onRename:r,onKill:i}){let{t:a}=G(`terminal`),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(e.name),u=(0,I.useRef)(null);(0,I.useEffect)(()=>{o&&(l(e.name),queueMicrotask(()=>{u.current?.focus(),u.current?.select()}))},[o,e.name]);function d(){let t=c.trim();t&&t!==e.name&&r(t),s(!1)}function f(){s(!0)}function p(){s(!1),l(e.name)}return(0,q.jsx)(`li`,{className:`relative group px-1`,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":t,onClick:()=>{o||n()},onKeyDown:e=>{o||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},onDoubleClick:f,className:X(`flex items-center gap-2 px-2 py-1.5 rounded-md text-xs cursor-pointer select-none`,`transition-colors duration-120`,t?`bg-border/40 text-foreground border-l-2 border-accent-primary/70 pl-[calc(0.5rem-2px)]`:`text-muted-foreground hover:bg-border/20 hover:text-foreground`),children:[(0,q.jsx)(Rp,{className:`h-3 w-3 shrink-0`}),o?(0,q.jsx)(`input`,{ref:u,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d()),e.key===`Escape`&&(e.preventDefault(),p())},onBlur:d,onClick:e=>e.stopPropagation(),maxLength:64,className:X(`flex-1 min-w-0 bg-background/60 border border-border/40 rounded px-1`,`text-xs text-foreground outline-none focus:ring-1 focus:ring-accent-primary/60`)}):(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),!o&&(0,q.jsx)(`button`,{type:`button`,"aria-label":a(`sidebar.rename`,{name:e.name}),title:a(`sidebar.rename`,{name:e.name}),onClick:e=>{e.stopPropagation(),f()},className:X(`inline-flex items-center justify-center h-4 w-4 rounded`,`text-muted-foreground opacity-0 group-hover:opacity-100`,`hover:bg-border/40 hover:text-foreground`,`transition-opacity duration-120`,t&&`opacity-70`),children:(0,q.jsx)(lp,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,"aria-label":a(`sidebar.close`,{name:e.name}),title:a(`sidebar.close`,{name:e.name}),onClick:e=>{e.stopPropagation(),i()},className:X(`inline-flex items-center justify-center h-4 w-4 rounded`,`text-muted-foreground opacity-0 group-hover:opacity-100`,`hover:bg-destructive/20 hover:text-destructive`,`transition-opacity duration-120`,t&&`opacity-70`),children:(0,q.jsx)(qp,{className:`h-3 w-3`})})]})})}function DK({search:e,onClose:t}){let{t:n}=G(`terminal`),r=(0,I.useRef)(null),[i,a]=(0,I.useState)(``),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(!1),[u,d]=(0,I.useState)(!1),[f,p]=(0,I.useState)(null);(0,I.useEffect)(()=>(r.current?.focus(),()=>{try{e.clearDecorations()}catch{}}),[e]),(0,I.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);function m(){return{caseSensitive:o,regex:c,wholeWord:u,decorations:{matchBackground:`#bd93f9`,matchOverviewRuler:`#bd93f9`,activeMatchBackground:`#ff79c6`,activeMatchColorOverviewRuler:`#ff79c6`}}}function h(){if(i)try{e.findNext(i,m())}catch{}}function g(){if(i)try{e.findPrevious(i,m())}catch{}}return(0,I.useEffect)(()=>{let t=()=>{};try{let n=e.onDidChangeResults(e=>{if(!e){p(null);return}p({current:e.resultIndex+1,total:e.resultCount})});t=()=>{try{n.dispose()}catch{}}}catch{}return t},[e]),(0,q.jsxs)(`div`,{className:`absolute top-2 right-2 flex items-center gap-1 bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg px-2 py-1 z-30`,role:`search`,"data-terminal-search-overlay":!0,children:[(0,q.jsx)(`input`,{ref:r,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.shiftKey?g():h())},placeholder:n(`search.placeholder`),className:`bg-transparent text-sm outline-none text-[#f8f8f2] placeholder:text-[#6272a4] w-48`}),f&&(0,q.jsxs)(`span`,{className:`text-xs text-[#6272a4] tabular-nums`,children:[f.current,`/`,f.total]}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.previous`),onClick:g,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(sf,{size:14})}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.next`),onClick:h,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(rf,{size:14})}),(0,q.jsx)(OK,{label:`Aa`,title:n(`search.matchCase`),active:o,onToggle:()=>s(e=>!e)}),(0,q.jsx)(OK,{label:`.*`,title:n(`search.regex`),active:c,onToggle:()=>l(e=>!e)}),(0,q.jsx)(OK,{label:`W`,title:n(`search.wholeWord`),active:u,onToggle:()=>d(e=>!e)}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.close`),onClick:t,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(qp,{size:14})})]})}function OK({label:e,title:t,active:n,onToggle:r}){return(0,q.jsx)(`button`,{type:`button`,title:t,onClick:r,className:`text-xs px-1.5 py-0.5 rounded font-mono ${n?`bg-[#6272a4] text-white`:`text-[#f8f8f2] hover:bg-[#44475a]`}`,children:e})}function kK({x:e,y:t,term:n,cwd:r,hasReveal:i,onClose:a,onOpenSearch:o,onReveal:s,onSaveScrollback:c}){let{t:l}=G(`terminal`),u=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&a()},t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let d=typeof window<`u`&&e+220>window.innerWidth?e-220:e,f=typeof window<`u`&&t+260>window.innerHeight?t-260:t,p=n.getSelection(),m=p.length>0;function h(){m&&(UG(p),a())}function g(){HG().then(e=>{if(e)try{n.paste(e)}catch{}}),a()}function _(){try{n.selectAll()}catch{}a()}function v(){try{n.clear()}catch{}a()}function y(){o(),a()}function b(){c(),a()}function x(){r&&s(r),a()}return(0,q.jsxs)(`div`,{ref:u,role:`menu`,"data-terminal-context-menu":!0,style:{position:`fixed`,left:d,top:f,minWidth:200},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:[(0,q.jsx)(AK,{onClick:h,disabled:!m,label:l(`common:actions.copy`),shortcut:`⌘C`}),(0,q.jsx)(AK,{onClick:g,label:l(`contextMenu.paste`),shortcut:`⌘V`}),(0,q.jsx)(AK,{onClick:_,label:l(`contextMenu.selectAll`),shortcut:`⌘A`}),(0,q.jsx)(jK,{}),(0,q.jsx)(AK,{onClick:v,label:l(`contextMenu.clear`),shortcut:`⌘K`}),(0,q.jsx)(AK,{onClick:y,label:l(`contextMenu.search`),shortcut:`⌘F`}),(0,q.jsx)(AK,{onClick:b,label:l(`contextMenu.saveScrollback`)}),r&&i&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(jK,{}),(0,q.jsx)(AK,{onClick:x,label:l(`contextMenu.openPath`,{path:MK(r,40)})})]})]})}function AK({onClick:e,label:t,shortcut:n,disabled:r}){return(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r||e()},disabled:r,className:`w-full text-left px-3 py-1.5 flex justify-between items-center ${r?`text-[#6272a4] cursor-not-allowed`:`text-[#f8f8f2] hover:bg-[#44475a]`}`,children:[(0,q.jsx)(`span`,{children:t}),n&&(0,q.jsx)(`span`,{className:`text-xs text-[#6272a4] tabular-nums`,children:n})]})}function jK(){return(0,q.jsx)(`div`,{className:`my-1 border-t border-[#44475a]`})}function MK(e,t){return e.length<=t?e:`…`+e.slice(e.length-t+1)}async function NK(e,t=`terminal-scrollback.txt`){let n=e.buffer.active,i=[];for(let e=0;e<n.length;e++){let t=n.getLine(e);t&&i.push(t.translateToString(!0))}let a=i.join(`
|
|
122
|
+
`);if(AB())try{let e=await(await r(()=>import(`./dist-js-CvScGQU_.js`),[])).save({defaultPath:t});if(!e)return;try{let t=await jB(`@tauri-apps/plugin-fs`);if(t?.writeTextFile){await t.writeTextFile(e,a);return}}catch{}try{await(await jB(`@tauri-apps/api/fs`))?.writeTextFile?.({path:e,contents:a})}catch{}return}catch{}try{let e=new Blob([a],{type:`text/plain;charset=utf-8`}),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch{}}function PK({sessionId:e}){let[t,n]=(0,I.useState)(()=>MG(e));return(0,I.useEffect)(()=>jG(e,n),[e]),t.promptRows.length===0?null:(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-prompt-gutter":!0,className:`absolute left-0 top-0 bottom-0 w-1 pointer-events-none z-10`,children:(0,q.jsx)(`div`,{className:`absolute top-0 left-0 bottom-0 w-full`,style:{backgroundImage:`linear-gradient(to bottom, rgba(189,147,249,0.2), rgba(189,147,249,0.05))`}})})}function FK({sessionId:e}){let{t}=G(`terminal`),[n,r]=(0,I.useState)(MG(e).openPreExec?.startedAt??null),[i,a]=(0,I.useState)(Date.now());if((0,I.useEffect)(()=>jG(e,e=>r(e.openPreExec?.startedAt??null)),[e]),(0,I.useEffect)(()=>{if(n==null)return;let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[n]),n==null)return null;let o=i-n;return o<500?null:(0,q.jsx)(`div`,{className:`absolute top-2 left-2 px-2 py-0.5 rounded text-xs font-mono bg-[#44475a] text-[#f8f8f2] z-10 pointer-events-none`,children:IK(o,t)})}function IK(e,t){return e<6e4?t(`terminal:duration.seconds`,{seconds:(e/1e3).toFixed(1)}):t(`terminal:duration.minutesSeconds`,{minutes:Math.floor(e/6e4),seconds:Math.floor(e%6e4/1e3)})}function LK({activeId:e}){let t=(0,I.useRef)(null),n=QG(),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(null),s=AB();(0,I.useEffect)(()=>{if(e)return n.subscribeOpenSearch(e,()=>i(!0))},[e,n]),(0,I.useEffect)(()=>{i(!1),o(null)},[e]);let c=e?n.getSearchAddon(e):null,l=e?n.getTerminalInstance(e):null,u=e?n.getCwd(e):null,[d,f]=(0,I.useState)(!1),p=(0,I.useCallback)(t=>{if(!t)return!1;if(e&&n.writeToSession(e,t))return!0;if(!l)return!1;try{return l.paste(t),!0}catch{return!1}},[e,n,l]),m=(0,I.useCallback)(e=>{if(!l||!e||e.length===0)return!1;let t=Array.from(e).map(e=>RK(e)).filter(e=>!!e);return t.length===0?!1:p(hK(t,typeof navigator<`u`&&/Win/i.test(navigator.platform||``)))},[l,p]),h=(0,I.useCallback)(e=>{if(e.preventDefault(),!e.shiftKey&&l){let e=l.modes?.mouseTrackingMode;if(e&&e!==`none`)return}o({x:e.clientX,y:e.clientY})},[l]),g=(0,I.useCallback)(e=>{if(!l)return;if(e.clipboardData.files&&e.clipboardData.files.length>0){let t=Array.from(e.clipboardData.files).map(e=>RK(e)).filter(e=>!!e);if(t.length>0){e.preventDefault(),e.stopPropagation(),p(hK(t,typeof navigator<`u`&&/Win/i.test(navigator.platform||``)));return}}let t=e.clipboardData.getData(`text/plain`);t&&(e.preventDefault(),e.stopPropagation(),p(t))},[l,p]),_=(0,I.useCallback)(e=>{if(!l)return;let t=l.getSelection();t&&(e.clipboardData.setData(`text/plain`,t),e.preventDefault(),e.stopPropagation())},[l]),v=(0,I.useCallback)(e=>{if(l&&(typeof navigator<`u`&&/Mac/i.test(navigator.platform||``)?e.metaKey:e.ctrlKey)&&(e.key===`c`||e.key===`C`)){let t=l.getSelection();if(!t)return;e.preventDefault(),e.stopPropagation(),UG(t)}},[l]);return(0,I.useEffect)(()=>{let r=t.current;if(!r||!e)return;let i=n.getContainer(e);if(i)return r.appendChild(i),n.notifyAdopted(e),()=>{let e=document.getElementById(`specrails-terminal-host`);e&&i.parentElement===r&&e.appendChild(i)}},[e,n]),(0,I.useEffect)(()=>{let r=t.current;if(!r||!e)return;let i=[],a=r.parentElement;for(;a&&a!==document.body;)(a.tagName.toLowerCase()===`aside`||a.matches(`[data-sidebar]`))&&i.push(a),a=a.parentElement;if(i.length===0)return;let o=t=>{let r=t;r.propertyName!==`width`&&r.propertyName!==`height`||n.refitActive(e)};return i.forEach(e=>e.addEventListener(`transitionend`,o)),()=>{i.forEach(e=>e.removeEventListener(`transitionend`,o))}},[e,n]),(0,q.jsxs)(`div`,{ref:t,className:`flex-1 min-w-0 bg-background px-2 py-1 relative ${d?`outline outline-2 outline-accent-primary outline-offset-[-2px]`:``}`,role:`presentation`,"data-terminal-viewport":!0,onContextMenu:h,onPasteCapture:g,onCopyCapture:_,onKeyDownCapture:v,tabIndex:-1,onDragEnter:e=>{zK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),f(!0))},onDragOver:e=>{zK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),f(!0))},onDragLeave:()=>f(!1),onDrop:e=>{zK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),m(e.dataTransfer.files)),f(!1)},children:[e&&(0,q.jsx)(PK,{sessionId:e}),e&&(0,q.jsx)(FK,{sessionId:e}),r&&c&&(0,q.jsx)(DK,{search:c,onClose:()=>i(!1)}),a&&l&&(0,q.jsx)(kK,{x:a.x,y:a.y,term:l,cwd:u,hasReveal:s,onClose:()=>o(null),onOpenSearch:()=>i(!0),onReveal:e=>{MB(e)},onSaveScrollback:()=>{l&&NK(l)}})]})}function RK(e){let t=e.path;return typeof t==`string`&&t.length>0?t:null}function zK(e){return e?Array.from(e.types).includes(`Files`):!1}function BK({height:e,maxHeight:t,onHeightCommit:n,onHeightPreview:r,minHeight:i=120}){let{t:a}=G(`terminal`),o=(0,I.useRef)(!1),s=(0,I.useRef)(0),c=(0,I.useRef)(e),l=(0,I.useRef)(!1),u=(0,I.useRef)(e),d=(0,I.useCallback)(e=>e<i?i:e>t?t:Math.round(e),[i,t]);(0,I.useEffect)(()=>{function e(e){if(!o.current)return;let t=s.current-e.clientY;u.current=d(c.current+t),l.current||(l.current=!0,requestAnimationFrame(()=>{l.current=!1,r?.(u.current)}))}function t(){o.current&&(o.current=!1,document.body.style.userSelect=``,document.body.style.cursor=``,n(u.current))}return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[d,n,r]);function f(t){o.current=!0,s.current=t.clientY,c.current=e,u.current=e,document.body.style.userSelect=`none`,document.body.style.cursor=`row-resize`;let n=t.target;if(typeof n.setPointerCapture==`function`)try{n.setPointerCapture(t.pointerId)}catch{}}return(0,q.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a(`dragHandle.resize`),onPointerDown:f,className:X(`absolute top-0 left-0 right-0 h-1`,`cursor-row-resize`,`bg-transparent hover:bg-accent-primary/40`,`transition-colors duration-120`,`z-10`)})}function VK({onCreate:e}){let{t}=G(`terminal`);return(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-center px-6 bg-background-deep`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,q.jsx)(Rp,{className:`h-8 w-8 opacity-50`}),(0,q.jsx)(`p`,{className:`text-xs`,children:t(`emptyState.noTerminals`)}),(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs bg-border/30 hover:bg-border/50 hover:text-foreground transition-colors`,children:[(0,q.jsx)(pp,{className:`h-3 w-3`}),` `,t(`emptyState.newTerminal`)]})]})})}function HK({projectId:e,provider:t=`claude`,providers:n,state:r,viewportHeight:i,statusBarHeight:a}){let o=QG(),{t:s}=G(`terminal`),c=ct(),l=(0,I.useRef)(null),[u,d]=(0,I.useState)(null),[f,p]=(0,I.useState)(vH),[m,h]=(0,I.useState)(null),[g,_]=(0,I.useState)(null),v=n&&n.length>0?n:[t],y=v.length>1,b=(0,I.useCallback)(async(t=()=>!1)=>{try{let n=await fetch(`/api/projects/${e}/terminal-settings`);if(!n.ok)return;let r=await n.json();!t()&&r?.resolved&&p(r.resolved)}catch{}},[e]);(0,I.useEffect)(()=>{let e=!1;return b(()=>e),()=>{e=!0}},[b]),(0,I.useEffect)(()=>{let t=t=>{let n=t.detail;n?.mode===`project`&&n.projectId!==e||b()};return window.addEventListener(bH,t),()=>window.removeEventListener(bH,t)},[b,e]);let x=Math.max(120,i-a-40),S=Math.min(Math.max(r.userHeight||320,120),x),C=r.visibility===`maximized`?Math.max(120,i-a):u??S,w=r.sessions.length<10,T=r.activeId!==null;(0,I.useEffect)(()=>{let e=!1,t=null;return gK(()=>{let e=l.current,t=r.activeId;return!e||!t||r.visibility===`hidden`?null:{viewportEl:e,writeText:e=>{if(o.writeToSession(t,e))return!0;let n=o.getTerminalInstance(t);try{return n?.paste(e),!!n}catch{return!1}}}}).then(n=>{e?n.dispose():t=n}),()=>{e=!0,t?.dispose()}},[r.activeId,r.visibility,o]);let E=(0,I.useCallback)(()=>{w&&o.create(e)},[w,e,o]),D=(0,I.useCallback)(t=>{if(!w)return;let n=t===`codex`?`codex`:`claude`,i=RegExp(`^${n} \\(\\d+\\)$`),a=r.sessions.filter(e=>e.name===n||i.test(e.name)),s=a.length===0?n:`${n} (${a.length+1})`;o.createAndType(e,`${n}\n`,{name:s})},[w,e,r.sessions,o]),O=(0,I.useCallback)(e=>{if(w){if(y&&e){_(e);return}D(t===`codex`?`codex`:`claude`)}},[w,y,t,D]),k=(0,I.useCallback)(()=>{NB(f.browserShortcutUrl)},[f.browserShortcutUrl]),A=(0,I.useCallback)(()=>{r.activeId&&f.quickScript&&o.writeToSession(r.activeId,f.quickScript)},[f.quickScript,r.activeId,o]),j=(0,I.useCallback)(e=>{h({...e,kind:`browser`})},[]),M=(0,I.useCallback)(e=>{h({...e,kind:`script`})},[]),N=(0,I.useCallback)(e=>{c(`/settings${e===`browser`?`#terminal-browser-shortcut-url`:`#terminal-quick-script`}`)},[c]),P=(0,I.useCallback)(()=>{r.activeId&&o.kill(e,r.activeId)},[e,r.activeId,o]),F=(0,I.useCallback)(()=>{o.setVisibility(e,r.visibility===`maximized`?`restored`:`maximized`)},[e,r.visibility,o]),L=(0,I.useCallback)(()=>{o.setVisibility(e,`hidden`)},[e,o]);return(0,I.useEffect)(()=>{d(null)},[r.visibility]),r.visibility===`hidden`?null:(0,q.jsxs)(`div`,{ref:l,className:X(`relative flex flex-col shrink-0 bg-background/95`,`border-t border-border/40`),style:{height:C},"data-testid":`terminal-bottom-panel`,children:[(0,q.jsx)(BK,{height:S,maxHeight:x,onHeightPreview:e=>d(e),onHeightCommit:t=>{d(null),o.setUserHeight(e,t),r.visibility===`maximized`&&o.setVisibility(e,`restored`)}}),(0,q.jsx)(CK,{visibility:r.visibility,canCreate:w,hasActive:T,provider:t,providers:v,onCreate:E,onOpenCli:O,onOpenBrowser:k,onPasteScript:A,pasteScriptDisabled:!T||!f.quickScript,onConfigureBrowser:j,onConfigureScript:M,onKillActive:P,onToggleMaximize:F,onCollapse:L}),m&&(0,q.jsx)(bK,{x:m.x,y:m.y,label:m.kind===`browser`?s(`shortcutMenu.configureBrowserUrl`):s(`shortcutMenu.editQuickScript`),onSelect:()=>N(m.kind),onClose:()=>h(null)}),g&&(0,q.jsx)(xK,{x:g.x,y:g.y,providers:v,onSelect:e=>D(e),onClose:()=>_(null)}),(0,q.jsx)(`div`,{className:`flex-1 flex min-h-0`,children:r.sessions.length===0?(0,q.jsx)(VK,{onCreate:E}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(LK,{activeId:r.activeId}),(0,q.jsx)(TK,{sessions:r.sessions,activeId:r.activeId,onActivate:t=>o.setActive(e,t),onRename:(t,n)=>void o.rename(e,t,n),onKill:t=>void o.kill(e,t)})]})})]})}var UK=28;function WK({project:e}){let{t}=G(`nav`),{connectionStatus:n}=hG(),r=dR(),{registerHandler:i,unregisterHandler:a}=xl(),[o,s]=(0,I.useState)(null),c=(0,I.useRef)(e.id);c.current=e.id,(0,I.useEffect)(()=>{let n=`cost-alerts-${e.id}`;return i(n,e=>{let n=e;n.projectId!==void 0&&n.projectId!==``&&n.projectId!==c.current||(n.type===`cost_alert`?K.warning(t(`costAlerts.costAlertTitle`),{description:t(`costAlerts.costAlertDescription`,{cost:(n.cost??0).toFixed(4),threshold:(n.threshold??0).toFixed(2)})}):n.type===`daily_budget_exceeded`?(K.error(t(`costAlerts.dailyBudgetTitle`),{description:t(`costAlerts.dailyBudgetDescription`,{spent:(n.dailySpend??0).toFixed(2),budget:(n.budget??0).toFixed(2)}),duration:1/0}),s({dailySpend:n.dailySpend??0,budget:n.budget??0})):n.type===`desktop_daily_budget_exceeded`&&K.error(t(`costAlerts.desktopBudgetTitle`),{description:t(`costAlerts.desktopBudgetDescription`,{spent:(n.desktopDailySpend??0).toFixed(2),budget:(n.desktopBudget??0).toFixed(2)}),duration:1/0}))}),()=>a(n)},[e.id,i,a,t]);let l=QG(),u=$G(e.id),d=(0,I.useRef)(null),[f,p]=(0,I.useState)(typeof window<`u`?window.innerHeight:820);(0,I.useLayoutEffect)(()=>{if(!$y)return;let e=d.current;if(!e)return;let t=()=>p(e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,I.useEffect)(()=>{$y&&l.ensureProject(e.id)},[e.id,l]);let m=$y&&u.visibility===`hidden`?(0,q.jsx)(SK,{isOpen:!1,onClick:()=>l.setVisibility(e.id,`restored`)}):null;return(0,q.jsx)(YT,{delayDuration:400,children:(0,q.jsx)(lR.Provider,{value:r,children:(0,q.jsxs)(`div`,{ref:d,className:`flex flex-col h-full overflow-hidden`,children:[o&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-destructive/10 border-b border-destructive/20 text-xs`,children:[(0,q.jsx)(`span`,{className:`text-destructive font-medium`,children:t(`costAlerts.bannerMessage`,{spent:o.dailySpend.toFixed(2),budget:o.budget.toFixed(2)})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`text-muted-foreground hover:text-foreground ml-4 shrink-0`,children:t(`costAlerts.dismiss`)})]}),(0,q.jsxs)(`div`,{className:`flex flex-1 overflow-hidden min-h-0`,children:[(0,q.jsx)(`main`,{className:`flex-1 overflow-auto`,children:(0,q.jsx)(Lt,{})}),!1]}),$y&&(0,q.jsx)(HK,{projectId:e.id,provider:e.provider,providers:hd(e),state:u,viewportHeight:f,statusBarHeight:UK}),(0,q.jsx)(pG,{connectionStatus:n,rightSlot:m})]})})})}function GK({projectName:e,errorMessage:t,onRetry:n}){let{t:r}=G(`nav`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 p-8`,children:[(0,q.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:r(`errorBoundary.title`)}),e&&(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,q.jsx)(Bi,{ns:`nav`,i18nKey:`errorBoundary.occurredIn`,values:{name:e},components:{strong:(0,q.jsx)(`span`,{className:`font-medium`})}})}),t&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/60 font-mono`,children:t})]}),(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,children:[(0,q.jsx)(yp,{className:`w-3.5 h-3.5`}),r(`common:actions.retry`)]})]})}var KK=class extends I.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[ProjectErrorBoundary]`,e,t.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?(0,q.jsx)(GK,{projectName:this.props.projectName,errorMessage:this.state.error?.message??null,onRetry:this.handleRetry}):this.props.children}};function qK({onAddProject:e}){let{t}=G(`setup`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full min-h-[400px] gap-6 px-8 text-center`,children:[(0,q.jsx)(`div`,{className:`w-14 h-14 rounded-2xl bg-muted/50 flex items-center justify-center`,children:(0,q.jsx)(Rp,{className:`w-7 h-7 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,q.jsx)(Bi,{t,i18nKey:`welcome.title`,components:{spec:(0,q.jsx)(`span`,{className:`text-accent-primary`}),rails:(0,q.jsx)(`span`,{className:`text-accent-secondary`})}})}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-sm`,children:t(`welcome.description`)}),nb&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/80 max-w-sm`,children:t(`welcome.jiraHint`)})]}),(0,q.jsxs)(Z,{onClick:e,size:`sm`,className:`gap-2`,children:[(0,q.jsx)(Nf,{className:`w-3.5 h-3.5`}),t(`welcome.addFirstProject`)]})]})}var JK=[{id:`sr-architect`,name:`Architect`,description:`Architecture design, change specs, implementation planning`,category:`Architecture`},{id:`sr-developer`,name:`Developer`,description:`Full-stack implementation across all layers`,category:`Development`},{id:`sr-frontend-developer`,name:`Frontend Dev`,description:`Frontend implementation (React, Vue, Angular, etc.)`,category:`Development`},{id:`sr-backend-developer`,name:`Backend Dev`,description:`Backend specialization (APIs, databases, services)`,category:`Development`},{id:`sr-reviewer`,name:`Reviewer`,description:`General code review — the final quality gate`,category:`Review`},{id:`sr-frontend-reviewer`,name:`Frontend Reviewer`,description:`Frontend review (UI, accessibility, performance)`,category:`Review`},{id:`sr-backend-reviewer`,name:`Backend Reviewer`,description:`Backend review (APIs, security, scalability)`,category:`Review`},{id:`sr-security-reviewer`,name:`Security Reviewer`,description:`Security analysis — OWASP, vulnerabilities, hardening`,category:`Review`},{id:`sr-performance-reviewer`,name:`Perf Reviewer`,description:`Performance analysis — profiling, bottlenecks, optimization`,category:`Review`},{id:`sr-product-manager`,name:`Product Manager`,description:`Product discovery, VPC personas, backlog management`,category:`Product`},{id:`sr-product-analyst`,name:`Product Analyst`,description:`Backlog analysis, spec gap analysis, reporting`,category:`Product`},{id:`sr-test-writer`,name:`Test Writer`,description:`Comprehensive test generation (unit, integration, E2E)`,category:`Utilities`},{id:`sr-doc-sync`,name:`Doc Sync`,description:`Documentation sync — keeps docs aligned with code`,category:`Utilities`},{id:`sr-merge-resolver`,name:`Merge Resolver`,description:`Merge conflict resolution with context awareness`,category:`Utilities`}],YK=new Set([`sr-architect`,`sr-developer`,`sr-reviewer`]),XK=new Set([...YK]),ZK=[`Architecture`,`Development`,`Review`,`Product`,`Utilities`],QK={Architecture:`text-accent-success`,Development:`text-accent-primary`,Review:`text-accent-info`,Product:`text-accent-secondary`,Utilities:`text-accent-warning`};function $K({selected:e,onChange:t}){let{t:n}=G(`agentstudio`),r=new Set(e);function i(e){if(YK.has(e))return;let n=new Set(r);n.has(e)?n.delete(e):n.add(e),t(Array.from(n))}function a(e){let n=JK.filter(t=>t.category===e).map(e=>e.id).filter(e=>!YK.has(e));if(n.length===0)return;let i=n.every(e=>r.has(e)),a=new Set(r);i?n.forEach(e=>a.delete(e)):n.forEach(e=>a.add(e)),t(Array.from(a))}function o(){t(JK.map(e=>e.id))}function s(){t([...YK])}return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:n(`agentSelector.selectedCount`,{selected:e.length,total:JK.length})}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`button`,{onClick:o,className:`text-[10px] text-accent-primary hover:underline`,children:n(`agentSelector.selectAll`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`·`}),(0,q.jsx)(`button`,{onClick:s,className:`text-[10px] text-muted-foreground hover:underline`,children:n(`common:states.none`)})]})]}),(0,q.jsx)(`div`,{className:`space-y-4`,children:ZK.map(e=>{let t=JK.filter(t=>t.category===e),o=t.every(e=>r.has(e.id)),s=t.some(e=>r.has(e.id));return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`button`,{onClick:()=>a(e),className:`flex items-center gap-2 mb-2 w-full text-left group`,children:[(0,q.jsx)(`div`,{className:X(`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors`,o?`bg-accent-primary border-accent-primary`:s?`bg-accent-primary/40 border-accent-primary/60`:`border-border/60 group-hover:border-accent-primary/40`),children:(o||s)&&(0,q.jsx)(nf,{className:X(`w-2.5 h-2.5`,o?`text-background`:`text-accent-primary`)})}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-semibold uppercase tracking-wider`,QK[e]),children:n(`agentSelector.categories.${e.toLowerCase()}`)})]}),(0,q.jsx)(`div`,{className:`space-y-1 pl-1`,children:t.map(e=>{let t=YK.has(e.id),a=t||r.has(e.id);return(0,q.jsxs)(`button`,{onClick:()=>i(e.id),disabled:t,className:X(`flex items-start gap-2.5 w-full text-left rounded-md px-2 py-1.5 transition-colors`,t?`bg-accent-primary/10 cursor-default`:a?`bg-accent-primary/10 hover:bg-accent-primary/15`:`hover:bg-muted/30`),children:[(0,q.jsx)(`div`,{className:X(`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 mt-0.5 transition-colors`,a?`bg-accent-primary border-accent-primary`:`border-border/60 hover:border-accent-primary/40`),children:a&&(0,q.jsx)(nf,{className:`w-2.5 h-2.5 text-background`})}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:X(`text-xs font-medium`,a?`text-foreground`:`text-foreground/80`),children:n(`agentSelector.agents.${e.id}.name`,{defaultValue:e.name})}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground/60 font-mono truncate`,children:e.id}),t&&(0,q.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-accent-warning/80`,children:[(0,q.jsx)(Xf,{className:`w-2.5 h-2.5`}),n(`agentSelector.coreBadge`)]})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground leading-tight mt-0.5`,children:n(`agentSelector.agents.${e.id}.description`,{defaultValue:e.description})})]})]},e.id)})})]},e)})})]})}var eq=[{value:`sonnet`,label:`Claude Sonnet`},{value:`opus`,label:`Claude Opus`},{value:`haiku`,label:`Claude Haiku`}],tq=[{value:`gpt-5.5`,label:`GPT-5.5`},{value:`gpt-5.4`,label:`GPT-5.4`},{value:`gpt-5.4-mini`,label:`GPT-5.4 Mini`},{value:`gpt-5.3-codex`,label:`GPT-5.3 Codex`}],nq={balanced:{claude:`sonnet`,codex:`gpt-5.5`},budget:{claude:`haiku`,codex:`gpt-5.4-mini`},max:{claude:`sonnet`,codex:`gpt-5.5`}},rq={"sr-architect":{claude:`opus`,codex:`gpt-5.3-codex`},"sr-product-manager":{claude:`opus`,codex:`gpt-5.3-codex`}};function iq(e,t,n){return t===`max`&&rq[e]?rq[e][n]:nq[t][n]}function aq({agents:e,provider:t,preset:n,overrides:r,onPresetChange:i,onOverrideChange:a}){let{t:o}=G(`addspec`),s=t===`claude`?eq:tq;function c(e){return r[e]??iq(e,n,t)}function l(e){return e in r}function u(e){a(e,``)}return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-xs font-medium mb-2`,children:o(`modelSelector.presetHeading`)}),(0,q.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[`balanced`,`budget`,`max`].map(e=>(0,q.jsxs)(`button`,{onClick:()=>i(e),className:X(`flex flex-col items-center gap-1 rounded-md border px-3 py-2.5 text-left transition-colors`,`focus:outline-none focus-visible:ring-1 focus-visible:ring-ring`,n===e?`border-accent-primary bg-accent-primary/10`:`border-border/30 hover:border-border/60`),children:[(0,q.jsx)(`span`,{className:X(`text-xs font-semibold`,n===e?`text-accent-primary`:`text-foreground/80`),children:o(`modelSelector.preset.${e}.label`)}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground text-center leading-tight`,children:o(`modelSelector.preset.${e}.description`)})]},e))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:o(`modelSelector.overridesHeading`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:o(`modelSelector.overriddenCount`,{count:Object.keys(r).length})})]}),(0,q.jsx)(`div`,{className:`space-y-1.5 max-h-64 overflow-y-auto pr-1`,children:e.map(e=>{let t=c(e.id),n=l(e.id);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted/20`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsx)(`span`,{className:X(`text-xs`,n?`text-foreground`:`text-foreground/70`),children:e.name}),n&&(0,q.jsx)(`span`,{className:`ml-1 text-[9px] text-accent-warning`,children:o(`modelSelector.customBadge`)})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsxs)(eT,{value:t,onValueChange:t=>a(e.id,t),children:[(0,q.jsx)(nT,{className:`h-6 w-44 text-[10px] px-2`,children:(0,q.jsx)(tT,{})}),(0,q.jsx)(aT,{children:s.map(e=>(0,q.jsx)(sT,{value:e.value,children:e.label},e.value))})]}),n&&(0,q.jsx)(`button`,{onClick:()=>u(e.id),className:`text-[9px] text-muted-foreground hover:text-foreground transition-colors px-1`,title:o(`modelSelector.resetToDefault`),children:`↺`})]})]},e.id)})})]})]})}var oq=6e4,sq={data:null,fetchedAt:0,inFlight:null,error:null},cq=new Set;function lq(){cq.forEach(e=>{try{e()}catch{}})}function uq(){return sq.data!==null&&Date.now()-sq.fetchedAt<oq}async function dq(e){if(sq.inFlight)return sq.inFlight;let t=(async()=>{let t=await fetch(`${sl}/api/setup-prerequisites`,{signal:e});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(typeof n?.ok!=`boolean`||!Array.isArray(n?.prerequisites)||!Array.isArray(n?.missingRequired))throw Error(`Malformed prerequisites response`);return sq.data=n,sq.fetchedAt=Date.now(),sq.error=null,sq.inFlight=null,lq(),sq.data})().catch(t=>{throw sq.inFlight=null,e?.aborted?t:(sq.error=t instanceof Error?t:Error(String(t)),lq(),sq.error)});return sq.inFlight=t,t}var fq=!1;function pq(){fq||typeof window>`u`||(window.addEventListener(`focus`,()=>{sq.fetchedAt=0,sq.data=null,dq().catch(()=>{})}),fq=!0)}function mq(){let[,e]=(0,I.useState)(0),[t,n]=(0,I.useState)(()=>!uq()),[r,i]=(0,I.useState)(sq.error);(0,I.useEffect)(()=>{pq();let t=()=>{e(e=>e+1),i(sq.error),n(!1)};cq.add(t);let r=new AbortController;return!uq()&&!sq.inFlight?(n(!0),dq(r.signal).catch(e=>{r.signal.aborted||i(e instanceof Error?e:Error(String(e)))}).finally(()=>{r.signal.aborted||n(!1)})):sq.inFlight&&sq.inFlight.catch(()=>{}).finally(()=>{r.signal.aborted||n(!1)}),()=>{r.abort(),cq.delete(t)}},[]);let a=(0,I.useCallback)(async()=>{sq.fetchedAt=0,sq.data=null,sq.error=null,n(!0);try{await dq()}catch(e){i(e instanceof Error?e:Error(String(e)))}finally{n(!1)}},[]);return{status:sq.data,isLoading:t,error:r,recheck:a}}function hq(e,t){return e.error===`corrupted-bundle`?t(`setup:prerequisites.corruptedBundle`):e.installed?e.executable===!1?e.resolvedPath&&e.executionError?t(`setup:prerequisites.failedToExecuteAtWithError`,{path:e.resolvedPath,error:e.executionError}):e.resolvedPath?t(`setup:prerequisites.failedToExecuteAt`,{path:e.resolvedPath}):e.executionError?t(`setup:prerequisites.failedToExecuteWithError`,{error:e.executionError}):t(`setup:prerequisites.failedToExecute`):!e.meetsMinimum&&e.minVersion?t(`setup:prerequisites.needsMinimum`,{version:e.version??t(`setup:prerequisites.unknownVersion`),minVersion:e.minVersion}):e.version??t(`setup:prerequisites.installedLabel`):t(`setup:prerequisites.notInstalled`)}function gq({status:e,isLoading:t,error:n,onRefresh:r,onMoreInfo:i}){let{t:a}=G(`setup`);if(t&&!e)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`loading`,className:`rounded-lg border border-border/30 bg-background/30 px-3 py-2`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`w-4 h-4 rounded-full bg-muted-foreground/20 animate-pulse`}),(0,q.jsx)(`div`,{className:`h-3 w-32 rounded bg-muted-foreground/15 animate-pulse`})]})});if(n&&!e)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`error`,className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:a(`prerequisites.verifyError`)})});if(!e)return null;if(e.ok)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`ok`,className:`rounded-lg border border-accent-success/25 bg-accent-success/5 px-3 py-2`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,q.jsx)(uf,{className:`w-4 h-4 text-accent-success flex-shrink-0`}),(0,q.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:a(`prerequisites.allDetected`)})]}),r&&(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,disabled:t,className:`h-7 px-2 gap-1.5 text-[11px] flex-shrink-0`,children:[(0,q.jsx)(yp,{className:X(`w-3 h-3`,t&&`animate-spin`)}),a(`common:actions.refresh`)]})]})});let o=e.missingRequired?.length??0,s=o>0&&(e.missingRequired??[]).every(e=>e.error===`corrupted-bundle`),c=(e.missingRequired??[]).some(e=>e.error===`corrupted-bundle`);return(0,q.jsxs)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`missing`,className:X(`rounded-lg border px-3 py-2`,c?`border-destructive/40 bg-destructive/10`:`border-accent-primary/40 bg-accent-primary/10`),children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,q.jsx)(Hp,{className:X(`w-4 h-4 flex-shrink-0`,c?`text-destructive`:`text-accent-primary`)}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:s?a(`prerequisites.bundleCorruptedTitle`):a(`prerequisites.toolsRequired`,{count:o})}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:a(s?`prerequisites.reinstallHint`:`prerequisites.installMissingHint`)})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[i&&!s&&(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,className:`h-7 px-2 gap-1.5 text-[11px]`,"data-testid":`prerequisites-more-info`,children:a(`prerequisites.moreInfo`)}),r&&(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,disabled:t,className:`h-7 px-2 gap-1.5 text-[11px]`,children:[(0,q.jsx)(yp,{className:X(`w-3 h-3`,t&&`animate-spin`)}),a(`common:actions.refresh`)]})]})]}),(0,q.jsx)(`ul`,{className:`mt-2 space-y-1`,children:e.prerequisites.map(e=>{let t=e.error===`corrupted-bundle`,n=e.bundled===!0&&e.executable===!0&&!t,r=!t&&e.installed&&e.meetsMinimum;return(0,q.jsxs)(`li`,{"data-testid":`prereq-row-${e.key}`,"data-ok":r?`true`:`false`,"data-bundled":e.bundled?`true`:void 0,"data-corrupted":t?`true`:void 0,className:X(`flex items-center gap-2 rounded-md border px-2 py-1.5 text-[11px]`,t?`border-destructive/40 bg-destructive/10 text-foreground`:r?`border-border/30 bg-background/30 text-muted-foreground`:`border-accent-primary/30 bg-background/50 text-foreground`),children:[t?(0,q.jsx)(df,{className:`w-3.5 h-3.5 text-destructive flex-shrink-0`}):n||r?(0,q.jsx)(uf,{className:`w-3.5 h-3.5 text-accent-success flex-shrink-0`}):(0,q.jsx)(df,{className:`w-3.5 h-3.5 text-accent-primary flex-shrink-0`}),(0,q.jsx)(`span`,{className:`font-medium`,children:e.label}),n&&(0,q.jsxs)(`span`,{"data-testid":`prereq-bundled-badge-${e.key}`,className:`inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium bg-accent-secondary/20 text-accent-secondary border border-accent-secondary/30`,children:[(0,q.jsx)(ip,{className:`w-2.5 h-2.5`}),a(`prerequisites.bundledBadge`)]}),(0,q.jsxs)(`span`,{className:X(`text-muted-foreground`,t&&`text-destructive/80`),children:[`— `,hq(e,a)]})]},e.key)})})]})}var _q=[`todo`,`in_progress`,`done`,`cancelled`],vq={todo:`todo`,in_progress:`inProgress`,done:`done`,cancelled:`cancelled`};function yq({onConnected:e,onSkip:t,apiBase:n}){let{t:r}=G(`jira`),[i,a]=(0,I.useState)(1),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(`idle`),[m,h]=(0,I.useState)(null),[g,_]=(0,I.useState)(`cloud`),[v,y]=(0,I.useState)([]),[b,x]=(0,I.useState)(``),[S,C]=(0,I.useState)(``),[w,T]=(0,I.useState)(``),[E,D]=(0,I.useState)(!1),[O,k]=(0,I.useState)([]),[A,j]=(0,I.useState)({}),[M,N]=(0,I.useState)(``),[P,F]=(0,I.useState)(!1),L=()=>({baseUrl:o.trim(),accountEmail:c.trim()||null,token:u});async function ee(){p(`testing`);try{let e=await ob.test(L(),n);p(`ok`),h(e.displayName),_(e.deployment)}catch(e){p(`error`),K.error(Sq(e,r))}}async function te(){a(2),D(!0);try{let{projects:e}=await ob.discoverProjects({...L(),query:b.trim()||void 0},n);y(e)}catch(e){K.error(Sq(e,r))}finally{D(!1)}}async function R(){if(a(3),S)try{let{statuses:e}=await ob.discoverStatuses({...L(),projectKey:S},n);k(e)}catch{k([])}}async function z(){F(!0);try{let t=Object.fromEntries(Object.entries(A).filter(([,e])=>e));await ob.connect({...L(),jiraProjectKey:S.trim(),statusMap:Object.keys(t).length?t:null,discardStatus:M.trim()||null},n),K.success(r(`status.connected`,{key:S.trim()})),e()}catch(e){K.error(Sq(e,r))}finally{F(!1)}}return(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-wizard`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`wizard.step`,{current:i,total:4})}),t&&(0,q.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs text-muted-foreground hover:text-foreground hover:underline`,"data-testid":`jira-later`,children:r(`wizard.later`)})]}),i===1&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step1Title`)}),(0,q.jsx)(bq,{label:r(`creds.baseUrlLabel`),help:r(`creds.baseUrlHelp`),children:(0,q.jsx)(_H,{value:o,onChange:e=>{s(e.target.value),p(`idle`)},placeholder:r(`creds.baseUrlPlaceholder`)})}),(0,q.jsx)(bq,{label:r(`creds.emailLabel`),help:r(`creds.emailHelp`),children:(0,q.jsx)(_H,{value:c,onChange:e=>{l(e.target.value),p(`idle`)},placeholder:r(`creds.emailPlaceholder`)})}),(0,q.jsx)(bq,{label:r(`creds.tokenLabel`),help:r(`creds.tokenHelp`),children:(0,q.jsx)(_H,{type:`password`,value:u,onChange:e=>{d(e.target.value),p(`idle`)}})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(Z,{size:`sm`,variant:`outline`,onClick:ee,disabled:!o.trim()||!u.trim()||f===`testing`,children:r(f===`testing`?`creds.testing`:f===`ok`?`creds.retest`:`creds.test`)}),f===`ok`&&(0,q.jsxs)(`span`,{className:`text-xs text-accent-success`,"data-testid":`jira-test-ok`,children:[`✓ `,r(`creds.testOk`,{name:m??``}),` · `,r(g===`cloud`?`review.cloud`:`review.dc`)]})]}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(Z,{size:`sm`,onClick:te,disabled:f!==`ok`,children:r(`wizard.next`)})})]}),i===2&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step2Title`)}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(_H,{value:b,onChange:e=>x(e.target.value),placeholder:r(`project.searchPlaceholder`)}),(0,q.jsx)(Z,{size:`sm`,variant:`outline`,onClick:te,children:r(`project.searchPlaceholder`)})]}),E?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.loading`)}):v.length===0?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.none`)}):(0,q.jsx)(`div`,{className:`max-h-48 space-y-1 overflow-y-auto`,"data-testid":`jira-project-list`,children:v.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{C(e.key),T(e.name)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left text-sm hover:bg-muted ${S===e.key?`bg-muted`:``}`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:e.key}),(0,q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.name})]},e.id))}),(0,q.jsx)(bq,{label:r(`project.manualLabel`),children:(0,q.jsx)(_H,{value:S,onChange:e=>{C(e.target.value.toUpperCase()),T(``)},placeholder:r(`project.manualPlaceholder`)})}),(0,q.jsxs)(`div`,{className:`flex justify-between`,children:[(0,q.jsx)(Z,{size:`sm`,variant:`ghost`,onClick:()=>a(1),children:r(`wizard.back`)}),(0,q.jsx)(Z,{size:`sm`,onClick:R,disabled:!S.trim(),children:r(`wizard.next`)})]})]}),i===3&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step3Title`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`mapping.intro`)}),_q.map(e=>(0,q.jsx)(bq,{label:r(`mapping.${vq[e]}`),children:(0,q.jsxs)(`select`,{value:A[e]??``,onChange:t=>j(n=>({...n,[e]:t.target.value||void 0})),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,children:[(0,q.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),O.map(e=>(0,q.jsx)(`option`,{value:e.name,children:e.name},e.id))]})},e)),(0,q.jsx)(bq,{label:r(`discard.configLabel`),help:r(`discard.configHelp`),children:(0,q.jsxs)(`select`,{value:M,onChange:e=>N(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,q.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),O.map(e=>(0,q.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}),(0,q.jsxs)(`div`,{className:`flex justify-between`,children:[(0,q.jsx)(Z,{size:`sm`,variant:`ghost`,onClick:()=>a(2),children:r(`wizard.back`)}),(0,q.jsx)(Z,{size:`sm`,onClick:()=>a(4),children:r(`wizard.next`)})]})]}),i===4&&(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step4Title`)}),(0,q.jsxs)(`dl`,{className:`space-y-1 text-sm`,children:[(0,q.jsx)(xq,{label:r(`review.site`),value:o}),(0,q.jsx)(xq,{label:r(`review.project`),value:w?`${S} — ${w}`:S}),(0,q.jsx)(xq,{label:r(`review.account`),value:m??c}),(0,q.jsx)(xq,{label:r(`review.type`),value:r(g===`cloud`?`review.cloud`:`review.dc`)}),(0,q.jsx)(xq,{label:r(`discard.reviewLabel`),value:M||r(`discard.configNone`)})]}),(0,q.jsxs)(`div`,{className:`flex justify-between`,children:[(0,q.jsx)(Z,{size:`sm`,variant:`ghost`,onClick:()=>a(3),children:r(`wizard.back`)}),(0,q.jsx)(Z,{size:`sm`,onClick:z,disabled:P,children:r(P?`wizard.connecting`:`wizard.connect`)})]})]})]})}function bq({label:e,help:t,children:n}){return(0,q.jsxs)(`label`,{className:`block space-y-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e}),n,t&&(0,q.jsx)(`span`,{className:`block text-[11px] text-muted-foreground`,children:t})]})}function xq({label:e,value:t}){return(0,q.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,q.jsx)(`dd`,{className:`truncate text-right font-medium`,children:t})]})}function Sq(e,t){return e instanceof Error?e.message:t(`errors.generic`)}var Cq={agents:0,specrailsCommands:0,opsxCommands:0,legacySrRemoved:0,tier:`quick`,provider:`claude`};function wq(e){return e.includes(`opus`)?`opus`:e.includes(`haiku`)?`haiku`:e.includes(`sonnet`)?`sonnet`:e}function Tq(e){return{balanced:`sonnet`,budget:`haiku`,max:`sonnet`}[e]}function Eq(){return{selectedAgents:[...XK],modelPreset:`balanced`,modelOverrides:{}}}var Dq=()=>[{key:`base_install`,name:J.t(`setup:wizard.checkpoints.baseInstall`),status:`pending`},{key:`agent_selection`,name:J.t(`setup:wizard.checkpoints.agentSelection`),status:`pending`},{key:`agent_generation`,name:J.t(`setup:wizard.checkpoints.agentGeneration`),status:`pending`}],Oq=new Map,kq=`prose prose-invert prose-xs max-w-none
|
|
123
|
+
prose-p:my-1 prose-p:leading-relaxed
|
|
124
|
+
prose-headings:mt-3 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold
|
|
125
|
+
prose-ul:my-1 prose-ol:my-1 prose-li:my-0
|
|
126
|
+
prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
|
127
|
+
prose-pre:my-1 prose-pre:bg-muted/30 prose-pre:rounded-md prose-pre:p-2 prose-pre:text-[10px]
|
|
128
|
+
prose-strong:text-foreground prose-em:text-foreground/70
|
|
129
|
+
prose-table:my-2 prose-table:text-[10px]
|
|
130
|
+
prose-thead:border-border prose-thead:bg-muted/30
|
|
131
|
+
prose-th:px-2 prose-th:py-1 prose-th:text-left prose-th:font-semibold
|
|
132
|
+
prose-td:px-2 prose-td:py-1 prose-td:border-border
|
|
133
|
+
text-foreground/80`,Aq=(0,I.memo)(function({lines:e}){let t=e.join(`
|
|
134
|
+
`);return(0,q.jsx)(`div`,{className:kq,children:(0,q.jsx)(rF,{remarkPlugins:[sR],children:t})})});function jq({config:e,onChange:t,onInstall:n,onSkip:r,provider:i,ctaLabel:a,lastStep:o=!0,prerequisites:s,prerequisitesLoading:c,prerequisitesError:l,onRefreshPrerequisites:u}){let{t:d}=G(`setup`),[f,p]=(0,I.useState)(`agents`),m=JK.filter(t=>e.selectedAgents.includes(t.id)),h=s!==null&&!s.ok&&!l,g=e.selectedAgents.length===0||h;return(0,q.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex-shrink-0 px-6 pt-6 pb-4 space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-accent-primary/20 flex items-center justify-center flex-shrink-0`,children:(0,q.jsx)(Xd,{className:`w-5 h-5 text-accent-primary`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:d(`wizard.configureAgents`,{provider:QE(i)})}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:d(`wizard.configureSubtitle`)})]})]}),(0,q.jsx)(gq,{status:s,isLoading:c,error:l,onRefresh:u}),(0,q.jsx)(`div`,{className:`flex border-b border-border/30`,children:[`agents`,`models`].map(e=>(0,q.jsx)(`button`,{onClick:()=>p(e),className:X(`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium border-b-2 -mb-px transition-colors`,f===e?`border-accent-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e===`agents`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Xd,{className:`w-3 h-3`}),d(`wizard.tabs.agents`)]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Op,{className:`w-3 h-3`}),d(`wizard.tabs.models`)]})},e))})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto px-6 pb-4`,children:f===`agents`?(0,q.jsx)($K,{selected:e.selectedAgents,onChange:n=>t({...e,selectedAgents:n})}):(0,q.jsx)(aq,{agents:m,provider:i,preset:e.modelPreset,overrides:e.modelOverrides,onPresetChange:n=>t({...e,modelPreset:n}),onOverrideChange:(n,r)=>{let i={...e.modelOverrides};r?i[n]=r:delete i[n],t({...e,modelOverrides:i})}})}),(0,q.jsxs)(`div`,{className:`flex-shrink-0 border-t border-border/30 px-6 py-4 relative flex items-center`,children:[(0,q.jsx)(`button`,{onClick:r,className:`absolute left-6 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:d(`wizard.skipForNow`)}),(0,q.jsx)(`div`,{"data-testid":`install-cta-wrapper`,className:`mx-auto`,children:(0,q.jsxs)(Z,{size:`sm`,className:`gap-2`,onClick:n,disabled:g,children:[o?(0,q.jsx)(ip,{className:`w-3.5 h-3.5`}):(0,q.jsx)(Gd,{className:`w-3.5 h-3.5`}),a??d(`wizard.install`)]})})]})]})}function Mq({logLines:e,onBack:t,providerLabelText:n}){let{t:r}=G(`setup`);return(0,q.jsxs)(`div`,{className:`flex flex-col h-full max-w-lg mx-auto px-6 py-8 gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-accent-primary/20 flex items-center justify-center flex-shrink-0`,children:(0,q.jsx)(ip,{className:`w-4 h-4 text-accent-primary animate-pulse`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:n?r(`wizard.installingProvider`,{provider:n}):r(`wizard.installingSpecrails`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`wizard.installingFromTemplates`)})]})]}),(0,q.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 gap-1.5 text-xs`,children:[(0,q.jsx)(af,{className:`w-3.5 h-3.5`}),r(`common:actions.back`)]})]}),(0,q.jsx)(`div`,{className:`flex-1 rounded-lg border border-border/30 bg-muted/10 overflow-auto p-3 text-[11px] text-muted-foreground space-y-0.5`,children:e.length===0?(0,q.jsx)(`p`,{className:`text-center text-muted-foreground mt-4`,children:r(`wizard.waitingForOutput`)}):(0,q.jsx)(Aq,{lines:e.slice(-300)})})]})}function Nq({summary:e}){let{t}=G(`setup`),n=e.provider===`codex`;return(0,q.jsxs)(`div`,{className:`w-full rounded-lg border border-border/50 bg-muted/20 p-3`,children:[(0,q.jsx)(`div`,{className:`text-[11px] font-semibold text-foreground mb-1.5`,children:QE(e.provider)}),(0,q.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-xl font-bold text-accent-primary leading-tight`,children:e.agents}),(0,q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(n?`wizard.summary.agentSkills`:`wizard.summary.agents`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-xl font-bold text-accent-success leading-tight`,children:e.specrailsCommands}),(0,q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:n?t(`wizard.summary.skills`):`/specrails:*`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-xl font-bold text-accent-info leading-tight`,children:e.opsxCommands}),(0,q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:n?t(`wizard.summary.openspecSkills`):`/opsx:*`})]})]}),e.legacySrRemoved>0&&(0,q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground text-center`,children:(0,q.jsx)(Bi,{t,i18nKey:`wizard.summary.legacyRemoved`,count:e.legacySrRemoved,components:{code:(0,q.jsx)(`code`,{className:`text-xs`})}})})]})}function Pq({projectName:e,projectId:t,summaries:n,onGoToProject:r}){let{t:i}=G(`setup`),a=n.length>0?n:[{...Cq}],[o,s]=(0,I.useState)(!1);return o&&nb?(0,q.jsxs)(`div`,{className:`flex flex-col h-full max-w-lg mx-auto px-6 py-8 gap-4 overflow-auto`,children:[(0,q.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,q.jsx)(`h2`,{className:`text-lg font-semibold`,children:i(`wizard.complete.jira.title`)}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`wizard.complete.jira.subtitle`)})]}),(0,q.jsx)(yq,{apiBase:`/api/projects/${t}`,onConnected:r,onSkip:r})]}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full max-w-lg mx-auto px-6 gap-4 overflow-auto py-5`,children:[(0,q.jsx)(`div`,{className:`w-11 h-11 rounded-2xl bg-accent-success/20 flex items-center justify-center shrink-0`,children:(0,q.jsx)(nf,{className:`w-6 h-6 text-accent-success`})}),(0,q.jsxs)(`div`,{className:`text-center space-y-1.5`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,q.jsx)(Bi,{t:i,i18nKey:`wizard.complete.welcome`,components:{spec:(0,q.jsx)(`span`,{className:`text-accent-primary`}),rails:(0,q.jsx)(`span`,{className:`text-accent-secondary`})}})}),(0,q.jsx)(`p`,{className:`text-[13px] text-muted-foreground max-w-sm`,children:(0,q.jsx)(Bi,{t:i,i18nKey:`wizard.complete.configured`,values:{projectName:e},components:{strong:(0,q.jsx)(`strong`,{className:`text-foreground`})}})})]}),(0,q.jsxs)(`div`,{className:`w-full space-y-2`,children:[a.length>1&&(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:i(`wizard.complete.installedForEngines`,{count:a.length})}),(0,q.jsx)(`div`,{className:X(`grid gap-3`,a.length>1?`sm:grid-cols-2`:`grid-cols-1`),children:a.map((e,t)=>(0,q.jsx)(Nq,{summary:e},e.provider??t))})]}),nb&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),"data-testid":`setup-jira-cta`,className:`inline-flex items-center gap-2 rounded-md border border-border/60 bg-muted/10 px-3 py-1.5 text-xs font-medium text-foreground/80 hover:text-foreground hover:border-border transition-colors`,children:[(0,q.jsx)(fp,{className:`w-3.5 h-3.5 text-accent-info`}),i(`wizard.complete.jira.configure`),(0,q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,i(`wizard.complete.jira.optional`)]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,q.jsx)(`span`,{children:i(`wizard.complete.learnMore`)}),(0,q.jsx)(`a`,{href:`https://specrails.dev/docs`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:`specrails.dev/docs`})]}),(0,q.jsxs)(Z,{size:`sm`,className:`gap-2`,onClick:r,children:[i(`wizard.complete.continueToProject`),(0,q.jsx)(Gd,{className:`w-3.5 h-3.5`})]})]})}function Fq({message:e,onRetry:t,onSkip:n}){let{t:r}=G(`setup`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full max-w-lg mx-auto px-6 gap-6`,children:[(0,q.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-destructive`,children:r(`wizard.error.title`)}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})]}),(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:n,children:r(`wizard.error.skipSetup`)}),(0,q.jsxs)(Z,{size:`sm`,className:`gap-2`,onClick:t,children:[(0,q.jsx)(xp,{className:`w-3.5 h-3.5`}),r(`common:actions.retry`)]})]})]})}function Iq({wizardStep:e,providers:t}){let{t:n}=G(`setup`),r=t.length>1?t.map(e=>({label:QE(e)})):[{label:n(`wizard.steps.configure`)}],i=[...r,{label:n(`wizard.install`)},{label:n(`common:actions.done`)}],a=r.length,o=a+1,s=e.step===`agent-selection`?Math.min(e.providerIndex,r.length-1):e.step===`installing`||e.step===`error`?a:o;return(0,q.jsx)(`div`,{className:`flex items-center gap-2`,children:i.map((e,t)=>{let n=t<s,r=t===s;return(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`div`,{className:X(`w-4 h-4 rounded-full flex items-center justify-center text-[9px] font-bold`,n&&`bg-accent-success text-background`,r&&`bg-accent-primary text-background`,!n&&!r&&`bg-muted/50 text-muted-foreground`),children:n?(0,q.jsx)(nf,{className:`w-2.5 h-2.5`}):t+1}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-medium`,r&&`text-foreground`,!r&&`text-muted-foreground`),children:e.label})]}),t<i.length-1&&(0,q.jsx)(`div`,{className:X(`w-6 h-px`,n?`bg-accent-success/50`:`bg-border/50`)})]},`${e.label}-${t}`)})})}function Lq({project:e,onComplete:t,onSkip:n}){let{t:r}=G(`setup`),i=(0,I.useCallback)(()=>{Oq.delete(e.id),t()},[e.id,t]),a=(0,I.useCallback)(()=>{Oq.delete(e.id),n()},[e.id,n]),o=hd(e),s=Oq.get(e.id),[c,l]=(0,I.useState)(s?.wizardStep??{step:`agent-selection`,providerIndex:0}),[u,d]=(0,I.useState)(()=>{if(s?.configs)return s.configs;let e={};for(let t of o)e[t]=Eq();return e}),[f,p]=(0,I.useState)(s?.checkpoints??Dq()),[m,h]=(0,I.useState)(s?.logLines??[]),{status:g,isLoading:_,error:v,recheck:y}=mq(),b=c.step===`agent-selection`?c.providerIndex:0,x=o[Math.min(b,o.length-1)]??`claude`,S=u[x]??Eq(),C=(0,I.useCallback)(e=>{d(t=>({...t,[x]:e}))},[x]),w=(0,I.useRef)([]),T=(0,I.useRef)(0),E=(0,I.useRef)(()=>{}),D=(0,I.useRef)(c),O=(0,I.useRef)(f),k=(0,I.useRef)(m),A=(0,I.useRef)(u);D.current=c,O.current=f,k.current=m,A.current=u,(0,I.useEffect)(()=>()=>{Oq.set(e.id,{wizardStep:D.current,checkpoints:O.current,logLines:k.current,configs:A.current})},[e.id]),(0,I.useEffect)(()=>{if(c.step!==`installing`)return;async function t(){try{let t=await fetch(`/api/projects/${e.id}/setup/checkpoints`);if(!t.ok)return;let n=await t.json();n.checkpoints&&p(e=>e.map(e=>{let t=n.checkpoints.find(t=>t.key===e.key);return!t||e.status===`done`&&t.status!==`done`?e:{...e,...t}})),n.logLines&&n.logLines.length>0&&h(e=>n.logLines.length>e.length?n.logLines:e),c.step===`installing`&&!n.isInstalling&&n.checkpoints?.some(e=>e.key===`base_install`&&e.status===`done`)&&l({step:`complete`,summaries:w.current.length>0?w.current:[n.summary??{...Cq}]})}catch{}}t()},[]);let{registerHandler:j,unregisterHandler:M}=xl(),N=(0,I.useCallback)(t=>{let n=t;if(typeof n.type==`string`&&n.projectId===e.id)switch(n.type){case`setup_log`:h(e=>[...e,n.line]);break;case`setup_install_done`:{let e=n.summary??{...Cq};w.current=[...w.current,e];let t=T.current+1;t<o.length?(T.current=t,E.current(t)):l({step:`complete`,summaries:[...w.current]});break}case`setup_checkpoint`:{let e=n.checkpoint,t=n.status,r=n.detail,i=n.duration_ms;p(n=>n.map(n=>n.key===e?{...n,status:t,detail:r??n.detail,duration_ms:i??n.duration_ms}:n));break}case`setup_error`:{let e=n.error;l({step:`error`,message:e,retryStep:`installing`,providerIndex:T.current});break}}},[e.id,o.length]);(0,I.useLayoutEffect)(()=>(j(`setup-${e.id}`,N),()=>M(`setup-${e.id}`)),[N,j,M,e.id]);let P=(0,I.useCallback)(t=>{let n=o[t]??`claude`,r=A.current[n]??Eq(),i=[...new Set([...YK,...r.selectedAgents])],a=JK.map(e=>e.id).filter(e=>!i.includes(e)),s={};for(let[e,t]of Object.entries(r.modelOverrides))t&&(s[e]=wq(t));p(Dq()),h([]),l({step:`installing`,providerIndex:t}),(async()=>{try{await fetch(`/api/projects/${e.id}/setup/install-config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({version:1,provider:n,tier:`quick`,agents:{selected:i,excluded:a},models:{preset:r.modelPreset,defaults:{model:Tq(r.modelPreset)},overrides:s},agent_teams:!1})})}catch(e){console.error(`[SetupWizard] install-config write error:`,e)}fetch(`/api/projects/${e.id}/setup/install`,{method:`POST`}).catch(e=>{console.error(`[SetupWizard] install start error:`,e)})})()},[e.id,o]);E.current=P;let F=(0,I.useCallback)(()=>{if(g!==null&&!g.ok){l({step:`error`,retryStep:`installing`,providerIndex:0,message:[r(`wizard.error.prereqMissing`),r(`wizard.error.prereqRetryHint`)].join(`
|
|
135
|
+
|
|
136
|
+
`)});return}w.current=[],T.current=0,P(0)},[g,P,r]),L=(0,I.useCallback)(()=>{if(c.step!==`agent-selection`)return;let e=c.providerIndex;e<o.length-1?l({step:`agent-selection`,providerIndex:e+1}):F()},[c,o.length,F]);function ee(){c.step===`error`&&F()}let te=c.step===`agent-selection`?c.providerIndex:0,R=te>=o.length-1,z=R?r(`wizard.install`):r(`wizard.nextProvider`,{provider:QE(o[te+1])});return(0,q.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,q.jsx)(`div`,{className:`flex-shrink-0 border-b border-border/30 px-4 py-2`,children:(0,q.jsx)(Iq,{wizardStep:c,providers:o})}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[c.step===`agent-selection`&&(0,q.jsx)(jq,{config:S,onChange:C,onInstall:L,onSkip:a,provider:x,ctaLabel:z,lastStep:R,prerequisites:g,prerequisitesLoading:_,prerequisitesError:v,onRefreshPrerequisites:y},x),c.step===`installing`&&(0,q.jsx)(Mq,{logLines:m,providerLabelText:o.length>1?QE(o[c.providerIndex]):void 0,onBack:()=>l({step:`agent-selection`,providerIndex:o.length-1})}),c.step===`complete`&&(0,q.jsx)(Pq,{projectName:e.name,projectId:e.id,summaries:c.summaries,onGoToProject:i}),c.step===`error`&&(0,q.jsx)(Fq,{message:c.message,onRetry:ee,onSkip:a})]})]})}var Rq=`https://specrails.dev/companion/ios`,zq=`https://specrails.dev/companion/android`,Bq=`specrails-desktop:onboarding-dismissed`;function Vq(){try{return localStorage.getItem(Bq)===`true`}catch{return!1}}function Hq(){try{localStorage.setItem(Bq,`true`)}catch{}}var Uq=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||``),Wq=Uq?`⌘`:`Ctrl`,Gq=Uq?`⌥`:`Alt`,Kq={primary:{text:`text-accent-primary`,bar:`bg-accent-primary`,glow:`glow-primary`,btn:`bg-accent-primary hover:bg-accent-primary/90 text-primary-foreground`,softBorder:`border-accent-primary/30`,softBg:`bg-accent-primary/5`,chipBg:`bg-accent-primary/10 text-accent-primary`},info:{text:`text-accent-info`,bar:`bg-accent-info`,glow:`glow-info`,btn:`bg-accent-info hover:bg-accent-info/90 text-primary-foreground`,softBorder:`border-accent-info/30`,softBg:`bg-accent-info/5`,chipBg:`bg-accent-info/10 text-accent-info`},success:{text:`text-accent-success`,bar:`bg-accent-success`,glow:`glow-success`,btn:`bg-accent-success hover:bg-accent-success/90 text-primary-foreground`,softBorder:`border-accent-success/30`,softBg:`bg-accent-success/5`,chipBg:`bg-accent-success/10 text-accent-success`},secondary:{text:`text-accent-secondary`,bar:`bg-accent-secondary`,glow:`glow-secondary`,btn:`bg-accent-secondary hover:bg-accent-secondary/90 text-primary-foreground`,softBorder:`border-accent-secondary/30`,softBg:`bg-accent-secondary/5`,chipBg:`bg-accent-secondary/10 text-accent-secondary`},warning:{text:`text-accent-warning`,bar:`bg-accent-warning`,glow:`glow-warning`,btn:`bg-accent-warning hover:bg-accent-warning/90 text-primary-foreground`,softBorder:`border-accent-warning/30`,softBg:`bg-accent-warning/5`,chipBg:`bg-accent-warning/10 text-accent-warning`},highlight:{text:`text-accent-highlight`,bar:`bg-accent-highlight`,glow:`glow-highlight`,btn:`bg-accent-highlight hover:bg-accent-highlight/90 text-primary-foreground`,softBorder:`border-accent-highlight/30`,softBg:`bg-accent-highlight/5`,chipBg:`bg-accent-highlight/10 text-accent-highlight`}};function qq({children:e}){return(0,q.jsx)(`kbd`,{className:`inline-flex items-center justify-center min-w-[1.5rem] h-5 px-1.5 rounded border border-border/60 bg-card/80 font-mono text-[11px] text-foreground shadow-sm`,children:e})}function Jq({icon:e,label:t,children:n,accent:r}){return(0,q.jsxs)(`div`,{className:`flex gap-3 items-start`,children:[(0,q.jsx)(`div`,{className:X(`mt-0.5 shrink-0 grid place-items-center w-7 h-7 rounded-md border border-border/40`,r.softBg,r.text),children:e}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground leading-tight`,children:t}),(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground leading-relaxed`,children:n})]})]})}function Yq({accent:e,label:t,children:n}){return(0,q.jsxs)(`div`,{className:X(`rounded-lg border p-3`,e.softBorder,e.softBg),children:[t&&(0,q.jsx)(`p`,{className:X(`text-[10px] font-semibold uppercase tracking-wider mb-1.5`,e.text),children:t}),(0,q.jsx)(`div`,{className:`text-xs text-foreground/90 leading-relaxed`,children:n})]})}function Xq({steps:e}){return(0,q.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap text-[13px] font-medium`,children:e.map((t,n)=>(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:t.cls,children:t.label}),n<e.length-1&&(0,q.jsx)(Gd,{className:`w-3.5 h-3.5 text-muted-foreground`})]},t.label))})}function Zq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:e(`onboarding.language.intro`)}),(0,q.jsx)(oU,{}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.language.note`)})]})}function Qq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:e(`onboarding.theme.intro`)}),(0,q.jsx)(QH,{}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.theme.note`)})]})}function $q({icon:e,url:t,label:n,testId:r}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border/40 bg-card/40 p-3`,children:[(0,q.jsx)(`div`,{className:`shrink-0 rounded-md bg-white p-1.5`,"aria-hidden":`true`,children:(0,q.jsx)(FU,{value:t,size:72})}),(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[13px] font-semibold text-foreground leading-tight`,children:[e,n]}),(0,q.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":r,"aria-label":n,className:`inline-flex items-center gap-1 text-xs text-accent-info hover:underline break-all`,children:[t.replace(`https://`,``),(0,q.jsx)(Df,{className:`w-3 h-3 shrink-0`,"aria-hidden":`true`})]})]})]})}function eJ(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.companion.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsx)(Yq,{accent:Kq.success,label:e(`onboarding.companion.localLabel`),children:e(`onboarding.companion.localBody`)}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:e(`onboarding.companion.downloadLabel`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`onboarding.companion.downloadHint`)}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-3`,children:[(0,q.jsx)($q,{icon:(0,q.jsx)(Vd,{className:`w-4 h-4 shrink-0`,"aria-hidden":`true`}),url:Rq,label:e(`onboarding.companion.ios`),testId:`companion-ios-link`}),(0,q.jsx)($q,{icon:(0,q.jsx)(jp,{className:`w-4 h-4 shrink-0`,"aria-hidden":`true`}),url:zq,label:e(`onboarding.companion.android`),testId:`companion-android-link`})]})]}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(hp,{className:`w-4 h-4`}),label:e(`onboarding.companion.pairLabel`),accent:Kq.success,children:e(`onboarding.companion.pairBody`)})]})}function tJ(e){return[{navLabel:e(`onboarding.language.nav`),icon:(0,q.jsx)(Wf,{className:`w-6 h-6`}),accent:Kq.info,title:e(`onboarding.language.title`),subtitle:e(`onboarding.language.subtitle`),content:(0,q.jsx)(Zq,{})},{navLabel:e(`onboarding.theme.nav`),icon:(0,q.jsx)(ap,{className:`w-6 h-6`}),accent:Kq.highlight,title:e(`onboarding.theme.title`),subtitle:e(`onboarding.theme.subtitle`),content:(0,q.jsx)(Qq,{})},{navLabel:e(`onboarding.welcome.nav`),icon:(0,q.jsx)(Mp,{className:`w-6 h-6`}),accent:Kq.primary,title:e(`onboarding.welcome.title`),subtitle:e(`onboarding.welcome.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.welcome.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(Yq,{accent:Kq.primary,label:e(`onboarding.welcome.coreLoopLabel`),children:[(0,q.jsx)(Xq,{steps:[{label:e(`onboarding.flow.addSpec`),cls:`text-accent-info`},{label:e(`onboarding.flow.dropInRail`),cls:`text-accent-success`},{label:e(`onboarding.flow.hitPlay`),cls:`text-accent-warning`},{label:e(`onboarding.flow.ship`),cls:`text-accent-secondary`}]}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.welcome.flowCaption`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`})}})})]}),(0,q.jsxs)(`div`,{className:`flex gap-3 items-start`,children:[(0,q.jsx)(Ap,{className:`w-4 h-4 mt-0.5 shrink-0 text-accent-success`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.welcome.localNote`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`}),i:(0,q.jsx)(`span`,{className:`italic`})}})})]}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.welcome.tourNote`)})]})},{navLabel:e(`onboarding.authorSpecs.nav`),icon:(0,q.jsx)(Qf,{className:`w-6 h-6`}),accent:Kq.info,title:e(`onboarding.authorSpecs.title`),subtitle:e(`onboarding.authorSpecs.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.authorSpecs.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(Jq,{icon:(0,q.jsx)(Qf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.exploreLabel`),accent:Kq.info,children:e(`onboarding.authorSpecs.exploreBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Jp,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.quickLabel`),accent:Kq.info,children:e(`onboarding.authorSpecs.quickBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Rf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.websiteLabel`),accent:Kq.info,children:e(`onboarding.authorSpecs.websiteBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(wp,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.smashLabel`),accent:Kq.info,children:e(`onboarding.authorSpecs.smashBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Cp,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.draftsLabel`),accent:Kq.info,children:e(`onboarding.authorSpecs.draftsBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(vf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.compareLabel`),accent:Kq.info,children:e(`onboarding.authorSpecs.compareBody`)})]}),nb&&(0,q.jsx)(Yq,{accent:Kq.info,label:e(`onboarding.jira.label`),children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.jira.body`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})})]})},{navLabel:e(`onboarding.rails.nav`),icon:(0,q.jsx)(Kp,{className:`w-6 h-6`}),accent:Kq.success,title:e(`onboarding.rails.title`),subtitle:e(`onboarding.rails.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.rails.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`}),play:(0,q.jsx)(`span`,{className:`text-accent-warning font-medium`})}})}),(0,q.jsxs)(Yq,{accent:Kq.success,label:e(`onboarding.rails.jobLabel`),children:[(0,q.jsx)(Xq,{steps:[{label:e(`onboarding.flow.architect`),cls:`text-accent-info`},{label:e(`onboarding.flow.developer`),cls:`text-accent-success`},{label:e(`onboarding.flow.reviewer`),cls:`text-accent-warning`},{label:e(`onboarding.flow.ship`),cls:`text-accent-secondary`}]}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:e(`onboarding.rails.flowCaption`)})]}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(Jq,{icon:(0,q.jsx)(Ff,{className:`w-4 h-4`}),label:e(`onboarding.rails.modeLabel`),accent:Kq.success,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.rails.modeBody`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`})}})}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Xd,{className:`w-4 h-4`}),label:e(`onboarding.rails.profilesLabel`),accent:Kq.success,children:e(`onboarding.rails.profilesBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Pf,{className:`w-4 h-4`}),label:e(`onboarding.rails.jobDetailLabel`),accent:Kq.success,children:e(`onboarding.rails.jobDetailBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Nf,{className:`w-4 h-4`}),label:e(`onboarding.rails.isolationLabel`),accent:Kq.success,children:e(`onboarding.rails.isolationBody`)})]})]})},{navLabel:e(`onboarding.providers.nav`),icon:(0,q.jsx)(Xd,{className:`w-6 h-6`}),accent:Kq.secondary,title:e(`onboarding.providers.title`),subtitle:e(`onboarding.providers.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.providers.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`rounded-lg border border-border/40 overflow-hidden text-xs`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_1fr_1fr] bg-card/40`,children:[(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-muted-foreground`,children:e(`onboarding.providers.table.capability`)}),(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-accent-secondary text-center`,children:`Claude Code`}),(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-accent-success text-center`,children:`Codex CLI`})]}),[[e(`onboarding.providers.table.streamingResume`),e(`onboarding.providers.table.native`),e(`onboarding.providers.table.native`)],[e(`onboarding.providers.table.costReporting`),e(`onboarding.providers.table.providerBilled`),e(`onboarding.providers.table.estimated`)],[e(`onboarding.providers.table.telemetry`),e(`onboarding.providers.table.native`),e(`onboarding.providers.table.synthesized`)],[e(`onboarding.providers.table.agentProfiles`),e(`common:states.yes`),`—`]].map(e=>(0,q.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_1fr_1fr] border-t border-border/30`,children:[(0,q.jsx)(`div`,{className:`px-3 py-2 text-foreground/90`,children:e[0]}),(0,q.jsx)(`div`,{className:`px-3 py-2 text-center text-muted-foreground`,children:e[1]}),(0,q.jsx)(`div`,{className:`px-3 py-2 text-center text-muted-foreground`,children:e[2]})]},e[0]))]}),(0,q.jsx)(Yq,{accent:Kq.secondary,label:e(`onboarding.providers.calloutLabel`),children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.providers.calloutBody`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`}),mono:(0,q.jsx)(`span`,{className:`font-mono`})}})})]})},{navLabel:e(`onboarding.cost.nav`),icon:(0,q.jsx)(_f,{className:`w-6 h-6`}),accent:Kq.warning,title:e(`onboarding.cost.title`),subtitle:e(`onboarding.cost.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.cost.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(Jq,{icon:(0,q.jsx)(Pf,{className:`w-4 h-4`}),label:e(`onboarding.cost.analyticsLabel`),accent:Kq.warning,children:e(`onboarding.cost.analyticsBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(_p,{className:`w-4 h-4`}),label:e(`onboarding.cost.perTicketLabel`),accent:Kq.warning,children:e(`onboarding.cost.perTicketBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(wf,{className:`w-4 h-4`}),label:e(`onboarding.cost.honestLabel`),accent:Kq.warning,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.cost.honestBody`,components:{mono:(0,q.jsx)(`span`,{className:`font-mono`})}})}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Gp,{className:`w-4 h-4`}),label:e(`onboarding.cost.budgetsLabel`),accent:Kq.warning,children:e(`onboarding.cost.budgetsBody`)})]})]})},{navLabel:e(`onboarding.workspace.nav`),icon:(0,q.jsx)(Zd,{className:`w-6 h-6`}),accent:Kq.highlight,title:e(`onboarding.workspace.title`),subtitle:e(`onboarding.workspace.subtitle`),content:(0,q.jsx)(`div`,{className:`space-y-4`,children:(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(Jq,{icon:(0,q.jsx)(Rp,{className:`w-4 h-4`}),label:e(`onboarding.workspace.terminalLabel`),accent:Kq.highlight,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.workspace.terminalBody`,values:{mod:Wq},components:{mod:(0,q.jsx)(qq,{children:Wq}),j:(0,q.jsx)(qq,{children:`J`})}})}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Of,{className:`w-4 h-4`}),label:e(`onboarding.workspace.codeLabel`),accent:Kq.highlight,children:e(`onboarding.workspace.codeBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(fp,{className:`w-4 h-4`}),label:e(`onboarding.workspace.integrationsLabel`),accent:Kq.highlight,children:e(`onboarding.workspace.integrationsBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(ap,{className:`w-4 h-4`}),label:e(`onboarding.workspace.themesLabel`),accent:Kq.highlight,children:e(`onboarding.workspace.themesBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Gf,{className:`w-4 h-4`}),label:e(`onboarding.workspace.chatsLabel`),accent:Kq.highlight,children:e(`onboarding.workspace.chatsBody`)}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(bp,{className:`w-4 h-4`}),label:e(`onboarding.workspace.desktopLabel`),accent:Kq.highlight,children:e(`onboarding.workspace.desktopBody`)})]})})},{navLabel:e(`onboarding.companion.nav`),icon:(0,q.jsx)(jp,{className:`w-6 h-6`}),accent:Kq.success,title:e(`onboarding.companion.title`),subtitle:e(`onboarding.companion.subtitle`),content:(0,q.jsx)(eJ,{})},{navLabel:e(`onboarding.moveFast.nav`),icon:(0,q.jsx)(yf,{className:`w-6 h-6`}),accent:Kq.primary,title:e(`onboarding.moveFast.title`),subtitle:e(`onboarding.moveFast.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(Yq,{accent:Kq.primary,label:e(`onboarding.moveFast.paletteLabel`),children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.moveFast.paletteShortcut`,values:{mod:Wq},components:{f:(0,q.jsx)(`span`,{className:`text-foreground`}),m:(0,q.jsx)(`span`,{className:`text-muted-foreground`}),mod:(0,q.jsx)(qq,{children:Wq}),k:(0,q.jsx)(qq,{children:`K`})}})}),e(`onboarding.moveFast.paletteBody`)]}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-3`,children:[(0,q.jsx)(Jq,{icon:(0,q.jsx)(Rp,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.terminalLabel`),accent:Kq.primary,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.moveFast.terminalBody`,values:{mod:Wq},components:{mod:(0,q.jsx)(qq,{children:Wq}),j:(0,q.jsx)(qq,{children:`J`})}})}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Uf,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.shortcutsLabel`),accent:Kq.primary,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.moveFast.shortcutsBody`,components:{q:(0,q.jsx)(qq,{children:`?`})}})}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Qf,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.chatLabel`),accent:Kq.primary,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.moveFast.chatBody`,values:{mod:Wq},components:{mod:(0,q.jsx)(qq,{children:Wq}),bkey:(0,q.jsx)(qq,{children:`B`})}})}),(0,q.jsx)(Jq,{icon:(0,q.jsx)(Nf,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.projectsLabel`),accent:Kq.primary,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.moveFast.projectsBody`,values:{alt:Gq,mod:Wq},components:{alt:(0,q.jsx)(qq,{children:Gq}),mod:(0,q.jsx)(qq,{children:Wq}),bkey:(0,q.jsx)(qq,{children:`B`})}})})]}),(0,q.jsx)(Yq,{accent:Kq.primary,children:(0,q.jsx)(Bi,{t:e,i18nKey:`onboarding.moveFast.outro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})})]})}]}function nJ({open:e,onClose:t}){let{t:n}=G(`setup`),[r,i]=(0,I.useState)(0),[a,o]=(0,I.useState)(!1),s=(0,I.useMemo)(()=>tJ(n),[n]),c=s[r],l=r===0,u=r===s.length-1,d=(0,I.useCallback)(()=>{a&&Hq(),i(0),t()},[a,t]),f=(0,I.useCallback)(()=>{Hq(),i(0),t()},[t]),p=(0,I.useCallback)(()=>{u?f():i(e=>e+1)},[u,f]),m=(0,I.useCallback)(()=>i(e=>Math.max(0,e-1)),[]);return(0,q.jsx)(Ry,{open:e,onOpenChange:e=>{e||d()},children:(0,q.jsxs)(zy,{children:[(0,q.jsx)(By,{className:`fixed inset-0 z-50 bg-black/70 backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,q.jsxs)(Vy,{className:`fixed left-[50%] top-[50%] z-50 flex flex-col w-[calc(100vw-2rem)] max-w-5xl h-[min(88vh,820px)] translate-x-[-50%] translate-y-[-50%] overflow-hidden border border-border/30 bg-popover shadow-2xl backdrop-blur-xl sm:rounded-2xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,"data-testid":`onboarding-wizard`,"aria-describedby":`onboarding-description`,children:[(0,q.jsx)(`div`,{className:X(`h-1 w-full shrink-0 transition-all duration-500`,c.accent.bar)}),(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,q.jsxs)(`nav`,{className:`hidden md:flex w-60 shrink-0 flex-col border-r border-border/30 bg-card/20 p-4`,children:[(0,q.jsxs)(`div`,{className:`px-2 mb-5`,children:[(0,q.jsxs)(`p`,{className:`text-sm font-bold tracking-tight`,children:[(0,q.jsx)(`span`,{className:`text-accent-primary`,children:`spec`}),(0,q.jsx)(`span`,{className:`text-accent-secondary`,children:`rails`})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:n(`onboarding.productTour`)})]}),(0,q.jsx)(`ol`,{className:`space-y-0.5 min-h-0 overflow-y-auto`,children:s.map((e,t)=>{let a=t===r,o=t<r;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(t),"aria-label":n(`onboarding.goToStep`,{step:t+1,label:e.navLabel}),"aria-current":a?`step`:void 0,className:X(`w-full flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors`,a?X(`bg-card/70`,e.accent.text):`text-muted-foreground hover:bg-card/40 hover:text-foreground`),children:[(0,q.jsx)(`span`,{className:X(`grid place-items-center w-5 h-5 shrink-0 rounded-full text-[10px] font-bold border`,a?X(e.accent.bar,`text-primary-foreground border-transparent`):o?`bg-accent-success/15 text-accent-success border-accent-success/30`:`border-border/50 text-muted-foreground`),children:o?(0,q.jsx)(nf,{className:`w-3 h-3`}):t+1}),(0,q.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.navLabel})]})},e.navLabel)})}),(0,q.jsx)(`div`,{className:`mt-auto px-2.5 pt-4 text-[10px] text-muted-foreground`,children:n(`onboarding.stepCount`,{current:r+1,total:s.length})})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 sm:p-7`,children:[(0,q.jsxs)(`div`,{className:X(`flex items-center gap-3.5 mb-5`,c.accent.text),children:[(0,q.jsx)(`div`,{className:X(`grid place-items-center w-12 h-12 shrink-0 rounded-xl border border-border/30 bg-card/40`,c.accent.glow),children:c.icon}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(Hy,{className:`text-lg font-bold leading-tight text-foreground`,children:c.title}),(0,q.jsx)(`p`,{id:`onboarding-description`,className:`text-xs text-muted-foreground mt-0.5`,children:c.subtitle})]})]}),(0,q.jsx)(`div`,{className:`md:hidden flex items-center gap-1.5 mb-5`,children:s.map((e,t)=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(t),"aria-label":n(`onboarding.stepLabel`,{step:t+1}),"aria-current":t===r?`step`:void 0,className:X(`h-1.5 rounded-full transition-all`,t===r?X(`w-6`,e.accent.bar):`w-1.5 bg-muted-foreground/30`)},e.navLabel))}),(0,q.jsx)(`div`,{className:`min-h-[300px]`,children:c.content})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border/30 px-6 sm:px-7 py-3.5`,children:[(0,q.jsx)(`div`,{className:`flex-1 min-w-0`,children:l&&(0,q.jsxs)(`label`,{className:`inline-flex items-center gap-2 cursor-pointer group`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked),className:`w-3.5 h-3.5 rounded`,"data-testid":`onboarding-dismiss-checkbox`}),(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground group-hover:text-foreground transition-colors`,children:n(`onboarding.dontShowAgain`)})]})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:d,className:`text-xs text-muted-foreground`,"data-testid":`onboarding-skip`,children:n(`onboarding.skipTour`)}):(0,q.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:m,className:`text-xs`,"data-testid":`onboarding-back`,children:[(0,q.jsx)(Wd,{className:`w-3.5 h-3.5 mr-1`}),n(`common:actions.back`)]}),(0,q.jsxs)(Z,{size:`sm`,onClick:p,className:X(`text-xs`,c.accent.btn),"data-testid":`onboarding-next`,children:[n(u?`onboarding.getStarted`:`common:actions.next`),!u&&(0,q.jsx)(Gd,{className:`w-3.5 h-3.5 ml-1`})]})]})]})]})]})]})]})})}var rJ=[`pinned-open`,`pinned-collapsed`,`unpinned`],iJ=`specrails-desktop:sidebar-mode:left`,aJ=`specrails-desktop:sidebar-mode:right`;function oJ(e){return typeof e==`string`&&rJ.includes(e)}function sJ(e){try{let t=window.localStorage.getItem(e);if(oJ(t))return t}catch{}return`unpinned`}function cJ(e,t){try{window.localStorage.setItem(e,t)}catch{}}function lJ(e){switch(e){case`pinned-open`:return`pinned-collapsed`;case`pinned-collapsed`:return`unpinned`;case`unpinned`:return`pinned-open`}}var uJ=(0,I.createContext)({leftMode:`unpinned`,rightMode:`unpinned`,setLeftMode:()=>{},setRightMode:()=>{},cycleLeftMode:()=>{},cycleRightMode:()=>{}});function dJ({children:e}){let[t,n]=(0,I.useState)(()=>sJ(iJ)),[r,i]=(0,I.useState)(()=>sJ(aJ));(0,I.useEffect)(()=>{cJ(iJ,t)},[t]),(0,I.useEffect)(()=>{cJ(aJ,r)},[r]);let a=(0,I.useCallback)(e=>n(e),[]),o=(0,I.useCallback)(e=>i(e),[]),s=(0,I.useCallback)(()=>n(e=>lJ(e)),[]),c=(0,I.useCallback)(()=>i(e=>lJ(e)),[]),l=(0,I.useMemo)(()=>({leftMode:t,rightMode:r,setLeftMode:a,setRightMode:o,cycleLeftMode:s,cycleRightMode:c}),[t,r,a,o,s,c]);return(0,q.jsx)(uJ.Provider,{value:l,children:e})}function fJ(){return(0,I.useContext)(uJ)}function pJ({project:e,isActive:t,expanded:n,onSelect:r,onRemove:i}){let{t:a}=G(`nav`),[o,s]=(0,I.useState)(!1),c=(0,I.useRef)(null);(0,I.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]);function l(e){e.stopPropagation(),o?(c.current&&clearTimeout(c.current),s(!1),i()):(s(!0),c.current=setTimeout(()=>{s(!1),c.current=null},3e3))}function u(e){e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),r())}return(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:r,onKeyDown:u,className:X(`group relative flex items-center gap-2 w-full h-8 rounded-md transition-colors`,n?`px-2`:`px-0 justify-center`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),title:n?void 0:e.name,"aria-current":t?`page`:void 0,children:[(0,q.jsx)(Nf,{className:X(`flex-shrink-0 w-4 h-4`,t&&`text-accent-primary`)}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-xs truncate flex-1 text-left`,children:e.name}),(0,q.jsx)(`button`,{type:`button`,onClick:l,className:X(`flex-shrink-0 flex items-center justify-center rounded-sm transition-all`,`opacity-0 group-hover:opacity-50 hover:!opacity-100 hover:bg-muted`,o?`opacity-100 px-1 h-4 text-[10px] text-destructive bg-destructive/10 hover:bg-destructive/20`:`w-3.5 h-3.5`),"aria-label":a(o?`projects.confirmRemove`:`projects.remove`,{name:e.name}),children:o?a(`projects.confirmShort`):(0,q.jsx)(qp,{className:`w-2.5 h-2.5`})})]})]})}var mJ={"pinned-open":`sidebarPin.left.pinnedOpen`,"pinned-collapsed":`sidebarPin.left.pinnedCollapsed`,unpinned:`sidebarPin.left.unpinned`};function hJ({onAddProject:e,onOpenAnalytics:t,onOpenDocs:n,onOpenSettings:r}){let{t:i}=G(`nav`),{projects:a,activeProjectId:o,setActiveProjectId:s,removeProject:c}=Sd(),{leftMode:l,cycleLeftMode:u}=fJ(),[d,f]=(0,I.useState)(!1),p=l===`pinned-open`||l===`unpinned`&&d,m=l!==`unpinned`,h=i(mJ[l]),g=[{label:i(`arcSidebar.docs`),icon:Yd,action:n},{label:i(`arcSidebar.analytics`),icon:ef,action:t},{label:i(`arcSidebar.settings`),icon:kp,action:r}];async function _(e){try{await c(e.id)}catch{}}return(0,q.jsxs)(`div`,{className:X(`relative flex flex-col h-full border-r border-border bg-background flex-shrink-0`,`transition-all duration-200 ease-in-out overflow-hidden`,p?`w-52`:`w-11`),onMouseEnter:()=>{l===`unpinned`&&f(!0)},onMouseLeave:()=>{l===`unpinned`&&f(!1)},children:[(0,q.jsxs)(`div`,{className:X(`flex items-center h-12 border-b border-border flex-shrink-0`,p?`px-3 justify-between`:`justify-center`),children:[p&&(0,q.jsx)(`span`,{className:`font-mono text-sm font-bold whitespace-nowrap overflow-hidden text-accent-primary`,children:i(`arcSidebar.desktopTitle`)}),(0,q.jsx)(`button`,{type:`button`,onClick:u,className:X(`flex items-center justify-center w-7 h-7 rounded-md transition-colors flex-shrink-0`,m?`text-foreground bg-muted`:`text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted/50`),"aria-label":h,title:i(`sidebarPin.withShortcut`,{label:h,shortcut:`⌥⌘B`}),children:(0,q.jsx)(op,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1.5 space-y-0.5`,children:[a.map(e=>(0,q.jsx)(pJ,{project:e,isActive:e.id===o,expanded:p,onSelect:()=>s(e.id),onRemove:()=>_(e)},e.id)),(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted/50`,p?`px-2`:`px-0 justify-center`),"aria-label":i(`projects.addProject`),title:p?void 0:i(`projects.addProject`),children:[(0,q.jsx)(pp,{className:`w-4 h-4 flex-shrink-0`}),p&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap`,children:i(`projects.addProject`)})]})]}),(0,q.jsx)(`div`,{className:`border-t border-border py-2 px-1.5 space-y-0.5`,children:g.map(({label:e,icon:t,action:n})=>(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted/50`,p?`px-2`:`px-0 justify-center`),"aria-label":e,title:p?void 0:e,children:[(0,q.jsx)(t,{className:`w-4 h-4 flex-shrink-0`}),p&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap`,children:e})]},e))})]})}var gJ={"pinned-open":`sidebarPin.right.pinnedOpen`,"pinned-collapsed":`sidebarPin.right.pinnedCollapsed`,unpinned:`sidebarPin.right.unpinned`};function _J(){let{t:e}=G(`nav`),{rightMode:t,cycleRightMode:n}=fJ(),{projects:r,activeProjectId:i}=Sd(),[a,o]=(0,I.useState)(!1),s=t===`pinned-open`||t===`unpinned`&&a,c=t!==`unpinned`,l=e(gJ[t]),u=r.find(e=>e.id===i),d=u?hd(u):[`claude`],f=eb&&ZE(`agents`,d),p=ZE(`integrations`,d),m=[{to:`/`,end:!0,icon:Kf,label:e(`rightSidebar.dashboard`)},{to:`/jobs`,end:!1,icon:Qd,label:e(`rightSidebar.jobs`)},{to:`/analytics`,end:!1,icon:$d,label:e(`rightSidebar.analytics`)},...f?[{to:`/agents`,end:!1,icon:Xd,label:e(`rightSidebar.agents`)}]:[],...tb?[{to:`/code`,end:!1,icon:hf,label:e(`rightSidebar.code`)}]:[],...p?[{to:`/integrations`,end:!1,icon:mp,label:e(`rightSidebar.integrations`)}]:[],{to:`/settings`,end:!1,icon:kp,label:e(`rightSidebar.settings`)}];return(0,q.jsxs)(`div`,{className:X(`relative flex flex-col h-full border-l border-border bg-background flex-shrink-0`,`transition-all duration-200 ease-in-out overflow-hidden`,s?`w-44`:`w-11`),onMouseEnter:()=>{t===`unpinned`&&o(!0)},onMouseLeave:()=>{t===`unpinned`&&o(!1)},children:[(0,q.jsxs)(`div`,{className:X(`flex items-center h-12 border-b border-border flex-shrink-0`,s?`px-3 justify-between`:`justify-center`),children:[s&&(0,q.jsx)(`span`,{className:`font-mono text-sm font-bold whitespace-nowrap overflow-hidden text-accent-secondary`,children:e(`rightSidebar.projectTitle`)}),(0,q.jsx)(`button`,{type:`button`,onClick:n,className:X(`flex items-center justify-center w-7 h-7 rounded-md transition-colors`,c?`text-foreground bg-muted`:`text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted/50`),"aria-label":l,title:e(`sidebarPin.withShortcut`,{label:l,shortcut:`⌘B`}),children:(0,q.jsx)(sp,{className:`w-4 h-4`})})]}),(0,q.jsx)(`nav`,{className:`flex-1 py-2 px-1.5 space-y-0.5`,children:m.map(({to:e,end:t,icon:n,label:r})=>(0,q.jsxs)(Nn,{to:e,end:t,className:({isActive:e})=>X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,s?`px-2`:`px-0 justify-center`,e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),title:s?void 0:r,children:[(0,q.jsx)(n,{className:`w-4 h-4 flex-shrink-0`}),s&&(0,q.jsx)(`span`,{className:`text-xs truncate`,children:r})]},e))})]})}function vJ(e){return{darwin:{title:`macOS`,intro:e(`setup:instructions.darwin.intro`),commands:[{label:e(`setup:instructions.darwin.installNodeGit`),command:`brew install node git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitOfficial`),url:`https://git-scm.com/downloads`},{label:`Homebrew`,url:`https://brew.sh`}]},win32:{title:`Windows`,intro:e(`setup:instructions.win32.intro`),commands:[{label:e(`setup:instructions.win32.installNode`),command:`winget install OpenJS.NodeJS.LTS`},{label:e(`setup:instructions.win32.installGit`),command:`winget install Git.Git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitWindows`),url:`https://git-scm.com/download/win`}],note:e(`setup:instructions.win32.note`)},linux:{title:`Linux`,intro:e(`setup:instructions.linux.intro`),commands:[{label:e(`setup:instructions.linux.debian`),command:`sudo apt install -y nodejs npm git`},{label:e(`setup:instructions.linux.fedora`),command:`sudo dnf install -y nodejs npm git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitOfficial`),url:`https://git-scm.com/downloads`}]}}}var yJ=[`darwin`,`win32`,`linux`];async function bJ(e){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function xJ({command:e}){let{t}=G(`setup`),[n,r]=(0,I.useState)(!1);return(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:async()=>{await bJ(e)&&(r(!0),window.setTimeout(()=>r(!1),1500))},className:`h-7 px-2 gap-1.5 text-[11px]`,"data-testid":`install-copy-button`,children:n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(nf,{className:`w-3 h-3`}),t(`common:actions.copied`)]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(bf,{className:`w-3 h-3`}),t(`common:actions.copy`)]})})}function SJ({platform:e,primary:t}){let{t:n}=G(`setup`),r=vJ(n)[e];return(0,q.jsxs)(`section`,{"data-testid":`install-section-${e}`,className:X(`rounded-lg border px-3 py-3`,t?`border-border/40 bg-background/40`:`border-border/20 bg-background/20`),children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:r.title}),r.intro&&(0,q.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:r.intro}),(0,q.jsx)(`div`,{className:`mt-2 space-y-2`,children:r.commands.map(e=>(0,q.jsxs)(`div`,{className:`rounded-md border border-border/30 bg-background/60 px-2 py-2`,children:[(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground mb-1`,children:e.label}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`code`,{className:`text-xs text-foreground font-mono break-all`,children:e.command}),(0,q.jsx)(xJ,{command:e.command})]})]},e.command))}),r.links.length>0&&(0,q.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1`,children:r.links.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-accent-info hover:underline`,children:[e.label,(0,q.jsx)(Df,{className:`w-3 h-3`})]})},e.url))}),r.note&&(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-accent-highlight`,children:r.note})]})}function CJ(){let{t:e}=G(`setup`),[t,n]=(0,I.useState)(`idle`);return(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:async()=>{n(`copying`);try{let e=await fetch(`${sl}/api/setup-prerequisites?diagnostic=1`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();await navigator.clipboard.writeText(JSON.stringify(t,null,2)),n(`copied`),setTimeout(()=>n(`idle`),1800)}catch{n(`error`),setTimeout(()=>n(`idle`),2400)}},disabled:t===`copying`,className:`gap-1.5 text-[11px]`,"data-testid":`copy-diagnostics-button`,children:[t===`copied`?(0,q.jsx)(nf,{className:`w-3 h-3 text-accent-success`}):(0,q.jsx)(pf,{className:`w-3 h-3`}),e(t===`copied`?`instructions.diagnostics.copied`:t===`error`?`instructions.diagnostics.failed`:`instructions.diagnostics.copy`)]})}function wJ({open:e,onClose:t,status:n,onRecheck:r,isRechecking:i}){let{t:a}=G(`setup`),[o,s]=(0,I.useState)(!1),c=n?.platform??`darwin`,l=yJ.filter(e=>e!==c);return n?.missingRequired?.some(e=>e.error===`corrupted-bundle`)??!1?(0,q.jsx)(Gy,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(Jy,{className:`max-w-xl`,"data-testid":`install-modal-corrupted-bundle`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:a(`instructions.corrupted.title`)}),(0,q.jsx)(Qy,{children:a(`instructions.corrupted.description`)})]}),(0,q.jsx)(`p`,{className:`text-sm text-foreground`,children:a(`instructions.corrupted.body`)}),(0,q.jsx)(`div`,{className:`flex justify-end mt-2`,children:(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,"data-testid":`install-corrupted-close-button`,children:a(`common:actions.close`)})})]})}):(0,q.jsx)(Gy,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(Jy,{className:`max-w-xl`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsx)(Zy,{children:a(`instructions.title`)}),(0,q.jsx)(Qy,{children:a(`instructions.description`)})]}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(SJ,{platform:c,primary:!0}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-[11px] text-muted-foreground hover:text-foreground underline-offset-2 hover:underline`,"data-testid":`install-toggle-others`,children:a(o?`instructions.hideOtherPlatforms`:`instructions.showOtherPlatforms`)}),o&&(0,q.jsx)(`div`,{className:`space-y-3`,children:l.map(e=>(0,q.jsx)(SJ,{platform:e,primary:!1},e))})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mt-2`,children:[(0,q.jsx)(CJ,{}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:a(`common:actions.close`)}),(0,q.jsxs)(Z,{type:`button`,variant:`default`,size:`sm`,onClick:r,disabled:i,className:`gap-1.5`,"data-testid":`install-recheck-button`,children:[(0,q.jsx)(yp,{className:X(`w-3 h-3`,i&&`animate-spin`)}),a(`instructions.recheck`)]})]})]})]})})}var TJ=typeof window<`u`&&`__TAURI_INTERNALS__`in window,EJ=[`claude`,`codex`];function DJ({open:e,onClose:t}){let[n,i]=(0,I.useState)(new Set([`claude`])),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)({claude:!0,codex:!1}),[p,m]=(0,I.useState)(!1),{t:h}=G(`setup`),{addProject:g,startSetupWizard:_,setActiveProjectId:v}=Sd(),{status:y,isLoading:b,error:x,recheck:S}=mq(),C=(0,I.useMemo)(()=>{if(!y||y.ok)return null;let e=y.missingRequired.map(e=>e.label);return e.length===0?null:h(`addProject.toolsRequired`,{tools:e.join(`, `),count:e.length})},[y,h]),w=y!==null&&!y.ok&&!x;(0,I.useEffect)(()=>{e&&fetch(`/api/available-providers`).then(e=>e.json()).then(e=>{let t=!!e.claude,n=!!e.codex;f({claude:t,codex:n});let r=new Set;t&&r.add(`claude`),n&&r.add(`codex`),r.size===0&&r.add(`claude`),i(r)}).catch(()=>{})},[e]);function T(e){i(t=>{let n=new Set(t);if(n.has(e)){if(n.size===1)return t;n.delete(e)}else n.add(e);return n})}let E=EJ.filter(e=>n.has(e)&&d[e]);async function D(){let e=a.trim();if(!e){K.error(h(`addProject.errors.pathRequired`));return}if(E.length===0){K.error(h(`addProject.errors.selectProvider`));return}u(!0);try{let t=await g(e,s.trim()||void 0,E);if(!t)return;let{project:n}=t;t.has_specrails===!1?(O(),v(n.id),_(n.id)):(K.success(h(`addProject.toasts.registered`,{name:n.name})),O())}catch(e){K.error(h(`addProject.errors.addFailed`),{description:e.message})}finally{u(!1)}}function O(){o(``),c(``),t()}function k(e){e||O()}let A=!d.claude&&!d.codex;return(0,q.jsx)(Gy,{open:e,onOpenChange:k,children:(0,q.jsxs)(Jy,{className:`max-w-md`,children:[(0,q.jsxs)(Yy,{children:[(0,q.jsxs)(Zy,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Nf,{className:`w-4 h-4`}),h(`addProject.title`)]}),(0,q.jsx)(Qy,{children:h(`addProject.description`)})]}),A&&(0,q.jsx)(`p`,{className:`text-xs text-destructive bg-destructive/10 rounded-md p-2`,children:h(`addProject.noProviderDetected`)}),(0,q.jsx)(gq,{status:y,isLoading:b,error:x,onMoreInfo:()=>m(!0),onRefresh:S}),(0,q.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{className:`text-xs font-medium`,children:[h(`addProject.pathLabel`),` `,(0,q.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(_H,{placeholder:h(`addProject.pathPlaceholder`),value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&D()},autoFocus:!0,className:`flex-1`}),TJ&&(0,q.jsx)(Z,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,title:h(`addProject.browseForFolder`),onClick:async()=>{try{let{open:e}=await r(async()=>{let{open:e}=await import(`./dist-js-CvScGQU_.js`);return{open:e}},[]),t=await e({directory:!0,multiple:!1,title:h(`addProject.selectProjectFolder`)});typeof t==`string`&&t&&(o(t),s||c(t.split(`/`).filter(Boolean).pop()??``))}catch{}},children:(0,q.jsx)(Nf,{className:`w-4 h-4`})})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:h(`addProject.pathHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{className:`text-xs font-medium`,children:[h(`addProject.nameLabel`),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:h(`addProject.optional`)})]}),(0,q.jsx)(_H,{placeholder:h(`addProject.namePlaceholder`),value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&D()}}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:h(`addProject.nameHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:h(`addProject.providersLabel`)}),(0,q.jsx)(`div`,{className:`flex gap-2`,children:[{id:`claude`,icon:`🤖`,label:`Claude`},{id:`codex`,icon:`⚡`,label:`Codex`}].map(({id:e,icon:t,label:r})=>{let i=d[e],a=n.has(e)&&i;return(0,q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":a,disabled:!i,onClick:()=>T(e),"data-testid":`provider-toggle-${e}`,className:X(`flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-left transition-colors text-xs`,`focus:outline-none focus-visible:ring-1 focus-visible:ring-ring`,a?`border-accent-primary/60 bg-accent-primary/10 text-foreground`:`border-border/30 text-muted-foreground hover:border-border/60`,!i&&`opacity-40 cursor-not-allowed`),children:[(0,q.jsx)(`span`,{className:X(`inline-flex h-3.5 w-3.5 items-center justify-center rounded-sm border text-[9px] leading-none`,a?`border-accent-primary bg-accent-primary text-background`:`border-border/50`),"aria-hidden":!0,children:a?`✓`:``}),(0,q.jsx)(`span`,{children:t}),(0,q.jsx)(`span`,{className:`font-medium`,children:r}),!i&&(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground/60`,children:h(`addProject.notFound`)})]},e)})}),(0,q.jsx)(`p`,{className:`text-[9px] text-muted-foreground/70`,children:E.length>1?h(`addProject.multiProviderHint`):h(`addProject.singleProviderHint`)})]})]}),(0,q.jsxs)(Xy,{children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:t,disabled:l,children:h(`common:actions.cancel`)}),(0,q.jsx)(Z,{size:`sm`,onClick:D,disabled:l||!a.trim()||A||E.length===0||w||b,title:w?C??void 0:void 0,"data-testid":`add-project-submit`,children:h(l?`addProject.adding`:`addProject.submit`)})]}),(0,q.jsx)(wJ,{open:p,onClose:()=>m(!1),status:y,onRecheck:S,isRechecking:b})]})})}var OJ=1,kJ=.9,AJ=.8,jJ=.17,MJ=.1,NJ=.999,PJ=.9999,FJ=.99,IJ=/[\\\/_+.#"@\[\(\{&]/,LJ=/[\\\/_+.#"@\[\(\{&]/g,RJ=/[\s-]/,zJ=/[\s-]/g;function BJ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?OJ:FJ;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=BJ(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=OJ:IJ.test(e.charAt(l-1))?(d*=AJ,p=e.slice(i,l-1).match(LJ),p&&i>0&&(d*=NJ**+p.length)):RJ.test(e.charAt(l-1))?(d*=kJ,m=e.slice(i,l-1).match(zJ),m&&i>0&&(d*=NJ**+m.length)):(d*=jJ,i>0&&(d*=NJ**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=PJ)),(d<MJ&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=BJ(e,t,n,r,l+1,a+2,o),f*MJ>d&&(d=f*MJ)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function VJ(e){return e.toLowerCase().replace(zJ,` `)}function HJ(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,BJ(e,t,VJ(e),VJ(t),0,0,{})}var UJ=`[cmdk-group=""]`,WJ=`[cmdk-group-items=""]`,GJ=`[cmdk-group-heading=""]`,KJ=`[cmdk-item=""]`,qJ=`${KJ}:not([aria-disabled="true"])`,JJ=`cmdk-item-select`,YJ=`data-value`,XJ=(e,t,n)=>HJ(e,t,n),ZJ=I.createContext(void 0),QJ=()=>I.useContext(ZJ),$J=I.createContext(void 0),eY=()=>I.useContext($J),tY=I.createContext(void 0),nY=I.forwardRef((e,t)=>{let n=gY(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=gY(()=>new Set),i=gY(()=>new Map),a=gY(()=>new Map),o=gY(()=>new Set),s=mY(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Pg(),y=Pg(),b=Pg(),x=I.useRef(null),S=yY();hY(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),hY(()=>{S(6,k)},[]);let C=I.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=I.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??XJ;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(WJ);t?t.appendChild(e.parentElement===t?e:e.closest(`${WJ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${WJ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${UJ}[${YJ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(YJ);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(UJ)?.querySelector(GJ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${KJ}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(qJ)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(YJ))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(YJ))}function P(e){let t=A()?.closest(UJ),n;for(;t&&!n;)t=e>0?fY(t,UJ):pY(t,UJ),n=t?.querySelector(qJ);n?C.setState(`value`,n.getAttribute(YJ)):N(e)}let F=()=>M(j().length-1),L=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},ee=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return I.createElement(Gg.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&ee(e);break;case`ArrowUp`:ee(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(JJ);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:SY},c),xY(e,e=>I.createElement($J.Provider,{value:C},I.createElement(ZJ.Provider,{value:w},e))))}),rY=I.forwardRef((e,t)=>{let n=Pg(),r=I.useRef(null),i=I.useContext(tY),a=QJ(),o=mY(e),s=o.current?.forceMount??i?.forceMount;hY(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=vY(n,r,[e.value,e.children,r],e.keywords),l=eY(),u=_Y(e=>e.value&&e.value===c.current),d=_Y(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);I.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(JJ,f),()=>t.removeEventListener(JJ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return I.createElement(Gg.div,{ref:Xp(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),iY=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Pg(),s=I.useRef(null),c=I.useRef(null),l=Pg(),u=QJ(),d=_Y(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);hY(()=>u.group(o),[]),vY(o,s,[e.value,e.heading,c]);let f=I.useMemo(()=>({id:o,forceMount:i}),[i]);return I.createElement(Gg.div,{ref:Xp(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&I.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),xY(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},I.createElement(tY.Provider,{value:f},e))))}),aY=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),a=_Y(e=>!e.search);return!n&&!a?null:I.createElement(Gg.div,{ref:Xp(i,t),...r,"cmdk-separator":``,role:`separator`})}),oY=I.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=eY(),o=_Y(e=>e.search),s=_Y(e=>e.selectedItemId),c=QJ();return I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.createElement(Gg.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),sY=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=I.useRef(null),o=I.useRef(null),s=_Y(e=>e.selectedItemId),c=QJ();return I.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),I.createElement(Gg.div,{ref:Xp(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},xY(e,e=>I.createElement(`div`,{ref:Xp(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),cY=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(Ry,{open:n,onOpenChange:r},I.createElement(zy,{container:o},I.createElement(By,{"cmdk-overlay":``,className:i}),I.createElement(Vy,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(nY,{ref:t,...s}))))}),lY=I.forwardRef((e,t)=>_Y(e=>e.filtered.count===0)?I.createElement(Gg.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),uY=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.createElement(Gg.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},xY(e,e=>I.createElement(`div`,{"aria-hidden":!0},e)))}),dY=Object.assign(nY,{List:sY,Item:rY,Input:oY,Group:iY,Separator:aY,Dialog:cY,Empty:lY,Loading:uY});function fY(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function pY(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mY(e){let t=I.useRef(e);return hY(()=>{t.current=e}),t}var hY=typeof window>`u`?I.useEffect:I.useLayoutEffect;function gY(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function _Y(e){let t=eY(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function vY(e,t,n,r=[]){let i=I.useRef(),a=QJ();return hY(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(YJ,s),i.current=s}),i}var yY=()=>{let[e,t]=I.useState(),n=gY(()=>new Map);return hY(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function bY(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function xY({asChild:e,children:t},n){return e&&I.isValidElement(t)?I.cloneElement(bY(t),{ref:t.ref},n(t.props.children)):n(t)}var SY={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function CY({onOpenSettings:e,onOpenAnalytics:t,onOpenDocs:n}){let{t:r}=G(`commands`),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)([]),[c,l]=(0,I.useState)([]),{projects:u,activeProjectId:d,setActiveProjectId:f}=Sd(),{leftMode:p,rightMode:m,cycleLeftMode:h,cycleRightMode:g}=fJ(),_=r(p===`pinned-open`?`palette.sidebar.collapseLeftKeepPinned`:p===`pinned-collapsed`?`palette.sidebar.unpinLeft`:`palette.sidebar.pinLeftOpen`),v=r(m===`pinned-open`?`palette.sidebar.collapseRightKeepPinned`:m===`pinned-collapsed`?`palette.sidebar.unpinRight`:`palette.sidebar.pinRightOpen`),y=ct(),b=(0,I.useRef)(!1);(0,I.useEffect)(()=>{function e(e){e.key===`k`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),a(e=>!e))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,I.useEffect)(()=>{if(!i){b.current=!1;return}if(b.current)return;b.current=!0;async function e(){try{let[e,t]=await Promise.all([fetch(`${ul()}/config`),fetch(`${ul()}/jobs?limit=10`)]);e.ok&&s((await e.json()).commands),t.ok&&l((await t.json()).jobs)}catch{}}e()},[i]);let x=(0,I.useCallback)(e=>{f(e),a(!1)},[f]),S=(0,I.useCallback)(async e=>{a(!1);try{let t=await fetch(`${ul()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:`/specrails:${e}`})}),n=await t.json();if(!t.ok)throw Error(n.error??r(`errors.spawnFailed`));K.success(r(`toasts.queued`,{name:e})),y(`/jobs/${n.jobId}`)}catch(e){K.error(e instanceof Error?e.message:r(`errors.spawnFailed`))}},[y,r]),C=(0,I.useCallback)(e=>{a(!1),y(`/jobs/${e}`)},[y]),w=(0,I.useCallback)(e=>{a(!1),y(e)},[y]),T=(0,I.useCallback)(e=>{e&&(a(!1),e())},[]),E=`flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer text-sm data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground`;return(0,q.jsxs)(dY.Dialog,{open:i,onOpenChange:a,label:r(`palette.label`),className:X(`fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%]`,`border border-border/30 bg-popover shadow-2xl backdrop-blur-md rounded-xl overflow-hidden`),children:[(0,q.jsx)(`span`,{className:`sr-only`,children:r(`palette.label`)}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 border-b border-border/30`,children:[(0,q.jsx)(Ep,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(dY.Input,{placeholder:r(`palette.searchPlaceholder`),className:`flex-1 h-11 bg-transparent text-sm outline-none placeholder:text-muted-foreground/50`}),(0,q.jsx)(`kbd`,{className:`hidden sm:inline-flex items-center gap-0.5 rounded border border-border/50 bg-muted/30 px-1.5 py-0.5 text-[10px] text-muted-foreground font-mono`,children:`esc`})]}),(0,q.jsxs)(dY.List,{className:`max-h-80 overflow-y-auto p-2`,children:[(0,q.jsx)(dY.Empty,{className:`py-8 text-center text-sm text-muted-foreground`,children:r(`palette.noResults`)}),u.length>0&&(0,q.jsx)(dY.Group,{heading:r(`palette.groups.projects`),children:u.map(e=>(0,q.jsxs)(dY.Item,{value:e.name,keywords:[e.slug],onSelect:()=>x(e.id),className:X(E,e.id===d&&`text-accent-primary`),children:[(0,q.jsx)(Nf,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.id===d&&(0,q.jsx)(`span`,{className:`text-[10px] text-accent-primary font-medium`,children:r(`palette.activeBadge`)})]},e.id))}),o.length>0&&(0,q.jsx)(dY.Group,{heading:r(`palette.groups.spec`),children:o.map(e=>(0,q.jsxs)(dY.Item,{value:e.name,keywords:[e.slug,e.description??``],onSelect:()=>S(e.slug),className:E,children:[(0,q.jsx)(Jp,{className:`w-4 h-4 text-accent-info shrink-0`}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.name}),e.description&&(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground/60 ml-2 truncate`,children:e.description})]})]},e.id))}),c.length>0&&(0,q.jsx)(dY.Group,{heading:r(`palette.groups.jobs`),children:c.map(e=>(0,q.jsxs)(dY.Item,{value:`${e.command} ${e.id}`,keywords:[e.status],onSelect:()=>C(e.id),className:E,children:[(0,q.jsx)(Qd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.command}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-medium`,e.status===`completed`&&`text-accent-success`,e.status===`failed`&&`text-destructive`,e.status===`running`&&`text-accent-info`,e.status===`queued`&&`text-muted-foreground`),children:r(`common:status.${e.status}`,{defaultValue:e.status})})]},e.id))}),(0,q.jsxs)(dY.Group,{heading:r(`palette.groups.navigation`),children:[(0,q.jsxs)(dY.Item,{value:r(`palette.nav.dashboard`),keywords:[`home`],onSelect:()=>w(`/`),className:E,children:[(0,q.jsx)(Kf,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.dashboard`)})]}),t&&(0,q.jsxs)(dY.Item,{value:r(`palette.nav.desktopAnalytics`),keywords:[`cross-project`,`desktop`],onSelect:()=>T(t),className:E,children:[(0,q.jsx)(tf,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.desktopAnalytics`)})]}),(0,q.jsxs)(dY.Item,{value:r(`palette.nav.projectAnalytics`),keywords:[`metrics`],onSelect:()=>w(`/analytics`),className:E,children:[(0,q.jsx)($d,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.projectAnalytics`)})]}),(0,q.jsxs)(dY.Item,{value:r(`palette.nav.activityFeed`),keywords:[`log`],onSelect:()=>w(`/activity`),className:E,children:[(0,q.jsx)(Bd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.activityFeed`)})]}),(0,q.jsxs)(dY.Item,{value:r(`palette.nav.desktopSettings`),keywords:[`configuration`],onSelect:()=>e?T(e):w(`/settings`),className:E,children:[(0,q.jsx)(kp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.desktopSettings`)})]}),(0,q.jsxs)(dY.Item,{value:r(`palette.nav.docs`),keywords:[`documentation`],onSelect:()=>n?T(n):w(`/docs`),className:E,children:[(0,q.jsx)(jf,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.docs`)})]}),(0,q.jsxs)(dY.Item,{value:_,keywords:[`sidebar`,`panel`,`left`,`pin`,`collapse`,`unpin`,`cycle`],onSelect:()=>{h(),a(!1)},className:E,children:[(0,q.jsx)(op,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:_})]}),(0,q.jsxs)(dY.Item,{value:v,keywords:[`sidebar`,`panel`,`right`,`nav`,`pin`,`collapse`,`unpin`,`cycle`],onSelect:()=>{g(),a(!1)},className:E,children:[(0,q.jsx)(sp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:v})]})]})]}),(0,q.jsx)(`div`,{className:`flex items-center justify-between px-3 py-2 border-t border-border/30 text-[10px] text-muted-foreground/50`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`↑↓`}),` `,r(`palette.footer.navigate`)]}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`↵`}),` `,r(`palette.footer.select`)]}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`esc`}),` `,r(`palette.footer.close`)]})]})})]})}var wY=`
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Contract Layer
|
|
141
|
+
|
|
142
|
+
`;function TY(e){return`contract-refine:${e}`}async function EY(e,t){try{let n=await fetch(`${sl}/api/projects/${e}/tickets/${t}/contract-refine`,{method:`POST`});if(n.ok)K.loading(J.t(`activity:contractRefine.refining`),{id:TY(t)});else{let e=await n.json().catch(()=>({}));K.error(e.error?J.t(`activity:contractRefine.retryRejectedWithError`,{error:e.error}):J.t(`activity:contractRefine.retryRejected`),{id:TY(t)})}}catch(e){K.error(J.t(`activity:contractRefine.retryFailed`,{message:e.message}),{id:TY(t)})}}function DY({children:e}){let{registerHandler:t,unregisterHandler:n}=xl(),r=(0,I.useRef)(new Map),i=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`explore.contract_refine_failed`)return;let n=t.ticketId,i=t.projectId,a=t.reason??`unknown`;typeof n!=`number`||!i||(r.current.set(n,i),K.error(J.t(`activity:contractRefine.skipped`),{id:TY(n),description:J.t(`activity:contractRefine.reason`,{reason:a}),action:{label:J.t(`common:actions.retry`),onClick:()=>void EY(i,n)},duration:15e3}))},[]),a=(0,I.useCallback)(e=>{let t=e;if(!t||t.type!==`ticket_updated`)return;let n=t.ticket;n&&typeof n.description==`string`&&n.description.includes(wY)&&K.success(J.t(`activity:contractRefine.added`,{title:n.title||`#${n.id}`}),{id:TY(n.id),duration:3500})},[]);return(0,I.useLayoutEffect)(()=>(t(`_contract_refine_failed`,i),t(`_contract_refine_ticket_updated`,a),()=>{n(`_contract_refine_failed`),n(`_contract_refine_ticket_updated`)}),[t,n,i,a]),(0,I.useEffect)(()=>()=>r.current.clear(),[]),(0,q.jsx)(q.Fragment,{children:e})}var OY=class extends gW{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,t){AY(t);let n=new hW;e&&(n.onmessage=e);let r=await $(`plugin:updater|download`,{onEvent:n,rid:this.rid,...t});this.downloadedBytes=new gW(r)}async install(){if(!this.downloadedBytes)throw Error(`Update.install called before Update.download`);await $(`plugin:updater|install`,{updateRid:this.rid,bytesRid:this.downloadedBytes.rid}),this.downloadedBytes=void 0}async downloadAndInstall(e,t){AY(t);let n=new hW;e&&(n.onmessage=e),await $(`plugin:updater|download_and_install`,{onEvent:n,rid:this.rid,...t})}async close(){await this.downloadedBytes?.close(),await super.close()}};async function kY(e){AY(e);let t=await $(`plugin:updater|check`,{...e});return t?new OY(t):null}function AY(e){e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries()))}async function jY(){await $(`plugin:process|restart`)}var MY=`specrails-desktop:dismissedDesktopUpdateVersion`,NY=`specrails-desktop-desktop-update`,PY=360*60*1e3;function FY(){return typeof window<`u`&&`__TAURI_INTERNALS__`in window}function IY(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_MOCK_DESKTOP_UPDATE===`true`}function LY(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_MOCK_DESKTOP_UPDATE_VERSION||`99.0.0-test`}function RY(e){return new Promise(t=>setTimeout(t,e))}function zY(){return{currentVersion:`1.40.1`,version:LY(),isMock:!0,async downloadAndInstall(e){let t=18*1024*1024;e({event:`Started`,data:{contentLength:t}});for(let n=0;n<12;n+=1)await RY(180),e({event:`Progress`,data:{chunkLength:Math.round(t/12)}});e({event:`Finished`})}}}function BY(e){return e<1024*1024?J.t(`commands:update.units.kb`,{value:Math.max(1,Math.round(e/1024))}):J.t(`commands:update.units.mb`,{value:(e/(1024*1024)).toFixed(1)})}function VY(){try{return localStorage.getItem(MY)}catch{return null}}function HY(e){try{localStorage.setItem(MY,e)}catch{}K.dismiss(NY)}function UY(e){switch(e){case`downloading`:return`var(--color-accent-info)`;case`ready`:return`var(--color-accent-success)`;default:return`var(--color-accent-primary)`}}function WY({state:e}){let t=`h-[15px] w-[15px]`;return e===`installing`?(0,q.jsx)(gf,{className:`${t} u-spin`,"aria-hidden":!0}):e===`ready`?(0,q.jsx)(nf,{className:`${t} u-check`,"aria-hidden":!0}):e===`error`?(0,q.jsx)(Hp,{className:t,"aria-hidden":!0}):(0,q.jsx)(mf,{className:t,"aria-hidden":!0})}function GY({state:e,progress:t}){let n=e===`downloading`&&t!=null,r=e===`installing`||e===`downloading`&&t==null,i=e===`ready`;return(0,q.jsxs)(`div`,{className:`relative h-1.5 w-full overflow-hidden rounded-full border border-border/30 bg-background/70`,children:[n&&(0,q.jsx)(`div`,{className:`relative h-full overflow-hidden rounded-full bg-[color:var(--u-accent)] transition-[width] duration-300 ease-out`,style:{width:`${t}%`},role:`progressbar`,"aria-valuenow":t??0,"aria-valuemin":0,"aria-valuemax":100,children:(0,q.jsx)(`span`,{className:`u-shimmer`,"aria-hidden":!0})}),r&&(0,q.jsx)(`span`,{className:`u-indeterminate`,"aria-hidden":!0}),i&&(0,q.jsx)(`div`,{className:`h-full w-full rounded-full bg-[color:var(--u-accent)]/80`,"aria-hidden":!0})]})}function KY({update:e,onClose:t}){let{t:n}=G(`commands`),[r,i]=(0,I.useState)(`available`),[a,o]=(0,I.useState)(0),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null);async function d(){try{i(`downloading`),o(0),c(null),u(null),await e.downloadAndInstall(e=>{if(e.event===`Started`){c(e.data.contentLength??null),o(0);return}if(e.event===`Progress`){o(t=>t+e.data.chunkLength);return}i(`installing`)}),i(`ready`)}catch(e){u(e.message||n(`update.errors.installFailed`)),i(`error`)}}function f(){if(e.isMock){K.success(n(`update.mockReady`),{duration:2500}),K.dismiss(NY),t?.();return}$(`restart_app`).catch(()=>{jY()})}let p=s&&s>0?Math.min(100,Math.round(a/s*100)):null,m=UY(r),h=r===`downloading`||r===`installing`,g=n(r===`downloading`?`update.title.downloading`:r===`installing`?`update.title.installing`:r===`ready`?`update.title.ready`:r===`error`?`update.title.error`:`update.title.available`),_=r===`available`?n(`update.desc.available`):r===`downloading`?p==null?n(`update.desc.fetching`,{size:BY(a)}):n(`update.desc.progress`,{percent:p,downloaded:BY(a),total:BY(s??0)}):r===`installing`?n(`update.desc.installing`):r===`ready`?n(`update.desc.ready`,{version:e.version}):l&&l.length<=80?l:n(`update.desc.errorFallback`),v=r===`available`?`${e.currentVersion} → ${e.version}`:r===`downloading`?n(`update.pill.downloading`):r===`installing`?n(`update.pill.installing`):r===`ready`?n(`update.pill.ready`):null;return(0,q.jsxs)(`div`,{className:`u-update-card relative flex w-full flex-col gap-2 overflow-hidden`,style:{"--u-accent":m},role:r===`error`?`alert`:`status`,"aria-live":r===`error`?`assertive`:`polite`,"data-state":r,children:[(0,q.jsx)(`span`,{className:`u-glow`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,q.jsx)(`span`,{className:`u-badge grid h-7 w-7 shrink-0 place-items-center rounded-lg border border-border/50 bg-background/60 text-[color:var(--u-accent)]`,"aria-hidden":!0,children:(0,q.jsx)(WY,{state:r})}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold leading-tight text-foreground`,children:g}),v!=null&&(0,q.jsx)(`span`,{className:`shrink-0 whitespace-nowrap rounded-md border border-border/40 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground`,style:r===`available`?void 0:{color:`var(--u-accent)`},children:v})]}),(0,q.jsx)(`p`,{className:`h-4 truncate text-[11px] leading-4 text-muted-foreground`,"data-testid":`update-description`,children:_}),(0,q.jsx)(GY,{state:r,progress:p}),(0,q.jsx)(`div`,{className:`flex items-center justify-end gap-1.5`,children:r===`ready`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-grid h-7 min-w-[64px] place-items-center rounded-lg border border-[color:var(--u-accent)]/45 bg-[color:var(--u-accent)]/15 px-3 text-[11px] font-semibold leading-none text-foreground transition-colors hover:bg-[color:var(--u-accent)]/25`,onClick:f,children:n(`update.actions.restart`)}),(0,q.jsx)(`button`,{type:`button`,className:`h-7 rounded-lg px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground`,onClick:()=>{K.dismiss(NY),t?.()},children:n(`update.actions.later`)})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-grid h-7 min-w-[64px] place-items-center rounded-lg border border-[color:var(--u-accent)]/45 bg-[color:var(--u-accent)]/15 px-3 text-[11px] font-semibold leading-none text-foreground transition-colors hover:bg-[color:var(--u-accent)]/25 disabled:cursor-not-allowed disabled:opacity-50`,disabled:h,onClick:()=>void d(),children:n(r===`installing`?`update.actions.installing`:r===`error`?`update.actions.tryAgain`:`update.actions.update`)}),(0,q.jsx)(`button`,{type:`button`,className:`h-7 rounded-lg px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,disabled:h,onClick:()=>{HY(e.version),t?.()},children:n(`update.actions.dismiss`)})]})})]})}function qY(){(0,I.useEffect)(()=>{let e=IY();if(!e&&!FY())return;let t=!1,n={current:!1};async function r(){if(!(t||n.current))try{let r=e?zY():await kY();if(t||!r||VY()===r.version)return;n.current=!0,K.custom(()=>(0,q.jsx)(KY,{update:r,onClose:()=>{n.current=!1}}),{id:NY,duration:1/0,dismissible:!1,unstyled:!0,closeButton:!1,onDismiss:()=>{n.current=!1},onAutoClose:()=>{n.current=!1}})}catch(e){console.warn(`[desktop-update] update check failed:`,e)}}r();let i=setInterval(()=>void r(),PY);return()=>{t=!0,clearInterval(i)}},[])}var JY=`input, textarea, select, [contenteditable="true"], [contenteditable=""], .monaco-editor, .xterm, [data-native-menu]`;function YY(e){return e instanceof Element?e.closest(JY)!==null:!1}function XY(e){YY(e.target)||e.preventDefault()}function ZY(){(0,I.useEffect)(()=>(document.addEventListener(`contextmenu`,XY),()=>document.removeEventListener(`contextmenu`,XY)),[])}function QY(){let{state:e,openTicketDetail:t,enterSplit:n,setComparedTicket:r}=iV(),{tickets:i}=Md(),a=at(),o=ct(),s=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(s.current||i.length===0)return;s.current=!0;let e=new URLSearchParams(a.search),c=e.get(`compare`),l=e.get(`compareSide`);if(!c)return;let u=Number.parseInt(c,10),d=l===`right`?`right`:`left`;if(typeof window<`u`&&window.innerWidth<900)return;if(!i.some(e=>e.id===u)){let e=new URLSearchParams(a.search);e.delete(`compare`),e.delete(`compareSide`);let t=e.toString();o({pathname:a.pathname,search:t?`?${t}`:``},{replace:!0});return}let f=e.get(`compareOrigin`);if(f){let e=Number.parseInt(f,10);if(i.some(t=>t.id===e)){t(e),n(d),r(u,d===`left`?`right`:`left`);return}}t(u)},[i,a.search,a.pathname,o,t,n,r]),(0,I.useEffect)(()=>{if(!s.current)return;let t=new URLSearchParams(a.search),n=t.has(`compare`);if(e.originSide===null){if(n){t.delete(`compare`),t.delete(`compareSide`),t.delete(`compareOrigin`);let e=t.toString();o({pathname:a.pathname,search:e?`?${e}`:``},{replace:!0})}return}let r=e.originSide===`left`?e.leftId:e.rightId,i=e.originSide===`left`?e.rightId:e.leftId;if(r==null||e.originSide==null)return;let c=new URLSearchParams(a.search);c.set(`compareSide`,e.originSide),c.set(`compareOrigin`,String(r)),i==null?c.delete(`compare`):c.set(`compare`,String(i));let l=c.toString();l!==(a.search.startsWith(`?`)?a.search.slice(1):a.search)&&o({pathname:a.pathname,search:l?`?${l}`:``},{replace:!0})},[e,a.search,a.pathname,o])}var $Y=(0,I.lazy)(()=>r(()=>import(`./JobDetailPage-DN2Jc8Ti.js`),__vite__mapDeps([27,1,28,29]))),eX=(0,I.lazy)(()=>r(()=>import(`./JobsPage-DmdpqijT.js`),__vite__mapDeps([30,1,31,32,29]))),tX=(0,I.lazy)(()=>r(()=>import(`./AnalyticsPage-BUd3gWYC.js`),__vite__mapDeps([33,1,34,35,31]))),nX=(0,I.lazy)(()=>r(()=>import(`./ActivityFeedPage-DJJlZ3mF.js`),__vite__mapDeps([36,1]))),rX=(0,I.lazy)(()=>r(()=>import(`./AgentsPage-49JaEDjR.js`),__vite__mapDeps([37,1]))),iX=(0,I.lazy)(()=>r(()=>import(`./CodePage-CqPPND47.js`),__vite__mapDeps([38,1,39,32]))),aX=(0,I.lazy)(()=>r(()=>import(`./IntegrationsPage-CX2Ybxx0.js`),__vite__mapDeps([40,1,32]))),oX=(0,I.lazy)(()=>r(()=>import(`./DesktopAnalyticsPage-CgvmSvF0.js`),__vite__mapDeps([41,1,34,35]))),sX=(0,I.lazy)(()=>r(()=>import(`./DocsPage-B4R1aksg.js`),__vite__mapDeps([42,1,28,43]))),cX=(0,I.lazy)(()=>r(()=>import(`./DocsDialog-hHFd3Ejs.js`),__vite__mapDeps([44,1,28,43]))),lX=new Set([`/settings`]),uX=`specrails-desktop:routeMemory`;try{localStorage.removeItem(uX)}catch{}function dX(e){let t=at(),n=ct(),r=(0,I.useRef)(new Map),i=(0,I.useRef)(null),a=(0,I.useRef)(!1);(0,I.useEffect)(()=>{Sa((e,t)=>{r.current.set(e,t)})},[]),(0,I.useEffect)(()=>{a.current||(a.current=!0,t.pathname!==`/`&&n(`/`,{replace:!0}))},[]),(0,I.useEffect)(()=>{if(i.current&&i.current!==e&&r.current.set(i.current,t.pathname),e&&e!==i.current){let i=r.current.get(e)??`/`;t.pathname!==i&&n(i,{replace:!0})}i.current=e},[e,t.pathname,n]),(0,I.useEffect)(()=>{e&&t.pathname!==`/`&&!lX.has(t.pathname)&&r.current.set(e,t.pathname)},[e,t.pathname])}function fX(){let{t:e}=G(`common`),{projects:t,activeProjectId:n,isLoading:r,isSwitchingProject:i,setupProjectIds:a,completeSetupWizard:o,setActiveProjectId:s}=Sd(),{cycleLeftMode:c,cycleRightMode:l}=fJ(),u=ct(),d=QG();QY();let[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(!1),b=(0,I.useCallback)(()=>y(!1),[]),[x,S]=(0,I.useState)(()=>!Vq());dX(n);let{cheatsheetOpen:C,setCheatsheetOpen:w,openCheatsheet:T}=eW(),E=[`/`,`/jobs`,`/analytics`,...eb?[`/agents`]:[],...tb?[`/code`]:[],`/integrations`,`/settings`];$U({onOpenCheatsheet:T,onToggleLeftSidebar:c,onToggleRightSidebar:l,onSwitchProject:e=>{let n=t[e-1];n&&s(n.id)},onSwitchProjectPage:e=>{let t=E[e-1];t&&u(t)},onToggleTerminalPanel:$y?()=>{n&&(d.togglePanel(n),d.getState(n).visibility===`hidden`?queueMicrotask(()=>d.focusActive(n)):d.focusActive(n))}:void 0}),GU({setActiveProjectId:s,projectsById:(0,I.useMemo)(()=>new Map(t.map(e=>[e.id,e.name])),[t])});let D=t.find(e=>e.id===n),O=n!==null&&a.has(n);return r?(0,q.jsxs)(`div`,{className:`flex h-full`,children:[(0,q.jsx)(`div`,{className:`w-11 border-r border-border bg-card/50 animate-pulse flex-shrink-0`}),(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})})]}):(0,q.jsxs)(`div`,{className:`flex h-full overflow-hidden font-sans`,children:[(0,q.jsx)(hJ,{onAddProject:()=>p(!0),onOpenAnalytics:()=>_(!0),onOpenDocs:()=>y(!0),onOpenSettings:()=>h(!0)}),(0,q.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[i&&(0,q.jsx)(`div`,{className:`h-0.5 w-full bg-accent-primary/70 animate-pulse shrink-0`,"data-testid":`project-switching-bar`}),(0,q.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:O&&D?(0,q.jsx)(Lq,{project:D,onComplete:()=>o(D.id),onSkip:()=>o(D.id)},D.id):(0,q.jsx)(I.Suspense,{fallback:(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})}),children:(0,q.jsxs)(Bt,{children:[(0,q.jsx)(Rt,{path:`/docs`,element:(0,q.jsx)(sX,{})}),(0,q.jsx)(Rt,{path:`/docs/:category/:slug`,element:(0,q.jsx)(sX,{})}),t.length===0?(0,q.jsx)(Rt,{path:`*`,element:(0,q.jsx)(qK,{onAddProject:()=>p(!0)})}):D?(0,q.jsxs)(Rt,{element:(0,q.jsx)(KK,{projectName:D.name,children:(0,q.jsx)(WK,{project:D})},D.id),children:[(0,q.jsx)(Rt,{path:`/`,element:(0,q.jsx)(uH,{})}),(0,q.jsx)(Rt,{path:`/jobs`,element:(0,q.jsx)(eX,{})}),(0,q.jsx)(Rt,{path:`/jobs/:id`,element:(0,q.jsx)($Y,{})}),(0,q.jsx)(Rt,{path:`/analytics`,element:(0,q.jsx)(tX,{})}),(0,q.jsx)(Rt,{path:`/activity`,element:(0,q.jsx)(nX,{})}),(0,q.jsx)(Rt,{path:`/agents`,element:(0,q.jsx)(rX,{})}),(0,q.jsx)(Rt,{path:`/code`,element:tb?(0,q.jsx)(iX,{}):(0,q.jsx)(It,{to:`/`,replace:!0})}),(0,q.jsx)(Rt,{path:`/integrations`,element:(0,q.jsx)(aX,{})}),(0,q.jsx)(Rt,{path:`/settings`,element:(0,q.jsx)(EH,{})}),(0,q.jsx)(Rt,{path:`*`,element:(0,q.jsx)(It,{to:`/`,replace:!0})})]}):(0,q.jsx)(Rt,{path:`*`,element:(0,q.jsx)(qK,{onAddProject:()=>p(!0)})})]})})})]}),D&&!O&&(0,q.jsx)(_J,{}),(0,q.jsx)(DJ,{open:f,onClose:()=>p(!1)}),(0,q.jsx)(JU,{open:m,onClose:()=>h(!1),onOpenOnboarding:()=>{h(!1),S(!0)}}),(0,q.jsx)(Gy,{open:g,onOpenChange:_,children:(0,q.jsx)(Jy,{className:`max-w-5xl max-h-[90vh] overflow-hidden p-0 flex flex-col`,children:(0,q.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,q.jsx)(I.Suspense,{fallback:(0,q.jsx)(`div`,{className:`flex items-center justify-center h-40`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})}),children:(0,q.jsx)(oX,{})})})})}),(0,q.jsx)(I.Suspense,{fallback:null,children:(0,q.jsx)(cX,{open:v,onClose:b})}),(0,q.jsx)(CY,{onOpenSettings:()=>h(!0),onOpenAnalytics:()=>_(!0),onOpenDocs:()=>y(!0)}),(0,q.jsx)(aW,{open:C,onOpenChange:w}),(0,q.jsx)(nJ,{open:x,onClose:()=>S(!1)})]})}function pX({children:e}){let{activeProjectId:t}=Sd();return(0,q.jsx)(XG,{activeProjectId:t,children:e})}function mX(){return(0,q.jsx)(`span`,{"aria-hidden":!0,style:{display:`none`}})}function hX(){let{theme:e}=YH(),t=e.previewSwatches.accents[0],n=e.status.completed,r=e.status.failed,i=e.status.canceled,a=e.status.running;return(0,q.jsx)(ba,{position:`bottom-right`,theme:e.scheme,gap:8,closeButton:!0,visibleToasts:6,icons:{loading:(0,q.jsx)(mX,{})},style:{"--accent":t,"--toast-success-border":`color-mix(in srgb, ${n} 38%, transparent)`,"--toast-error-border":`color-mix(in srgb, ${r} 38%, transparent)`,"--toast-warning-border":`color-mix(in srgb, ${i} 38%, transparent)`,"--toast-info-border":`color-mix(in srgb, ${a} 38%, transparent)`},toastOptions:{unstyled:!0,classNames:{toast:`glass-card border border-border/30 text-foreground text-xs p-3 rounded-lg flex items-start gap-2 w-[356px] max-w-[356px] overflow-hidden shadow-lg`,content:`flex-1 min-w-0 flex flex-col gap-0.5`,icon:`shrink-0 mt-[2px] flex items-center justify-center`,title:`font-medium text-sm`,description:`text-muted-foreground mt-0.5`,actionButton:`text-[11px] px-2.5 py-1 rounded-md bg-accent-primary text-white hover:bg-accent-primary/90 whitespace-nowrap shrink-0 self-start`,cancelButton:`text-[11px] px-2.5 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50 whitespace-nowrap shrink-0 self-start`,closeButton:`text-muted-foreground hover:text-foreground rounded-md p-0.5`,success:`border-l-4 border-l-[var(--toast-success-border)]`,error:`border-l-4 border-l-[var(--toast-error-border)]`,warning:`border-l-4 border-l-[var(--toast-warning-border)]`,info:`border-l-4 border-l-[var(--toast-info-border)]`,loading:``}}})}function gX(){return qY(),ZY(),(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100vh`,overflow:`hidden`},children:(0,q.jsx)(`div`,{style:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`},children:(0,q.jsx)(bl,{url:TD,children:(0,q.jsx)(JH,{children:(0,q.jsxs)(iU,{children:[(0,q.jsx)(fG,{}),(0,q.jsxs)(bd,{children:[(0,q.jsx)(KW,{}),(0,q.jsx)(wE,{children:(0,q.jsx)(DY,{children:(0,q.jsx)(yV,{children:(0,q.jsx)(dJ,{children:(0,q.jsx)(pX,{children:(0,q.jsx)(vg,{children:(0,q.jsxs)(rV,{children:[(0,q.jsx)(fX,{}),(0,q.jsx)(hX,{})]})})})})})})})]})]})})})})})}async function _X(){await fl(),hl(),await dd(),(0,Zn.createRoot)(document.getElementById(`root`)).render((0,q.jsx)(I.StrictMode,{children:(0,q.jsx)(kn,{children:(0,q.jsx)(gX,{})})}));let e=document.getElementById(`specrails-splash`);e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.classList.add(`is-hidden`),setTimeout(()=>e.remove(),300)})})}_X();export{Bf as $,Hi as $t,yg as A,Vl as At,Mp as B,Fc as Bt,nb as C,Y as Ct,Xy as D,J as Dt,Qy as E,md as Et,Jp as F,kl as Ft,yp as G,fs as Gt,Cp as H,el as Ht,qp as I,xl as It,fp as J,uo as Jt,mp as K,_s as Kt,Hp as L,_l as Lt,Bh as M,Rl as Mt,Z as N,Ll as Nt,Yy as O,ou as Ot,X as P,Al as Pt,qf as Q,G as Qt,Vp as R,ul as Rt,ob as S,Bd as St,Jy as T,Sd as Tt,Sp as U,Hc as Ut,Ep as V,il as Vt,xp as W,mc as Wt,tp as X,Ya as Xt,lp as Y,fo as Yt,Yf as Z,K as Zt,xO as _,Yd as _t,ZH as a,N as an,Df as at,QT as b,Wd as bt,oV as c,pf as ct,Zz as d,uf as dt,Bi as en,If as et,fz as f,cf as ft,JN as g,nf as gt,aP as h,rf as ht,$ as i,Bn as in,kf as it,bg as j,Bl as jt,Zy as k,Hl as kt,iV as l,ff as lt,rF as m,of as mt,hG as n,ct as nn,jf as nt,_H as o,k as on,Tf as ot,sR as p,sf as pt,pp as q,xo as qt,hW as r,ft as rn,Af as rt,sV as s,bf as st,yq as t,Mn as tn,Nf as tt,lB as u,df as ut,QE as v,qd as vt,Gy as w,hd as wt,ZT as x,Ud as xt,XT as y,Kd as yt,Lp as z,Kc as zt};
|