@vibedeckx/linux-x64 0.1.16 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/process-manager.d.ts +1 -1
- package/dist/process-manager.js +111 -38
- package/dist/routes/terminal-routes.js +7 -0
- package/dist/routes/websocket-routes.js +6 -0
- package/dist/ui/404/index.html +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/__next.__PAGE__.txt +2 -2
- package/dist/ui/__next._full.txt +2 -2
- package/dist/ui/__next._head.txt +1 -1
- package/dist/ui/__next._index.txt +1 -1
- package/dist/ui/__next._tree.txt +1 -1
- package/dist/ui/_next/static/chunks/{d272cd438400a22c.js → 869e15bfcbb5dbd1.js} +1 -1
- package/dist/ui/_not-found/__next._full.txt +1 -1
- package/dist/ui/_not-found/__next._head.txt +1 -1
- package/dist/ui/_not-found/__next._index.txt +1 -1
- package/dist/ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/ui/_not-found/__next._not-found.txt +1 -1
- package/dist/ui/_not-found/__next._tree.txt +1 -1
- package/dist/ui/_not-found/index.html +1 -1
- package/dist/ui/_not-found/index.txt +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/index.txt +2 -2
- package/node_modules/node-pty/lib/conpty_console_list_agent.js +10 -1
- package/node_modules/node-pty/lib/unixTerminal.js +6 -3
- package/node_modules/node-pty/lib/utils.js +1 -1
- package/node_modules/node-pty/lib/windowsPtyAgent.js +62 -95
- package/node_modules/node-pty/lib/windowsTerminal.js +4 -2
- package/node_modules/node-pty/package.json +6 -5
- package/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
- package/package.json +2 -2
- package/node_modules/@ai-sdk/deepseek/dist/index.d.mts +0 -68
- package/node_modules/@ai-sdk/deepseek/dist/index.d.ts +0 -68
- package/node_modules/@ai-sdk/deepseek/dist/index.js.map +0 -1
- package/node_modules/@ai-sdk/deepseek/dist/index.mjs.map +0 -1
- package/node_modules/@ai-sdk/gateway/dist/index.d.mts +0 -713
- package/node_modules/@ai-sdk/gateway/dist/index.d.ts +0 -713
- package/node_modules/@ai-sdk/gateway/dist/index.js.map +0 -1
- package/node_modules/@ai-sdk/gateway/dist/index.mjs.map +0 -1
- package/node_modules/@ai-sdk/provider/dist/index.d.mts +0 -4030
- package/node_modules/@ai-sdk/provider/dist/index.d.ts +0 -4030
- package/node_modules/@ai-sdk/provider/dist/index.js.map +0 -1
- package/node_modules/@ai-sdk/provider/dist/index.mjs.map +0 -1
- package/node_modules/@ai-sdk/provider-utils/dist/index.d.mts +0 -1433
- package/node_modules/@ai-sdk/provider-utils/dist/index.d.ts +0 -1433
- package/node_modules/@ai-sdk/provider-utils/dist/index.js.map +0 -1
- package/node_modules/@ai-sdk/provider-utils/dist/index.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/APIKeysApi.d.ts +0 -76
- package/node_modules/@clerk/backend/dist/api/endpoints/APIKeysApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/AbstractApi.d.ts +0 -7
- package/node_modules/@clerk/backend/dist/api/endpoints/AbstractApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/AccountlessApplicationsAPI.d.ts +0 -11
- package/node_modules/@clerk/backend/dist/api/endpoints/AccountlessApplicationsAPI.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/ActorTokenApi.d.ts +0 -47
- package/node_modules/@clerk/backend/dist/api/endpoints/ActorTokenApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/AgentTaskApi.d.ts +0 -47
- package/node_modules/@clerk/backend/dist/api/endpoints/AgentTaskApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/AllowlistIdentifierApi.d.ts +0 -16
- package/node_modules/@clerk/backend/dist/api/endpoints/AllowlistIdentifierApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/BetaFeaturesApi.d.ts +0 -29
- package/node_modules/@clerk/backend/dist/api/endpoints/BetaFeaturesApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/BillingApi.d.ts +0 -47
- package/node_modules/@clerk/backend/dist/api/endpoints/BillingApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/BlocklistIdentifierApi.d.ts +0 -15
- package/node_modules/@clerk/backend/dist/api/endpoints/BlocklistIdentifierApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/ClientApi.d.ts +0 -16
- package/node_modules/@clerk/backend/dist/api/endpoints/ClientApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/DomainApi.d.ts +0 -46
- package/node_modules/@clerk/backend/dist/api/endpoints/DomainApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/EmailAddressApi.d.ts +0 -20
- package/node_modules/@clerk/backend/dist/api/endpoints/EmailAddressApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/EnterpriseConnectionApi.d.ts +0 -62
- package/node_modules/@clerk/backend/dist/api/endpoints/EnterpriseConnectionApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/IdPOAuthAccessTokenApi.d.ts +0 -6
- package/node_modules/@clerk/backend/dist/api/endpoints/IdPOAuthAccessTokenApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/InstanceApi.d.ts +0 -70
- package/node_modules/@clerk/backend/dist/api/endpoints/InstanceApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/InvitationApi.d.ts +0 -50
- package/node_modules/@clerk/backend/dist/api/endpoints/InvitationApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/JwksApi.d.ts +0 -6
- package/node_modules/@clerk/backend/dist/api/endpoints/JwksApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/JwtTemplatesApi.d.ts +0 -50
- package/node_modules/@clerk/backend/dist/api/endpoints/JwtTemplatesApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/M2MTokenApi.d.ts +0 -87
- package/node_modules/@clerk/backend/dist/api/endpoints/M2MTokenApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/MachineApi.d.ts +0 -81
- package/node_modules/@clerk/backend/dist/api/endpoints/MachineApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/OAuthApplicationsApi.d.ts +0 -49
- package/node_modules/@clerk/backend/dist/api/endpoints/OAuthApplicationsApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/OrganizationApi.d.ts +0 -200
- package/node_modules/@clerk/backend/dist/api/endpoints/OrganizationApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/PhoneNumberApi.d.ts +0 -22
- package/node_modules/@clerk/backend/dist/api/endpoints/PhoneNumberApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/ProxyCheckApi.d.ts +0 -11
- package/node_modules/@clerk/backend/dist/api/endpoints/ProxyCheckApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/RedirectUrlApi.d.ts +0 -14
- package/node_modules/@clerk/backend/dist/api/endpoints/RedirectUrlApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/SamlConnectionApi.d.ts +0 -69
- package/node_modules/@clerk/backend/dist/api/endpoints/SamlConnectionApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/SessionApi.d.ts +0 -52
- package/node_modules/@clerk/backend/dist/api/endpoints/SessionApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/SignInTokenApi.d.ts +0 -12
- package/node_modules/@clerk/backend/dist/api/endpoints/SignInTokenApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/SignUpApi.d.ts +0 -13
- package/node_modules/@clerk/backend/dist/api/endpoints/SignUpApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/TestingTokenApi.d.ts +0 -6
- package/node_modules/@clerk/backend/dist/api/endpoints/TestingTokenApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/UserApi.d.ts +0 -178
- package/node_modules/@clerk/backend/dist/api/endpoints/UserApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/WaitlistEntryApi.d.ts +0 -61
- package/node_modules/@clerk/backend/dist/api/endpoints/WaitlistEntryApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/WebhookApi.d.ts +0 -8
- package/node_modules/@clerk/backend/dist/api/endpoints/WebhookApi.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/index.d.ts +0 -33
- package/node_modules/@clerk/backend/dist/api/endpoints/index.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/endpoints/util-types.d.ts +0 -2
- package/node_modules/@clerk/backend/dist/api/endpoints/util-types.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/factory.d.ts +0 -51
- package/node_modules/@clerk/backend/dist/api/factory.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/index.d.ts +0 -3
- package/node_modules/@clerk/backend/dist/api/index.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/request.d.ts +0 -76
- package/node_modules/@clerk/backend/dist/api/request.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/APIKey.d.ts +0 -137
- package/node_modules/@clerk/backend/dist/api/resources/APIKey.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/AccountlessApplication.d.ts +0 -10
- package/node_modules/@clerk/backend/dist/api/resources/AccountlessApplication.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/ActorToken.d.ts +0 -15
- package/node_modules/@clerk/backend/dist/api/resources/ActorToken.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/AgentTask.d.ts +0 -42
- package/node_modules/@clerk/backend/dist/api/resources/AgentTask.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/AllowlistIdentifier.d.ts +0 -66
- package/node_modules/@clerk/backend/dist/api/resources/AllowlistIdentifier.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/BlocklistIdentifier.d.ts +0 -13
- package/node_modules/@clerk/backend/dist/api/resources/BlocklistIdentifier.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Client.d.ts +0 -83
- package/node_modules/@clerk/backend/dist/api/resources/Client.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/CnameTarget.d.ts +0 -9
- package/node_modules/@clerk/backend/dist/api/resources/CnameTarget.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/CommercePlan.d.ts +0 -141
- package/node_modules/@clerk/backend/dist/api/resources/CommercePlan.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/CommerceSubscription.d.ts +0 -99
- package/node_modules/@clerk/backend/dist/api/resources/CommerceSubscription.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/CommerceSubscriptionItem.d.ts +0 -167
- package/node_modules/@clerk/backend/dist/api/resources/CommerceSubscriptionItem.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Cookies.d.ts +0 -7
- package/node_modules/@clerk/backend/dist/api/resources/Cookies.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/DeletedObject.d.ts +0 -10
- package/node_modules/@clerk/backend/dist/api/resources/DeletedObject.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Deserializer.d.ts +0 -26
- package/node_modules/@clerk/backend/dist/api/resources/Deserializer.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Domain.d.ts +0 -15
- package/node_modules/@clerk/backend/dist/api/resources/Domain.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Email.d.ts +0 -17
- package/node_modules/@clerk/backend/dist/api/resources/Email.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/EmailAddress.d.ts +0 -47
- package/node_modules/@clerk/backend/dist/api/resources/EmailAddress.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/EnterpriseAccount.d.ts +0 -225
- package/node_modules/@clerk/backend/dist/api/resources/EnterpriseAccount.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/EnterpriseConnection.d.ts +0 -89
- package/node_modules/@clerk/backend/dist/api/resources/EnterpriseConnection.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Enums.d.ts +0 -42
- package/node_modules/@clerk/backend/dist/api/resources/Enums.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/ExternalAccount.d.ts +0 -134
- package/node_modules/@clerk/backend/dist/api/resources/ExternalAccount.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Feature.d.ts +0 -51
- package/node_modules/@clerk/backend/dist/api/resources/Feature.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/HandshakePayload.d.ts +0 -9
- package/node_modules/@clerk/backend/dist/api/resources/HandshakePayload.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/IdPOAuthAccessToken.d.ts +0 -23
- package/node_modules/@clerk/backend/dist/api/resources/IdPOAuthAccessToken.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/IdentificationLink.d.ts +0 -25
- package/node_modules/@clerk/backend/dist/api/resources/IdentificationLink.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Instance.d.ts +0 -9
- package/node_modules/@clerk/backend/dist/api/resources/Instance.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/InstanceRestrictions.d.ts +0 -11
- package/node_modules/@clerk/backend/dist/api/resources/InstanceRestrictions.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/InstanceSettings.d.ts +0 -11
- package/node_modules/@clerk/backend/dist/api/resources/InstanceSettings.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Invitation.d.ts +0 -76
- package/node_modules/@clerk/backend/dist/api/resources/Invitation.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/JSON.d.ts +0 -971
- package/node_modules/@clerk/backend/dist/api/resources/JSON.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/JwtTemplate.d.ts +0 -15
- package/node_modules/@clerk/backend/dist/api/resources/JwtTemplate.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/M2MToken.d.ts +0 -31
- package/node_modules/@clerk/backend/dist/api/resources/M2MToken.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Machine.d.ts +0 -17
- package/node_modules/@clerk/backend/dist/api/resources/Machine.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/MachineScope.d.ts +0 -13
- package/node_modules/@clerk/backend/dist/api/resources/MachineScope.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/MachineSecretKey.d.ts +0 -10
- package/node_modules/@clerk/backend/dist/api/resources/MachineSecretKey.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/OAuthApplication.d.ts +0 -169
- package/node_modules/@clerk/backend/dist/api/resources/OAuthApplication.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/OauthAccessToken.d.ts +0 -83
- package/node_modules/@clerk/backend/dist/api/resources/OauthAccessToken.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Organization.d.ts +0 -115
- package/node_modules/@clerk/backend/dist/api/resources/Organization.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationDomain.d.ts +0 -18
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationDomain.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationInvitation.d.ts +0 -116
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationInvitation.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationMembership.d.ts +0 -140
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationMembership.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationSettings.d.ts +0 -17
- package/node_modules/@clerk/backend/dist/api/resources/OrganizationSettings.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/PhoneNumber.d.ts +0 -63
- package/node_modules/@clerk/backend/dist/api/resources/PhoneNumber.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/ProxyCheck.d.ts +0 -13
- package/node_modules/@clerk/backend/dist/api/resources/ProxyCheck.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/RedirectUrl.d.ts +0 -47
- package/node_modules/@clerk/backend/dist/api/resources/RedirectUrl.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/SMSMessage.d.ts +0 -13
- package/node_modules/@clerk/backend/dist/api/resources/SMSMessage.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/SamlConnection.d.ts +0 -215
- package/node_modules/@clerk/backend/dist/api/resources/SamlConnection.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Session.d.ts +0 -176
- package/node_modules/@clerk/backend/dist/api/resources/Session.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/SignInTokens.d.ts +0 -13
- package/node_modules/@clerk/backend/dist/api/resources/SignInTokens.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/SignUpAttempt.d.ts +0 -44
- package/node_modules/@clerk/backend/dist/api/resources/SignUpAttempt.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/TestingToken.d.ts +0 -8
- package/node_modules/@clerk/backend/dist/api/resources/TestingToken.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Token.d.ts +0 -7
- package/node_modules/@clerk/backend/dist/api/resources/Token.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/User.d.ts +0 -296
- package/node_modules/@clerk/backend/dist/api/resources/User.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Verification.d.ts +0 -90
- package/node_modules/@clerk/backend/dist/api/resources/Verification.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/WaitlistEntry.d.ts +0 -67
- package/node_modules/@clerk/backend/dist/api/resources/WaitlistEntry.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Web3Wallet.d.ts +0 -36
- package/node_modules/@clerk/backend/dist/api/resources/Web3Wallet.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/Webhooks.d.ts +0 -32
- package/node_modules/@clerk/backend/dist/api/resources/Webhooks.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/api/resources/index.d.ts +0 -57
- package/node_modules/@clerk/backend/dist/api/resources/index.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/chunk-7KLH7JRZ.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/chunk-I4B6KCGC.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/chunk-P263NW7Z.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/chunk-QR37SKMP.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/chunk-TOROEX6P.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/chunk-YBVFDYDR.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/constants.d.ts +0 -91
- package/node_modules/@clerk/backend/dist/constants.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/createRedirect.d.ts +0 -25
- package/node_modules/@clerk/backend/dist/createRedirect.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/errors.d.ts +0 -67
- package/node_modules/@clerk/backend/dist/errors.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/errors.js.map +0 -1
- package/node_modules/@clerk/backend/dist/errors.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/fixtures/index.d.ts +0 -105
- package/node_modules/@clerk/backend/dist/fixtures/index.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/fixtures/machine.d.ts +0 -72
- package/node_modules/@clerk/backend/dist/fixtures/machine.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/index.d.ts +0 -49
- package/node_modules/@clerk/backend/dist/index.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/index.js.map +0 -1
- package/node_modules/@clerk/backend/dist/index.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/internal.d.ts +0 -20
- package/node_modules/@clerk/backend/dist/internal.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/internal.js.map +0 -1
- package/node_modules/@clerk/backend/dist/internal.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/algorithms.d.ts +0 -3
- package/node_modules/@clerk/backend/dist/jwt/algorithms.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/assertions.d.ts +0 -10
- package/node_modules/@clerk/backend/dist/jwt/assertions.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/cryptoKeys.d.ts +0 -2
- package/node_modules/@clerk/backend/dist/jwt/cryptoKeys.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/index.d.ts +0 -7
- package/node_modules/@clerk/backend/dist/jwt/index.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/index.js.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/index.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/legacyReturn.d.ts +0 -4
- package/node_modules/@clerk/backend/dist/jwt/legacyReturn.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/signJwt.d.ts +0 -20
- package/node_modules/@clerk/backend/dist/jwt/signJwt.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/types.d.ts +0 -18
- package/node_modules/@clerk/backend/dist/jwt/types.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/verifyJwt.d.ts +0 -38
- package/node_modules/@clerk/backend/dist/jwt/verifyJwt.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/jwt/verifyMachineJwt.d.ts +0 -19
- package/node_modules/@clerk/backend/dist/jwt/verifyMachineJwt.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/mock-server.d.ts +0 -4
- package/node_modules/@clerk/backend/dist/mock-server.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/proxy.d.ts +0 -72
- package/node_modules/@clerk/backend/dist/proxy.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/proxy.js.map +0 -1
- package/node_modules/@clerk/backend/dist/proxy.mjs.map +0 -1
- package/node_modules/@clerk/backend/dist/runtime.d.ts +0 -26
- package/node_modules/@clerk/backend/dist/runtime.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/authObjects.d.ts +0 -193
- package/node_modules/@clerk/backend/dist/tokens/authObjects.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/authStatus.d.ts +0 -120
- package/node_modules/@clerk/backend/dist/tokens/authStatus.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/authenticateContext.d.ts +0 -78
- package/node_modules/@clerk/backend/dist/tokens/authenticateContext.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/clerkRequest.d.ts +0 -29
- package/node_modules/@clerk/backend/dist/tokens/clerkRequest.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/clerkUrl.d.ts +0 -18
- package/node_modules/@clerk/backend/dist/tokens/clerkUrl.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/cookie.d.ts +0 -3
- package/node_modules/@clerk/backend/dist/tokens/cookie.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/factory.d.ts +0 -29
- package/node_modules/@clerk/backend/dist/tokens/factory.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/handshake.d.ts +0 -64
- package/node_modules/@clerk/backend/dist/tokens/handshake.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/keys.d.ts +0 -54
- package/node_modules/@clerk/backend/dist/tokens/keys.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/machine.d.ts +0 -85
- package/node_modules/@clerk/backend/dist/tokens/machine.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/organizationMatcher.d.ts +0 -11
- package/node_modules/@clerk/backend/dist/tokens/organizationMatcher.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/request.d.ts +0 -60
- package/node_modules/@clerk/backend/dist/tokens/request.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/tokenTypes.d.ts +0 -19
- package/node_modules/@clerk/backend/dist/tokens/tokenTypes.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/types.d.ts +0 -253
- package/node_modules/@clerk/backend/dist/tokens/types.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/tokens/verify.d.ts +0 -109
- package/node_modules/@clerk/backend/dist/tokens/verify.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/util/decorateObjectWithResources.d.ts +0 -22
- package/node_modules/@clerk/backend/dist/util/decorateObjectWithResources.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/util/mergePreDefinedOptions.d.ts +0 -2
- package/node_modules/@clerk/backend/dist/util/mergePreDefinedOptions.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/util/optionsAssertions.d.ts +0 -3
- package/node_modules/@clerk/backend/dist/util/optionsAssertions.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/util/path.d.ts +0 -4
- package/node_modules/@clerk/backend/dist/util/path.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/util/rfc4648.d.ts +0 -26
- package/node_modules/@clerk/backend/dist/util/rfc4648.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/util/shared.d.ts +0 -7
- package/node_modules/@clerk/backend/dist/util/shared.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/webhooks.d.ts +0 -50
- package/node_modules/@clerk/backend/dist/webhooks.d.ts.map +0 -1
- package/node_modules/@clerk/backend/dist/webhooks.js.map +0 -1
- package/node_modules/@clerk/backend/dist/webhooks.mjs.map +0 -1
- package/node_modules/@clerk/fastify/dist/chunk-RY4T2JMQ.mjs.map +0 -1
- package/node_modules/@clerk/fastify/dist/index-CWnSaB0B.d.mts +0 -25
- package/node_modules/@clerk/fastify/dist/index-CWnSaB0B.d.ts +0 -25
- package/node_modules/@clerk/fastify/dist/index.d.mts +0 -16
- package/node_modules/@clerk/fastify/dist/index.d.ts +0 -16
- package/node_modules/@clerk/fastify/dist/index.js.map +0 -1
- package/node_modules/@clerk/fastify/dist/index.mjs.map +0 -1
- package/node_modules/@clerk/fastify/dist/types.d.mts +0 -4
- package/node_modules/@clerk/fastify/dist/types.d.ts +0 -4
- package/node_modules/@clerk/fastify/dist/types.js.map +0 -1
- package/node_modules/@clerk/fastify/dist/types.mjs.map +0 -1
- package/node_modules/@clerk/fastify/dist/webhooks.d.mts +0 -19
- package/node_modules/@clerk/fastify/dist/webhooks.d.ts +0 -19
- package/node_modules/@clerk/fastify/dist/webhooks.js.map +0 -1
- package/node_modules/@clerk/fastify/dist/webhooks.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/alternativePhoneCode.d.mts +0 -9
- package/node_modules/@clerk/shared/dist/runtime/alternativePhoneCode.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/alternativePhoneCode.d.ts +0 -9
- package/node_modules/@clerk/shared/dist/runtime/alternativePhoneCode.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/alternativePhoneCode.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/alternativePhoneCode.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/apiUrlFromPublishableKey.d.mts +0 -11
- package/node_modules/@clerk/shared/dist/runtime/apiUrlFromPublishableKey.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/apiUrlFromPublishableKey.d.ts +0 -11
- package/node_modules/@clerk/shared/dist/runtime/apiUrlFromPublishableKey.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/apiUrlFromPublishableKey.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/apiUrlFromPublishableKey.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization-Du_JQmnH.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization-Un7v7f6J.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization-errors-B7aH39AU.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization-errors-CBHAr6Ld.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization-errors.d.mts +0 -26
- package/node_modules/@clerk/shared/dist/runtime/authorization-errors.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization-errors.d.ts +0 -26
- package/node_modules/@clerk/shared/dist/runtime/authorization-errors.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization.d.mts +0 -72
- package/node_modules/@clerk/shared/dist/runtime/authorization.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/authorization.d.ts +0 -72
- package/node_modules/@clerk/shared/dist/runtime/authorization.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/browser-CMFCxUv7.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/browser-CaHqvEp1.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/browser.d.mts +0 -35
- package/node_modules/@clerk/shared/dist/runtime/browser.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/browser.d.ts +0 -35
- package/node_modules/@clerk/shared/dist/runtime/browser.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/buildAccountsBaseUrl.d.mts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/buildAccountsBaseUrl.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/buildAccountsBaseUrl.d.ts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/buildAccountsBaseUrl.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/buildAccountsBaseUrl.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/buildAccountsBaseUrl.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/clerkEventBus.d.mts +0 -22
- package/node_modules/@clerk/shared/dist/runtime/clerkEventBus.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/clerkEventBus.d.ts +0 -22
- package/node_modules/@clerk/shared/dist/runtime/clerkEventBus.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/clerkEventBus.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/clerkEventBus.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/clerkRuntimeError-CaS4sM5w.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/clerkRuntimeError-DqAmLuLY.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/color.d.mts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/color.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/color.d.ts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/color.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/color.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/color.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/complexity-DEun2UD2.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/complexity-DydNJOmy.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/constants-BUzkV8jh.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/constants-Bta24VLk.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/constants-BulbbNR9.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/constants-WYhx_umW.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/constants.d.mts +0 -21
- package/node_modules/@clerk/shared/dist/runtime/constants.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/constants.d.ts +0 -21
- package/node_modules/@clerk/shared/dist/runtime/constants.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/cookie.d.mts +0 -30
- package/node_modules/@clerk/shared/dist/runtime/cookie.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/cookie.d.ts +0 -30
- package/node_modules/@clerk/shared/dist/runtime/cookie.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/cookie.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/cookie.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/createDeferredPromise-Bq0Rf2GM.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/createDeferredPromise-CYCAgyvC.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/date.d.mts +0 -37
- package/node_modules/@clerk/shared/dist/runtime/date.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/date.d.ts +0 -37
- package/node_modules/@clerk/shared/dist/runtime/date.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/date.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/date.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deprecated--jK9xTNh.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deprecated-841w0zq7.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deprecated.d.mts +0 -40
- package/node_modules/@clerk/shared/dist/runtime/deprecated.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deprecated.d.ts +0 -40
- package/node_modules/@clerk/shared/dist/runtime/deprecated.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deriveState-CQUgOdaO.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deriveState-zgq99aY1.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deriveState.d.mts +0 -28
- package/node_modules/@clerk/shared/dist/runtime/deriveState.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/deriveState.d.ts +0 -28
- package/node_modules/@clerk/shared/dist/runtime/deriveState.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/devBrowser.d.mts +0 -13
- package/node_modules/@clerk/shared/dist/runtime/devBrowser.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/devBrowser.d.ts +0 -13
- package/node_modules/@clerk/shared/dist/runtime/devBrowser.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/devBrowser.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/devBrowser.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/dom/index.d.mts +0 -2
- package/node_modules/@clerk/shared/dist/runtime/dom/index.d.ts +0 -2
- package/node_modules/@clerk/shared/dist/runtime/dom/waitForElement.d.mts +0 -2
- package/node_modules/@clerk/shared/dist/runtime/dom/waitForElement.d.ts +0 -2
- package/node_modules/@clerk/shared/dist/runtime/encoders-CAjYroSe.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/encoders-C_EA3--l.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/error-D-ayZ5nL.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/error-kcck_bbZ.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/error.d.mts +0 -3
- package/node_modules/@clerk/shared/dist/runtime/error.d.ts +0 -3
- package/node_modules/@clerk/shared/dist/runtime/errors-FAXDzRsM.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/errors-oOcNTWU9.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/esm-D9kK-xzr.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/esm-DGPYZuZb.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/eventBus-TFTcHo0F.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/eventBus-mLhN9dkg.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/eventBus.d.mts +0 -117
- package/node_modules/@clerk/shared/dist/runtime/eventBus.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/eventBus.d.ts +0 -117
- package/node_modules/@clerk/shared/dist/runtime/eventBus.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/file.d.mts +0 -21
- package/node_modules/@clerk/shared/dist/runtime/file.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/file.d.ts +0 -21
- package/node_modules/@clerk/shared/dist/runtime/file.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/file.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/file.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getEnvVariable.d.mts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/getEnvVariable.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getEnvVariable.d.ts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/getEnvVariable.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getEnvVariable.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getEnvVariable.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getToken.d.mts +0 -46
- package/node_modules/@clerk/shared/dist/runtime/getToken.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getToken.d.ts +0 -46
- package/node_modules/@clerk/shared/dist/runtime/getToken.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getToken.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/getToken.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/globs-D0Kpu4g1.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/globs-u_gXJPLt.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/globs.d.mts +0 -7
- package/node_modules/@clerk/shared/dist/runtime/globs.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/globs.d.ts +0 -7
- package/node_modules/@clerk/shared/dist/runtime/globs.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn-4-yw9hYF.d.ts +0 -7
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn-4-yw9hYF.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn-BWsoUzyL.d.mts +0 -7
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn-BWsoUzyL.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn-BmJC8Cue.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn-iAIjw-kJ.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn.d.mts +0 -11
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn.d.ts +0 -11
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/handleValueOrFn.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/hex-txii11Pj.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/hex-zF8OyMcG.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/index-BK_NVS1t.d.ts +0 -10885
- package/node_modules/@clerk/shared/dist/runtime/index-BK_NVS1t.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/index-Cc98l5ga.d.mts +0 -10885
- package/node_modules/@clerk/shared/dist/runtime/index-Cc98l5ga.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/index.d.mts +0 -1
- package/node_modules/@clerk/shared/dist/runtime/index.d.ts +0 -1
- package/node_modules/@clerk/shared/dist/runtime/index.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/index.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/injectedWeb3EthProviders-BqNbQ8Of.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/injectedWeb3EthProviders-Cp_aXKsI.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/injectedWeb3SolanaProviders-Cbd4CVu9.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/injectedWeb3SolanaProviders-DRQuwtHF.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/instance-BmZr0cdE.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/instance-C1LlVxIp.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/completeSignUpFlow.d.mts +0 -31
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/completeSignUpFlow.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/completeSignUpFlow.d.ts +0 -31
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/completeSignUpFlow.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/completeSignUpFlow.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/completeSignUpFlow.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/componentGuards.d.mts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/componentGuards.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/componentGuards.d.ts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/componentGuards.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/componentGuards.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/componentGuards.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/constants.d.mts +0 -54
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/constants.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/constants.d.ts +0 -54
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/constants.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/email.d.mts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/email.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/email.d.ts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/email.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/email.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/email.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/encoders.d.mts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/encoders.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/encoders.d.ts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/encoders.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/errors.d.mts +0 -113
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/errors.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/errors.d.ts +0 -113
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/errors.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/hex.d.mts +0 -5
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/hex.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/hex.d.ts +0 -5
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/hex.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3EthProviders.d.mts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3EthProviders.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3EthProviders.d.ts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3EthProviders.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3SolanaProviders.d.mts +0 -13
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3SolanaProviders.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3SolanaProviders.d.ts +0 -13
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/injectedWeb3SolanaProviders.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/organization.d.mts +0 -10
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/organization.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/organization.d.ts +0 -10
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/organization.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/organization.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/organization.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passkeys.d.mts +0 -61
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passkeys.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passkeys.d.ts +0 -61
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passkeys.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passkeys.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passkeys.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/complexity.d.mts +0 -11
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/complexity.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/complexity.d.ts +0 -11
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/complexity.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.d.mts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.d.ts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/password.d.mts +0 -19
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/password.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/password.d.ts +0 -19
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/password.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/password.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/password.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/strength.d.mts +0 -20
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/strength.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/strength.d.ts +0 -20
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/passwords/strength.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/path.d.mts +0 -6
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/path.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/path.d.ts +0 -6
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/path.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryParams.d.mts +0 -36
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryParams.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryParams.d.ts +0 -36
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryParams.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryStateParams.d.mts +0 -19
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryStateParams.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryStateParams.d.ts +0 -19
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryStateParams.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryStateParams.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/queryStateParams.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/querystring.d.mts +0 -9
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/querystring.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/querystring.d.ts +0 -9
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/querystring.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/redirectUrls.d.mts +0 -23
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/redirectUrls.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/redirectUrls.d.ts +0 -23
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/redirectUrls.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/redirectUrls.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/redirectUrls.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/runtime.d.mts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/runtime.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/runtime.d.ts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/runtime.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/runtime.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/runtime.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/sessionTasks.d.mts +0 -31
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/sessionTasks.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/sessionTasks.d.ts +0 -31
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/sessionTasks.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/sessionTasks.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/sessionTasks.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/thirdPartyDomains.d.mts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/thirdPartyDomains.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/thirdPartyDomains.d.ts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/thirdPartyDomains.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/thirdPartyDomains.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/thirdPartyDomains.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/url.d.mts +0 -4
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/url.d.ts +0 -4
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/user.d.mts +0 -23
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/user.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/user.d.ts +0 -23
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/user.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/user.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/user.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/warnings.d.mts +0 -25
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/warnings.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/warnings.d.ts +0 -25
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/warnings.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/warnings.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/warnings.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/web3.d.mts +0 -32
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/web3.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/web3.d.ts +0 -32
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/web3.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/web3.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/web3.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/windowNavigate.d.mts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/windowNavigate.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/windowNavigate.d.ts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/windowNavigate.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/windowNavigate.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/internal/clerk-js/windowNavigate.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicAtob-CoF80qYz.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicAtob-Hkpnx2p8.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicAtob.d.mts +0 -9
- package/node_modules/@clerk/shared/dist/runtime/isomorphicAtob.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicAtob.d.ts +0 -9
- package/node_modules/@clerk/shared/dist/runtime/isomorphicAtob.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicBtoa-DWmLcIHi.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicBtoa-_pSA92Q9.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicBtoa.d.mts +0 -5
- package/node_modules/@clerk/shared/dist/runtime/isomorphicBtoa.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/isomorphicBtoa.d.ts +0 -5
- package/node_modules/@clerk/shared/dist/runtime/isomorphicBtoa.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/jwtPayloadParser.d.mts +0 -23
- package/node_modules/@clerk/shared/dist/runtime/jwtPayloadParser.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/jwtPayloadParser.d.ts +0 -23
- package/node_modules/@clerk/shared/dist/runtime/jwtPayloadParser.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/jwtPayloadParser.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/jwtPayloadParser.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keyless/index.d.mts +0 -271
- package/node_modules/@clerk/shared/dist/runtime/keyless/index.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keyless/index.d.ts +0 -271
- package/node_modules/@clerk/shared/dist/runtime/keyless/index.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keyless/index.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keyless/index.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keys-BI9hmfja.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keys-DuxzP8MU.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keys.d.mts +0 -103
- package/node_modules/@clerk/shared/dist/runtime/keys.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/keys.d.ts +0 -103
- package/node_modules/@clerk/shared/dist/runtime/keys.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadClerkJsScript.d.mts +0 -88
- package/node_modules/@clerk/shared/dist/runtime/loadClerkJsScript.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadClerkJsScript.d.ts +0 -88
- package/node_modules/@clerk/shared/dist/runtime/loadClerkJsScript.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadClerkJsScript.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadClerkJsScript.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadScript-BnB9d_IW.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadScript-UG_epen4.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadScript.d.mts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/loadScript.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/loadScript.d.ts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/loadScript.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/localStorageBroadcastChannel.d.mts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/localStorageBroadcastChannel.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/localStorageBroadcastChannel.d.ts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/localStorageBroadcastChannel.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/localStorageBroadcastChannel.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/localStorageBroadcastChannel.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/logger-BOte4sQb.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/logger-DISzhF9M.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/logger.d.mts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/logger.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/logger.d.ts +0 -12
- package/node_modules/@clerk/shared/dist/runtime/logger.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/moduleManager-BsmFyRrH.d.mts +0 -21
- package/node_modules/@clerk/shared/dist/runtime/moduleManager-BsmFyRrH.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/moduleManager-WB15hU3T.d.ts +0 -21
- package/node_modules/@clerk/shared/dist/runtime/moduleManager-WB15hU3T.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/moduleManager.d.mts +0 -2
- package/node_modules/@clerk/shared/dist/runtime/moduleManager.d.ts +0 -2
- package/node_modules/@clerk/shared/dist/runtime/netlifyCacheHandler-DFm5qdPh.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/netlifyCacheHandler-Dkdkho_6.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/netlifyCacheHandler.d.mts +0 -34
- package/node_modules/@clerk/shared/dist/runtime/netlifyCacheHandler.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/netlifyCacheHandler.d.ts +0 -34
- package/node_modules/@clerk/shared/dist/runtime/netlifyCacheHandler.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/noop-B7RzLU-c.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/noop-CVg8oVJr.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/oauth.d.mts +0 -19
- package/node_modules/@clerk/shared/dist/runtime/oauth.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/oauth.d.ts +0 -19
- package/node_modules/@clerk/shared/dist/runtime/oauth.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/oauth.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/oauth.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/object-DYaB_9gA.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/object-DklYlVP-.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/object.d.mts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/object.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/object.d.ts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/object.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/organization-BzM6mhUv.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/organization-Cy_ag_4B.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/organization.d.mts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/organization.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/organization.d.ts +0 -15
- package/node_modules/@clerk/shared/dist/runtime/organization.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/path-BLD6zl1u.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/path-ci3QmWY8.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathMatcher.d.mts +0 -17
- package/node_modules/@clerk/shared/dist/runtime/pathMatcher.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathMatcher.d.ts +0 -17
- package/node_modules/@clerk/shared/dist/runtime/pathMatcher.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathMatcher.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathMatcher.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathToRegexp-7eww5BY6.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathToRegexp-Do-462DY.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathToRegexp.d.mts +0 -85
- package/node_modules/@clerk/shared/dist/runtime/pathToRegexp.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/pathToRegexp.d.ts +0 -85
- package/node_modules/@clerk/shared/dist/runtime/pathToRegexp.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/poller.d.mts +0 -20
- package/node_modules/@clerk/shared/dist/runtime/poller.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/poller.d.ts +0 -20
- package/node_modules/@clerk/shared/dist/runtime/poller.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/poller.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/poller.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/proxy-BcfViKjn.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/proxy-DahrnOq8.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/proxy.d.mts +0 -24
- package/node_modules/@clerk/shared/dist/runtime/proxy.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/proxy.d.ts +0 -24
- package/node_modules/@clerk/shared/dist/runtime/proxy.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/queryParams-DSUymAGT.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/queryParams-Dlt0oVDg.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/querystring-BFj_iDi0.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/querystring-pXtwII0l.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/react/index.d.mts +0 -1647
- package/node_modules/@clerk/shared/dist/runtime/react/index.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/react/index.d.ts +0 -1647
- package/node_modules/@clerk/shared/dist/runtime/react/index.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/react/index.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/react/index.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/retry-DGCmqlcR.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/retry-DqRIhHV5.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/retry.d.mts +0 -60
- package/node_modules/@clerk/shared/dist/runtime/retry.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/retry.d.ts +0 -60
- package/node_modules/@clerk/shared/dist/runtime/retry.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/router.d.mts +0 -100
- package/node_modules/@clerk/shared/dist/runtime/router.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/router.d.ts +0 -100
- package/node_modules/@clerk/shared/dist/runtime/router.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/router.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/router.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/runtimeEnvironment-D1yr0yUs.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/runtimeEnvironment-DJJWo5AR.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/safeImport.d.mts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/safeImport.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/safeImport.d.ts +0 -18
- package/node_modules/@clerk/shared/dist/runtime/safeImport.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/safeImport.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/safeImport.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/saml.d.mts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/saml.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/saml.d.ts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/saml.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/saml.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/saml.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/strength-DMrZQDoO.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/strength-DPtAse7d.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/telemetry--P0a0tSk.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/telemetry-DE2JFEBf.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/telemetry.d.mts +0 -143
- package/node_modules/@clerk/shared/dist/runtime/telemetry.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/telemetry.d.ts +0 -143
- package/node_modules/@clerk/shared/dist/runtime/telemetry.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/types/index.d.mts +0 -3
- package/node_modules/@clerk/shared/dist/runtime/types/index.d.ts +0 -3
- package/node_modules/@clerk/shared/dist/runtime/ui/index.d.mts +0 -3
- package/node_modules/@clerk/shared/dist/runtime/ui/index.d.ts +0 -3
- package/node_modules/@clerk/shared/dist/runtime/underscore-BX6Ucmg5.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/underscore-ClYSgvuy.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/underscore.d.mts +0 -63
- package/node_modules/@clerk/shared/dist/runtime/underscore.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/underscore.d.ts +0 -63
- package/node_modules/@clerk/shared/dist/runtime/underscore.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url-C6gPMFx5.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url-CKcDCvyG.d.ts +0 -144
- package/node_modules/@clerk/shared/dist/runtime/url-CKcDCvyG.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url-CoXV4i87.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url-DaPDWryr.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url-Ou22U773.d.mts +0 -144
- package/node_modules/@clerk/shared/dist/runtime/url-Ou22U773.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url-sAcxbiir.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url.d.mts +0 -78
- package/node_modules/@clerk/shared/dist/runtime/url.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/url.d.ts +0 -78
- package/node_modules/@clerk/shared/dist/runtime/url.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/utils/index.d.mts +0 -65
- package/node_modules/@clerk/shared/dist/runtime/utils/index.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/utils/index.d.ts +0 -65
- package/node_modules/@clerk/shared/dist/runtime/utils/index.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/utils-TXJdVJx7.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/utils-Y3tB5LFT.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionCheck.d.mts +0 -58
- package/node_modules/@clerk/shared/dist/runtime/versionCheck.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionCheck.d.ts +0 -58
- package/node_modules/@clerk/shared/dist/runtime/versionCheck.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionCheck.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionCheck.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionSelector-BSa0YYBu.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionSelector-CoS6g9-B.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionSelector.d.mts +0 -17
- package/node_modules/@clerk/shared/dist/runtime/versionSelector.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/versionSelector.d.ts +0 -17
- package/node_modules/@clerk/shared/dist/runtime/versionSelector.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/waitForElement-CB9iynCD.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/waitForElement-DGxKWlwM.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/waitForElement-DLpcirWQ.d.ts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/waitForElement-DLpcirWQ.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/waitForElement-DZxkXjac.d.mts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/waitForElement-DZxkXjac.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/web3.d.mts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/web3.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/web3.d.ts +0 -8
- package/node_modules/@clerk/shared/dist/runtime/web3.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/web3.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/web3.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/webauthn.d.mts +0 -16
- package/node_modules/@clerk/shared/dist/runtime/webauthn.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/webauthn.d.ts +0 -16
- package/node_modules/@clerk/shared/dist/runtime/webauthn.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/webauthn.js.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/webauthn.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/workerTimers/index.d.mts +0 -17
- package/node_modules/@clerk/shared/dist/runtime/workerTimers/index.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/workerTimers/index.d.ts +0 -17
- package/node_modules/@clerk/shared/dist/runtime/workerTimers/index.d.ts.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/workerTimers-CDy8bBJS.mjs.map +0 -1
- package/node_modules/@clerk/shared/dist/runtime/workerTimers-D-HZtmjt.js.map +0 -1
- package/node_modules/@clerk/shared/dist/types/index.d.mts +0 -10584
- package/node_modules/@clerk/shared/dist/types/index.d.mts.map +0 -1
- package/node_modules/@clerk/shared/dist/types/index.d.ts +0 -10584
- package/node_modules/@clerk/shared/dist/types/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts +0 -4
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts +0 -34
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts +0 -6
- package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/index.d.ts +0 -41
- package/node_modules/@isaacs/cliui/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/index.min.js.map +0 -7
- package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts +0 -5
- package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts +0 -7
- package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts +0 -4
- package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts +0 -34
- package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts +0 -6
- package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/index.d.ts +0 -41
- package/node_modules/@isaacs/cliui/dist/esm/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/index.min.js.map +0 -7
- package/node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts +0 -5
- package/node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/string-width/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts +0 -7
- package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/dist/index.d.mts +0 -239
- package/node_modules/@openrouter/ai-sdk-provider/dist/index.d.ts +0 -239
- package/node_modules/@openrouter/ai-sdk-provider/dist/index.js.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/dist/index.mjs.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/dist/internal/index.d.mts +0 -156
- package/node_modules/@openrouter/ai-sdk-provider/dist/internal/index.d.ts +0 -156
- package/node_modules/@openrouter/ai-sdk-provider/dist/internal/index.js.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/dist/internal/index.mjs.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider/dist/index.d.mts +0 -1252
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider/dist/index.d.ts +0 -1252
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider/dist/index.js.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider/dist/index.mjs.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider-utils/dist/index.d.mts +0 -352
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider-utils/dist/index.d.ts +0 -352
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider-utils/dist/index.js.map +0 -1
- package/node_modules/@openrouter/ai-sdk-provider/node_modules/@ai-sdk/provider-utils/dist/index.mjs.map +0 -1
- package/node_modules/@standard-schema/spec/dist/index.d.cts +0 -119
- package/node_modules/@standard-schema/spec/dist/index.d.ts +0 -119
- package/node_modules/@stricli/core/dist/index.d.cts +0 -1443
- package/node_modules/@stricli/core/dist/index.d.ts +0 -1443
- package/node_modules/@vercel/oidc/dist/auth-config.d.ts +0 -30
- package/node_modules/@vercel/oidc/dist/get-context.d.ts +0 -6
- package/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.d.ts +0 -49
- package/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.test.d.ts +0 -1
- package/node_modules/@vercel/oidc/dist/index-browser.d.ts +0 -3
- package/node_modules/@vercel/oidc/dist/index-browser.test.d.ts +0 -1
- package/node_modules/@vercel/oidc/dist/index.d.ts +0 -2
- package/node_modules/@vercel/oidc/dist/oauth.d.ts +0 -17
- package/node_modules/@vercel/oidc/dist/token-error.d.ts +0 -5
- package/node_modules/@vercel/oidc/dist/token-io.d.ts +0 -2
- package/node_modules/@vercel/oidc/dist/token-util.d.ts +0 -21
- package/node_modules/@vercel/oidc/dist/token-util.test.d.ts +0 -1
- package/node_modules/@vercel/oidc/dist/token.d.ts +0 -1
- package/node_modules/@vercel/oidc/dist/token.test.d.ts +0 -1
- package/node_modules/agent-base/dist/helpers.d.ts +0 -15
- package/node_modules/agent-base/dist/helpers.d.ts.map +0 -1
- package/node_modules/agent-base/dist/helpers.js.map +0 -1
- package/node_modules/agent-base/dist/index.d.ts +0 -41
- package/node_modules/agent-base/dist/index.d.ts.map +0 -1
- package/node_modules/agent-base/dist/index.js.map +0 -1
- package/node_modules/ai/dist/index.d.mts +0 -6403
- package/node_modules/ai/dist/index.d.ts +0 -6403
- package/node_modules/ai/dist/index.js.map +0 -1
- package/node_modules/ai/dist/index.mjs.map +0 -1
- package/node_modules/ai/dist/internal/index.d.mts +0 -314
- package/node_modules/ai/dist/internal/index.d.ts +0 -314
- package/node_modules/ai/dist/internal/index.js.map +0 -1
- package/node_modules/ai/dist/internal/index.mjs.map +0 -1
- package/node_modules/ajv/dist/2019.d.ts +0 -19
- package/node_modules/ajv/dist/2019.js.map +0 -1
- package/node_modules/ajv/dist/2020.d.ts +0 -19
- package/node_modules/ajv/dist/2020.js.map +0 -1
- package/node_modules/ajv/dist/ajv.d.ts +0 -18
- package/node_modules/ajv/dist/ajv.js.map +0 -1
- package/node_modules/ajv/dist/compile/codegen/code.d.ts +0 -40
- package/node_modules/ajv/dist/compile/codegen/code.js.map +0 -1
- package/node_modules/ajv/dist/compile/codegen/index.d.ts +0 -79
- package/node_modules/ajv/dist/compile/codegen/index.js.map +0 -1
- package/node_modules/ajv/dist/compile/codegen/scope.d.ts +0 -79
- package/node_modules/ajv/dist/compile/codegen/scope.js.map +0 -1
- package/node_modules/ajv/dist/compile/errors.d.ts +0 -13
- package/node_modules/ajv/dist/compile/errors.js.map +0 -1
- package/node_modules/ajv/dist/compile/index.d.ts +0 -80
- package/node_modules/ajv/dist/compile/index.js.map +0 -1
- package/node_modules/ajv/dist/compile/jtd/parse.d.ts +0 -4
- package/node_modules/ajv/dist/compile/jtd/parse.js.map +0 -1
- package/node_modules/ajv/dist/compile/jtd/serialize.d.ts +0 -4
- package/node_modules/ajv/dist/compile/jtd/serialize.js.map +0 -1
- package/node_modules/ajv/dist/compile/jtd/types.d.ts +0 -6
- package/node_modules/ajv/dist/compile/jtd/types.js.map +0 -1
- package/node_modules/ajv/dist/compile/names.d.ts +0 -20
- package/node_modules/ajv/dist/compile/names.js.map +0 -1
- package/node_modules/ajv/dist/compile/ref_error.d.ts +0 -6
- package/node_modules/ajv/dist/compile/ref_error.js.map +0 -1
- package/node_modules/ajv/dist/compile/resolve.d.ts +0 -12
- package/node_modules/ajv/dist/compile/resolve.js.map +0 -1
- package/node_modules/ajv/dist/compile/rules.d.ts +0 -28
- package/node_modules/ajv/dist/compile/rules.js.map +0 -1
- package/node_modules/ajv/dist/compile/util.d.ts +0 -40
- package/node_modules/ajv/dist/compile/util.js.map +0 -1
- package/node_modules/ajv/dist/compile/validate/applicability.d.ts +0 -6
- package/node_modules/ajv/dist/compile/validate/applicability.js.map +0 -1
- package/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +0 -4
- package/node_modules/ajv/dist/compile/validate/boolSchema.js.map +0 -1
- package/node_modules/ajv/dist/compile/validate/dataType.d.ts +0 -17
- package/node_modules/ajv/dist/compile/validate/dataType.js.map +0 -1
- package/node_modules/ajv/dist/compile/validate/defaults.d.ts +0 -2
- package/node_modules/ajv/dist/compile/validate/defaults.js.map +0 -1
- package/node_modules/ajv/dist/compile/validate/index.d.ts +0 -42
- package/node_modules/ajv/dist/compile/validate/index.js.map +0 -1
- package/node_modules/ajv/dist/compile/validate/keyword.d.ts +0 -8
- package/node_modules/ajv/dist/compile/validate/keyword.js.map +0 -1
- package/node_modules/ajv/dist/compile/validate/subschema.d.ts +0 -47
- package/node_modules/ajv/dist/compile/validate/subschema.js.map +0 -1
- package/node_modules/ajv/dist/core.d.ts +0 -174
- package/node_modules/ajv/dist/core.js.map +0 -1
- package/node_modules/ajv/dist/jtd.d.ts +0 -47
- package/node_modules/ajv/dist/jtd.js.map +0 -1
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +0 -2
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map +0 -1
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +0 -2
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map +0 -1
- package/node_modules/ajv/dist/refs/jtd-schema.d.ts +0 -3
- package/node_modules/ajv/dist/refs/jtd-schema.js.map +0 -1
- package/node_modules/ajv/dist/runtime/equal.d.ts +0 -6
- package/node_modules/ajv/dist/runtime/equal.js.map +0 -1
- package/node_modules/ajv/dist/runtime/parseJson.d.ts +0 -18
- package/node_modules/ajv/dist/runtime/parseJson.js.map +0 -1
- package/node_modules/ajv/dist/runtime/quote.d.ts +0 -5
- package/node_modules/ajv/dist/runtime/quote.js.map +0 -1
- package/node_modules/ajv/dist/runtime/re2.d.ts +0 -6
- package/node_modules/ajv/dist/runtime/re2.js.map +0 -1
- package/node_modules/ajv/dist/runtime/timestamp.d.ts +0 -5
- package/node_modules/ajv/dist/runtime/timestamp.js.map +0 -1
- package/node_modules/ajv/dist/runtime/ucs2length.d.ts +0 -5
- package/node_modules/ajv/dist/runtime/ucs2length.js.map +0 -1
- package/node_modules/ajv/dist/runtime/uri.d.ts +0 -6
- package/node_modules/ajv/dist/runtime/uri.js.map +0 -1
- package/node_modules/ajv/dist/runtime/validation_error.d.ts +0 -7
- package/node_modules/ajv/dist/runtime/validation_error.js.map +0 -1
- package/node_modules/ajv/dist/standalone/index.d.ts +0 -6
- package/node_modules/ajv/dist/standalone/index.js.map +0 -1
- package/node_modules/ajv/dist/standalone/instance.d.ts +0 -12
- package/node_modules/ajv/dist/standalone/instance.js.map +0 -1
- package/node_modules/ajv/dist/types/index.d.ts +0 -183
- package/node_modules/ajv/dist/types/index.js.map +0 -1
- package/node_modules/ajv/dist/types/json-schema.d.ts +0 -125
- package/node_modules/ajv/dist/types/json-schema.js.map +0 -1
- package/node_modules/ajv/dist/types/jtd-schema.d.ts +0 -174
- package/node_modules/ajv/dist/types/jtd-schema.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +0 -8
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +0 -4
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +0 -7
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +0 -21
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/applicator/if.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +0 -13
- package/node_modules/ajv/dist/vocabularies/applicator/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/applicator/items.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +0 -4
- package/node_modules/ajv/dist/vocabularies/applicator/not.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/code.d.ts +0 -17
- package/node_modules/ajv/dist/vocabularies/code.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/core/id.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/core/id.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/core/index.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/core/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/core/ref.d.ts +0 -8
- package/node_modules/ajv/dist/vocabularies/core/ref.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +0 -10
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/draft2020.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/draft2020.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/draft7.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/draft7.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/errors.d.ts +0 -9
- package/node_modules/ajv/dist/vocabularies/errors.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/format/format.d.ts +0 -8
- package/node_modules/ajv/dist/vocabularies/format/format.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/format/index.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/format/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +0 -9
- package/node_modules/ajv/dist/vocabularies/jtd/error.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +0 -10
- package/node_modules/ajv/dist/vocabularies/jtd/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +0 -4
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +0 -22
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +0 -4
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +0 -10
- package/node_modules/ajv/dist/vocabularies/jtd/type.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/jtd/union.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/jtd/values.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/metadata.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/metadata.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/next.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/next.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/const.d.ts +0 -6
- package/node_modules/ajv/dist/vocabularies/validation/const.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +0 -5
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +0 -8
- package/node_modules/ajv/dist/vocabularies/validation/enum.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/index.d.ts +0 -16
- package/node_modules/ajv/dist/vocabularies/validation/index.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +0 -11
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +0 -3
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +0 -8
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +0 -8
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/required.d.ts +0 -8
- package/node_modules/ajv/dist/vocabularies/validation/required.js.map +0 -1
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +0 -9
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +0 -1
- package/node_modules/ajv-formats/dist/formats.d.ts +0 -9
- package/node_modules/ajv-formats/dist/formats.js.map +0 -1
- package/node_modules/ajv-formats/dist/index.d.ts +0 -15
- package/node_modules/ajv-formats/dist/index.js.map +0 -1
- package/node_modules/ajv-formats/dist/limit.d.ts +0 -10
- package/node_modules/ajv-formats/dist/limit.js.map +0 -1
- package/node_modules/balanced-match/dist/commonjs/index.d.ts +0 -9
- package/node_modules/balanced-match/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/balanced-match/dist/commonjs/index.js.map +0 -1
- package/node_modules/balanced-match/dist/esm/index.d.ts +0 -9
- package/node_modules/balanced-match/dist/esm/index.d.ts.map +0 -1
- package/node_modules/balanced-match/dist/esm/index.js.map +0 -1
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts +0 -6
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +0 -1
- package/node_modules/brace-expansion/dist/esm/index.d.ts +0 -6
- package/node_modules/brace-expansion/dist/esm/index.d.ts.map +0 -1
- package/node_modules/brace-expansion/dist/esm/index.js.map +0 -1
- package/node_modules/cookie/dist/index.d.ts +0 -148
- package/node_modules/cookie/dist/index.js.map +0 -1
- package/node_modules/eventsource-parser/dist/index.cjs.map +0 -1
- package/node_modules/eventsource-parser/dist/index.d.cts +0 -144
- package/node_modules/eventsource-parser/dist/index.d.ts +0 -144
- package/node_modules/eventsource-parser/dist/index.js.map +0 -1
- package/node_modules/eventsource-parser/dist/stream.cjs.map +0 -1
- package/node_modules/eventsource-parser/dist/stream.d.cts +0 -118
- package/node_modules/eventsource-parser/dist/stream.d.ts +0 -118
- package/node_modules/eventsource-parser/dist/stream.js.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/all-signals.d.ts +0 -2
- package/node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/all-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/index.d.ts +0 -58
- package/node_modules/foreground-child/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/index.js.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts +0 -6
- package/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/watchdog.d.ts +0 -10
- package/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/watchdog.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/all-signals.d.ts +0 -2
- package/node_modules/foreground-child/dist/esm/all-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/all-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/index.d.ts +0 -58
- package/node_modules/foreground-child/dist/esm/index.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/index.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/proxy-signals.d.ts +0 -6
- package/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/proxy-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/watchdog.d.ts +0 -10
- package/node_modules/foreground-child/dist/esm/watchdog.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/watchdog.js.map +0 -1
- package/node_modules/glob/dist/commonjs/glob.d.ts +0 -388
- package/node_modules/glob/dist/commonjs/glob.d.ts.map +0 -1
- package/node_modules/glob/dist/commonjs/glob.js.map +0 -1
- package/node_modules/glob/dist/commonjs/has-magic.d.ts +0 -14
- package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +0 -1
- package/node_modules/glob/dist/commonjs/has-magic.js.map +0 -1
- package/node_modules/glob/dist/commonjs/ignore.d.ts +0 -24
- package/node_modules/glob/dist/commonjs/ignore.d.ts.map +0 -1
- package/node_modules/glob/dist/commonjs/ignore.js.map +0 -1
- package/node_modules/glob/dist/commonjs/index.d.ts +0 -97
- package/node_modules/glob/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/glob/dist/commonjs/index.js.map +0 -1
- package/node_modules/glob/dist/commonjs/pattern.d.ts +0 -76
- package/node_modules/glob/dist/commonjs/pattern.d.ts.map +0 -1
- package/node_modules/glob/dist/commonjs/pattern.js.map +0 -1
- package/node_modules/glob/dist/commonjs/processor.d.ts +0 -59
- package/node_modules/glob/dist/commonjs/processor.d.ts.map +0 -1
- package/node_modules/glob/dist/commonjs/processor.js.map +0 -1
- package/node_modules/glob/dist/commonjs/walker.d.ts +0 -97
- package/node_modules/glob/dist/commonjs/walker.d.ts.map +0 -1
- package/node_modules/glob/dist/commonjs/walker.js.map +0 -1
- package/node_modules/glob/dist/esm/bin.d.mts +0 -3
- package/node_modules/glob/dist/esm/bin.d.mts.map +0 -1
- package/node_modules/glob/dist/esm/bin.mjs.map +0 -1
- package/node_modules/glob/dist/esm/glob.d.ts +0 -388
- package/node_modules/glob/dist/esm/glob.d.ts.map +0 -1
- package/node_modules/glob/dist/esm/glob.js.map +0 -1
- package/node_modules/glob/dist/esm/has-magic.d.ts +0 -14
- package/node_modules/glob/dist/esm/has-magic.d.ts.map +0 -1
- package/node_modules/glob/dist/esm/has-magic.js.map +0 -1
- package/node_modules/glob/dist/esm/ignore.d.ts +0 -24
- package/node_modules/glob/dist/esm/ignore.d.ts.map +0 -1
- package/node_modules/glob/dist/esm/ignore.js.map +0 -1
- package/node_modules/glob/dist/esm/index.d.ts +0 -97
- package/node_modules/glob/dist/esm/index.d.ts.map +0 -1
- package/node_modules/glob/dist/esm/index.js.map +0 -1
- package/node_modules/glob/dist/esm/pattern.d.ts +0 -76
- package/node_modules/glob/dist/esm/pattern.d.ts.map +0 -1
- package/node_modules/glob/dist/esm/pattern.js.map +0 -1
- package/node_modules/glob/dist/esm/processor.d.ts +0 -59
- package/node_modules/glob/dist/esm/processor.d.ts.map +0 -1
- package/node_modules/glob/dist/esm/processor.js.map +0 -1
- package/node_modules/glob/dist/esm/walker.d.ts +0 -97
- package/node_modules/glob/dist/esm/walker.d.ts.map +0 -1
- package/node_modules/glob/dist/esm/walker.js.map +0 -1
- package/node_modules/https-proxy-agent/dist/index.d.ts +0 -47
- package/node_modules/https-proxy-agent/dist/index.d.ts.map +0 -1
- package/node_modules/https-proxy-agent/dist/index.js.map +0 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +0 -15
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +0 -1
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +0 -1
- package/node_modules/ip-address/dist/address-error.d.ts +0 -5
- package/node_modules/ip-address/dist/address-error.d.ts.map +0 -1
- package/node_modules/ip-address/dist/address-error.js.map +0 -1
- package/node_modules/ip-address/dist/common.d.ts +0 -15
- package/node_modules/ip-address/dist/common.d.ts.map +0 -1
- package/node_modules/ip-address/dist/common.js.map +0 -1
- package/node_modules/ip-address/dist/ip-address.d.ts +0 -8
- package/node_modules/ip-address/dist/ip-address.d.ts.map +0 -1
- package/node_modules/ip-address/dist/ip-address.js.map +0 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +0 -209
- package/node_modules/ip-address/dist/ipv4.d.ts.map +0 -1
- package/node_modules/ip-address/dist/ipv4.js.map +0 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +0 -428
- package/node_modules/ip-address/dist/ipv6.d.ts.map +0 -1
- package/node_modules/ip-address/dist/ipv6.js.map +0 -1
- package/node_modules/ip-address/dist/v4/constants.d.ts +0 -5
- package/node_modules/ip-address/dist/v4/constants.d.ts.map +0 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +0 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +0 -45
- package/node_modules/ip-address/dist/v6/constants.d.ts.map +0 -1
- package/node_modules/ip-address/dist/v6/constants.js.map +0 -1
- package/node_modules/ip-address/dist/v6/helpers.d.ts +0 -18
- package/node_modules/ip-address/dist/v6/helpers.d.ts.map +0 -1
- package/node_modules/ip-address/dist/v6/helpers.js.map +0 -1
- package/node_modules/ip-address/dist/v6/regular-expressions.d.ts +0 -6
- package/node_modules/ip-address/dist/v6/regular-expressions.d.ts.map +0 -1
- package/node_modules/ip-address/dist/v6/regular-expressions.js.map +0 -1
- package/node_modules/jackspeak/dist/commonjs/index.d.ts +0 -323
- package/node_modules/jackspeak/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/jackspeak/dist/commonjs/index.js.map +0 -1
- package/node_modules/jackspeak/dist/commonjs/index.min.js.map +0 -7
- package/node_modules/jackspeak/dist/esm/index.d.ts +0 -323
- package/node_modules/jackspeak/dist/esm/index.d.ts.map +0 -1
- package/node_modules/jackspeak/dist/esm/index.js.map +0 -1
- package/node_modules/jackspeak/dist/esm/index.min.js.map +0 -7
- package/node_modules/lru-cache/dist/commonjs/index.d.ts +0 -1323
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/lru-cache/dist/commonjs/index.js.map +0 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +0 -7
- package/node_modules/lru-cache/dist/esm/index.d.ts +0 -1323
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +0 -1
- package/node_modules/lru-cache/dist/esm/index.js.map +0 -1
- package/node_modules/lru-cache/dist/esm/index.min.js.map +0 -7
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +0 -2
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +0 -1
- package/node_modules/minimatch/dist/commonjs/ast.d.ts +0 -22
- package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/ast.js.map +0 -1
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +0 -8
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +0 -1
- package/node_modules/minimatch/dist/commonjs/escape.d.ts +0 -15
- package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/escape.js.map +0 -1
- package/node_modules/minimatch/dist/commonjs/index.d.ts +0 -174
- package/node_modules/minimatch/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/index.js.map +0 -1
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts +0 -22
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +0 -1
- package/node_modules/minimatch/dist/commonjs/unescape.js.map +0 -1
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +0 -2
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +0 -1
- package/node_modules/minimatch/dist/esm/ast.d.ts +0 -22
- package/node_modules/minimatch/dist/esm/ast.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/ast.js.map +0 -1
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +0 -8
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/brace-expressions.js.map +0 -1
- package/node_modules/minimatch/dist/esm/escape.d.ts +0 -15
- package/node_modules/minimatch/dist/esm/escape.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/escape.js.map +0 -1
- package/node_modules/minimatch/dist/esm/index.d.ts +0 -174
- package/node_modules/minimatch/dist/esm/index.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/index.js.map +0 -1
- package/node_modules/minimatch/dist/esm/unescape.d.ts +0 -22
- package/node_modules/minimatch/dist/esm/unescape.d.ts.map +0 -1
- package/node_modules/minimatch/dist/esm/unescape.js.map +0 -1
- package/node_modules/minipass/dist/commonjs/index.d.ts +0 -545
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/minipass/dist/commonjs/index.js.map +0 -1
- package/node_modules/minipass/dist/esm/index.d.ts +0 -545
- package/node_modules/minipass/dist/esm/index.d.ts.map +0 -1
- package/node_modules/minipass/dist/esm/index.js.map +0 -1
- package/node_modules/node-pty/build/Release/pty.node +0 -0
- package/node_modules/node-pty/build/binding.Makefile +0 -6
- package/node_modules/node-pty/build/pty.target.mk +0 -168
- package/node_modules/node-pty/lib/eventEmitter2.test.js +0 -30
- package/node_modules/node-pty/lib/terminal.test.js +0 -139
- package/node_modules/node-pty/lib/testUtils.test.js +0 -28
- package/node_modules/node-pty/lib/unixTerminal.test.js +0 -351
- package/node_modules/node-pty/lib/windowsPtyAgent.test.js +0 -90
- package/node_modules/node-pty/lib/windowsTerminal.test.js +0 -219
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts +0 -89
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/package-json-from-dist/dist/commonjs/index.js.map +0 -1
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts +0 -89
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts.map +0 -1
- package/node_modules/package-json-from-dist/dist/esm/index.js.map +0 -1
- package/node_modules/path-scurry/dist/commonjs/index.d.ts +0 -1115
- package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/path-scurry/dist/commonjs/index.js.map +0 -1
- package/node_modules/path-scurry/dist/esm/index.d.ts +0 -1115
- package/node_modules/path-scurry/dist/esm/index.d.ts.map +0 -1
- package/node_modules/path-scurry/dist/esm/index.js.map +0 -1
- package/node_modules/ret/dist/index.d.ts +0 -7
- package/node_modules/ret/dist/index.js.map +0 -1
- package/node_modules/ret/dist/reconstruct.d.ts +0 -2
- package/node_modules/ret/dist/reconstruct.js.map +0 -1
- package/node_modules/ret/dist/sets-lookup.d.ts +0 -5
- package/node_modules/ret/dist/sets-lookup.js.map +0 -1
- package/node_modules/ret/dist/sets.d.ts +0 -9
- package/node_modules/ret/dist/sets.js.map +0 -1
- package/node_modules/ret/dist/tokenizer.d.ts +0 -8
- package/node_modules/ret/dist/tokenizer.js.map +0 -1
- package/node_modules/ret/dist/types/index.d.ts +0 -3
- package/node_modules/ret/dist/types/index.js.map +0 -1
- package/node_modules/ret/dist/types/set-lookup.d.ts +0 -8
- package/node_modules/ret/dist/types/set-lookup.js.map +0 -1
- package/node_modules/ret/dist/types/tokens.d.ts +0 -41
- package/node_modules/ret/dist/types/tokens.js.map +0 -1
- package/node_modules/ret/dist/types/types.d.ts +0 -10
- package/node_modules/ret/dist/types/types.js.map +0 -1
- package/node_modules/ret/dist/util.d.ts +0 -18
- package/node_modules/ret/dist/util.js.map +0 -1
- package/node_modules/ret/dist/write-set-tokens.d.ts +0 -14
- package/node_modules/ret/dist/write-set-tokens.js.map +0 -1
- package/node_modules/signal-exit/dist/cjs/browser.d.ts +0 -12
- package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/browser.js.map +0 -1
- package/node_modules/signal-exit/dist/cjs/index.d.ts +0 -48
- package/node_modules/signal-exit/dist/cjs/index.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/index.js.map +0 -1
- package/node_modules/signal-exit/dist/cjs/signals.d.ts +0 -29
- package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/signals.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/browser.d.ts +0 -12
- package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/browser.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/index.d.ts +0 -48
- package/node_modules/signal-exit/dist/mjs/index.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/index.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/signals.d.ts +0 -29
- package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/signals.js.map +0 -1
- package/node_modules/socks-proxy-agent/dist/index.d.ts +0 -27
- package/node_modules/socks-proxy-agent/dist/index.d.ts.map +0 -1
- package/node_modules/socks-proxy-agent/dist/index.js.map +0 -1
- package/node_modules/standardwebhooks/dist/index.d.ts +0 -24
- package/node_modules/standardwebhooks/dist/index.js.map +0 -1
- package/node_modules/standardwebhooks/dist/timing_safe_equal.d.ts +0 -1
- package/node_modules/standardwebhooks/dist/timing_safe_equal.js.map +0 -1
- package/node_modules/std-env/dist/index.d.cts +0 -92
- package/node_modules/std-env/dist/index.d.mts +0 -92
- package/node_modules/std-env/dist/index.d.ts +0 -92
- /package/dist/ui/_next/static/{XLzUBsNMptwXfIl9-a4z_ → VUA3uJYddmpvYUPcharb_}/_buildManifest.js +0 -0
- /package/dist/ui/_next/static/{XLzUBsNMptwXfIl9-a4z_ → VUA3uJYddmpvYUPcharb_}/_clientMiddlewareManifest.json +0 -0
- /package/dist/ui/_next/static/{XLzUBsNMptwXfIl9-a4z_ → VUA3uJYddmpvYUPcharb_}/_ssgManifest.js +0 -0
|
@@ -19,7 +19,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
19
19
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ui&&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:3===this._activeSelectionMode})}_isClickInSelection(e){let r=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!s&&!!i&&!!r&&this._areCoordsInSelection(r,s,i)}isCellInSelection(e,r){let s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!s&&!!i&&this._areCoordsInSelection([e,r],s,i)}_areCoordsInSelection(e,r,s){return e[1]>r[1]&&e[1]<s[1]||r[1]===s[1]&&e[1]===r[1]&&e[0]>=r[0]&&e[0]<s[0]||r[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||r[1]<s[1]&&e[1]===r[1]&&e[0]>=r[0]}_selectWordAtCursor(e,r){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=u_(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return!!i&&(this._selectWordAt(i,r),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,r){this._model.clearSelection(),e=Math.max(e,0),r=Math.min(r,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,r],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let r=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(r)return r[0]--,r[1]--,r[1]+=this._bufferService.buffer.ydisp,r}_getMouseEventScrollAmount(e){let r=hJ(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return r>=0&&r<=s?0:(r>s&&(r-=s),(r=Math.min(Math.max(r,-50),50)/50)/Math.abs(r)+Math.round(14*r))}shouldForceSelection(e){return ue?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&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=3*!!this.shouldColumnSelect(e),this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let r=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);r&&r.length!==this._model.selectionStart[0]&&0===r.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let r=this._getMouseBufferCoords(e);r&&(this._activeSelectionMode=2,this._selectLineAt(r[1]))}shouldColumnSelect(e){return e.altKey&&!(ue&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let r=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);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let e=s.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}r&&r[0]===this._model.selectionEnd[0]&&r[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?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let r=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&r<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&void 0!==r[0]&&void 0!==r[1]){let e=function(e,r,s,i){var n,o,a,l,c,d,h,u,f,p,m,g,v,x,_,y,b,w;let S,C=s.buffer.x,k=s.buffer.y;if(!s.buffer.hasScrollback){let b,w,S;return n=C,a=0,(0===uf(o=k,r,l=s,c=i).length?"":uv(um(n,o,n,o-up(o,l),!1,l).length,ug("D",c)))+uf(k,r,s,i)+(d=C,h=k,u=e,b=uf(h,f=r,p=s,m=i).length>0?f-up(f,p):h,S=(g=d,v=h,w=uf(x=u,_=f,y=p,m).length>0?_-up(_,y):v,g<x&&w<=_||g>=x&&w<_?"C":"D"),uv(um(d,b,u,f,"C"===S,p).length,ug(S,m)))}if(k===r)return S=C>e?"D":"C",uv(Math.abs(C-e),ug(S,i));S=k>r?"D":"C";let j=Math.abs(k-r);return uv((b=k>r?e:C,s.cols-b+(j-1)*s.cols+1+(w=0,(k>r?C:e)-1)),ug(S,i))}(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,r=this._model.finalSelectionEnd,s=!!e&&!!r&&(e[0]!==r[0]||e[1]!==r[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,r,s);return}!e||!r||this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&r[0]===this._oldSelectionEnd[0]&&r[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,r,s)}_fireOnSelectionChange(e,r,s){this._oldSelectionStart=e,this._oldSelectionEnd=r,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,r){let s=r;for(let i=0;r>=i;i++){let n=e.loadCell(i,this._workCell).getChars().length;0===this._workCell.getWidth()?s--:n>1&&r!==i&&(s+=n-1)}return s}setSelection(e,r,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,r],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,r,s=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let a=n.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(o,e[0]),c=l,d=e[0]-l,h=0,u=0,f=0,p=0;if(" "===a.charAt(l)){for(;l>0&&" "===a.charAt(l-1);)l--;for(;c<a.length&&" "===a.charAt(c+1);)c++}else{let r=e[0],s=e[0];0===o.getWidth(r)&&(h++,r--),2===o.getWidth(s)&&(u++,s++);let i=o.getString(s).length;for(i>1&&(p+=i-1,c+=i-1);r>0&&l>0&&!this._isCharWordSeparator(o.loadCell(r-1,this._workCell));){o.loadCell(r-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,r--):e>1&&(f+=e-1,l-=e-1),l--,r--}for(;s<o.length&&c+1<a.length&&!this._isCharWordSeparator(o.loadCell(s+1,this._workCell));){o.loadCell(s+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,s++):e>1&&(p+=e-1,c+=e-1),c++,s++}}c++;let m=l+d-h+f,g=Math.min(this._bufferService.cols,c-l+h+u-f-p);if(!(!r&&""===a.slice(l,c).trim())){if(s&&0===m&&32!==o.getCodePoint(0)){let r=n.lines.get(e[1]-1);if(r&&o.isWrapped&&32!==r.getCodePoint(this._bufferService.cols-1)){let r=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(r){let e=this._bufferService.cols-r.start;m-=e,g+=e}}}if(i&&m+g===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){let r=n.lines.get(e[1]+1);if(r?.isWrapped&&32!==r.getCodePoint(0)){let r=this._getWordAt([0,e[1]+1],!1,!1,!0);r&&(g+=r.length)}}return{start:m,length:g}}}_selectWordAt(e,r){let s=this._getWordAt(e,r);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let r=this._getWordAt(e,!0);if(r){let s=e[1];for(;r.start<0;)r.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;r.start+r.length>this._bufferService.cols;)r.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?r.start:r.start+r.length,s]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let r=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:r.first},end:{x:this._bufferService.cols-1,y:r.last}};this._model.selectionStart=[0,r.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=u_(s,this._bufferService.cols)}};ub=lm([lg(3,lP),lg(4,lB),lg(5,lq),lg(6,lz),lg(7,lV),lg(8,lU)],ub);var uw=class{constructor(){this._data={}}set(e,r,s){this._data[e]||(this._data[e]={}),this._data[e][r]=s}get(e,r){return this._data[e]?this._data[e][r]:void 0}clear(){this._data={}}},uS=class{constructor(){this._color=new uw,this._css=new uw}setCss(e,r,s){this._css.set(e,r,s)}getCss(e,r){return this._css.get(e,r)}setColor(e,r,s){this._color.set(e,r,s)}getColor(e,r){return this._color.get(e,r)}clear(){this._color.clear(),this._css.clear()}},uC=Object.freeze((()=>{let e=[u6.toColor("#2e3436"),u6.toColor("#cc0000"),u6.toColor("#4e9a06"),u6.toColor("#c4a000"),u6.toColor("#3465a4"),u6.toColor("#75507b"),u6.toColor("#06989a"),u6.toColor("#d3d7cf"),u6.toColor("#555753"),u6.toColor("#ef2929"),u6.toColor("#8ae234"),u6.toColor("#fce94f"),u6.toColor("#729fcf"),u6.toColor("#ad7fa8"),u6.toColor("#34e2e2"),u6.toColor("#eeeeec")],r=[0,95,135,175,215,255];for(let s=0;s<216;s++){let i=r[s/36%6|0],n=r[s/6%6|0],o=r[s%6];e.push({css:hp.toCss(i,n,o),rgba:hp.toRgba(i,n,o)})}for(let r=0;r<24;r++){let s=8+10*r;e.push({css:hp.toCss(s,s,s),rgba:hp.toRgba(s,s,s)})}return e})()),uk=u6.toColor("#ffffff"),uj=u6.toColor("#000000"),uN=u6.toColor("#ffffff"),uE={css:"rgba(255, 255, 255, 0.3)",rgba:0xffffff4d},uR=class extends cr{constructor(e){super(),this._optionsService=e,this._contrastCache=new uS,this._halfContrastCache=new uS,this._onChangeColors=this._register(new cM),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:uk,background:uj,cursor:uN,cursorAccent:uj,selectionForeground:void 0,selectionBackgroundTransparent:uE,selectionBackgroundOpaque:u4.blend(uj,uE),selectionInactiveBackgroundTransparent:uE,selectionInactiveBackgroundOpaque:u4.blend(uj,uE),scrollbarSliderBackground:u4.opacity(uk,.2),scrollbarSliderHoverBackground:u4.opacity(uk,.4),scrollbarSliderActiveBackground:u4.opacity(uk,.5),overviewRulerBorder:uk,ansi:uC.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let r=this._colors;if(r.foreground=uM(e.foreground,uk),r.background=uM(e.background,uj),r.cursor=u4.blend(r.background,uM(e.cursor,uN)),r.cursorAccent=u4.blend(r.background,uM(e.cursorAccent,uj)),r.selectionBackgroundTransparent=uM(e.selectionBackground,uE),r.selectionBackgroundOpaque=u4.blend(r.background,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundTransparent=uM(e.selectionInactiveBackground,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundOpaque=u4.blend(r.background,r.selectionInactiveBackgroundTransparent),r.selectionForeground=e.selectionForeground?uM(e.selectionForeground,h_):void 0,r.selectionForeground===h_&&(r.selectionForeground=void 0),u4.isOpaque(r.selectionBackgroundTransparent)&&(r.selectionBackgroundTransparent=u4.opacity(r.selectionBackgroundTransparent,.3)),u4.isOpaque(r.selectionInactiveBackgroundTransparent)&&(r.selectionInactiveBackgroundTransparent=u4.opacity(r.selectionInactiveBackgroundTransparent,.3)),r.scrollbarSliderBackground=uM(e.scrollbarSliderBackground,u4.opacity(r.foreground,.2)),r.scrollbarSliderHoverBackground=uM(e.scrollbarSliderHoverBackground,u4.opacity(r.foreground,.4)),r.scrollbarSliderActiveBackground=uM(e.scrollbarSliderActiveBackground,u4.opacity(r.foreground,.5)),r.overviewRulerBorder=uM(e.overviewRulerBorder,uk),r.ansi=uC.slice(),r.ansi[0]=uM(e.black,uC[0]),r.ansi[1]=uM(e.red,uC[1]),r.ansi[2]=uM(e.green,uC[2]),r.ansi[3]=uM(e.yellow,uC[3]),r.ansi[4]=uM(e.blue,uC[4]),r.ansi[5]=uM(e.magenta,uC[5]),r.ansi[6]=uM(e.cyan,uC[6]),r.ansi[7]=uM(e.white,uC[7]),r.ansi[8]=uM(e.brightBlack,uC[8]),r.ansi[9]=uM(e.brightRed,uC[9]),r.ansi[10]=uM(e.brightGreen,uC[10]),r.ansi[11]=uM(e.brightYellow,uC[11]),r.ansi[12]=uM(e.brightBlue,uC[12]),r.ansi[13]=uM(e.brightMagenta,uC[13]),r.ansi[14]=uM(e.brightCyan,uC[14]),r.ansi[15]=uM(e.brightWhite,uC[15]),e.extendedAnsi){let s=Math.min(r.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<s;i++)r.ansi[i+16]=uM(e.extendedAnsi[i],uC[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(void 0===e){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function uM(e,r){if(void 0!==e)try{return u6.toColor(e)}catch{}return r}uR=lm([lg(0,lz)],uR);var uD=class{constructor(...e){for(let[r,s]of(this._entries=new Map,e))this.set(r,s)}set(e,r){let s=this._entries.get(e);return this._entries.set(e,r),s}forEach(e){for(let[r,s]of this._entries.entries())e(r,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},uT=class{constructor(){this._services=new uD,this._services.set(lO,this)}setService(e,r){this._services.set(e,r)}getService(e){return this._services.get(e)}createInstance(e,...r){let s=(e[lM]||[]).sort((e,r)=>e.index-r.index),i=[];for(let r of s){let s=this._services.get(r.id);if(!s)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${r.id._id}.`);i.push(s)}let n=s.length>0?s[0].index:r.length;if(r.length!==n)throw Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${r.length} static arguments`);return new e(...r,...i)}},uP={trace:0,debug:1,info:2,warn:3,error:4,off:5},uL=class extends cr{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=uP[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)"function"==typeof e[r]&&(e[r]=e[r]())}_log(e,r,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...s)}trace(e,...r){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,r)}debug(e,...r){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,r)}info(e,...r){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,r)}warn(e,...r){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,r)}error(e,...r){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,r)}};uL=lm([lg(0,lz)],uL);var uB=class extends cr{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new cM),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new cM),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new cM),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 r=Array(e);for(let s=0;s<Math.min(e,this.length);s++)r[s]=this._array[this._getCyclicIndex(s)];this._array=r,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let r=this._length;r<e;r++)this._array[r]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,r){this._array[this._getCyclicIndex(e)]=r}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,r,...s){if(r){for(let s=e;s<this._length-r;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+r)];this._length-=r,this.onDeleteEmitter.fire({index:e,amount:r})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let e=this._length+s.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,r,s){if(!(r<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+s<0)throw Error("Cannot shift elements in list beyond index 0");if(s>0){for(let i=r-1;i>=0;i--)this.set(e+i+s,this.get(e+i));let i=e+r+s-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<r;i++)this.set(e+i+s,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},uA=Object.freeze(new lj),uO=0,uI=class e{constructor(e,r,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let i=r||lE.fromCharData([0,"",1,0]);for(let r=0;r<e;++r)this.setCell(r,i);this.length=e}get(e){let r=this._data[3*e+0],s=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:s?lw(s):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,r){this._data[3*e+1]=r[0],r[1].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[2]<<22):this._data[3*e+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 0xc00000&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 r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?lw(2097151&r):""}isProtected(e){return 0x20000000&this._data[3*e+2]}loadCell(e,r){return uO=3*e,r.content=this._data[uO+0],r.fg=this._data[uO+1],r.bg=this._data[uO+2],2097152&r.content&&(r.combinedData=this._combined[e]),0x10000000&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),0x10000000&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,s,i){0x10000000&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=r|s<<22,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}addCodepointToCell(e,r,s){let i=this._data[3*e+0];2097152&i?this._combined[e]+=lw(r):2097151&i?(this._combined[e]=lw(2097151&i)+lw(r),i&=-2097152,i|=2097152):i=4194304|r,s&&(i&=-0xc00001,i|=s<<22),this._data[3*e+0]=i}insertCells(e,r,s){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),r<this.length-e){let i=new lE;for(let s=this.length-e-r-1;s>=0;--s)this.setCell(e+r+s,this.loadCell(e+s,i));for(let i=0;i<r;++i)this.setCell(e+i,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,r,s){if(e%=this.length,r<this.length-e){let i=new lE;for(let s=0;s<this.length-e-r;++s)this.setCell(e+s,this.loadCell(e+r+s,i));for(let e=this.length-r;e<this.length;++e)this.setCell(e,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,r,s,i=!1){if(i){for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),r<this.length&&2===this.getWidth(r-1)&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,s);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;return}for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),r<this.length&&2===this.getWidth(r-1)&&this.setCellFromCodepoint(r,0,1,s);e<r&&e<this.length;)this.setCell(e++,s)}resize(e,r){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let s=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{let e=new Uint32Array(s);e.set(this._data),this._data=e}for(let s=this.length;s<e;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let s=0;s<r.length;s++){let i=parseInt(r[s],10);i>=e&&delete this._combined[i]}let i=Object.keys(this._extendedAttrs);for(let r=0;r<i.length;r++){let s=parseInt(i[r],10);s>=e&&delete this._extendedAttrs[s]}}return this.length=e,4*s*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,r=!1){if(r){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}copyFrom(e){for(let r in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[r]=e._combined[r];for(let r in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){let r=new e(0);for(let e in r._data=new Uint32Array(this._data),r.length=this.length,this._combined)r._combined[e]=this._combined[e];for(let e in this._extendedAttrs)r._extendedAttrs[e]=this._extendedAttrs[e];return r.isWrapped=this.isWrapped,r}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]||0x3000000&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,r,s,i,n){let o=e._data;if(n)for(let n=i-1;n>=0;n--){for(let e=0;e<3;e++)this._data[(s+n)*3+e]=o[(r+n)*3+e];0x10000000&o[(r+n)*3+2]&&(this._extendedAttrs[s+n]=e._extendedAttrs[r+n])}else for(let n=0;n<i;n++){for(let e=0;e<3;e++)this._data[(s+n)*3+e]=o[(r+n)*3+e];0x10000000&o[(r+n)*3+2]&&(this._extendedAttrs[s+n]=e._extendedAttrs[r+n])}let a=Object.keys(e._combined);for(let i=0;i<a.length;i++){let n=parseInt(a[i],10);n>=r&&(this._combined[n-r+s]=e._combined[n])}}translateToString(e,r,s,i){r=r??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),i&&(i.length=0);let n="";for(;r<s;){let e=this._data[3*r+0],s=2097151&e,o=2097152&e?this._combined[r]:s?lw(s):" ";if(n+=o,i)for(let e=0;e<o.length;++e)i.push(r);r+=e>>22||1}return i&&i.push(r),n}};function uz(e,r,s){if(r===e.length-1)return e[r].getTrimmedLength();let i=!e[r].hasContent(s-1)&&1===e[r].getWidth(s-1),n=2===e[r+1].getWidth(0);return i&&n?s-1:s}var uF=class e{constructor(r){this.line=r,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new cM),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),l7(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};uF._nextId=1;var uW={},uH=uW.B;uW[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:"≥","{":"π","|":"≠","}":"£","~":"·"},uW.A={"#":"£"},uW.B=void 0,uW[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},uW.C=uW[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},uW.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},uW.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},uW.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},uW.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},uW.E=uW[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},uW.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},uW.H=uW[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},uW["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var u$=class{constructor(e,r,s){this._hasScrollback=e,this._optionsService=r,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=uA.clone(),this.savedCharset=uH,this.markers=[],this._nullCell=lE.fromCharData([0,"",1,0]),this._whitespaceCell=lE.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupQueue=new uc,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new uB(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 lN),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 lN),this._whitespaceCell}getBlankLine(e,r){return new uI(this._bufferService.cols,this.getNullCell(e),r)}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 r=e+this._optionsService.rawOptions.scrollback;return r>0xffffffff?0xffffffff:r}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=uA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new uB(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,r){let s=this.getNullCell(uA),i=0,n=this._getCorrectBufferLength(r);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let r=0;r<this.lines.length;r++)i+=+this.lines.get(r).resize(e,s);let o=0;if(this._rows<r)for(let i=this._rows;i<r;i++)this.lines.length<r+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new uI(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new uI(e,s)));else for(let e=this._rows;e>r;e--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let e=this.lines.length-n;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=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,r-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(e,r),this._cols>e))for(let r=0;r<this.lines.length;r++)i+=+this.lines.get(r).resize(e,s);this._cols=e,this._rows=r,this._memoryCleanupQueue.clear(),i>.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 r=0;for(;this._memoryCleanupPosition<this.lines.length;)if((r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory())>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,r){this._cols!==e&&(e>this._cols?this._reflowLarger(e,r):this._reflowSmaller(e,r))}_reflowLarger(e,r){let s=this._optionsService.rawOptions.reflowCursorLine,i=function(e,r,s,i,n,o){let a=[];for(let l=0;l<e.length-1;l++){let c=l,d=e.get(++c);if(!d.isWrapped)continue;let h=[e.get(l)];for(;c<e.length&&d.isWrapped;)h.push(d),d=e.get(++c);if(!o&&i>=l&&i<c){l+=h.length-1;continue}let u=0,f=uz(h,0,r),p=1,m=0;for(;p<h.length;){let e=uz(h,p,r),i=Math.min(e-m,s-f);h[u].copyCellsFrom(h[p],m,f,i,!1),(f+=i)===s&&(u++,f=0),(m+=i)===e&&(p++,m=0),0===f&&0!==u&&2===h[u-1].getWidth(s-1)&&(h[u].copyCellsFrom(h[u-1],s-1,f++,1,!1),h[u-1].setCell(s-1,n))}h[u].replaceCells(f,s,n);let g=0;for(let e=h.length-1;e>0&&(e>u||0===h[e].getTrimmedLength());e--)g++;g>0&&(a.push(l+h.length-g),a.push(g)),l+=h.length-1}return a}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(uA),s);if(i.length>0){let s=function(e,r){let s=[],i=0,n=r[0],o=0;for(let a=0;a<e.length;a++)if(n===a){let s=r[++i];e.onDeleteEmitter.fire({index:a-o,amount:s}),a+=s-1,o+=s,n=r[++i]}else s.push(a);return{layout:s,countRemoved:o}}(this.lines,i);(function(e,r){let s=[];for(let i=0;i<r.length;i++)s.push(e.get(r[i]));for(let r=0;r<s.length;r++)e.set(r,s[r]);e.length=r.length})(this.lines,s.layout),this._reflowLargerAdjustViewport(e,r,s.countRemoved)}}_reflowLargerAdjustViewport(e,r,s){let i=this.getNullCell(uA),n=s;for(;n-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new uI(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,r){let s=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(uA),n=[],o=0;for(let a=this.lines.length-1;a>=0;a--){let l=this.lines.get(a);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let c=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),c.unshift(l);if(!s){let e=this.ybase+this.y;if(e>=a&&e<a+c.length)continue}let d=c[c.length-1].getTrimmedLength(),h=function(e,r,s){let i=[],n=e.map((s,i)=>uz(e,i,r)).reduce((e,r)=>e+r),o=0,a=0,l=0;for(;l<n;){if(n-l<s){i.push(n-l);break}o+=s;let c=uz(e,a,r);o>c&&(o-=c,a++);let d=2===e[a].getWidth(o-1);d&&o--;let h=d?s-1:s;i.push(h),l+=h}return i}(c,this._cols,e),u=h.length-c.length,f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+u):Math.max(0,this.lines.length-this.lines.maxLength+u);let p=[];for(let e=0;e<u;e++){let e=this.getBlankLine(uA,!0);p.push(e)}p.length>0&&(n.push({start:a+c.length+o,newLines:p}),o+=p.length),c.push(...p);let m=h.length-1,g=h[m];0===g&&(g=h[--m]);let v=c.length-u-1,x=d;for(;v>=0;){let e=Math.min(x,g);if(void 0===c[m])break;c[m].copyCellsFrom(c[v],x-e,g-e,e,!0),0==(g-=e)&&(g=h[--m]),0==(x-=e)&&(x=uz(c,Math.max(--v,0),this._cols))}for(let r=0;r<c.length;r++)h[r]<e&&c[r].setCell(h[r],i);let _=u-f;for(;_-- >0;)0===this.ybase?this.y<r-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+r-1)}if(n.length>0){let e=[],r=[];for(let e=0;e<this.lines.length;e++)r.push(this.lines.get(e));let s=this.lines.length,i=s-1,a=0,l=n[0];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let c=0;for(let d=Math.min(this.lines.maxLength-1,s+o-1);d>=0;d--)if(l&&l.start>i+c){for(let e=l.newLines.length-1;e>=0;e--)this.lines.set(d--,l.newLines[e]);d++,e.push({index:i+1,amount:l.newLines.length}),c+=l.newLines.length,l=n[++a]}else this.lines.set(d,r[i--]);let d=0;for(let r=e.length-1;r>=0;r--)e[r].index+=d,this.lines.onInsertEmitter.fire(e[r]),d+=e[r].amount;let h=Math.max(0,s+o-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,r,s=0,i){let n=this.lines.get(e);return n?n.translateToString(r,s,i):""}getWrappedRangeForLine(e){let r=e,s=e;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:r,last:s}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(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 r=0;r<this.markers.length;r++)this.markers[r].line===e&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let r=new uF(e);return this.markers.push(r),r.register(this.lines.onTrim(e=>{r.line-=e,r.line<0&&r.dispose()})),r.register(this.lines.onInsert(e=>{r.line>=e.index&&(r.line+=e.amount)})),r.register(this.lines.onDelete(e=>{r.line>=e.index&&r.line<e.index+e.amount&&r.dispose(),r.line>e.index&&(r.line-=e.amount)})),r.register(r.onDispose(()=>this._removeMarker(r))),r}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},uK=class extends cr{constructor(e,r){super(),this._optionsService=e,this._bufferService=r,this._onBufferActivate=this._register(new cM),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 u$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u$(!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,r){this._normal.resize(e,r),this._alt.resize(e,r),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},uU=class extends cr{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new cM),this.onResize=this._onResize.event,this._onScroll=this._register(new cM),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new uK(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,r){let s=this.cols!==e,i=this.rows!==r;this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r,colsChanged:s,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){let s=this.buffer,i;(i=this._cachedBlankLine)&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=s.getBlankLine(e,r),this._cachedBlankLine=i),i.isWrapped=r;let n=s.ybase+s.scrollTop,o=s.ybase+s.scrollBottom;if(0===s.scrollTop){let e=s.lines.isFull;o===s.lines.length-1?e?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(o+1,0,i.clone()),e?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let e=o-n+1;s.lines.shiftElements(n+1,e-1,-1),s.lines.set(o,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,r){let s=this.buffer;if(e<0){if(0===s.ydisp)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let i=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),i!==s.ydisp&&(r||this._onScroll.fire(s.ydisp))}};uU=lm([lg(0,lz)],uU);var uq={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:ue,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},uV=["normal","bold","100","200","300","400","500","600","700","800","900"],uY=class extends cr{constructor(e){super(),this._onOptionChange=this._register(new cM),this.onOptionChange=this._onOptionChange.event;let r={...uq};for(let s in e)if(s in r)try{let i=e[s];r[s]=this._sanitizeAndValidateOption(s,i)}catch(e){console.error(e)}this.rawOptions=r,this.options={...r},this._setupOptions(),this._register(l9(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,r){return this.onOptionChange(s=>{s===e&&r(this.rawOptions[e])})}onMultipleOptionChange(e,r){return this.onOptionChange(s=>{-1!==e.indexOf(s)&&r()})}_setupOptions(){let e=e=>{if(!(e in uq))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},r=(e,r)=>{if(!(e in uq))throw Error(`No option with key "${e}"`);r=this._sanitizeAndValidateOption(e,r),this.rawOptions[e]!==r&&(this.rawOptions[e]=r,this._onOptionChange.fire(e))};for(let s in this.rawOptions){let i={get:e.bind(this,s),set:r.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(e,r){switch(e){case"cursorStyle":var s;if(r||(r=uq[e]),"block"!==(s=r)&&"underline"!==s&&"bar"!==s)throw Error(`"${r}" is not a valid value for ${e}`);break;case"wordSeparator":r||(r=uq[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof r&&1<=r&&r<=1e3)break;r=uV.includes(r)?r:uq[e];break;case"cursorWidth":r=Math.floor(r);case"lineHeight":case"tabStopWidth":if(r<1)throw Error(`${e} cannot be less than 1, value: ${r}`);break;case"minimumContrastRatio":r=Math.max(1,Math.min(21,Math.round(10*r)/10));break;case"scrollback":if((r=Math.min(r,0xffffffff))<0)throw Error(`${e} cannot be less than 0, value: ${r}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(r<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${r}`);break;case"rows":case"cols":if(!r&&0!==r)throw Error(`${e} must be numeric, value: ${r}`);break;case"windowsPty":r=r??{}}return r}};function uX(e,r=5){if("object"!=typeof e)return e;let s=Array.isArray(e)?[]:{};for(let i in e)s[i]=r<=1?e[i]:e[i]&&uX(e[i],r-1);return s}var uG=Object.freeze({insertMode:!1}),uJ=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),uZ=class extends cr{constructor(e,r,s){super(),this._bufferService=e,this._logService=r,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new cM),this.onData=this._onData.event,this._onUserInput=this._register(new cM),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new cM),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new cM),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=uX(uG),this.decPrivateModes=uX(uJ)}reset(){this.modes=uX(uG),this.decPrivateModes=uX(uJ)}triggerDataEvent(e,r=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};uZ=lm([lg(0,lP),lg(1,lI),lg(2,lz)],uZ);var uQ={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function u0(e,r){let s=16*!!e.ctrl|4*!!e.shift|8*!!e.alt;return 4===e.button?(s|=64,s|=e.action):(s|=3&e.button,4&e.button&&(s|=64),8&e.button&&(s|=128),32===e.action?s|=32:0!==e.action||r||(s|=3)),s}var u1=String.fromCharCode,u2={DEFAULT:e=>{let r=[u0(e,!1)+32,e.col+32,e.row+32];return r[0]>255||r[1]>255||r[2]>255?"":`\x1b[M${u1(r[0])}${u1(r[1])}${u1(r[2])}`},SGR:e=>{let r=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${u0(e,!0)};${e.col};${e.row}${r}`},SGR_PIXELS:e=>{let r=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${u0(e,!0)};${e.x};${e.y}${r}`}},u5=class extends cr{constructor(e,r,s){for(let i of(super(),this._bufferService=e,this._coreService=r,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new cM),this.onProtocolChange=this._onProtocolChange.event,Object.keys(uQ)))this.addProtocol(i,uQ[i]);for(let e of Object.keys(u2))this.addEncoding(e,u2[e]);this.reset()}addProtocol(e,r){this._protocols[e]=r}addEncoding(e,r){this._encodings[e]=r}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,r,s){if(0===e.deltaY||e.shiftKey||void 0===r||void 0===s)return 0;let i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r/s+0,50>Math.abs(e.deltaY)&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,r){return r.altKey||r.ctrlKey||r.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let r=this._encodings[this._activeEncoding](e);return r&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(r):this._coreService.triggerDataEvent(r,!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,r,s){if(s){if(e.x!==r.x||e.y!==r.y)return!1}else if(e.col!==r.col||e.row!==r.row)return!1;return e.button===r.button&&e.action===r.action&&e.ctrl===r.ctrl&&e.alt===r.alt&&e.shift===r.shift}};u5=lm([lg(0,lP),lg(1,lB),lg(2,lz)],u5);var u3,u4,u6,u8,u7,u9,fe=[[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]],ft=[[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]],fr=class{constructor(){if(this.version="6",!u9){(u9=new Uint8Array(65536)).fill(1),u9[0]=0,u9.fill(0,1,32),u9.fill(0,127,160),u9.fill(2,4352,4448),u9[9001]=2,u9[9002]=2,u9.fill(2,11904,42192),u9[12351]=1,u9.fill(2,44032,55204),u9.fill(2,63744,64256),u9.fill(2,65040,65050),u9.fill(2,65072,65136),u9.fill(2,65280,65377),u9.fill(2,65504,65511);for(let e=0;e<fe.length;++e)u9.fill(0,fe[e][0],fe[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?u9[e]:!function(e,r){let s=0,i=r.length-1,n;if(e<r[0][0]||e>r[i][1])return!1;for(;i>=s;)if(e>r[n=s+i>>1][1])s=n+1;else{if(!(e<r[n][0]))return!0;i=n-1}return!1}(e,ft)?e>=131072&&e<=196605||e>=196608&&e<=262141?2:1:0}charProperties(e,r){let s=this.wcwidth(e),i=0===s&&0!==r;if(i){let e=fs.extractWidth(r);0===e?i=!1:e>s&&(s=e)}return fs.createPropertyValue(0,s,i)}},fs=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new cM,this.onChange=this._onChange.event;let e=new fr;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,r,s=!1){return(0xffffff&e)<<3|(3&r)<<1|!!s}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(r){let s=0,i=0,n=r.length;for(let o=0;o<n;++o){let a=r.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=n)return s+this.wcwidth(a);let e=r.charCodeAt(o);56320<=e&&e<=57343?a=(a-55296)*1024+e-56320+65536:s+=this.wcwidth(e)}let l=this.charProperties(a,i),c=e.extractWidth(l);e.extractShouldJoin(l)&&(c-=e.extractWidth(i)),s+=c,i=l}return s}charProperties(e,r){return this._activeProvider.charProperties(e,r)}},fi=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,r){this._charsets[e]=r,this.glevel===e&&(this.charset=r)}};function fn(e){let r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&r&&(s.isWrapped=0!==r[3]&&32!==r[3])}var fo=class e{constructor(e=32,r=32){if(this.maxLength=e,this.maxSubParamsLength=r,r>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(r){let s=new e;if(!r.length)return s;for(let e=+!!Array.isArray(r[0]);e<r.length;++e){let i=r[e];if(Array.isArray(i))for(let e=0;e<i.length;++e)s.addSubParam(i[e]);else s.addParam(i)}return s}clone(){let r=new e(this.maxLength,this.maxSubParamsLength);return r.params.set(this.params),r.length=this.length,r._subParams.set(this._subParams),r._subParamsLength=this._subParamsLength,r._subParamsIdx.set(this._subParamsIdx),r._rejectDigits=this._rejectDigits,r._rejectSubDigits=this._rejectSubDigits,r._digitIsSub=this._digitIsSub,r}toArray(){let e=[];for(let r=0;r<this.length;++r){e.push(this.params[r]);let s=this._subParamsIdx[r]>>8,i=255&this._subParamsIdx[r];i-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,i))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>0x7fffffff?0x7fffffff:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>0x7fffffff?0x7fffffff:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let r=this._subParamsIdx[e]>>8,s=255&this._subParamsIdx[e];return s-r>0?this._subParams.subarray(r,s):null}getSubParamsAll(){let e={};for(let r=0;r<this.length;++r){let s=this._subParamsIdx[r]>>8,i=255&this._subParamsIdx[r];i-s>0&&(e[r]=this._subParams.slice(s,i))}return e}addDigit(e){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,i=s[r-1];s[r-1]=~i?Math.min(10*i+e,0x7fffffff):e}},fa=[],fl=class{constructor(){this._state=0,this._active=fa,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,r){void 0===this._handlers[e]&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(r),{dispose:()=>{let e=s.indexOf(r);-1!==e&&s.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=fa}reset(){if(2===this._state)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=fa,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||fa,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,r,s){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,r,s);else this._handlerFb(this._id,"PUT",lS(e,r,s))}start(){this.reset(),this._state=1}put(e,r,s){if(3!==this._state){if(1===this._state)for(;r<s;){let s=e[r++];if(59===s){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}-1===this._id&&(this._id=0),this._id=10*this._id+s-48}2===this._state&&s-r>0&&this._put(e,r,s)}}end(e,r=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let s=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=r,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===s){for(;i>=0&&!0!==(s=this._active[i].end(e));i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if((s=this._active[i].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}else this._handlerFb(this._id,"END",e);this._active=fa,this._id=-1,this._state=0}}},fc=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,r,s){this._hitLimit||(this._data+=lS(e,r,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let r=!1;if(this._hitLimit)r=!1;else if(e&&(r=this._handler(this._data))instanceof Promise)return r.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,r}},fd=[],fh=class{constructor(){this._handlers=Object.create(null),this._active=fd,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=fd}registerHandler(e,r){void 0===this._handlers[e]&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(r),{dispose:()=>{let e=s.indexOf(r);-1!==e&&s.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=fd,this._ident=0}hook(e,r){if(this.reset(),this._ident=e,this._active=this._handlers[e]||fd,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(r);else this._handlerFb(this._ident,"HOOK",r)}put(e,r,s){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,r,s);else this._handlerFb(this._ident,"PUT",lS(e,r,s))}unhook(e,r=!0){if(this._active.length){let s=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=r,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===s){for(;i>=0&&!0!==(s=this._active[i].unhook(e));i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if((s=this._active[i].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}else this._handlerFb(this._ident,"UNHOOK",e);this._active=fd,this._ident=0}},fu=new fo;fu.addParam(0);var ff=class{constructor(e){this._handler=e,this._data="",this._params=fu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():fu,this._data="",this._hitLimit=!1}put(e,r,s){this._hitLimit||(this._data+=lS(e,r,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let r=!1;if(this._hitLimit)r=!1;else if(e&&(r=this._handler(this._data,this._params))instanceof Promise)return r.then(e=>(this._params=fu,this._data="",this._hitLimit=!1,e));return this._params=fu,this._data="",this._hitLimit=!1,r}},fp=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,r){this.table.fill(e<<4|r)}add(e,r,s,i){this.table[r<<8|e]=s<<4|i}addMany(e,r,s,i){for(let n=0;n<e.length;n++)this.table[r<<8|e[n]]=s<<4|i}},fm=function(){let e=new fp(4095),r=Array.apply(null,Array(256)).map((e,r)=>r),s=(e,s)=>r.slice(e,s),i=s(32,127),n=s(0,24);n.push(25),n.push.apply(n,s(28,32));let o=s(0,14),a;for(a in e.setDefault(1,0),e.addMany(i,0,2,0),o)e.addMany([24,26,153,154],a,3,0),e.addMany(s(128,144),a,3,0),e.addMany(s(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(i,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}(),fg=class extends cr{constructor(e=fm){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 fo,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,r,s)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,r)=>{},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(l9(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new fl),this._dcsParser=this._register(new fh),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,r=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if((s=e.prefix.charCodeAt(0))&&60>s||s>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 r=0;r<e.intermediates.length;++r){let i=e.intermediates.charCodeAt(r);if(32>i||i>47)throw Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=i}}if(1!==e.final.length)throw Error("final must be a single byte");let i=e.final.charCodeAt(0);if(r[0]>i||i>r[1])throw Error(`final must be in range ${r[0]} .. ${r[1]}`);return s<<=8,s|=i}identToString(e){let r=[];for(;e;)r.push(String.fromCharCode(255&e)),e>>=8;return r.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,r){let s=this._identifier(e,[48,126]);void 0===this._escHandlers[s]&&(this._escHandlers[s]=[]);let i=this._escHandlers[s];return i.push(r),{dispose:()=>{let e=i.indexOf(r);-1!==e&&i.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,r){this._executeHandlers[e.charCodeAt(0)]=r}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,r){let s=this._identifier(e);void 0===this._csiHandlers[s]&&(this._csiHandlers[s]=[]);let i=this._csiHandlers[s];return i.push(r),{dispose:()=>{let e=i.indexOf(r);-1!==e&&i.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,r){return this._dcsParser.registerHandler(this._identifier(e),r)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,r){return this._oscParser.registerHandler(e,r)}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,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,r,s,i,n){this._parseStack.state=e,this._parseStack.handlers=r,this._parseStack.handlerPos=s,this._parseStack.transition=i,this._parseStack.chunkPos=n}parse(e,r,s){let i=0,n=0,o=0,a;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===s||1===this._parseStack.state)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let r=this._parseStack.handlers,n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===s&&n>-1){for(;n>=0&&!0!==(a=r[n](this._params));n--)if(a instanceof Promise)return this._parseStack.handlerPos=n,a}this._parseStack.handlers=[];break;case 4:if(!1===s&&n>-1){for(;n>=0&&!0!==(a=r[n]());n--)if(a instanceof Promise)return this._parseStack.handlerPos=n,a}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(24!==i&&26!==i,s))return a;27===i&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],a=this._oscParser.end(24!==i&&26!==i,s))return a;27===i&&(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 s=o;s<r;++s){switch(i=e[s],(n=this._transitions.table[this.currentState<<8|(i<160?i:160)])>>4){case 2:for(let n=s+1;;++n)if(n>=r||(i=e[n])<32||i>126&&i<160||++n>=r||(i=e[n])<32||i>126&&i<160||++n>=r||(i=e[n])<32||i>126&&i<160||++n>=r||(i=e[n])<32||i>126&&i<160){this._printHandler(e,s,n),s=n-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:s,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],l=o?o.length-1:-1;for(;l>=0&&!0!==(a=o[l](this._params));l--)if(a instanceof Promise)return this._preserveStack(3,o,l,n,s),a;l<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(++s<r&&(i=e[s])>47&&i<60)s--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],d=c?c.length-1:-1;for(;d>=0&&!0!==(a=c[d]());d--)if(a instanceof Promise)return this._preserveStack(4,c,d,n,s),a;d<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 n=s+1;;++n)if(n>=r||24===(i=e[n])||26===i||27===i||i>127&&i<160){this._dcsParser.put(e,s,n),s=n-1;break}break;case 14:if(a=this._dcsParser.unhook(24!==i&&26!==i))return this._preserveStack(6,[],0,n,s),a;27===i&&(n|=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 n=s+1;;n++)if(n>=r||(i=e[n])<32||i>127&&i<160){this._oscParser.put(e,s,n),s=n-1;break}break;case 6:if(a=this._oscParser.end(24!==i&&26!==i))return this._preserveStack(5,[],0,n,s),a;27===i&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}},fv=/^([\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})$/,fx=/^[\da-f]+$/;function f_(e){if(!e)return;let r=e.toLowerCase();if(0===r.indexOf("rgb:")){r=r.slice(4);let e=fv.exec(r);if(e){let r=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/r*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/r*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/r*255)]}}else if(0===r.indexOf("#")&&(r=r.slice(1),fx.exec(r)&&[3,6,9,12].includes(r.length))){let e=r.length/3,s=[0,0,0];for(let i=0;i<3;++i){let n=parseInt(r.slice(e*i,e*i+e),16);s[i]=1===e?n<<4:2===e?n:3===e?n>>4:n>>8}return s}}function fy(e,r){let s=e.toString(16),i=s.length<2?"0"+s:s;switch(r){case 4:return s[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}var fb={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function fw(e,r){if(e>24)return r.setWinLines||!1;switch(e){case 1:return!!r.restoreWin;case 2:return!!r.minimizeWin;case 3:return!!r.setWinPosition;case 4:return!!r.setWinSizePixels;case 5:return!!r.raiseWin;case 6:return!!r.lowerWin;case 7:return!!r.refreshWin;case 8:return!!r.setWinSizeChars;case 9:return!!r.maximizeWin;case 10:return!!r.fullscreenWin;case 11:return!!r.getWinState;case 13:return!!r.getWinPosition;case 14:return!!r.getWinSizePixels;case 15:return!!r.getScreenSizePixels;case 16:return!!r.getCellSizePixels;case 18:return!!r.getWinSizeChars;case 19:return!!r.getScreenSizeChars;case 20:return!!r.getIconTitle;case 21:return!!r.getWinTitle;case 22:return!!r.pushTitle;case 23:return!!r.popTitle;case 24:return!!r.setWinLines}return!1}var fS=0,fC=class extends cr{constructor(e,r,s,i,n,o,a,l,c=new fg){for(let d in super(),this._bufferService=e,this._charsetService=r,this._coreService=s,this._logService=i,this._optionsService=n,this._oscLinkService=o,this._coreMouseService=a,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new lC,this._utf8Decoder=new lk,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=uA.clone(),this._eraseAttrDataInternal=uA.clone(),this._onRequestBell=this._register(new cM),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new cM),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new cM),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new cM),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new cM),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new cM),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new cM),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new cM),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new cM),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new cM),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new cM),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new cM),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new cM),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 fk(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,r)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:r.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,r,s)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:r,data:s})}),this._parser.setDcsHandlerFallback((e,r,s)=>{"HOOK"===r&&(s=s.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:r,payload:s})}),this._parser.setPrintHandler((e,r,s)=>this.print(e,r,s)),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(hh.BEL,()=>this.bell()),this._parser.setExecuteHandler(hh.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(hh.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(hh.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(hh.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(hh.BS,()=>this.backspace()),this._parser.setExecuteHandler(hh.HT,()=>this.tab()),this._parser.setExecuteHandler(hh.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(hh.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(hu.IND,()=>this.index()),this._parser.setExecuteHandler(hu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(hu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new fc(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new fc(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new fc(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new fc(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new fc(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new fc(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new fc(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new fc(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new fc(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new fc(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new fc(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new fc(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()),uW)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));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 ff((e,r)=>this.requestStatusString(e,r)))}getAttrData(){return this._curAttrData}_preserveStack(e,r,s,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=r,this._parseStack.decodedLength=s,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,r){let s,i=this._activeBuffer.x,n=this._activeBuffer.y,o=0,a=this._parseStack.paused;if(a){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,r))return this._logSlowResolvingAsync(s),s;i=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(o=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${"string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`}`),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),a||this._dirtyRowTracker.clearRange(),e.length>131072)for(let r=o;r<e.length;r+=131072){let o=r+131072<e.length?r+131072:e.length,a="string"==typeof e?this._stringDecoder.decode(e.substring(r,o),this._parseBuffer):this._utf8Decoder.decode(e.subarray(r,o),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,a))return this._preserveStack(i,n,a,r),this._logSlowResolvingAsync(s),s}else if(!a){let r="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,r))return this._preserveStack(i,n,r,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==i||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,r,s){let i,n,o=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-r>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let f=this._parser.precedingJoinState;for(let p=r;p<s;++p){if((i=e[p])<127&&o){let e=o[String.fromCharCode(i)];e&&(i=e.charCodeAt(0))}let r=this._unicodeService.charProperties(i,f);n=fs.extractWidth(r);let s=fs.extractShouldJoin(r),m=s?fs.extractWidth(f):0;if(f=r,a&&this._onA11yChar.fire(lw(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-m>l){if(c){let e=u,r=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&u instanceof uI&&u.copyCellsFrom(e,r,0,m,!1);r<l;)e.setCellFromCodepoint(r++,0,1,h)}else if(this._activeBuffer.x=l-1,2===n)continue}if(s&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,i,n);for(let e=n-m;--e>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(d&&(u.insertCells(this._activeBuffer.x,n-m,this._activeBuffer.getNullCell(h)),2===u.getWidth(l-1)&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,i,n,h),n>0)for(;--n;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&s-r>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,r){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,r):this._parser.registerCsiHandler(e,e=>!fw(e.params[0],this._optionsService.rawOptions.windowOptions)||r(e))}registerDcsHandler(e,r){return this._parser.registerDcsHandler(e,new ff(r))}registerEscHandler(e,r){return this._parser.registerEscHandler(e,r)}registerOscHandler(e,r){return this._parser.registerOscHandler(e,new fc(r))}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(0===this._activeBuffer.x&&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,r){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+r):(this._activeBuffer.x=e,this._activeBuffer.y=r),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,r){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+r)}cursorUp(e){let r=this._activeBuffer.y-this._activeBuffer.scrollTop;return r>=0?this._moveCursor(0,-Math.min(r,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let r=this._activeBuffer.scrollBottom-this._activeBuffer.y;return r>=0?this._moveCursor(0,Math.min(r,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 r=e.params[0];return 0===r?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===r&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let r=e.params[0]||1;for(;r--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let r=e.params[0]||1;for(;r--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let r=e.params[0];return 1===r&&(this._curAttrData.bg|=0x20000000),(2===r||0===r)&&(this._curAttrData.bg&=-0x20000001),!0}_eraseInBufferLine(e,r,s,i=!1,n=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(r,s,this._activeBuffer.getNullCell(this._eraseAttrData()),n),i&&(o.isWrapped=!1)}_resetBufferLine(e,r=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),r),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,r=!1){let s;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,r);s<this._bufferService.rows;s++)this._resetBufferLine(s,r);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,r),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,r);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,r);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0))}return!0}eraseInLine(e,r=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,r);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,r);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,r)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let r=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;r--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(s,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 r=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;r--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,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 r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return r&&(r.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 r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return r&&(r.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let r=e.params[0]||1;for(;r--;)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 r=e.params[0]||1;for(;r--;)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(uA));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 r=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.deleteCells(0,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 r=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.insertCells(0,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 r=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.insertCells(this._activeBuffer.x,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 r=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.deleteCells(this._activeBuffer.x,r,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return r&&(r.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 r=this._parser.precedingJoinState;if(!r)return!0;let s=e.params[0]||1,i=fs.extractWidth(r),n=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),a=new Uint32Array(o.length*s),l=0;for(let e=0;e<o.length;){let r=o.codePointAt(e)||0;a[l++]=r,e+=r>65535?2:1}let c=l;for(let e=1;e<s;++e)a.copyWithin(c,0,l),c+=l;return this.print(a,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(hh.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(hh.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(hh.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(hh.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(hh.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let r=0;r<e.length;r++)switch(e.params[r]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let r=0;r<e.length;r++)switch(e.params[r]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,uH),this._charsetService.setgCharset(1,uH),this._charsetService.setgCharset(2,uH),this._charsetService.setgCharset(3,uH);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let r=0;r<e.length;r++)switch(e.params[r]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let r=0;r<e.length;r++)switch(e.params[r]){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(),1049===e.params[r]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,r){let s,i,n,o;(i=s||={})[i.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",i[i.SET=1]="SET",i[i.RESET=2]="RESET",i[i.PERMANENTLY_SET=3]="PERMANENTLY_SET",i[i.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let a=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:c}=this._coreMouseService,d=this._coreService,{buffers:h,cols:u}=this._bufferService,{active:f,alt:p}=h,m=this._optionsService.rawOptions,g=e=>e?1:2,v=e.params[0];return n=v,o=r?2===v?4:4===v?g(d.modes.insertMode):12===v?3:20===v?g(m.convertEol):0:1===v?g(a.applicationCursorKeys):3===v?m.windowOptions.setWinLines?80===u?2:+(132===u):0:6===v?g(a.origin):7===v?g(a.wraparound):8===v?3:9===v?g("X10"===l):12===v?g(m.cursorBlink):25===v?g(!d.isCursorHidden):45===v?g(a.reverseWraparound):66===v?g(a.applicationKeypad):67===v?4:1e3===v?g("VT200"===l):1002===v?g("DRAG"===l):1003===v?g("ANY"===l):1004===v?g(a.sendFocus):1005===v?4:1006===v?g("SGR"===c):1015===v?4:1016===v?g("SGR_PIXELS"===c):1048===v?1:47===v||1047===v||1049===v?g(f===p):2004===v?g(a.bracketedPasteMode):2026===v?g(a.synchronizedOutput):0,d.triggerDataEvent(`${hh.ESC}[${r?"":"?"}${n};${o}$y`),!0}_updateAttrColor(e,r,s,i,n){return 2===r?(e|=0x3000000,e&=-0x1000000,e|=lj.fromColorRGB([s,i,n])):5===r&&(e&=-0x3000100,e|=0x2000000|255&s),e}_extractColor(e,r,s){let i=[0,0,-1,0,0,0],n=0,o=0;do{if(i[o+n]=e.params[r+o],e.hasSubParams(r+o)){let s=e.getSubParams(r+o),a=0;do 5===i[1]&&(n=1),i[o+a+1+n]=s[a];while(++a<s.length&&a+o+1+n<i.length)break}if(5===i[1]&&o+n>=2||2===i[1]&&o+n>=5)break;i[1]&&(n=1)}while(++o+r<e.length&&o+n<i.length)for(let e=2;e<i.length;++e)-1===i[e]&&(i[e]=0);switch(i[0]){case 38:s.fg=this._updateAttrColor(s.fg,i[1],i[3],i[4],i[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,i[1],i[3],i[4],i[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,r){r.extended=r.extended.clone(),(!~e||e>5)&&(e=1),r.extended.underlineStyle=e,r.fg|=0x10000000,0===e&&(r.fg&=-0x10000001),r.updateExtended()}_processSGR0(e){e.fg=uA.fg,e.bg=uA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-0x4000000,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let r=e.length,s,i=this._curAttrData;for(let n=0;n<r;n++)(s=e.params[n])>=30&&s<=37?(i.fg&=-0x3000100,i.fg|=0x1000000|s-30):s>=40&&s<=47?(i.bg&=-0x3000100,i.bg|=0x1000000|s-40):s>=90&&s<=97?(i.fg&=-0x3000100,i.fg|=0x1000000|s-90|8):s>=100&&s<=107?(i.bg&=-0x3000100,i.bg|=0x1000000|s-100|8):0===s?this._processSGR0(i):1===s?i.fg|=0x8000000:3===s?i.bg|=0x4000000:4===s?(i.fg|=0x10000000,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,i)):5===s?i.fg|=0x20000000:7===s?i.fg|=0x4000000:8===s?i.fg|=0x40000000:9===s?i.fg|=0x80000000:2===s?i.bg|=0x8000000:21===s?this._processUnderline(2,i):22===s?(i.fg&=-0x8000001,i.bg&=-0x8000001):23===s?i.bg&=-0x4000001:24===s?(i.fg&=-0x10000001,this._processUnderline(0,i)):25===s?i.fg&=-0x20000001:27===s?i.fg&=-0x4000001:28===s?i.fg&=-0x40000001:29===s?i.fg&=0x7fffffff:39===s?(i.fg&=-0x4000000,i.fg|=0xffffff&uA.fg):49===s?(i.bg&=-0x4000000,i.bg|=0xffffff&uA.bg):38===s||48===s||58===s?n+=this._extractColor(e,n,i):53===s?i.bg|=0x40000000:55===s?i.bg&=-0x40000001:59===s?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):100===s?(i.fg&=-0x4000000,i.fg|=0xffffff&uA.fg,i.bg&=-0x4000000,i.bg|=0xffffff&uA.bg):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${hh.ESC}[0n`);break;case 6:let r=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${hh.ESC}[${r};${s}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${hh.ESC}[?${e};${r}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=uA.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 r=0===e.length?1:e.params[0];if(0===r)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(r){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}this._coreService.decPrivateModes.cursorBlink=r%2==1}return!0}setScrollRegion(e){let r=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||0===s)&&(s=this._bufferService.rows),s>r&&(this._activeBuffer.scrollTop=r-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!fw(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let r=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==r&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${hh.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===r||2===r)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===r||1===r)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===r||2===r)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===r||1===r)&&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 r=[],s=e.split(";");for(;s.length>1;){let e=s.shift(),i=s.shift();if(/^\d+$/.exec(e)){let s=parseInt(e);if(fj(s))if("?"===i)r.push({type:0,index:s});else{let e=f_(i);e&&r.push({type:1,index:s,color:e})}}}return r.length&&this._onColor.fire(r),!0}setHyperlink(e){let r=e.indexOf(";");if(-1===r)return!0;let s=e.slice(0,r).trim(),i=e.slice(r+1);return i?this._createHyperlink(s,i):!s.trim()&&this._finishHyperlink()}_createHyperlink(e,r){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),i,n=s.findIndex(e=>e.startsWith("id="));return -1!==n&&(i=s[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:r}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,r){let s=e.split(";");for(let e=0;e<s.length&&!(r>=this._specialColors.length);++e,++r)if("?"===s[e])this._onColor.fire([{type:0,index:this._specialColors[r]}]);else{let i=f_(s[e]);i&&this._onColor.fire([{type:1,index:this._specialColors[r],color:i}])}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 r=[],s=e.split(";");for(let e=0;e<s.length;++e)if(/^\d+$/.exec(s[e])){let i=parseInt(s[e]);fj(i)&&r.push({type:2,index:i})}return r.length&&this._onColor.fire(r),!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,uH),!0}selectCharset(e){return 2!==e.length?this.selectDefaultCharset():"/"===e[0]||this._charsetService.setgCharset(fb[e[0]],uW[e[1]]||uH),!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=uA.clone(),this._eraseAttrDataInternal=uA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-0x4000000,this._eraseAttrDataInternal.bg|=0x3ffffff&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new lE;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let r=0;r<this._bufferService.rows;++r){let s=this._activeBuffer.ybase+this._activeBuffer.y+r,i=this._activeBuffer.lines.get(s);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,r){let s=e=>(this._coreService.triggerDataEvent(`${hh.ESC}${e}${hh.ESC}\\`),!0),i=this._bufferService.buffer,n=this._optionsService.rawOptions;return s('"q'===e?`P1$r${+!!this._curAttrData.isProtected()}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${({block:2,underline:4,bar:6})[n.cursorStyle]-!!n.cursorBlink} q`:"P0$r")}markRangeDirty(e,r){this._dirtyRowTracker.markRangeDirty(e,r)}},fk=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,r){e>r&&(fS=e,e=r,r=fS),e<this.start&&(this.start=e),r>this.end&&(this.end=r)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function fj(e){return 0<=e&&e<256}fk=lm([lg(0,lP)],fk);var fN=class extends cr{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 cM),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,r){let s;if(void 0!==r&&this._syncCalls>r){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){for(this._isSyncWriting=!0;s=this._writeBuffer.shift();){this._action(s);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=0x7fffffff,this._isSyncWriting=!1,this._syncCalls=0}}write(e,r){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){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(r),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(r)}_innerWrite(e=0,r=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],i=this._action(e,r);if(i){let e=e=>performance.now()-s>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(s,e);i.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-s>=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()}},fE=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let r=this._bufferService.buffer;if(void 0===e.id){let s=r.addMarker(r.ybase+r.y),i={data:e,id:this._nextId++,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(i,s)),this._dataByLinkId.set(i.id,i),i.id}let s=this._getEntryIdKey(e),i=this._entriesWithId.get(s);if(i)return this.addLineToLink(i.id,r.ybase+r.y),i.id;let n=r.addMarker(r.ybase+r.y),o={id:this._nextId++,key:this._getEntryIdKey(e),data:e,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,r){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(e=>e.line!==r)){let e=this._bufferService.buffer.addMarker(r);s.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(s,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,r){let s=e.lines.indexOf(r);-1!==s&&(e.lines.splice(s,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};fE=lm([lg(0,lP)],fE);var fR=!1,fM=class extends cr{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cs),this._onBinary=this._register(new cM),this.onBinary=this._onBinary.event,this._onData=this._register(new cM),this.onData=this._onData.event,this._onLineFeed=this._register(new cM),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new cM),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new cM),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new cM),this._instantiationService=new uT,this.optionsService=this._register(new uY(e)),this._instantiationService.setService(lz,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(uU)),this._instantiationService.setService(lP,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(uL)),this._instantiationService.setService(lI,this._logService),this.coreService=this._register(this._instantiationService.createInstance(uZ)),this._instantiationService.setService(lB,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(u5)),this._instantiationService.setService(lL,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(fs)),this._instantiationService.setService(lW,this.unicodeService),this._charsetService=this._instantiationService.createInstance(fi),this._instantiationService.setService(lA,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(fE),this._instantiationService.setService(lF,this._oscLinkService),this._inputHandler=this._register(new fC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(cS.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(cS.forward(this._bufferService.onResize,this._onResize)),this._register(cS.forward(this.coreService.onData,this._onData)),this._register(cS.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new fN((e,r)=>this._inputHandler.parse(e,r))),this._register(cS.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new cM),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 r in e)this.optionsService.options[r]=e[r]}write(e,r){this._writeBuffer.write(e,r)}writeSync(e,r){this._logService.logLevel<=3&&!fR&&(this._logService.warn("writeSync is unreliable and will be removed soon."),fR=!0),this._writeBuffer.writeSync(e,r)}input(e,r=!0){this.coreService.triggerDataEvent(e,r)}resize(e,r){isNaN(e)||isNaN(r)||(e=Math.max(e,2),r=Math.max(r,1),this._bufferService.resize(e,r))}scroll(e,r=!1){this._bufferService.scroll(e,r)}scrollLines(e,r){this._bufferService.scrollLines(e,r)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let r=e-this._bufferService.buffer.ydisp;0!==r&&this.scrollLines(r)}registerEscHandler(e,r){return this._inputHandler.registerEscHandler(e,r)}registerDcsHandler(e,r){return this._inputHandler.registerDcsHandler(e,r)}registerCsiHandler(e,r){return this._inputHandler.registerCsiHandler(e,r)}registerOscHandler(e,r){return this._inputHandler.registerOscHandler(e,r)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,r=this.optionsService.rawOptions.windowsPty;r&&void 0!==r.buildNumber&&void 0!==r.buildNumber?e="conpty"===r.backend&&r.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(fn.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(fn(this._bufferService),!1))),this._windowsWrappingHeuristics.value=l9(()=>{for(let r of e)r.dispose()})}}},fD={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:["'",'"']},fT=0,fP=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new uc,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new uc,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,r)=>this._getKey(e)-this._getKey(r)),r=0,s=0,i=Array(this._array.length+this._insertedValues.length);for(let n=0;n<i.length;n++)s>=this._array.length||this._getKey(e[r])<=this._getKey(this._array[s])?(i[n]=e[r],r++):i[n]=this._array[s++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let r=this._getKey(e);if(void 0===r||-1===(fT=this._search(r))||this._getKey(this._array[fT])!==r)return!1;do if(this._array[fT]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(fT),!0;while(++fT<this._array.length&&this._getKey(this._array[fT])===r)return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,r)=>e-r),r=0,s=Array(this._array.length-e.length),i=0;for(let n=0;n<this._array.length;n++)e[r]===n?r++:s[i++]=this._array[n];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((fT=this._search(e))<0||fT>=this._array.length)&&this._getKey(this._array[fT])===e)do yield this._array[fT];while(++fT<this._array.length&&this._getKey(this._array[fT])===e)}forEachByKey(e,r){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((fT=this._search(e))<0||fT>=this._array.length)&&this._getKey(this._array[fT])===e)do r(this._array[fT]);while(++fT<this._array.length&&this._getKey(this._array[fT])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let r=0,s=this._array.length-1;for(;s>=r;){let i=r+s>>1,n=this._getKey(this._array[i]);if(n>e)s=i-1;else if(n<e)r=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return r}},fL=0,fB=0,fA=class extends cr{constructor(){super(),this._decorations=new fP(e=>e?.marker.line),this._onDecorationRegistered=this._register(new cM),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new cM),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(l9(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let r=new fO(e);if(r){let e=r.marker.onDispose(()=>r.dispose()),s=r.onDispose(()=>{s.dispose(),r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),e.dispose())});this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,r,s){let i=0,n=0;for(let o of this._decorations.getKeyIterator(r))n=(i=o.options.x??0)+(o.options.width??1),e>=i&&e<n&&(!s||(o.options.layer??"bottom")===s)&&(yield o)}forEachDecorationAtCell(e,r,s,i){this._decorations.forEachByKey(r,r=>{fB=(fL=r.options.x??0)+(r.options.width??1),e>=fL&&e<fB&&(!s||(r.options.layer??"bottom")===s)&&i(r)})}},fO=class extends ct{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new cM),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new cM),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=u6.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=u6.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},fI=class{constructor(e,r=1e3){this._renderCallback=e,this._debounceThresholdMS=r,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,r,s){this._rowCount=s,e=void 0!==e?e:0,r=void 0!==r?r:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,r):r;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=i-this._lastRefreshMs,r=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},r)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),r=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,r)}},fz=class extends cr{constructor(e,r,s,i){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new fI(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(`
|
|
20
20
|
`))),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(dB(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(l9(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let r=0;r<e;r++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
21
21
|
`&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=lx)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,r){this._liveRegionDebouncer.refresh(e,r,this._terminal.rows)}_renderRows(e,r){let s=this._terminal.buffer,i=s.lines.length.toString();for(let n=e;n<=r;n++){let e=s.lines.get(s.ydisp+n),r=[],o=e?.translateToString(!0,void 0,void 0,r)||"",a=(s.ydisp+n+1).toString(),l=this._rowElements[n];l&&(0===o.length?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=o,this._rowColumns.set(l,r)),l.setAttribute("aria-posinset",a),l.setAttribute("aria-setsize",i),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,r){let s,i,n=e.target,o=this._rowElements[0===r?1:this._rowElements.length-2];if(n.getAttribute("aria-posinset")!==(0===r?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===r?(s=n,i=this._rowElements.pop(),this._rowContainer.removeChild(i)):(s=this._rowElements.shift(),i=n,this._rowContainer.removeChild(s)),s.removeEventListener("focus",this._topBoundaryFocusListener),i.removeEventListener("focus",this._bottomBoundaryFocusListener),0===r){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(0===r?-1:1),this._rowElements[0===r?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((r.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===s.node&&r.offset>s.offset)&&([r,s]=[s,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;let i=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let n=({node:e,offset:r})=>{let s=e instanceof Text?e.parentNode:e,i=parseInt(s?.getAttribute("aria-posinset"),10)-1;if(isNaN(i))return console.warn("row is invalid. Race condition?"),null;let n=this._rowColumns.get(s);if(!n)return console.warn("columns is null. Race condition?"),null;let o=r<n.length?n[r]:n.slice(-1)[0]+1;return o>=this._terminal.cols&&(++i,o=0),{row:i,column:o}},o=n(r),a=n(s);if(!(!o||!a)){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let r=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let i=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/r})`}};fz=lm([lg(1,lO),lg(2,lU),lg(3,lV)],fz);var fF=class extends cr{constructor(e,r,s,i,n){super(),this._element=e,this._mouseService=r,this._renderService=s,this._bufferService=i,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new cM),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new cM),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(l9(()=>{l7(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(dB(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(dB(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(dB(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(dB(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let r=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!r)return;this._isMouseOut=!1;let s=e.composedPath();for(let e=0;e<s.length;e++){let r=s[e];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}this._lastBufferCell&&r.x===this._lastBufferCell.x&&r.y===this._lastBufferCell.y||(this._handleHover(r),this._lastBufferCell=r)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,r){this._activeProviderReplies&&r||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[i,n]of this._linkProviderService.linkProviders.entries())r?this._activeProviderReplies?.get(i)&&(s=this._checkLinkProviderResult(i,e,s)):n.provideLinks(e.y,r=>{if(this._isMouseOut)return;let n=r?.map(e=>({link:e}));this._activeProviderReplies?.set(i,n),s=this._checkLinkProviderResult(i,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,r){let s=new Set;for(let i=0;i<r.size;i++){let n=r.get(i);if(n)for(let r=0;r<n.length;r++){let i=n[r],o=i.link.range.start.y<e?0:i.link.range.start.x,a=i.link.range.end.y>e?this._bufferService.cols:i.link.range.end.x;for(let e=o;e<=a;e++){if(s.has(e)){n.splice(r--,1);break}s.add(e)}}}}_checkLinkProviderResult(e,r,s){if(!this._activeProviderReplies)return s;let i=this._activeProviderReplies.get(e),n=!1;for(let r=0;r<e;r++)(!this._activeProviderReplies.has(r)||this._activeProviderReplies.get(r))&&(n=!0);if(!n&&i){let e=i.find(e=>this._linkAtPosition(e.link,r));e&&(s=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let e=0;e<this._activeProviderReplies.size;e++){let i=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,r));if(i){s=!0,this._handleNewLink(i);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var r,s;if(!this._currentLink)return;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink&&(r=this._mouseDownLink.link,s=this._currentLink.link,r.text===s.text&&r.range.start.x===s.range.start.x&&r.range.start.y===s.range.start.y&&r.range.end.x===s.range.end.x&&r.range.end.y===s.range.end.y)&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,r){this._currentLink&&this._lastMouseEvent&&(!e||!r||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=r)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,l7(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(e.link,r)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||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:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let r=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,r,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),r.hover&&r.hover(s,r.text)}_fireUnderlineEvent(e,r){let s=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-i-1,s.end.x,s.end.y-i-1,void 0);(r?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,r,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),r.leave&&r.leave(s,r.text)}_linkAtPosition(e,r){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,n=r.y*this._bufferService.cols+r.x;return s<=n&&n<=i}_positionFromMouseEvent(e,r,s){let i=s.getCoords(e,r,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,r,s,i,n){return{x1:e,y1:r,x2:s,y2:i,cols:this._bufferService.cols,fg:n}}};fF=lm([lg(1,lq),lg(2,lV),lg(3,lP),lg(4,lJ)],fF);var fW=class extends fM{constructor(e={}){super(e),this._linkifier=this._register(new cs),this.browser=h0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cs),this._onCursorMove=this._register(new cM),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new cM),this.onKey=this._onKey.event,this._onRender=this._register(new cM),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new cM),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new cM),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new cM),this.onBell=this._onBell.event,this._onFocus=this._register(new cM),this._onBlur=this._register(new cM),this._onA11yCharEmitter=this._register(new cM),this._onA11yTabEmitter=this._register(new cM),this._onWillOpen=this._register(new cM),this._setup(),this._decorationService=this._instantiationService.createInstance(fA),this._instantiationService.setService(lH,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(hG),this._instantiationService.setService(lJ,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(l$)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(cS.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(cS.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(cS.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(cS.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(l9(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let r of e){let e,s="";switch(r.index){case 256:e="foreground",s="10";break;case 257:e="background",s="11";break;case 258:e="cursor",s="12";break;default:e="ansi",s="4;"+r.index}switch(r.type){case 0:let i=u4.toColorRGB("ansi"===e?this._themeService.colors.ansi[r.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${hh.ESC}]${s};${function(e,r=16){let[s,i,n]=e;return`rgb:${fy(s,r)}/${fy(i,r)}/${fy(n,r)}`}(i)}${hf.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[r.index]=hp.toColor(...r.color));else{let s=e;this._themeService.modifyColors(e=>e[s]=hp.toColor(...r.color))}break;case 2:this._themeService.restoreColor(r.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(fz,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(hh.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(hh.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,r=this.buffer.lines.get(e);if(!r)return;let s=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,n=r.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,a=this.buffer.y*this._renderService.dimensions.css.cell.height,l=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(dB(this.element,"copy",e=>{var r;this.hasSelection()&&(r=this._selectionService,e.clipboardData&&e.clipboardData.setData("text/plain",r.selectionText),e.preventDefault())}));let e=e=>{var r,s,i;return r=this.textarea,s=this.coreService,i=this.optionsService,void(e.stopPropagation(),e.clipboardData&&l_(e.clipboardData.getData("text/plain"),r,s,i))};this._register(dB(this.textarea,"paste",e)),this._register(dB(this.element,"paste",e)),h6?this._register(dB(this.element,"mousedown",e=>{2===e.button&&lb(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(dB(this.element,"contextmenu",e=>{lb(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ui&&this._register(dB(this.element,"auxclick",e=>{1===e.button&&ly(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(dB(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(dB(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(dB(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(dB(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(dB(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(dB(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(dB(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let r=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(dB(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",lv),un||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(hY,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(lU,this._coreBrowserService),this._register(dB(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(dB(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(hK,this._document,this._helperContainer),this._instantiationService.setService(lK,this._charSizeService),this._themeService=this._instantiationService.createInstance(uR),this._instantiationService.setService(lG,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(hM),this._instantiationService.setService(lX,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(uh,this.rows,this.screenElement)),this._instantiationService.setService(lV,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(hn,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(hZ),this._instantiationService.setService(lq,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(fF,this.screenElement));this.element.appendChild(r);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(d7,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ub,this.element,this.screenElement,i)),this._instantiationService.setService(lY,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(cS.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(d9,this.screenElement)),this._register(dB(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(fz,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hi,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hi,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(h$,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,r=this.element;function s(r){let s,i,n=e._mouseService.getMouseReportCoords(r,e.screenElement);if(!n)return!1;switch(r.overrideType||r.type){case"mousemove":i=32,void 0===r.buttons?(s=3,void 0!==r.button&&(s=r.button<3?r.button:3)):s=1&r.buttons?0:4&r.buttons?1:2&r.buttons?2:3;break;case"mouseup":i=0,s=r.button<3?r.button:3;break;case"mousedown":i=1,s=r.button<3?r.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(r))return!1;let o=r.deltaY;if(0===o||0===e.coreMouseService.consumeWheelEvent(r,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;i=o<0?0:1,s=4;break;default:return!1}return void 0!==i&&void 0!==s&&!(s>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:s,action:i,ctrl:r.ctrlKey,alt:r.altKey,shift:r.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n=e=>(s(e),e.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(e)),o=e=>(s(e),this.cancel(e,!0)),a=e=>{e.buttons&&s(e)},l=e=>{e.buttons||s(e)};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&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?i.mousemove||(r.addEventListener("mousemove",l),i.mousemove=l):(r.removeEventListener("mousemove",i.mousemove),i.mousemove=null),16&e?i.wheel||(r.addEventListener("wheel",o,{passive:!1}),i.wheel=o):(r.removeEventListener("wheel",i.wheel),i.wheel=null),2&e?i.mouseup||(i.mouseup=n):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),4&e?i.mousedrag||(i.mousedrag=a):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(dB(r,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return s(e),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(e)})),this._register(dB(r,"wheel",r=>{if(!i.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(r))return!1;if(!this.buffer.hasScrollback){if(0===r.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(r,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return this.cancel(r,!0);let s=hh.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(r.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(s,!0),this.cancel(r,!0)}}},{passive:!1}))}refresh(e,r){this._renderService?.refreshRows(e,r)}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,r){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,r),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let r=e-this._bufferService.buffer.ydisp;0!==r&&this.scrollLines(r)}paste(e){l_(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 r=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),r}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,r,s){this._selectionService.setSelection(e,r,s)}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,r){this._selectionService?.selectLines(e,r)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let r=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!r&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;r||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);let s=function(e,r,s,i){let n={type:0,cancel:!1,key:void 0},o=!!e.shiftKey|2*!!e.altKey|4*!!e.ctrlKey|8*!!e.metaKey;switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?r?n.key=hh.ESC+"OA":n.key=hh.ESC+"[A":"UIKeyInputLeftArrow"===e.key?r?n.key=hh.ESC+"OD":n.key=hh.ESC+"[D":"UIKeyInputRightArrow"===e.key?r?n.key=hh.ESC+"OC":n.key=hh.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(r?n.key=hh.ESC+"OB":n.key=hh.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":hh.DEL,e.altKey&&(n.key=hh.ESC+n.key);break;case 9:if(e.shiftKey){n.key=hh.ESC+"[Z";break}n.key=hh.HT,n.cancel=!0;break;case 13:n.key=e.altKey?hh.ESC+hh.CR:hh.CR,n.cancel=!0;break;case 27:n.key=hh.ESC,e.altKey&&(n.key=hh.ESC+hh.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;o?n.key=hh.ESC+"[1;"+(o+1)+"D":r?n.key=hh.ESC+"OD":n.key=hh.ESC+"[D";break;case 39:if(e.metaKey)break;o?n.key=hh.ESC+"[1;"+(o+1)+"C":r?n.key=hh.ESC+"OC":n.key=hh.ESC+"[C";break;case 38:if(e.metaKey)break;o?n.key=hh.ESC+"[1;"+(o+1)+"A":r?n.key=hh.ESC+"OA":n.key=hh.ESC+"[A";break;case 40:if(e.metaKey)break;o?n.key=hh.ESC+"[1;"+(o+1)+"B":r?n.key=hh.ESC+"OB":n.key=hh.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(n.key=hh.ESC+"[2~");break;case 46:o?n.key=hh.ESC+"[3;"+(o+1)+"~":n.key=hh.ESC+"[3~";break;case 36:o?n.key=hh.ESC+"[1;"+(o+1)+"H":r?n.key=hh.ESC+"OH":n.key=hh.ESC+"[H";break;case 35:o?n.key=hh.ESC+"[1;"+(o+1)+"F":r?n.key=hh.ESC+"OF":n.key=hh.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=hh.ESC+"[5;"+(o+1)+"~":n.key=hh.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=hh.ESC+"[6;"+(o+1)+"~":n.key=hh.ESC+"[6~";break;case 112:o?n.key=hh.ESC+"[1;"+(o+1)+"P":n.key=hh.ESC+"OP";break;case 113:o?n.key=hh.ESC+"[1;"+(o+1)+"Q":n.key=hh.ESC+"OQ";break;case 114:o?n.key=hh.ESC+"[1;"+(o+1)+"R":n.key=hh.ESC+"OR";break;case 115:o?n.key=hh.ESC+"[1;"+(o+1)+"S":n.key=hh.ESC+"OS";break;case 116:o?n.key=hh.ESC+"[15;"+(o+1)+"~":n.key=hh.ESC+"[15~";break;case 117:o?n.key=hh.ESC+"[17;"+(o+1)+"~":n.key=hh.ESC+"[17~";break;case 118:o?n.key=hh.ESC+"[18;"+(o+1)+"~":n.key=hh.ESC+"[18~";break;case 119:o?n.key=hh.ESC+"[19;"+(o+1)+"~":n.key=hh.ESC+"[19~";break;case 120:o?n.key=hh.ESC+"[20;"+(o+1)+"~":n.key=hh.ESC+"[20~";break;case 121:o?n.key=hh.ESC+"[21;"+(o+1)+"~":n.key=hh.ESC+"[21~";break;case 122:o?n.key=hh.ESC+"[23;"+(o+1)+"~":n.key=hh.ESC+"[23~";break;case 123:o?n.key=hh.ESC+"[24;"+(o+1)+"~":n.key=hh.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!s||i)&&e.altKey&&!e.metaKey){let r=fD[e.keyCode]?.[+!!e.shiftKey];if(r)n.key=hh.ESC+r;else if(e.keyCode>=65&&e.keyCode<=90){let r=String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32);e.shiftKey&&(r=r.toUpperCase()),n.key=hh.ESC+r}else if(32===e.keyCode)n.key=hh.ESC+(e.ctrlKey?hh.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let r=e.code.slice(3,4);e.shiftKey||(r=r.toLowerCase()),n.key=hh.ESC+r,n.cancel=!0}}else!s||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?!e.key||e.ctrlKey||e.altKey||e.metaKey||!(e.keyCode>=48)||1!==e.key.length?e.key&&e.ctrlKey&&("_"===e.key&&(n.key=hh.US),"@"===e.key&&(n.key=hh.NUL)):n.key=e.key:65===e.keyCode&&(n.type=1);else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key=hh.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key=hh.DEL:219===e.keyCode?n.key=hh.ESC:220===e.keyCode?n.key=hh.FS:221===e.keyCode&&(n.key=hh.GS)}return n}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===s.type||2===s.type){let r=this.rows-1;return this.scrollLines(2===s.type?-r:r),this.cancel(e,!0)}return 1===s.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&90>=e.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((s.key===hh.ETX||s.key===hh.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,r){let s=e.isMac&&!this.options.macOptionIsMeta&&r.altKey&&!r.ctrlKey&&!r.metaKey||e.isWindows&&r.altKey&&r.ctrlKey&&!r.metaKey||e.isWindows&&r.getModifierState("AltGraph");return"keypress"===r.type?s:s&&(!r.keyCode||r.keyCode>47)}_keyUp(e){var r;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(r=e).keyCode||17===r.keyCode||18===r.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let r;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)r=e.charCode;else if(null===e.which||void 0===e.which)r=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;r=e.which}return!!r&&(!e.altKey&&!e.ctrlKey&&!e.metaKey||!!this._isThirdLevelShift(this.browser,e))&&(r=String.fromCharCode(r),this._onKey.fire({key:r,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let r=e.data;return this.coreService.triggerDataEvent(r,!0),this.cancel(e),!0}return!1}resize(e,r){if(e===this.cols&&r===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,r)}_afterResize(e,r){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){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(uA));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(hh.ESC+"[I"):this.coreService.triggerDataEvent(hh.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let r=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${hh.ESC}[4;${s};${r}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${hh.ESC}[6;${n};${i}t`)}}cancel(e,r){if(!(!this.options.cancelEvents&&!r))return e.preventDefault(),e.stopPropagation(),!1}},fH=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,r){let s={instance:r,dispose:r.dispose,isDisposed:!1};this._addons.push(s),r.dispose=()=>this._wrappedAddonDispose(s),r.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let r=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){r=s;break}if(-1===r)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(r,1)}},f$=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,r){if(!(e<0||e>=this._line.length))return r?(this._line.loadCell(e,r),r):this._line.loadCell(e,new lE)}translateToString(e,r,s){return this._line.translateToString(e,r,s)}},fK=class{constructor(e,r){this._buffer=e,this.type=r}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 r=this._buffer.lines.get(e);if(r)return new f$(r)}getNullCell(){return new lE}},fU=class extends cr{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new cM),this.onBufferChange=this._onBufferChange.event,this._normal=new fK(this._core.buffers.normal,"normal"),this._alternate=new fK(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)}},fq=class{constructor(e){this._core=e}registerCsiHandler(e,r){return this._core.registerCsiHandler(e,e=>r(e.toArray()))}addCsiHandler(e,r){return this.registerCsiHandler(e,r)}registerDcsHandler(e,r){return this._core.registerDcsHandler(e,(e,s)=>r(e,s.toArray()))}addDcsHandler(e,r){return this.registerDcsHandler(e,r)}registerEscHandler(e,r){return this._core.registerEscHandler(e,r)}addEscHandler(e,r){return this.registerEscHandler(e,r)}registerOscHandler(e,r){return this._core.registerOscHandler(e,r)}addOscHandler(e,r){return this.registerOscHandler(e,r)}},fV=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}},fY=["cols","rows"],fX=0,fG=class extends cr{constructor(e){super(),this._core=this._register(new fW(e)),this._addonManager=this._register(new fH),this._publicOptions={...this._core.options};let r=e=>this._core.options[e],s=(e,r)=>{this._checkReadonlyOptions(e),this._core.options[e]=r};for(let e in this._core.options){let i={get:r.bind(this,e),set:s.bind(this,e)};Object.defineProperty(this._publicOptions,e,i)}}_checkReadonlyOptions(e){if(fY.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||(this._parser=new fq(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new fV(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._buffer=this._register(new fU(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,r="none";switch(this._core.coreMouseService.activeProtocol){case"X10":r="x10";break;case"VT200":r="vt200";break;case"DRAG":r="drag";break;case"ANY":r="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:r,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let r in e)this._publicOptions[r]=e[r]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,r=!0){this._core.input(e,r)}resize(e,r){this._verifyIntegers(e,r),this._core.resize(e,r)}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,r,s){this._verifyIntegers(e,r,s),this._core.select(e,r,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,r){this._verifyIntegers(e,r),this._core.selectLines(e,r)}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,r){this._core.write(e,r)}writeln(e,r){this._core.write(e),this._core.write(`\r
|
|
22
|
-
`,r)}paste(e){this._core.paste(e)}refresh(e,r){this._verifyIntegers(e,r),this._core.refresh(e,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return lv},set promptLabel(t){lv=t},get tooMuchOutput(){return lx},set tooMuchOutput(t){lx=t}}}_verifyIntegers(...e){for(fX of e)if(fX===1/0||isNaN(fX)||fX%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(fX of e)if(fX&&(fX===1/0||isNaN(fX)||fX%1!=0||fX<0))throw Error("This API only accepts positive integers")}},fJ=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let r=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},l=a.top+a.bottom;return{cols:Math.max(2,Math.floor((n-(a.right+a.left)-r)/e.css.cell.width)),rows:Math.max(1,Math.floor((i-l)/e.css.cell.height))}}},fZ=class{constructor(e,r,s,i={}){this._terminal=e,this._regex=r,this._handler=s,this._options=i}provideLinks(e,r){let s=fQ.computeLink(e,this._regex,this._terminal,this._handler);r(this._addCallbacks(s))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(r,s)=>{if(this._options.hover){let{range:i}=e;this._options.hover(r,s,i)}},e))}},fQ=class e{static computeLink(r,s,i,n){let o=RegExp(s.source,(s.flags||"")+"g"),[a,l]=e._getWindowedLineStrings(r-1,i),c=a.join(""),d,h=[];for(;d=o.exec(c);){let r=d[0];if(!function(e){try{let r=new URL(e),s=r.password&&r.username?`${r.protocol}//${r.username}:${r.password}@${r.host}`:r.username?`${r.protocol}//${r.username}@${r.host}`:`${r.protocol}//${r.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}(r))continue;let[s,o]=e._mapStrIdx(i,l,0,d.index),[a,c]=e._mapStrIdx(i,s,o,r.length);if(-1===s||-1===o||-1===a||-1===c)continue;let u={start:{x:o+1,y:s+1},end:{x:c,y:a+1}};h.push({range:u,text:r,activate:n})}return h}static _getWindowedLineStrings(e,r){let s,i=e,n=e,o=0,a="",l=[];if(s=r.buffer.active.getLine(e)){let e=s.translateToString(!0);if(s.isWrapped&&" "!==e[0]){for(o=0;(s=r.buffer.active.getLine(--i))&&o<2048&&(o+=(a=s.translateToString(!0)).length,l.push(a),!(!s.isWrapped||-1!==a.indexOf(" "))););l.reverse()}for(l.push(e),o=0;(s=r.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(o+=(a=s.translateToString(!0)).length,l.push(a),-1===a.indexOf(" ")););}return[l,i]}static _mapStrIdx(e,r,s,i){let n=e.buffer.active,o=n.getNullCell(),a=s;for(;i;){let e=n.getLine(r);if(!e)return[-1,-1];for(let s=a;s<e.length;++s){e.getCell(s,o);let a=o.getChars();if(o.getWidth()&&(i-=a.length||1,s===e.length-1&&""===a)){let e=n.getLine(r+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(i+=1))}if(i<0)return[r,s]}r++,a=0}return[r,a]}},f0=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f1(e,r){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=r}else console.warn("Opening link blocked as opener could not be cleared")}var f2=class{constructor(e=f1,r={}){this._handler=e,this._options=r}activate(e){this._terminal=e;let r=this._options,s=r.urlRegex||f0;this._linkProvider=this._terminal.registerLinkProvider(new fZ(this._terminal,s,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function f5({logs:e,isPty:r,className:s,onInput:i,onResize:n}){let o=(0,W.useRef)(null),a=(0,W.useRef)(null),l=(0,W.useRef)(null),c=(0,W.useRef)(0);return(0,W.useEffect)(()=>{if(!o.current||a.current)return;let e=new fG({cursorBlink:r,cursorStyle:r?"block":"underline",disableStdin:!r,convertEol:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{background:"#09090b",foreground:"#fafafa",cursor:r?"#fafafa":"#09090b",cursorAccent:"#09090b",selectionBackground:"#3f3f46",black:"#09090b",red:"#f87171",green:"#4ade80",yellow:"#facc15",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#fafafa",brightBlack:"#71717a",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#ffffff"},allowProposedApi:!0}),s=new fJ,d=new f2;return e.loadAddon(s),e.loadAddon(d),e.open(o.current),setTimeout(()=>{try{s.fit(),r&&n?.(e.cols,e.rows)}catch{}},0),a.current=e,l.current=s,r&&i&&e.onData(e=>{i(e)}),r&&n&&e.onResize(({cols:e,rows:r})=>{n(e,r)}),()=>{e.dispose(),a.current=null,l.current=null,c.current=0}},[r,i,n]),(0,W.useEffect)(()=>{if(a.current){e.length<c.current&&(a.current.reset(),c.current=0);for(let r=c.current;r<e.length;r++){let s=e[r];"pty"===s.type?a.current.write(s.data):("stdout"===s.type||"stderr"===s.type)&&a.current.write(s.data)}c.current=e.length}},[e]),(0,W.useEffect)(()=>{if(!o.current||!l.current)return;let e=new ResizeObserver(()=>{try{l.current?.fit()}catch{}});return e.observe(o.current),()=>{e.disconnect()}},[]),(0,F.jsx)("div",{ref:o,className:(0,iu.cn)("h-[300px] rounded-md border bg-zinc-950 overflow-hidden",s)})}let f3=(0,ic.default)("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"}]]),f4=[{name:"Dev Server",command:"pnpm dev",executor_type:"command",pty:!0,description:"Start the development server with hot reload"},{name:"Build",command:"pnpm build",executor_type:"command",pty:!0,description:"Build the project for production"},{name:"Lint",command:"pnpm lint",executor_type:"command",pty:!0,description:"Run the linter to check code quality"},{name:"Type Check",command:"npx tsc --noEmit",executor_type:"command",pty:!0,description:"Run TypeScript type checking without emitting files"},{name:"Test",command:"pnpm test",executor_type:"command",pty:!0,description:"Run the test suite"},{name:"Rebase on and merge into main",command:"Our goal is to sync the current local branch with the local branch/worktree `main`. The two branches may have diverged.\n\nPlease do the following in order. Only proceed to the next step if the previous step succeeds:\n\n1. Rebase the current local branch onto the local branch `main`, and resolve any conflicts if needed.\n2. If, after the rebase, `main` does not yet contain the current branch's commits, switch to the `main` branch/worktree and merge the current branch into `main` using `git merge`. Do not use `git branch -f`.\n3. If the current branch is already fully contained in `main`, and `main` has newer commits, update the current branch so it includes the latest commits from `main`.\n4. Push both the current local branch and the local branch `main` to the remote.",executor_type:"prompt",pty:!1,description:"Rebase current branch onto main, merge into main, and push both branches"},{name:"Reset to main",command:"git reset --hard main",executor_type:"command",pty:!0,description:"Hard reset the current branch to match main"},{name:"Push to remote",command:"git push --force-with-lease",executor_type:"command",pty:!0,description:"Force push to remote with lease safety check"},{name:"Git commit",command:"Inspect the modified and untracked and deleted files in the current repository, generate an appropriate commit message, and commit all relevant files.\n\nCommit message rules:\n- Use Conventional Commits format (feat:, fix:, chore:, refactor:, docs:, test:, ci:, build:, perf:, style:, etc.)\n- Choose the type that best matches the main purpose of the changes\n- Make the message specific to the actual changes\n- Keep it within 50 characters if possible\n- Use lowercase\n- Do not end with a period\n- Do not wrap the message in quotes, backticks, or markdown\n\nCommit requirements:\n- Include all relevant modified and untracked files\n- Do not include unrelated files\n- If there are no meaningful changes to commit, do not create a commit\n\nWhen finished, output only the final commit message.",executor_type:"prompt",pty:!1,description:"Inspect changes, generate a conventional commit message, and commit"}];function f6({open:e,onOpenChange:r,executor:s,onSubmit:i}){let[n,o]=(0,W.useState)(s?.name??""),[a,l]=(0,W.useState)(s?.executor_type??"command"),[c,d]=(0,W.useState)(s?.prompt_provider??"claude"),[h,u]=(0,W.useState)(s?.command??""),[f,p]=(0,W.useState)(s?.cwd??""),[m,g]=(0,W.useState)(s?.pty??!0),[v,x]=(0,W.useState)(!1),[_,y]=(0,W.useState)(!1),[b,w]=(0,W.useState)(null),[S,C]=(0,W.useState)(null),[k,j]=(0,W.useState)(""),N=!!s;(0,W.useEffect)(()=>{e&&(y(!1),w(null),C(null),j(""),s&&(o(s.name),l(s.executor_type??"command"),d(s.prompt_provider??"claude"),u(s.command),p(s.cwd??""),g(s.pty)))},[e]);let E=async e=>{if(e.preventDefault(),n.trim()&&h.trim()){x(!0);try{await i({name:n.trim(),command:h.trim(),executor_type:a,prompt_provider:"prompt"===a?c:null,cwd:f.trim()||void 0,pty:"prompt"===a||m}),r(!1),N||(o(""),l("command"),d("claude"),u(""),p(""),g(!0))}finally{x(!1)}}};return(0,F.jsx)(ne,{open:e,onOpenChange:r,children:(0,F.jsxs)(ns,{children:[(0,F.jsx)(ni,{children:(0,F.jsxs)("div",{className:"flex items-center justify-between pr-6",children:[(0,F.jsx)(no,{children:_?"Select Preset":N?"Edit Executor":"Add Executor"}),!N&&!_&&(0,F.jsx)("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",onClick:()=>y(!0),children:"Select from presets"})]})}),(0,F.jsxs)("div",{className:"h-[420px] flex flex-col",children:[!_&&(0,F.jsxs)("form",{onSubmit:E,className:"space-y-4 flex-1 flex flex-col",children:[(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Name"}),(0,F.jsx)(nM,{placeholder:"e.g., Dev Server",value:n,onChange:e=>o(e.target.value),required:!0})]}),(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Type"}),(0,F.jsxs)("div",{className:"flex rounded-md border border-input overflow-hidden",children:[(0,F.jsx)("button",{type:"button",className:(0,iu.cn)("flex-1 px-3 py-1.5 text-sm font-medium transition-colors","command"===a?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:bg-muted"),onClick:()=>l("command"),children:"Command"}),(0,F.jsx)("button",{type:"button",className:(0,iu.cn)("flex-1 px-3 py-1.5 text-sm font-medium transition-colors border-l border-input","prompt"===a?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:bg-muted"),onClick:()=>l("prompt"),children:"Prompt"})]})]}),"prompt"===a&&(0,F.jsxs)("div",{className:"flex gap-3",children:[(0,F.jsxs)("div",{className:"w-[140px] shrink-0 space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Provider"}),(0,F.jsxs)(aP,{value:c,onValueChange:e=>d(e),children:[(0,F.jsx)(aB,{className:"w-full",children:(0,F.jsx)(aL,{})}),(0,F.jsxs)(aA,{children:[(0,F.jsx)(aO,{value:"claude",children:"Claude"}),(0,F.jsx)(aO,{value:"codex",children:"Codex"})]})]})]}),(0,F.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,F.jsxs)("label",{className:"text-sm font-medium",children:["Working Directory"," ",(0,F.jsx)("span",{className:"text-muted-foreground",children:"(optional)"})]}),(0,F.jsx)(nM,{placeholder:"Relative to worktree root",value:f,onChange:e=>p(e.target.value)})]})]}),(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"prompt"===a?"Prompt":"Command"}),"prompt"===a?(0,F.jsx)("textarea",{className:"flex min-h-[90px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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 resize-y",placeholder:"e.g., Review the code and suggest improvements",value:h,onChange:e=>u(e.target.value),required:!0}):(0,F.jsx)(nM,{placeholder:"e.g., npm run dev",value:h,onChange:e=>u(e.target.value),required:!0})]}),"command"===a&&(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsxs)("label",{className:"text-sm font-medium",children:["Working Directory"," ",(0,F.jsx)("span",{className:"text-muted-foreground",children:"(optional)"})]}),(0,F.jsx)(nM,{placeholder:"Relative to worktree root (leave empty for root)",value:f,onChange:e=>p(e.target.value)})]}),"command"===a&&(0,F.jsxs)("div",{className:"flex items-center justify-between",children:[(0,F.jsxs)("div",{className:"space-y-0.5",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Terminal Mode (PTY)"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enable for interactive commands like top, vim, htop"})]}),(0,F.jsx)("button",{type:"button",role:"switch","aria-checked":m,onClick:()=>g(!m),className:(0,iu.cn)("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",m?"bg-primary":"bg-input"),children:(0,F.jsx)("span",{className:(0,iu.cn)("pointer-events-none inline-block h-5 w-5 transform rounded-full bg-background shadow-lg ring-0 transition-transform",m?"translate-x-5":"translate-x-0")})})]}),(0,F.jsx)("div",{className:"flex-1"}),(0,F.jsxs)(nn,{children:[(0,F.jsx)($.Button,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),(0,F.jsx)($.Button,{type:"submit",disabled:v||!n.trim()||!h.trim(),children:v?"Saving...":N?"Save":"Add"})]})]}),_&&(0,F.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col min-h-0",children:[(0,F.jsx)(nM,{placeholder:"Search presets...",value:k,onChange:e=>j(e.target.value),autoFocus:!0}),(0,F.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-1",children:f4.filter(e=>{if(!k.trim())return!0;let r=k.toLowerCase();return e.name.toLowerCase().includes(r)||e.command.toLowerCase().includes(r)||(e.description?.toLowerCase().includes(r)??!1)}).map(e=>{let r=b?.command===e.command,s=S===e.command;return(0,F.jsxs)("div",{className:"rounded-md overflow-hidden",children:[(0,F.jsxs)("button",{type:"button",className:(0,iu.cn)("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"bg-primary/10 text-primary":"hover:bg-muted"),onClick:()=>w(e),children:["command"===e.executor_type?(0,F.jsx)(nB.Terminal,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):(0,F.jsx)(f3,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,F.jsx)("span",{className:"font-medium flex-1 text-left",children:e.name}),(0,F.jsx)("button",{type:"button",className:"shrink-0 p-0.5 rounded hover:bg-muted-foreground/10 transition-colors",onClick:r=>{r.stopPropagation(),C(s?null:e.command)},children:s?(0,F.jsx)(aT,{className:"h-4 w-4 text-muted-foreground"}):(0,F.jsx)(id,{className:"h-4 w-4 text-muted-foreground"})})]}),s&&(0,F.jsxs)("div",{className:(0,iu.cn)("px-3 pb-2 pt-1 text-xs text-muted-foreground space-y-1 border-t border-border/50",r?"bg-primary/5":"bg-muted/50"),children:[e.description&&(0,F.jsx)("p",{children:e.description}),(0,F.jsx)("pre",{className:"whitespace-pre-wrap break-all bg-muted/50 rounded px-2 py-1 font-mono",children:e.command}),(0,F.jsxs)("div",{className:"flex gap-3",children:[(0,F.jsxs)("span",{children:["Type: ",(0,F.jsx)("span",{className:"font-medium text-foreground/70",children:e.executor_type})]}),(0,F.jsxs)("span",{children:["PTY: ",(0,F.jsx)("span",{className:"font-medium text-foreground/70",children:e.pty?"on":"off"})]})]})]})]},e.command)})}),(0,F.jsxs)(nn,{children:[(0,F.jsx)($.Button,{type:"button",variant:"outline",onClick:()=>{y(!1),w(null),C(null)},children:"Cancel"}),(0,F.jsx)($.Button,{type:"button",disabled:!b,onClick:()=>{b&&(o(b.name),u(b.command),l(b.executor_type),g(b.pty),y(!1),w(null),C(null))},children:"Select"})]})]})]})]})})}function f8(e,r){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)("closed"),[a,l]=(0,W.useState)(null),[c,d]=(0,W.useState)(!1),h=(0,W.useRef)(null),u=(0,W.useRef)(null),f=(0,W.useRef)(0),p=(0,W.useRef)(null),m=(0,W.useRef)(!1),g=(0,W.useCallback)(()=>{i([]),l(null),d(!1)},[]),v=(0,W.useCallback)(e=>{h.current?.readyState===WebSocket.OPEN&&h.current.send(JSON.stringify({type:"input",data:e}))},[]),x=(0,W.useCallback)((e,r)=>{h.current?.readyState===WebSocket.OPEN?h.current.send(JSON.stringify({type:"resize",cols:e,rows:r})):u.current={cols:e,rows:r}},[]);return(0,W.useEffect)(()=>{if(!e)return;i([]),l(null),d(!1),m.current=!1,f.current=0;let r=!1;return!function s(){if(r||m.current)return;o("connecting");let n=(0,iR.getWebSocketUrl)(`/api/executor-processes/${e}/logs`);console.log(`[useExecutorLogs] Connecting to WebSocket: ${n}`);let a=new WebSocket(n);h.current=a,a.onopen=()=>{if(!r&&(console.log("[useExecutorLogs] WebSocket connected"),o("connected"),i([]),f.current=0,u.current)){let{cols:e,rows:r}=u.current;a.send(JSON.stringify({type:"resize",cols:e,rows:r})),u.current=null}},a.onmessage=e=>{if(!r)try{let r=JSON.parse(e.data);"init"===r.type?d(r.isPty):"finished"===r.type?(m.current=!0,l(r.exitCode),o("closed")):"error"===r.type?o("error"):i(e=>[...e,r])}catch(e){console.error("Failed to parse WebSocket message:",e)}},a.onerror=e=>{r||console.error("[useExecutorLogs] WebSocket error:",e)},a.onclose=i=>{if(console.log("[useExecutorLogs] WebSocket closed:",i.code,i.reason),h.current=null,m.current||r||!e?.startsWith("remote-"))return void o("closed");if(f.current<8){let e=f.current,i=Math.min(15e3,1e3*Math.pow(2,e)),n=i*Math.random()*.25,a=i+n;console.log(`[useExecutorLogs] Scheduling reconnect in ${Math.round(a)}ms (attempt ${e+1}/8)`),o("connecting"),f.current=e+1,p.current=setTimeout(()=>{p.current=null,r||s()},a)}else console.log("[useExecutorLogs] Max reconnect attempts reached"),o("error")}}(),()=>{r=!0,p.current&&(clearTimeout(p.current),p.current=null),h.current&&(h.current.close(),h.current=null)}},[e,r]),{logs:s,status:n,exitCode:a,isPty:c,clearLogs:g,sendInput:v,sendResize:x}}let f7="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function f9(e){let r=Object.prototype.toString.call(e);return"[object Window]"===r||"[object global]"===r}function pe(e){return"nodeType"in e}function pt(e){var r,s;return e?f9(e)?e:pe(e)&&null!=(r=null==(s=e.ownerDocument)?void 0:s.defaultView)?r:window:window}function pr(e){let{Document:r}=pt(e);return e instanceof r}function ps(e){return!f9(e)&&e instanceof pt(e).HTMLElement}function pi(e){return e instanceof pt(e).SVGElement}function pn(e){return e?f9(e)?e.document:pe(e)?pr(e)?e:ps(e)||pi(e)?e.ownerDocument:document:document:document}let po=f7?W.useLayoutEffect:W.useEffect;function pa(e){let r=(0,W.useRef)(e);return po(()=>{r.current=e}),(0,W.useCallback)(function(){for(var e=arguments.length,s=Array(e),i=0;i<e;i++)s[i]=arguments[i];return null==r.current?void 0:r.current(...s)},[])}function pl(e,r){void 0===r&&(r=[e]);let s=(0,W.useRef)(e);return po(()=>{s.current!==e&&(s.current=e)},r),s}function pc(e,r){let s=(0,W.useRef)();return(0,W.useMemo)(()=>{let r=e(s.current);return s.current=r,r},[...r])}function pd(e){let r=pa(e),s=(0,W.useRef)(null),i=(0,W.useCallback)(e=>{e!==s.current&&(null==r||r(e,s.current)),s.current=e},[]);return[s,i]}function ph(e){let r=(0,W.useRef)();return(0,W.useEffect)(()=>{r.current=e},[e]),r.current}let pu={};function pf(e,r){return(0,W.useMemo)(()=>{if(r)return r;let s=null==pu[e]?0:pu[e]+1;return pu[e]=s,e+"-"+s},[e,r])}function pp(e){return function(r){for(var s=arguments.length,i=Array(s>1?s-1:0),n=1;n<s;n++)i[n-1]=arguments[n];return i.reduce((r,s)=>{for(let[i,n]of Object.entries(s)){let s=r[i];null!=s&&(r[i]=s+e*n)}return r},{...r})}}let pm=pp(1),pg=pp(-1);function pv(e){if(!e)return!1;let{KeyboardEvent:r}=pt(e.target);return r&&e instanceof r}function px(e){if(function(e){if(!e)return!1;let{TouchEvent:r}=pt(e.target);return r&&e instanceof r}(e)){if(e.touches&&e.touches.length){let{clientX:r,clientY:s}=e.touches[0];return{x:r,y:s}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:r,clientY:s}=e.changedTouches[0];return{x:r,y:s}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let p_=Object.freeze({Translate:{toString(e){if(!e)return;let{x:r,y:s}=e;return"translate3d("+(r?Math.round(r):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:r,scaleY:s}=e;return"scaleX("+r+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[p_.Translate.toString(e),p_.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:r,duration:s,easing:i}=e;return r+" "+s+"ms "+i}}}),py="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]",pb={display:"none"};function pw(e){let{id:r,value:s}=e;return W.default.createElement("div",{id:r,style:pb},s)}function pS(e){let{id:r,announcement:s,ariaLiveType:i="assertive"}=e;return W.default.createElement("div",{id:r,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":i,"aria-atomic":!0},s)}let pC=(0,W.createContext)(null),pk={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},pj={onDragStart(e){let{active:r}=e;return"Picked up draggable item "+r.id+"."},onDragOver(e){let{active:r,over:s}=e;return s?"Draggable item "+r.id+" was moved over droppable area "+s.id+".":"Draggable item "+r.id+" is no longer over a droppable area."},onDragEnd(e){let{active:r,over:s}=e;return s?"Draggable item "+r.id+" was dropped over droppable area "+s.id:"Draggable item "+r.id+" was dropped."},onDragCancel(e){let{active:r}=e;return"Dragging was cancelled. Draggable item "+r.id+" was dropped."}};function pN(e){var r;let s,{announcements:i=pj,container:n,hiddenTextDescribedById:o,screenReaderInstructions:a=pk}=e,{announce:l,announcement:c}=function(){let[e,r]=(0,W.useState)("");return{announce:(0,W.useCallback)(e=>{null!=e&&r(e)},[]),announcement:e}}(),d=pf("DndLiveRegion"),[h,u]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{u(!0)},[]),r=(0,W.useMemo)(()=>({onDragStart(e){let{active:r}=e;l(i.onDragStart({active:r}))},onDragMove(e){let{active:r,over:s}=e;i.onDragMove&&l(i.onDragMove({active:r,over:s}))},onDragOver(e){let{active:r,over:s}=e;l(i.onDragOver({active:r,over:s}))},onDragEnd(e){let{active:r,over:s}=e;l(i.onDragEnd({active:r,over:s}))},onDragCancel(e){let{active:r,over:s}=e;l(i.onDragCancel({active:r,over:s}))}}),[l,i]),s=(0,W.useContext)(pC),(0,W.useEffect)(()=>{if(!s)throw Error("useDndMonitor must be used within a children of <DndContext>");return s(r)},[r,s]),!h)return null;let f=W.default.createElement(W.default.Fragment,null,W.default.createElement(pw,{id:o,value:a.draggable}),W.default.createElement(pS,{id:d,announcement:c}));return n?(0,G.createPortal)(f,n):f}function pE(){}function pR(e,r){return(0,W.useMemo)(()=>({sensor:e,options:null!=r?r:{}}),[e,r])}(_=E||(E={})).DragStart="dragStart",_.DragMove="dragMove",_.DragEnd="dragEnd",_.DragCancel="dragCancel",_.DragOver="dragOver",_.RegisterDroppable="registerDroppable",_.SetDroppableDisabled="setDroppableDisabled",_.UnregisterDroppable="unregisterDroppable";let pM=Object.freeze({x:0,y:0});function pD(e,r){return Math.sqrt(Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2))}function pT(e,r){let{data:{value:s}}=e,{data:{value:i}}=r;return s-i}function pP(e,r){let{data:{value:s}}=e,{data:{value:i}}=r;return i-s}function pL(e){let{left:r,top:s,height:i,width:n}=e;return[{x:r,y:s},{x:r+n,y:s},{x:r,y:s+i},{x:r+n,y:s+i}]}function pB(e,r){if(!e||0===e.length)return null;let[s]=e;return r?s[r]:s}function pA(e,r,s){return void 0===r&&(r=e.left),void 0===s&&(s=e.top),{x:r+.5*e.width,y:s+.5*e.height}}let pO=e=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=e,n=[];for(let e of i){let{id:i}=e,o=s.get(i);if(o){let s=function(e,r){let s=Math.max(r.top,e.top),i=Math.max(r.left,e.left),n=Math.min(r.left+r.width,e.left+e.width),o=Math.min(r.top+r.height,e.top+e.height);if(i<n&&s<o){let a=r.width*r.height,l=e.width*e.height,c=(n-i)*(o-s);return Number((c/(a+l-c)).toFixed(4))}return 0}(o,r);s>0&&n.push({id:i,data:{droppableContainer:e,value:s}})}}return n.sort(pP)};function pI(e,r){return e&&r?{x:e.left-r.left,y:e.top-r.top}:pM}let pz=function(e){for(var r=arguments.length,s=Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((e,r)=>({...e,top:e.top+ +r.y,bottom:e.bottom+ +r.y,left:e.left+ +r.x,right:e.right+ +r.x}),{...e})},pF={ignoreTransform:!1};function pW(e,r){void 0===r&&(r=pF);let s=e.getBoundingClientRect();if(r.ignoreTransform){let{transform:r,transformOrigin:i}=pt(e).getComputedStyle(e);r&&(s=function(e,r,s){let i=function(e){if(e.startsWith("matrix3d(")){let r=e.slice(9,-1).split(/, /);return{x:+r[12],y:+r[13],scaleX:+r[0],scaleY:+r[5]}}if(e.startsWith("matrix(")){let r=e.slice(7,-1).split(/, /);return{x:+r[4],y:+r[5],scaleX:+r[0],scaleY:+r[3]}}return null}(r);if(!i)return e;let{scaleX:n,scaleY:o,x:a,y:l}=i,c=e.left-a-(1-n)*parseFloat(s),d=e.top-l-(1-o)*parseFloat(s.slice(s.indexOf(" ")+1)),h=n?e.width/n:e.width,u=o?e.height/o:e.height;return{width:h,height:u,top:d,right:c+h,bottom:d+u,left:c}}(s,r,i))}let{top:i,left:n,width:o,height:a,bottom:l,right:c}=s;return{top:i,left:n,width:o,height:a,bottom:l,right:c}}function pH(e){return pW(e,{ignoreTransform:!0})}function p$(e,r){let s=[];return e?function i(n){var o,a;let l;if(null!=r&&s.length>=r||!n)return s;if(pr(n)&&null!=n.scrollingElement&&!s.includes(n.scrollingElement))return s.push(n.scrollingElement),s;if(!ps(n)||pi(n)||s.includes(n))return s;let c=pt(e).getComputedStyle(n);return(n!==e&&(void 0===(o=c)&&(o=pt(n).getComputedStyle(n)),l=/(auto|scroll|overlay)/,["overflow","overflowX","overflowY"].some(e=>{let r=o[e];return"string"==typeof r&&l.test(r)}))&&s.push(n),void 0===(a=c)&&(a=pt(n).getComputedStyle(n)),"fixed"===a.position)?s:i(n.parentNode)}(e):s}function pK(e){let[r]=p$(e,1);return null!=r?r:null}function pU(e){return f7&&e?f9(e)?e:pe(e)?pr(e)||e===pn(e).scrollingElement?window:ps(e)?e:null:null:null}function pq(e){return f9(e)?e.scrollX:e.scrollLeft}function pV(e){return f9(e)?e.scrollY:e.scrollTop}function pY(e){return{x:pq(e),y:pV(e)}}function pX(e){return!!f7&&!!e&&e===document.scrollingElement}function pG(e){let r={x:0,y:0},s=pX(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},i={x:e.scrollWidth-s.width,y:e.scrollHeight-s.height},n=e.scrollTop<=r.y,o=e.scrollLeft<=r.x;return{isTop:n,isLeft:o,isBottom:e.scrollTop>=i.y,isRight:e.scrollLeft>=i.x,maxScroll:i,minScroll:r}}(y=R||(R={}))[y.Forward=1]="Forward",y[y.Backward=-1]="Backward";let pJ={x:.2,y:.2};function pZ(e){return e.reduce((e,r)=>pm(e,pY(r)),pM)}let pQ=[["x",["left","right"],function(e){return e.reduce((e,r)=>e+pq(r),0)}],["y",["top","bottom"],function(e){return e.reduce((e,r)=>e+pV(r),0)}]];class p0{constructor(e,r){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;const s=p$(r),i=pZ(s);for(const[r,n,o]of(this.rect={...e},this.width=e.width,this.height=e.height,pQ))for(const e of n)Object.defineProperty(this,e,{get:()=>{let n=o(s),a=i[r]-n;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class p1{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var r;return null==(r=this.target)?void 0:r.removeEventListener(...e)})},this.target=e}add(e,r,s){var i;null==(i=this.target)||i.addEventListener(e,r,s),this.listeners.push([e,r,s])}}function p2(e,r){let s=Math.abs(e.x),i=Math.abs(e.y);return"number"==typeof r?Math.sqrt(s**2+i**2)>r:"x"in r&&"y"in r?s>r.x&&i>r.y:"x"in r?s>r.x:"y"in r&&i>r.y}function p5(e){e.preventDefault()}function p3(e){e.stopPropagation()}(b=M||(M={})).Click="click",b.DragStart="dragstart",b.Keydown="keydown",b.ContextMenu="contextmenu",b.Resize="resize",b.SelectionChange="selectionchange",b.VisibilityChange="visibilitychange",(w=D||(D={})).Space="Space",w.Down="ArrowDown",w.Right="ArrowRight",w.Left="ArrowLeft",w.Up="ArrowUp",w.Esc="Escape",w.Enter="Enter",w.Tab="Tab";let p4={start:[D.Space,D.Enter],cancel:[D.Esc],end:[D.Space,D.Enter,D.Tab]},p6=(e,r)=>{let{currentCoordinates:s}=r;switch(e.code){case D.Right:return{...s,x:s.x+25};case D.Left:return{...s,x:s.x-25};case D.Down:return{...s,y:s.y+25};case D.Up:return{...s,y:s.y-25}}};class p8{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:r}}=e;this.props=e,this.listeners=new p1(pn(r)),this.windowListeners=new p1(pt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(M.Resize,this.handleCancel),this.windowListeners.add(M.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(M.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,s=e.node.current;s&&function(e,r){if(void 0===r&&(r=pW),!e)return;let{top:s,left:i,bottom:n,right:o}=r(e);pK(e)&&(n<=0||o<=0||s>=window.innerHeight||i>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(s),r(pM)}handleKeyDown(e){if(pv(e)){let{active:r,context:s,options:i}=this.props,{keyboardCodes:n=p4,coordinateGetter:o=p6,scrollBehavior:a="smooth"}=i,{code:l}=e;if(n.end.includes(l))return void this.handleEnd(e);if(n.cancel.includes(l))return void this.handleCancel(e);let{collisionRect:c}=s.current,d=c?{x:c.left,y:c.top}:pM;this.referenceCoordinates||(this.referenceCoordinates=d);let h=o(e,{active:r,context:s.current,currentCoordinates:d});if(h){let r=pg(h,d),i={x:0,y:0},{scrollableAncestors:n}=s.current;for(let s of n){let n=e.code,{isTop:o,isRight:l,isLeft:c,isBottom:d,maxScroll:u,minScroll:f}=pG(s),p=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:r}=window;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}let{top:r,left:s,right:i,bottom:n}=e.getBoundingClientRect();return{top:r,left:s,right:i,bottom:n,width:e.clientWidth,height:e.clientHeight}}(s),m={x:Math.min(n===D.Right?p.right-p.width/2:p.right,Math.max(n===D.Right?p.left:p.left+p.width/2,h.x)),y:Math.min(n===D.Down?p.bottom-p.height/2:p.bottom,Math.max(n===D.Down?p.top:p.top+p.height/2,h.y))},g=n===D.Right&&!l||n===D.Left&&!c,v=n===D.Down&&!d||n===D.Up&&!o;if(g&&m.x!==h.x){let e=s.scrollLeft+r.x,o=n===D.Right&&e<=u.x||n===D.Left&&e>=f.x;if(o&&!r.y)return void s.scrollTo({left:e,behavior:a});o?i.x=s.scrollLeft-e:i.x=n===D.Right?s.scrollLeft-u.x:s.scrollLeft-f.x,i.x&&s.scrollBy({left:-i.x,behavior:a});break}if(v&&m.y!==h.y){let e=s.scrollTop+r.y,o=n===D.Down&&e<=u.y||n===D.Up&&e>=f.y;if(o&&!r.x)return void s.scrollTo({top:e,behavior:a});o?i.y=s.scrollTop-e:i.y=n===D.Down?s.scrollTop-u.y:s.scrollTop-f.y,i.y&&s.scrollBy({top:-i.y,behavior:a});break}}this.handleMove(e,pm(pg(h,this.referenceCoordinates),i))}}}handleMove(e,r){let{onMove:s}=this.props;e.preventDefault(),s(r)}handleEnd(e){let{onEnd:r}=this.props;e.preventDefault(),this.detach(),r()}handleCancel(e){let{onCancel:r}=this.props;e.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function p7(e){return!!(e&&"distance"in e)}function p9(e){return!!(e&&"delay"in e)}p8.activators=[{eventName:"onKeyDown",handler:(e,r,s)=>{let{keyboardCodes:i=p4,onActivation:n}=r,{active:o}=s,{code:a}=e.nativeEvent;if(i.start.includes(a)){let r=o.activatorNode.current;return(!r||e.target===r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}return!1}}];class me{constructor(e,r,s){var i;void 0===s&&(s=function(e){let{EventTarget:r}=pt(e);return e instanceof r?e:pn(e)}(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=r;const{event:n}=e,{target:o}=n;this.props=e,this.events=r,this.document=pn(o),this.documentListeners=new p1(this.document),this.listeners=new p1(s),this.windowListeners=new p1(pt(o)),this.initialCoordinates=null!=(i=px(n))?i:pM,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:r,bypassActivationConstraint:s}}}=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(M.Resize,this.handleCancel),this.windowListeners.add(M.DragStart,p5),this.windowListeners.add(M.VisibilityChange,this.handleCancel),this.windowListeners.add(M.ContextMenu,p5),this.documentListeners.add(M.Keydown,this.handleKeydown),r){if(null!=s&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(p9(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(p7(r))return void this.handlePending(r)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,r){let{active:s,onPending:i}=this.props;i(s,e,this.initialCoordinates,r)}handleStart(){let{initialCoordinates:e}=this,{onStart:r}=this.props;e&&(this.activated=!0,this.documentListeners.add(M.Click,p3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(M.SelectionChange,this.removeTextSelection),r(e))}handleMove(e){var r;let{activated:s,initialCoordinates:i,props:n}=this,{onMove:o,options:{activationConstraint:a}}=n;if(!i)return;let l=null!=(r=px(e))?r:pM,c=pg(i,l);if(!s&&a){if(p7(a)){if(null!=a.tolerance&&p2(c,a.tolerance))return this.handleCancel();if(p2(c,a.distance))return this.handleStart()}return p9(a)&&p2(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){let{onAbort:e,onEnd:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleCancel(){let{onAbort:e,onCancel:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleKeydown(e){e.code===D.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let mt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class mr extends me{constructor(e){const{event:r}=e;super(e,mt,pn(r.target))}}mr.activators=[{eventName:"onPointerDown",handler:(e,r)=>{let{nativeEvent:s}=e,{onActivation:i}=r;return!!s.isPrimary&&0===s.button&&(null==i||i({event:s}),!0)}}];(S=T||(T={}))[S.RightClick=2]="RightClick";(C=P||(P={}))[C.Pointer=0]="Pointer",C[C.DraggableRect=1]="DraggableRect",(k=L||(L={}))[k.TreeOrder=0]="TreeOrder",k[k.ReversedTreeOrder=1]="ReversedTreeOrder";let ms={x:{[R.Backward]:!1,[R.Forward]:!1},y:{[R.Backward]:!1,[R.Forward]:!1}};(j=B||(B={}))[j.Always=0]="Always",j[j.BeforeDragging=1]="BeforeDragging",j[j.WhileDragging=2]="WhileDragging",(A||(A={})).Optimized="optimized";let mi=new Map;function mn(e,r){return pc(s=>e?s||("function"==typeof r?r(e):e):null,[r,e])}function mo(e){let{callback:r,disabled:s}=e,i=pa(r),n=(0,W.useMemo)(()=>{if(s||"undefined"==typeof window||void 0===window.ResizeObserver)return;let{ResizeObserver:e}=window;return new e(i)},[s]);return(0,W.useEffect)(()=>()=>null==n?void 0:n.disconnect(),[n]),n}function ma(e){return new p0(pW(e),e)}function ml(e,r,s){void 0===r&&(r=ma);let[i,n]=(0,W.useState)(null);function o(){n(i=>{if(!e)return null;if(!1===e.isConnected){var n;return null!=(n=null!=i?i:s)?n:null}let o=r(e);return JSON.stringify(i)===JSON.stringify(o)?i:o})}let a=function(e){let{callback:r,disabled:s}=e,i=pa(r),n=(0,W.useMemo)(()=>{if(s||"undefined"==typeof window||void 0===window.MutationObserver)return;let{MutationObserver:e}=window;return new e(i)},[i,s]);return(0,W.useEffect)(()=>()=>null==n?void 0:n.disconnect(),[n]),n}({callback(r){if(e)for(let s of r){let{type:r,target:i}=s;if("childList"===r&&i instanceof HTMLElement&&i.contains(e)){o();break}}}}),l=mo({callback:o});return po(()=>{o(),e?(null==l||l.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==a||a.disconnect())},[e]),i}let mc=[];function md(e,r){void 0===r&&(r=[]);let s=(0,W.useRef)(null);return(0,W.useEffect)(()=>{s.current=null},r),(0,W.useEffect)(()=>{let r=e!==pM;r&&!s.current&&(s.current=e),!r&&s.current&&(s.current=null)},[e]),s.current?pg(e,s.current):pM}function mh(e){return(0,W.useMemo)(()=>{let r,s;return e?(r=e.innerWidth,{top:0,left:0,right:r,bottom:s=e.innerHeight,width:r,height:s}):null},[e])}let mu=[],mf=[{sensor:mr,options:{}},{sensor:p8,options:{}}],mp={current:{}},mm={draggable:{measure:pH},droppable:{measure:pH,strategy:B.WhileDragging,frequency:A.Optimized},dragOverlay:{measure:pW}};class mg extends Map{get(e){var r;return null!=e&&null!=(r=super.get(e))?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:r}=e;return!r})}getNodeFor(e){var r,s;return null!=(r=null==(s=this.get(e))?void 0:s.node.current)?r:void 0}}let mv={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mg,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pE},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:mm,measureDroppableContainers:pE,windowRect:null,measuringScheduled:!1},mx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pE,draggableNodes:new Map,over:null,measureDroppableContainers:pE},m_=(0,W.createContext)(mx),my=(0,W.createContext)(mv);function mb(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mg}}}function mw(e,r){switch(r.type){case E.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:r.initialCoordinates,active:r.active}};case E.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:r.coordinates.x-e.draggable.initialCoordinates.x,y:r.coordinates.y-e.draggable.initialCoordinates.y}}};case E.DragEnd:case E.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case E.RegisterDroppable:{let{element:s}=r,{id:i}=s,n=new mg(e.droppable.containers);return n.set(i,s),{...e,droppable:{...e.droppable,containers:n}}}case E.SetDroppableDisabled:{let{id:s,key:i,disabled:n}=r,o=e.droppable.containers.get(s);if(!o||i!==o.key)return e;let a=new mg(e.droppable.containers);return a.set(s,{...o,disabled:n}),{...e,droppable:{...e.droppable,containers:a}}}case E.UnregisterDroppable:{let{id:s,key:i}=r,n=e.droppable.containers.get(s);if(!n||i!==n.key)return e;let o=new mg(e.droppable.containers);return o.delete(s),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function mS(e){let{disabled:r}=e,{active:s,activatorEvent:i,draggableNodes:n}=(0,W.useContext)(m_),o=ph(i),a=ph(null==s?void 0:s.id);return(0,W.useEffect)(()=>{if(!r&&!i&&o&&null!=a){if(!pv(o)||document.activeElement===o.target)return;let e=n.get(a);if(!e)return;let{activatorNode:r,node:s}=e;(r.current||s.current)&&requestAnimationFrame(()=>{for(let e of[r.current,s.current]){if(!e)continue;let r=e.matches(py)?e:e.querySelector(py);if(r){r.focus();break}}})}},[i,r,n,a,o]),null}let mC=(0,W.createContext)({...pM,scaleX:1,scaleY:1});(N=O||(O={}))[N.Uninitialized=0]="Uninitialized",N[N.Initializing=1]="Initializing",N[N.Initialized=2]="Initialized";let mk=(0,W.memo)(function(e){var r,s,i,n,o,a,l,c;let d,h,u,f,p,m,g,v,{id:x,accessibility:_,autoScroll:y=!0,children:b,sensors:w=mf,collisionDetection:S=pO,measuring:C,modifiers:k,...j}=e,[N,M]=(0,W.useReducer)(mw,void 0,mb),[D,T]=function(){let[e]=(0,W.useState)(()=>new Set),r=(0,W.useCallback)(r=>(e.add(r),()=>e.delete(r)),[e]);return[(0,W.useCallback)(r=>{let{type:s,event:i}=r;e.forEach(e=>{var r;return null==(r=e[s])?void 0:r.call(e,i)})},[e]),r]}(),[A,I]=(0,W.useState)(O.Uninitialized),z=A===O.Initialized,{draggable:{active:F,nodes:H,translate:$},droppable:{containers:K}}=N,U=null!=F?H.get(F):null,q=(0,W.useRef)({initial:null,translated:null}),V=(0,W.useMemo)(()=>{var e;return null!=F?{id:F,data:null!=(e=null==U?void 0:U.data)?e:mp,rect:q}:null},[F,U]),Y=(0,W.useRef)(null),[X,J]=(0,W.useState)(null),[Z,Q]=(0,W.useState)(null),ee=pl(j,Object.values(j)),et=pf("DndDescribedBy",x),er=(0,W.useMemo)(()=>K.getEnabled(),[K]),es=(0,W.useMemo)(()=>({draggable:{...mm.draggable,...null==C?void 0:C.draggable},droppable:{...mm.droppable,...null==C?void 0:C.droppable},dragOverlay:{...mm.dragOverlay,...null==C?void 0:C.dragOverlay}}),[null==C?void 0:C.draggable,null==C?void 0:C.droppable,null==C?void 0:C.dragOverlay]),{droppableRects:ei,measureDroppableContainers:en,measuringScheduled:eo}=function(e,r){let{dragging:s,dependencies:i,config:n}=r,[o,a]=(0,W.useState)(null),{frequency:l,measure:c,strategy:d}=n,h=(0,W.useRef)(e),u=function(){switch(d){case B.Always:return!1;case B.BeforeDragging:return s;default:return!s}}(),f=pl(u),p=(0,W.useCallback)(function(e){void 0===e&&(e=[]),f.current||a(r=>null===r?e:r.concat(e.filter(e=>!r.includes(e))))},[f]),m=(0,W.useRef)(null),g=pc(r=>{if(u&&!s)return mi;if(!r||r===mi||h.current!==e||null!=o){let r=new Map;for(let s of e){if(!s)continue;if(o&&o.length>0&&!o.includes(s.id)&&s.rect.current){r.set(s.id,s.rect.current);continue}let e=s.node.current,i=e?new p0(c(e),e):null;s.rect.current=i,i&&r.set(s.id,i)}return r}return r},[e,o,s,u,c]);return(0,W.useEffect)(()=>{h.current=e},[e]),(0,W.useEffect)(()=>{u||p()},[s,u]),(0,W.useEffect)(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),(0,W.useEffect)(()=>{u||"number"!=typeof l||null!==m.current||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,u,p,...i]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:null!=o}}(er,{dragging:z,dependencies:[$.x,$.y],config:es.droppable}),ea=pc(e=>{var r;return null==F?null:null!=(r=null!=p?p:e)?r:null},[p=(f=null!=F?H.get(F):void 0)?f.node.current:null,F]),el=(0,W.useMemo)(()=>Z?px(Z):null,[Z]),ec=(d=(null==X?void 0:X.autoScrollEnabled)===!1,h="object"==typeof y?!1===y.enabled:!1===y,u=z&&!d&&!h,"object"==typeof y?{...y,enabled:u}:{enabled:u}),ed=mn(ea,es.draggable.measure);!function(e){let{activeNode:r,measure:s,initialRect:i,config:n=!0}=e,o=(0,W.useRef)(!1),{x:a,y:l}="boolean"==typeof n?{x:n,y:n}:n;po(()=>{if(!a&&!l||!r){o.current=!1;return}if(o.current||!i)return;let e=null==r?void 0:r.node.current;if(!e||!1===e.isConnected)return;let n=pI(s(e),i);if(a||(n.x=0),l||(n.y=0),o.current=!0,Math.abs(n.x)>0||Math.abs(n.y)>0){let r=pK(e);r&&r.scrollBy({top:n.y,left:n.x})}},[r,a,l,i,s])}({activeNode:null!=F?H.get(F):null,config:ec.layoutShiftCompensation,initialRect:ed,measure:es.draggable.measure});let eh=ml(ea,es.draggable.measure,ed),eu=ml(ea?ea.parentElement:null),ef=(0,W.useRef)({activatorEvent:null,active:null,activeNode:ea,collisionRect:null,collisions:null,droppableRects:ei,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:K,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ep=K.getNodeFor(null==(r=ef.current.over)?void 0:r.id),em=function(e){let{measure:r}=e,[s,i]=(0,W.useState)(null),n=mo({callback:(0,W.useCallback)(e=>{for(let{target:s}of e)if(ps(s)){i(e=>{let i=r(s);return e?{...e,width:i.width,height:i.height}:i});break}},[r])}),[o,a]=pd((0,W.useCallback)(e=>{let s=function(e){if(!e)return null;if(e.children.length>1)return e;let r=e.children[0];return ps(r)?r:e}(e);null==n||n.disconnect(),s&&(null==n||n.observe(s)),i(s?r(s):null)},[r,n]));return(0,W.useMemo)(()=>({nodeRef:o,rect:s,setRef:a}),[s,o,a])}({measure:es.dragOverlay.measure}),eg=null!=(s=em.nodeRef.current)?s:ea,ev=z?null!=(i=em.rect)?i:eh:null,ex=!!(em.nodeRef.current&&em.rect),e_=(m=mn(o=ex?null:eh),pI(o,m)),ey=mh(eg?pt(eg):null),eb=(a=z?null!=ep?ep:ea:null,g=(0,W.useRef)(a),v=pc(e=>a?e&&e!==mc&&a&&g.current&&a.parentNode===g.current.parentNode?e:p$(a):mc,[a]),(0,W.useEffect)(()=>{g.current=a},[a]),v),ew=function(e,r){void 0===r&&(r=pW);let[s]=e,i=mh(s?pt(s):null),[n,o]=(0,W.useState)(mu);function a(){o(()=>e.length?e.map(e=>pX(e)?i:new p0(r(e),e)):mu)}let l=mo({callback:a});return po(()=>{null==l||l.disconnect(),a(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),n}(eb),eS=function(e,r){let{transform:s,...i}=r;return null!=e&&e.length?e.reduce((e,r)=>r({transform:e,...i}),s):s}(k,{transform:{x:$.x-e_.x,y:$.y-e_.y,scaleX:1,scaleY:1},activatorEvent:Z,active:V,activeNodeRect:eh,containerNodeRect:eu,draggingNodeRect:ev,over:ef.current.over,overlayNodeRect:em.rect,scrollableAncestors:eb,scrollableAncestorRects:ew,windowRect:ey}),eC=el?pm(el,$):null,ek=function(e){let[r,s]=(0,W.useState)(null),i=(0,W.useRef)(e),n=(0,W.useCallback)(e=>{let r=pU(e.target);r&&s(e=>e?(e.set(r,pY(r)),new Map(e)):null)},[]);return(0,W.useEffect)(()=>{let r=i.current;if(e!==r){o(r);let a=e.map(e=>{let r=pU(e);return r?(r.addEventListener("scroll",n,{passive:!0}),[r,pY(r)]):null}).filter(e=>null!=e);s(a.length?new Map(a):null),i.current=e}return()=>{o(e),o(r)};function o(e){e.forEach(e=>{let r=pU(e);null==r||r.removeEventListener("scroll",n)})}},[n,e]),(0,W.useMemo)(()=>e.length?r?Array.from(r.values()).reduce((e,r)=>pm(e,r),pM):pZ(e):pM,[e,r])}(eb),ej=md(ek),eN=md(ek,[eh]),eE=pm(eS,ej),eR=ev?pz(ev,eS):null,eM=V&&eR?S({active:V,collisionRect:eR,droppableRects:ei,droppableContainers:er,pointerCoordinates:eC}):null,eD=pB(eM,"id"),[eT,eP]=(0,W.useState)(null),eL=(l=ex?eS:pm(eS,eN),c=null!=(n=null==eT?void 0:eT.rect)?n:null,{...l,scaleX:c&&eh?c.width/eh.width:1,scaleY:c&&eh?c.height/eh.height:1}),eB=(0,W.useRef)(null),eA=(0,W.useCallback)((e,r)=>{let{sensor:s,options:i}=r;if(null==Y.current)return;let n=H.get(Y.current);if(!n)return;let o=e.nativeEvent,a=new s({active:Y.current,activeNode:n,event:o,options:i,context:ef,onAbort(e){if(!H.get(e))return;let{onDragAbort:r}=ee.current,s={id:e};null==r||r(s),D({type:"onDragAbort",event:s})},onPending(e,r,s,i){if(!H.get(e))return;let{onDragPending:n}=ee.current,o={id:e,constraint:r,initialCoordinates:s,offset:i};null==n||n(o),D({type:"onDragPending",event:o})},onStart(e){let r=Y.current;if(null==r)return;let s=H.get(r);if(!s)return;let{onDragStart:i}=ee.current,n={activatorEvent:o,active:{id:r,data:s.data,rect:q}};(0,G.unstable_batchedUpdates)(()=>{null==i||i(n),I(O.Initializing),M({type:E.DragStart,initialCoordinates:e,active:r}),D({type:"onDragStart",event:n}),J(eB.current),Q(o)})},onMove(e){M({type:E.DragMove,coordinates:e})},onEnd:l(E.DragEnd),onCancel:l(E.DragCancel)});function l(e){return async function(){let{active:r,collisions:s,over:i,scrollAdjustedTranslate:n}=ef.current,a=null;if(r&&n){let{cancelDrop:l}=ee.current;a={activatorEvent:o,active:r,collisions:s,delta:n,over:i},e===E.DragEnd&&"function"==typeof l&&await Promise.resolve(l(a))&&(e=E.DragCancel)}Y.current=null,(0,G.unstable_batchedUpdates)(()=>{M({type:e}),I(O.Uninitialized),eP(null),J(null),Q(null),eB.current=null;let r=e===E.DragEnd?"onDragEnd":"onDragCancel";if(a){let e=ee.current[r];null==e||e(a),D({type:r,event:a})}})}}eB.current=a},[H]),eO=(0,W.useCallback)((e,r)=>(s,i)=>{let n=s.nativeEvent,o=H.get(i);null!==Y.current||!o||n.dndKit||n.defaultPrevented||!0===e(s,r.options,{active:o})&&(n.dndKit={capturedBy:r.sensor},Y.current=i,eA(s,r))},[H,eA]),eI=(0,W.useMemo)(()=>w.reduce((e,r)=>{let{sensor:s}=r;return[...e,...s.activators.map(e=>({eventName:e.eventName,handler:eO(e.handler,r)}))]},[]),[w,eO]);(0,W.useEffect)(()=>{if(!f7)return;let e=w.map(e=>{let{sensor:r}=e;return null==r.setup?void 0:r.setup()});return()=>{for(let r of e)null==r||r()}},w.map(e=>{let{sensor:r}=e;return r})),po(()=>{eh&&A===O.Initializing&&I(O.Initialized)},[eh,A]),(0,W.useEffect)(()=>{let{onDragMove:e}=ee.current,{active:r,activatorEvent:s,collisions:i,over:n}=ef.current;if(!r||!s)return;let o={active:r,activatorEvent:s,collisions:i,delta:{x:eE.x,y:eE.y},over:n};(0,G.unstable_batchedUpdates)(()=>{null==e||e(o),D({type:"onDragMove",event:o})})},[eE.x,eE.y]),(0,W.useEffect)(()=>{let{active:e,activatorEvent:r,collisions:s,droppableContainers:i,scrollAdjustedTranslate:n}=ef.current;if(!e||null==Y.current||!r||!n)return;let{onDragOver:o}=ee.current,a=i.get(eD),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,activatorEvent:r,collisions:s,delta:{x:n.x,y:n.y},over:l};(0,G.unstable_batchedUpdates)(()=>{eP(l),null==o||o(c),D({type:"onDragOver",event:c})})},[eD]),po(()=>{ef.current={activatorEvent:Z,active:V,activeNode:ea,collisionRect:eR,collisions:eM,droppableRects:ei,draggableNodes:H,draggingNode:eg,draggingNodeRect:ev,droppableContainers:K,over:eT,scrollableAncestors:eb,scrollAdjustedTranslate:eE},q.current={initial:ev,translated:eR}},[V,ea,eM,eR,H,eg,ev,ei,K,eT,eb,eE]),function(e){let r,{acceleration:s,activator:i=P.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:l=5,order:c=L.TreeOrder,pointerCoordinates:d,scrollableAncestors:h,scrollableAncestorRects:u,delta:f,threshold:p}=e,m=function(e){let{delta:r,disabled:s}=e,i=ph(r);return pc(e=>{if(s||!i||!e)return ms;let n={x:Math.sign(r.x-i.x),y:Math.sign(r.y-i.y)};return{x:{[R.Backward]:e.x[R.Backward]||-1===n.x,[R.Forward]:e.x[R.Forward]||1===n.x},y:{[R.Backward]:e.y[R.Backward]||-1===n.y,[R.Forward]:e.y[R.Forward]||1===n.y}}},[s,r,i])}({delta:f,disabled:!a}),[g,v]=(r=(0,W.useRef)(null),[(0,W.useCallback)((e,s)=>{r.current=setInterval(e,s)},[]),(0,W.useCallback)(()=>{null!==r.current&&(clearInterval(r.current),r.current=null)},[])]),x=(0,W.useRef)({x:0,y:0}),_=(0,W.useRef)({x:0,y:0}),y=(0,W.useMemo)(()=>{switch(i){case P.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case P.DraggableRect:return o}},[i,o,d]),b=(0,W.useRef)(null),w=(0,W.useCallback)(()=>{let e=b.current;if(!e)return;let r=x.current.x*_.current.x,s=x.current.y*_.current.y;e.scrollBy(r,s)},[]),S=(0,W.useMemo)(()=>c===L.TreeOrder?[...h].reverse():h,[c,h]);(0,W.useEffect)(()=>{if(!a||!h.length||!y)return void v();for(let e of S){if((null==n?void 0:n(e))===!1)continue;let r=u[h.indexOf(e)];if(!r)continue;let{direction:i,speed:o}=function(e,r,s,i,n){let{top:o,left:a,right:l,bottom:c}=s;void 0===i&&(i=10),void 0===n&&(n=pJ);let{isTop:d,isBottom:h,isLeft:u,isRight:f}=pG(e),p={x:0,y:0},m={x:0,y:0},g={height:r.height*n.y,width:r.width*n.x};return!d&&o<=r.top+g.height?(p.y=R.Backward,m.y=i*Math.abs((r.top+g.height-o)/g.height)):!h&&c>=r.bottom-g.height&&(p.y=R.Forward,m.y=i*Math.abs((r.bottom-g.height-c)/g.height)),!f&&l>=r.right-g.width?(p.x=R.Forward,m.x=i*Math.abs((r.right-g.width-l)/g.width)):!u&&a<=r.left+g.width&&(p.x=R.Backward,m.x=i*Math.abs((r.left+g.width-a)/g.width)),{direction:p,speed:m}}(e,r,y,s,p);for(let e of["x","y"])m[e][i[e]]||(o[e]=0,i[e]=0);if(o.x>0||o.y>0){v(),b.current=e,g(w,l),x.current=o,_.current=i;return}}x.current={x:0,y:0},_.current={x:0,y:0},v()},[s,w,n,v,a,l,JSON.stringify(y),JSON.stringify(m),g,h,S,u,JSON.stringify(p)])}({...ec,delta:$,draggingRect:eR,pointerCoordinates:eC,scrollableAncestors:eb,scrollableAncestorRects:ew});let ez=(0,W.useMemo)(()=>({active:V,activeNode:ea,activeNodeRect:eh,activatorEvent:Z,collisions:eM,containerNodeRect:eu,dragOverlay:em,draggableNodes:H,droppableContainers:K,droppableRects:ei,over:eT,measureDroppableContainers:en,scrollableAncestors:eb,scrollableAncestorRects:ew,measuringConfiguration:es,measuringScheduled:eo,windowRect:ey}),[V,ea,eh,Z,eM,eu,em,H,K,ei,eT,en,eb,ew,es,eo,ey]),eF=(0,W.useMemo)(()=>({activatorEvent:Z,activators:eI,active:V,activeNodeRect:eh,ariaDescribedById:{draggable:et},dispatch:M,draggableNodes:H,over:eT,measureDroppableContainers:en}),[Z,eI,V,eh,M,et,H,eT,en]);return W.default.createElement(pC.Provider,{value:T},W.default.createElement(m_.Provider,{value:eF},W.default.createElement(my.Provider,{value:ez},W.default.createElement(mC.Provider,{value:eL},b)),W.default.createElement(mS,{disabled:(null==_?void 0:_.restoreFocus)===!1})),W.default.createElement(pN,{..._,hiddenTextDescribedById:et}))}),mj=(0,W.createContext)(null),mN="button",mE={timeout:25},mR={position:"fixed",touchAction:"none"},mM=e=>pv(e)?"transform 250ms ease":void 0;function mD(e,r,s){let i=e.slice();return i.splice(s<0?i.length+s:s,0,i.splice(r,1)[0]),i}function mT(e){return null!==e&&e>=0}(e,r)=>{let{as:s,activatorEvent:i,adjustScale:n,children:o,className:a,rect:l,style:c,transform:d,transition:h=mM}=e;if(!l)return null;let u=n?d:{...d,scaleX:1,scaleY:1},f={...mR,width:l.width,height:l.height,top:l.top,left:l.left,transform:p_.Transform.toString(u),transformOrigin:n&&i?function(e,r){let s=px(e);if(!s)return"0 0";let i={x:(s.x-r.left)/r.width*100,y:(s.y-r.top)/r.height*100};return i.x+"% "+i.y+"%"}(i,l):void 0,transition:"function"==typeof h?h(i):h,...c};return W.default.createElement(s,{className:a,style:f,ref:r},o)},v={styles:{active:{opacity:"0"}}};let mP=e=>{let{rects:r,activeIndex:s,overIndex:i,index:n}=e,o=mD(r,i,s),a=r[n],l=o[n];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},mL={scaleX:1,scaleY:1},mB=e=>{var r,s,i,n;let o,a,l,{activeIndex:c,activeNodeRect:d,index:h,rects:u,overIndex:f}=e,p=null!=(r=u[c])?r:d;if(!p)return null;if(h===c){let e=u[f];return e?{x:0,y:c<f?e.top+e.height-(p.top+p.height):e.top-p.top,...mL}:null}let m=(s=u,i=h,n=c,o=s[i],a=s[i-1],l=s[i+1],o?n<i?a?o.top-(a.top+a.height):l?l.top-(o.top+o.height):0:l?l.top-(o.top+o.height):a?o.top-(a.top+a.height):0:0);return h>c&&h<=f?{x:0,y:-p.height-m,...mL}:h<c&&h>=f?{x:0,y:p.height+m,...mL}:{x:0,y:0,...mL}},mA="Sortable",mO=W.default.createContext({activeIndex:-1,containerId:mA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mP,disabled:{draggable:!1,droppable:!1}});function mI(e){let{children:r,id:s,items:i,strategy:n=mP,disabled:o=!1}=e,{active:a,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=(0,W.useContext)(my),u=pf(mA,s),f=null!==l.rect,p=(0,W.useMemo)(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),m=null!=a,g=a?p.indexOf(a.id):-1,v=d?p.indexOf(d.id):-1,x=(0,W.useRef)(p),_=!function(e,r){if(e===r)return!0;if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==r[s])return!1;return!0}(p,x.current),y=-1!==v&&-1===g||_,b="boolean"==typeof o?{draggable:o,droppable:o}:o;po(()=>{_&&m&&h(p)},[_,p,m,h]),(0,W.useEffect)(()=>{x.current=p},[p]);let w=(0,W.useMemo)(()=>({activeIndex:g,containerId:u,disabled:b,disableTransforms:y,items:p,overIndex:v,useDragOverlay:f,sortedRects:p.reduce((e,r,s)=>{let i=c.get(r);return i&&(e[s]=i),e},Array(p.length)),strategy:n}),[g,u,b.draggable,b.droppable,y,p,v,c,f,n]);return W.default.createElement(mO.Provider,{value:w},r)}let mz=e=>{let{id:r,items:s,activeIndex:i,overIndex:n}=e;return mD(s,i,n).indexOf(r)},mF=e=>{let{containerId:r,isSorting:s,wasDragging:i,index:n,items:o,newIndex:a,previousItems:l,previousContainerId:c,transition:d}=e;return!!d&&!!i&&(l===o||n!==a)&&(!!s||a!==n&&r===c)},mW={duration:200,easing:"ease"},mH="transform",m$=p_.Transition.toString({property:mH,duration:0,easing:"linear"}),mK={roleDescription:"sortable"};function mU(e){if(!e)return!1;let r=e.data.current;return!!r&&"sortable"in r&&"object"==typeof r.sortable&&"containerId"in r.sortable&&"items"in r.sortable&&"index"in r.sortable}let mq=[D.Down,D.Right,D.Up,D.Left],mV=(e,r)=>{let{context:{active:s,collisionRect:i,droppableRects:n,droppableContainers:o,over:a,scrollableAncestors:l}}=r;if(mq.includes(e.code)){if(e.preventDefault(),!s||!i)return;let r=[];o.getEnabled().forEach(s=>{if(!s||null!=s&&s.disabled)return;let o=n.get(s.id);if(o)switch(e.code){case D.Down:i.top<o.top&&r.push(s);break;case D.Up:i.top>o.top&&r.push(s);break;case D.Left:i.left>o.left&&r.push(s);break;case D.Right:i.left<o.left&&r.push(s)}});let h=(e=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=e,n=pL(r),o=[];for(let e of i){let{id:r}=e,i=s.get(r);if(i){let s=pL(i),a=Number((n.reduce((e,r,i)=>e+pD(s[i],r),0)/4).toFixed(4));o.push({id:r,data:{droppableContainer:e,value:a}})}}return o.sort(pT)})({active:s,collisionRect:i,droppableRects:n,droppableContainers:r,pointerCoordinates:null}),u=pB(h,"id");if(u===(null==a?void 0:a.id)&&h.length>1&&(u=h[1].id),null!=u){let e=o.get(s.id),r=o.get(u),a=r?n.get(r.id):null,h=null==r?void 0:r.node.current;if(h&&a&&e&&r){var c,d;let s=p$(h).some((e,r)=>l[r]!==e),n=mY(e,r),o=(c=e,d=r,!!mU(c)&&!!mU(d)&&!!mY(c,d)&&c.data.current.sortable.index<d.data.current.sortable.index),u=s||!n?{x:0,y:0}:{x:o?i.width-a.width:0,y:o?i.height-a.height:0},f={x:a.left,y:a.top};return u.x&&u.y?f:pg(f,u)}}}};function mY(e,r){return!!mU(e)&&!!mU(r)&&e.data.current.sortable.containerId===r.data.current.sortable.containerId}function mX({executor:e,executorMode:r,isOpen:s,onOpenChange:i,onStart:n,onStop:o,onUpdate:a,onDelete:l,onProcessFinished:c}){let[d,h]=(0,W.useState)(!1),[u,f]=(0,W.useState)(e.currentProcessId),p=(0,W.useRef)(!1),{attributes:m,listeners:g,setNodeRef:v,transform:x,transition:_,isDragging:y}=function(e){var r,s,i,n;let{animateLayoutChanges:o=mF,attributes:a,disabled:l,data:c,getNewIndex:d=mz,id:h,strategy:u,resizeObserverConfig:f,transition:p=mW}=e,{items:m,containerId:g,activeIndex:v,disabled:x,disableTransforms:_,sortedRects:y,overIndex:b,useDragOverlay:w,strategy:S}=(0,W.useContext)(mO),C=(r=l,s=x,"boolean"==typeof r?{draggable:r,droppable:!1}:{draggable:null!=(i=null==r?void 0:r.draggable)?i:s.draggable,droppable:null!=(n=null==r?void 0:r.droppable)?n:s.droppable}),k=m.indexOf(h),j=(0,W.useMemo)(()=>({sortable:{containerId:g,index:k,items:m},...c}),[g,c,k,m]),N=(0,W.useMemo)(()=>m.slice(m.indexOf(h)),[m,h]),{rect:R,node:M,isOver:D,setNodeRef:T}=function(e){let{data:r,disabled:s=!1,id:i,resizeObserverConfig:n}=e,o=pf("Droppable"),{active:a,dispatch:l,over:c,measureDroppableContainers:d}=(0,W.useContext)(m_),h=(0,W.useRef)({disabled:s}),u=(0,W.useRef)(!1),f=(0,W.useRef)(null),p=(0,W.useRef)(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...mE,...n},x=pl(null!=g?g:i),_=mo({callback:(0,W.useCallback)(()=>{if(!u.current){u.current=!0;return}null!=p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),p.current=null},v)},[v]),disabled:m||!a}),[y,b]=pd((0,W.useCallback)((e,r)=>{_&&(r&&(_.unobserve(r),u.current=!1),e&&_.observe(e))},[_])),w=pl(r);return(0,W.useEffect)(()=>{_&&y.current&&(_.disconnect(),u.current=!1,_.observe(y.current))},[y,_]),(0,W.useEffect)(()=>(l({type:E.RegisterDroppable,element:{id:i,key:o,disabled:s,node:y,rect:f,data:w}}),()=>l({type:E.UnregisterDroppable,key:o,id:i})),[i]),(0,W.useEffect)(()=>{s!==h.current.disabled&&(l({type:E.SetDroppableDisabled,id:i,key:o,disabled:s}),h.current.disabled=s)},[i,o,s,l]),{active:a,rect:f,isOver:(null==c?void 0:c.id)===i,node:y,over:c,setNodeRef:b}}({id:h,data:j,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...f}}),{active:P,activatorEvent:L,activeNodeRect:B,attributes:A,setNodeRef:O,listeners:I,isDragging:z,over:F,setActivatorNodeRef:H,transform:$}=function(e){let{id:r,data:s,disabled:i=!1,attributes:n}=e,o=pf("Draggable"),{activators:a,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:u,over:f}=(0,W.useContext)(m_),{role:p=mN,roleDescription:m="draggable",tabIndex:g=0}=null!=n?n:{},v=(null==c?void 0:c.id)===r,x=(0,W.useContext)(v?mC:mj),[_,y]=pd(),[b,w]=pd(),S=(0,W.useMemo)(()=>a.reduce((e,s)=>{let{eventName:i,handler:n}=s;return e[i]=e=>{n(e,r)},e},{}),[a,r]),C=pl(s);return po(()=>(u.set(r,{id:r,key:o,node:_,activatorNode:b,data:C}),()=>{let e=u.get(r);e&&e.key===o&&u.delete(r)}),[u,r]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:(0,W.useMemo)(()=>({role:p,tabIndex:g,"aria-disabled":i,"aria-pressed":!!v&&p===mN||void 0,"aria-roledescription":m,"aria-describedby":h.draggable}),[i,p,g,v,m,h.draggable]),isDragging:v,listeners:i?void 0:S,node:_,over:f,setNodeRef:y,setActivatorNodeRef:w,transform:x}}({id:h,data:j,attributes:{...mK,...a},disabled:C.draggable}),K=function(){for(var e=arguments.length,r=Array(e),s=0;s<e;s++)r[s]=arguments[s];return(0,W.useMemo)(()=>e=>{r.forEach(r=>r(e))},r)}(T,O),U=!!P,q=U&&!_&&mT(v)&&mT(b),V=!w&&z,Y=V&&q?$:null,X=q?null!=Y?Y:(null!=u?u:S)({rects:y,activeNodeRect:B,activeIndex:v,overIndex:b,index:k}):null,G=mT(v)&&mT(b)?d({id:h,items:m,activeIndex:v,overIndex:b}):k,J=null==P?void 0:P.id,Z=(0,W.useRef)({activeId:J,items:m,newIndex:G,containerId:g}),Q=m!==Z.current.items,ee=o({active:P,containerId:g,isDragging:z,isSorting:U,id:h,index:k,items:m,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:p,wasDragging:null!=Z.current.activeId}),et=function(e){let{disabled:r,index:s,node:i,rect:n}=e,[o,a]=(0,W.useState)(null),l=(0,W.useRef)(s);return po(()=>{if(!r&&s!==l.current&&i.current){let e=n.current;if(e){let r=pW(i.current,{ignoreTransform:!0}),s={x:e.left-r.left,y:e.top-r.top,scaleX:e.width/r.width,scaleY:e.height/r.height};(s.x||s.y)&&a(s)}}s!==l.current&&(l.current=s)},[r,s,i,n]),(0,W.useEffect)(()=>{o&&a(null)},[o]),o}({disabled:!ee,index:k,node:M,rect:R});return(0,W.useEffect)(()=>{U&&Z.current.newIndex!==G&&(Z.current.newIndex=G),g!==Z.current.containerId&&(Z.current.containerId=g),m!==Z.current.items&&(Z.current.items=m)},[U,G,g,m]),(0,W.useEffect)(()=>{if(J===Z.current.activeId)return;if(null!=J&&null==Z.current.activeId){Z.current.activeId=J;return}let e=setTimeout(()=>{Z.current.activeId=J},50);return()=>clearTimeout(e)},[J]),{active:P,activeIndex:v,attributes:A,data:j,rect:R,index:k,newIndex:G,items:m,isOver:D,isSorting:U,isDragging:z,listeners:I,node:M,overIndex:b,over:F,setNodeRef:K,setActivatorNodeRef:H,setDroppableNodeRef:T,setDraggableNodeRef:O,transform:null!=et?et:X,transition:et||Q&&Z.current.newIndex===k?m$:(!V||pv(L))&&p&&(U||ee)?p_.Transition.toString({...p,property:mH}):void 0}}({id:e.id}),b={transform:p_.Translate.toString(x),transition:_,zIndex:y?50:void 0,position:y?"relative":void 0,opacity:y?1:void 0},{logs:w,status:S,exitCode:C,isPty:k,sendInput:j,sendResize:N}=f8(u,r);(0,W.useEffect)(()=>{f(e.currentProcessId),e.currentProcessId&&(p.current=!1)},[e.currentProcessId]),(0,W.useEffect)(()=>{"closed"!==S||null===C||p.current||(p.current=!0,c(u))},[S,C,u,c]);let R=async()=>{console.log(`[ExecutorItem] Starting executor ${e.id}`),p.current=!1;let r=await n();console.log(`[ExecutorItem] Got processId: ${r}`),r&&(f(r),i(!0))},M=async()=>{await o(u||void 0)},D=e.isRunning;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(a6,{open:s,onOpenChange:i,children:(0,F.jsxs)("div",{ref:v,style:b,className:(0,iu.cn)("border rounded-lg",y&&"shadow-lg bg-background"),children:[(0,F.jsx)(a8,{asChild:!0,children:(0,F.jsxs)("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-muted/50",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...m,...g,onClick:e=>e.stopPropagation(),children:(0,F.jsx)(lh,{className:"h-4 w-4"})}),s?(0,F.jsx)(aT,{className:"h-4 w-4"}):(0,F.jsx)(id,{className:"h-4 w-4"}),(0,F.jsx)("span",{className:"font-medium",children:e.name}),(0,F.jsx)(ll,{variant:D?"default":"secondary",className:(0,iu.cn)(D&&"bg-green-600 hover:bg-green-600"),children:D?"Running":null!==C?0===C?"Completed":"Failed":"Stopped"})]}),(0,F.jsxs)("div",{className:"flex items-center gap-2",onClick:e=>e.stopPropagation(),children:[D?(0,F.jsxs)($.Button,{size:"sm",variant:"destructive",onClick:M,children:[(0,F.jsx)(lc,{className:"h-3 w-3 mr-1"}),"Stop"]}):(0,F.jsxs)($.Button,{size:"sm",onClick:R,children:[(0,F.jsx)(iC,{className:"h-3 w-3 mr-1"}),"Start"]}),(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)($.Button,{size:"icon",variant:"ghost",className:"h-8 w-8",children:(0,F.jsx)(ld,{className:"h-4 w-4"})})}),(0,F.jsxs)(ig,{align:"end",children:[(0,F.jsxs)(iv,{onClick:()=>h(!0),children:[(0,F.jsx)(oL,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,F.jsxs)(iv,{onClick:l,className:"text-destructive",children:[(0,F.jsx)(nz,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]})}),(0,F.jsx)(a7,{children:(0,F.jsxs)("div",{className:"px-3 pb-3",children:[(0,F.jsx)("div",{className:"text-xs text-muted-foreground mb-2 font-mono",children:"prompt"===e.executor_type?`${e.prompt_provider??"claude"} → ${e.command}`:`$ ${e.command}`}),(0,F.jsx)(f5,{logs:w,isPty:k,onInput:j,onResize:N})]})})]})}),(0,F.jsx)(f6,{open:d,onOpenChange:h,executor:e,onSubmit:async e=>{await a(e)}})]})}let mG=e=>{let{droppableContainers:r,pointerCoordinates:s}=e;if(!s)return(e=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=e,n=pA(r,r.left,r.top),o=[];for(let e of i){let{id:r}=e,i=s.get(r);if(i){let s=pD(pA(i),n);o.push({id:r,data:{droppableContainer:e,value:s}})}}return o.sort(pT)})(e);let i=[];for(let e of r){let r=e.rect.current;if(!r)continue;let n=r.top,o=r.top+52;s.x>=r.left&&s.x<=r.right&&s.y>=n&&s.y<=o&&i.push({id:e.id,data:{droppableContainer:e}})}if(i.length>0)return i;let n=null;for(let e of r){let r=e.rect.current;if(!r)continue;let i=r.top+26,o=r.left+r.width/2,a=Math.sqrt(Math.pow(s.x-o,2)+Math.pow(s.y-i,2));(!n||a<n.distance)&&(n={id:e.id,distance:a,data:{droppableContainer:e}})}return n?[{id:n.id,data:n.data}]:[]};function mJ({projectId:e,selectedBranch:r,project:s,onExecutorModeChange:i}){let[n,o]=(0,W.useState)(!1),[a,l]=(0,W.useState)(new Set),{remotes:c}=iM(s?.id??void 0),d=[];for(let e of(s?.path&&d.push({id:"local",label:"Local",icon:nO.Monitor}),c))d.push({id:e.remote_server_id,label:e.server_name,icon:nI});let{activeGroup:h,loading:u,createGroup:f}=function(e,r){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)(null),[a,l]=(0,W.useState)(!0),c=r??"",d=(0,W.useCallback)(async()=>{if(!e){i([]),o(null),l(!1);return}try{let[r,s]=await Promise.all([iR.api.getExecutorGroups(e),iR.api.getExecutorGroupByBranch(e,c)]);i(r),o(s)}catch(e){console.error("Failed to fetch executor groups:",e)}finally{l(!1)}},[e,c]);(0,W.useEffect)(()=>{l(!0),d()},[d]);let h=(0,W.useCallback)(async r=>{if(!e)return null;try{let s=await iR.api.createExecutorGroup(e,{name:r,branch:c});return i(e=>[...e,s]),o(s),s}catch(e){return console.error("Failed to create executor group:",e),null}},[e,c]);return{groups:s,activeGroup:n,loading:a,createGroup:h,updateGroup:(0,W.useCallback)(async(e,r)=>{try{let s=await iR.api.updateExecutorGroup(e,r);return i(r=>r.map(r=>r.id===e?s:r)),o(r=>r?.id===e?s:r),s}catch(e){return console.error("Failed to update executor group:",e),null}},[]),deleteGroup:(0,W.useCallback)(async e=>{try{await iR.api.deleteExecutorGroup(e),i(r=>r.filter(r=>r.id!==e)),o(r=>r?.id===e?null:r)}catch(e){console.error("Failed to delete executor group:",e)}},[]),refetch:d}}(e,r),{executors:p,loading:m,createExecutor:g,updateExecutor:v,deleteExecutor:x,startExecutor:_,stopExecutor:y,markProcessFinished:b,reorderExecutors:w}=function(e,r,s){let[i,n]=(0,W.useState)([]),[o,a]=(0,W.useState)(new Map),[l,c]=(0,W.useState)(!0),d=(0,W.useCallback)(async()=>{if(!e||!r){n([]),c(!1);return}try{let s=await iR.api.getExecutors(e,r);n(s)}catch(e){console.error("Failed to fetch executors:",e)}finally{c(!1)}},[e,r]),h=(0,W.useCallback)(async()=>{try{let e=await iR.api.getRunningProcesses(),r=new Map;for(let s of e){let e={processId:s.id,target:s.target??"local"},i=r.get(s.executor_id);i?i.push(e):r.set(s.executor_id,[e])}a(r)}catch(e){console.error("Failed to fetch running processes:",e)}},[]);(0,W.useEffect)(()=>{d(),h()},[d,h]),(0,W.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&h()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[h]);let u=(0,W.useRef)(new Set);(0,W.useEffect)(()=>{u.current=new Set(i.map(e=>e.id))},[i]),(0,W.useEffect)(()=>{if(!e)return;let r=new EventSource(`${"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}/api/events`);return r.onmessage=r=>{try{let s=JSON.parse(r.data);if(s.projectId!==e||!u.current.has(s.executorId))return;"executor:started"===s.type?a(e=>{let r=e.get(s.executorId)??[];if(r.some(e=>e.processId===s.processId))return e;let i=new Map(e);return i.set(s.executorId,[...r,{processId:s.processId,target:s.target??"local"}]),i}):"executor:stopped"===s.type&&a(e=>{let r=e.get(s.executorId);if(!r)return e;let i=r.filter(e=>e.processId!==s.processId),n=new Map(e);return 0===i.length?n.delete(s.executorId):n.set(s.executorId,i),n})}catch{}},()=>{r.close()}},[e]);let f=(0,W.useCallback)(async s=>{if(!e||!r)return null;try{let i=await iR.api.createExecutor(e,{...s,group_id:r});return n(e=>[...e,i]),i}catch(e){return console.error("Failed to create executor:",e),null}},[e,r]),p=(0,W.useCallback)(async(e,r)=>{try{let s=await iR.api.updateExecutor(e,r);return n(r=>r.map(r=>r.id===e?s:r)),s}catch(e){return console.error("Failed to update executor:",e),null}},[]),m=(0,W.useCallback)(async e=>{try{await iR.api.deleteExecutor(e),n(r=>r.filter(r=>r.id!==e))}catch(e){console.error("Failed to delete executor:",e)}},[]),g=(0,W.useCallback)(async(e,r)=>{try{let i=await iR.api.startExecutor(e,r,s);return a(r=>{let n=r.get(e)??[],o=new Map(r);return o.set(e,[...n,{processId:i,target:s??"local"}]),o}),i}catch(e){return console.error("Failed to start executor:",e),null}},[s]),v=(0,W.useCallback)(async(e,r)=>{let i=o.get(e),n=i?.find(e=>e.target===(s??"local")),l=r||n?.processId;if(l){try{await iR.api.stopProcess(l)}catch(e){console.error("Failed to stop executor:",e)}a(r=>{let s=r.get(e);if(!s)return r;let i=s.filter(e=>e.processId!==l),n=new Map(r);return 0===i.length?n.delete(e):n.set(e,i),n})}},[o,s]),x=(0,W.useCallback)((e,r)=>{a(s=>{let i=s.get(e);if(!i)return s;if(r){let n=i.filter(e=>e.processId!==r);if(n.length===i.length)return s;let o=new Map(s);return 0===n.length?o.delete(e):o.set(e,n),o}let n=new Map(s);return n.delete(e),n})},[]),_=(0,W.useCallback)(async s=>{if(e&&r){n(s.map(e=>i.find(r=>r.id===e)).filter(e=>void 0!==e));try{await iR.api.reorderExecutors(e,s,r)}catch(e){console.error("Failed to reorder executors:",e),n(i)}}},[e,r,i]);return{executors:i.map(e=>{let r=o.get(e.id),i=s??"local",n=r?.find(e=>e.target===i);return{...e,currentProcessId:n?.processId??null,isRunning:!!n}}),loading:l,createExecutor:f,updateExecutor:p,deleteExecutor:m,startExecutor:g,stopExecutor:v,markProcessFinished:x,reorderExecutors:_,refetch:d}}(e,h?.id,s?.executor_mode),S=function(){for(var e=arguments.length,r=Array(e),s=0;s<e;s++)r[s]=arguments[s];return(0,W.useMemo)(()=>[...r].filter(e=>null!=e),[...r])}(pR(mr,{activationConstraint:{distance:8}}),pR(p8,{coordinateGetter:mV}));return e?(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/60 h-10",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsxs)("h2",{className:"text-xs font-semibold flex items-center gap-2 text-foreground",children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5"}),h?h.name:"Executors"]}),d.length>1&&i&&(0,F.jsx)(nL,{targets:d,activeTarget:s?.executor_mode??"local",onTargetChange:i})]}),h&&(0,F.jsxs)($.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>o(!0),children:[(0,F.jsx)(nT,{className:"h-3 w-3 mr-1"}),"Add"]})]}),(0,F.jsx)(oh,{className:"flex-1 overflow-hidden",children:(0,F.jsx)("div",{className:"p-4 space-y-3",children:u||m?(0,F.jsx)("div",{className:"text-center text-muted-foreground py-8",children:"Loading executors..."}):h?0===p.length?(0,F.jsxs)("div",{className:"text-center text-muted-foreground py-8",children:[(0,F.jsx)("p",{children:"No executors configured"}),(0,F.jsx)("p",{className:"text-sm mt-1",children:'Add an executor to run commands like "npm run dev"'})]}):(0,F.jsx)(mk,{sensors:S,collisionDetection:mG,onDragEnd:e=>{let{active:r,over:s}=e;if(s&&r.id!==s.id){let e=p.findIndex(e=>e.id===r.id),i=p.findIndex(e=>e.id===s.id),n=[...p],[o]=n.splice(e,1);n.splice(i,0,o),w(n.map(e=>e.id))}},children:(0,F.jsx)(mI,{items:p.map(e=>e.id),strategy:mB,children:p.map(e=>(0,F.jsx)(mX,{executor:e,executorMode:s?.executor_mode??"local",isOpen:a.has(e.id),onOpenChange:r=>l(s=>{let i=new Set(s);return r?i.add(e.id):i.delete(e.id),i}),onStart:()=>_(e.id,r),onStop:r=>y(e.id,r||e.currentProcessId||void 0),onUpdate:r=>v(e.id,r),onDelete:()=>x(e.id),onProcessFinished:r=>b(e.id,r)},`${e.id}-${s?.executor_mode??"local"}`))})}):(0,F.jsxs)("div",{className:"text-center text-muted-foreground py-8",children:[(0,F.jsx)("p",{children:"No executor group for this branch"}),(0,F.jsx)("p",{className:"text-sm mt-1 mb-4",children:"Create a group to start adding executors"}),(0,F.jsxs)($.Button,{size:"sm",onClick:()=>f(r?`Executors (${r})`:"Default"),children:[(0,F.jsx)(aV,{className:"h-4 w-4 mr-1"}),"Create Group"]})]})})}),(0,F.jsx)(f6,{open:n,onOpenChange:o,onSubmit:async e=>{await g(e)}})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nB.Terminal,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to manage executors"})]})})}let mZ=(0,ic.default)("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"}]]),mQ=(0,ic.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]),m0=(0,ic.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);function m1({line:e}){let r="add"===e.type?"+":"delete"===e.type?"-":" ";return(0,F.jsxs)("div",{className:(0,iu.cn)("flex font-mono text-sm","add"===e.type&&"bg-green-500/30","delete"===e.type&&"bg-red-500/30"),children:[(0,F.jsx)("span",{className:"w-12 flex-shrink-0 text-right pr-2 text-muted-foreground select-none border-r border-border",children:e.oldLineNo??""}),(0,F.jsx)("span",{className:"w-12 flex-shrink-0 text-right pr-2 text-muted-foreground select-none border-r border-border",children:e.newLineNo??""}),(0,F.jsx)("span",{className:"w-6 flex-shrink-0 text-center select-none",children:r}),(0,F.jsx)("span",{className:"whitespace-pre-wrap break-all pr-4 flex-1 min-w-0",children:e.content})]})}let m2={modified:"bg-yellow-500/20 text-yellow-500",added:"bg-green-500/20 text-green-500",deleted:"bg-red-500/20 text-red-500",renamed:"bg-blue-500/20 text-blue-500"},m5={modified:"Modified",added:"Added",deleted:"Deleted",renamed:"Renamed"};function m3({file:e,defaultOpen:r=!0}){let[s,i]=(0,W.useState)(r);return(0,F.jsxs)(a6,{open:s,onOpenChange:i,className:"border rounded-lg overflow-hidden",children:[(0,F.jsxs)(a8,{className:"flex items-center gap-2 px-4 py-2 bg-muted border-b w-full cursor-pointer hover:bg-muted/80 transition-colors",children:[s?(0,F.jsx)(aT,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):(0,F.jsx)(id,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,F.jsx)("span",{className:"font-mono text-sm flex-1 min-w-0 truncate text-left",children:e.oldPath&&"renamed"===e.status?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"text-muted-foreground",children:e.oldPath}),(0,F.jsx)("span",{className:"mx-2",children:"→"}),e.path]}):e.path}),(0,F.jsx)(ll,{variant:"secondary",className:m2[e.status],children:m5[e.status]})]}),(0,F.jsx)(a7,{children:(0,F.jsx)("div",{children:e.hunks.map((e,r)=>(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"px-4 py-1 bg-muted/50 text-muted-foreground text-sm font-mono sticky top-0",children:["@@ -",e.oldStart,",",e.oldLines," +",e.newStart,",",e.newLines," @@"]}),e.lines.map((e,r)=>(0,F.jsx)(m1,{line:e},r))]},r))})})]})}let m4=(0,ic.default)("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"}]]),m6="__head__";function m8({commits:e,selectedCommit:r,onSelectCommit:s,loading:i,disabled:n}){return(0,F.jsxs)(aP,{value:r??m6,onValueChange:e=>{s(e===m6?null:e)},disabled:n||i,children:[(0,F.jsxs)(aB,{size:"sm",className:"w-[200px]",children:[(0,F.jsx)(m4,{className:"h-3.5 w-3.5 shrink-0"}),(0,F.jsx)(aL,{placeholder:"Compare from..."})]}),(0,F.jsxs)(aA,{children:[(0,F.jsx)(aO,{value:m6,children:"HEAD (uncommitted)"}),e.map(e=>(0,F.jsxs)(aO,{value:e.hash,children:[(0,F.jsx)("span",{className:"font-mono text-xs",children:e.shortHash})," ",(0,F.jsx)("span",{className:"truncate",children:e.message.length>40?e.message.slice(0,40)+"...":e.message})]},e.hash))]})]})}function m7({projectId:e,selectedBranch:r,onMergeRequest:s,project:i}){let[n,o]=(0,W.useState)(null),{remotes:a}=iM(i?.id??void 0),l=[];for(let e of(i?.path&&l.push({id:"local",label:"Local",icon:nO.Monitor}),a))l.push({id:e.remote_server_id,label:e.server_name,icon:nI});let c=i?.path?"local":a.length>0?a[0].remote_server_id:"local",[d,h]=(0,W.useState)(c),[u,f]=(0,W.useState)(!0),[p,m]=(0,W.useState)(0),g="local"===d?i?.path?"local":void 0:"remote",{diff:v,loading:x,error:_,refresh:y}=function(e,r,s,i){let[n,o]=(0,W.useState)(null),[a,l]=(0,W.useState)(!1),[c,d]=(0,W.useState)(null),h=(0,W.useCallback)(async()=>{if(!e)return void o(null);l(!0),d(null);try{let n=await iR.api.getDiff(e,r,s,i);o(n)}catch(e){d(e instanceof Error?e.message:"Failed to load diff"),o(null)}finally{l(!1)}},[e,r,s,i]);return{diff:n,loading:a,error:c,refresh:h}}(e,r,n,g),{commits:b,loading:w,refetch:S}=function(e,r,s,i){let[n,o]=(0,W.useState)([]),[a,l]=(0,W.useState)(!1);return{commits:n,loading:a,refetch:(0,W.useCallback)(async()=>{if(!e)return void o([]);l(!0);try{let n=await iR.api.getCommits(e,r,s,i);o(n)}catch{o([])}finally{l(!1)}},[e,r,s,i])}}(e,r,void 0,g);if((0,W.useEffect)(()=>{y()},[y]),(0,W.useEffect)(()=>{S()},[S]),(0,W.useEffect)(()=>{o(null)},[r]),(0,W.useEffect)(()=>{h(c)},[e,c]),!e)return(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(aU,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to view changes"})]})});let C=v?.files.length??0;return(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/60 h-10",children:[(0,F.jsx)("div",{className:"flex items-center gap-4",children:C>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("span",{className:"text-xs text-muted-foreground",children:[C," file",1!==C?"s":""," changed"]}),(0,F.jsxs)($.Button,{size:"sm",variant:"ghost",onClick:()=>{f(e=>!e),m(e=>e+1)},title:u?"Collapse all":"Expand all",children:[(0,F.jsx)(m0,{className:"h-4 w-4 mr-1"}),u?"Collapse all":"Expand all"]})]})}),(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[l.length>1&&(0,F.jsx)(nL,{targets:l,activeTarget:d,onTargetChange:h,disabled:x}),(0,F.jsx)("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Changes since:"}),(0,F.jsx)(m8,{commits:b,selectedCommit:n,onSelectCommit:o,loading:w,disabled:x}),(0,F.jsxs)($.Button,{size:"sm",variant:"outline",onClick:s,disabled:x||0===C,children:[(0,F.jsx)(mQ,{className:"h-4 w-4 mr-1"}),"Merge"]}),(0,F.jsxs)($.Button,{size:"sm",variant:"outline",onClick:y,disabled:x,children:[(0,F.jsx)(mZ,{className:`h-4 w-4 mr-1 ${x?"animate-spin":""}`}),"Refresh"]})]})]}),(0,F.jsx)(oh,{className:"flex-1 overflow-hidden",children:(0,F.jsx)("div",{className:"p-4 space-y-4",children:x&&!v?(0,F.jsx)("div",{className:"text-center text-muted-foreground py-8",children:"Loading changes..."}):_?(0,F.jsx)("div",{className:"text-center text-red-400 py-8",children:_}):0===C?(0,F.jsxs)("div",{className:"text-center text-muted-foreground py-8",children:[(0,F.jsx)("p",{children:n?"No changes since this commit":"No changes"}),n&&(0,F.jsx)("p",{className:"text-sm mt-1",children:"Try selecting an earlier commit"})]}):v?.files.map((e,r)=>(0,F.jsx)(m3,{file:e,defaultOpen:u},`${r}-${p}`))})})]})}function m9({terminalId:e,onExit:r}){let{logs:s,sendInput:i,sendResize:n,exitCode:o}=f8(e);return(0,W.useEffect)(()=>{null!==o&&r(e)},[o,r,e]),(0,F.jsx)(f5,{logs:s,isPty:!0,className:"h-full rounded-none border-0",onInput:i,onResize:n})}function ge({projectId:e,selectedBranch:r,project:s}){let{terminals:i,activeTerminalId:n,createTerminal:o,closeTerminal:a,setActiveTerminal:l,removeTerminal:c}=function(e,r){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e){i([]),o(null);return}iR.api.getTerminals(e,r).then(e=>{i(e),o(e.length>0?e[0].id:null)})},[e,r]);let a=(0,W.useCallback)(async(s,n)=>{if(!e)return;let a=await iR.api.createTerminal(e,r,s,n);i(e=>[...e,a]),o(a.id)},[e,r]),l=(0,W.useCallback)(async e=>{await iR.api.closeTerminal(e),i(r=>{let s=r.filter(r=>r.id!==e);return o(r=>r===e?s.length>0?s[s.length-1].id:null:r),s})},[]);return{terminals:s,activeTerminalId:n,createTerminal:a,closeTerminal:l,setActiveTerminal:(0,W.useCallback)(e=>{o(e)},[]),removeTerminal:(0,W.useCallback)(e=>{i(r=>{let s=r.filter(r=>r.id!==e);return o(r=>r===e?s.length>0?s[s.length-1].id:null:r),s})},[])}}(e,r),{remotes:d}=iM(s?.id??void 0),[h,u]=(0,W.useState)(!1),f=(0,W.useRef)(null),p=!!s?.path,m=d.length>0,g=p&&m||d.length>1,v=!p&&m||g&&s?.executor_mode!=="local"?"remote":"local",x=(0,W.useCallback)(()=>{o(v)},[o,v]),_=(0,W.useCallback)((e,r)=>{u(!1),o(e,r)},[o]);(0,W.useEffect)(()=>{if(h)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){f.current&&!f.current.contains(e.target)&&u(!1)}},[h]);let y=(0,W.useCallback)(e=>{c(e)},[c]);return e?(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center h-10 border-b border-border/60 px-2 gap-1 shrink-0 bg-muted/20",children:[(0,F.jsxs)(oh,{className:"flex-1",children:[(0,F.jsx)("div",{className:"flex items-center gap-1",children:i.map(e=>{let r="remote"===e.location||e.id.startsWith("remote-"),s=g?r?nI:nO.Monitor:nB.Terminal;return(0,F.jsxs)("button",{onClick:()=>l(e.id),className:(0,iu.cn)("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs whitespace-nowrap transition-all duration-150",n===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(s,{className:"h-3 w-3"}),e.name,(0,F.jsx)("span",{role:"button",onClick:r=>{r.stopPropagation(),a(e.id)},className:"ml-1 hover:text-destructive",children:(0,F.jsx)(i9,{className:"h-3 w-3"})})]},e.id)})}),(0,F.jsx)(ou,{orientation:"horizontal"})]}),(0,F.jsxs)("div",{className:"relative shrink-0",ref:f,children:[(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:g?()=>u(e=>!e):x,children:(0,F.jsx)(nT,{className:"h-3.5 w-3.5"})}),g&&h&&(0,F.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[160px] rounded-md border bg-popover p-1 shadow-md",children:[p&&(0,F.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>_("local"),children:[(0,F.jsx)(nO.Monitor,{className:"h-3.5 w-3.5"}),"Local Terminal"]}),d.map(e=>(0,F.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>_("remote",e.remote_server_id),children:[(0,F.jsx)(nI,{className:"h-3.5 w-3.5"}),e.server_name," Terminal"]},e.remote_server_id))]})]})]}),(0,F.jsx)("div",{className:"flex-1 overflow-hidden bg-zinc-950",children:n?(0,F.jsx)(m9,{terminalId:n,onExit:y},n):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsx)(nB.Terminal,{className:"h-10 w-10 text-muted-foreground/70"})})})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nB.Terminal,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to use the terminal"})]})})}let gt=(0,ic.default)("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"}]]);var[gr,gs]=q("Tooltip",[tK]),gi=tK(),gn="TooltipProvider",go="tooltip.open",[ga,gl]=gr(gn),gc=e=>{let{__scopeTooltip:r,delayDuration:s=700,skipDelayDuration:i=300,disableHoverableContent:n=!1,children:o}=e,a=W.useRef(!0),l=W.useRef(!1),c=W.useRef(0);return W.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,F.jsx)(ga,{scope:r,isOpenDelayedRef:a,delayDuration:s,onOpen:W.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:W.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:W.useCallback(e=>{l.current=e},[]),disableHoverableContent:n,children:o})};gc.displayName=gn;var gd="Tooltip",[gh,gu]=gr(gd),gf=e=>{let{__scopeTooltip:r,children:s,open:i,defaultOpen:n,onOpenChange:o,disableHoverableContent:a,delayDuration:l}=e,c=gl(gd,e.__scopeTooltip),d=gi(r),[h,u]=W.useState(null),f=ej(),p=W.useRef(0),m=a??c.disableHoverableContent,g=l??c.delayDuration,v=W.useRef(!1),[x,_]=X({prop:i,defaultProp:n??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(go))):c.onClose(),o?.(e)},caller:gd}),y=W.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),b=W.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,_(!0)},[_]),w=W.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),S=W.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,_(!0),p.current=0},g)},[g,_]);return W.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,F.jsx)(tV,{...d,children:(0,F.jsx)(gh,{scope:r,contentId:f,open:x,stateAttribute:y,trigger:h,onTriggerChange:u,onTriggerEnter:W.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:W.useCallback(()=>{m?w():(window.clearTimeout(p.current),p.current=0)},[w,m]),onOpen:b,onClose:w,disableHoverableContent:m,children:s})})};gf.displayName=gd;var gp="TooltipTrigger",gm=W.forwardRef((e,r)=>{let{__scopeTooltip:s,...i}=e,n=gu(gp,s),o=gl(gp,s),a=gi(s),l=W.useRef(null),c=(0,U.useComposedRefs)(r,l,n.onTriggerChange),d=W.useRef(!1),h=W.useRef(!1),u=W.useCallback(()=>d.current=!1,[]);return W.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),(0,F.jsx)(tX,{asChild:!0,...a,children:(0,F.jsx)(Z.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...i,ref:c,onPointerMove:K(e.onPointerMove,e=>{"touch"!==e.pointerType&&(h.current||o.isPointerInTransitRef.current||(n.onTriggerEnter(),h.current=!0))}),onPointerLeave:K(e.onPointerLeave,()=>{n.onTriggerLeave(),h.current=!1}),onPointerDown:K(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:K(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:K(e.onBlur,n.onClose),onClick:K(e.onClick,n.onClose)})})});gm.displayName=gp;var gg="TooltipPortal",[gv,gx]=gr(gg,{forceMount:void 0}),g_=e=>{let{__scopeTooltip:r,forceMount:s,children:i,container:n}=e,o=gu(gg,r);return(0,F.jsx)(gv,{scope:r,forceMount:s,children:(0,F.jsx)(t8,{present:s||o.open,children:(0,F.jsx)(t6,{asChild:!0,container:n,children:i})})})};g_.displayName=gg;var gy="TooltipContent",gb=W.forwardRef((e,r)=>{let s=gx(gy,e.__scopeTooltip),{forceMount:i=s.forceMount,side:n="top",...o}=e,a=gu(gy,e.__scopeTooltip);return(0,F.jsx)(t8,{present:i||a.open,children:a.disableHoverableContent?(0,F.jsx)(gj,{side:n,...o,ref:r}):(0,F.jsx)(gw,{side:n,...o,ref:r})})}),gw=W.forwardRef((e,r)=>{let s=gu(gy,e.__scopeTooltip),i=gl(gy,e.__scopeTooltip),n=W.useRef(null),o=(0,U.useComposedRefs)(r,n),[a,l]=W.useState(null),{trigger:c,onClose:d}=s,h=n.current,{onPointerInTransitChange:u}=i,f=W.useCallback(()=>{l(null),u(!1)},[u]),p=W.useCallback((e,r)=>{let s,i=e.currentTarget,n={x:e.clientX,y:e.clientY},o=function(e,r){let s=Math.abs(r.top-e.y),i=Math.abs(r.bottom-e.y),n=Math.abs(r.right-e.x),o=Math.abs(r.left-e.x);switch(Math.min(s,i,n,o)){case o:return"left";case n:return"right";case s:return"top";case i:return"bottom";default:throw Error("unreachable")}}(n,i.getBoundingClientRect());l(((s=[...function(e,r,s=5){let i=[];switch(r){case"top":i.push({x:e.x-s,y:e.y+s},{x:e.x+s,y:e.y+s});break;case"bottom":i.push({x:e.x-s,y:e.y-s},{x:e.x+s,y:e.y-s});break;case"left":i.push({x:e.x+s,y:e.y-s},{x:e.x+s,y:e.y+s});break;case"right":i.push({x:e.x-s,y:e.y-s},{x:e.x-s,y:e.y+s})}return i}(n,o),...function(e){let{top:r,right:s,bottom:i,left:n}=e;return[{x:n,y:r},{x:s,y:r},{x:s,y:i},{x:n,y:i}]}(r.getBoundingClientRect())].slice()).sort((e,r)=>e.x<r.x?-1:e.x>r.x?1:e.y<r.y?-1:1*!!(e.y>r.y)),function(e){if(e.length<=1)return e.slice();let r=[];for(let s=0;s<e.length;s++){let i=e[s];for(;r.length>=2;){let e=r[r.length-1],s=r[r.length-2];if((e.x-s.x)*(i.y-s.y)>=(e.y-s.y)*(i.x-s.x))r.pop();else break}r.push(i)}r.pop();let s=[];for(let r=e.length-1;r>=0;r--){let i=e[r];for(;s.length>=2;){let e=s[s.length-1],r=s[s.length-2];if((e.x-r.x)*(i.y-r.y)>=(e.y-r.y)*(i.x-r.x))s.pop();else break}s.push(i)}return(s.pop(),1===r.length&&1===s.length&&r[0].x===s[0].x&&r[0].y===s[0].y)?r:r.concat(s)}(s))),u(!0)},[u]);return W.useEffect(()=>()=>f(),[f]),W.useEffect(()=>{if(c&&h){let e=e=>p(e,h),r=e=>p(e,c);return c.addEventListener("pointerleave",e),h.addEventListener("pointerleave",r),()=>{c.removeEventListener("pointerleave",e),h.removeEventListener("pointerleave",r)}}},[c,h,p,f]),W.useEffect(()=>{if(a){let e=e=>{let r=e.target,s={x:e.clientX,y:e.clientY},i=c?.contains(r)||h?.contains(r),n=!function(e,r){let{x:s,y:i}=e,n=!1;for(let e=0,o=r.length-1;e<r.length;o=e++){let a=r[e],l=r[o],c=a.x,d=a.y,h=l.x,u=l.y;d>i!=u>i&&s<(h-c)*(i-d)/(u-d)+c&&(n=!n)}return n}(s,a);i?f():n&&(f(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,h,a,d,f]),(0,F.jsx)(gj,{...e,ref:o})}),[gS,gC]=gr(gd,{isInside:!1}),gk=(0,J.createSlottable)("TooltipContent"),gj=W.forwardRef((e,r)=>{let{__scopeTooltip:s,children:i,"aria-label":n,onEscapeKeyDown:o,onPointerDownOutside:a,...l}=e,c=gu(gy,s),d=gi(s),{onClose:h}=c;return W.useEffect(()=>(document.addEventListener(go,h),()=>document.removeEventListener(go,h)),[h]),W.useEffect(()=>{if(c.trigger){let e=e=>{let r=e.target;r?.contains(c.trigger)&&h()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[c.trigger,h]),(0,F.jsx)(ec,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:e=>e.preventDefault(),onDismiss:h,children:(0,F.jsxs)(tQ,{"data-state":c.stateAttribute,...d,...l,ref:r,style:{...l.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,F.jsx)(gk,{children:i}),(0,F.jsx)(gS,{scope:s,isInside:!0,children:(0,F.jsx)(oW,{id:c.contentId,role:"tooltip",children:n||i})})]})})});gb.displayName=gy;var gN="TooltipArrow",gE=W.forwardRef((e,r)=>{let{__scopeTooltip:s,...i}=e,n=gi(s);return gC(gN,s).isInside?null:(0,F.jsx)(t2,{...n,...i,ref:r})});gE.displayName=gN,e.s(["Arrow",()=>gE,"Content",()=>gb,"Portal",()=>g_,"Provider",()=>gc,"Root",()=>gf,"Tooltip",()=>gf,"TooltipArrow",()=>gE,"TooltipContent",()=>gb,"TooltipPortal",()=>g_,"TooltipProvider",()=>gc,"TooltipTrigger",()=>gm,"Trigger",()=>gm,"createTooltipScope",()=>gs],517964);var gR=e.i(517964),gR=gR;function gM({delayDuration:e=0,...r}){return(0,F.jsx)(gR.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...r})}function gD({...e}){return(0,F.jsx)(gR.Root,{"data-slot":"tooltip",...e})}function gT({...e}){return(0,F.jsx)(gR.Trigger,{"data-slot":"tooltip-trigger",...e})}function gP({className:e,sideOffset:r=0,children:s,...i}){return(0,F.jsx)(gR.Portal,{children:(0,F.jsxs)(gR.Content,{"data-slot":"tooltip-content",sideOffset:r,className:(0,iu.cn)("bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...i,children:[s,(0,F.jsx)(gR.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}let gL=(0,W.createContext)(null),gB=({className:e,children:r,defaultUrl:s="",onUrlChange:i,...n})=>{let[o,a]=(0,W.useState)(s),[l,c]=(0,W.useState)(!1);return(0,F.jsx)(gL.Provider,{value:{url:o,setUrl:e=>{a(e),i?.(e)},consoleOpen:l,setConsoleOpen:c},children:(0,F.jsx)("div",{className:(0,iu.cn)("flex size-full flex-col bg-card",e),...n,children:r})})},gA=({className:e,children:r,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("flex items-center gap-1 border-b p-2 h-14",e),...s,children:r}),gO=({onClick:e,disabled:r,tooltip:s,children:i,...n})=>(0,F.jsx)(gM,{children:(0,F.jsxs)(gD,{children:[(0,F.jsx)(gT,{asChild:!0,children:(0,F.jsx)($.Button,{className:"h-8 w-8 p-0 hover:text-foreground",disabled:r,onClick:e,size:"sm",variant:"ghost",...n,children:i})}),(0,F.jsx)(gP,{children:(0,F.jsx)("p",{children:s})})]})}),gI=({value:e,onChange:r,onKeyDown:s,...i})=>{let{url:n,setUrl:o}=(()=>{let e=(0,W.useContext)(gL);if(!e)throw Error("WebPreview components must be used within a WebPreview");return e})(),[a,l]=(0,W.useState)(n);return(0,W.useEffect)(()=>{l(n)},[n]),(0,F.jsx)(nM,{className:"h-8 flex-1 text-sm",onChange:r??(e=>{l(e.target.value),r?.(e)}),onKeyDown:e=>{"Enter"===e.key&&o(e.target.value),s?.(e)},placeholder:"Enter URL...",value:e??a,...i})};var gz=e.i(254824);function gF({projectId:e}){let r=(0,W.useRef)(null),s=(0,W.useRef)(null),{addFrame:i,updateFrameUrl:n,refreshFrame:o,hasFrame:a,claimFrame:l,getFrameUrl:c}=(0,gz.useBrowserFrames)(),d=e?c(e):void 0;(0,W.useEffect)(()=>{if(e&&d&&r.current){let i=setTimeout(()=>{r.current&&(s.current?.(),s.current=l(e,r.current))},50);return()=>{clearTimeout(i),s.current?.(),s.current=null}}return()=>{s.current?.(),s.current=null}},[e,d,l]);let h=(0,W.useCallback)(()=>{e&&o(e)},[e,o]),u=(0,W.useCallback)(()=>{d&&window.open(d,"_blank")},[d]),f=(0,W.useCallback)(r=>{e&&(a(e)?n(e,r):i(e,r))},[e,a,n,i]);return(0,F.jsx)("div",{className:"h-full flex flex-col",children:(0,F.jsxs)(gB,{defaultUrl:d??"",onUrlChange:f,className:"h-full",children:[(0,F.jsxs)(gA,{className:"h-10 p-1.5 gap-0.5",children:[(0,F.jsx)(gO,{tooltip:"Refresh",onClick:h,disabled:!d,children:(0,F.jsx)(mZ,{className:"h-3.5 w-3.5"})}),(0,F.jsx)(gO,{tooltip:"Open in browser",onClick:u,disabled:!d,children:(0,F.jsx)(gt,{className:"h-3.5 w-3.5"})}),(0,F.jsx)(gI,{className:"h-7 text-xs"})]}),d?(0,F.jsx)("div",{ref:r,className:"flex-1 bg-white"}):(0,F.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,F.jsx)(ib,{className:"h-8 w-8 opacity-40"}),(0,F.jsx)("p",{className:"text-sm",children:"Enter a URL above to preview"})]})})]})})}function gW({projectId:e,selectedBranch:r,onMergeRequest:s,project:i,onExecutorModeChange:n,agentSlot:o}){let[a,l]=function(e,r){let s=`vibedeckx:activeTab:${e??"none"}:${r??"main"}`,[i,n]=(0,W.useState)(()=>localStorage.getItem(s)??"agent");return(0,W.useEffect)(()=>{n(localStorage.getItem(s)??"agent")},[s]),[i,(0,W.useCallback)(e=>{n(e),localStorage.setItem(s,e)},[s])]}(e,r);return(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center border-b border-border/60 h-10 px-2 gap-0.5 bg-muted/30",children:[(0,F.jsxs)("button",{onClick:()=>l("agent"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","agent"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(nA,{className:"h-3.5 w-3.5"}),"Agent"]}),(0,F.jsxs)("button",{onClick:()=>l("executors"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","executors"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5"}),"Executors"]}),(0,F.jsxs)("button",{onClick:()=>l("diff"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","diff"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(aU,{className:"h-3.5 w-3.5"}),"Diff"]}),(0,F.jsxs)("button",{onClick:()=>l("terminal"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","terminal"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(aq,{className:"h-3.5 w-3.5"}),"Terminal"]}),(0,F.jsxs)("button",{onClick:()=>l("preview"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","preview"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(ib,{className:"h-3.5 w-3.5"}),"Preview"]})]}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","agent"!==a&&"hidden"),children:o}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","executors"!==a&&"hidden"),children:(0,F.jsx)(mJ,{projectId:e,selectedBranch:r,project:i,onExecutorModeChange:n})}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","diff"!==a&&"hidden"),children:(0,F.jsx)(m7,{projectId:e,selectedBranch:r,onMergeRequest:s,project:i})}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","terminal"!==a&&"hidden"),children:(0,F.jsx)(ge,{projectId:e,selectedBranch:r,project:i})}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","preview"!==a&&"hidden"),children:(0,F.jsx)(gF,{projectId:e,selectedBranch:r,project:i})})]})}var gH=Symbol.for("immer-nothing"),g$=Symbol.for("immer-draftable"),gK=Symbol.for("immer-state");function gU(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var gq=Object.getPrototypeOf;function gV(e){return!!e&&!!e[gK]}function gY(e){return!!e&&(gJ(e)||Array.isArray(e)||!!e[g$]||!!e.constructor?.[g$]||g2(e)||g5(e))}var gX=Object.prototype.constructor.toString(),gG=new WeakMap;function gJ(e){if(!e||"object"!=typeof e)return!1;let r=Object.getPrototypeOf(e);if(null===r||r===Object.prototype)return!0;let s=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;if(s===Object)return!0;if("function"!=typeof s)return!1;let i=gG.get(s);return void 0===i&&(i=Function.toString.call(s),gG.set(s,i)),i===gX}function gZ(e,r,s=!0){0===gQ(e)?(s?Reflect.ownKeys(e):Object.keys(e)).forEach(s=>{r(s,e[s],e)}):e.forEach((s,i)=>r(i,s,e))}function gQ(e){let r=e[gK];return r?r.type_:Array.isArray(e)?1:g2(e)?2:3*!!g5(e)}function g0(e,r){return 2===gQ(e)?e.has(r):Object.prototype.hasOwnProperty.call(e,r)}function g1(e,r,s){let i=gQ(e);2===i?e.set(r,s):3===i?e.add(s):e[r]=s}function g2(e){return e instanceof Map}function g5(e){return e instanceof Set}function g3(e){return e.copy_||e.base_}function g4(e,r){if(g2(e))return new Map(e);if(g5(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let s=gJ(e);if(!0!==r&&("class_only"!==r||s)){let r=gq(e);return null!==r&&s?{...e}:Object.assign(Object.create(r),e)}{let r=Object.getOwnPropertyDescriptors(e);delete r[gK];let s=Reflect.ownKeys(r);for(let i=0;i<s.length;i++){let n=s[i],o=r[n];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[n]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[n]})}return Object.create(gq(e),r)}}function g6(e,r=!1){return g7(e)||gV(e)||!gY(e)||(gQ(e)>1&&Object.defineProperties(e,{set:g8,add:g8,clear:g8,delete:g8}),Object.freeze(e),r&&Object.values(e).forEach(e=>g6(e,!0))),e}var g8={value:function(){gU(2)}};function g7(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var g9={};function ve(e){let r=g9[e];return r||gU(0,e),r}function vt(e,r){r&&(ve("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=r)}function vr(e){vs(e),e.drafts_.forEach(vn),e.drafts_=null}function vs(e){e===I&&(I=e.parent_)}function vi(e){return I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vn(e){let r=e[gK];0===r.type_||1===r.type_?r.revoke_():r.revoked_=!0}function vo(e,r){r.unfinalizedDrafts_=r.drafts_.length;let s=r.drafts_[0];return void 0!==e&&e!==s?(s[gK].modified_&&(vr(r),gU(4)),gY(e)&&(e=va(r,e),r.parent_||vc(r,e)),r.patches_&&ve("Patches").generateReplacementPatches_(s[gK].base_,e,r.patches_,r.inversePatches_)):e=va(r,s,[]),vr(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==gH?e:void 0}function va(e,r,s){if(g7(r))return r;let i=e.immer_.shouldUseStrictIteration(),n=r[gK];if(!n)return gZ(r,(i,o)=>vl(e,n,r,i,o,s),i),r;if(n.scope_!==e)return r;if(!n.modified_)return vc(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;let r=n.copy_,o=r,a=!1;3===n.type_&&(o=new Set(r),r.clear(),a=!0),gZ(o,(i,o)=>vl(e,n,r,i,o,s,a),i),vc(e,r,!1),s&&e.patches_&&ve("Patches").generatePatches_(n,s,e.patches_,e.inversePatches_)}return n.copy_}function vl(e,r,s,i,n,o,a){if(null==n||"object"!=typeof n&&!a)return;let l=g7(n);if(!l||a){if(gV(n)){let a=va(e,n,o&&r&&3!==r.type_&&!g0(r.assigned_,i)?o.concat(i):void 0);if(g1(s,i,a),!gV(a))return;e.canAutoFreeze_=!1}else a&&s.add(n);if(gY(n)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||r&&r.base_&&r.base_[i]===n&&l)return;va(e,n),(!r||!r.scope_.parent_)&&"symbol"!=typeof i&&(g2(s)?s.has(i):Object.prototype.propertyIsEnumerable.call(s,i))&&vc(e,n)}}}function vc(e,r,s=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&g6(r,s)}var vd={get(e,r){if(r===gK)return e;let s=g3(e);if(!g0(s,r)){var i;let n;return i=e,(n=vf(s,r))?"value"in n?n.value:n.get?.call(i.draft_):void 0}let n=s[r];return e.finalized_||!gY(n)?n:n===vu(e.base_,r)?(vm(e),e.copy_[r]=vg(n,e)):n},has:(e,r)=>r in g3(e),ownKeys:e=>Reflect.ownKeys(g3(e)),set(e,r,s){let i=vf(g3(e),r);if(i?.set)return i.set.call(e.draft_,s),!0;if(!e.modified_){let i=vu(g3(e),r),n=i?.[gK];if(n&&n.base_===s)return e.copy_[r]=s,e.assigned_[r]=!1,!0;if((s===i?0!==s||1/s==1/i:s!=s&&i!=i)&&(void 0!==s||g0(e.base_,r)))return!0;vm(e),vp(e)}return!!(e.copy_[r]===s&&(void 0!==s||r in e.copy_)||Number.isNaN(s)&&Number.isNaN(e.copy_[r]))||(e.copy_[r]=s,e.assigned_[r]=!0,!0)},deleteProperty:(e,r)=>(void 0!==vu(e.base_,r)||r in e.base_?(e.assigned_[r]=!1,vm(e),vp(e)):delete e.assigned_[r],e.copy_&&delete e.copy_[r],!0),getOwnPropertyDescriptor(e,r){let s=g3(e),i=Reflect.getOwnPropertyDescriptor(s,r);return i?{writable:!0,configurable:1!==e.type_||"length"!==r,enumerable:i.enumerable,value:s[r]}:i},defineProperty(){gU(11)},getPrototypeOf:e=>gq(e.base_),setPrototypeOf(){gU(12)}},vh={};function vu(e,r){let s=e[gK];return(s?g3(s):e)[r]}function vf(e,r){if(!(r in e))return;let s=gq(e);for(;s;){let e=Object.getOwnPropertyDescriptor(s,r);if(e)return e;s=gq(s)}}function vp(e){!e.modified_&&(e.modified_=!0,e.parent_&&vp(e.parent_))}function vm(e){e.copy_||(e.copy_=g4(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function vg(e,r){let s=g2(e)?ve("MapSet").proxyMap_(e,r):g5(e)?ve("MapSet").proxySet_(e,r):function(e,r){let s=Array.isArray(e),i={type_:+!!s,scope_:r?r.scope_:I,modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},n=i,o=vd;s&&(n=[i],o=vh);let{revoke:a,proxy:l}=Proxy.revocable(n,o);return i.draft_=l,i.revoke_=a,l}(e,r);return(r?r.scope_:I).drafts_.push(s),s}gZ(vd,(e,r)=>{vh[e]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),vh.deleteProperty=function(e,r){return vh.set.call(this,e,r,void 0)},vh.set=function(e,r,s){return vd.set.call(this,e[0],r,s,e[0])};var vv=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,r,s)=>{let i;if("function"==typeof e&&"function"!=typeof r){let s=r;r=e;let i=this;return function(e=s,...n){return i.produce(e,e=>r.call(this,e,...n))}}if("function"!=typeof r&&gU(6),void 0!==s&&"function"!=typeof s&&gU(7),gY(e)){let n=vi(this),o=vg(e,void 0),a=!0;try{i=r(o),a=!1}finally{a?vr(n):vs(n)}return vt(n,s),vo(i,n)}if(e&&"object"==typeof e)gU(1,e);else{if(void 0===(i=r(e))&&(i=e),i===gH&&(i=void 0),this.autoFreeze_&&g6(i,!0),s){let r=[],n=[];ve("Patches").generateReplacementPatches_(e,i,r,n),s(r,n)}return i}},this.produceWithPatches=(e,r)=>{let s,i;return"function"==typeof e?(r,...s)=>this.produceWithPatches(r,r=>e(r,...s)):[this.produce(e,r,(e,r)=>{s=e,i=r}),s,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var r;gY(e)||gU(8),gV(e)&&(gV(r=e)||gU(10,r),e=function e(r){let s;if(!gY(r)||g7(r))return r;let i=r[gK],n=!0;if(i){if(!i.modified_)return i.base_;i.finalized_=!0,s=g4(r,i.scope_.immer_.useStrictShallowCopy_),n=i.scope_.immer_.shouldUseStrictIteration()}else s=g4(r,!0);return gZ(s,(r,i)=>{g1(s,r,e(i))},n),i&&(i.finalized_=!1),s}(r));let s=vi(this),i=vg(e,void 0);return i[gK].isManual_=!0,vs(s),i}finishDraft(e,r){let s=e&&e[gK];s&&s.isManual_||gU(9);let{scope_:i}=s;return vt(i,r),vo(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,r){let s;for(s=r.length-1;s>=0;s--){let i=r[s];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}s>-1&&(r=r.slice(s+1));let i=ve("Patches").applyPatches_;return gV(e)?i(e,r):this.produce(e,e=>i(e,r))}}().produce,vx=e.i(754219);function v_(){return"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}function vy(e){let r={};e&&(r["Content-Type"]=e);let s=(0,iR.getAuthToken)();return s&&(r.Authorization=`Bearer ${s}`),r}async function vb(e,r,s,i){let n=await fetch(`${v_()}/api/projects/${e}/agent-sessions`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({branch:r,permissionMode:s,agentType:i})});if(!n.ok)throw Error("Failed to create session");return n.json()}async function vw(e,r){let s=await fetch(`${v_()}/api/agent-sessions/${e}/message`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({content:r})});if(!s.ok){let r="";try{let e=await s.json();if(e.errorCode){let s=[`${e.errorCode}`];e.attempts&&s.push(`${e.attempts} attempts`),e.totalDurationMs&&s.push(`${(e.totalDurationMs/1e3).toFixed(1)}s`),r=` (${s.join(", ")})`}else e.error&&(r=` — ${e.error}`)}catch{}throw console.error(`[AgentSession] /message failed: status=${s.status}, sessionId=${e}, detail=${r}`),Error(`Failed to send message [${s.status}]${r}`)}}async function vS(e,r){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/restart`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({agentType:r})})).ok)throw Error("Failed to restart session")}async function vC(e){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/stop`,{method:"POST",headers:vy()})).ok)throw Error("Failed to stop session")}async function vk(e,r){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/switch-mode`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({mode:r})})).ok)throw Error("Failed to switch mode")}async function vj(e,r){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/accept-plan`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({planContent:r})})).ok)throw Error("Failed to accept plan")}let vN=new Map;function vE(e,r){return`${e}:${r??""}`}let vR=(0,ic.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),vM=(0,ic.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),vD=(0,ic.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),vT=(0,ic.default)("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"}]]),vP=(0,ic.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),vL=(0,ic.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),vB=(0,ic.default)("file-check",[["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:"m9 15 2 2 4-4",key:"1grp1n"}]]),vA=(0,ic.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),vO=(0,ic.default)("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"}]]),vI=(0,ic.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),vz=(0,ic.default)("folder-search",[["path",{d:"M10.7 20H4a2 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.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]),vF=(0,ic.default)("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"}]]),vW=(0,ic.default)("file-pen-line",[["path",{d:"m18.226 5.226-2.52-2.52A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.351",key:"1k2beg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]),vH=(0,ic.default)("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"}]]),v$=(0,ic.default)("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"}]]),vK=(0,ic.default)("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),vU=(0,ic.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var vq="horizontal",vV=["horizontal","vertical"],vY=W.forwardRef((e,r)=>{var s;let{decorative:i,orientation:n=vq,...o}=e,a=(s=n,vV.includes(s))?n:vq;return(0,F.jsx)(Z.div,{"data-orientation":a,...i?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...o,ref:r})});vY.displayName="Separator",e.s(["Root",()=>vY,"Separator",()=>vY],691102),e.i(691102),(0,lo.cva)("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),(0,ic.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var vX=e.i(94265);let vG=({className:e,from:r,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("group flex w-full max-w-[95%] flex-col gap-2","user"===r?"is-user ml-auto justify-end":"is-assistant",e),...s}),vJ=({children:e,className:r,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",r),...s,children:e}),vZ=(0,W.memo)(({className:e,...r})=>(0,F.jsx)(vX.i,{className:(0,iu.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...r}),(e,r)=>e.children===r.children);function vQ({input:e,messageIndex:r}){let{sendMessage:s,messages:i}=yx(),n=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&Array.isArray(r.questions)&&r.questions.length>0&&r.questions.every(e=>"string"==typeof e.question&&"string"==typeof e.header&&Array.isArray(e.options)))return r}catch{}return null}(e),o=i[r+1],a=o?.type==="user",l=a?o.content:"",c="string"==typeof l?l:l.filter(e=>"text"===e.type).map(e=>e.text).join("\n");if(!n){let r="string"==typeof e?e:JSON.stringify(e,null,2);return(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r.length>500?r.substring(0,500)+"...":r})}return a?(0,F.jsx)(v0,{questions:n.questions,answeredText:c}):(0,F.jsx)(v1,{questions:n.questions,sendMessage:s})}function v0({questions:e,answeredText:r}){return(0,F.jsx)("div",{className:"space-y-3 mt-2",children:e.map((e,s)=>(0,F.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-3",children:[(0,F.jsx)("div",{className:"flex items-center gap-2 mb-1.5",children:(0,F.jsx)(ll,{variant:"secondary",className:"text-[10px]",children:e.header})}),(0,F.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.question}),(0,F.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[(0,F.jsx)(ok,{className:"h-4 w-4"}),(0,F.jsx)("span",{className:"font-medium",children:r})]})]},s))})}function v1({questions:e,sendMessage:r}){let[s,i]=(0,W.useState)(new Map),[n,o]=(0,W.useState)(new Map),[a,l]=(0,W.useState)(new Set),[c,d]=(0,W.useState)(!1);async function h(){let i=[];for(let r=0;r<e.length;r++)if(a.has(r)){let e=n.get(r)?.trim();e&&i.push(e)}else{let e=s.get(r);e&&e.size>0&&i.push(Array.from(e).join(", "))}if(i.length>0){d(!0);try{await r(i.join("\n"))}finally{d(!1)}}}let u=e.some((e,r)=>{if(a.has(r))return!!n.get(r)?.trim();let i=s.get(r);return i&&i.size>0});return(0,F.jsxs)("div",{className:"space-y-4 mt-2",children:[e.map((e,r)=>{let c=s.get(r)||new Set,d=n.get(r)||"",h=a.has(r);return(0,F.jsxs)("div",{className:"rounded-lg border bg-card p-3",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,F.jsx)(vL,{className:"h-3.5 w-3.5 text-violet-500"}),(0,F.jsx)(ll,{variant:"secondary",className:"text-[10px]",children:e.header})]}),(0,F.jsx)("p",{className:"text-sm font-medium mb-3",children:e.question}),(0,F.jsxs)("div",{className:"grid gap-2",children:[e.options.map(s=>{let n=c.has(s.label)&&!h;return(0,F.jsx)($.Button,{variant:n?"default":"outline",className:(0,iu.cn)("h-auto py-2 px-3 justify-start text-left whitespace-normal",n&&"ring-2 ring-primary/50"),onClick:()=>{var n,o;return n=s.label,o=e.multiSelect,void(i(e=>{let s=new Map(e),i=new Set(s.get(r)||[]);return o?i.has(n)?i.delete(n):i.add(n):i.has(n)?i.clear():(i.clear(),i.add(n)),s.set(r,i),s}),l(e=>{let s=new Set(e);return s.delete(r),s}))},children:(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"font-medium text-sm",children:s.label}),s.description&&(0,F.jsx)("span",{className:"block text-xs text-muted-foreground mt-0.5",children:s.description})]})},s.label)}),(0,F.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,F.jsx)(nM,{placeholder:"Other...",value:d,onChange:e=>{var s;return s=e.target.value,void(o(e=>new Map(e).set(r,s)),s&&(i(e=>{let s=new Map(e);return s.set(r,new Set),s}),l(e=>new Set(e).add(r))))},className:"text-sm"})})]})]},r)}),(0,F.jsxs)($.Button,{onClick:h,disabled:!u||c,size:"sm",className:"active:scale-95 transition-transform",children:[c&&(0,F.jsx)(iE,{className:"h-3.5 w-3.5 animate-spin"}),c?"Submitting...":"Submit"]})]})}function v2(e){try{return JSON.parse(e)}catch{return null}}function v5({input:e,messageIndex:r}){let{messages:s,acceptPlan:i,permissionMode:n,agentType:o}=yx(),[a,l]=(0,W.useState)(!0),[c,d]=(0,W.useState)(!1),h=function(e,r,s){let i="string"==typeof e?v2(e):e;if(i&&"object"==typeof i&&"plan"in i){let e=i.plan;if(e)return e}if("claude-code"===s)for(let e=r.length-1;e>=0;e--){let s=r[e];if("tool_use"===s.type&&"Write"===s.tool){let e="string"==typeof s.input?v2(s.input):s.input;if(e&&"object"==typeof e&&e.file_path?.includes(".claude/plans/")&&e.content)return e.content}}return"Plan written to file"}(e,s,o),u=(0,W.useCallback)(async()=>{d(!0);try{await i(h)}catch{d(!1)}},[i,h]),f="edit"===n,p=!1,m="";for(let e=r+1;e<s.length;e++){let r=s[e];if(r?.type==="user"){p=!0;let e=r.content??"";m="string"==typeof e?e:e.filter(e=>"text"===e.type).map(e=>e.text).join("\n");break}}return(f&&!p&&(p=!0),f||p)?(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[f?(0,F.jsxs)(ll,{variant:"default",className:"bg-green-600 hover:bg-green-700 text-white",children:[(0,F.jsx)(ok,{className:"h-3 w-3 mr-1"}),"Plan Accepted"]}):(0,F.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,F.jsx)(f3,{className:"h-3.5 w-3.5"}),(0,F.jsxs)("span",{children:["Feedback sent: ",m.length>100?m.substring(0,100)+"...":m]})]}),(0,F.jsxs)("details",{open:!f,children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"View Plan"}),(0,F.jsx)("div",{className:"mt-2 rounded-lg border p-3 bg-muted/30",children:(0,F.jsx)("div",{className:"text-sm prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words",children:(0,F.jsx)(vZ,{children:h})})})]})]}):(0,F.jsxs)("div",{className:"space-y-3 mt-2",children:[(0,F.jsxs)("div",{className:"rounded-lg border p-3 bg-card",children:[(0,F.jsxs)("button",{onClick:()=>l(!a),className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground mb-2 block",children:[a?"Collapse":"Expand"," Plan"]}),a&&(0,F.jsx)("div",{className:"text-sm prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words max-h-96 overflow-y-auto",children:(0,F.jsx)(vZ,{children:h})})]}),(0,F.jsxs)($.Button,{onClick:u,disabled:c,className:"bg-green-600 hover:bg-green-700 text-white",size:"sm",children:[c?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):(0,F.jsx)(iC,{className:"h-3.5 w-3.5 mr-1.5"}),c?"Accepting Plan...":"Accept Plan & Start Editing"]})]})}function v3({requestId:e,command:r,cwd:s,messageIndex:i}){let{messages:n,sessionId:o}=yx(),[a,l]=(0,W.useState)(!1),[c,d]=(0,W.useState)(null),h=!1;for(let e=i+1;e<n.length;e++)if(n[e]?.type==="user"){h=!0;break}c&&(h=!0);let u=(0,W.useCallback)(async r=>{if(o){l(!0),d(r);try{await (0,iR.sendApprovalResponse)(o,e,r)}catch{d(null),l(!1)}}},[o,e]);return h?(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[(0,F.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-3",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"Command"})]}),(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r||"(empty)"}),s&&(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["cwd: ",s]})]}),(0,F.jsxs)(ll,{variant:"default",className:"decline"===c?"bg-red-600 hover:bg-red-700 text-white":"bg-green-600 hover:bg-green-700 text-white",children:[(0,F.jsx)(ok,{className:"h-3 w-3 mr-1"}),"decline"===c?"Denied":"Allowed"]})]}):(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[(0,F.jsxs)("div",{className:"rounded-lg border bg-card p-3",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"Command"})]}),(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r||"(empty)"}),s&&(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["cwd: ",s]})]}),(0,F.jsxs)("div",{className:"flex gap-2",children:[(0,F.jsxs)($.Button,{onClick:()=>u("accept"),disabled:a,className:"bg-green-600 hover:bg-green-700 text-white",size:"sm",children:[a&&"accept"===c?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(ok,{className:"h-3.5 w-3.5 mr-1"}),"Allow"]}),(0,F.jsxs)($.Button,{onClick:()=>u("decline"),disabled:a,variant:"destructive",size:"sm",children:[a&&"decline"===c?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(nc,{className:"h-3.5 w-3.5 mr-1"}),"Deny"]})]})]})}function v4({requestId:e,changes:r,messageIndex:s}){let{messages:i,sessionId:n}=yx(),[o,a]=(0,W.useState)(!1),[l,c]=(0,W.useState)(null),d=!1;for(let e=s+1;e<i.length;e++)if(i[e]?.type==="user"){d=!0;break}l&&(d=!0);let h=(0,W.useCallback)(async r=>{if(n){a(!0),c(r);try{await (0,iR.sendApprovalResponse)(n,e,r)}catch{c(null),a(!1)}}},[n,e]),u=r??[],f=()=>(0,F.jsx)("div",{className:"rounded-lg border bg-muted/30 p-3 space-y-2",children:0===u.length?(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"No file changes"}):u.map((e,r)=>(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(vO,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),(0,F.jsx)("code",{className:"text-xs break-all",children:e.path}),(0,F.jsx)(ll,{variant:"secondary",className:`text-[10px] ${function(e){switch(e){case"added":case"add":return"bg-green-500/10 text-green-600";case"deleted":case"delete":return"bg-red-500/10 text-red-600";default:return"bg-blue-500/10 text-blue-600"}}(e.kind)}`,children:function(e){switch(e){case"added":case"add":return"added";case"deleted":case"delete":return"deleted";default:return"modified"}}(e.kind)})]}),e.diff&&(0,F.jsxs)("details",{className:"mt-1",children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"View diff"}),(0,F.jsx)("pre",{className:"mt-1 text-xs p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.diff.split("\n").map((e,r)=>{let s="";return e.startsWith("+")?s="bg-green-500/10 text-green-700 dark:text-green-400":e.startsWith("-")&&(s="bg-red-500/10 text-red-700 dark:text-red-400"),(0,F.jsx)("div",{className:s,children:e},r)})})]})]},r))});return d?(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[f(),(0,F.jsxs)(ll,{variant:"default",className:"decline"===l?"bg-red-600 hover:bg-red-700 text-white":"bg-green-600 hover:bg-green-700 text-white",children:[(0,F.jsx)(ok,{className:"h-3 w-3 mr-1"}),"decline"===l?"Denied":"Allowed"]})]}):(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[f(),(0,F.jsxs)("div",{className:"flex gap-2",children:[(0,F.jsxs)($.Button,{onClick:()=>h("accept"),disabled:o,className:"bg-green-600 hover:bg-green-700 text-white",size:"sm",children:[o&&"accept"===l?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(ok,{className:"h-3.5 w-3.5 mr-1"}),"Allow"]}),(0,F.jsxs)($.Button,{onClick:()=>h("decline"),disabled:o,variant:"destructive",size:"sm",children:[o&&"decline"===l?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(nc,{className:"h-3.5 w-3.5 mr-1"}),"Deny"]})]})]})}vZ.displayName="MessageResponse";let v6=(0,ic.default)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var v8=e.i(252512);let v7=(0,ic.default)("badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);function v9({status:e,className:r}){switch(e){case"completed":return(0,F.jsx)(ok,{className:(0,iu.cn)("h-4 w-4 text-green-500",r)});case"in_progress":return(0,F.jsx)(iE,{className:(0,iu.cn)("h-4 w-4 text-cyan-500 animate-spin",r)});case"pending":default:return(0,F.jsx)(ih,{className:(0,iu.cn)("h-4 w-4 text-muted-foreground",r)});case"deleted":return(0,F.jsx)(nc,{className:(0,iu.cn)("h-4 w-4 text-red-400",r)})}}function xe(e,r){try{let s="string"==typeof e?JSON.parse(e):e;if(s&&"object"==typeof s&&r(s))return s}catch{}return null}function xt({input:e}){let r="string"==typeof e?e:JSON.stringify(e,null,2);return(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r.length>500?r.substring(0,500)+"...":r})}function xr({input:e}){let r=xe(e,e=>Array.isArray(e.todos)&&e.todos.length>0);return r?(0,F.jsx)("div",{className:"mt-2 space-y-1",children:r.todos.map((e,r)=>(0,F.jsxs)("div",{className:"flex items-start gap-2 py-0.5",children:[(0,F.jsx)(v9,{status:e.status,className:"mt-0.5 flex-shrink-0"}),(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:(0,iu.cn)("text-sm break-words","completed"===e.status&&"line-through text-muted-foreground"),children:e.subject??e.content??"Untitled task"}),"in_progress"===e.status&&e.activeForm&&(0,F.jsx)("span",{className:"block text-xs italic text-cyan-500",children:e.activeForm})]})]},e.id??r))}):(0,F.jsx)(xt,{input:e})}function xs({input:e}){let r=xe(e,e=>"string"==typeof e.subject);return r?(0,F.jsxs)("div",{className:"mt-2 flex items-start gap-2",children:[(0,F.jsx)(v6,{className:"h-4 w-4 text-cyan-500 mt-0.5 flex-shrink-0"}),(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-words",children:r.subject}),r.description&&(0,F.jsx)("span",{className:"block text-xs text-muted-foreground mt-0.5 break-words",children:r.description.length>200?r.description.substring(0,200)+"...":r.description})]})]}):(0,F.jsx)(xt,{input:e})}function xi({input:e}){let r=xe(e,e=>"string"==typeof e.taskId);return r?(0,F.jsxs)("div",{className:"mt-2 flex items-start gap-2 flex-wrap",children:[r.status?(0,F.jsx)(v9,{status:r.status,className:"mt-0.5 flex-shrink-0"}):(0,F.jsx)(v8.ArrowRight,{className:"h-4 w-4 text-cyan-500 mt-0.5 flex-shrink-0"}),(0,F.jsxs)("span",{className:"text-sm break-words",children:["Task #",r.taskId,r.status&&(0,F.jsxs)(F.Fragment,{children:[" ",(0,F.jsx)(v8.ArrowRight,{className:"inline h-3 w-3 text-muted-foreground mx-0.5"})," ",r.status]}),r.subject&&(0,F.jsxs)("span",{className:"text-muted-foreground",children:[" — ",r.subject]})]}),r.addBlockedBy&&r.addBlockedBy.length>0&&(0,F.jsx)("div",{className:"flex gap-1 mt-1 w-full pl-6",children:r.addBlockedBy.map(e=>(0,F.jsxs)(ll,{variant:"outline",className:"text-[10px]",children:[(0,F.jsx)(v7,{className:"h-2.5 w-2.5 mr-0.5"}),"blocked by #",e]},e))}),r.addBlocks&&r.addBlocks.length>0&&(0,F.jsx)("div",{className:"flex gap-1 mt-1 w-full pl-6",children:r.addBlocks.map(e=>(0,F.jsxs)(ll,{variant:"outline",className:"text-[10px]",children:[(0,F.jsx)(v7,{className:"h-2.5 w-2.5 mr-0.5"}),"blocks #",e]},e))})]}):(0,F.jsx)(xt,{input:e})}function xn(){return(0,F.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-sm text-muted-foreground",children:[(0,F.jsx)(iE,{className:"h-4 w-4 animate-spin text-cyan-500"}),(0,F.jsx)("span",{children:"Listing tasks..."})]})}function xo({input:e}){let r=xe(e,e=>"string"==typeof e.taskId);return r?(0,F.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-sm text-muted-foreground",children:[(0,F.jsx)(iE,{className:"h-4 w-4 animate-spin text-cyan-500"}),(0,F.jsxs)("span",{children:["Fetching task #",r.taskId,"..."]})]}):(0,F.jsx)(xt,{input:e})}function xa({output:e}){let r=function(e){try{let r=JSON.parse(e);if(Array.isArray(r))return r.filter(e=>e.id&&e.subject).map(e=>({id:String(e.id),subject:String(e.subject),status:e.status||"pending",owner:e.owner?String(e.owner):void 0,blockedBy:Array.isArray(e.blockedBy)?e.blockedBy.map(String):void 0}));let s=r.tasks??r.items??r.data;if(Array.isArray(s))return s.filter(e=>e.id&&e.subject).map(e=>({id:String(e.id),subject:String(e.subject),status:e.status||"pending",owner:e.owner?String(e.owner):void 0,blockedBy:Array.isArray(e.blockedBy)?e.blockedBy.map(String):void 0}))}catch{let r=e.trim().split("\n").filter(Boolean),s=[];for(let e of r){let r=e.match(/^#?(\d+)[\s.:\-]+\[?(completed|in_progress|pending|deleted)\]?\s+(.+)/i);r&&s.push({id:r[1],status:r[2].toLowerCase(),subject:r[3].trim()})}if(s.length>0)return s}return null}(e);return r?(0,F.jsx)("div",{className:"mt-1 space-y-1",children:r.map(e=>(0,F.jsxs)("div",{className:"flex items-start gap-2 py-0.5",children:[(0,F.jsx)(v9,{status:e.status,className:"mt-0.5 flex-shrink-0"}),(0,F.jsxs)("div",{className:"min-w-0 flex items-center gap-1.5 flex-wrap",children:[(0,F.jsxs)("span",{className:"text-xs text-muted-foreground",children:["#",e.id]}),(0,F.jsx)("span",{className:(0,iu.cn)("text-sm break-words","completed"===e.status&&"line-through text-muted-foreground"),children:e.subject}),e.blockedBy&&e.blockedBy.length>0&&(0,F.jsx)(ll,{variant:"outline",className:"text-[10px]",children:"blocked"})]})]},e.id))}):null}function xl({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.file_path)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{file_path:s,offset:i,limit:n}=r,o=s.split("/"),a=o.pop()||s,l=o.join("/"),c=null!=i||null!=n,d="";if(c){let e=i??1;d=null!=n?`Lines ${e}\u2013${e+n-1}`:`From line ${e}`}return(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-all",children:a}),l&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:s,children:l})]}),c&&(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:d})]})}function xc({output:e}){let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["File contents (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xd({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.file_path)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{file_path:s,content:i}=r,n=s.split("/"),o=n.pop()||s,a=n.join("/"),l=i.split("\n").length;return(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-all",children:o}),a&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:s,children:a})]}),(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Content (",l," ",1===l?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:i.length>1e3?i.substring(0,1e3)+"...":i})]})]})}function xh({output:e}){return e&&""!==e.trim()?(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Result"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]}):(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"File written"})}function xu({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.command)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{command:s,description:i,timeout:n}=r;return(0,F.jsxs)("div",{className:"space-y-1",children:[i&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),(0,F.jsxs)("div",{className:"flex items-start gap-2",children:[(0,F.jsxs)("pre",{className:"flex-1 min-w-0 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-muted-foreground select-none",children:"$ "}),s]}),null!=n&&(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0 mt-1",children:function(e){if(e>=6e4){let r=e/6e4;return`${r%1==0?r:r.toFixed(1)}m`}return`${e/1e3}s`}(n)})]})]})}function xf({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Output (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xp({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.pattern)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let s=[];return r.path&&s.push({label:r.path}),r.glob&&s.push({label:r.glob}),r.type&&s.push({label:`.${r.type}`}),r.output_mode&&"files_with_matches"!==r.output_mode&&s.push({label:r.output_mode}),null!=r.context&&s.push({label:`context: ${r.context}`}),null!=r["-C"]&&s.push({label:`context: ${r["-C"]}`}),null!=r["-B"]&&s.push({label:`before: ${r["-B"]}`}),null!=r["-A"]&&s.push({label:`after: ${r["-A"]}`}),r["-i"]&&s.push({label:"case-insensitive"}),r.multiline&&s.push({label:"multiline"}),null!=r.head_limit&&s.push({label:`limit: ${r.head_limit}`}),null!=r.offset&&s.push({label:`offset: ${r.offset}`}),(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("div",{className:"flex items-start gap-2",children:(0,F.jsxs)("pre",{className:"flex-1 min-w-0 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-muted-foreground select-none",children:"/ "}),r.pattern]})}),s.length>0&&(0,F.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:s.map((e,r)=>(0,F.jsx)(ll,{variant:"outline",className:"text-xs",children:e.label},r))})]})}function xm({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No matches"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Results (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xg({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.pattern)return r;return null}catch{return null}}(e);return r?(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("div",{className:"flex items-start gap-2",children:(0,F.jsx)("pre",{className:"flex-1 min-w-0 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r.pattern})}),r.path&&(0,F.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:(0,F.jsx)(ll,{variant:"outline",className:"text-xs",children:r.path})})]}):(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)})}function xv({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No matches"});let r=e.trim().split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:[r," ",1===r?"file":"files"," found"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}let xx={Explore:"Explore",Bash:"Bash",Plan:"Plan","general-purpose":"General","code-simplifier":"Simplify","superpowers:code-reviewer":"Review","memory-leak-detector":"Memory","directory-structure-validator":"Structure","tech-docs-finder":"Docs","claude-code-guide":"Guide","statusline-setup":"Status"};function x_({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.description&&"string"==typeof r.subagent_type)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{description:s,subagent_type:i,prompt:n,model:o,max_turns:a,resume:l,run_in_background:c}=r,d=[];return d.push({label:xx[i]||i}),o&&d.push({label:o}),null!=a&&d.push({label:`${a} turns`}),c&&d.push({label:"background"}),l&&d.push({label:"resume"}),(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsx)("span",{className:"text-sm",children:s}),d.map((e,r)=>(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:e.label},r))]}),n&&(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Prompt (",n.length>1e3?`${Math.round(n.length/1e3)}k chars`:`${n.length} chars`,")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:n.length>1e3?n.substring(0,1e3)+"...":n})]})]})}function xy({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Agent result (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xb(e,r){return e.length>r?e.substring(0,r)+"...":e}function xw({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.file_path&&"string"==typeof r.old_string&&"string"==typeof r.new_string)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{file_path:s,old_string:i,new_string:n,replace_all:o}=r,a=s.split("/"),l=a.pop()||s,c=a.join("/"),d=i.split("\n").length,h=n.split("\n").length;return(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-all",children:l}),c&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:s,children:c})]}),(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:d===h?`${d} ${1===d?"line":"lines"}`:`${d}\u2192${h} lines`}),o&&(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:"replace all"})]}),(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Diff"}),(0,F.jsxs)("div",{className:"mt-1 text-xs rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full",children:[(0,F.jsxs)("pre",{className:"bg-red-500/10 p-1.5 rounded-t whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-red-500 select-none",children:"- "}),xb(i,500)]}),(0,F.jsxs)("pre",{className:"bg-green-500/10 p-1.5 rounded-b whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-green-500 select-none",children:"+ "}),xb(n,500)]})]})]})]})}function xS({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});if(e.length<=200)return(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:e});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Result (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xC({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.url&&"string"==typeof r.prompt)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{display:s,href:i}=function(e){try{let r=new URL(e),s="/"===r.pathname?"":r.pathname,i=r.hostname+s;return{display:i.length>80?i.substring(0,77)+"...":i,href:e}}catch{return{display:e.length>80?e.substring(0,77)+"...":e,href:e}}}(r.url),n=r.prompt.length>150?r.prompt.substring(0,147)+"...":r.prompt;return(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"block text-xs font-mono text-blue-500 hover:underline truncate",children:s}),(0,F.jsxs)("p",{className:"text-xs text-muted-foreground",children:['"',n,'"']})]})}function xk({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No content fetched"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Response (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xj({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.query)return r;return null}catch{return null}}(e);return r?(0,F.jsxs)("div",{className:"space-y-1.5",children:[(0,F.jsx)("p",{className:"text-xs font-mono bg-muted/50 px-2 py-1 rounded break-words",children:r.query}),r.allowed_domains&&r.allowed_domains.length>0&&(0,F.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"only:"}),r.allowed_domains.map(e=>(0,F.jsx)(ll,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:e},e))]}),r.blocked_domains&&r.blocked_domains.length>0&&(0,F.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"exclude:"}),r.blocked_domains.map(e=>(0,F.jsx)(ll,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:e},e))]})]}):(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)})}function xN({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No search results"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Results (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xE({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.skill)return r;return null}catch{return null}}(e);return r?(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("p",{className:"text-xs font-mono text-pink-500",children:r.skill}),r.args&&(0,F.jsxs)("p",{className:"text-xs text-muted-foreground truncate",children:["args: ",r.args]})]}):(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)})}function xR({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Loaded (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xM({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.task_id)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{task_id:s,block:i,timeout:n}=r,o=[];return o.push({label:!1===i?"non-blocking":"blocking"}),null!=n&&o.push({label:`${Math.round(n/1e3)}s`}),(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsx)("code",{className:"text-sm bg-muted/50 px-1.5 py-0.5 rounded",children:s}),o.map((e,r)=>(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:e.label},r))]})}function xD({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Task output (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xT({input:e}){let r="string"==typeof e?function(e){try{return JSON.parse(e)}catch{return null}}(e):e,s=r?.changes??[];return 0===s.length?(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"No file changes"}):(0,F.jsx)("div",{className:"space-y-2 mt-1",children:s.map((e,r)=>(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(vO,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),(0,F.jsx)("code",{className:"text-xs break-all",children:e.path}),(0,F.jsx)(ll,{variant:"secondary",className:`text-[10px] ${function(e){switch(e){case"added":case"add":return"bg-green-500/10 text-green-600";case"deleted":case"delete":return"bg-red-500/10 text-red-600";default:return"bg-blue-500/10 text-blue-600"}}(e.kind)}`,children:function(e){switch(e){case"added":case"add":return"added";case"deleted":case"delete":return"deleted";default:return"modified"}}(e.kind)})]}),e.diff&&(0,F.jsxs)("details",{className:"mt-1",children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"View diff"}),(0,F.jsx)("pre",{className:"mt-1 text-xs p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.diff.split("\n").map((e,r)=>{let s="";return e.startsWith("+")?s="bg-green-500/10 text-green-700 dark:text-green-400":e.startsWith("-")&&(s="bg-red-500/10 text-red-700 dark:text-red-400"),(0,F.jsx)("div",{className:s,children:e},r)})})]})]},r))})}function xP({output:e}){let r=e.toLowerCase(),s="text-muted-foreground";return r.includes("completed")||r.includes("success")?s="text-green-600 dark:text-green-400":r.includes("failed")||r.includes("error")?s="text-red-600 dark:text-red-400":(r.includes("declined")||r.includes("denied"))&&(s="text-amber-600 dark:text-amber-400"),(0,F.jsx)("p",{className:`text-xs ${s}`,children:e})}function xL({message:e,messageIndex:r}){switch(e.type){case"user":return(0,F.jsx)(xB,{content:e.content});case"assistant":return(0,F.jsx)(xA,{content:e.content});case"tool_use":return(0,F.jsx)(xO,{tool:e.tool,input:e.input,messageIndex:r});case"tool_result":return(0,F.jsx)(xI,{tool:e.tool,output:e.output});case"thinking":return(0,F.jsx)(xz,{content:e.content});case"error":return(0,F.jsx)(xF,{message:e.message});case"system":return(0,F.jsx)(xW,{content:e.content});case"approval_request":return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-amber-500/10 flex items-center justify-center",children:(0,F.jsx)(vU,{className:"w-4 h-4 text-amber-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-amber-500 mb-1",children:"command"===e.requestType?"Command Approval":"File Change Approval"}),"command"===e.requestType?(0,F.jsx)(v3,{requestId:e.requestId,command:e.command,cwd:e.cwd,messageIndex:r}):(0,F.jsx)(v4,{requestId:e.requestId,changes:e.changes,messageIndex:r})]})]});default:return null}}function xB({content:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,F.jsx)(vR,{className:"w-3.5 h-3.5 text-primary"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:"You"}),(0,F.jsx)("div",{className:"text-sm text-foreground prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words",children:"string"==typeof e?(0,F.jsx)(vZ,{children:e??""}):e.map((e,r)=>"text"===e.type?(0,F.jsx)(vZ,{children:e.text},r):(0,F.jsx)("img",{src:`data:${e.mediaType};base64,${e.data}`,alt:"Attached image",className:"max-w-sm rounded-lg mt-2"},r))})]})]})}function xA({content:e}){let r="codex"===function(){try{return yx().agentType}catch{return"claude-code"}}();return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:`flex-shrink-0 w-7 h-7 rounded-lg ${r?"bg-green-500/10":"bg-violet-500/10"} flex items-center justify-center`,children:(0,F.jsx)(nA,{className:`w-3.5 h-3.5 ${r?"text-green-500":"text-violet-500"}`})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:`text-sm font-medium ${r?"text-green-500":"text-violet-500"} mb-1`,children:r?"Codex":"Claude"}),(0,F.jsx)("div",{className:"text-sm text-foreground prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words",children:(0,F.jsx)(vZ,{children:e??""})})]})]})}function xO({tool:e,input:r,messageIndex:s}){if("AskUserQuestion"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-violet-500/10 flex items-center justify-center",children:(0,F.jsx)(vL,{className:"w-4 h-4 text-violet-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-violet-500 mb-1",children:"Question"}),(0,F.jsx)(vQ,{input:r,messageIndex:s})]})]});if("ExitPlanMode"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-green-500/10 flex items-center justify-center",children:(0,F.jsx)(vB,{className:"w-4 h-4 text-green-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-green-500 mb-1",children:"Plan Ready"}),(0,F.jsx)(v5,{input:r,messageIndex:s})]})]});let i={TodoWrite:{label:"Tasks",ui:(0,F.jsx)(xr,{input:r})},TaskCreate:{label:"Create Task",ui:(0,F.jsx)(xs,{input:r})},TaskUpdate:{label:"Update Task",ui:(0,F.jsx)(xi,{input:r})},TaskList:{label:"Task List",ui:(0,F.jsx)(xn,{})},TaskGet:{label:"Get Task",ui:(0,F.jsx)(xo,{input:r})}}[e];if(i)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-cyan-500/10 flex items-center justify-center",children:(0,F.jsx)(vA,{className:"w-4 h-4 text-cyan-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-cyan-500 mb-1",children:i.label}),i.ui]})]});if("Read"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(vO,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"Read File"}),(0,F.jsx)(xl,{input:r})]})]});if("Edit"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(vW,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"Edit File"}),(0,F.jsx)(xw,{input:r})]})]});if("Write"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(v$,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"Write File"}),(0,F.jsx)(xd,{input:r})]})]});if("Bash"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-emerald-500/10 flex items-center justify-center",children:(0,F.jsx)(nB.Terminal,{className:"w-4 h-4 text-emerald-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-emerald-500 mb-1",children:"Run Command"}),(0,F.jsx)(xu,{input:r})]})]});if("Grep"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-orange-500/10 flex items-center justify-center",children:(0,F.jsx)(vI,{className:"w-4 h-4 text-orange-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-orange-500 mb-1",children:"Search"}),(0,F.jsx)(xp,{input:r})]})]});if("Glob"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-teal-500/10 flex items-center justify-center",children:(0,F.jsx)(vz,{className:"w-4 h-4 text-teal-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-teal-500 mb-1",children:"Glob"}),(0,F.jsx)(xg,{input:r})]})]});if("Task"===e||"Agent"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-purple-500/10 flex items-center justify-center",children:(0,F.jsx)(vF,{className:"w-4 h-4 text-purple-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-purple-500 mb-1",children:"Agent"}),(0,F.jsx)(x_,{input:r})]})]});if("TaskOutput"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-purple-500/10 flex items-center justify-center",children:(0,F.jsx)(vF,{className:"w-4 h-4 text-purple-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-purple-500 mb-1",children:"Task Output"}),(0,F.jsx)(xM,{input:r})]})]});if("WebFetch"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-blue-500/10 flex items-center justify-center",children:(0,F.jsx)(ib,{className:"w-4 h-4 text-blue-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-blue-500 mb-1",children:"Fetch Web Page"}),(0,F.jsx)(xC,{input:r})]})]});if("WebSearch"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-indigo-500/10 flex items-center justify-center",children:(0,F.jsx)(vK,{className:"w-4 h-4 text-indigo-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-indigo-500 mb-1",children:"Web Search"}),(0,F.jsx)(xj,{input:r})]})]});if("Skill"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-pink-500/10 flex items-center justify-center",children:(0,F.jsx)(vH,{className:"w-4 h-4 text-pink-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-pink-500 mb-1",children:"Skill"}),(0,F.jsx)(xE,{input:r})]})]});if("FileChange"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(vW,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"File Changes"}),(0,F.jsx)(xT,{input:r})]})]});let n="string"==typeof r?r:JSON.stringify(r,null,2);return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-amber-500/10 flex items-center justify-center",children:(0,F.jsx)(vM,{className:"w-4 h-4 text-amber-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsxs)("p",{className:"text-sm font-medium text-amber-500 mb-1 break-words",children:["Tool: ",e]}),(0,F.jsxs)("details",{open:!0,children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Input"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:n.length>500?n.substring(0,500)+"...":n})]})]})]})}function xI({tool:e,output:r}){if(["TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"].includes(e)){let s="TaskList"===e?(0,F.jsx)(xa,{output:r}):null;return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mb-1",children:["Result (",e,")"]}),s||(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Output"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:r.length>1e3?r.substring(0,1e3)+"...":r})]})]})})}if("Read"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xc,{output:r})})});if("Edit"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xS,{output:r})})});if("Write"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xh,{output:r})})});if("Bash"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xf,{output:r})})});if("Grep"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xm,{output:r})})});if("Glob"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xv,{output:r})})});if("Task"===e||"Agent"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xy,{output:r})})});if("TaskOutput"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xD,{output:r})})});if("WebFetch"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xk,{output:r})})});if("WebSearch"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xN,{output:r})})});if("Skill"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xR,{output:r})})});if("FileChange"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xP,{output:r})})});let s=r.length>200;return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mb-1",children:["Result",e?` (${e})`:""]}),(0,F.jsxs)("details",{className:(0,iu.cn)(!s&&"open"),children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Output"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:r.length>1e3?r.substring(0,1e3)+"...":r})]})]})})}function xz({content:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-blue-500/10 flex items-center justify-center",children:(0,F.jsx)(vD,{className:"w-3.5 h-3.5 text-blue-500"})}),(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs font-medium text-blue-500 cursor-pointer hover:underline",children:"Thinking..."}),(0,F.jsx)("div",{className:"mt-2 text-xs text-muted-foreground whitespace-pre-wrap break-words bg-blue-500/5 p-2 rounded-md overflow-hidden",children:(e??"").length>500?(e??"").substring(0,500)+"...":e??""})]})})]})}function xF({message:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-red-500/10 flex items-center justify-center",children:(0,F.jsx)(vT,{className:"w-3.5 h-3.5 text-red-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-red-500 mb-1",children:"Error"}),(0,F.jsx)("p",{className:"text-sm text-red-500/80 break-words",children:e})]})]})}function xW({content:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-2",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-gray-500/10 flex items-center justify-center",children:(0,F.jsx)(vP,{className:"w-3.5 h-3.5 text-gray-500"})}),(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:e??""})})]})}let xH={damping:.7,stiffness:.05,mass:1.25},x$=1e3/60,xK=!1;function xU(e,r){let s=(0,W.useCallback)(r=>(s.current=r,e(r)),r);return s}globalThis.document?.addEventListener("mousedown",()=>{xK=!0}),globalThis.document?.addEventListener("mouseup",()=>{xK=!1}),globalThis.document?.addEventListener("click",()=>{xK=!1});let xq=new Map;function xV(...e){let r={...xH},s=!1;for(let i of e){if("instant"===i){s=!0;continue}"object"==typeof i&&(s=!1,r.damping=i.damping??r.damping,r.stiffness=i.stiffness??r.stiffness,r.mass=i.mass??r.mass)}let i=JSON.stringify(r);return xq.has(i)||xq.set(i,Object.freeze(r)),s?"instant":xq.get(i)}let xY=(0,W.createContext)(null),xX="undefined"!=typeof window?W.useLayoutEffect:W.useEffect;function xG({instance:e,children:r,resize:s,initial:i,mass:n,damping:o,stiffness:a,targetScrollTop:l,contextRef:c,...d}){let h=(0,W.useRef)(null),u=((e={})=>{let[r,s]=(0,W.useState)(!1),[i,n]=(0,W.useState)(!1!==e.initial),[o,a]=(0,W.useState)(!1),l=(0,W.useRef)(null);l.current=e;let c=(0,W.useCallback)(()=>{if(!xK)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let r=e.getRangeAt(0);return r.commonAncestorContainer.contains(v.current)||v.current?.contains(r.commonAncestorContainer)},[]),d=(0,W.useCallback)(e=>{u.isAtBottom=e,n(e)},[]),h=(0,W.useCallback)(e=>{u.escapedFromLock=e,s(e)},[]),u=(0,W.useMemo)(()=>{let s;return{escapedFromLock:r,isAtBottom:i,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return v.current?.scrollTop??0},set scrollTop(scrollTop){v.current&&(v.current.scrollTop=scrollTop,u.ignoreScrollToTop=v.current.scrollTop)},get targetScrollTop(){if(!v.current||!x.current)return 0;return v.current.scrollHeight-1-v.current.clientHeight},get calculatedTargetScrollTop(){if(!v.current||!x.current)return 0;let{targetScrollTop:r}=this;if(!e.targetScrollTop)return r;if(s?.targetScrollTop===r)return s.calculatedScrollTop;let i=Math.max(Math.min(e.targetScrollTop(r,{scrollElement:v.current,contentElement:x.current}),r),0);return s={targetScrollTop:r,calculatedScrollTop:i},requestAnimationFrame(()=>{s=void 0}),i},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),f=(0,W.useCallback)((e={})=>{let r;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||d(!0);let s=Date.now()+(Number(e.wait)||0),i=xV(l.current,e.animation),{ignoreEscapes:n=!1}=e,o=u.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{r=Date.now()}):r=s+(e.duration??0);let a=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!u.isAtBottom)return u.animation=void 0,!1;let{scrollTop:d}=u,h=performance.now(),p=(h-(u.lastTick??h))/x$;if(u.animation||(u.animation={behavior:i,promise:e,ignoreEscapes:n}),u.animation.behavior===i&&(u.lastTick=h),c()||s>Date.now())return a();if(d<Math.min(o,u.calculatedTargetScrollTop)){if(u.animation?.behavior===i){if("instant"===i)return u.scrollTop=u.calculatedTargetScrollTop,a();u.velocity=(i.damping*u.velocity+i.stiffness*u.scrollDifference)/i.mass,u.accumulated+=u.velocity*p,u.scrollTop+=u.accumulated,u.scrollTop!==d&&(u.accumulated=0)}return a()}return r>Date.now()?(o=u.calculatedTargetScrollTop,a()):(u.animation=void 0,u.scrollTop<u.calculatedTargetScrollTop)?f({animation:xV(l.current,l.current.resize),ignoreEscapes:n,duration:Math.max(0,r-Date.now())||void 0}):u.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{u.animation||(u.lastTick=void 0,u.velocity=0)}),e))};return(!0!==e.wait&&(u.animation=void 0),u.animation?.behavior===i)?u.animation.promise:a()},[d,c,u]),p=(0,W.useCallback)(()=>{h(!0),d(!1)},[h,d]),m=(0,W.useCallback)(({target:e})=>{if(e!==v.current)return;let{scrollTop:r,ignoreScrollToTop:s}=u,{lastScrollTop:i=r}=u;u.lastScrollTop=r,u.ignoreScrollToTop=void 0,s&&s>r&&(i=s),a(u.isNearBottom),setTimeout(()=>{if(u.resizeDifference||r===s)return;if(c()){h(!0),d(!1);return}let e=r>i,n=r<i;if(u.animation?.ignoreEscapes){u.scrollTop=i;return}n&&(h(!0),d(!1)),e&&h(!1),!u.escapedFromLock&&u.isNearBottom&&d(!0)},1)},[h,d,c,u]),g=(0,W.useCallback)(({target:e,deltaY:r})=>{let s=e;for(;!["scroll","auto"].includes(getComputedStyle(s).overflow);){if(!s.parentElement)return;s=s.parentElement}s===v.current&&r<0&&v.current.scrollHeight>v.current.clientHeight&&!u.animation?.ignoreEscapes&&(h(!0),d(!1))},[h,d,u]),v=xU(e=>{v.current?.removeEventListener("scroll",m),v.current?.removeEventListener("wheel",g),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",g,{passive:!0})},[]),x=xU(e=>{let r;u.resizeObserver?.disconnect(),e&&(u.resizeObserver=new ResizeObserver(([e])=>{let{height:s}=e.contentRect,i=s-(r??s);if(u.resizeDifference=i,u.scrollTop>u.targetScrollTop&&(u.scrollTop=u.targetScrollTop),a(u.isNearBottom),i>=0){let e=xV(l.current,r?l.current.resize:l.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else u.isNearBottom&&(h(!1),d(!0));r=s,requestAnimationFrame(()=>{setTimeout(()=>{u.resizeDifference===i&&(u.resizeDifference=0)},1)})}),u.resizeObserver?.observe(e))},[]);return{contentRef:x,scrollRef:v,scrollToBottom:f,stopScroll:p,isAtBottom:i||o,isNearBottom:o,escapedFromLock:r,state:u}})({mass:n,damping:o,stiffness:a,resize:s,initial:i,targetScrollTop:W.useCallback((e,r)=>{let s=y?.targetScrollTop??l;return s?.(e,r)??e},[l])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:g,isAtBottom:v,escapedFromLock:x,state:_}=e??u,y=(0,W.useMemo)(()=>({scrollToBottom:m,stopScroll:g,scrollRef:f,isAtBottom:v,escapedFromLock:x,contentRef:p,state:_,get targetScrollTop(){return h.current},set targetScrollTop(targetScrollTop){h.current=targetScrollTop}}),[m,v,p,f,g,x,_]);return(0,W.useImperativeHandle)(c,()=>y,[y]),xX(()=>{f.current&&"visible"===getComputedStyle(f.current).overflow&&(f.current.style.overflow="auto")},[]),W.createElement(xY.Provider,{value:y},W.createElement("div",{...d},"function"==typeof r?r(y):r))}function xJ(){let e=(0,W.useContext)(xY);if(!e)throw Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}(xG||(xG={})).Content=function({children:e,scrollClassName:r,...s}){let i=xJ();return W.createElement("div",{ref:i.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},W.createElement("div",{...s,ref:i.contentRef},"function"==typeof e?e(i):e))};let xZ=({className:e,...r})=>(0,F.jsx)(xG,{className:(0,iu.cn)("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...r}),xQ=({className:e,...r})=>(0,F.jsx)(xG.Content,{className:(0,iu.cn)("flex flex-col gap-8 p-4",e),...r}),x0=({className:e,...r})=>{let{isAtBottom:s,scrollToBottom:i}=xJ(),n=(0,W.useCallback)(()=>{i()},[i]);return!s&&(0,F.jsx)($.Button,{className:(0,iu.cn)("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",...r,children:(0,F.jsx)(iS,{className:"size-4"})})};var x1=/[\\\/_+.#"@\[\(\{&]/,x2=/[\\\/_+.#"@\[\(\{&]/g,x5=/[\s-]/,x3=/[\s-]/g;function x4(e){return e.toLowerCase().replace(x3," ")}var x6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{let s=lr(`Primitive.${r}`),i=W.forwardRef((e,i)=>{let{asChild:n,...o}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,F.jsx)(n?s:r,{...o,ref:i})});return i.displayName=`Primitive.${r}`,{...e,[r]:i}},{}),x8='[cmdk-group=""]',x7='[cmdk-group-items=""]',x9='[cmdk-item=""]',_e=`${x9}:not([aria-disabled="true"])`,_t="cmdk-item-select",_r="data-value",_s=(e,r,s)=>{var i;return i=e,function e(r,s,i,n,o,a,l){if(a===s.length)return o===r.length?1:.99;var c=`${o},${a}`;if(void 0!==l[c])return l[c];for(var d,h,u,f,p=n.charAt(a),m=i.indexOf(p,o),g=0;m>=0;)(d=e(r,s,i,n,m+1,a+1,l))>g&&(m===o?d*=1:x1.test(r.charAt(m-1))?(d*=.8,(u=r.slice(o,m-1).match(x2))&&o>0&&(d*=Math.pow(.999,u.length))):x5.test(r.charAt(m-1))?(d*=.9,(f=r.slice(o,m-1).match(x3))&&o>0&&(d*=Math.pow(.999,f.length))):(d*=.17,o>0&&(d*=Math.pow(.999,m-o))),r.charAt(m)!==s.charAt(a)&&(d*=.9999)),(d<.1&&i.charAt(m-1)===n.charAt(a+1)||n.charAt(a+1)===n.charAt(a)&&i.charAt(m-1)!==n.charAt(a))&&.1*(h=e(r,s,i,n,m+1,a+2,l))>d&&(d=.1*h),d>g&&(g=d),m=i.indexOf(p,m+1);return l[c]=g,g}(i=s&&s.length>0?`${i+" "+s.join(" ")}`:i,r,x4(i),x4(r),0,0,{})},_i=W.createContext(void 0),_n=W.createContext(void 0),_o=W.createContext(void 0),_a=W.forwardRef((e,r)=>{let s=_g(()=>{var r,s;return{search:"",value:null!=(s=null!=(r=e.value)?r:e.defaultValue)?s:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=_g(()=>new Set),n=_g(()=>new Map),o=_g(()=>new Map),a=_g(()=>new Set),l=_p(e),{label:c,children:d,value:h,onValueChange:u,filter:f,shouldFilter:p,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,_=ej(),y=ej(),b=ej(),w=W.useRef(null),S=__();_m(()=>{if(void 0!==h){let e=h.trim();s.current.value=e,C.emit()}},[h]),_m(()=>{S(6,M)},[]);let C=W.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>s.current,setState:(e,r,i)=>{var n,o,a,c;if(!Object.is(s.current[e],r)){if(s.current[e]=r,"search"===e)R(),N(),S(1,E);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(b);e?e.focus():null==(n=document.getElementById(_))||n.focus()}if(S(7,()=>{var e;s.current.selectedItemId=null==(e=D())?void 0:e.id,C.emit()}),i||S(5,M),(null==(o=l.current)?void 0:o.value)!==void 0){null==(c=(a=l.current).onValueChange)||c.call(a,null!=r?r:"");return}}C.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),k=W.useMemo(()=>({value:(e,r,i)=>{var n;r!==(null==(n=o.current.get(e))?void 0:n.value)&&(o.current.set(e,{value:r,keywords:i}),s.current.filtered.items.set(e,j(r,i)),S(2,()=>{N(),C.emit()}))},item:(e,r)=>(i.current.add(e),r&&(n.current.has(r)?n.current.get(r).add(e):n.current.set(r,new Set([e]))),S(3,()=>{R(),N(),s.current.value||E(),C.emit()}),()=>{o.current.delete(e),i.current.delete(e),s.current.filtered.items.delete(e);let r=D();S(4,()=>{R(),(null==r?void 0:r.getAttribute("id"))===e&&E(),C.emit()})}),group:e=>(n.current.has(e)||n.current.set(e,new Set),()=>{o.current.delete(e),n.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:_,inputId:b,labelId:y,listInnerRef:w}),[]);function j(e,r){var i,n;let o=null!=(n=null==(i=l.current)?void 0:i.filter)?n:_s;return e?o(e,s.current.search,r):0}function N(){if(!s.current.search||!1===l.current.shouldFilter)return;let e=s.current.filtered.items,r=[];s.current.filtered.groups.forEach(s=>{let i=n.current.get(s),o=0;i.forEach(r=>{o=Math.max(e.get(r),o)}),r.push([s,o])});let i=w.current;T().sort((r,s)=>{var i,n;let o=r.getAttribute("id"),a=s.getAttribute("id");return(null!=(i=e.get(a))?i:0)-(null!=(n=e.get(o))?n:0)}).forEach(e=>{let r=e.closest(x7);r?r.appendChild(e.parentElement===r?e:e.closest(`${x7} > *`)):i.appendChild(e.parentElement===i?e:e.closest(`${x7} > *`))}),r.sort((e,r)=>r[1]-e[1]).forEach(e=>{var r;let s=null==(r=w.current)?void 0:r.querySelector(`${x8}[${_r}="${encodeURIComponent(e[0])}"]`);null==s||s.parentElement.appendChild(s)})}function E(){let e=T().find(e=>"true"!==e.getAttribute("aria-disabled")),r=null==e?void 0:e.getAttribute(_r);C.setState("value",r||void 0)}function R(){var e,r,a,c;if(!s.current.search||!1===l.current.shouldFilter){s.current.filtered.count=i.current.size;return}s.current.filtered.groups=new Set;let d=0;for(let n of i.current){let i=j(null!=(r=null==(e=o.current.get(n))?void 0:e.value)?r:"",null!=(c=null==(a=o.current.get(n))?void 0:a.keywords)?c:[]);s.current.filtered.items.set(n,i),i>0&&d++}for(let[e,r]of n.current)for(let i of r)if(s.current.filtered.items.get(i)>0){s.current.filtered.groups.add(e);break}s.current.filtered.count=d}function M(){var e,r,s;let i=D();i&&((null==(e=i.parentElement)?void 0:e.firstChild)===i&&(null==(s=null==(r=i.closest(x8))?void 0:r.querySelector('[cmdk-group-heading=""]'))||s.scrollIntoView({block:"nearest"})),i.scrollIntoView({block:"nearest"}))}function D(){var e;return null==(e=w.current)?void 0:e.querySelector(`${x9}[aria-selected="true"]`)}function T(){var e;return Array.from((null==(e=w.current)?void 0:e.querySelectorAll(_e))||[])}function P(e){let r=T()[e];r&&C.setState("value",r.getAttribute(_r))}function L(e){var r;let s=D(),i=T(),n=i.findIndex(e=>e===s),o=i[n+e];null!=(r=l.current)&&r.loop&&(o=n+e<0?i[i.length-1]:n+e===i.length?i[0]:i[n+e]),o&&C.setState("value",o.getAttribute(_r))}function B(e){let r=D(),s=null==r?void 0:r.closest(x8),i;for(;s&&!i;)i=null==(s=e>0?function(e,r){let s=e.nextElementSibling;for(;s;){if(s.matches(r))return s;s=s.nextElementSibling}}(s,x8):function(e,r){let s=e.previousElementSibling;for(;s;){if(s.matches(r))return s;s=s.previousElementSibling}}(s,x8))?void 0:s.querySelector(_e);i?C.setState("value",i.getAttribute(_r)):L(e)}let A=()=>P(T().length-1),O=e=>{e.preventDefault(),e.metaKey?A():e.altKey?B(1):L(1)},I=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?B(-1):L(-1)};return W.createElement(x6.div,{ref:r,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:e=>{var r;null==(r=x.onKeyDown)||r.call(x,e);let s=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":v&&e.ctrlKey&&O(e);break;case"ArrowDown":O(e);break;case"p":case"k":v&&e.ctrlKey&&I(e);break;case"ArrowUp":I(e);break;case"Home":e.preventDefault(),P(0);break;case"End":e.preventDefault(),A();break;case"Enter":{e.preventDefault();let r=D();if(r){let e=new Event(_t);r.dispatchEvent(e)}}}}},W.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:_b},c),_y(e,e=>W.createElement(_n.Provider,{value:C},W.createElement(_i.Provider,{value:k},e))))}),_l=W.forwardRef((e,r)=>{var s,i;let n=ej(),o=W.useRef(null),a=W.useContext(_o),l=W.useContext(_i),c=_p(e),d=null!=(i=null==(s=c.current)?void 0:s.forceMount)?i:null==a?void 0:a.forceMount;_m(()=>{if(!d)return l.item(n,null==a?void 0:a.id)},[d]);let h=_x(n,o,[e.value,e.children,o],e.keywords),u=W.useContext(_n),f=_v(e=>e.value&&e.value===h.current),p=_v(e=>!!d||!1===l.filter()||!e.search||e.filtered.items.get(n)>0);function m(){var e,r;g(),null==(r=(e=c.current).onSelect)||r.call(e,h.current)}function g(){u.setState("value",h.current,!0)}if(W.useEffect(()=>{let r=o.current;if(!(!r||e.disabled))return r.addEventListener(_t,m),()=>r.removeEventListener(_t,m)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:v,value:x,onSelect:_,forceMount:y,keywords:b,...w}=e;return W.createElement(x6.div,{ref:(0,U.composeRefs)(o,r),...w,id:n,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),_c=W.forwardRef((e,r)=>{let{heading:s,children:i,forceMount:n,...o}=e,a=ej(),l=W.useRef(null),c=W.useRef(null),d=ej(),h=W.useContext(_i),u=_v(e=>!!n||!1===h.filter()||!e.search||e.filtered.groups.has(a));_m(()=>h.group(a),[]),_x(a,l,[e.value,e.heading,c]);let f=W.useMemo(()=>({id:a,forceMount:n}),[n]);return W.createElement(x6.div,{ref:(0,U.composeRefs)(l,r),...o,"cmdk-group":"",role:"presentation",hidden:!u||void 0},s&&W.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},s),_y(e,e=>W.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":s?d:void 0},W.createElement(_o.Provider,{value:f},e))))}),_d=W.forwardRef((e,r)=>{let{alwaysRender:s,...i}=e,n=W.useRef(null),o=_v(e=>!e.search);return s||o?W.createElement(x6.div,{ref:(0,U.composeRefs)(n,r),...i,"cmdk-separator":"",role:"separator"}):null}),_h=W.forwardRef((e,r)=>{let{onValueChange:s,...i}=e,n=null!=e.value,o=W.useContext(_n),a=_v(e=>e.search),l=_v(e=>e.selectedItemId),c=W.useContext(_i);return W.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),W.createElement(x6.input,{ref:r,...i,"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":l,id:c.inputId,type:"text",value:n?e.value:a,onChange:e=>{n||o.setState("search",e.target.value),null==s||s(e.target.value)}})}),_u=W.forwardRef((e,r)=>{let{children:s,label:i="Suggestions",...n}=e,o=W.useRef(null),a=W.useRef(null),l=_v(e=>e.selectedItemId),c=W.useContext(_i);return W.useEffect(()=>{if(a.current&&o.current){let e=a.current,r=o.current,s,i=new ResizeObserver(()=>{s=requestAnimationFrame(()=>{let s=e.offsetHeight;r.style.setProperty("--cmdk-list-height",s.toFixed(1)+"px")})});return i.observe(e),()=>{cancelAnimationFrame(s),i.unobserve(e)}}},[]),W.createElement(x6.div,{ref:(0,U.composeRefs)(o,r),...n,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:c.listId},_y(e,e=>W.createElement("div",{ref:(0,U.composeRefs)(a,c.listInnerRef),"cmdk-list-sizer":""},e)))}),_f=W.forwardRef((e,r)=>{let{open:s,onOpenChange:i,overlayClassName:n,contentClassName:o,container:a,...l}=e;return W.createElement(iA,{open:s,onOpenChange:i},W.createElement(iW,{container:a},W.createElement(i$,{"cmdk-overlay":"",className:n}),W.createElement(iV,{"aria-label":e.label,"cmdk-dialog":"",className:o},W.createElement(_a,{ref:r,...l}))))});function _p(e){let r=W.useRef(e);return _m(()=>{r.current=e}),r}Object.assign(_a,{List:_u,Item:_l,Input:_h,Group:_c,Separator:_d,Dialog:_f,Empty:W.forwardRef((e,r)=>_v(e=>0===e.filtered.count)?W.createElement(x6.div,{ref:r,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:W.forwardRef((e,r)=>{let{progress:s,children:i,label:n="Loading...",...o}=e;return W.createElement(x6.div,{ref:r,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},_y(e,e=>W.createElement("div",{"aria-hidden":!0},e)))})});var _m="undefined"==typeof window?W.useEffect:W.useLayoutEffect;function _g(e){let r=W.useRef();return void 0===r.current&&(r.current=e()),r}function _v(e){let r=W.useContext(_n),s=()=>e(r.snapshot());return W.useSyncExternalStore(r.subscribe,s,s)}function _x(e,r,s,i=[]){let n=W.useRef(),o=W.useContext(_i);return _m(()=>{var a;let l=(()=>{var e;for(let r of s){if("string"==typeof r)return r.trim();if("object"==typeof r&&"current"in r)return r.current?null==(e=r.current.textContent)?void 0:e.trim():n.current}})(),c=i.map(e=>e.trim());o.value(e,l,c),null==(a=r.current)||a.setAttribute(_r,l),n.current=l}),n}var __=()=>{let[e,r]=W.useState(),s=_g(()=>new Map);return _m(()=>{s.current.forEach(e=>e()),s.current=new Map},[e]),(e,i)=>{s.current.set(e,i),r({})}};function _y({asChild:e,children:r},s){let i;return e&&W.isValidElement(r)?W.cloneElement("function"==typeof(i=r.type)?i(r.props):"render"in i?i.render(r.props):r,{ref:r.ref},s(r.props.children)):s(r)}var _b={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},_w="HoverCard",[_S,_C]=q(_w,[tK]),_k=tK(),[_j,_N]=_S(_w),_E=e=>{let{__scopeHoverCard:r,children:s,open:i,defaultOpen:n,onOpenChange:o,openDelay:a=700,closeDelay:l=300}=e,c=_k(r),d=W.useRef(0),h=W.useRef(0),u=W.useRef(!1),f=W.useRef(!1),[p,m]=X({prop:i,defaultProp:n??!1,onChange:o,caller:_w}),g=W.useCallback(()=>{clearTimeout(h.current),d.current=window.setTimeout(()=>m(!0),a)},[a,m]),v=W.useCallback(()=>{clearTimeout(d.current),u.current||f.current||(h.current=window.setTimeout(()=>m(!1),l))},[l,m]),x=W.useCallback(()=>m(!1),[m]);return W.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(h.current)},[]),(0,F.jsx)(_j,{scope:r,open:p,onOpenChange:m,onOpen:g,onClose:v,onDismiss:x,hasSelectionRef:u,isPointerDownOnContentRef:f,children:(0,F.jsx)(tV,{...c,children:s})})};_E.displayName=_w;var _R="HoverCardTrigger",_M=W.forwardRef((e,r)=>{let{__scopeHoverCard:s,...i}=e,n=_N(_R,s),o=_k(s);return(0,F.jsx)(tX,{asChild:!0,...o,children:(0,F.jsx)(Z.a,{"data-state":n.open?"open":"closed",...i,ref:r,onPointerEnter:K(e.onPointerEnter,_I(n.onOpen)),onPointerLeave:K(e.onPointerLeave,_I(n.onClose)),onFocus:K(e.onFocus,n.onOpen),onBlur:K(e.onBlur,n.onClose),onTouchStart:K(e.onTouchStart,e=>e.preventDefault())})})});_M.displayName=_R;var _D="HoverCardPortal",[_T,_P]=_S(_D,{forceMount:void 0}),_L=e=>{let{__scopeHoverCard:r,forceMount:s,children:i,container:n}=e,o=_N(_D,r);return(0,F.jsx)(_T,{scope:r,forceMount:s,children:(0,F.jsx)(t8,{present:s||o.open,children:(0,F.jsx)(t6,{asChild:!0,container:n,children:i})})})};_L.displayName=_D;var _B="HoverCardContent",_A=W.forwardRef((e,r)=>{let s=_P(_B,e.__scopeHoverCard),{forceMount:i=s.forceMount,...n}=e,o=_N(_B,e.__scopeHoverCard);return(0,F.jsx)(t8,{present:i||o.open,children:(0,F.jsx)(_O,{"data-state":o.open?"open":"closed",...n,onPointerEnter:K(e.onPointerEnter,_I(o.onOpen)),onPointerLeave:K(e.onPointerLeave,_I(o.onClose)),ref:r})})});_A.displayName=_B;var _O=W.forwardRef((e,r)=>{let{__scopeHoverCard:s,onEscapeKeyDown:i,onPointerDownOutside:n,onFocusOutside:o,onInteractOutside:a,...l}=e,c=_N(_B,s),d=_k(s),h=W.useRef(null),u=(0,U.useComposedRefs)(r,h),[f,p]=W.useState(!1);return W.useEffect(()=>{if(f){let e=document.body;return z=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=z,e.style.webkitUserSelect=z}}},[f]),W.useEffect(()=>{if(h.current){let e=()=>{p(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(c.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),W.useEffect(()=>{h.current&&(function(e){let r=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;s.nextNode();)r.push(s.currentNode);return r})(h.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,F.jsx)(ec,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:i,onPointerDownOutside:n,onFocusOutside:K(o,e=>{e.preventDefault()}),onDismiss:c.onDismiss,children:(0,F.jsx)(tQ,{...d,...l,onPointerDown:K(l.onPointerDown,e=>{e.currentTarget.contains(e.target)&&p(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:u,style:{...l.style,userSelect:f?"text":void 0,WebkitUserSelect:f?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function _I(e){return r=>"touch"===r.pointerType?void 0:e()}function _z({...e}){return(0,F.jsx)(_E,{"data-slot":"hover-card",...e})}function _F({...e}){return(0,F.jsx)(_M,{"data-slot":"hover-card-trigger",...e})}function _W({className:e,align:r="center",sideOffset:s=4,...i}){return(0,F.jsx)(_L,{"data-slot":"hover-card-portal",children:(0,F.jsx)(_A,{"data-slot":"hover-card-content",align:r,sideOffset:s,className:(0,iu.cn)("bg-popover text-popover-foreground 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 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...i})})}function _H({className:e,...r}){return(0,F.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,iu.cn)("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...r})}W.forwardRef((e,r)=>{let{__scopeHoverCard:s,...i}=e,n=_k(s);return(0,F.jsx)(t2,{...n,...i,ref:r})}).displayName="HoverCardArrow";let _$=(0,lo.cva)("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function _K({className:e,align:r="inline-start",...s}){return(0,F.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":r,className:(0,iu.cn)(_$({align:r}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}let _U=(0,lo.cva)("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function _q({className:e,type:r="button",variant:s="ghost",size:i="xs",...n}){return(0,F.jsx)($.Button,{type:r,"data-size":i,variant:s,className:(0,iu.cn)(_U({size:i}),e),...n})}function _V({className:e,...r}){return(0,F.jsx)(nD,{"data-slot":"input-group-control",className:(0,iu.cn)("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...r})}let _Y=(0,ic.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),_X=(0,ic.default)("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"}]]);(0,ic.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);let _G=(0,ic.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),_J=(e=21)=>{let r="",s=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)r+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&s[e]];return r},_Z=(0,W.createContext)(null),_Q=(0,W.createContext)(null),_0=()=>(0,W.useContext)(_Z),_1=(0,W.createContext)(null),_2=()=>{let e=(0,W.useContext)(_Q),r=(0,W.useContext)(_1),s=e??r;if(!s)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return s};function _5({data:e,className:r,...s}){let i=_2(),n=e.filename||"",o="image"==(e.mediaType?.startsWith("image/")&&e.url?"image":"file"),a=n||(o?"Image":"Attachment");return(0,F.jsxs)(yn,{children:[(0,F.jsx)(_F,{asChild:!0,children:(0,F.jsxs)("div",{className:(0,iu.cn)("group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",r),...s,children:[(0,F.jsxs)("div",{className:"relative size-5 shrink-0",children:[(0,F.jsx)("div",{className:"absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0",children:o?(0,F.jsx)("img",{alt:n||"attachment",className:"size-5 object-cover",height:20,src:e.url,width:20}):(0,F.jsx)("div",{className:"flex size-5 items-center justify-center text-muted-foreground",children:(0,F.jsx)(_G,{className:"size-3"})})}),(0,F.jsxs)($.Button,{"aria-label":"Remove attachment",className:"absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",onClick:r=>{r.stopPropagation(),i.remove(e.id)},type:"button",variant:"ghost",children:[(0,F.jsx)(i9,{}),(0,F.jsx)("span",{className:"sr-only",children:"Remove"})]})]}),(0,F.jsx)("span",{className:"flex-1 truncate",children:a})]},e.id)}),(0,F.jsx)(yo,{className:"w-auto p-2",children:(0,F.jsxs)("div",{className:"w-auto space-y-3",children:[o&&(0,F.jsx)("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:(0,F.jsx)("img",{alt:n||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:e.url,width:448})}),(0,F.jsx)("div",{className:"flex items-center gap-2.5",children:(0,F.jsxs)("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[(0,F.jsx)("h4",{className:"truncate font-semibold text-sm leading-none",children:n||(o?"Image":"Attachment")}),e.mediaType&&(0,F.jsx)("p",{className:"truncate font-mono text-muted-foreground text-xs",children:e.mediaType})]})})]})})]})}function _3({children:e,className:r,...s}){let i=_2();return i.files.length?(0,F.jsx)("div",{className:(0,iu.cn)("flex flex-wrap items-center gap-2 p-3 w-full",r),...s,children:i.files.map(r=>(0,F.jsx)(W.Fragment,{children:e(r)},r.id))}):null}let _4=({label:e="Add photos or files",...r})=>{let s=_2();return(0,F.jsxs)(iv,{...r,onSelect:e=>{e.preventDefault(),s.openFileDialog()},children:[(0,F.jsx)(_X,{className:"mr-2 size-4"})," ",e]})},_6=({className:e,accept:r,multiple:s,globalDrop:i,syncHiddenInput:n,maxFiles:o,maxFileSize:a,onError:l,onSubmit:c,children:d,...h})=>{let u=_0(),f=!!u,p=(0,W.useRef)(null),m=(0,W.useRef)(null),[g,v]=(0,W.useState)([]),x=f?u.attachments.files:g,_=(0,W.useRef)(x);_.current=x;let y=(0,W.useCallback)(()=>{p.current?.click()},[]),b=(0,W.useCallback)(e=>!r||""===r.trim()||r.split(",").map(e=>e.trim()).filter(Boolean).some(r=>{if(r.endsWith("/*")){let s=r.slice(0,-1);return e.type.startsWith(s)}return e.type===r}),[r]),w=(0,W.useCallback)(e=>{let r=Array.from(e),s=r.filter(e=>b(e));if(r.length&&0===s.length)return void l?.({code:"accept",message:"No files match the accepted types."});let i=s.filter(e=>!a||e.size<=a);s.length>0&&0===i.length?l?.({code:"max_file_size",message:"All files exceed the maximum size."}):v(e=>{let r="number"==typeof o?Math.max(0,o-e.length):void 0,s="number"==typeof r?i.slice(0,r):i;"number"==typeof r&&i.length>r&&l?.({code:"max_files",message:"Too many files. Some were not added."});let n=[];for(let e of s)n.push({id:_J(),type:"file",url:URL.createObjectURL(e),mediaType:e.type,filename:e.name});return e.concat(n)})},[b,o,a,l]),S=(0,W.useCallback)(e=>v(r=>{let s=r.find(r=>r.id===e);return s?.url&&URL.revokeObjectURL(s.url),r.filter(r=>r.id!==e)}),[]),C=(0,W.useCallback)(()=>v(e=>{for(let r of e)r.url&&URL.revokeObjectURL(r.url);return[]}),[]),k=f?u.attachments.add:w,j=f?u.attachments.remove:S,N=f?u.attachments.clear:C,E=f?u.attachments.openFileDialog:y;(0,W.useEffect)(()=>{f&&u.__registerFileInput(p,()=>p.current?.click())},[f,u]),(0,W.useEffect)(()=>{n&&p.current&&0===x.length&&(p.current.value="")},[x,n]),(0,W.useEffect)(()=>{let e=m.current;if(!e||i)return;let r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},s=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&k(e.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",s),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",s)}},[k,i]),(0,W.useEffect)(()=>{if(!i)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&k(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[k,i]),(0,W.useEffect)(()=>()=>{if(!f)for(let e of _.current)e.url&&URL.revokeObjectURL(e.url)},[f]);let R=async e=>{try{let r=await fetch(e),s=await r.blob();return new Promise(e=>{let r=new FileReader;r.onloadend=()=>e(r.result),r.onerror=()=>e(null),r.readAsDataURL(s)})}catch{return null}},M=(0,W.useMemo)(()=>({files:x.map(e=>({...e,id:e.id})),add:k,remove:j,clear:N,openFileDialog:E,fileInputRef:p}),[x,k,j,N,E]),D=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("input",{accept:r,"aria-label":"Upload files",className:"hidden",multiple:s,onChange:e=>{e.currentTarget.files&&k(e.currentTarget.files),e.currentTarget.value=""},ref:p,title:"Upload files",type:"file"}),(0,F.jsx)("form",{className:(0,iu.cn)("w-full",e),onSubmit:e=>{e.preventDefault();let r=e.currentTarget,s=f?u.textInput.value:new FormData(r).get("message")||"";f||r.reset(),Promise.all(x.map(async({id:e,...r})=>{if(r.url&&r.url.startsWith("blob:")){let e=await R(r.url);return{...r,url:e??r.url}}return r})).then(r=>{try{let i=c({text:s,files:r},e);i instanceof Promise?i.then(()=>{N(),f&&u.textInput.clear()}).catch(()=>{}):(N(),f&&u.textInput.clear())}catch{}}).catch(()=>{})},ref:m,...h,children:(0,F.jsx)(_H,{className:"overflow-hidden",children:d})})]});return f?D:(0,F.jsx)(_1.Provider,{value:M,children:D})},_8=({onChange:e,onKeyDown:r,className:s,placeholder:i="What would you like to know?",...n})=>{let o=_0(),a=_2(),[l,c]=(0,W.useState)(!1),d=o?{value:o.textInput.value,onChange:r=>{o.textInput.setInput(r.currentTarget.value),e?.(r)}}:{onChange:e};return(0,F.jsx)(_V,{className:(0,iu.cn)("field-sizing-content max-h-48 min-h-9",s),name:"message",onCompositionEnd:()=>c(!1),onCompositionStart:()=>c(!0),onKeyDown:e=>{if(r?.(e),!e.defaultPrevented){if("Enter"===e.key){if(l||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let r=e.currentTarget.form,s=r?.querySelector('button[type="submit"]');if(s?.disabled)return;r?.requestSubmit()}if("Backspace"===e.key&&""===e.currentTarget.value&&a.files.length>0){e.preventDefault();let r=a.files.at(-1);r&&a.remove(r.id)}}},onPaste:e=>{let r=e.clipboardData?.items;if(!r)return;let s=[];for(let e of r)if("file"===e.kind){let r=e.getAsFile();r&&s.push(r)}s.length>0&&(e.preventDefault(),a.add(s))},placeholder:i,...n,...d})},_7=({className:e,...r})=>(0,F.jsx)(_K,{align:"block-end",className:(0,iu.cn)("order-first flex-wrap gap-1",e),...r}),_9=({variant:e="ghost",className:r,size:s,...i})=>{let n=s??(W.Children.count(i.children)>1?"sm":"icon-sm");return(0,F.jsx)(_q,{className:(0,iu.cn)(r),size:n,type:"button",variant:e,...i})},ye=e=>(0,F.jsx)(ip,{...e}),yt=({className:e,children:r,...s})=>(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)(_9,{className:e,...s,children:r??(0,F.jsx)(nT,{className:"size-4"})})}),yr=({className:e,...r})=>(0,F.jsx)(ig,{align:"start",className:(0,iu.cn)(e),...r}),ys=({className:e,...r})=>(0,F.jsx)(iv,{className:(0,iu.cn)(e),...r}),yi=({className:e,variant:r="default",size:s="icon-sm",status:i,children:n,...o})=>{let a=(0,F.jsx)(_Y,{className:"size-4"});return"submitted"===i?a=(0,F.jsx)(iE,{className:"size-4 animate-spin"}):"streaming"===i?a=(0,F.jsx)(lc,{className:"size-4"}):"error"===i&&(a=(0,F.jsx)(i9,{className:"size-4"})),(0,F.jsx)(_q,{"aria-label":"Submit",className:(0,iu.cn)(e),size:s,type:"submit",variant:r,...o,children:n??a})},yn=({openDelay:e=0,closeDelay:r=0,...s})=>(0,F.jsx)(_z,{closeDelay:r,openDelay:e,...s}),yo=({align:e="start",...r})=>(0,F.jsx)(_W,{align:e,...r}),ya=({size:e=16})=>(0,F.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,F.jsx)("title",{children:"Loader"}),(0,F.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,F.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,F.jsx)("defs",{children:(0,F.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,F.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),yl=({className:e,size:r=16,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("inline-flex animate-spin items-center justify-center",e),...s,children:(0,F.jsx)(ya,{size:r})}),yc=(0,ic.default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),yd=(0,ic.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),yh=(0,ic.default)("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"}]]),yu=(0,ic.default)("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"}]]);function yf({mode:e,onModeChange:r,disabled:s}){return(0,F.jsxs)("div",{className:"inline-flex items-center rounded-md border bg-muted/50 p-0.5 text-xs",children:[(0,F.jsxs)("button",{onClick:()=>r("plan"),disabled:s,className:(0,iu.cn)("inline-flex items-center gap-1 rounded-sm px-2 py-0.5 transition-colors","plan"===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground",s&&"opacity-50 cursor-not-allowed"),children:[(0,F.jsx)(yu,{className:"h-3 w-3"}),"Plan"]}),(0,F.jsxs)("button",{onClick:()=>r("edit"),disabled:s,className:(0,iu.cn)("inline-flex items-center gap-1 rounded-sm px-2 py-0.5 transition-colors","edit"===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground",s&&"opacity-50 cursor-not-allowed"),children:[(0,F.jsx)(oL,{className:"h-3 w-3"}),"Edit"]})]})}function yp(e){let r=e.parentElement;for(;r;){let{overflowY:e}=getComputedStyle(r);if("auto"===e||"scroll"===e)return r;r=r.parentElement}return null}function ym({messages:e,contentRef:r}){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)(!1),[a,l]=(0,W.useState)(null),c=(0,W.useRef)(null),d=(0,W.useCallback)(()=>{let s=r.current;if(!s)return;c.current||(c.current=yp(s));let n=c.current;if(!n)return;let a=n.scrollHeight>n.clientHeight;if(o(a),!a)return void i([]);let l=s.querySelectorAll("[data-user-msg-idx]"),d=n.getBoundingClientRect(),h=[];l.forEach(r=>{let s=parseInt(r.dataset.userMsgIdx,10),i=(r.getBoundingClientRect().top-d.top+n.scrollTop)/n.scrollHeight;h.push({index:s,position:Math.max(0,Math.min(1,i)),preview:function(e){if("user"!==e.type)return"";let r=e.content,s="string"==typeof r?r:r.filter(e=>"text"===e.type).map(e=>e.text).join(" "),i="string"!=typeof r&&r.some(e=>"image"===e.type),n=s.split("\n")[0]??"";return(n.length>80?n.slice(0,77)+"...":n)||(i?"(Image)":"")}(e[s])})}),i(h)},[e,r]);(0,W.useEffect)(()=>{let e=r.current;if(!e)return;let s=yp(e);if(!s)return;c.current=s,d();let i=new ResizeObserver(d);return i.observe(s),i.observe(e),()=>{i.disconnect()}},[e,d,r]);let h=(0,W.useCallback)(e=>{let s=r.current;if(!s)return;let i=s.querySelector(`[data-user-msg-idx="${e}"]`);i&&i.scrollIntoView({block:"start",behavior:"smooth"})},[r]);return n&&0!==s.length?(0,F.jsx)("div",{className:"absolute right-0 top-0 bottom-0 w-5 z-20 pointer-events-none",children:s.map(e=>(0,F.jsxs)("div",{className:"absolute right-0.5 -translate-y-1/2 pointer-events-auto",style:{top:`${100*e.position}%`},children:[(0,F.jsx)("div",{className:"w-3 h-[3px] rounded-sm bg-primary/50 hover:bg-primary cursor-pointer transition-colors",onClick:()=>h(e.index),onMouseEnter:()=>l(e.index),onMouseLeave:()=>l(null)}),a===e.index&&e.preview&&(0,F.jsxs)("div",{className:"absolute right-full mr-2 top-1/2 -translate-y-1/2 max-w-64 px-2.5 py-1.5 bg-popover border border-border rounded-md shadow-md text-xs text-popover-foreground whitespace-nowrap overflow-hidden text-ellipsis pointer-events-none",children:[e.preview,(0,F.jsx)("div",{className:"absolute top-1/2 -translate-y-1/2 -right-1 w-2 h-2 bg-popover border-r border-t border-border rotate-45"})]})]},e.index))}):null}function yg(){return 0===_2().files.length?null:(0,F.jsx)(_7,{children:(0,F.jsx)(_3,{children:e=>(0,F.jsx)(_5,{data:e})})})}let yv=(0,W.createContext)(null);function yx(){let e=(0,W.useContext)(yv);if(!e)throw Error("useAgentConversation must be used within AgentConversationContext");return e}let y_=(0,W.forwardRef)(function({projectId:e,branch:r,project:s,onAgentModeChange:i,onTaskCompleted:n,onSessionStarted:o,onStatusChange:a},l){let c,d,h,u,f,p,m,[g,v]=(0,W.useState)(""),[x,_]=(0,W.useState)("edit"),[y,b]=(0,W.useState)(!1),[w,S]=(0,W.useState)(!1),[C,k]=(0,W.useState)("claude-code"),[j,N]=(0,W.useState)([]),E=(0,W.useRef)(null),R=(f=(0,W.useRef)([]),p=(0,W.useRef)(-1),m=(0,W.useRef)(""),{push:(0,W.useCallback)(e=>{let r=e.trim();if(!r)return;let s=f.current;if(s.length>0&&s[s.length-1]===r){p.current=-1;return}s.push(r),s.length>50&&s.shift(),p.current=-1},[]),handleKeyDown:(0,W.useCallback)(e=>{let r=e.currentTarget,s=f.current;if(0!==s.length)if("ArrowUp"===e.key){if(0!==r.selectionStart||0!==r.selectionEnd)return;if(e.preventDefault(),-1===p.current)m.current=r.value,p.current=s.length-1;else{if(!(p.current>0))return;p.current--}v(s[p.current])}else if("ArrowDown"===e.key){if(-1===p.current)return;let i=r.value.length;if(r.selectionStart!==i||r.selectionEnd!==i)return;e.preventDefault(),p.current<s.length-1?(p.current++,v(s[p.current])):(p.current=-1,v(m.current))}else -1!==p.current&&(p.current=-1)},[v])}),{remotes:M}=iM(s?.id??void 0),D=[];for(let e of(s?.path&&D.push({id:"local",label:"Local",icon:nO.Monitor}),M))D.push({id:e.remote_server_id,label:e.server_name,icon:nI});let{session:T,messages:P,status:L,isConnected:B,isInitialized:A,isLoading:O,error:I,remoteStatus:z,startSession:H,sendMessage:K,stopSession:U,restartSession:q,switchMode:V,acceptPlan:Y}=function(e,r,s,i,n){let[o,a]=(0,W.useState)(null),[l,c]=(0,W.useState)([]),[d,h]=(0,W.useState)("stopped"),[u,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[g,v]=(0,W.useState)(!1),[x,_]=(0,W.useState)(null),[y,b]=(0,W.useState)(null),w=(0,W.useRef)(null),S=(0,W.useRef)(null),C=(0,W.useRef)(null),k=(0,W.useRef)(0),j=(0,W.useRef)({entries:[],status:"stopped"}),N=(0,W.useRef)(!1),E=(0,W.useRef)(!0),R=(0,W.useRef)(null),M=(0,W.useRef)(null),D=(0,W.useRef)(0),T=(0,W.useRef)(!1),P=(0,W.useRef)(0),L=(0,W.useRef)(!1),B=(0,W.useRef)(!1),A=(0,W.useRef)(n?.onTaskCompleted),O=(0,W.useRef)(n?.onSessionStarted);(0,W.useEffect)(()=>{A.current=n?.onTaskCompleted,O.current=n?.onSessionStarted});let I=(0,W.useCallback)(s=>{if(w.current&&S.current!==s&&(console.log(`[AgentSession] Closing stale WS for ${S.current}, switching to ${s}`),w.current.close(1e3,"session-switch"),w.current=null,S.current=null),w.current?.readyState===WebSocket.OPEN||w.current?.readyState===WebSocket.CONNECTING)return;0===j.current.entries.filter(Boolean).length&&(j.current={entries:[],status:"running"}),N.current=!1,T.current=!0;let i=(0,iR.getWebSocketUrl)(`/api/agent-sessions/${s}/stream`);console.log("[AgentSession] Connecting to WebSocket:",i);let n=new WebSocket(i);w.current=n,S.current=s,n.onopen=()=>{console.log("[AgentSession] WebSocket connected"),f(!0),_(null),b(null),R.current=Date.now(),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{console.log("[AgentSession] Connection stable, resetting backoff counter"),k.current=0,D.current=0},5e3)},n.onmessage=s=>{try{let o=JSON.parse(s.data);if("JsonPatch"in o){var i;let s=o.JsonPatch;i=j.current,j.current=vv(i,e=>{for(let r of s){let{op:s,path:i,value:n}=r;if("/entries"===i&&"replace"===s&&n?.type==="ENTRY"&&n.content?.type==="system"&&n.content?.content==="__CLEAR_ALL__"){console.log("[JsonPatch] Received clearAll signal - clearing all entries"),e.entries=[];continue}if(i.startsWith("/entries/")){let r=parseInt(i.replace("/entries/",""),10);if(isNaN(r)){console.warn(`[JsonPatch] Invalid index in path: ${i}`);continue}if(n?.type!=="ENTRY"){console.warn("[JsonPatch] Expected ENTRY type for entries path");continue}switch(s){case"add":for(;e.entries.length<=r;)e.entries.push(null);e.entries[r]=n.content;break;case"replace":r<e.entries.length?e.entries[r]=n.content:console.warn(`[JsonPatch] Replace index out of bounds: ${r}`);break;case"remove":r<e.entries.length&&e.entries.splice(r,1)}}else"/status"===i&&n?.type==="STATUS"&&(e.status=n.content)}}),!T.current&&(c([...j.current.entries.filter(Boolean)]),h(j.current.status),("stopped"===j.current.status||"error"===j.current.status)&&e&&vN.delete(vE(e,r)));return}if("Ready"in o){console.log("[AgentSession] Received Ready signal - history complete"),T.current=!1,c([...j.current.entries.filter(Boolean)]),h(j.current.status),m(!0);return}if("finished"in o){console.log("[AgentSession] Received finished signal, invalidating cache"),N.current=!0,e&&vN.delete(vE(e,r)),n.close(1e3,"finished");return}if("taskCompleted"in o){let{duration_ms:e,cost_usd:r,input_tokens:s,output_tokens:i}=o.taskCompleted,n=[];if(null!=e){let r=(e/1e3).toFixed(1);n.push(`${r}s`)}if(null!=r)n.push(`$${r.toFixed(4)}`);else if(null!=s||null!=i){let e=(s??0)+(i??0),r=e>1e3?`${(e/1e3).toFixed(1)}K`:String(e);n.push(`${r} tokens`)}vx.toast.success("Task completed",{description:n.length>0?n.join(" · "):void 0}),A.current?.();return}if("remoteStatus"in o)return void b(o.remoteStatus);if("error"in o){console.error("[AgentSession] Server error:",o.error),_(o.error),"Session not found"===o.error&&(console.log("[AgentSession] Session invalid, invalidating cache, will create new session"),e&&vN.delete(vE(e,r)),N.current=!0,a(null),h("stopped"),m(!1),E.current=!0);return}}catch(e){console.error("[AgentSession] Failed to parse message:",e)}},n.onclose=s=>{let i,n;console.log("[AgentSession] WebSocket disconnected",s.code,s.reason),f(!1),M.current&&(clearTimeout(M.current),M.current=null);let o=R.current?Date.now()-R.current:0;if(R.current=null,o>0&&o<5e3){if(D.current++,console.log(`[AgentSession] Short-lived connection (${o}ms), count: ${D.current}, backoff attempt: ${k.current}`),D.current>=3){if(console.log("[AgentSession] Multiple short-lived connections detected, session likely invalid - will recreate"),L.current){console.log("[AgentSession] Skipping auto-restart: last session creation failed"),_("Unable to connect to remote server. Please check the server configuration.");return}e&&vN.delete(vE(e,r)),a(null),_(null),k.current=0,D.current=0,E.current=!0;return}}else o>=5e3&&(D.current=0);if(N.current||1e3===s.code)return;if(k.current>=10){console.log("[AgentSession] Max reconnect attempts reached"),_("Unable to connect to server. Please check if the backend is running.");return}let l=(n=(i=Math.min(3e4,1e3*Math.pow(2,k.current)))*Math.random()*.25,i+n);console.log(`[AgentSession] Reconnecting in ${Math.round(l)}ms (attempt ${k.current+1})`),k.current++,C.current=setTimeout(()=>{let e=S.current;e&&!N.current&&I(e)},l)},n.onerror=e=>{console.error("[AgentSession] WebSocket error:",e)}},[]),z=(0,W.useCallback)(async s=>{if(!e)return null;if(B.current)return console.log("[AgentSession] startSession already in progress, skipping"),null;B.current=!0;let n=P.current;_(null),b(null),m(!1),L.current=!1;let o=vE(e,r),l=vN.get(o);if(l)return console.log(`[AgentSession] Cache hit for ${o}, reconnecting WebSocket directly`),a(l),h(l.status),I(l.id),O.current?.(),B.current=!1,l;v(!0);try{console.log(`[AgentSession] Starting REST call: projectId=${e}, branch=${r}, agentType=${i}, generation=${n}`);let{session:l,messages:d}=await vb(e,r,s,i);if(console.log(`[AgentSession] REST response: sessionId=${l.id}, msgCount=${d?.length??0}`),P.current!==n)return console.log("[AgentSession] Discarding stale session response (generation mismatch)"),null;return vN.set(o,l),a(l),h(l.status),d&&d.length>0&&(c(d),j.current={entries:[...d],status:l.status}),I(l.id),O.current?.(),l}catch(e){if(console.error("[AgentSession] startSession error:",e),P.current!==n)return console.log("[AgentSession] Discarding error (generation mismatch)"),null;return _(e instanceof Error?e.message:"Failed to start session"),L.current=!0,null}finally{B.current=!1,P.current===n&&v(!1)}},[e,r,i,I]),F=(0,W.useCallback)(async(s,i)=>{let n=i||o?.id;if(!n)return void console.warn("[AgentSession] sendMessage: no session ID available (sessionId param:",i,", session?.id:",o?.id,")");if(("string"!=typeof s||s.trim())&&(!Array.isArray(s)||0!==s.length)){console.log(`[AgentSession] sendMessage: targetSessionId=${n}, source=${i?"explicit":"state"}`);try{let e="string"==typeof s?s.trim():s;await vw(n,e)}catch(i){let s=i instanceof Error?i.message:"Failed to send message";console.error("[AgentSession] Failed to send message:",s),s.includes("[404]")&&(e&&vN.delete(vE(e,r)),a(null),h("stopped"),m(!1),E.current=!0),_(s),vx.toast.error("Failed to send message",{description:s})}}},[o?.id]),H=(0,W.useCallback)(async()=>{if(o?.id)try{await vC(o.id)}catch(e){e instanceof Error&&e.message,console.error("[AgentSession] Failed to stop session:",e),vx.toast.error("Failed to stop session")}},[o?.id]),$=(0,W.useCallback)(async s=>{if(o?.id){e&&vN.delete(vE(e,r)),v(!0),_(null);try{await vS(o.id,s),s&&a(e=>e?{...e,agentType:s}:null)}catch(e){_(e instanceof Error?e.message:"Failed to restart session"),console.error("[AgentSession] Failed to restart session:",e)}finally{v(!1)}}},[o?.id]),K=(0,W.useCallback)(async s=>{if(o?.id){_(null);try{await vk(o.id,s),a(i=>{if(!i)return i;let n={...i,permissionMode:s};return e&&vN.set(vE(e,r),n),n})}catch(e){_(e instanceof Error?e.message:"Failed to switch mode"),console.error("[AgentSession] Failed to switch mode:",e)}}},[o?.id,e,r]),U=(0,W.useCallback)(async s=>{if(o?.id){_(null);try{await vj(o.id,s),a(s=>{if(!s)return s;let i={...s,permissionMode:"edit"};return e&&vN.set(vE(e,r),i),i})}catch(e){_(e instanceof Error?e.message:"Failed to accept plan"),console.error("[AgentSession] Failed to accept plan:",e)}}},[o?.id,e,r]);return(0,W.useEffect)(()=>()=>{w.current&&(N.current=!0,w.current.close(),S.current=null),C.current&&clearTimeout(C.current),M.current&&clearTimeout(M.current)},[]),(0,W.useEffect)(()=>{w.current&&(w.current.close(1e3,"branch-switch"),w.current=null,S.current=null),C.current&&(clearTimeout(C.current),C.current=null),M.current&&(clearTimeout(M.current),M.current=null),P.current+=1,a(null),h("stopped"),f(!1),m(!1),_(null),v(!1),b(null),c([]),j.current={entries:[],status:"stopped"},N.current=!1,k.current=0,R.current=null,D.current=0,L.current=!1,B.current=!1,E.current=!0,e&&vN.delete(vE(e,r))},[e,r,s]),(0,W.useEffect)(()=>{!E.current||!e||o||g||L.current||(E.current=!1,console.log(`[AgentSession] Auto-start: projectId=${e}, branch=${r}, agentMode=${s}`),z())},[e,o,g,z]),(0,W.useEffect)(()=>{let e=()=>{if("visible"===document.visibilityState&&o?.id&&!N.current){let e=w.current;e&&e.readyState!==WebSocket.CLOSED&&e.readyState!==WebSocket.CLOSING||(console.log("[AgentSession] Tab visible, WebSocket disconnected - reconnecting"),k.current=0,D.current=0,C.current&&(clearTimeout(C.current),C.current=null),I(o.id))}};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[o?.id,I]),(0,W.useEffect)(()=>{o?.id&&!N.current&&I(o.id)},[o?.id,I]),{session:o,messages:l,status:d,isConnected:u,isInitialized:p,isLoading:g,error:x,remoteStatus:y,startSession:z,sendMessage:F,stopSession:H,restartSession:$,switchMode:K,acceptPlan:U}}(e,r,s?.agent_mode,C,{onTaskCompleted:n,onSessionStarted:o});(0,W.useEffect)(()=>{(0,iR.getAgentProviders)().then(N).catch(()=>{})},[]),(0,W.useEffect)(()=>{T?.permissionMode&&_(T.permissionMode)},[T?.permissionMode]),(0,W.useEffect)(()=>{T?.agentType&&k(T.agentType)},[T?.agentType]);let X=(0,W.useRef)(!1);(0,W.useEffect)(()=>{let e="running"===L&&P.length>0;e&&!X.current&&a?.(),X.current=e},[L,P.length,a]);let G=async e=>{_(e),T&&await V(e)},J=async e=>{await Y(e),_("edit"),a?.()};(0,W.useImperativeHandle)(l,()=>({submitMessage:async e=>{if(T&&"running"===L)K(e);else{a?.();let r=await H(x);r&&"running"===r.status?K(e,r.id):r&&console.error(`[AgentConversation] Session ${r.id} is ${r.status}, not sending message`)}}}),[T,L,H,K,x]);let Z=async e=>{let r,s=e.text.trim(),i=e.files.length>0;if(s||i){if(v(""),R.push(s),i){let i=[];for(let r of(s&&i.push({type:"text",text:s}),e.files))if(r.mediaType&&r.url){let e=r.url.match(/^data:[^;]+;base64,(.+)$/);e&&i.push({type:"image",mediaType:r.mediaType,data:e[1]})}r=i}else r=s;if(y){let e="string"==typeof r?r:r.filter(e=>"text"===e.type).map(e=>e.text).join("\n");if(e.trim()){S(!0);try{let i=await (0,iR.translateText)(e);if(i.error){v(s),vx.toast.error("Translation failed",{description:"Disable translation to send the original text."});return}r="string"==typeof r?i.translatedText:r.map(e=>"text"===e.type?{...e,text:i.translatedText}:e)}catch{v(s),vx.toast.error("Translation failed",{description:"Disable translation to send the original text."});return}finally{S(!1)}}}if(T&&"running"===L)console.log(`[AgentConversation] handleSubmit: existing session ${T.id}, status=${L}`),K(r);else{console.log(`[AgentConversation] handleSubmit: no session or not running (session=${T?.id}, status=${L}), starting new session...`),a?.();let e=await H(x);console.log("[AgentConversation] handleSubmit: startSession returned",e?.id??"null",e?.status),e&&"running"===e.status?K(r,e.id):e&&console.error(`[AgentConversation] Session ${e.id} is ${e.status}, not sending message`)}}};return e?(0,F.jsxs)("div",{className:"h-full flex flex-col min-h-0",children:[(0,F.jsxs)("div",{className:"flex-shrink-0 flex items-center justify-between px-4 h-10 border-b border-border/60 bg-muted/20",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(nA,{className:`h-4 w-4 ${"codex"===C?"text-green-500":"text-violet-500"}`}),j.length>1?(0,F.jsx)("select",{className:"text-sm font-medium bg-transparent border border-border rounded px-1.5 py-0.5 outline-none",value:C,onChange:e=>{let r=e.target.value;k(r),T&&q(r)},disabled:null!==T&&P.length>0,children:j.map(e=>(0,F.jsx)("option",{value:e.type,disabled:!e.available,children:e.displayName},e.type))}):(0,F.jsx)("span",{className:"text-sm font-medium",children:"codex"===C?"Codex":"Claude Code"}),(0,F.jsx)(yf,{mode:x,onModeChange:G,disabled:O}),D.length>=1&&i&&(0,F.jsx)(nL,{targets:D,activeTarget:s?.agent_mode??"local",onTargetChange:i}),T&&(c=T.id.startsWith("remote-"),d="text-muted-foreground",h=(0,F.jsx)(yd,{className:"h-3 w-3"}),u="Disconnected",B&&(c&&"connected"!==z&&null!==z?"reconnecting"===z?(d="text-amber-500",h=(0,F.jsx)(yc,{className:"h-3 w-3 animate-pulse"}),u="Reconnecting..."):"disconnected"===z&&(d="text-red-500",h=(0,F.jsx)(yd,{className:"h-3 w-3"}),u="Remote disconnected"):(d="text-green-500",h=(0,F.jsx)(yc,{className:"h-3 w-3"}),u="Connected")),(0,F.jsxs)("span",{className:`flex items-center gap-1 text-xs ${d}`,children:[h,u]}))]}),T&&(0,F.jsxs)("div",{className:"flex items-center gap-1",children:[(0,F.jsx)($.Button,{variant:"ghost",size:"icon",onClick:()=>q(),disabled:O,className:"h-7 w-7",title:"New Conversation",children:(0,F.jsx)(ik,{className:"h-3.5 w-3.5"})}),"running"===T.status&&(0,F.jsxs)($.Button,{variant:"ghost",size:"sm",onClick:()=>U(),className:"h-7 text-xs",children:[(0,F.jsx)(lc,{className:"h-3 w-3 mr-1"}),"Stop"]})]})]}),(0,F.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[(0,F.jsxs)(xZ,{className:"h-full",initial:"instant",children:[(0,F.jsxs)(xQ,{className:"gap-1 p-4",children:[T||0!==P.length?(0,F.jsx)(yv.Provider,{value:{sendMessage:K,messages:P,acceptPlan:J,permissionMode:T?.permissionMode??x,agentType:T?.agentType??C,sessionId:T?.id??null},children:(0,F.jsxs)("div",{className:"space-y-1",ref:E,children:[P.map((e,r)=>"user"===e.type?(0,F.jsx)("div",{"data-user-msg-idx":r,children:(0,F.jsx)(xL,{message:e,messageIndex:r})},r):(0,F.jsx)(xL,{message:e,messageIndex:r},r)),O&&(0,F.jsxs)("div",{className:"flex items-center gap-2 py-4 text-muted-foreground",children:[(0,F.jsx)(yl,{className:"h-4 w-4"}),(0,F.jsx)("span",{className:"text-sm",children:"Connecting to agent..."})]})]})}):(0,F.jsx)("div",{className:"text-center py-16",children:O||e&&!A?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(yl,{className:"h-6 w-6 mx-auto mb-4"}),(0,F.jsx)("h3",{className:"text-sm font-semibold mb-1 text-foreground",children:"Connecting to agent..."}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Setting up the session for this worktree"})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"mx-auto w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mb-4",children:(0,F.jsx)(nA,{className:"h-6 w-6 text-primary/60"})}),(0,F.jsx)("h3",{className:"text-sm font-semibold mb-1 text-foreground",children:"Start a conversation"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ask the agent to help you with coding tasks in this worktree"})]})}),I&&(0,F.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-red-500/10 rounded-lg text-red-500 text-sm mt-4",children:[(0,F.jsx)(vT,{className:"h-4 w-4"}),I]})]}),(0,F.jsx)(x0,{})]}),(0,F.jsx)(ym,{messages:P,contentRef:E})]}),(0,F.jsx)("div",{className:"flex-shrink-0 border-t border-border/60 p-3",children:(0,F.jsxs)(_6,{onSubmit:Z,accept:"image/*",className:"w-full",children:[(0,F.jsx)(yg,{}),(0,F.jsxs)("div",{className:"relative flex w-full flex-col",children:[y&&(0,F.jsx)("div",{className:"flex items-center pl-12 pr-2 pt-1.5 pb-0.5",children:(0,F.jsxs)("button",{type:"button",onClick:()=>b(!1),className:"inline-flex shrink-0 items-center gap-1.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 px-2.5 py-0.5 text-xs font-medium hover:bg-blue-500/20 transition-colors",children:[w?(0,F.jsx)(iE,{className:"size-3 animate-spin"}):(0,F.jsx)(yh,{className:"size-3"}),"Translate",(0,F.jsx)(i9,{className:"size-3"})]})}),(0,F.jsxs)("div",{className:"flex w-full items-center",children:[(0,F.jsxs)(ye,{children:[(0,F.jsx)(yt,{className:"ml-1"}),(0,F.jsxs)(yr,{children:[(0,F.jsx)(_4,{label:"Add images"}),(0,F.jsxs)(ys,{onSelect:()=>{b(!y)},children:[(0,F.jsx)(yh,{className:"mr-2 size-4"}),y?"Disable translation":"Translate"]})]})]}),(0,F.jsx)(_8,{value:g,onChange:e=>v(e.target.value),onKeyDown:R.handleKeyDown,placeholder:T?"Ask the agent to help with your code...":"Type your first message to start...",className:"pr-12"}),(0,F.jsx)(yi,{className:"absolute bottom-1 right-1",disabled:!g.trim()&&!O||w,status:w?"submitted":O?"streaming":"ready"})]})]})]})})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nA,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to start coding"})]})})});function yy(){return"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}function yb(e){let r={};e&&(r["Content-Type"]=e);let s=(0,iR.getAuthToken)();return s&&(r.Authorization=`Bearer ${s}`),r}async function yw(e,r){let s=await fetch(`${yy()}/api/projects/${e}/chat-sessions`,{method:"POST",headers:yb("application/json"),body:JSON.stringify({branch:r})});if(!s.ok)throw Error("Failed to create chat session");return s.json()}async function yS(e,r){if(!(await fetch(`${yy()}/api/chat-sessions/${e}/message`,{method:"POST",headers:yb("application/json"),body:JSON.stringify({content:r})})).ok)throw Error("Failed to send message")}async function yC(e){if(!(await fetch(`${yy()}/api/chat-sessions/${e}/stop`,{method:"POST",headers:yb()})).ok)throw Error("Failed to stop generation")}let yk=new Map;function yj(e,r){return`chat:${e}:${r??""}`}var yN=e.i(286235);function yE({projectId:e,branch:r}){let{session:s,messages:i,status:n,isInitialized:o,isLoading:a,error:l,sendMessage:c,stopGeneration:d}=function(e,r){let[s,i]=(0,W.useState)(null),[n,o]=(0,W.useState)([]),[a,l]=(0,W.useState)("stopped"),[c,d]=(0,W.useState)(!1),[h,u]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,g]=(0,W.useState)(null),v=(0,W.useRef)(null),x=(0,W.useRef)(null),_=(0,W.useRef)(0),y=(0,W.useRef)({entries:[],status:"stopped"}),b=(0,W.useRef)(!1),w=(0,W.useRef)(!0),S=(0,W.useRef)(!1),C=(0,W.useRef)(0),k=(0,W.useRef)(null),j=(0,W.useRef)(null),N=(0,W.useRef)(0),E=(0,W.useRef)(!1),R=(0,W.useCallback)(n=>{if(v.current?.readyState===WebSocket.OPEN||v.current?.readyState===WebSocket.CONNECTING)return;y.current={entries:[],status:"stopped"},b.current=!1,S.current=!0;let a=new WebSocket((0,iR.getWebSocketUrl)(`/api/chat-sessions/${n}/stream`));v.current=a,a.onopen=()=>{d(!0),g(null),k.current=Date.now(),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{_.current=0,N.current=0},5e3)},a.onmessage=s=>{try{let c=JSON.parse(s.data);if("JsonPatch"in c){var i,n;i=y.current,n=c.JsonPatch,y.current=vv(i,e=>{for(let r of n){let{op:s,path:i,value:n}=r;if("/entries"===i&&"replace"===s&&n?.type==="ENTRY"&&n.content?.type==="system"&&n.content?.content==="__CLEAR_ALL__"){e.entries=[];continue}if(i.startsWith("/entries/")){let r=parseInt(i.replace("/entries/",""),10);if(isNaN(r)||n?.type!=="ENTRY")continue;switch(s){case"add":for(;e.entries.length<=r;)e.entries.push(null);e.entries[r]=n.content;break;case"replace":r<e.entries.length&&(e.entries[r]=n.content);break;case"remove":r<e.entries.length&&e.entries.splice(r,1)}}else"/status"===i&&n?.type==="STATUS"&&(e.status=n.content)}}),S.current||(o([...y.current.entries.filter(Boolean)]),l(y.current.status));return}if("Ready"in c){S.current=!1,o([...y.current.entries.filter(Boolean)]),l(y.current.status),u(!0);return}if("finished"in c){b.current=!0,a.close(1e3,"finished");return}if("openPreviewFrame"in c)return void(0,gz.openPreviewFrame)(c.openPreviewFrame.projectId,c.openPreviewFrame.url);if("browserCommand"in c){let r=c.browserCommand;e&&(0,gz.sendCommandToIframe)(e,{type:"vibedeckx-command",...r}).then(e=>{e&&a.readyState===WebSocket.OPEN&&a.send(JSON.stringify({type:"browser_result",result:{id:r.id,success:e.success??!1,error:e.error,content:e.content,found:e.found,tag:e.tag,text:e.text}}))});return}if("error"in c){g(c.error),"Session not found"===c.error&&(e&&yk.delete(yj(e,r)),b.current=!0);return}}catch(e){console.error("[ChatSession] Failed to parse message:",e)}},a.onclose=n=>{let o,a;d(!1),j.current&&(clearTimeout(j.current),j.current=null);let l=k.current?Date.now()-k.current:0;if(k.current=null,l>0&&l<5e3){if(N.current++,N.current>=3)return E.current?void g("Unable to connect to remote server. Please check the server configuration."):(e&&yk.delete(yj(e,r)),i(null),g(null),_.current=0,N.current=0,void(w.current=!0))}else l>=5e3&&(N.current=0);if(b.current||1e3===n.code)return;if(_.current>=10)return void g("Unable to connect to server.");let c=(a=(o=Math.min(3e4,1e3*Math.pow(2,_.current)))*Math.random()*.25,o+a);_.current++,x.current=setTimeout(()=>{s?.id&&!b.current&&R(s.id)},c)},a.onerror=()=>{}},[s?.id]),M=(0,W.useCallback)(async()=>{if(!e)return null;let s=C.current;g(null),u(!1),E.current=!1;let n=yj(e,r),a=yk.get(n);if(a)return i(a),l(a.status),R(a.id),a;p(!0);try{let{session:a,messages:c}=await yw(e,r);if(C.current!==s)return null;return yk.set(n,a),i(a),l(a.status),c&&c.length>0&&o(c),R(a.id),a}catch(e){if(C.current!==s)return null;return g(e instanceof Error?e.message:"Failed to start session"),E.current=!0,null}finally{C.current===s&&p(!1)}},[e,r,R]),D=(0,W.useCallback)(async e=>{let r=s?.id;if(r&&e.trim())try{await yS(r,e.trim())}catch(r){let e=r instanceof Error?r.message:"Failed to send message";g(e),vx.toast.error("Failed to send message",{description:e})}},[s?.id]),T=(0,W.useCallback)(async()=>{if(s?.id)try{await yC(s.id)}catch(e){console.error("[ChatSession] Failed to stop generation:",e)}},[s?.id]);return(0,W.useEffect)(()=>()=>{v.current&&(b.current=!0,v.current.close()),x.current&&clearTimeout(x.current),j.current&&clearTimeout(j.current)},[]),(0,W.useEffect)(()=>{v.current&&(v.current.close(1e3,"branch-switch"),v.current=null),x.current&&(clearTimeout(x.current),x.current=null),j.current&&(clearTimeout(j.current),j.current=null),C.current+=1,i(null),l("stopped"),d(!1),u(!1),g(null),p(!1),y.current={entries:[],status:"stopped"},b.current=!1,_.current=0,k.current=null,N.current=0,E.current=!1,w.current=!0},[e,r]),(0,W.useEffect)(()=>{!w.current||!e||s||f||E.current||(w.current=!1,M())},[e,s,f,M]),(0,W.useEffect)(()=>{!s?.id||c||b.current||R(s.id)},[s?.id,c,R]),{session:s,messages:n,status:a,isConnected:c,isInitialized:h,isLoading:f,error:m,sendMessage:D,stopGeneration:T}}(e,r),[h,u]=(0,W.useState)(""),[f,p]=(0,W.useState)(!1),m="running"===n,g=(0,W.useCallback)(async e=>{let r=e.text.trim();r&&(u(""),await c(r))},[c]);return e?(0,F.jsxs)("div",{className:"h-full flex flex-col min-h-0",children:[(0,F.jsxs)("div",{className:"flex-shrink-0 flex items-center justify-between px-4 h-10 border-b border-border/60 bg-muted/20",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(f3,{className:"h-3.5 w-3.5 text-primary"}),(0,F.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Main Chat"}),m&&(0,F.jsx)(iE,{className:"h-3 w-3 animate-spin text-primary/60"})]}),s&&(0,F.jsx)($.Button,{variant:"ghost",size:"icon",onClick:async()=>{let e=!f;try{await iR.api.setChatEventListening(s.id,e),p(e)}catch{vx.toast.error("Failed to toggle event listening")}},className:`h-7 w-7 ${f?"text-amber-500":""}`,title:f?"Listening to executor events (click to disable)":"Listen to executor events (click to enable)",children:(0,F.jsx)(yN.Radio,{className:"h-3.5 w-3.5"})})]}),(0,F.jsxs)(xZ,{className:"flex-1 min-h-0",initial:"instant",children:[(0,F.jsxs)(xQ,{className:"gap-4 p-4",children:[a&&0===i.length&&(0,F.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,F.jsx)(iE,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),!a&&o&&0===i.length&&(0,F.jsxs)("div",{className:"text-center py-16",children:[(0,F.jsx)("div",{className:"mx-auto w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mb-4",children:(0,F.jsx)(f3,{className:"h-6 w-6 text-primary/60"})}),(0,F.jsx)("h3",{className:"text-sm font-semibold mb-1 text-foreground",children:"Start a conversation"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Chat with the AI assistant about your project"})]}),i.map((e,r)=>"user"===e.type?(0,F.jsx)(vG,{from:"user",children:(0,F.jsx)(vJ,{children:e.content})},r):"assistant"===e.type?(0,F.jsx)(vG,{from:"assistant",children:(0,F.jsx)(vJ,{children:(0,F.jsx)(vZ,{children:e.content})})},r):"tool_use"===e.type?(0,F.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 text-xs text-muted-foreground",children:[(0,F.jsx)(vI,{className:"w-3.5 h-3.5 animate-pulse"}),(0,F.jsx)("span",{children:function(e){switch(e){case"getExecutorStatus":return"Checking executor status...";case"getAgentConversation":return"Checking agent conversation...";case"listTerminals":return"Listing terminals...";case"runInTerminal":return"Sending command to terminal...";default:return`Running ${e}...`}}(e.tool)})]},r):"tool_result"===e.type?(0,F.jsx)("div",{className:"px-4 py-2",children:(0,F.jsxs)("details",{className:"text-xs text-muted-foreground",children:[(0,F.jsx)("summary",{className:"cursor-pointer hover:text-foreground",children:"Tool result"}),(0,F.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:e.output})]})},r):"error"===e.type?(0,F.jsx)("div",{className:"mx-auto max-w-[90%] rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:e.message},r):null),l&&(0,F.jsx)("div",{className:"mx-auto max-w-[90%] rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:l})]}),(0,F.jsx)(x0,{})]}),(0,F.jsxs)("div",{className:"flex-shrink-0 border-t border-border/60 p-3",children:[m&&(0,F.jsx)("div",{className:"flex justify-center mb-2",children:(0,F.jsxs)($.Button,{variant:"outline",size:"sm",onClick:d,className:"gap-1.5",children:[(0,F.jsx)(lc,{className:"h-3 w-3"}),"Stop generating"]})}),(0,F.jsxs)(_6,{onSubmit:g,className:"w-full",children:[(0,F.jsx)(_8,{disabled:!o||m,placeholder:o?m?"Waiting for response...":"Type a message...":"Connecting...",className:"pr-12",value:h,onChange:e=>u(e.currentTarget.value)}),(0,F.jsx)(yi,{className:"absolute bottom-1 right-1",disabled:!o||m||!h.trim()})]})]})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(f3,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to start chatting"})]})})}let yR=(0,W.createContext)(null);yR.displayName="PanelGroupContext";let yM="data-panel-group-direction",yD="data-panel-group-id",yT="data-resize-handle",yP="data-panel-resize-handle-id",yL=W.useLayoutEffect,yB=W["useId".toString()],yA="function"==typeof yB?yB:()=>null,yO=0;function yI(e=null){let r=yA(),s=(0,W.useRef)(e||r||null);return null===s.current&&(s.current=""+yO++),null!=e?e:s.current}function yz({children:e,className:r="",collapsedSize:s,collapsible:i,defaultSize:n,forwardedRef:o,id:a,maxSize:l,minSize:c,onCollapse:d,onExpand:h,onResize:u,order:f,style:p,tagName:m="div",...g}){let v=(0,W.useContext)(yR);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:x,expandPanel:_,getPanelSize:y,getPanelStyle:b,groupId:w,isPanelCollapsed:S,reevaluatePanelConstraints:C,registerPanel:k,resizePanel:j,unregisterPanel:N}=v,E=yI(a),R=(0,W.useRef)({callbacks:{onCollapse:d,onExpand:h,onResize:u},constraints:{collapsedSize:s,collapsible:i,defaultSize:n,maxSize:l,minSize:c},id:E,idIsFromProps:void 0!==a,order:f});(0,W.useRef)({didLogMissingDefaultSizeWarning:!1}),yL(()=>{let{callbacks:e,constraints:r}=R.current,o={...r};R.current.id=E,R.current.idIsFromProps=void 0!==a,R.current.order=f,e.onCollapse=d,e.onExpand=h,e.onResize=u,r.collapsedSize=s,r.collapsible=i,r.defaultSize=n,r.maxSize=l,r.minSize=c,(o.collapsedSize!==r.collapsedSize||o.collapsible!==r.collapsible||o.maxSize!==r.maxSize||o.minSize!==r.minSize)&&C(R.current,o)}),yL(()=>{let e=R.current;return k(e),()=>{N(e)}},[f,E,k,N]),(0,W.useImperativeHandle)(o,()=>({collapse:()=>{x(R.current)},expand:e=>{_(R.current,e)},getId:()=>E,getSize:()=>y(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{j(R.current,e)}}),[x,_,y,S,E,j]);let M=b(R.current,n);return(0,W.createElement)(m,{...g,children:e,className:r,id:E,style:{...M,...p},[yD]:w,"data-panel":"","data-panel-collapsible":i||void 0,"data-panel-id":E,"data-panel-size":parseFloat(""+M.flexGrow).toFixed(1)})}let yF=(0,W.forwardRef)((e,r)=>(0,W.createElement)(yz,{...e,forwardedRef:r}));yz.displayName="Panel",yF.displayName="forwardRef(Panel)";let yW=null,yH=-1,y$=null;function yK(e,s){var i,n,o;let a=function(e,r){if(r){let e=(r&y0)!=0,s=(r&y1)!=0,i=(r&y2)!=0,n=(r&y5)!=0;if(e)if(i)return"se-resize";else if(n)return"ne-resize";else return"e-resize";if(s)if(i)return"sw-resize";else if(n)return"nw-resize";else return"w-resize";if(i)return"s-resize";else if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,s);yW!==a&&(yW=a,null===y$&&(y$=document.createElement("style"),r&&y$.setAttribute("nonce",r),document.head.appendChild(y$)),yH>=0&&(null==(o=y$.sheet)||o.removeRule(yH)),yH=null!=(i=null==(n=y$.sheet)?void 0:n.insertRule(`*{cursor: ${a} !important;}`))?i:-1)}function yU(e){return"keydown"===e.type}function yq(e){return e.type.startsWith("pointer")}function yV(e){return e.type.startsWith("mouse")}function yY(e){if(yq(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(yV(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}let yX=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function yG(e){let r=e.length;for(;r--;){let s=e[r];if(bc(s,"Missing node"),function(e){var r;let s,i=getComputedStyle(e);return"fixed"===i.position||!!("auto"!==i.zIndex&&("static"!==i.position||"flex"===(s=getComputedStyle(null!=(r=yQ(e))?r:e).display)||"inline-flex"===s)||1>+i.opacity||"transform"in i&&"none"!==i.transform||"webkitTransform"in i&&"none"!==i.webkitTransform||"mixBlendMode"in i&&"normal"!==i.mixBlendMode||"filter"in i&&"none"!==i.filter||"webkitFilter"in i&&"none"!==i.webkitFilter||"isolation"in i&&"isolate"===i.isolation||yX.test(i.willChange))||"touch"===i.webkitOverflowScrolling}(s))return s}return null}function yJ(e){return e&&Number(getComputedStyle(e).zIndex)||0}function yZ(e){let r=[];for(;e;)r.push(e),e=yQ(e);return r}function yQ(e){let{parentNode:r}=e;return r&&r instanceof ShadowRoot?r.host:r}let y0=1,y1=2,y2=4,y5=8,y3="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}(),y4=[],y6=!1,y8=new Map,y7=new Map,y9=new Set;function be(e){let{target:r}=e,{x:s,y:i}=yY(e);y6=!0,bi({target:r,x:s,y:i}),ba(),y4.length>0&&(bl("down",e),e.preventDefault(),bs(r)||e.stopImmediatePropagation())}function bt(e){let{x:r,y:s}=yY(e);if(y6&&0===e.buttons&&(y6=!1,bl("up",e)),!y6){let{target:i}=e;bi({target:i,x:r,y:s})}bl("move",e),bn(),y4.length>0&&e.preventDefault()}function br(e){let{target:r}=e,{x:s,y:i}=yY(e);y7.clear(),y6=!1,y4.length>0&&(e.preventDefault(),bs(r)||e.stopImmediatePropagation()),bl("up",e),bi({target:r,x:s,y:i}),bn(),ba()}function bs(e){let r=e;for(;r;){if(r.hasAttribute(yT))return!0;r=r.parentElement}return!1}function bi({target:e,x:r,y:s}){y4.splice(0);let i=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(i=e),y9.forEach(e=>{let{element:n,hitAreaMargins:o}=e,a=n.getBoundingClientRect(),{bottom:l,left:c,right:d,top:h}=a,u=y3?o.coarse:o.fine;if(r>=c-u&&r<=d+u&&s>=h-u&&s<=l+u){if(null!==i&&document.contains(i)&&n!==i&&!n.contains(i)&&!i.contains(n)&&function(e,r){let s;if(e===r)throw Error("Cannot compare node with itself");let i={a:yZ(e),b:yZ(r)};for(;i.a.at(-1)===i.b.at(-1);)e=i.a.pop(),r=i.b.pop(),s=e;bc(s,"Stacking order can only be calculated for elements with a common ancestor");let n={a:yJ(yG(i.a)),b:yJ(yG(i.b))};if(n.a===n.b){let e=s.childNodes,r={a:i.a.at(-1),b:i.b.at(-1)},n=e.length;for(;n--;){let s=e[n];if(s===r.a)return 1;if(s===r.b)return -1}}return Math.sign(n.a-n.b)}(i,n)>0){let e=i,r=!1;for(;e;){var f;if(e.contains(n))break;if(f=e.getBoundingClientRect(),f.x<a.x+a.width&&f.x+f.width>a.x&&f.y<a.y+a.height&&f.y+f.height>a.y){r=!0;break}e=e.parentElement}if(r)return}y4.push(e)}})}function bn(){let e=!1,r=!1;y4.forEach(s=>{let{direction:i}=s;"horizontal"===i?e=!0:r=!0});let s=0;y7.forEach(e=>{s|=e}),e&&r?yK("intersection",s):e?yK("horizontal",s):r?yK("vertical",s):null!==y$&&(document.head.removeChild(y$),yW=null,y$=null,yH=-1)}let bo=new AbortController;function ba(){bo.abort();let e={capture:!0,signal:(bo=new AbortController).signal};y9.size&&(y6?(y4.length>0&&y8.forEach((r,s)=>{let{body:i}=s;r>0&&(i.addEventListener("contextmenu",br,e),i.addEventListener("pointerleave",bt,e),i.addEventListener("pointermove",bt,e))}),window.addEventListener("pointerup",br,e),window.addEventListener("pointercancel",br,e)):y8.forEach((r,s)=>{let{body:i}=s;r>0&&(i.addEventListener("pointerdown",be,e),i.addEventListener("pointermove",bt,e))}))}function bl(e,r){y9.forEach(s=>{let{setResizeHandlerState:i}=s;i(e,y4.includes(s),r)})}function bc(e,r){if(!e)throw console.error(r),Error(r)}function bd(e,r,s=10){return e.toFixed(s)===r.toFixed(s)?0:e>r?1:-1}function bh(e,r,s=10){return 0===bd(e,r,s)}function bu(e,r,s){return 0===bd(e,r,s)}function bf({panelConstraints:e,panelIndex:r,size:s}){let i=e[r];bc(null!=i,`Panel constraints not found for index ${r}`);let{collapsedSize:n=0,collapsible:o,maxSize:a=100,minSize:l=0}=i;return 0>bd(s,l)&&(s=o&&0>bd(s,(n+l)/2)?n:l),s=parseFloat((s=Math.min(a,s)).toFixed(10))}function bp({delta:e,initialLayout:r,panelConstraints:s,pivotIndices:i,prevLayout:n,trigger:o}){if(bu(e,0))return r;let a=[...r],[l,c]=i;bc(null!=l,"Invalid first pivot index"),bc(null!=c,"Invalid second pivot index");let d=0;if("keyboard"===o){{let i=e<0?c:l,n=s[i];bc(n,`Panel constraints not found for index ${i}`);let{collapsedSize:o=0,collapsible:a,minSize:d=0}=n;if(a){let s=r[i];if(bc(null!=s,`Previous layout not found for panel index ${i}`),bu(s,o)){let r=d-s;bd(r,Math.abs(e))>0&&(e=e<0?0-r:r)}}}{let i=e<0?l:c,n=s[i];bc(n,`No panel constraints found for index ${i}`);let{collapsedSize:o=0,collapsible:a,minSize:d=0}=n;if(a){let s=r[i];if(bc(null!=s,`Previous layout not found for panel index ${i}`),bu(s,d)){let r=s-o;bd(r,Math.abs(e))>0&&(e=e<0?0-r:r)}}}}{let i=e<0?1:-1,n=e<0?c:l,o=0;for(;;){let e=r[n];if(bc(null!=e,`Previous layout not found for panel index ${n}`),o+=bf({panelConstraints:s,panelIndex:n,size:100})-e,(n+=i)<0||n>=s.length)break}let a=Math.min(Math.abs(e),Math.abs(o));e=e<0?0-a:a}{let i=e<0?l:c;for(;i>=0&&i<s.length;){let n=Math.abs(e)-Math.abs(d),o=r[i];bc(null!=o,`Previous layout not found for panel index ${i}`);let l=bf({panelConstraints:s,panelIndex:i,size:o-n});if(!bu(o,l)&&(d+=o-l,a[i]=l,d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?i--:i++}}if(function(e,r,s){if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(!bu(e[s],r[s],void 0))return!1;return!0}(n,a))return n;{let i=e<0?c:l,n=r[i];bc(null!=n,`Previous layout not found for panel index ${i}`);let o=n+d,h=bf({panelConstraints:s,panelIndex:i,size:o});if(a[i]=h,!bu(h,o)){let r=o-h,i=e<0?c:l;for(;i>=0&&i<s.length;){let n=a[i];bc(null!=n,`Previous layout not found for panel index ${i}`);let o=bf({panelConstraints:s,panelIndex:i,size:n+r});if(bu(n,o)||(r-=o-n,a[i]=o),bu(r,0))break;e>0?i--:i++}}}return bu(a.reduce((e,r)=>r+e,0),100)?a:n}function bm(e,r=document){return Array.from(r.querySelectorAll(`[${yP}][data-panel-group-id="${e}"]`))}function bg(e,r,s=document){let i=bm(e,s).findIndex(e=>e.getAttribute(yP)===r);return null!=i?i:null}function bv(e,r,s){let i=bg(e,r,s);return null!=i?[i,i+1]:[-1,-1]}function bx(e,r=document){var s;if(r instanceof HTMLElement&&(null==r||null==(s=r.dataset)?void 0:s.panelGroupId)==e)return r;let i=r.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return i||null}function b_(e,r=document){let s=r.querySelector(`[${yP}="${e}"]`);return s||null}function by(e,r){if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==r[s])return!1;return!0}function bb(e,r){let{x:s,y:i}=yY(r);return"horizontal"===e?s:i}function bw(e,r,s){r.forEach((r,i)=>{let n=e[i];bc(n,`Panel data not found for index ${i}`);let{callbacks:o,constraints:a,id:l}=n,{collapsedSize:c=0,collapsible:d}=a,h=s[l];if(null==h||r!==h){s[l]=r;let{onCollapse:e,onExpand:i,onResize:n}=o;n&&n(r,h),d&&(e||i)&&(i&&(null==h||bh(h,c))&&!bh(r,c)&&i(),e&&(null==h||!bh(h,c))&&bh(r,c)&&e())}})}function bS(e,r){if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=r[s])return!1;return!0}function bC(e){try{if("undefined"!=typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw Error("localStorage not supported in this environment")}catch(r){console.error(r),e.getItem=()=>null,e.setItem=()=>{}}}function bk(e){return`react-resizable-panels:${e}`}function bj(e){return e.map(e=>{let{constraints:r,id:s,idIsFromProps:i,order:n}=e;return i?s:n?`${n}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function bN(e,r){try{let s=bk(e),i=r.getItem(s);if(i){let e=JSON.parse(i);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}function bE(e,r,s,i,n){var o;let a=bk(e),l=bj(r),c=null!=(o=bN(e,n))?o:{};c[l]={expandToSizes:Object.fromEntries(s.entries()),layout:i};try{n.setItem(a,JSON.stringify(c))}catch(e){console.error(e)}}function bR({layout:e,panelConstraints:r}){let s=[...e],i=s.reduce((e,r)=>e+r,0);if(s.length!==r.length)throw Error(`Invalid ${r.length} panel layout: ${s.map(e=>`${e}%`).join(", ")}`);if(!bu(i,100)&&s.length>0)for(let e=0;e<r.length;e++){let r=s[e];bc(null!=r,`No layout data found for index ${e}`);let n=100/i*r;s[e]=n}let n=0;for(let e=0;e<r.length;e++){let i=s[e];bc(null!=i,`No layout data found for index ${e}`);let o=bf({panelConstraints:r,panelIndex:e,size:i});i!=o&&(n+=i-o,s[e]=o)}if(!bu(n,0))for(let e=0;e<r.length;e++){let i=s[e];bc(null!=i,`No layout data found for index ${e}`);let o=bf({panelConstraints:r,panelIndex:e,size:i+n});if(i!==o&&(n-=o-i,s[e]=o,bu(n,0)))break}return s}let bM={getItem:e=>(bC(bM),bM.getItem(e)),setItem:(e,r)=>{bC(bM),bM.setItem(e,r)}},bD={};function bT({autoSaveId:e=null,children:r,className:s="",direction:i,forwardedRef:n,id:o=null,onLayout:a=null,keyboardResizeBy:l=null,storage:c=bM,style:d,tagName:h="div",...u}){let f=yI(o),p=(0,W.useRef)(null),[m,g]=(0,W.useState)(null),[v,x]=(0,W.useState)([]),_=function(){let[e,r]=(0,W.useState)(0);return(0,W.useCallback)(()=>r(e=>e+1),[])}(),y=(0,W.useRef)({}),b=(0,W.useRef)(new Map),w=(0,W.useRef)(0),S=(0,W.useRef)({autoSaveId:e,direction:i,dragState:m,id:f,keyboardResizeBy:l,onLayout:a,storage:c}),C=(0,W.useRef)({layout:v,panelDataArray:[],panelDataArrayChanged:!1});(0,W.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,W.useImperativeHandle)(n,()=>({getId:()=>S.current.id,getLayout:()=>{let{layout:e}=C.current;return e},setLayout:e=>{let{onLayout:r}=S.current,{layout:s,panelDataArray:i}=C.current,n=bR({layout:e,panelConstraints:i.map(e=>e.constraints)});by(s,n)||(x(n),C.current.layout=n,r&&r(n),bw(i,n,y.current))}}),[]),yL(()=>{S.current.autoSaveId=e,S.current.direction=i,S.current.dragState=m,S.current.id=f,S.current.onLayout=a,S.current.storage=c}),function({committedValuesRef:e,eagerValuesRef:r,groupId:s,layout:i,panelDataArray:n,panelGroupElement:o,setLayout:a}){(0,W.useRef)({didWarnAboutMissingResizeHandle:!1}),yL(()=>{if(!o)return;let e=bm(s,o);for(let r=0;r<n.length-1;r++){let{valueMax:s,valueMin:o,valueNow:a}=function({layout:e,panelsArray:r,pivotIndices:s}){let i=0,n=100,o=0,a=0,l=s[0];return bc(null!=l,"No pivot index found"),r.forEach((e,r)=>{let{constraints:s}=e,{maxSize:c=100,minSize:d=0}=s;r===l?(i=d,n=c):(o+=d,a+=c)}),{valueMax:Math.min(n,100-o),valueMin:Math.max(i,100-a),valueNow:e[l]}}({layout:i,panelsArray:n,pivotIndices:[r,r+1]}),l=e[r];if(null==l);else{let e=n[r];bc(e,`No panel data found for index "${r}"`),l.setAttribute("aria-controls",e.id),l.setAttribute("aria-valuemax",""+Math.round(s)),l.setAttribute("aria-valuemin",""+Math.round(o)),l.setAttribute("aria-valuenow",null!=a?""+Math.round(a):"")}}return()=>{e.forEach((e,r)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")})}},[s,i,n,o]),(0,W.useEffect)(()=>{if(!o)return;let e=r.current;bc(e,"Eager values not found");let{panelDataArray:n}=e;bc(null!=bx(s,o),`No group found for id "${s}"`);let l=bm(s,o);bc(l,`No resize handles found for group id "${s}"`);let c=l.map(e=>{let r=e.getAttribute(yP);bc(r,"Resize handle element has no handle id attribute");let[l,c]=function(e,r,s,i=document){var n,o,a,l;let c=b_(r,i),d=bm(e,i),h=c?d.indexOf(c):-1;return[null!=(n=null==(o=s[h])?void 0:o.id)?n:null,null!=(a=null==(l=s[h+1])?void 0:l.id)?a:null]}(s,r,n,o);if(null==l||null==c)return()=>{};let d=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let c=n.findIndex(e=>e.id===l);if(c>=0){let e=n[c];bc(e,`No panel data found for index ${c}`);let l=i[c],{collapsedSize:d=0,collapsible:h,minSize:u=0}=e.constraints;if(null!=l&&h){let e=bp({delta:bu(l,d)?u-d:d-l,initialLayout:i,panelConstraints:n.map(e=>e.constraints),pivotIndices:bv(s,r,o),prevLayout:i,trigger:"keyboard"});i!==e&&a(e)}}}};return e.addEventListener("keydown",d),()=>{e.removeEventListener("keydown",d)}});return()=>{c.forEach(e=>e())}},[o,e,r,s,i,n,a])}({committedValuesRef:S,eagerValuesRef:C,groupId:f,layout:v,panelDataArray:C.current.panelDataArray,setLayout:x,panelGroupElement:p.current}),(0,W.useEffect)(()=>{let{panelDataArray:r}=C.current;if(e){if(0===v.length||v.length!==r.length)return;let s=bD[e];null==s&&(s=function(e,r=10){let s=null;return(...i)=>{null!==s&&clearTimeout(s),s=setTimeout(()=>{e(...i)},r)}}(bE,100),bD[e]=s),s(e,[...r],new Map(b.current),v,c)}},[e,v,c]),(0,W.useEffect)(()=>{});let k=(0,W.useCallback)(e=>{let{onLayout:r}=S.current,{layout:s,panelDataArray:i}=C.current;if(e.constraints.collapsible){let n=i.map(e=>e.constraints),{collapsedSize:o=0,panelSize:a,pivotIndices:l}=bB(i,e,s);if(bc(null!=a,`Panel size not found for panel "${e.id}"`),!bh(a,o)){b.current.set(e.id,a);let c=bp({delta:bL(i,e)===i.length-1?a-o:o-a,initialLayout:s,panelConstraints:n,pivotIndices:l,prevLayout:s,trigger:"imperative-api"});bS(s,c)||(x(c),C.current.layout=c,r&&r(c),bw(i,c,y.current))}}},[]),j=(0,W.useCallback)((e,r)=>{let{onLayout:s}=S.current,{layout:i,panelDataArray:n}=C.current;if(e.constraints.collapsible){let o=n.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l=0,minSize:c=0,pivotIndices:d}=bB(n,e,i),h=null!=r?r:c;if(bh(l,a)){let r=b.current.get(e.id),a=null!=r&&r>=h?r:h,c=bp({delta:bL(n,e)===n.length-1?l-a:a-l,initialLayout:i,panelConstraints:o,pivotIndices:d,prevLayout:i,trigger:"imperative-api"});bS(i,c)||(x(c),C.current.layout=c,s&&s(c),bw(n,c,y.current))}}},[]),N=(0,W.useCallback)(e=>{let{layout:r,panelDataArray:s}=C.current,{panelSize:i}=bB(s,e,r);return bc(null!=i,`Panel size not found for panel "${e.id}"`),i},[]),E=(0,W.useCallback)((e,r)=>{let{panelDataArray:s}=C.current,i=bL(s,e);return function({defaultSize:e,dragState:r,layout:s,panelData:i,panelIndex:n,precision:o=3}){let a=s[n];return{flexBasis:0,flexGrow:null==a?void 0!=e?e.toPrecision(o):"1":1===i.length?"1":a.toPrecision(o),flexShrink:1,overflow:"hidden",pointerEvents:null!==r?"none":void 0}}({defaultSize:r,dragState:m,layout:v,panelData:s,panelIndex:i})},[m,v]),R=(0,W.useCallback)(e=>{let{layout:r,panelDataArray:s}=C.current,{collapsedSize:i=0,collapsible:n,panelSize:o}=bB(s,e,r);return bc(null!=o,`Panel size not found for panel "${e.id}"`),!0===n&&bh(o,i)},[]),M=(0,W.useCallback)(e=>{let{layout:r,panelDataArray:s}=C.current,{collapsedSize:i=0,collapsible:n,panelSize:o}=bB(s,e,r);return bc(null!=o,`Panel size not found for panel "${e.id}"`),!n||bd(o,i)>0},[]),D=(0,W.useCallback)(e=>{let{panelDataArray:r}=C.current;r.push(e),r.sort((e,r)=>{let s=e.order,i=r.order;return null==s&&null==i?0:null==s?-1:null==i?1:s-i}),C.current.panelDataArrayChanged=!0,_()},[_]);yL(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;let{autoSaveId:s,onLayout:i,storage:n}=S.current,{layout:o,panelDataArray:a}=C.current,l=null;if(s){var e,r;let i=null!=(r=(null!=(e=bN(s,n))?e:{})[bj(a)])?r:null;i&&(b.current=new Map(Object.entries(i.expandToSizes)),l=i.layout)}null==l&&(l=function({panelDataArray:e}){let r=Array(e.length),s=e.map(e=>e.constraints),i=0,n=100;for(let o=0;o<e.length;o++){let e=s[o];bc(e,`Panel constraints not found for index ${o}`);let{defaultSize:a}=e;null!=a&&(i++,r[o]=a,n-=a)}for(let o=0;o<e.length;o++){let a=s[o];bc(a,`Panel constraints not found for index ${o}`);let{defaultSize:l}=a;if(null!=l)continue;let c=n/(e.length-i);i++,r[o]=c,n-=c}return r}({panelDataArray:a}));let c=bR({layout:l,panelConstraints:a.map(e=>e.constraints)});by(o,c)||(x(c),C.current.layout=c,i&&i(c),bw(a,c,y.current))}}),yL(()=>{let e=C.current;return()=>{e.layout=[]}},[]);let T=(0,W.useCallback)(e=>{let r=!1,s=p.current;return s&&"rtl"===window.getComputedStyle(s,null).getPropertyValue("direction")&&(r=!0),function(s){var i,n;s.preventDefault();let o=p.current;if(!o)return()=>null;let{direction:a,dragState:l,id:c,keyboardResizeBy:d,onLayout:h}=S.current,{layout:u,panelDataArray:f}=C.current,{initialLayout:m}=null!=l?l:{},g=bv(c,e,o),v=function(e,r,s,i,n,o){if(yU(e)){let r="horizontal"===s,i=0;i=e.shiftKey?100:null!=n?n:10;let o=0;switch(e.key){case"ArrowDown":o=r?0:i;break;case"ArrowLeft":o=r?-i:0;break;case"ArrowRight":o=r?i:0;break;case"ArrowUp":o=r?0:-i;break;case"End":o=100;break;case"Home":o=-100}return o}return null==i?0:function(e,r,s,i,n){let o="horizontal"===s,a=b_(r,n);bc(a,`No resize handle element found for id "${r}"`);let l=a.getAttribute(yD);bc(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=i,d=bb(s,e),h=bx(l,n);bc(h,`No group element found for id "${l}"`);let u=h.getBoundingClientRect();return(d-c)/(o?u.width:u.height)*100}(e,r,s,i,o)}(s,e,a,l,d,o),_="horizontal"===a;_&&r&&(v=-v);let b=bp({delta:v,initialLayout:null!=m?m:u,panelConstraints:f.map(e=>e.constraints),pivotIndices:g,prevLayout:u,trigger:yU(s)?"keyboard":"mouse-or-touch"}),k=!bS(u,b);(yq(s)||yV(s))&&w.current!=v&&((w.current=v,k||0===v)?y7.set(e,0):_?(i=v<0?y0:y1,y7.set(e,i)):(n=v<0?y2:y5,y7.set(e,n))),k&&(x(b),C.current.layout=b,h&&h(b),bw(f,b,y.current))}},[]),P=(0,W.useCallback)((e,r)=>{let{onLayout:s}=S.current,{layout:i,panelDataArray:n}=C.current,o=n.map(e=>e.constraints),{panelSize:a,pivotIndices:l}=bB(n,e,i);bc(null!=a,`Panel size not found for panel "${e.id}"`);let c=bp({delta:bL(n,e)===n.length-1?a-r:r-a,initialLayout:i,panelConstraints:o,pivotIndices:l,prevLayout:i,trigger:"imperative-api"});bS(i,c)||(x(c),C.current.layout=c,s&&s(c),bw(n,c,y.current))},[]),L=(0,W.useCallback)((e,r)=>{let{layout:s,panelDataArray:i}=C.current,{collapsedSize:n=0,collapsible:o}=r,{collapsedSize:a=0,collapsible:l,maxSize:c=100,minSize:d=0}=e.constraints,{panelSize:h}=bB(i,e,s);null!=h&&(o&&l&&bh(h,n)?bh(n,a)||P(e,a):h<d?P(e,d):h>c&&P(e,c))},[P]),B=(0,W.useCallback)((e,r)=>{let{direction:s}=S.current,{layout:i}=C.current;if(!p.current)return;let n=b_(e,p.current);bc(n,`Drag handle element not found for id "${e}"`);let o=bb(s,r);g({dragHandleId:e,dragHandleRect:n.getBoundingClientRect(),initialCursorPosition:o,initialLayout:i})},[]),A=(0,W.useCallback)(()=>{g(null)},[]),O=(0,W.useCallback)(e=>{let{panelDataArray:r}=C.current,s=bL(r,e);s>=0&&(r.splice(s,1),delete y.current[e.id],C.current.panelDataArrayChanged=!0,_())},[_]),I=(0,W.useMemo)(()=>({collapsePanel:k,direction:i,dragState:m,expandPanel:j,getPanelSize:N,getPanelStyle:E,groupId:f,isPanelCollapsed:R,isPanelExpanded:M,reevaluatePanelConstraints:L,registerPanel:D,registerResizeHandle:T,resizePanel:P,startDragging:B,stopDragging:A,unregisterPanel:O,panelGroupElement:p.current}),[k,m,i,j,N,E,f,R,M,L,D,T,P,B,A,O]);return(0,W.createElement)(yR.Provider,{value:I},(0,W.createElement)(h,{...u,children:r,className:s,id:o,ref:p,style:{display:"flex",flexDirection:"horizontal"===i?"row":"column",height:"100%",overflow:"hidden",width:"100%",...d},"data-panel-group":"",[yM]:i,[yD]:f}))}let bP=(0,W.forwardRef)((e,r)=>(0,W.createElement)(bT,{...e,forwardedRef:r}));function bL(e,r){return e.findIndex(e=>e===r||e.id===r.id)}function bB(e,r,s){let i=bL(e,r),n=i===e.length-1,o=s[i];return{...r.constraints,panelSize:o,pivotIndices:n?[i-1,i]:[i,i+1]}}function bA({children:e=null,className:r="",disabled:s=!1,hitAreaMargins:i,id:n,onBlur:o,onClick:a,onDragging:l,onFocus:c,onPointerDown:d,onPointerUp:h,style:u={},tabIndex:f=0,tagName:p="div",...m}){var g,v;let x=(0,W.useRef)(null),_=(0,W.useRef)({onClick:a,onDragging:l,onPointerDown:d,onPointerUp:h});(0,W.useEffect)(()=>{_.current.onClick=a,_.current.onDragging=l,_.current.onPointerDown=d,_.current.onPointerUp=h});let y=(0,W.useContext)(yR);if(null===y)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:b,groupId:w,registerResizeHandle:S,startDragging:C,stopDragging:k,panelGroupElement:j}=y,N=yI(n),[E,R]=(0,W.useState)("inactive"),[M,D]=(0,W.useState)(!1),[T,P]=(0,W.useState)(null),L=(0,W.useRef)({state:E});yL(()=>{L.current.state=E}),(0,W.useEffect)(()=>{if(s)P(null);else{let e=S(N);P(()=>e)}},[s,N,S]);let B=null!=(g=null==i?void 0:i.coarse)?g:15,A=null!=(v=null==i?void 0:i.fine)?v:5;return(0,W.useEffect)(()=>{if(s||null==T)return;let e=x.current;bc(e,"Element ref not attached");let r=!1;return function(e,r,s,i,n){var o;let{ownerDocument:a}=r,l={direction:s,element:r,hitAreaMargins:i,setResizeHandlerState:n},c=null!=(o=y8.get(a))?o:0;return y8.set(a,c+1),y9.add(l),ba(),function(){var r;y7.delete(e),y9.delete(l);let s=null!=(r=y8.get(a))?r:1;if(y8.set(a,s-1),ba(),1===s&&y8.delete(a),y4.includes(l)){let e=y4.indexOf(l);e>=0&&y4.splice(e,1),bn(),n("up",!0,null)}}}(N,e,b,{coarse:B,fine:A},(e,s,i)=>{if(!s)return void R("inactive");switch(e){case"down":{R("drag"),r=!1,bc(i,'Expected event to be defined for "down" action'),C(N,i);let{onDragging:e,onPointerDown:s}=_.current;null==e||e(!0),null==s||s();break}case"move":{let{state:e}=L.current;r=!0,"drag"!==e&&R("hover"),bc(i,'Expected event to be defined for "move" action'),T(i);break}case"up":{R("hover"),k();let{onClick:e,onDragging:s,onPointerUp:i}=_.current;null==s||s(!1),null==i||i(),r||null==e||e()}}})},[B,b,s,A,S,N,T,C,k]),!function({disabled:e,handleId:r,resizeHandler:s,panelGroupElement:i}){(0,W.useEffect)(()=>{if(e||null==s||null==i)return;let n=b_(r,i);if(null==n)return;let o=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),s(e);break;case"F6":{e.preventDefault();let s=n.getAttribute(yD);bc(s,`No group element found for id "${s}"`);let o=bm(s,i),a=bg(s,r,i);bc(null!==a,`No resize element found for id "${r}"`);let l=e.shiftKey?a>0?a-1:o.length-1:a+1<o.length?a+1:0;o[l].focus()}}};return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}},[i,e,r,s])}({disabled:s,handleId:N,resizeHandler:T,panelGroupElement:j}),(0,W.createElement)(p,{...m,children:e,className:r,id:n,onBlur:()=>{D(!1),null==o||o()},onFocus:()=>{D(!0),null==c||c()},ref:x,role:"separator",style:{touchAction:"none",userSelect:"none",...u},tabIndex:f,[yM]:b,[yD]:w,[yT]:"","data-resize-handle-active":"drag"===E?"pointer":M?"keyboard":void 0,"data-panel-resize-handle-enabled":!s,[yP]:N,"data-resize-handle-state":E})}bT.displayName="PanelGroup",bP.displayName="forwardRef(PanelGroup)",bA.displayName="PanelResizeHandle";let bO=({className:e,...r})=>(0,F.jsx)(bP,{className:(0,iu.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...r}),bI=({withHandle:e,className:r,...s})=>(0,F.jsx)(bA,{className:(0,iu.cn)("relative flex w-px items-center justify-center bg-border/60 after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-[''] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:inset-x-0 data-[panel-group-direction=vertical]:after:-top-1 data-[panel-group-direction=vertical]:after:-bottom-1 data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:right-0 [&[data-resize-handle-active]]:bg-ring",r),...s,children:e&&(0,F.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,F.jsx)(lh,{className:"h-2.5 w-2.5"})})}),bz=(0,ic.default)("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),bF=(0,ic.default)("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"}]]);function bW({status:e}){return e&&"idle"!==e?"assigned"===e?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-yellow-500 shrink-0"}):"working"===e?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse shrink-0"}):(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0"}):(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/30 shrink-0"})}function bH({project:e}){let r=!!e.path,s=e.is_remote||!!e.remote_path;return r&&s?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-purple-500 shrink-0"}):s?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0"}):(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/30 shrink-0"})}function b$({activeView:e,onViewChange:r,worktrees:s,selectedBranch:i,onBranchChange:n,currentProject:o,onCreateWorktreeOpen:a,onDeleteWorktree:l,workspaceStatuses:c,hasProject:d=!0,projects:h,onSelectProject:u,onCreateProjectOpen:f}){return(0,F.jsxs)("nav",{className:"w-52 border-r border-border/60 bg-sidebar flex flex-col p-3",children:[(0,F.jsxs)("div",{className:"space-y-0.5",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-3 mb-2",children:[(0,F.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Projects"}),(0,F.jsx)("button",{onClick:f,className:"p-0.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors text-muted-foreground",title:"Create new project",children:(0,F.jsx)(nT,{className:"h-3 w-3"})})]}),h&&h.length>0?(0,F.jsx)(gM,{delayDuration:300,children:(0,F.jsx)("div",{className:"flex flex-col gap-0.5 max-h-40 overflow-y-auto",children:h.map(s=>{let i=o?.id===s.id,n=i&&"project-info"===e;return(0,F.jsxs)(gD,{children:[(0,F.jsx)(gT,{asChild:!0,children:(0,F.jsxs)("button",{onClick:()=>{u?.(s),r("project-info")},className:(0,iu.cn)("w-full flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs transition-all duration-150 min-w-0","hover:bg-accent/80 hover:text-accent-foreground",n?"bg-primary/10 text-primary font-medium shadow-sm":i?"font-medium text-foreground":"text-muted-foreground"),children:[(0,F.jsx)(bH,{project:s}),(0,F.jsx)("span",{className:"truncate flex-1 text-left",children:s.name}),i&&(0,F.jsx)(i_,{className:"h-3 w-3 shrink-0 text-primary ml-auto"})]})}),(0,F.jsx)(gP,{side:"right",children:s.name})]},s.id)})})}):(0,F.jsx)("span",{className:"px-3 text-xs text-muted-foreground/60",children:"No projects yet"})]}),(0,F.jsxs)("div",{className:"mt-4 space-y-0.5",children:[(0,F.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70 px-3 mb-2 block",children:"Navigation"}),(0,F.jsxs)("button",{onClick:()=>{d&&(n?.(null),r("tasks"))},disabled:!d,className:(0,iu.cn)("w-full flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-medium transition-all duration-150",d?"hover:bg-accent/80 hover:text-accent-foreground":"text-muted-foreground/40 cursor-not-allowed","tasks"===e&&d?"bg-primary/10 text-primary shadow-sm":d?"text-muted-foreground":""),children:[(0,F.jsx)(vA,{className:"h-3 w-3 shrink-0"}),(0,F.jsx)("span",{children:"Tasks"})]}),(0,F.jsxs)("button",{onClick:()=>{d&&r("files")},disabled:!d,className:(0,iu.cn)("w-full flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-medium transition-all duration-150",d?"hover:bg-accent/80 hover:text-accent-foreground":"text-muted-foreground/40 cursor-not-allowed","files"===e&&d?"bg-primary/10 text-primary shadow-sm":d?"text-muted-foreground":""),children:[(0,F.jsx)(i_,{className:"h-3 w-3 shrink-0"}),(0,F.jsx)("span",{children:"Files"})]})]}),(0,F.jsxs)("div",{className:"mt-4 space-y-0.5",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-3 mb-2",children:[(0,F.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Workspace"}),o&&(0,F.jsx)("button",{onClick:a,className:"p-0.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors text-muted-foreground",title:"Create new worktree",children:(0,F.jsx)(nT,{className:"h-3 w-3"})})]}),s&&s.length>0&&(0,F.jsx)(gM,{delayDuration:300,children:(0,F.jsx)("div",{className:"flex flex-col gap-0.5",children:s.map(s=>(0,F.jsxs)("div",{className:"group relative flex items-center min-w-0",children:[(0,F.jsxs)(gD,{children:[(0,F.jsx)(gT,{asChild:!0,children:(0,F.jsxs)("button",{onClick:()=>{n?.(s.branch),r("workspace")},className:(0,iu.cn)("flex-1 min-w-0 flex items-center gap-2 rounded-lg pl-3 pr-6 py-1.5 text-xs transition-all duration-150 overflow-hidden","hover:bg-accent/80 hover:text-accent-foreground","workspace"===e&&i===s.branch?"bg-primary/10 text-primary font-medium shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(bW,{status:c?.get(null===s.branch?"":s.branch)}),(0,F.jsx)("span",{className:"truncate",children:s.branch??"main"})]})}),(0,F.jsx)(gP,{side:"right",children:s.branch??"main"})]}),null!==s.branch&&(0,F.jsx)("button",{onClick:e=>{e.stopPropagation(),l?.(s)},className:"absolute right-1.5 p-0.5 rounded-md opacity-0 group-hover:opacity-100 hover:bg-destructive/15 hover:text-destructive transition-all",title:"Delete worktree",children:(0,F.jsx)(nz,{className:"h-3 w-3"})})]},s.branch??"__main__"))})}),(!s||0===s.length)&&(0,F.jsxs)("button",{onClick:()=>r("workspace"),className:(0,iu.cn)("w-full flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-150","hover:bg-accent/80 hover:text-accent-foreground","workspace"===e?"bg-primary/10 text-primary shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(bz,{className:"h-4 w-4 shrink-0"}),(0,F.jsx)("span",{children:"Workspace"})]})]}),(0,F.jsxs)("div",{className:"mt-auto space-y-0.5",children:[(0,F.jsx)("div",{className:"border-t border-border/40 mb-3"}),(0,F.jsxs)("button",{onClick:()=>r("remote-servers"),className:(0,iu.cn)("w-full flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-150","hover:bg-accent/80 hover:text-accent-foreground","remote-servers"===e?"bg-primary/10 text-primary shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(ib,{className:"h-4 w-4 shrink-0"}),(0,F.jsx)("span",{children:"Remote Servers"})]}),(0,F.jsxs)("button",{onClick:()=>r("settings"),className:(0,iu.cn)("w-full flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-150","hover:bg-accent/80 hover:text-accent-foreground","settings"===e?"bg-primary/10 text-primary shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(bF,{className:"h-4 w-4 shrink-0"}),(0,F.jsx)("span",{children:"Settings"})]})]})]})}var il=il,bK="Checkbox",[bU,bq]=q(bK),[bV,bY]=bU(bK);function bX(e){let{__scopeCheckbox:r,checked:s,children:i,defaultChecked:n,disabled:o,form:a,name:l,onCheckedChange:c,required:d,value:h="on",internal_do_not_use_render:u}=e,[f,p]=X({prop:s,defaultProp:n??!1,onChange:c,caller:bK}),[m,g]=W.useState(null),[v,x]=W.useState(null),_=W.useRef(!1),y=!m||!!a||!!m.closest("form"),b={checked:f,disabled:o,setChecked:p,control:m,setControl:g,name:l,form:a,value:h,hasConsumerStoppedPropagationRef:_,required:d,defaultChecked:!b5(n)&&n,isFormControl:y,bubbleInput:v,setBubbleInput:x};return(0,F.jsx)(bV,{scope:r,...b,children:"function"==typeof u?u(b):i})}var bG="CheckboxTrigger",bJ=W.forwardRef(({__scopeCheckbox:e,onKeyDown:r,onClick:s,...i},n)=>{let{control:o,value:a,disabled:l,checked:c,required:d,setControl:h,setChecked:u,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=bY(bG,e),g=(0,U.useComposedRefs)(n,h),v=W.useRef(c);return W.useEffect(()=>{let e=o?.form;if(e){let r=()=>u(v.current);return e.addEventListener("reset",r),()=>e.removeEventListener("reset",r)}},[o,u]),(0,F.jsx)(Z.button,{type:"button",role:"checkbox","aria-checked":b5(c)?"mixed":c,"aria-required":d,"data-state":b3(c),"data-disabled":l?"":void 0,disabled:l,value:a,...i,ref:g,onKeyDown:K(r,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:K(s,e=>{u(e=>!!b5(e)||!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});bJ.displayName=bG;var bZ=W.forwardRef((e,r)=>{let{__scopeCheckbox:s,name:i,checked:n,defaultChecked:o,required:a,disabled:l,value:c,onCheckedChange:d,form:h,...u}=e;return(0,F.jsx)(bX,{__scopeCheckbox:s,checked:n,defaultChecked:o,disabled:l,required:a,onCheckedChange:d,name:i,form:h,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(bJ,{...u,ref:r,__scopeCheckbox:s}),e&&(0,F.jsx)(b2,{__scopeCheckbox:s})]})})});bZ.displayName=bK;var bQ="CheckboxIndicator",b0=W.forwardRef((e,r)=>{let{__scopeCheckbox:s,forceMount:i,...n}=e,o=bY(bQ,s);return(0,F.jsx)(t8,{present:i||b5(o.checked)||!0===o.checked,children:(0,F.jsx)(Z.span,{"data-state":b3(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:r,style:{pointerEvents:"none",...e.style}})})});b0.displayName=bQ;var b1="CheckboxBubbleInput",b2=W.forwardRef(({__scopeCheckbox:e,...r},s)=>{let{control:i,hasConsumerStoppedPropagationRef:n,checked:o,defaultChecked:a,required:l,disabled:c,name:d,value:h,form:u,bubbleInput:f,setBubbleInput:p}=bY(b1,e),m=(0,U.useComposedRefs)(s,p),g=oz(o),v=tW(i);W.useEffect(()=>{if(!f)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,r=!n.current;if(g!==o&&e){let s=new Event("click",{bubbles:r});f.indeterminate=b5(o),e.call(f,!b5(o)&&o),f.dispatchEvent(s)}},[f,g,o,n]);let x=W.useRef(!b5(o)&&o);return(0,F.jsx)(Z.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??x.current,required:l,disabled:c,name:d,value:h,form:u,...r,tabIndex:-1,ref:m,style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function b5(e){return"indeterminate"===e}function b3(e){return b5(e)?"indeterminate":e?"checked":"unchecked"}b2.displayName=b1,e.s(["Checkbox",()=>bZ,"CheckboxIndicator",()=>b0,"Indicator",()=>b0,"Root",()=>bZ,"createCheckboxScope",()=>bq,"unstable_BubbleInput",()=>b2,"unstable_CheckboxBubbleInput",()=>b2,"unstable_CheckboxProvider",()=>bX,"unstable_CheckboxTrigger",()=>bJ,"unstable_Provider",()=>bX,"unstable_Trigger",()=>bJ],85402);var b4=e.i(85402),b4=b4;function b6({className:e,...r}){return(0,F.jsx)(b4.Root,{"data-slot":"checkbox",className:(0,iu.cn)("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:(0,F.jsx)(b4.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:(0,F.jsx)(il.default,{className:"size-3.5"})})})}let b8={todo:{label:"To Do",color:"bg-muted text-muted-foreground"},in_progress:{label:"In Progress",color:"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300"},done:{label:"Done",color:"bg-green-100 text-green-800 dark:bg-green-900/40 dark:text-green-300"},cancelled:{label:"Cancelled",color:"bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400 line-through"}},b7={low:{label:"Low",color:"bg-muted text-muted-foreground"},medium:{label:"Medium",color:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/40 dark:text-yellow-300"},high:{label:"High",color:"bg-orange-100 text-orange-800 dark:bg-orange-900/40 dark:text-orange-300"},urgent:{label:"Urgent",color:"bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-300"}},b9=["todo","in_progress","done","cancelled"],we=["low","medium","high","urgent"];function wt({task:e,onUpdate:r,onDelete:s,onClick:i,worktrees:n,assignedBranches:o,onAssign:a}){let[l,c]=(0,W.useState)(!1),[d,h]=(0,W.useState)(e.title),u=(0,W.useRef)(null);(0,W.useEffect)(()=>{l&&(u.current?.focus(),u.current?.select())},[l]),(0,W.useEffect)(()=>{h(e.title)},[e.title]);let f=()=>{c(!1);let s=d.trim();s&&s!==e.title?r(e.id,{title:s}):h(e.title)},p="done"===e.status||"cancelled"===e.status;return(0,F.jsxs)(oD,{className:"group cursor-pointer",onClick:()=>i?.(e),children:[(0,F.jsx)(oP,{className:"w-10",onClick:e=>e.stopPropagation(),children:(0,F.jsx)(b6,{checked:"done"===e.status,onCheckedChange:s=>{r(e.id,{status:s?"done":"todo"})}})}),(0,F.jsx)(oP,{className:"font-medium",children:l?(0,F.jsx)("input",{ref:u,className:"w-full bg-transparent border-b border-primary outline-none text-sm py-0.5",value:d,onChange:e=>h(e.target.value),onBlur:f,onClick:e=>e.stopPropagation(),onKeyDown:r=>{"Enter"===r.key&&f(),"Escape"===r.key&&(h(e.title),c(!1))}}):(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:`cursor-pointer hover:underline text-sm ${p?"line-through text-muted-foreground":""}`,onClick:e=>{e.stopPropagation(),c(!0)},children:e.title}),e.description&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate max-w-[400px] mt-0.5",children:e.description.length>80?e.description.slice(0,80)+"...":e.description})]})}),(0,F.jsx)(oP,{onClick:e=>e.stopPropagation(),children:(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)("button",{className:"focus:outline-none",children:(0,F.jsx)(ll,{variant:"outline",className:`cursor-pointer text-xs ${b8[e.status].color}`,children:b8[e.status].label})})}),(0,F.jsx)(ig,{align:"start",children:b9.map(s=>(0,F.jsxs)(iv,{onClick:()=>r(e.id,{status:s}),children:[(0,F.jsx)("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${b8[s].color}`}),b8[s].label]},s))})]})}),(0,F.jsx)(oP,{onClick:e=>e.stopPropagation(),children:(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)("button",{className:"focus:outline-none",children:(0,F.jsx)(ll,{variant:"outline",className:`cursor-pointer text-xs ${b7[e.priority].color}`,children:b7[e.priority].label})})}),(0,F.jsx)(ig,{align:"start",children:we.map(s=>(0,F.jsxs)(iv,{onClick:()=>r(e.id,{priority:s}),children:[(0,F.jsx)("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${b7[s].color}`}),b7[s].label]},s))})]})}),(0,F.jsx)(oP,{onClick:e=>e.stopPropagation(),children:(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)("button",{className:"focus:outline-none",children:(0,F.jsxs)(ll,{variant:"outline",className:`cursor-pointer text-xs ${null!==e.assigned_branch?"bg-blue-500/10 text-blue-600 border-blue-500/30":"text-muted-foreground"}`,children:[(0,F.jsx)(aU,{className:"h-3 w-3 mr-1"}),null!==e.assigned_branch?""===e.assigned_branch?"main":e.assigned_branch:"Unassigned"]})})}),(0,F.jsxs)(ig,{align:"start",children:[null!==e.assigned_branch&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(iv,{onClick:()=>a(e.id,null),children:"Unassign"}),(0,F.jsx)(ix,{})]}),n.filter(r=>{let s=null===r.branch?"":r.branch;return!(e.assigned_branch===s||o.has(s))}).map(r=>{let s=null===r.branch?"":r.branch,i=r.branch??"main";return(0,F.jsxs)(iv,{onClick:()=>a(e.id,s),children:[(0,F.jsx)(aU,{className:"h-3 w-3 mr-2"}),i]},s)})]})]})}),(0,F.jsx)(oP,{className:"text-muted-foreground text-xs",children:new Date(e.created_at).toLocaleDateString()}),(0,F.jsx)(oP,{className:"w-10",onClick:e=>e.stopPropagation(),children:(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>s(e.id),children:(0,F.jsx)(nz,{className:"h-3.5 w-3.5 text-muted-foreground"})})})]})}function wr({task:e,open:r,onOpenChange:s}){return e?(0,F.jsx)(ne,{open:r,onOpenChange:s,children:(0,F.jsxs)(ns,{className:"sm:max-w-lg",children:[(0,F.jsx)(ni,{children:(0,F.jsx)(no,{className:"text-base leading-snug",children:e.title})}),(0,F.jsxs)("div",{className:"space-y-4",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(ll,{variant:"outline",className:`text-xs ${b8[e.status].color}`,children:b8[e.status].label}),(0,F.jsx)(ll,{variant:"outline",className:`text-xs ${b7[e.priority].color}`,children:b7[e.priority].label})]}),e.description&&(0,F.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.description}),(0,F.jsxs)("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2 border-t",children:[(0,F.jsxs)("span",{children:["Created: ",new Date(e.created_at).toLocaleString()]}),(0,F.jsxs)("span",{children:["Updated: ",new Date(e.updated_at).toLocaleString()]})]})]})]})}):null}let ws={todo:0,in_progress:1,done:2,cancelled:3},wi={urgent:0,high:1,medium:2,low:3};function wn({tasks:e,onUpdate:r,onDelete:s,worktrees:i,onAssign:n}){let[o,a]=(0,W.useState)(null),[l,c]=(0,W.useState)("asc"),[d,h]=(0,W.useState)(null),[u,f]=(0,W.useState)(!1),p=e=>{o===e?c(e=>"asc"===e?"desc":"asc"):(a(e),c("asc"))},m=(0,W.useMemo)(()=>{if(!o)return e;let r="asc"===l?1:-1;return[...e].sort((e,s)=>{switch(o){case"title":return r*e.title.localeCompare(s.title);case"status":return r*(ws[e.status]-ws[s.status]);case"priority":return r*(wi[e.priority]-wi[s.priority]);case"created_at":return r*(new Date(e.created_at).getTime()-new Date(s.created_at).getTime());default:return 0}})},[e,o,l]),g=e=>o!==e?null:"asc"===l?" ↑":" ↓",v=(0,W.useMemo)(()=>new Set(e.filter(e=>null!==e.assigned_branch).map(e=>e.assigned_branch)),[e]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(oE,{children:[(0,F.jsx)(oR,{children:(0,F.jsxs)(oD,{children:[(0,F.jsx)(oT,{className:"w-10"}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none",onClick:()=>p("title"),children:["Title",g("title")]}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none w-32",onClick:()=>p("status"),children:["Status",g("status")]}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none w-28",onClick:()=>p("priority"),children:["Priority",g("priority")]}),(0,F.jsx)(oT,{className:"w-32",children:"Assign"}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none w-28",onClick:()=>p("created_at"),children:["Created",g("created_at")]}),(0,F.jsx)(oT,{className:"w-10"})]})}),(0,F.jsxs)(oM,{children:[m.map(e=>(0,F.jsx)(wt,{task:e,onUpdate:r,onDelete:s,onClick:e=>{h(e),f(!0)},worktrees:i,assignedBranches:v,onAssign:n},e.id)),0===e.length&&(0,F.jsx)(oD,{children:(0,F.jsx)("td",{colSpan:7,className:"text-center text-muted-foreground py-12 text-sm",children:(0,F.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-foreground/60",children:"No tasks yet"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"Create one to get started."})]})})})]})]}),(0,F.jsx)(wr,{task:d,open:u,onOpenChange:f})]})}function wo({open:e,onOpenChange:r,onSubmit:s}){let[i,n]=(0,W.useState)(""),[o,a]=(0,W.useState)("todo"),[l,c]=(0,W.useState)("medium");return(0,F.jsx)(ne,{open:e,onOpenChange:r,children:(0,F.jsxs)(ns,{className:"sm:max-w-md max-h-[85vh] flex flex-col",children:[(0,F.jsx)(ni,{children:(0,F.jsx)(no,{children:"Create Task"})}),(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i.trim()&&(s({description:i.trim(),status:o,priority:l}),n(""),a("todo"),c("medium"),r(!1))},className:"space-y-4 overflow-y-auto min-h-0 px-0.5",children:[(0,F.jsx)("div",{className:"space-y-2",children:(0,F.jsx)(nD,{placeholder:"Describe the task...",value:i,onChange:e=>n(e.target.value),className:"max-h-[40vh]",rows:3,autoFocus:!0})}),(0,F.jsxs)("div",{className:"flex gap-3",children:[(0,F.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,F.jsx)("label",{className:"text-xs text-muted-foreground",children:"Status"}),(0,F.jsxs)(aP,{value:o,onValueChange:e=>a(e),children:[(0,F.jsx)(aB,{children:(0,F.jsx)(aL,{})}),(0,F.jsx)(aA,{children:b9.map(e=>(0,F.jsx)(aO,{value:e,children:b8[e].label},e))})]})]}),(0,F.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,F.jsx)("label",{className:"text-xs text-muted-foreground",children:"Priority"}),(0,F.jsxs)(aP,{value:l,onValueChange:e=>c(e),children:[(0,F.jsx)(aB,{children:(0,F.jsx)(aL,{})}),(0,F.jsx)(aA,{children:we.map(e=>(0,F.jsx)(aO,{value:e,children:b7[e].label},e))})]})]})]}),(0,F.jsxs)(nn,{children:[(0,F.jsx)($.Button,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),(0,F.jsx)($.Button,{type:"submit",disabled:!i.trim(),children:"Create"})]})]})]})})}function wa({projectId:e,tasks:r,loading:s,worktrees:i,onCreateTask:n,onUpdateTask:o,onDeleteTask:a}){let[l,c]=(0,W.useState)(!1);return e?(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border/60 flex-shrink-0",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Tasks"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Manage and track your project tasks"})]}),(0,F.jsxs)($.Button,{size:"sm",onClick:()=>c(!0),className:"shadow-sm",children:[(0,F.jsx)(nT,{className:"h-3.5 w-3.5 mr-1.5"}),"New Task"]})]}),(0,F.jsx)("div",{className:"flex-1 overflow-auto px-5",children:s?(0,F.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading tasks..."}):(0,F.jsx)(wn,{tasks:r,onUpdate:o,onDelete:a,worktrees:i,onAssign:(e,r)=>{o(e,{assigned_branch:r})}})}),(0,F.jsx)(wo,{open:l,onOpenChange:c,onSubmit:n})]}):(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nT,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to view tasks."})]})})}let wl=(0,ic.default)("file",[["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"}]]),wc=(0,ic.default)("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"}]]),wd=new Set(["ts","tsx","js","jsx","py","rb","go","rs","java","c","cpp","h","css","scss","html","vue","svelte","php","swift","kt","sh","bash","yaml","yml","toml","json","xml","sql","graphql","proto"]),wh=new Set(["md","txt","log","csv","env","gitignore","dockerignore","editorconfig"]);function wu({path:e}){let[r,s]=(0,W.useState)(!1),i=(0,W.useCallback)(r=>{r.stopPropagation(),navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)},[e]);return(0,F.jsx)("button",{onClick:i,className:"p-0.5 rounded hover:bg-muted-foreground/20 transition-colors",title:`Copy path: ${e}`,children:r?(0,F.jsx)(iN.Check,{className:"h-3 w-3 text-green-500"}):(0,F.jsx)(ij.Copy,{className:"h-3 w-3 text-muted-foreground"})})}function wf({entry:e,path:r,depth:s,expandedDirs:i,directoryContents:n,loadingDirs:o,selectedFile:a,onToggleDirectory:l,onSelectFile:c}){var d,h,u;let f,p,m,g,v,x=i.has(r),_=o.has(r),y=n.get(r);if("directory"===e.type){let d=x?i_:of;return(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"group flex items-center w-full px-2 py-1 text-sm rounded-sm hover:bg-accent transition-colors cursor-pointer",style:{paddingLeft:`${16*s+8}px`},onClick:()=>l(r),children:[(0,F.jsxs)("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[_?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):(0,F.jsx)(x?aT:id,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,F.jsx)(d,{className:"h-4 w-4 shrink-0 text-blue-500"}),(0,F.jsx)("span",{className:"truncate",children:e.name})]}),(0,F.jsx)("div",{className:"shrink-0 hidden group-hover:block ml-1",children:(0,F.jsx)(wu,{path:r})})]}),x&&y&&(0,F.jsx)("div",{children:y.map(e=>{let d=r?`${r}/${e.name}`:e.name;return(0,F.jsx)(wf,{entry:e,path:d,depth:s+1,expandedDirs:i,directoryContents:n,loadingDirs:o,selectedFile:a,onToggleDirectory:l,onSelectFile:c},d)})})]})}let b=(d=e.name,f=d.split(".").pop()?.toLowerCase()??"",wd.has(f)?wc:wh.has(f)?vO:wl),w=a===r;return(0,F.jsxs)("div",{className:(0,iu.cn)("group flex items-center w-full px-2 py-1 text-sm rounded-sm transition-colors cursor-pointer",w?"bg-accent text-accent-foreground":"hover:bg-accent/50"),style:{paddingLeft:`${16*s+8+18}px`},onClick:()=>c(r),children:[(0,F.jsxs)("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[(0,F.jsx)(b,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,F.jsx)("span",{className:"truncate",children:e.name})]}),(0,F.jsxs)("div",{className:"shrink-0 flex items-center gap-2 ml-1",children:[(0,F.jsx)("span",{className:"text-[11px] text-muted-foreground/70 group-hover:hidden whitespace-nowrap w-[52px] text-right tabular-nums",children:e.mtime&&(h=e.mtime,p=Date.now(),v=Math.floor((g=Math.floor((m=Math.floor(Math.floor((p-new Date(h).getTime())/1e3)/60))/60))/24),m<1?"just now":m<60?`${m}m ago`:g<24?`${g}h ago`:v<30?`${v}d ago`:new Date(h).toLocaleDateString(void 0,{month:"short",day:"numeric"}))}),(0,F.jsx)("span",{className:"text-[11px] text-muted-foreground/70 group-hover:hidden whitespace-nowrap w-[52px] text-right tabular-nums",children:null!=e.size&&((u=e.size)<1024?`${u} B`:u<1048576?`${(u/1024).toFixed(1)} KB`:`${(u/1048576).toFixed(1)} MB`)}),(0,F.jsx)("div",{className:"hidden group-hover:block",children:(0,F.jsx)(wu,{path:r})})]})]})}function wp({entries:e,expandedDirs:r,directoryContents:s,loadingDirs:i,selectedFile:n,onToggleDirectory:o,onSelectFile:a}){return 0===e.length?(0,F.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:"No files found."}):(0,F.jsx)("div",{className:"py-1",children:e.map(e=>{let l=e.name;return(0,F.jsx)(wf,{entry:e,path:l,depth:0,expandedDirs:r,directoryContents:s,loadingDirs:i,selectedFile:n,onToggleDirectory:o,onSelectFile:a},l)})})}var wm=e.i(166520);let wg=(0,ic.default)("file-exclamation-point",[["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:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var il=il,wv=e.i(829692),wv=wv,wx=e.i(615742);let w_=(0,W.createContext)({code:""}),wy={name:"line-numbers",line(e,r){e.children.unshift({type:"element",tagName:"span",properties:{className:["inline-block","min-w-10","mr-4","text-right","select-none","text-muted-foreground"]},children:[{type:"text",value:String(r)}]})}};async function wb(e,r,s=!1){let i=s?[wy]:[];return await Promise.all([(0,wx.codeToHtml)(e,{lang:r,theme:"one-light",transformers:i}),(0,wx.codeToHtml)(e,{lang:r,theme:"one-dark-pro",transformers:i})])}let ww=({code:e,language:r,showLineNumbers:s=!1,className:i,children:n,...o})=>{let[a,l]=(0,W.useState)(""),[c,d]=(0,W.useState)(""),h=(0,W.useRef)(!1);return(0,W.useEffect)(()=>(wb(e,r,s).then(([e,r])=>{h.current||(l(e),d(r),h.current=!0)}),()=>{h.current=!1}),[e,r,s]),(0,F.jsx)(w_.Provider,{value:{code:e},children:(0,F.jsx)("div",{className:(0,iu.cn)("group relative w-full overflow-hidden rounded-md border bg-background text-foreground",i),...o,children:(0,F.jsxs)("div",{className:"relative",children:[(0,F.jsx)("div",{className:"overflow-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",dangerouslySetInnerHTML:{__html:a}}),(0,F.jsx)("div",{className:"hidden overflow-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",dangerouslySetInnerHTML:{__html:c}}),n&&(0,F.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})})},wS=({onCopy:e,onError:r,timeout:s=2e3,children:i,className:n,...o})=>{let[a,l]=(0,W.useState)(!1),{code:c}=(0,W.useContext)(w_),d=async()=>{if(!navigator?.clipboard?.writeText)return void r?.(Error("Clipboard API not available"));try{await navigator.clipboard.writeText(c),l(!0),e?.(),setTimeout(()=>l(!1),s)}catch(e){r?.(e)}},h=a?il.default:wv.default;return(0,F.jsx)($.Button,{className:(0,iu.cn)("shrink-0",n),onClick:d,size:"icon",variant:"ghost",...o,children:i??(0,F.jsx)(h,{size:14})})};function wC({className:e,...r}){return(0,F.jsx)("div",{"data-slot":"skeleton",className:(0,iu.cn)("bg-accent animate-pulse rounded-md",e),...r})}let wk={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",cs:"csharp",css:"css",scss:"scss",html:"html",vue:"vue",svelte:"svelte",php:"php",swift:"swift",kt:"kotlin",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",toml:"toml",json:"json",xml:"xml",sql:"sql",graphql:"graphql",md:"markdown",mdx:"mdx",dockerfile:"dockerfile",makefile:"makefile",lua:"lua",r:"r",scala:"scala",zig:"zig"};function wj(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function wN({filePath:e,fileContent:r,loading:s,downloadUrl:i}){let n;if(!e)return(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Select a file to preview."});if(s)return(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsx)("div",{className:"flex items-center justify-between px-4 py-2 border-b flex-shrink-0",children:(0,F.jsx)(wC,{className:"h-4 w-48"})}),(0,F.jsxs)("div",{className:"flex-1 p-4",children:[(0,F.jsx)(wC,{className:"h-4 w-full mb-2"}),(0,F.jsx)(wC,{className:"h-4 w-3/4 mb-2"}),(0,F.jsx)(wC,{className:"h-4 w-5/6 mb-2"}),(0,F.jsx)(wC,{className:"h-4 w-2/3"})]})]});if(!r)return(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Failed to load file."});let o=()=>{i&&window.open(i,"_blank")};return(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b flex-shrink-0 gap-2",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-mono truncate",children:e}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:wj(r.size)})]}),(0,F.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{navigator.clipboard.writeText(e)},title:"Copy path",children:(0,F.jsx)(ij.Copy,{className:"h-3.5 w-3.5"})}),i&&(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:o,title:"Download",children:(0,F.jsx)(wm.Download,{className:"h-3.5 w-3.5"})})]})]}),(0,F.jsx)("div",{className:"flex-1 overflow-auto",children:r.tooLarge?(0,F.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[(0,F.jsx)(wg,{className:"h-10 w-10"}),(0,F.jsxs)("p",{className:"text-sm",children:["File too large to preview (",wj(r.size),")"]}),i&&(0,F.jsxs)($.Button,{variant:"outline",size:"sm",onClick:o,children:[(0,F.jsx)(wm.Download,{className:"h-4 w-4 mr-2"}),"Download"]})]}):r.binary?(0,F.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[(0,F.jsx)(wg,{className:"h-10 w-10"}),(0,F.jsxs)("p",{className:"text-sm",children:["Binary file (",wj(r.size),")"]}),i&&(0,F.jsxs)($.Button,{variant:"outline",size:"sm",onClick:o,children:[(0,F.jsx)(wm.Download,{className:"h-4 w-4 mr-2"}),"Download"]})]}):null!==r.content?(0,F.jsx)(ww,{code:r.content,language:"dockerfile"===(n=e.split("/").pop()?.toLowerCase()??"")?"dockerfile":"makefile"===n?"makefile":wk[n.split(".").pop()?.toLowerCase()??""]??"text",showLineNumbers:!0,className:"border-0 rounded-none",children:(0,F.jsx)(wS,{})}):(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Empty file."})})]})}function wE({projectId:e,project:r,selectedBranch:s}){let i=r&&!r.path?"remote":void 0,{rootEntries:n,directoryContents:o,expandedDirs:a,selectedFile:l,fileContent:c,fileLoading:d,rootLoading:h,loadingDirs:u,fetchRoot:f,toggleDirectory:p,selectFile:m}=function({projectId:e,branch:r,target:s}){let[i,n]=(0,W.useState)([]),[o,a]=(0,W.useState)(new Map),[l,c]=(0,W.useState)(new Set),[d,h]=(0,W.useState)(null),[u,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),[g,v]=(0,W.useState)(!1),[x,_]=(0,W.useState)(new Set),y=(0,W.useRef)(0),b=(0,W.useCallback)(async()=>{if(!e)return;v(!0);let i=++y.current;try{let o=await iR.api.browseProjectDirectory(e,void 0,r,s);if(i!==y.current)return;n(o.items),a(new Map),c(new Set),h(null),f(null)}catch(e){if(console.error("Failed to browse root directory:",e),i!==y.current)return;n([])}finally{i===y.current&&v(!1)}},[e,r,s]),w=(0,W.useCallback)(async i=>{if(e&&(c(e=>{let r=new Set(e);return r.has(i)?r.delete(i):r.add(i),r}),!o.has(i))){_(e=>new Set(e).add(i));try{let n=await iR.api.browseProjectDirectory(e,i,r,s);a(e=>{let r=new Map(e);return r.set(i,n.items),r})}catch(e){console.error("Failed to browse directory:",e)}finally{_(e=>{let r=new Set(e);return r.delete(i),r})}}},[e,r,s,o]);return{rootEntries:i,directoryContents:o,expandedDirs:l,selectedFile:d,fileContent:u,fileLoading:p,rootLoading:g,loadingDirs:x,fetchRoot:b,toggleDirectory:w,selectFile:(0,W.useCallback)(async i=>{if(e){h(i),m(!0),f(null);try{let n=await iR.api.getFileContent(e,i,r,s);f(n)}catch(e){console.error("Failed to get file content:",e),f(null)}finally{m(!1)}}},[e,r,s])}}({projectId:e,branch:s,target:i});if((0,W.useEffect)(()=>{f()},[f]),!e)return(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(mZ,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to browse files."})]})});let g=l&&e?iR.api.getFileDownloadUrl(e,l,s,i):null;return(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border/60 flex-shrink-0",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Files"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Browse and preview project files"})]}),(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:f,title:"Refresh",children:(0,F.jsx)(mZ,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`})})]}),(0,F.jsxs)(bO,{direction:"horizontal",autoSaveId:"files-panels",className:"flex-1",children:[(0,F.jsx)(yF,{defaultSize:33,minSize:20,children:(0,F.jsx)(oh,{className:"h-full",children:h&&0===n.length?(0,F.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading files..."}):(0,F.jsx)(wp,{entries:n,expandedDirs:a,directoryContents:o,loadingDirs:u,selectedFile:l,onToggleDirectory:p,onSelectFile:m})})}),(0,F.jsx)(bI,{withHandle:!0}),(0,F.jsx)(yF,{defaultSize:67,minSize:25,children:(0,F.jsx)("div",{className:"h-full overflow-hidden",children:(0,F.jsx)(wN,{filePath:l,fileContent:c,loading:d,downloadUrl:g})})})]})]})}let wR=new Set(["workspace","tasks","files","remote-servers","settings","project-info"]),wM="tasks";function wD(){let e=window.location.pathname,r=new URLSearchParams(window.location.search),s=r.get("project");if(s){let e=r.get("tab");return{projectId:s,tab:e&&wR.has(e)?e:wM,branch:r.get("branch")}}let i=e.split("/").filter(Boolean);if(1===i.length&&wR.has(i[0])){let e=i[0];if("remote-servers"===e||"settings"===e)return{projectId:null,tab:e,branch:null}}let n=null,o=wM;if("p"===i[0]&&i[1]){n=i[1];let e=i[2];e&&wR.has(e)&&(o=e)}return{projectId:n,tab:o,branch:r.get("branch")}}function wT(e){let{projectId:r,tab:s,branch:i}=e;if("remote-servers"===s||"settings"===s)return`/${s}`;if(!r)return"/";let n=`/p/${r}`;return s&&s!==wM&&(n+=`/${s}`),i&&(n+=`?branch=${encodeURIComponent(i)}`),n}function wP(e){return null===e?"":e}function wL(e,r){let s=new Map(e);return s.set(wP(r),"working"),s}function wB(e,r){let s=new Map(e);return s.delete(wP(r)),s}function wA(){var e,r;let s,i,n,{projectId:o,tab:a,branch:l}=function(){let[e,r]=(0,W.useState)(wD);return(0,W.useEffect)(()=>{let e=()=>r(wD());return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]),e}();(0,W.useEffect)(()=>{if(new URLSearchParams(window.location.search).has("project")){let e=wT({projectId:o,tab:a,branch:l});window.history.replaceState(null,"",e)}},[]);let[c,d]=(0,W.useState)(!1),[h,u]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,g]=(0,W.useState)(null),[v,x]=(0,W.useState)(l),[_,y]=(0,W.useState)(a),b=(0,W.useRef)(null),w=(0,W.useRef)(void 0),[S,C]=(0,W.useTransition)(),{projects:k,currentProject:j,loading:N,addProject:E,createProject:R,updateProject:M,deleteProject:D,selectProject:T}=function(e){let[r,s]=(0,W.useState)([]),[i,n]=(0,W.useState)(null),[o,a]=(0,W.useState)(!0),l=(0,W.useCallback)(async()=>{a(!0);try{let r=await iR.api.getProjects();if(s(r),r.length>0&&!i){let s=e?r.find(r=>r.id===e):null;n(s??r[0])}}finally{a(!1)}},[i,e]);(0,W.useEffect)(()=>{l()},[]);let c=async(e,r)=>{let o=await iR.api.updateProject(e,r);return s(r=>r.map(r=>r.id===e?o:r)),i?.id===e&&n(o),o},d=async e=>{await iR.api.deleteProject(e),s(r=>r.filter(r=>r.id!==e)),i?.id===e&&n(r.find(r=>r.id!==e)??null)};return{projects:r,currentProject:i,loading:o,addProject:e=>{s(r=>[e,...r]),n(e)},createProject:async e=>{let r=await iR.api.createProject(e);return s(e=>[r,...e]),n(r),r},updateProject:c,deleteProject:d,selectProject:e=>{n(e)},refresh:l}}(o),{worktrees:P,loading:L,refetch:B}=function(e){let[r,s]=(0,W.useState)([]),[i,n]=(0,W.useState)(!0),o=(0,W.useCallback)(async()=>{if(!e){s([]),n(!1);return}try{let r=await iR.api.getProjectWorktrees(e);s(r)}catch(e){console.error("Failed to fetch worktrees:",e),s([{branch:null}])}finally{n(!1)}},[e]);return(0,W.useEffect)(()=>{o()},[o]),{worktrees:r,loading:i,refetch:o}}(j?.id??null),{tasks:A,loading:O,createTask:I,updateTask:z,deleteTask:H,refetch:K}=function(e){let[r,s]=(0,W.useState)([]),[i,n]=(0,W.useState)(!0),o=(0,W.useCallback)(async()=>{if(!e){s([]),n(!1);return}try{let r=await iR.api.getTasks(e);s(r)}catch(e){console.error("Failed to fetch tasks:",e)}finally{n(!1)}},[e]);(0,W.useEffect)(()=>{o()},[o]);let a=(0,W.useCallback)(async r=>{if(!e)return null;try{let i=await iR.api.createTask(e,r);return s(e=>[...e,i]),i}catch(e){return console.error("Failed to create task:",e),null}},[e]),l=(0,W.useCallback)(async(e,i)=>{s(r=>r.map(r=>r.id===e?{...r,...i,updated_at:new Date().toISOString()}:r));try{let r=await iR.api.updateTask(e,i);return s(s=>s.map(s=>s.id===e?r:s)),r}catch(e){return console.error("Failed to update task:",e),s(r),null}},[r]),c=(0,W.useCallback)(async e=>{s(r=>r.filter(r=>r.id!==e));try{await iR.api.deleteTask(e)}catch(e){console.error("Failed to delete task:",e),s(r)}},[r]),d=(0,W.useCallback)(async i=>{if(e){s(i.map(e=>r.find(r=>r.id===e)).filter(e=>void 0!==e));try{await iR.api.reorderTasks(e,i)}catch(e){console.error("Failed to reorder tasks:",e),s(r)}}},[e,r]);return{tasks:r,loading:i,createTask:a,updateTask:l,deleteTask:c,reorderTasks:d,refetch:o}}(j?.id??null),{statuses:U,refetch:q}=function(e){let[r,s]=(0,W.useState)(new Map),i=(0,W.useRef)(null),n=(0,W.useCallback)(async()=>{if(!e)return void s(new Map);try{let r={},i=(0,iR.getAuthToken)();i&&(r.Authorization=`Bearer ${i}`);let n=await fetch(`${"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}/api/projects/${e}/agent-sessions`,{headers:r});if(!n.ok)return;let o=await n.json(),a=new Map;for(let e of o.sessions)a.has(e.branch)&&"running"!==e.status||a.set(e.branch,e.status);s(a)}catch{}},[e]);return(0,W.useEffect)(()=>(n(),i.current=setInterval(n,5e3),()=>{i.current&&clearInterval(i.current)}),[n]),{statuses:r,refetch:n,updateStatus:(0,W.useCallback)((e,r)=>{s(s=>{let i=new Map(s);return i.set(e,r),i})},[])}}(j?.id??null),[V,Y]=(0,W.useState)(new Map),X=(0,W.useMemo)(()=>(function(e,r,s,i,n){let o=new Map;if(!e)return o;let a=wP(n);for(let n of e){let e=wP(n.branch),l=r.get(e);if(void 0!==l){o.set(e,l);continue}let c=e===a?void 0:s.get(e),d=i.find(r=>r.assigned_branch===e);d&&"done"===d.status?o.set(e,"completed"):"running"===c?o.set(e,"working"):d?o.set(e,"assigned"):o.set(e,"idle")}return o})(P,V,U,A,v),[P,U,A,v,V]),G=(0,W.useCallback)(()=>{Y(e=>wL(e,v))},[v]),J=(0,W.useCallback)(()=>{Y(e=>{let r;return(r=new Map(e)).set(wP(v),"completed"),r}),K(),q()},[v,K,q]),Z=(0,W.useCallback)(()=>{q()},[q]),Q=(0,W.useCallback)((e,r)=>{Y(s=>{let i="running"===r?{realtimeStatuses:wL(s,e),shouldRefetchTasks:!1}:{realtimeStatuses:wB(s,e),shouldRefetchTasks:!0};return i.shouldRefetchTasks&&K(),i.realtimeStatuses}),q()},[q,K]),ee=(0,W.useCallback)(e=>{Y(r=>wB(r,e)),K(),q()},[K,q]),et=(0,W.useCallback)(()=>{K()},[K]);e=j?.id??null,r={onSessionStatus:Q,onSessionFinished:ee,onTaskChanged:et},s=(0,W.useRef)(r.onSessionStatus),i=(0,W.useRef)(r.onSessionFinished),n=(0,W.useRef)(r.onTaskChanged),(0,W.useEffect)(()=>{s.current=r.onSessionStatus,i.current=r.onSessionFinished,n.current=r.onTaskChanged}),(0,W.useEffect)(()=>{if(!e)return;let r=(0,iR.getAuthToken)(),o=r?`?token=${encodeURIComponent(r)}`:"",a=new EventSource(`${"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}/api/events${o}`);return a.onmessage=r=>{try{let o=JSON.parse(r.data);if(o.projectId!==e)return;"session:status"===o.type?s.current?.(o.branch,o.status):"session:finished"===o.type?i.current?.(o.branch):("task:created"===o.type||"task:updated"===o.type||"task:deleted"===o.type)&&n.current?.()}catch{}},()=>{a.close()}},[e]);let er=(0,W.useMemo)(()=>{let e=wP(v);return A.find(r=>r.assigned_branch===e)??null},[A,v]),es=(0,W.useCallback)(e=>{C(async()=>{await b.current?.submitMessage(e.description??e.title)})},[]),ei=(0,W.useCallback)(e=>{Y(e=>wB(e,v)),z(e,{assigned_branch:null})},[v,z]);(0,W.useEffect)(()=>{void 0!==w.current&&w.current!==j?.id&&x(null),w.current=j?.id},[j?.id]),(0,W.useEffect)(()=>{!L&&0!==P.length&&(P.some(e=>e.branch===v)||x(P[0].branch))},[P,L,v]),(0,W.useEffect)(()=>{if(N)return;let e=wT({projectId:j?.id,tab:_,branch:v});window.history.replaceState(null,"",e)},[j?.id,_,v,N]);let en=(0,W.useCallback)(e=>{B(),x(e)},[B]),eo=(0,W.useCallback)((e,r)=>{j&&r!==j.agent_mode?M(j.id,{agentMode:r}).then(()=>{b.current?.submitMessage(e)}):b.current?.submitMessage(e)},[j,M]),ea=(0,W.useCallback)(()=>{let e=`Please perform the following git operations for this worktree:
|
|
22
|
+
`,r)}paste(e){this._core.paste(e)}refresh(e,r){this._verifyIntegers(e,r),this._core.refresh(e,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return lv},set promptLabel(t){lv=t},get tooMuchOutput(){return lx},set tooMuchOutput(t){lx=t}}}_verifyIntegers(...e){for(fX of e)if(fX===1/0||isNaN(fX)||fX%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(fX of e)if(fX&&(fX===1/0||isNaN(fX)||fX%1!=0||fX<0))throw Error("This API only accepts positive integers")}},fJ=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let r=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},l=a.top+a.bottom;return{cols:Math.max(2,Math.floor((n-(a.right+a.left)-r)/e.css.cell.width)),rows:Math.max(1,Math.floor((i-l)/e.css.cell.height))}}},fZ=class{constructor(e,r,s,i={}){this._terminal=e,this._regex=r,this._handler=s,this._options=i}provideLinks(e,r){let s=fQ.computeLink(e,this._regex,this._terminal,this._handler);r(this._addCallbacks(s))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(r,s)=>{if(this._options.hover){let{range:i}=e;this._options.hover(r,s,i)}},e))}},fQ=class e{static computeLink(r,s,i,n){let o=RegExp(s.source,(s.flags||"")+"g"),[a,l]=e._getWindowedLineStrings(r-1,i),c=a.join(""),d,h=[];for(;d=o.exec(c);){let r=d[0];if(!function(e){try{let r=new URL(e),s=r.password&&r.username?`${r.protocol}//${r.username}:${r.password}@${r.host}`:r.username?`${r.protocol}//${r.username}@${r.host}`:`${r.protocol}//${r.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}(r))continue;let[s,o]=e._mapStrIdx(i,l,0,d.index),[a,c]=e._mapStrIdx(i,s,o,r.length);if(-1===s||-1===o||-1===a||-1===c)continue;let u={start:{x:o+1,y:s+1},end:{x:c,y:a+1}};h.push({range:u,text:r,activate:n})}return h}static _getWindowedLineStrings(e,r){let s,i=e,n=e,o=0,a="",l=[];if(s=r.buffer.active.getLine(e)){let e=s.translateToString(!0);if(s.isWrapped&&" "!==e[0]){for(o=0;(s=r.buffer.active.getLine(--i))&&o<2048&&(o+=(a=s.translateToString(!0)).length,l.push(a),!(!s.isWrapped||-1!==a.indexOf(" "))););l.reverse()}for(l.push(e),o=0;(s=r.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(o+=(a=s.translateToString(!0)).length,l.push(a),-1===a.indexOf(" ")););}return[l,i]}static _mapStrIdx(e,r,s,i){let n=e.buffer.active,o=n.getNullCell(),a=s;for(;i;){let e=n.getLine(r);if(!e)return[-1,-1];for(let s=a;s<e.length;++s){e.getCell(s,o);let a=o.getChars();if(o.getWidth()&&(i-=a.length||1,s===e.length-1&&""===a)){let e=n.getLine(r+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(i+=1))}if(i<0)return[r,s]}r++,a=0}return[r,a]}},f0=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f1(e,r){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=r}else console.warn("Opening link blocked as opener could not be cleared")}var f2=class{constructor(e=f1,r={}){this._handler=e,this._options=r}activate(e){this._terminal=e;let r=this._options,s=r.urlRegex||f0;this._linkProvider=this._terminal.registerLinkProvider(new fZ(this._terminal,s,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function f5({logs:e,isPty:r,className:s,onInput:i,onResize:n}){let o=(0,W.useRef)(null),a=(0,W.useRef)(null),l=(0,W.useRef)(null),c=(0,W.useRef)(0);return(0,W.useEffect)(()=>{if(!o.current||a.current)return;let e=new fG({cursorBlink:r,cursorStyle:r?"block":"underline",disableStdin:!r,convertEol:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{background:"#09090b",foreground:"#fafafa",cursor:r?"#fafafa":"#09090b",cursorAccent:"#09090b",selectionBackground:"#3f3f46",black:"#09090b",red:"#f87171",green:"#4ade80",yellow:"#facc15",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#fafafa",brightBlack:"#71717a",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#ffffff"},allowProposedApi:!0}),s=new fJ,d=new f2;return e.loadAddon(s),e.loadAddon(d),e.open(o.current),setTimeout(()=>{try{s.fit(),r&&n?.(e.cols,e.rows)}catch{}},0),a.current=e,l.current=s,r&&i&&e.onData(e=>{i(e)}),r&&n&&e.onResize(({cols:e,rows:r})=>{n(e,r)}),()=>{e.dispose(),a.current=null,l.current=null,c.current=0}},[r,i,n]),(0,W.useEffect)(()=>{if(a.current){e.length<c.current&&(a.current.reset(),c.current=0);for(let r=c.current;r<e.length;r++){let s=e[r];"pty"===s.type?a.current.write(s.data):("stdout"===s.type||"stderr"===s.type)&&a.current.write(s.data)}c.current=e.length}},[e]),(0,W.useEffect)(()=>{if(!o.current||!l.current)return;let e=new ResizeObserver(()=>{try{l.current?.fit()}catch{}});return e.observe(o.current),()=>{e.disconnect()}},[]),(0,F.jsx)("div",{ref:o,className:(0,iu.cn)("h-[300px] rounded-md border bg-zinc-950 overflow-hidden",s)})}let f3=(0,ic.default)("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"}]]),f4=[{name:"Dev Server",command:"pnpm dev",executor_type:"command",pty:!0,description:"Start the development server with hot reload"},{name:"Build",command:"pnpm build",executor_type:"command",pty:!0,description:"Build the project for production"},{name:"Lint",command:"pnpm lint",executor_type:"command",pty:!0,description:"Run the linter to check code quality"},{name:"Type Check",command:"npx tsc --noEmit",executor_type:"command",pty:!0,description:"Run TypeScript type checking without emitting files"},{name:"Test",command:"pnpm test",executor_type:"command",pty:!0,description:"Run the test suite"},{name:"Rebase on and merge into main",command:"Our goal is to sync the current local branch with the local branch/worktree `main`. The two branches may have diverged.\n\nPlease do the following in order. Only proceed to the next step if the previous step succeeds:\n\n1. Rebase the current local branch onto the local branch `main`, and resolve any conflicts if needed.\n2. If, after the rebase, `main` does not yet contain the current branch's commits, switch to the `main` branch/worktree and merge the current branch into `main` using `git merge`. Do not use `git branch -f`.\n3. If the current branch is already fully contained in `main`, and `main` has newer commits, update the current branch so it includes the latest commits from `main`.\n4. Push both the current local branch and the local branch `main` to the remote.",executor_type:"prompt",pty:!1,description:"Rebase current branch onto main, merge into main, and push both branches"},{name:"Reset to main",command:"git reset --hard main",executor_type:"command",pty:!0,description:"Hard reset the current branch to match main"},{name:"Push to remote",command:"git push --force-with-lease",executor_type:"command",pty:!0,description:"Force push to remote with lease safety check"},{name:"Git commit",command:"Inspect the modified and untracked and deleted files in the current repository, generate an appropriate commit message, and commit all relevant files.\n\nCommit message rules:\n- Use Conventional Commits format (feat:, fix:, chore:, refactor:, docs:, test:, ci:, build:, perf:, style:, etc.)\n- Choose the type that best matches the main purpose of the changes\n- Make the message specific to the actual changes\n- Keep it within 50 characters if possible\n- Use lowercase\n- Do not end with a period\n- Do not wrap the message in quotes, backticks, or markdown\n\nCommit requirements:\n- Include all relevant modified and untracked files\n- Do not include unrelated files\n- If there are no meaningful changes to commit, do not create a commit\n\nWhen finished, output only the final commit message.",executor_type:"prompt",pty:!1,description:"Inspect changes, generate a conventional commit message, and commit"}];function f6({open:e,onOpenChange:r,executor:s,onSubmit:i}){let[n,o]=(0,W.useState)(s?.name??""),[a,l]=(0,W.useState)(s?.executor_type??"command"),[c,d]=(0,W.useState)(s?.prompt_provider??"claude"),[h,u]=(0,W.useState)(s?.command??""),[f,p]=(0,W.useState)(s?.cwd??""),[m,g]=(0,W.useState)(s?.pty??!0),[v,x]=(0,W.useState)(!1),[_,y]=(0,W.useState)(!1),[b,w]=(0,W.useState)(null),[S,C]=(0,W.useState)(null),[k,j]=(0,W.useState)(""),N=!!s;(0,W.useEffect)(()=>{e&&(y(!1),w(null),C(null),j(""),s&&(o(s.name),l(s.executor_type??"command"),d(s.prompt_provider??"claude"),u(s.command),p(s.cwd??""),g(s.pty)))},[e]);let E=async e=>{if(e.preventDefault(),n.trim()&&h.trim()){x(!0);try{await i({name:n.trim(),command:h.trim(),executor_type:a,prompt_provider:"prompt"===a?c:null,cwd:f.trim()||void 0,pty:"prompt"===a||m}),r(!1),N||(o(""),l("command"),d("claude"),u(""),p(""),g(!0))}finally{x(!1)}}};return(0,F.jsx)(ne,{open:e,onOpenChange:r,children:(0,F.jsxs)(ns,{children:[(0,F.jsx)(ni,{children:(0,F.jsxs)("div",{className:"flex items-center justify-between pr-6",children:[(0,F.jsx)(no,{children:_?"Select Preset":N?"Edit Executor":"Add Executor"}),!N&&!_&&(0,F.jsx)("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",onClick:()=>y(!0),children:"Select from presets"})]})}),(0,F.jsxs)("div",{className:"h-[420px] flex flex-col",children:[!_&&(0,F.jsxs)("form",{onSubmit:E,className:"space-y-4 flex-1 flex flex-col",children:[(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Name"}),(0,F.jsx)(nM,{placeholder:"e.g., Dev Server",value:n,onChange:e=>o(e.target.value),required:!0})]}),(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Type"}),(0,F.jsxs)("div",{className:"flex rounded-md border border-input overflow-hidden",children:[(0,F.jsx)("button",{type:"button",className:(0,iu.cn)("flex-1 px-3 py-1.5 text-sm font-medium transition-colors","command"===a?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:bg-muted"),onClick:()=>l("command"),children:"Command"}),(0,F.jsx)("button",{type:"button",className:(0,iu.cn)("flex-1 px-3 py-1.5 text-sm font-medium transition-colors border-l border-input","prompt"===a?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:bg-muted"),onClick:()=>l("prompt"),children:"Prompt"})]})]}),"prompt"===a&&(0,F.jsxs)("div",{className:"flex gap-3",children:[(0,F.jsxs)("div",{className:"w-[140px] shrink-0 space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Provider"}),(0,F.jsxs)(aP,{value:c,onValueChange:e=>d(e),children:[(0,F.jsx)(aB,{className:"w-full",children:(0,F.jsx)(aL,{})}),(0,F.jsxs)(aA,{children:[(0,F.jsx)(aO,{value:"claude",children:"Claude"}),(0,F.jsx)(aO,{value:"codex",children:"Codex"})]})]})]}),(0,F.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,F.jsxs)("label",{className:"text-sm font-medium",children:["Working Directory"," ",(0,F.jsx)("span",{className:"text-muted-foreground",children:"(optional)"})]}),(0,F.jsx)(nM,{placeholder:"Relative to worktree root",value:f,onChange:e=>p(e.target.value)})]})]}),(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"prompt"===a?"Prompt":"Command"}),"prompt"===a?(0,F.jsx)("textarea",{className:"flex min-h-[90px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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 resize-y",placeholder:"e.g., Review the code and suggest improvements",value:h,onChange:e=>u(e.target.value),required:!0}):(0,F.jsx)(nM,{placeholder:"e.g., npm run dev",value:h,onChange:e=>u(e.target.value),required:!0})]}),"command"===a&&(0,F.jsxs)("div",{className:"space-y-2",children:[(0,F.jsxs)("label",{className:"text-sm font-medium",children:["Working Directory"," ",(0,F.jsx)("span",{className:"text-muted-foreground",children:"(optional)"})]}),(0,F.jsx)(nM,{placeholder:"Relative to worktree root (leave empty for root)",value:f,onChange:e=>p(e.target.value)})]}),"command"===a&&(0,F.jsxs)("div",{className:"flex items-center justify-between",children:[(0,F.jsxs)("div",{className:"space-y-0.5",children:[(0,F.jsx)("label",{className:"text-sm font-medium",children:"Terminal Mode (PTY)"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enable for interactive commands like top, vim, htop"})]}),(0,F.jsx)("button",{type:"button",role:"switch","aria-checked":m,onClick:()=>g(!m),className:(0,iu.cn)("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",m?"bg-primary":"bg-input"),children:(0,F.jsx)("span",{className:(0,iu.cn)("pointer-events-none inline-block h-5 w-5 transform rounded-full bg-background shadow-lg ring-0 transition-transform",m?"translate-x-5":"translate-x-0")})})]}),(0,F.jsx)("div",{className:"flex-1"}),(0,F.jsxs)(nn,{children:[(0,F.jsx)($.Button,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),(0,F.jsx)($.Button,{type:"submit",disabled:v||!n.trim()||!h.trim(),children:v?"Saving...":N?"Save":"Add"})]})]}),_&&(0,F.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col min-h-0",children:[(0,F.jsx)(nM,{placeholder:"Search presets...",value:k,onChange:e=>j(e.target.value),autoFocus:!0}),(0,F.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-1",children:f4.filter(e=>{if(!k.trim())return!0;let r=k.toLowerCase();return e.name.toLowerCase().includes(r)||e.command.toLowerCase().includes(r)||(e.description?.toLowerCase().includes(r)??!1)}).map(e=>{let r=b?.command===e.command,s=S===e.command;return(0,F.jsxs)("div",{className:"rounded-md overflow-hidden",children:[(0,F.jsxs)("button",{type:"button",className:(0,iu.cn)("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"bg-primary/10 text-primary":"hover:bg-muted"),onClick:()=>w(e),children:["command"===e.executor_type?(0,F.jsx)(nB.Terminal,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):(0,F.jsx)(f3,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,F.jsx)("span",{className:"font-medium flex-1 text-left",children:e.name}),(0,F.jsx)("button",{type:"button",className:"shrink-0 p-0.5 rounded hover:bg-muted-foreground/10 transition-colors",onClick:r=>{r.stopPropagation(),C(s?null:e.command)},children:s?(0,F.jsx)(aT,{className:"h-4 w-4 text-muted-foreground"}):(0,F.jsx)(id,{className:"h-4 w-4 text-muted-foreground"})})]}),s&&(0,F.jsxs)("div",{className:(0,iu.cn)("px-3 pb-2 pt-1 text-xs text-muted-foreground space-y-1 border-t border-border/50",r?"bg-primary/5":"bg-muted/50"),children:[e.description&&(0,F.jsx)("p",{children:e.description}),(0,F.jsx)("pre",{className:"whitespace-pre-wrap break-all bg-muted/50 rounded px-2 py-1 font-mono",children:e.command}),(0,F.jsxs)("div",{className:"flex gap-3",children:[(0,F.jsxs)("span",{children:["Type: ",(0,F.jsx)("span",{className:"font-medium text-foreground/70",children:e.executor_type})]}),(0,F.jsxs)("span",{children:["PTY: ",(0,F.jsx)("span",{className:"font-medium text-foreground/70",children:e.pty?"on":"off"})]})]})]})]},e.command)})}),(0,F.jsxs)(nn,{children:[(0,F.jsx)($.Button,{type:"button",variant:"outline",onClick:()=>{y(!1),w(null),C(null)},children:"Cancel"}),(0,F.jsx)($.Button,{type:"button",disabled:!b,onClick:()=>{b&&(o(b.name),u(b.command),l(b.executor_type),g(b.pty),y(!1),w(null),C(null))},children:"Select"})]})]})]})]})})}function f8(e,r){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)("closed"),[a,l]=(0,W.useState)(null),[c,d]=(0,W.useState)(!1),h=(0,W.useRef)(null),u=(0,W.useRef)(null),f=(0,W.useRef)(0),p=(0,W.useRef)(null),m=(0,W.useRef)(!1),g=(0,W.useCallback)(()=>{i([]),l(null),d(!1)},[]),v=(0,W.useCallback)(e=>{h.current?.readyState===WebSocket.OPEN&&h.current.send(JSON.stringify({type:"input",data:e}))},[]),x=(0,W.useCallback)((e,r)=>{h.current?.readyState===WebSocket.OPEN?h.current.send(JSON.stringify({type:"resize",cols:e,rows:r})):u.current={cols:e,rows:r}},[]);return(0,W.useEffect)(()=>{if(!e)return;i([]),l(null),d(!1),m.current=!1,f.current=0;let r=!1;return!function s(){if(r||m.current)return;o("connecting");let n=(0,iR.getWebSocketUrl)(`/api/executor-processes/${e}/logs`);console.log(`[useExecutorLogs] Connecting to WebSocket: ${n}`);let a=new WebSocket(n);h.current=a,a.onopen=()=>{if(!r&&(console.log("[useExecutorLogs] WebSocket connected"),o("connected"),i([]),f.current=0,u.current)){let{cols:e,rows:r}=u.current;a.send(JSON.stringify({type:"resize",cols:e,rows:r})),u.current=null}},a.onmessage=e=>{if(!r)try{let r=JSON.parse(e.data);"init"===r.type?d(r.isPty):"finished"===r.type?(m.current=!0,l(r.exitCode),o("closed")):"error"===r.type?o("error"):i(e=>[...e,r])}catch(e){console.error("Failed to parse WebSocket message:",e)}},a.onerror=e=>{r||console.error("[useExecutorLogs] WebSocket error:",e)},a.onclose=i=>{if(console.log("[useExecutorLogs] WebSocket closed:",i.code,i.reason),h.current=null,m.current||r||!e?.startsWith("remote-"))return void o("closed");if(f.current<8){let e=f.current,i=Math.min(15e3,1e3*Math.pow(2,e)),n=i*Math.random()*.25,a=i+n;console.log(`[useExecutorLogs] Scheduling reconnect in ${Math.round(a)}ms (attempt ${e+1}/8)`),o("connecting"),f.current=e+1,p.current=setTimeout(()=>{p.current=null,r||s()},a)}else console.log("[useExecutorLogs] Max reconnect attempts reached"),o("error")}}(),()=>{r=!0,p.current&&(clearTimeout(p.current),p.current=null),h.current&&(h.current.close(),h.current=null)}},[e,r]),{logs:s,status:n,exitCode:a,isPty:c,clearLogs:g,sendInput:v,sendResize:x}}let f7="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function f9(e){let r=Object.prototype.toString.call(e);return"[object Window]"===r||"[object global]"===r}function pe(e){return"nodeType"in e}function pt(e){var r,s;return e?f9(e)?e:pe(e)&&null!=(r=null==(s=e.ownerDocument)?void 0:s.defaultView)?r:window:window}function pr(e){let{Document:r}=pt(e);return e instanceof r}function ps(e){return!f9(e)&&e instanceof pt(e).HTMLElement}function pi(e){return e instanceof pt(e).SVGElement}function pn(e){return e?f9(e)?e.document:pe(e)?pr(e)?e:ps(e)||pi(e)?e.ownerDocument:document:document:document}let po=f7?W.useLayoutEffect:W.useEffect;function pa(e){let r=(0,W.useRef)(e);return po(()=>{r.current=e}),(0,W.useCallback)(function(){for(var e=arguments.length,s=Array(e),i=0;i<e;i++)s[i]=arguments[i];return null==r.current?void 0:r.current(...s)},[])}function pl(e,r){void 0===r&&(r=[e]);let s=(0,W.useRef)(e);return po(()=>{s.current!==e&&(s.current=e)},r),s}function pc(e,r){let s=(0,W.useRef)();return(0,W.useMemo)(()=>{let r=e(s.current);return s.current=r,r},[...r])}function pd(e){let r=pa(e),s=(0,W.useRef)(null),i=(0,W.useCallback)(e=>{e!==s.current&&(null==r||r(e,s.current)),s.current=e},[]);return[s,i]}function ph(e){let r=(0,W.useRef)();return(0,W.useEffect)(()=>{r.current=e},[e]),r.current}let pu={};function pf(e,r){return(0,W.useMemo)(()=>{if(r)return r;let s=null==pu[e]?0:pu[e]+1;return pu[e]=s,e+"-"+s},[e,r])}function pp(e){return function(r){for(var s=arguments.length,i=Array(s>1?s-1:0),n=1;n<s;n++)i[n-1]=arguments[n];return i.reduce((r,s)=>{for(let[i,n]of Object.entries(s)){let s=r[i];null!=s&&(r[i]=s+e*n)}return r},{...r})}}let pm=pp(1),pg=pp(-1);function pv(e){if(!e)return!1;let{KeyboardEvent:r}=pt(e.target);return r&&e instanceof r}function px(e){if(function(e){if(!e)return!1;let{TouchEvent:r}=pt(e.target);return r&&e instanceof r}(e)){if(e.touches&&e.touches.length){let{clientX:r,clientY:s}=e.touches[0];return{x:r,y:s}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:r,clientY:s}=e.changedTouches[0];return{x:r,y:s}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let p_=Object.freeze({Translate:{toString(e){if(!e)return;let{x:r,y:s}=e;return"translate3d("+(r?Math.round(r):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:r,scaleY:s}=e;return"scaleX("+r+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[p_.Translate.toString(e),p_.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:r,duration:s,easing:i}=e;return r+" "+s+"ms "+i}}}),py="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]",pb={display:"none"};function pw(e){let{id:r,value:s}=e;return W.default.createElement("div",{id:r,style:pb},s)}function pS(e){let{id:r,announcement:s,ariaLiveType:i="assertive"}=e;return W.default.createElement("div",{id:r,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":i,"aria-atomic":!0},s)}let pC=(0,W.createContext)(null),pk={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},pj={onDragStart(e){let{active:r}=e;return"Picked up draggable item "+r.id+"."},onDragOver(e){let{active:r,over:s}=e;return s?"Draggable item "+r.id+" was moved over droppable area "+s.id+".":"Draggable item "+r.id+" is no longer over a droppable area."},onDragEnd(e){let{active:r,over:s}=e;return s?"Draggable item "+r.id+" was dropped over droppable area "+s.id:"Draggable item "+r.id+" was dropped."},onDragCancel(e){let{active:r}=e;return"Dragging was cancelled. Draggable item "+r.id+" was dropped."}};function pN(e){var r;let s,{announcements:i=pj,container:n,hiddenTextDescribedById:o,screenReaderInstructions:a=pk}=e,{announce:l,announcement:c}=function(){let[e,r]=(0,W.useState)("");return{announce:(0,W.useCallback)(e=>{null!=e&&r(e)},[]),announcement:e}}(),d=pf("DndLiveRegion"),[h,u]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{u(!0)},[]),r=(0,W.useMemo)(()=>({onDragStart(e){let{active:r}=e;l(i.onDragStart({active:r}))},onDragMove(e){let{active:r,over:s}=e;i.onDragMove&&l(i.onDragMove({active:r,over:s}))},onDragOver(e){let{active:r,over:s}=e;l(i.onDragOver({active:r,over:s}))},onDragEnd(e){let{active:r,over:s}=e;l(i.onDragEnd({active:r,over:s}))},onDragCancel(e){let{active:r,over:s}=e;l(i.onDragCancel({active:r,over:s}))}}),[l,i]),s=(0,W.useContext)(pC),(0,W.useEffect)(()=>{if(!s)throw Error("useDndMonitor must be used within a children of <DndContext>");return s(r)},[r,s]),!h)return null;let f=W.default.createElement(W.default.Fragment,null,W.default.createElement(pw,{id:o,value:a.draggable}),W.default.createElement(pS,{id:d,announcement:c}));return n?(0,G.createPortal)(f,n):f}function pE(){}function pR(e,r){return(0,W.useMemo)(()=>({sensor:e,options:null!=r?r:{}}),[e,r])}(_=E||(E={})).DragStart="dragStart",_.DragMove="dragMove",_.DragEnd="dragEnd",_.DragCancel="dragCancel",_.DragOver="dragOver",_.RegisterDroppable="registerDroppable",_.SetDroppableDisabled="setDroppableDisabled",_.UnregisterDroppable="unregisterDroppable";let pM=Object.freeze({x:0,y:0});function pD(e,r){return Math.sqrt(Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2))}function pT(e,r){let{data:{value:s}}=e,{data:{value:i}}=r;return s-i}function pP(e,r){let{data:{value:s}}=e,{data:{value:i}}=r;return i-s}function pL(e){let{left:r,top:s,height:i,width:n}=e;return[{x:r,y:s},{x:r+n,y:s},{x:r,y:s+i},{x:r+n,y:s+i}]}function pB(e,r){if(!e||0===e.length)return null;let[s]=e;return r?s[r]:s}function pA(e,r,s){return void 0===r&&(r=e.left),void 0===s&&(s=e.top),{x:r+.5*e.width,y:s+.5*e.height}}let pO=e=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=e,n=[];for(let e of i){let{id:i}=e,o=s.get(i);if(o){let s=function(e,r){let s=Math.max(r.top,e.top),i=Math.max(r.left,e.left),n=Math.min(r.left+r.width,e.left+e.width),o=Math.min(r.top+r.height,e.top+e.height);if(i<n&&s<o){let a=r.width*r.height,l=e.width*e.height,c=(n-i)*(o-s);return Number((c/(a+l-c)).toFixed(4))}return 0}(o,r);s>0&&n.push({id:i,data:{droppableContainer:e,value:s}})}}return n.sort(pP)};function pI(e,r){return e&&r?{x:e.left-r.left,y:e.top-r.top}:pM}let pz=function(e){for(var r=arguments.length,s=Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((e,r)=>({...e,top:e.top+ +r.y,bottom:e.bottom+ +r.y,left:e.left+ +r.x,right:e.right+ +r.x}),{...e})},pF={ignoreTransform:!1};function pW(e,r){void 0===r&&(r=pF);let s=e.getBoundingClientRect();if(r.ignoreTransform){let{transform:r,transformOrigin:i}=pt(e).getComputedStyle(e);r&&(s=function(e,r,s){let i=function(e){if(e.startsWith("matrix3d(")){let r=e.slice(9,-1).split(/, /);return{x:+r[12],y:+r[13],scaleX:+r[0],scaleY:+r[5]}}if(e.startsWith("matrix(")){let r=e.slice(7,-1).split(/, /);return{x:+r[4],y:+r[5],scaleX:+r[0],scaleY:+r[3]}}return null}(r);if(!i)return e;let{scaleX:n,scaleY:o,x:a,y:l}=i,c=e.left-a-(1-n)*parseFloat(s),d=e.top-l-(1-o)*parseFloat(s.slice(s.indexOf(" ")+1)),h=n?e.width/n:e.width,u=o?e.height/o:e.height;return{width:h,height:u,top:d,right:c+h,bottom:d+u,left:c}}(s,r,i))}let{top:i,left:n,width:o,height:a,bottom:l,right:c}=s;return{top:i,left:n,width:o,height:a,bottom:l,right:c}}function pH(e){return pW(e,{ignoreTransform:!0})}function p$(e,r){let s=[];return e?function i(n){var o,a;let l;if(null!=r&&s.length>=r||!n)return s;if(pr(n)&&null!=n.scrollingElement&&!s.includes(n.scrollingElement))return s.push(n.scrollingElement),s;if(!ps(n)||pi(n)||s.includes(n))return s;let c=pt(e).getComputedStyle(n);return(n!==e&&(void 0===(o=c)&&(o=pt(n).getComputedStyle(n)),l=/(auto|scroll|overlay)/,["overflow","overflowX","overflowY"].some(e=>{let r=o[e];return"string"==typeof r&&l.test(r)}))&&s.push(n),void 0===(a=c)&&(a=pt(n).getComputedStyle(n)),"fixed"===a.position)?s:i(n.parentNode)}(e):s}function pK(e){let[r]=p$(e,1);return null!=r?r:null}function pU(e){return f7&&e?f9(e)?e:pe(e)?pr(e)||e===pn(e).scrollingElement?window:ps(e)?e:null:null:null}function pq(e){return f9(e)?e.scrollX:e.scrollLeft}function pV(e){return f9(e)?e.scrollY:e.scrollTop}function pY(e){return{x:pq(e),y:pV(e)}}function pX(e){return!!f7&&!!e&&e===document.scrollingElement}function pG(e){let r={x:0,y:0},s=pX(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},i={x:e.scrollWidth-s.width,y:e.scrollHeight-s.height},n=e.scrollTop<=r.y,o=e.scrollLeft<=r.x;return{isTop:n,isLeft:o,isBottom:e.scrollTop>=i.y,isRight:e.scrollLeft>=i.x,maxScroll:i,minScroll:r}}(y=R||(R={}))[y.Forward=1]="Forward",y[y.Backward=-1]="Backward";let pJ={x:.2,y:.2};function pZ(e){return e.reduce((e,r)=>pm(e,pY(r)),pM)}let pQ=[["x",["left","right"],function(e){return e.reduce((e,r)=>e+pq(r),0)}],["y",["top","bottom"],function(e){return e.reduce((e,r)=>e+pV(r),0)}]];class p0{constructor(e,r){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;const s=p$(r),i=pZ(s);for(const[r,n,o]of(this.rect={...e},this.width=e.width,this.height=e.height,pQ))for(const e of n)Object.defineProperty(this,e,{get:()=>{let n=o(s),a=i[r]-n;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class p1{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var r;return null==(r=this.target)?void 0:r.removeEventListener(...e)})},this.target=e}add(e,r,s){var i;null==(i=this.target)||i.addEventListener(e,r,s),this.listeners.push([e,r,s])}}function p2(e,r){let s=Math.abs(e.x),i=Math.abs(e.y);return"number"==typeof r?Math.sqrt(s**2+i**2)>r:"x"in r&&"y"in r?s>r.x&&i>r.y:"x"in r?s>r.x:"y"in r&&i>r.y}function p5(e){e.preventDefault()}function p3(e){e.stopPropagation()}(b=M||(M={})).Click="click",b.DragStart="dragstart",b.Keydown="keydown",b.ContextMenu="contextmenu",b.Resize="resize",b.SelectionChange="selectionchange",b.VisibilityChange="visibilitychange",(w=D||(D={})).Space="Space",w.Down="ArrowDown",w.Right="ArrowRight",w.Left="ArrowLeft",w.Up="ArrowUp",w.Esc="Escape",w.Enter="Enter",w.Tab="Tab";let p4={start:[D.Space,D.Enter],cancel:[D.Esc],end:[D.Space,D.Enter,D.Tab]},p6=(e,r)=>{let{currentCoordinates:s}=r;switch(e.code){case D.Right:return{...s,x:s.x+25};case D.Left:return{...s,x:s.x-25};case D.Down:return{...s,y:s.y+25};case D.Up:return{...s,y:s.y-25}}};class p8{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:r}}=e;this.props=e,this.listeners=new p1(pn(r)),this.windowListeners=new p1(pt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(M.Resize,this.handleCancel),this.windowListeners.add(M.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(M.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,s=e.node.current;s&&function(e,r){if(void 0===r&&(r=pW),!e)return;let{top:s,left:i,bottom:n,right:o}=r(e);pK(e)&&(n<=0||o<=0||s>=window.innerHeight||i>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(s),r(pM)}handleKeyDown(e){if(pv(e)){let{active:r,context:s,options:i}=this.props,{keyboardCodes:n=p4,coordinateGetter:o=p6,scrollBehavior:a="smooth"}=i,{code:l}=e;if(n.end.includes(l))return void this.handleEnd(e);if(n.cancel.includes(l))return void this.handleCancel(e);let{collisionRect:c}=s.current,d=c?{x:c.left,y:c.top}:pM;this.referenceCoordinates||(this.referenceCoordinates=d);let h=o(e,{active:r,context:s.current,currentCoordinates:d});if(h){let r=pg(h,d),i={x:0,y:0},{scrollableAncestors:n}=s.current;for(let s of n){let n=e.code,{isTop:o,isRight:l,isLeft:c,isBottom:d,maxScroll:u,minScroll:f}=pG(s),p=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:r}=window;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}let{top:r,left:s,right:i,bottom:n}=e.getBoundingClientRect();return{top:r,left:s,right:i,bottom:n,width:e.clientWidth,height:e.clientHeight}}(s),m={x:Math.min(n===D.Right?p.right-p.width/2:p.right,Math.max(n===D.Right?p.left:p.left+p.width/2,h.x)),y:Math.min(n===D.Down?p.bottom-p.height/2:p.bottom,Math.max(n===D.Down?p.top:p.top+p.height/2,h.y))},g=n===D.Right&&!l||n===D.Left&&!c,v=n===D.Down&&!d||n===D.Up&&!o;if(g&&m.x!==h.x){let e=s.scrollLeft+r.x,o=n===D.Right&&e<=u.x||n===D.Left&&e>=f.x;if(o&&!r.y)return void s.scrollTo({left:e,behavior:a});o?i.x=s.scrollLeft-e:i.x=n===D.Right?s.scrollLeft-u.x:s.scrollLeft-f.x,i.x&&s.scrollBy({left:-i.x,behavior:a});break}if(v&&m.y!==h.y){let e=s.scrollTop+r.y,o=n===D.Down&&e<=u.y||n===D.Up&&e>=f.y;if(o&&!r.x)return void s.scrollTo({top:e,behavior:a});o?i.y=s.scrollTop-e:i.y=n===D.Down?s.scrollTop-u.y:s.scrollTop-f.y,i.y&&s.scrollBy({top:-i.y,behavior:a});break}}this.handleMove(e,pm(pg(h,this.referenceCoordinates),i))}}}handleMove(e,r){let{onMove:s}=this.props;e.preventDefault(),s(r)}handleEnd(e){let{onEnd:r}=this.props;e.preventDefault(),this.detach(),r()}handleCancel(e){let{onCancel:r}=this.props;e.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function p7(e){return!!(e&&"distance"in e)}function p9(e){return!!(e&&"delay"in e)}p8.activators=[{eventName:"onKeyDown",handler:(e,r,s)=>{let{keyboardCodes:i=p4,onActivation:n}=r,{active:o}=s,{code:a}=e.nativeEvent;if(i.start.includes(a)){let r=o.activatorNode.current;return(!r||e.target===r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}return!1}}];class me{constructor(e,r,s){var i;void 0===s&&(s=function(e){let{EventTarget:r}=pt(e);return e instanceof r?e:pn(e)}(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=r;const{event:n}=e,{target:o}=n;this.props=e,this.events=r,this.document=pn(o),this.documentListeners=new p1(this.document),this.listeners=new p1(s),this.windowListeners=new p1(pt(o)),this.initialCoordinates=null!=(i=px(n))?i:pM,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:r,bypassActivationConstraint:s}}}=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(M.Resize,this.handleCancel),this.windowListeners.add(M.DragStart,p5),this.windowListeners.add(M.VisibilityChange,this.handleCancel),this.windowListeners.add(M.ContextMenu,p5),this.documentListeners.add(M.Keydown,this.handleKeydown),r){if(null!=s&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(p9(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(p7(r))return void this.handlePending(r)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,r){let{active:s,onPending:i}=this.props;i(s,e,this.initialCoordinates,r)}handleStart(){let{initialCoordinates:e}=this,{onStart:r}=this.props;e&&(this.activated=!0,this.documentListeners.add(M.Click,p3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(M.SelectionChange,this.removeTextSelection),r(e))}handleMove(e){var r;let{activated:s,initialCoordinates:i,props:n}=this,{onMove:o,options:{activationConstraint:a}}=n;if(!i)return;let l=null!=(r=px(e))?r:pM,c=pg(i,l);if(!s&&a){if(p7(a)){if(null!=a.tolerance&&p2(c,a.tolerance))return this.handleCancel();if(p2(c,a.distance))return this.handleStart()}return p9(a)&&p2(c,a.tolerance)?this.handleCancel():void this.handlePending(a,c)}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){let{onAbort:e,onEnd:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleCancel(){let{onAbort:e,onCancel:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleKeydown(e){e.code===D.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let mt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class mr extends me{constructor(e){const{event:r}=e;super(e,mt,pn(r.target))}}mr.activators=[{eventName:"onPointerDown",handler:(e,r)=>{let{nativeEvent:s}=e,{onActivation:i}=r;return!!s.isPrimary&&0===s.button&&(null==i||i({event:s}),!0)}}];(S=T||(T={}))[S.RightClick=2]="RightClick";(C=P||(P={}))[C.Pointer=0]="Pointer",C[C.DraggableRect=1]="DraggableRect",(k=L||(L={}))[k.TreeOrder=0]="TreeOrder",k[k.ReversedTreeOrder=1]="ReversedTreeOrder";let ms={x:{[R.Backward]:!1,[R.Forward]:!1},y:{[R.Backward]:!1,[R.Forward]:!1}};(j=B||(B={}))[j.Always=0]="Always",j[j.BeforeDragging=1]="BeforeDragging",j[j.WhileDragging=2]="WhileDragging",(A||(A={})).Optimized="optimized";let mi=new Map;function mn(e,r){return pc(s=>e?s||("function"==typeof r?r(e):e):null,[r,e])}function mo(e){let{callback:r,disabled:s}=e,i=pa(r),n=(0,W.useMemo)(()=>{if(s||"undefined"==typeof window||void 0===window.ResizeObserver)return;let{ResizeObserver:e}=window;return new e(i)},[s]);return(0,W.useEffect)(()=>()=>null==n?void 0:n.disconnect(),[n]),n}function ma(e){return new p0(pW(e),e)}function ml(e,r,s){void 0===r&&(r=ma);let[i,n]=(0,W.useState)(null);function o(){n(i=>{if(!e)return null;if(!1===e.isConnected){var n;return null!=(n=null!=i?i:s)?n:null}let o=r(e);return JSON.stringify(i)===JSON.stringify(o)?i:o})}let a=function(e){let{callback:r,disabled:s}=e,i=pa(r),n=(0,W.useMemo)(()=>{if(s||"undefined"==typeof window||void 0===window.MutationObserver)return;let{MutationObserver:e}=window;return new e(i)},[i,s]);return(0,W.useEffect)(()=>()=>null==n?void 0:n.disconnect(),[n]),n}({callback(r){if(e)for(let s of r){let{type:r,target:i}=s;if("childList"===r&&i instanceof HTMLElement&&i.contains(e)){o();break}}}}),l=mo({callback:o});return po(()=>{o(),e?(null==l||l.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==a||a.disconnect())},[e]),i}let mc=[];function md(e,r){void 0===r&&(r=[]);let s=(0,W.useRef)(null);return(0,W.useEffect)(()=>{s.current=null},r),(0,W.useEffect)(()=>{let r=e!==pM;r&&!s.current&&(s.current=e),!r&&s.current&&(s.current=null)},[e]),s.current?pg(e,s.current):pM}function mh(e){return(0,W.useMemo)(()=>{let r,s;return e?(r=e.innerWidth,{top:0,left:0,right:r,bottom:s=e.innerHeight,width:r,height:s}):null},[e])}let mu=[],mf=[{sensor:mr,options:{}},{sensor:p8,options:{}}],mp={current:{}},mm={draggable:{measure:pH},droppable:{measure:pH,strategy:B.WhileDragging,frequency:A.Optimized},dragOverlay:{measure:pW}};class mg extends Map{get(e){var r;return null!=e&&null!=(r=super.get(e))?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:r}=e;return!r})}getNodeFor(e){var r,s;return null!=(r=null==(s=this.get(e))?void 0:s.node.current)?r:void 0}}let mv={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mg,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pE},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:mm,measureDroppableContainers:pE,windowRect:null,measuringScheduled:!1},mx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pE,draggableNodes:new Map,over:null,measureDroppableContainers:pE},m_=(0,W.createContext)(mx),my=(0,W.createContext)(mv);function mb(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mg}}}function mw(e,r){switch(r.type){case E.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:r.initialCoordinates,active:r.active}};case E.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:r.coordinates.x-e.draggable.initialCoordinates.x,y:r.coordinates.y-e.draggable.initialCoordinates.y}}};case E.DragEnd:case E.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case E.RegisterDroppable:{let{element:s}=r,{id:i}=s,n=new mg(e.droppable.containers);return n.set(i,s),{...e,droppable:{...e.droppable,containers:n}}}case E.SetDroppableDisabled:{let{id:s,key:i,disabled:n}=r,o=e.droppable.containers.get(s);if(!o||i!==o.key)return e;let a=new mg(e.droppable.containers);return a.set(s,{...o,disabled:n}),{...e,droppable:{...e.droppable,containers:a}}}case E.UnregisterDroppable:{let{id:s,key:i}=r,n=e.droppable.containers.get(s);if(!n||i!==n.key)return e;let o=new mg(e.droppable.containers);return o.delete(s),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function mS(e){let{disabled:r}=e,{active:s,activatorEvent:i,draggableNodes:n}=(0,W.useContext)(m_),o=ph(i),a=ph(null==s?void 0:s.id);return(0,W.useEffect)(()=>{if(!r&&!i&&o&&null!=a){if(!pv(o)||document.activeElement===o.target)return;let e=n.get(a);if(!e)return;let{activatorNode:r,node:s}=e;(r.current||s.current)&&requestAnimationFrame(()=>{for(let e of[r.current,s.current]){if(!e)continue;let r=e.matches(py)?e:e.querySelector(py);if(r){r.focus();break}}})}},[i,r,n,a,o]),null}let mC=(0,W.createContext)({...pM,scaleX:1,scaleY:1});(N=O||(O={}))[N.Uninitialized=0]="Uninitialized",N[N.Initializing=1]="Initializing",N[N.Initialized=2]="Initialized";let mk=(0,W.memo)(function(e){var r,s,i,n,o,a,l,c;let d,h,u,f,p,m,g,v,{id:x,accessibility:_,autoScroll:y=!0,children:b,sensors:w=mf,collisionDetection:S=pO,measuring:C,modifiers:k,...j}=e,[N,M]=(0,W.useReducer)(mw,void 0,mb),[D,T]=function(){let[e]=(0,W.useState)(()=>new Set),r=(0,W.useCallback)(r=>(e.add(r),()=>e.delete(r)),[e]);return[(0,W.useCallback)(r=>{let{type:s,event:i}=r;e.forEach(e=>{var r;return null==(r=e[s])?void 0:r.call(e,i)})},[e]),r]}(),[A,I]=(0,W.useState)(O.Uninitialized),z=A===O.Initialized,{draggable:{active:F,nodes:H,translate:$},droppable:{containers:K}}=N,U=null!=F?H.get(F):null,q=(0,W.useRef)({initial:null,translated:null}),V=(0,W.useMemo)(()=>{var e;return null!=F?{id:F,data:null!=(e=null==U?void 0:U.data)?e:mp,rect:q}:null},[F,U]),Y=(0,W.useRef)(null),[X,J]=(0,W.useState)(null),[Z,Q]=(0,W.useState)(null),ee=pl(j,Object.values(j)),et=pf("DndDescribedBy",x),er=(0,W.useMemo)(()=>K.getEnabled(),[K]),es=(0,W.useMemo)(()=>({draggable:{...mm.draggable,...null==C?void 0:C.draggable},droppable:{...mm.droppable,...null==C?void 0:C.droppable},dragOverlay:{...mm.dragOverlay,...null==C?void 0:C.dragOverlay}}),[null==C?void 0:C.draggable,null==C?void 0:C.droppable,null==C?void 0:C.dragOverlay]),{droppableRects:ei,measureDroppableContainers:en,measuringScheduled:eo}=function(e,r){let{dragging:s,dependencies:i,config:n}=r,[o,a]=(0,W.useState)(null),{frequency:l,measure:c,strategy:d}=n,h=(0,W.useRef)(e),u=function(){switch(d){case B.Always:return!1;case B.BeforeDragging:return s;default:return!s}}(),f=pl(u),p=(0,W.useCallback)(function(e){void 0===e&&(e=[]),f.current||a(r=>null===r?e:r.concat(e.filter(e=>!r.includes(e))))},[f]),m=(0,W.useRef)(null),g=pc(r=>{if(u&&!s)return mi;if(!r||r===mi||h.current!==e||null!=o){let r=new Map;for(let s of e){if(!s)continue;if(o&&o.length>0&&!o.includes(s.id)&&s.rect.current){r.set(s.id,s.rect.current);continue}let e=s.node.current,i=e?new p0(c(e),e):null;s.rect.current=i,i&&r.set(s.id,i)}return r}return r},[e,o,s,u,c]);return(0,W.useEffect)(()=>{h.current=e},[e]),(0,W.useEffect)(()=>{u||p()},[s,u]),(0,W.useEffect)(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),(0,W.useEffect)(()=>{u||"number"!=typeof l||null!==m.current||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,u,p,...i]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:null!=o}}(er,{dragging:z,dependencies:[$.x,$.y],config:es.droppable}),ea=pc(e=>{var r;return null==F?null:null!=(r=null!=p?p:e)?r:null},[p=(f=null!=F?H.get(F):void 0)?f.node.current:null,F]),el=(0,W.useMemo)(()=>Z?px(Z):null,[Z]),ec=(d=(null==X?void 0:X.autoScrollEnabled)===!1,h="object"==typeof y?!1===y.enabled:!1===y,u=z&&!d&&!h,"object"==typeof y?{...y,enabled:u}:{enabled:u}),ed=mn(ea,es.draggable.measure);!function(e){let{activeNode:r,measure:s,initialRect:i,config:n=!0}=e,o=(0,W.useRef)(!1),{x:a,y:l}="boolean"==typeof n?{x:n,y:n}:n;po(()=>{if(!a&&!l||!r){o.current=!1;return}if(o.current||!i)return;let e=null==r?void 0:r.node.current;if(!e||!1===e.isConnected)return;let n=pI(s(e),i);if(a||(n.x=0),l||(n.y=0),o.current=!0,Math.abs(n.x)>0||Math.abs(n.y)>0){let r=pK(e);r&&r.scrollBy({top:n.y,left:n.x})}},[r,a,l,i,s])}({activeNode:null!=F?H.get(F):null,config:ec.layoutShiftCompensation,initialRect:ed,measure:es.draggable.measure});let eh=ml(ea,es.draggable.measure,ed),eu=ml(ea?ea.parentElement:null),ef=(0,W.useRef)({activatorEvent:null,active:null,activeNode:ea,collisionRect:null,collisions:null,droppableRects:ei,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:K,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ep=K.getNodeFor(null==(r=ef.current.over)?void 0:r.id),em=function(e){let{measure:r}=e,[s,i]=(0,W.useState)(null),n=mo({callback:(0,W.useCallback)(e=>{for(let{target:s}of e)if(ps(s)){i(e=>{let i=r(s);return e?{...e,width:i.width,height:i.height}:i});break}},[r])}),[o,a]=pd((0,W.useCallback)(e=>{let s=function(e){if(!e)return null;if(e.children.length>1)return e;let r=e.children[0];return ps(r)?r:e}(e);null==n||n.disconnect(),s&&(null==n||n.observe(s)),i(s?r(s):null)},[r,n]));return(0,W.useMemo)(()=>({nodeRef:o,rect:s,setRef:a}),[s,o,a])}({measure:es.dragOverlay.measure}),eg=null!=(s=em.nodeRef.current)?s:ea,ev=z?null!=(i=em.rect)?i:eh:null,ex=!!(em.nodeRef.current&&em.rect),e_=(m=mn(o=ex?null:eh),pI(o,m)),ey=mh(eg?pt(eg):null),eb=(a=z?null!=ep?ep:ea:null,g=(0,W.useRef)(a),v=pc(e=>a?e&&e!==mc&&a&&g.current&&a.parentNode===g.current.parentNode?e:p$(a):mc,[a]),(0,W.useEffect)(()=>{g.current=a},[a]),v),ew=function(e,r){void 0===r&&(r=pW);let[s]=e,i=mh(s?pt(s):null),[n,o]=(0,W.useState)(mu);function a(){o(()=>e.length?e.map(e=>pX(e)?i:new p0(r(e),e)):mu)}let l=mo({callback:a});return po(()=>{null==l||l.disconnect(),a(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),n}(eb),eS=function(e,r){let{transform:s,...i}=r;return null!=e&&e.length?e.reduce((e,r)=>r({transform:e,...i}),s):s}(k,{transform:{x:$.x-e_.x,y:$.y-e_.y,scaleX:1,scaleY:1},activatorEvent:Z,active:V,activeNodeRect:eh,containerNodeRect:eu,draggingNodeRect:ev,over:ef.current.over,overlayNodeRect:em.rect,scrollableAncestors:eb,scrollableAncestorRects:ew,windowRect:ey}),eC=el?pm(el,$):null,ek=function(e){let[r,s]=(0,W.useState)(null),i=(0,W.useRef)(e),n=(0,W.useCallback)(e=>{let r=pU(e.target);r&&s(e=>e?(e.set(r,pY(r)),new Map(e)):null)},[]);return(0,W.useEffect)(()=>{let r=i.current;if(e!==r){o(r);let a=e.map(e=>{let r=pU(e);return r?(r.addEventListener("scroll",n,{passive:!0}),[r,pY(r)]):null}).filter(e=>null!=e);s(a.length?new Map(a):null),i.current=e}return()=>{o(e),o(r)};function o(e){e.forEach(e=>{let r=pU(e);null==r||r.removeEventListener("scroll",n)})}},[n,e]),(0,W.useMemo)(()=>e.length?r?Array.from(r.values()).reduce((e,r)=>pm(e,r),pM):pZ(e):pM,[e,r])}(eb),ej=md(ek),eN=md(ek,[eh]),eE=pm(eS,ej),eR=ev?pz(ev,eS):null,eM=V&&eR?S({active:V,collisionRect:eR,droppableRects:ei,droppableContainers:er,pointerCoordinates:eC}):null,eD=pB(eM,"id"),[eT,eP]=(0,W.useState)(null),eL=(l=ex?eS:pm(eS,eN),c=null!=(n=null==eT?void 0:eT.rect)?n:null,{...l,scaleX:c&&eh?c.width/eh.width:1,scaleY:c&&eh?c.height/eh.height:1}),eB=(0,W.useRef)(null),eA=(0,W.useCallback)((e,r)=>{let{sensor:s,options:i}=r;if(null==Y.current)return;let n=H.get(Y.current);if(!n)return;let o=e.nativeEvent,a=new s({active:Y.current,activeNode:n,event:o,options:i,context:ef,onAbort(e){if(!H.get(e))return;let{onDragAbort:r}=ee.current,s={id:e};null==r||r(s),D({type:"onDragAbort",event:s})},onPending(e,r,s,i){if(!H.get(e))return;let{onDragPending:n}=ee.current,o={id:e,constraint:r,initialCoordinates:s,offset:i};null==n||n(o),D({type:"onDragPending",event:o})},onStart(e){let r=Y.current;if(null==r)return;let s=H.get(r);if(!s)return;let{onDragStart:i}=ee.current,n={activatorEvent:o,active:{id:r,data:s.data,rect:q}};(0,G.unstable_batchedUpdates)(()=>{null==i||i(n),I(O.Initializing),M({type:E.DragStart,initialCoordinates:e,active:r}),D({type:"onDragStart",event:n}),J(eB.current),Q(o)})},onMove(e){M({type:E.DragMove,coordinates:e})},onEnd:l(E.DragEnd),onCancel:l(E.DragCancel)});function l(e){return async function(){let{active:r,collisions:s,over:i,scrollAdjustedTranslate:n}=ef.current,a=null;if(r&&n){let{cancelDrop:l}=ee.current;a={activatorEvent:o,active:r,collisions:s,delta:n,over:i},e===E.DragEnd&&"function"==typeof l&&await Promise.resolve(l(a))&&(e=E.DragCancel)}Y.current=null,(0,G.unstable_batchedUpdates)(()=>{M({type:e}),I(O.Uninitialized),eP(null),J(null),Q(null),eB.current=null;let r=e===E.DragEnd?"onDragEnd":"onDragCancel";if(a){let e=ee.current[r];null==e||e(a),D({type:r,event:a})}})}}eB.current=a},[H]),eO=(0,W.useCallback)((e,r)=>(s,i)=>{let n=s.nativeEvent,o=H.get(i);null!==Y.current||!o||n.dndKit||n.defaultPrevented||!0===e(s,r.options,{active:o})&&(n.dndKit={capturedBy:r.sensor},Y.current=i,eA(s,r))},[H,eA]),eI=(0,W.useMemo)(()=>w.reduce((e,r)=>{let{sensor:s}=r;return[...e,...s.activators.map(e=>({eventName:e.eventName,handler:eO(e.handler,r)}))]},[]),[w,eO]);(0,W.useEffect)(()=>{if(!f7)return;let e=w.map(e=>{let{sensor:r}=e;return null==r.setup?void 0:r.setup()});return()=>{for(let r of e)null==r||r()}},w.map(e=>{let{sensor:r}=e;return r})),po(()=>{eh&&A===O.Initializing&&I(O.Initialized)},[eh,A]),(0,W.useEffect)(()=>{let{onDragMove:e}=ee.current,{active:r,activatorEvent:s,collisions:i,over:n}=ef.current;if(!r||!s)return;let o={active:r,activatorEvent:s,collisions:i,delta:{x:eE.x,y:eE.y},over:n};(0,G.unstable_batchedUpdates)(()=>{null==e||e(o),D({type:"onDragMove",event:o})})},[eE.x,eE.y]),(0,W.useEffect)(()=>{let{active:e,activatorEvent:r,collisions:s,droppableContainers:i,scrollAdjustedTranslate:n}=ef.current;if(!e||null==Y.current||!r||!n)return;let{onDragOver:o}=ee.current,a=i.get(eD),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,activatorEvent:r,collisions:s,delta:{x:n.x,y:n.y},over:l};(0,G.unstable_batchedUpdates)(()=>{eP(l),null==o||o(c),D({type:"onDragOver",event:c})})},[eD]),po(()=>{ef.current={activatorEvent:Z,active:V,activeNode:ea,collisionRect:eR,collisions:eM,droppableRects:ei,draggableNodes:H,draggingNode:eg,draggingNodeRect:ev,droppableContainers:K,over:eT,scrollableAncestors:eb,scrollAdjustedTranslate:eE},q.current={initial:ev,translated:eR}},[V,ea,eM,eR,H,eg,ev,ei,K,eT,eb,eE]),function(e){let r,{acceleration:s,activator:i=P.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:l=5,order:c=L.TreeOrder,pointerCoordinates:d,scrollableAncestors:h,scrollableAncestorRects:u,delta:f,threshold:p}=e,m=function(e){let{delta:r,disabled:s}=e,i=ph(r);return pc(e=>{if(s||!i||!e)return ms;let n={x:Math.sign(r.x-i.x),y:Math.sign(r.y-i.y)};return{x:{[R.Backward]:e.x[R.Backward]||-1===n.x,[R.Forward]:e.x[R.Forward]||1===n.x},y:{[R.Backward]:e.y[R.Backward]||-1===n.y,[R.Forward]:e.y[R.Forward]||1===n.y}}},[s,r,i])}({delta:f,disabled:!a}),[g,v]=(r=(0,W.useRef)(null),[(0,W.useCallback)((e,s)=>{r.current=setInterval(e,s)},[]),(0,W.useCallback)(()=>{null!==r.current&&(clearInterval(r.current),r.current=null)},[])]),x=(0,W.useRef)({x:0,y:0}),_=(0,W.useRef)({x:0,y:0}),y=(0,W.useMemo)(()=>{switch(i){case P.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case P.DraggableRect:return o}},[i,o,d]),b=(0,W.useRef)(null),w=(0,W.useCallback)(()=>{let e=b.current;if(!e)return;let r=x.current.x*_.current.x,s=x.current.y*_.current.y;e.scrollBy(r,s)},[]),S=(0,W.useMemo)(()=>c===L.TreeOrder?[...h].reverse():h,[c,h]);(0,W.useEffect)(()=>{if(!a||!h.length||!y)return void v();for(let e of S){if((null==n?void 0:n(e))===!1)continue;let r=u[h.indexOf(e)];if(!r)continue;let{direction:i,speed:o}=function(e,r,s,i,n){let{top:o,left:a,right:l,bottom:c}=s;void 0===i&&(i=10),void 0===n&&(n=pJ);let{isTop:d,isBottom:h,isLeft:u,isRight:f}=pG(e),p={x:0,y:0},m={x:0,y:0},g={height:r.height*n.y,width:r.width*n.x};return!d&&o<=r.top+g.height?(p.y=R.Backward,m.y=i*Math.abs((r.top+g.height-o)/g.height)):!h&&c>=r.bottom-g.height&&(p.y=R.Forward,m.y=i*Math.abs((r.bottom-g.height-c)/g.height)),!f&&l>=r.right-g.width?(p.x=R.Forward,m.x=i*Math.abs((r.right-g.width-l)/g.width)):!u&&a<=r.left+g.width&&(p.x=R.Backward,m.x=i*Math.abs((r.left+g.width-a)/g.width)),{direction:p,speed:m}}(e,r,y,s,p);for(let e of["x","y"])m[e][i[e]]||(o[e]=0,i[e]=0);if(o.x>0||o.y>0){v(),b.current=e,g(w,l),x.current=o,_.current=i;return}}x.current={x:0,y:0},_.current={x:0,y:0},v()},[s,w,n,v,a,l,JSON.stringify(y),JSON.stringify(m),g,h,S,u,JSON.stringify(p)])}({...ec,delta:$,draggingRect:eR,pointerCoordinates:eC,scrollableAncestors:eb,scrollableAncestorRects:ew});let ez=(0,W.useMemo)(()=>({active:V,activeNode:ea,activeNodeRect:eh,activatorEvent:Z,collisions:eM,containerNodeRect:eu,dragOverlay:em,draggableNodes:H,droppableContainers:K,droppableRects:ei,over:eT,measureDroppableContainers:en,scrollableAncestors:eb,scrollableAncestorRects:ew,measuringConfiguration:es,measuringScheduled:eo,windowRect:ey}),[V,ea,eh,Z,eM,eu,em,H,K,ei,eT,en,eb,ew,es,eo,ey]),eF=(0,W.useMemo)(()=>({activatorEvent:Z,activators:eI,active:V,activeNodeRect:eh,ariaDescribedById:{draggable:et},dispatch:M,draggableNodes:H,over:eT,measureDroppableContainers:en}),[Z,eI,V,eh,M,et,H,eT,en]);return W.default.createElement(pC.Provider,{value:T},W.default.createElement(m_.Provider,{value:eF},W.default.createElement(my.Provider,{value:ez},W.default.createElement(mC.Provider,{value:eL},b)),W.default.createElement(mS,{disabled:(null==_?void 0:_.restoreFocus)===!1})),W.default.createElement(pN,{..._,hiddenTextDescribedById:et}))}),mj=(0,W.createContext)(null),mN="button",mE={timeout:25},mR={position:"fixed",touchAction:"none"},mM=e=>pv(e)?"transform 250ms ease":void 0;function mD(e,r,s){let i=e.slice();return i.splice(s<0?i.length+s:s,0,i.splice(r,1)[0]),i}function mT(e){return null!==e&&e>=0}(e,r)=>{let{as:s,activatorEvent:i,adjustScale:n,children:o,className:a,rect:l,style:c,transform:d,transition:h=mM}=e;if(!l)return null;let u=n?d:{...d,scaleX:1,scaleY:1},f={...mR,width:l.width,height:l.height,top:l.top,left:l.left,transform:p_.Transform.toString(u),transformOrigin:n&&i?function(e,r){let s=px(e);if(!s)return"0 0";let i={x:(s.x-r.left)/r.width*100,y:(s.y-r.top)/r.height*100};return i.x+"% "+i.y+"%"}(i,l):void 0,transition:"function"==typeof h?h(i):h,...c};return W.default.createElement(s,{className:a,style:f,ref:r},o)},v={styles:{active:{opacity:"0"}}};let mP=e=>{let{rects:r,activeIndex:s,overIndex:i,index:n}=e,o=mD(r,i,s),a=r[n],l=o[n];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},mL={scaleX:1,scaleY:1},mB=e=>{var r,s,i,n;let o,a,l,{activeIndex:c,activeNodeRect:d,index:h,rects:u,overIndex:f}=e,p=null!=(r=u[c])?r:d;if(!p)return null;if(h===c){let e=u[f];return e?{x:0,y:c<f?e.top+e.height-(p.top+p.height):e.top-p.top,...mL}:null}let m=(s=u,i=h,n=c,o=s[i],a=s[i-1],l=s[i+1],o?n<i?a?o.top-(a.top+a.height):l?l.top-(o.top+o.height):0:l?l.top-(o.top+o.height):a?o.top-(a.top+a.height):0:0);return h>c&&h<=f?{x:0,y:-p.height-m,...mL}:h<c&&h>=f?{x:0,y:p.height+m,...mL}:{x:0,y:0,...mL}},mA="Sortable",mO=W.default.createContext({activeIndex:-1,containerId:mA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mP,disabled:{draggable:!1,droppable:!1}});function mI(e){let{children:r,id:s,items:i,strategy:n=mP,disabled:o=!1}=e,{active:a,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=(0,W.useContext)(my),u=pf(mA,s),f=null!==l.rect,p=(0,W.useMemo)(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),m=null!=a,g=a?p.indexOf(a.id):-1,v=d?p.indexOf(d.id):-1,x=(0,W.useRef)(p),_=!function(e,r){if(e===r)return!0;if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==r[s])return!1;return!0}(p,x.current),y=-1!==v&&-1===g||_,b="boolean"==typeof o?{draggable:o,droppable:o}:o;po(()=>{_&&m&&h(p)},[_,p,m,h]),(0,W.useEffect)(()=>{x.current=p},[p]);let w=(0,W.useMemo)(()=>({activeIndex:g,containerId:u,disabled:b,disableTransforms:y,items:p,overIndex:v,useDragOverlay:f,sortedRects:p.reduce((e,r,s)=>{let i=c.get(r);return i&&(e[s]=i),e},Array(p.length)),strategy:n}),[g,u,b.draggable,b.droppable,y,p,v,c,f,n]);return W.default.createElement(mO.Provider,{value:w},r)}let mz=e=>{let{id:r,items:s,activeIndex:i,overIndex:n}=e;return mD(s,i,n).indexOf(r)},mF=e=>{let{containerId:r,isSorting:s,wasDragging:i,index:n,items:o,newIndex:a,previousItems:l,previousContainerId:c,transition:d}=e;return!!d&&!!i&&(l===o||n!==a)&&(!!s||a!==n&&r===c)},mW={duration:200,easing:"ease"},mH="transform",m$=p_.Transition.toString({property:mH,duration:0,easing:"linear"}),mK={roleDescription:"sortable"};function mU(e){if(!e)return!1;let r=e.data.current;return!!r&&"sortable"in r&&"object"==typeof r.sortable&&"containerId"in r.sortable&&"items"in r.sortable&&"index"in r.sortable}let mq=[D.Down,D.Right,D.Up,D.Left],mV=(e,r)=>{let{context:{active:s,collisionRect:i,droppableRects:n,droppableContainers:o,over:a,scrollableAncestors:l}}=r;if(mq.includes(e.code)){if(e.preventDefault(),!s||!i)return;let r=[];o.getEnabled().forEach(s=>{if(!s||null!=s&&s.disabled)return;let o=n.get(s.id);if(o)switch(e.code){case D.Down:i.top<o.top&&r.push(s);break;case D.Up:i.top>o.top&&r.push(s);break;case D.Left:i.left>o.left&&r.push(s);break;case D.Right:i.left<o.left&&r.push(s)}});let h=(e=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=e,n=pL(r),o=[];for(let e of i){let{id:r}=e,i=s.get(r);if(i){let s=pL(i),a=Number((n.reduce((e,r,i)=>e+pD(s[i],r),0)/4).toFixed(4));o.push({id:r,data:{droppableContainer:e,value:a}})}}return o.sort(pT)})({active:s,collisionRect:i,droppableRects:n,droppableContainers:r,pointerCoordinates:null}),u=pB(h,"id");if(u===(null==a?void 0:a.id)&&h.length>1&&(u=h[1].id),null!=u){let e=o.get(s.id),r=o.get(u),a=r?n.get(r.id):null,h=null==r?void 0:r.node.current;if(h&&a&&e&&r){var c,d;let s=p$(h).some((e,r)=>l[r]!==e),n=mY(e,r),o=(c=e,d=r,!!mU(c)&&!!mU(d)&&!!mY(c,d)&&c.data.current.sortable.index<d.data.current.sortable.index),u=s||!n?{x:0,y:0}:{x:o?i.width-a.width:0,y:o?i.height-a.height:0},f={x:a.left,y:a.top};return u.x&&u.y?f:pg(f,u)}}}};function mY(e,r){return!!mU(e)&&!!mU(r)&&e.data.current.sortable.containerId===r.data.current.sortable.containerId}function mX({executor:e,executorMode:r,isOpen:s,onOpenChange:i,onStart:n,onStop:o,onUpdate:a,onDelete:l,onProcessFinished:c}){let[d,h]=(0,W.useState)(!1),[u,f]=(0,W.useState)(e.currentProcessId),p=(0,W.useRef)(!1),{attributes:m,listeners:g,setNodeRef:v,transform:x,transition:_,isDragging:y}=function(e){var r,s,i,n;let{animateLayoutChanges:o=mF,attributes:a,disabled:l,data:c,getNewIndex:d=mz,id:h,strategy:u,resizeObserverConfig:f,transition:p=mW}=e,{items:m,containerId:g,activeIndex:v,disabled:x,disableTransforms:_,sortedRects:y,overIndex:b,useDragOverlay:w,strategy:S}=(0,W.useContext)(mO),C=(r=l,s=x,"boolean"==typeof r?{draggable:r,droppable:!1}:{draggable:null!=(i=null==r?void 0:r.draggable)?i:s.draggable,droppable:null!=(n=null==r?void 0:r.droppable)?n:s.droppable}),k=m.indexOf(h),j=(0,W.useMemo)(()=>({sortable:{containerId:g,index:k,items:m},...c}),[g,c,k,m]),N=(0,W.useMemo)(()=>m.slice(m.indexOf(h)),[m,h]),{rect:R,node:M,isOver:D,setNodeRef:T}=function(e){let{data:r,disabled:s=!1,id:i,resizeObserverConfig:n}=e,o=pf("Droppable"),{active:a,dispatch:l,over:c,measureDroppableContainers:d}=(0,W.useContext)(m_),h=(0,W.useRef)({disabled:s}),u=(0,W.useRef)(!1),f=(0,W.useRef)(null),p=(0,W.useRef)(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...mE,...n},x=pl(null!=g?g:i),_=mo({callback:(0,W.useCallback)(()=>{if(!u.current){u.current=!0;return}null!=p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),p.current=null},v)},[v]),disabled:m||!a}),[y,b]=pd((0,W.useCallback)((e,r)=>{_&&(r&&(_.unobserve(r),u.current=!1),e&&_.observe(e))},[_])),w=pl(r);return(0,W.useEffect)(()=>{_&&y.current&&(_.disconnect(),u.current=!1,_.observe(y.current))},[y,_]),(0,W.useEffect)(()=>(l({type:E.RegisterDroppable,element:{id:i,key:o,disabled:s,node:y,rect:f,data:w}}),()=>l({type:E.UnregisterDroppable,key:o,id:i})),[i]),(0,W.useEffect)(()=>{s!==h.current.disabled&&(l({type:E.SetDroppableDisabled,id:i,key:o,disabled:s}),h.current.disabled=s)},[i,o,s,l]),{active:a,rect:f,isOver:(null==c?void 0:c.id)===i,node:y,over:c,setNodeRef:b}}({id:h,data:j,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...f}}),{active:P,activatorEvent:L,activeNodeRect:B,attributes:A,setNodeRef:O,listeners:I,isDragging:z,over:F,setActivatorNodeRef:H,transform:$}=function(e){let{id:r,data:s,disabled:i=!1,attributes:n}=e,o=pf("Draggable"),{activators:a,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:u,over:f}=(0,W.useContext)(m_),{role:p=mN,roleDescription:m="draggable",tabIndex:g=0}=null!=n?n:{},v=(null==c?void 0:c.id)===r,x=(0,W.useContext)(v?mC:mj),[_,y]=pd(),[b,w]=pd(),S=(0,W.useMemo)(()=>a.reduce((e,s)=>{let{eventName:i,handler:n}=s;return e[i]=e=>{n(e,r)},e},{}),[a,r]),C=pl(s);return po(()=>(u.set(r,{id:r,key:o,node:_,activatorNode:b,data:C}),()=>{let e=u.get(r);e&&e.key===o&&u.delete(r)}),[u,r]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:(0,W.useMemo)(()=>({role:p,tabIndex:g,"aria-disabled":i,"aria-pressed":!!v&&p===mN||void 0,"aria-roledescription":m,"aria-describedby":h.draggable}),[i,p,g,v,m,h.draggable]),isDragging:v,listeners:i?void 0:S,node:_,over:f,setNodeRef:y,setActivatorNodeRef:w,transform:x}}({id:h,data:j,attributes:{...mK,...a},disabled:C.draggable}),K=function(){for(var e=arguments.length,r=Array(e),s=0;s<e;s++)r[s]=arguments[s];return(0,W.useMemo)(()=>e=>{r.forEach(r=>r(e))},r)}(T,O),U=!!P,q=U&&!_&&mT(v)&&mT(b),V=!w&&z,Y=V&&q?$:null,X=q?null!=Y?Y:(null!=u?u:S)({rects:y,activeNodeRect:B,activeIndex:v,overIndex:b,index:k}):null,G=mT(v)&&mT(b)?d({id:h,items:m,activeIndex:v,overIndex:b}):k,J=null==P?void 0:P.id,Z=(0,W.useRef)({activeId:J,items:m,newIndex:G,containerId:g}),Q=m!==Z.current.items,ee=o({active:P,containerId:g,isDragging:z,isSorting:U,id:h,index:k,items:m,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:p,wasDragging:null!=Z.current.activeId}),et=function(e){let{disabled:r,index:s,node:i,rect:n}=e,[o,a]=(0,W.useState)(null),l=(0,W.useRef)(s);return po(()=>{if(!r&&s!==l.current&&i.current){let e=n.current;if(e){let r=pW(i.current,{ignoreTransform:!0}),s={x:e.left-r.left,y:e.top-r.top,scaleX:e.width/r.width,scaleY:e.height/r.height};(s.x||s.y)&&a(s)}}s!==l.current&&(l.current=s)},[r,s,i,n]),(0,W.useEffect)(()=>{o&&a(null)},[o]),o}({disabled:!ee,index:k,node:M,rect:R});return(0,W.useEffect)(()=>{U&&Z.current.newIndex!==G&&(Z.current.newIndex=G),g!==Z.current.containerId&&(Z.current.containerId=g),m!==Z.current.items&&(Z.current.items=m)},[U,G,g,m]),(0,W.useEffect)(()=>{if(J===Z.current.activeId)return;if(null!=J&&null==Z.current.activeId){Z.current.activeId=J;return}let e=setTimeout(()=>{Z.current.activeId=J},50);return()=>clearTimeout(e)},[J]),{active:P,activeIndex:v,attributes:A,data:j,rect:R,index:k,newIndex:G,items:m,isOver:D,isSorting:U,isDragging:z,listeners:I,node:M,overIndex:b,over:F,setNodeRef:K,setActivatorNodeRef:H,setDroppableNodeRef:T,setDraggableNodeRef:O,transform:null!=et?et:X,transition:et||Q&&Z.current.newIndex===k?m$:(!V||pv(L))&&p&&(U||ee)?p_.Transition.toString({...p,property:mH}):void 0}}({id:e.id}),b={transform:p_.Translate.toString(x),transition:_,zIndex:y?50:void 0,position:y?"relative":void 0,opacity:y?1:void 0},{logs:w,status:S,exitCode:C,isPty:k,sendInput:j,sendResize:N}=f8(u,r);(0,W.useEffect)(()=>{f(e.currentProcessId),e.currentProcessId&&(p.current=!1)},[e.currentProcessId]),(0,W.useEffect)(()=>{"closed"!==S||null===C||p.current||(p.current=!0,c(u))},[S,C,u,c]);let R=async()=>{console.log(`[ExecutorItem] Starting executor ${e.id}`),p.current=!1;let r=await n();console.log(`[ExecutorItem] Got processId: ${r}`),r&&(f(r),i(!0))},M=async()=>{await o(u||void 0)},D=e.isRunning;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(a6,{open:s,onOpenChange:i,children:(0,F.jsxs)("div",{ref:v,style:b,className:(0,iu.cn)("border rounded-lg",y&&"shadow-lg bg-background"),children:[(0,F.jsx)(a8,{asChild:!0,children:(0,F.jsxs)("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-muted/50",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...m,...g,onClick:e=>e.stopPropagation(),children:(0,F.jsx)(lh,{className:"h-4 w-4"})}),s?(0,F.jsx)(aT,{className:"h-4 w-4"}):(0,F.jsx)(id,{className:"h-4 w-4"}),(0,F.jsx)("span",{className:"font-medium",children:e.name}),(0,F.jsx)(ll,{variant:D?"default":"secondary",className:(0,iu.cn)(D&&"bg-green-600 hover:bg-green-600"),children:D?"Running":null!==C?0===C?"Completed":"Failed":"Stopped"})]}),(0,F.jsxs)("div",{className:"flex items-center gap-2",onClick:e=>e.stopPropagation(),children:[D?(0,F.jsxs)($.Button,{size:"sm",variant:"destructive",onClick:M,children:[(0,F.jsx)(lc,{className:"h-3 w-3 mr-1"}),"Stop"]}):(0,F.jsxs)($.Button,{size:"sm",onClick:R,children:[(0,F.jsx)(iC,{className:"h-3 w-3 mr-1"}),"Start"]}),(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)($.Button,{size:"icon",variant:"ghost",className:"h-8 w-8",children:(0,F.jsx)(ld,{className:"h-4 w-4"})})}),(0,F.jsxs)(ig,{align:"end",children:[(0,F.jsxs)(iv,{onClick:()=>h(!0),children:[(0,F.jsx)(oL,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,F.jsxs)(iv,{onClick:l,className:"text-destructive",children:[(0,F.jsx)(nz,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]})}),(0,F.jsx)(a7,{children:(0,F.jsxs)("div",{className:"px-3 pb-3",children:[(0,F.jsx)("div",{className:"text-xs text-muted-foreground mb-2 font-mono",children:"prompt"===e.executor_type?`${e.prompt_provider??"claude"} → ${e.command}`:`$ ${e.command}`}),(0,F.jsx)(f5,{logs:w,isPty:k,onInput:j,onResize:N})]})})]})}),(0,F.jsx)(f6,{open:d,onOpenChange:h,executor:e,onSubmit:async e=>{await a(e)}})]})}let mG=e=>{let{droppableContainers:r,pointerCoordinates:s}=e;if(!s)return(e=>{let{collisionRect:r,droppableRects:s,droppableContainers:i}=e,n=pA(r,r.left,r.top),o=[];for(let e of i){let{id:r}=e,i=s.get(r);if(i){let s=pD(pA(i),n);o.push({id:r,data:{droppableContainer:e,value:s}})}}return o.sort(pT)})(e);let i=[];for(let e of r){let r=e.rect.current;if(!r)continue;let n=r.top,o=r.top+52;s.x>=r.left&&s.x<=r.right&&s.y>=n&&s.y<=o&&i.push({id:e.id,data:{droppableContainer:e}})}if(i.length>0)return i;let n=null;for(let e of r){let r=e.rect.current;if(!r)continue;let i=r.top+26,o=r.left+r.width/2,a=Math.sqrt(Math.pow(s.x-o,2)+Math.pow(s.y-i,2));(!n||a<n.distance)&&(n={id:e.id,distance:a,data:{droppableContainer:e}})}return n?[{id:n.id,data:n.data}]:[]};function mJ({projectId:e,selectedBranch:r,project:s,onExecutorModeChange:i}){let[n,o]=(0,W.useState)(!1),[a,l]=(0,W.useState)(new Set),{remotes:c}=iM(s?.id??void 0),d=[];for(let e of(s?.path&&d.push({id:"local",label:"Local",icon:nO.Monitor}),c))d.push({id:e.remote_server_id,label:e.server_name,icon:nI});let{activeGroup:h,loading:u,createGroup:f}=function(e,r){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)(null),[a,l]=(0,W.useState)(!0),c=r??"",d=(0,W.useCallback)(async()=>{if(!e){i([]),o(null),l(!1);return}try{let[r,s]=await Promise.all([iR.api.getExecutorGroups(e),iR.api.getExecutorGroupByBranch(e,c)]);i(r),o(s)}catch(e){console.error("Failed to fetch executor groups:",e)}finally{l(!1)}},[e,c]);(0,W.useEffect)(()=>{l(!0),d()},[d]);let h=(0,W.useCallback)(async r=>{if(!e)return null;try{let s=await iR.api.createExecutorGroup(e,{name:r,branch:c});return i(e=>[...e,s]),o(s),s}catch(e){return console.error("Failed to create executor group:",e),null}},[e,c]);return{groups:s,activeGroup:n,loading:a,createGroup:h,updateGroup:(0,W.useCallback)(async(e,r)=>{try{let s=await iR.api.updateExecutorGroup(e,r);return i(r=>r.map(r=>r.id===e?s:r)),o(r=>r?.id===e?s:r),s}catch(e){return console.error("Failed to update executor group:",e),null}},[]),deleteGroup:(0,W.useCallback)(async e=>{try{await iR.api.deleteExecutorGroup(e),i(r=>r.filter(r=>r.id!==e)),o(r=>r?.id===e?null:r)}catch(e){console.error("Failed to delete executor group:",e)}},[]),refetch:d}}(e,r),{executors:p,loading:m,createExecutor:g,updateExecutor:v,deleteExecutor:x,startExecutor:_,stopExecutor:y,markProcessFinished:b,reorderExecutors:w}=function(e,r,s){let[i,n]=(0,W.useState)([]),[o,a]=(0,W.useState)(new Map),[l,c]=(0,W.useState)(!0),d=(0,W.useCallback)(async()=>{if(!e||!r){n([]),c(!1);return}try{let s=await iR.api.getExecutors(e,r);n(s)}catch(e){console.error("Failed to fetch executors:",e)}finally{c(!1)}},[e,r]),h=(0,W.useCallback)(async()=>{try{let e=await iR.api.getRunningProcesses(),r=new Map;for(let s of e){let e={processId:s.id,target:s.target??"local"},i=r.get(s.executor_id);i?i.push(e):r.set(s.executor_id,[e])}a(r)}catch(e){console.error("Failed to fetch running processes:",e)}},[]);(0,W.useEffect)(()=>{d(),h()},[d,h]),(0,W.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&h()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[h]);let u=(0,W.useRef)(new Set);(0,W.useEffect)(()=>{u.current=new Set(i.map(e=>e.id))},[i]),(0,W.useEffect)(()=>{if(!e)return;let r=new EventSource(`${"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}/api/events`);return r.onmessage=r=>{try{let s=JSON.parse(r.data);if(s.projectId!==e||!u.current.has(s.executorId))return;"executor:started"===s.type?a(e=>{let r=e.get(s.executorId)??[];if(r.some(e=>e.processId===s.processId))return e;let i=new Map(e);return i.set(s.executorId,[...r,{processId:s.processId,target:s.target??"local"}]),i}):"executor:stopped"===s.type&&a(e=>{let r=e.get(s.executorId);if(!r)return e;let i=r.filter(e=>e.processId!==s.processId),n=new Map(e);return 0===i.length?n.delete(s.executorId):n.set(s.executorId,i),n})}catch{}},()=>{r.close()}},[e]);let f=(0,W.useCallback)(async s=>{if(!e||!r)return null;try{let i=await iR.api.createExecutor(e,{...s,group_id:r});return n(e=>[...e,i]),i}catch(e){return console.error("Failed to create executor:",e),null}},[e,r]),p=(0,W.useCallback)(async(e,r)=>{try{let s=await iR.api.updateExecutor(e,r);return n(r=>r.map(r=>r.id===e?s:r)),s}catch(e){return console.error("Failed to update executor:",e),null}},[]),m=(0,W.useCallback)(async e=>{try{await iR.api.deleteExecutor(e),n(r=>r.filter(r=>r.id!==e))}catch(e){console.error("Failed to delete executor:",e)}},[]),g=(0,W.useCallback)(async(e,r)=>{try{let i=await iR.api.startExecutor(e,r,s);return a(r=>{let n=r.get(e)??[],o=new Map(r);return o.set(e,[...n,{processId:i,target:s??"local"}]),o}),i}catch(e){return console.error("Failed to start executor:",e),null}},[s]),v=(0,W.useCallback)(async(e,r)=>{let i=o.get(e),n=i?.find(e=>e.target===(s??"local")),l=r||n?.processId;if(l){try{await iR.api.stopProcess(l)}catch(e){console.error("Failed to stop executor:",e)}a(r=>{let s=r.get(e);if(!s)return r;let i=s.filter(e=>e.processId!==l),n=new Map(r);return 0===i.length?n.delete(e):n.set(e,i),n})}},[o,s]),x=(0,W.useCallback)((e,r)=>{a(s=>{let i=s.get(e);if(!i)return s;if(r){let n=i.filter(e=>e.processId!==r);if(n.length===i.length)return s;let o=new Map(s);return 0===n.length?o.delete(e):o.set(e,n),o}let n=new Map(s);return n.delete(e),n})},[]),_=(0,W.useCallback)(async s=>{if(e&&r){n(s.map(e=>i.find(r=>r.id===e)).filter(e=>void 0!==e));try{await iR.api.reorderExecutors(e,s,r)}catch(e){console.error("Failed to reorder executors:",e),n(i)}}},[e,r,i]);return{executors:i.map(e=>{let r=o.get(e.id),i=s??"local",n=r?.find(e=>e.target===i);return{...e,currentProcessId:n?.processId??null,isRunning:!!n}}),loading:l,createExecutor:f,updateExecutor:p,deleteExecutor:m,startExecutor:g,stopExecutor:v,markProcessFinished:x,reorderExecutors:_,refetch:d}}(e,h?.id,s?.executor_mode),S=function(){for(var e=arguments.length,r=Array(e),s=0;s<e;s++)r[s]=arguments[s];return(0,W.useMemo)(()=>[...r].filter(e=>null!=e),[...r])}(pR(mr,{activationConstraint:{distance:8}}),pR(p8,{coordinateGetter:mV}));return e?(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/60 h-10",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsxs)("h2",{className:"text-xs font-semibold flex items-center gap-2 text-foreground",children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5"}),h?h.name:"Executors"]}),d.length>1&&i&&(0,F.jsx)(nL,{targets:d,activeTarget:s?.executor_mode??"local",onTargetChange:i})]}),h&&(0,F.jsxs)($.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>o(!0),children:[(0,F.jsx)(nT,{className:"h-3 w-3 mr-1"}),"Add"]})]}),(0,F.jsx)(oh,{className:"flex-1 overflow-hidden",children:(0,F.jsx)("div",{className:"p-4 space-y-3",children:u||m?(0,F.jsx)("div",{className:"text-center text-muted-foreground py-8",children:"Loading executors..."}):h?0===p.length?(0,F.jsxs)("div",{className:"text-center text-muted-foreground py-8",children:[(0,F.jsx)("p",{children:"No executors configured"}),(0,F.jsx)("p",{className:"text-sm mt-1",children:'Add an executor to run commands like "npm run dev"'})]}):(0,F.jsx)(mk,{sensors:S,collisionDetection:mG,onDragEnd:e=>{let{active:r,over:s}=e;if(s&&r.id!==s.id){let e=p.findIndex(e=>e.id===r.id),i=p.findIndex(e=>e.id===s.id),n=[...p],[o]=n.splice(e,1);n.splice(i,0,o),w(n.map(e=>e.id))}},children:(0,F.jsx)(mI,{items:p.map(e=>e.id),strategy:mB,children:p.map(e=>(0,F.jsx)(mX,{executor:e,executorMode:s?.executor_mode??"local",isOpen:a.has(e.id),onOpenChange:r=>l(s=>{let i=new Set(s);return r?i.add(e.id):i.delete(e.id),i}),onStart:()=>_(e.id,r),onStop:r=>y(e.id,r||e.currentProcessId||void 0),onUpdate:r=>v(e.id,r),onDelete:()=>x(e.id),onProcessFinished:r=>b(e.id,r)},`${e.id}-${s?.executor_mode??"local"}`))})}):(0,F.jsxs)("div",{className:"text-center text-muted-foreground py-8",children:[(0,F.jsx)("p",{children:"No executor group for this branch"}),(0,F.jsx)("p",{className:"text-sm mt-1 mb-4",children:"Create a group to start adding executors"}),(0,F.jsxs)($.Button,{size:"sm",onClick:()=>f(r?`Executors (${r})`:"Default"),children:[(0,F.jsx)(aV,{className:"h-4 w-4 mr-1"}),"Create Group"]})]})})}),(0,F.jsx)(f6,{open:n,onOpenChange:o,onSubmit:async e=>{await g(e)}})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nB.Terminal,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to manage executors"})]})})}let mZ=(0,ic.default)("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"}]]),mQ=(0,ic.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]),m0=(0,ic.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);function m1({line:e}){let r="add"===e.type?"+":"delete"===e.type?"-":" ";return(0,F.jsxs)("div",{className:(0,iu.cn)("flex font-mono text-sm","add"===e.type&&"bg-green-500/30","delete"===e.type&&"bg-red-500/30"),children:[(0,F.jsx)("span",{className:"w-12 flex-shrink-0 text-right pr-2 text-muted-foreground select-none border-r border-border",children:e.oldLineNo??""}),(0,F.jsx)("span",{className:"w-12 flex-shrink-0 text-right pr-2 text-muted-foreground select-none border-r border-border",children:e.newLineNo??""}),(0,F.jsx)("span",{className:"w-6 flex-shrink-0 text-center select-none",children:r}),(0,F.jsx)("span",{className:"whitespace-pre-wrap break-all pr-4 flex-1 min-w-0",children:e.content})]})}let m2={modified:"bg-yellow-500/20 text-yellow-500",added:"bg-green-500/20 text-green-500",deleted:"bg-red-500/20 text-red-500",renamed:"bg-blue-500/20 text-blue-500"},m5={modified:"Modified",added:"Added",deleted:"Deleted",renamed:"Renamed"};function m3({file:e,defaultOpen:r=!0}){let[s,i]=(0,W.useState)(r);return(0,F.jsxs)(a6,{open:s,onOpenChange:i,className:"border rounded-lg overflow-hidden",children:[(0,F.jsxs)(a8,{className:"flex items-center gap-2 px-4 py-2 bg-muted border-b w-full cursor-pointer hover:bg-muted/80 transition-colors",children:[s?(0,F.jsx)(aT,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):(0,F.jsx)(id,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,F.jsx)("span",{className:"font-mono text-sm flex-1 min-w-0 truncate text-left",children:e.oldPath&&"renamed"===e.status?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"text-muted-foreground",children:e.oldPath}),(0,F.jsx)("span",{className:"mx-2",children:"→"}),e.path]}):e.path}),(0,F.jsx)(ll,{variant:"secondary",className:m2[e.status],children:m5[e.status]})]}),(0,F.jsx)(a7,{children:(0,F.jsx)("div",{children:e.hunks.map((e,r)=>(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"px-4 py-1 bg-muted/50 text-muted-foreground text-sm font-mono sticky top-0",children:["@@ -",e.oldStart,",",e.oldLines," +",e.newStart,",",e.newLines," @@"]}),e.lines.map((e,r)=>(0,F.jsx)(m1,{line:e},r))]},r))})})]})}let m4=(0,ic.default)("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"}]]),m6="__head__";function m8({commits:e,selectedCommit:r,onSelectCommit:s,loading:i,disabled:n}){return(0,F.jsxs)(aP,{value:r??m6,onValueChange:e=>{s(e===m6?null:e)},disabled:n||i,children:[(0,F.jsxs)(aB,{size:"sm",className:"w-[200px]",children:[(0,F.jsx)(m4,{className:"h-3.5 w-3.5 shrink-0"}),(0,F.jsx)(aL,{placeholder:"Compare from..."})]}),(0,F.jsxs)(aA,{children:[(0,F.jsx)(aO,{value:m6,children:"HEAD (uncommitted)"}),e.map(e=>(0,F.jsxs)(aO,{value:e.hash,children:[(0,F.jsx)("span",{className:"font-mono text-xs",children:e.shortHash})," ",(0,F.jsx)("span",{className:"truncate",children:e.message.length>40?e.message.slice(0,40)+"...":e.message})]},e.hash))]})]})}function m7({projectId:e,selectedBranch:r,onMergeRequest:s,project:i}){let[n,o]=(0,W.useState)(null),{remotes:a}=iM(i?.id??void 0),l=[];for(let e of(i?.path&&l.push({id:"local",label:"Local",icon:nO.Monitor}),a))l.push({id:e.remote_server_id,label:e.server_name,icon:nI});let c=i?.path?"local":a.length>0?a[0].remote_server_id:"local",[d,h]=(0,W.useState)(c),[u,f]=(0,W.useState)(!0),[p,m]=(0,W.useState)(0),g="local"===d?i?.path?"local":void 0:"remote",{diff:v,loading:x,error:_,refresh:y}=function(e,r,s,i){let[n,o]=(0,W.useState)(null),[a,l]=(0,W.useState)(!1),[c,d]=(0,W.useState)(null),h=(0,W.useCallback)(async()=>{if(!e)return void o(null);l(!0),d(null);try{let n=await iR.api.getDiff(e,r,s,i);o(n)}catch(e){d(e instanceof Error?e.message:"Failed to load diff"),o(null)}finally{l(!1)}},[e,r,s,i]);return{diff:n,loading:a,error:c,refresh:h}}(e,r,n,g),{commits:b,loading:w,refetch:S}=function(e,r,s,i){let[n,o]=(0,W.useState)([]),[a,l]=(0,W.useState)(!1);return{commits:n,loading:a,refetch:(0,W.useCallback)(async()=>{if(!e)return void o([]);l(!0);try{let n=await iR.api.getCommits(e,r,s,i);o(n)}catch{o([])}finally{l(!1)}},[e,r,s,i])}}(e,r,void 0,g);if((0,W.useEffect)(()=>{y()},[y]),(0,W.useEffect)(()=>{S()},[S]),(0,W.useEffect)(()=>{o(null)},[r]),(0,W.useEffect)(()=>{h(c)},[e,c]),!e)return(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(aU,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to view changes"})]})});let C=v?.files.length??0;return(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/60 h-10",children:[(0,F.jsx)("div",{className:"flex items-center gap-4",children:C>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("span",{className:"text-xs text-muted-foreground",children:[C," file",1!==C?"s":""," changed"]}),(0,F.jsxs)($.Button,{size:"sm",variant:"ghost",onClick:()=>{f(e=>!e),m(e=>e+1)},title:u?"Collapse all":"Expand all",children:[(0,F.jsx)(m0,{className:"h-4 w-4 mr-1"}),u?"Collapse all":"Expand all"]})]})}),(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[l.length>1&&(0,F.jsx)(nL,{targets:l,activeTarget:d,onTargetChange:h,disabled:x}),(0,F.jsx)("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Changes since:"}),(0,F.jsx)(m8,{commits:b,selectedCommit:n,onSelectCommit:o,loading:w,disabled:x}),(0,F.jsxs)($.Button,{size:"sm",variant:"outline",onClick:s,disabled:x||0===C,children:[(0,F.jsx)(mQ,{className:"h-4 w-4 mr-1"}),"Merge"]}),(0,F.jsxs)($.Button,{size:"sm",variant:"outline",onClick:y,disabled:x,children:[(0,F.jsx)(mZ,{className:`h-4 w-4 mr-1 ${x?"animate-spin":""}`}),"Refresh"]})]})]}),(0,F.jsx)(oh,{className:"flex-1 overflow-hidden",children:(0,F.jsx)("div",{className:"p-4 space-y-4",children:x&&!v?(0,F.jsx)("div",{className:"text-center text-muted-foreground py-8",children:"Loading changes..."}):_?(0,F.jsx)("div",{className:"text-center text-red-400 py-8",children:_}):0===C?(0,F.jsxs)("div",{className:"text-center text-muted-foreground py-8",children:[(0,F.jsx)("p",{children:n?"No changes since this commit":"No changes"}),n&&(0,F.jsx)("p",{className:"text-sm mt-1",children:"Try selecting an earlier commit"})]}):v?.files.map((e,r)=>(0,F.jsx)(m3,{file:e,defaultOpen:u},`${r}-${p}`))})})]})}function m9({terminalId:e,onExit:r}){let{logs:s,sendInput:i,sendResize:n,exitCode:o}=f8(e);return(0,W.useEffect)(()=>{null!==o&&r(e)},[o,r,e]),(0,F.jsx)(f5,{logs:s,isPty:!0,className:"h-full rounded-none border-0",onInput:i,onResize:n})}function ge({projectId:e,selectedBranch:r,project:s}){let{terminals:i,activeTerminalId:n,createTerminal:o,closeTerminal:a,setActiveTerminal:l,removeTerminal:c}=function(e,r){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e){i([]),o(null);return}iR.api.getTerminals(e,r).then(e=>{i(e),o(e.length>0?e[0].id:null)})},[e,r]);let a=(0,W.useCallback)(async(s,n)=>{if(e)try{let a=await iR.api.createTerminal(e,r,s,n);i(e=>[...e,a]),o(a.id)}catch(e){console.error("[useTerminals] Failed to create terminal:",e)}},[e,r]),l=(0,W.useCallback)(async e=>{await iR.api.closeTerminal(e),i(r=>{let s=r.filter(r=>r.id!==e);return o(r=>r===e?s.length>0?s[s.length-1].id:null:r),s})},[]);return{terminals:s,activeTerminalId:n,createTerminal:a,closeTerminal:l,setActiveTerminal:(0,W.useCallback)(e=>{o(e)},[]),removeTerminal:(0,W.useCallback)(e=>{i(r=>{let s=r.filter(r=>r.id!==e);return o(r=>r===e?s.length>0?s[s.length-1].id:null:r),s})},[])}}(e,r),{remotes:d}=iM(s?.id??void 0),[h,u]=(0,W.useState)(!1),f=(0,W.useRef)(null),p=!!s?.path,m=d.length>0,g=p&&m||d.length>1,v=!p&&m||g&&s?.executor_mode!=="local"?"remote":"local",x=(0,W.useCallback)(()=>{o(v)},[o,v]),_=(0,W.useCallback)((e,r)=>{u(!1),o(e,r)},[o]);(0,W.useEffect)(()=>{if(h)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){f.current&&!f.current.contains(e.target)&&u(!1)}},[h]);let y=(0,W.useCallback)(e=>{c(e)},[c]);return e?(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center h-10 border-b border-border/60 px-2 gap-1 shrink-0 bg-muted/20",children:[(0,F.jsxs)(oh,{className:"flex-1",children:[(0,F.jsx)("div",{className:"flex items-center gap-1",children:i.map(e=>{let r="remote"===e.location||e.id.startsWith("remote-"),s=g?r?nI:nO.Monitor:nB.Terminal;return(0,F.jsxs)("button",{onClick:()=>l(e.id),className:(0,iu.cn)("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs whitespace-nowrap transition-all duration-150",n===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(s,{className:"h-3 w-3"}),e.name,(0,F.jsx)("span",{role:"button",onClick:r=>{r.stopPropagation(),a(e.id)},className:"ml-1 hover:text-destructive",children:(0,F.jsx)(i9,{className:"h-3 w-3"})})]},e.id)})}),(0,F.jsx)(ou,{orientation:"horizontal"})]}),(0,F.jsxs)("div",{className:"relative shrink-0",ref:f,children:[(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:g?()=>u(e=>!e):x,children:(0,F.jsx)(nT,{className:"h-3.5 w-3.5"})}),g&&h&&(0,F.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[160px] rounded-md border bg-popover p-1 shadow-md",children:[p&&(0,F.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>_("local"),children:[(0,F.jsx)(nO.Monitor,{className:"h-3.5 w-3.5"}),"Local Terminal"]}),d.map(e=>(0,F.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground transition-colors",onClick:()=>_("remote",e.remote_server_id),children:[(0,F.jsx)(nI,{className:"h-3.5 w-3.5"}),e.server_name," Terminal"]},e.remote_server_id))]})]})]}),(0,F.jsx)("div",{className:"flex-1 overflow-hidden bg-zinc-950",children:n?(0,F.jsx)(m9,{terminalId:n,onExit:y},n):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsx)(nB.Terminal,{className:"h-10 w-10 text-muted-foreground/70"})})})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nB.Terminal,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to use the terminal"})]})})}let gt=(0,ic.default)("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"}]]);var[gr,gs]=q("Tooltip",[tK]),gi=tK(),gn="TooltipProvider",go="tooltip.open",[ga,gl]=gr(gn),gc=e=>{let{__scopeTooltip:r,delayDuration:s=700,skipDelayDuration:i=300,disableHoverableContent:n=!1,children:o}=e,a=W.useRef(!0),l=W.useRef(!1),c=W.useRef(0);return W.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,F.jsx)(ga,{scope:r,isOpenDelayedRef:a,delayDuration:s,onOpen:W.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:W.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:W.useCallback(e=>{l.current=e},[]),disableHoverableContent:n,children:o})};gc.displayName=gn;var gd="Tooltip",[gh,gu]=gr(gd),gf=e=>{let{__scopeTooltip:r,children:s,open:i,defaultOpen:n,onOpenChange:o,disableHoverableContent:a,delayDuration:l}=e,c=gl(gd,e.__scopeTooltip),d=gi(r),[h,u]=W.useState(null),f=ej(),p=W.useRef(0),m=a??c.disableHoverableContent,g=l??c.delayDuration,v=W.useRef(!1),[x,_]=X({prop:i,defaultProp:n??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(go))):c.onClose(),o?.(e)},caller:gd}),y=W.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),b=W.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,_(!0)},[_]),w=W.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),S=W.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,_(!0),p.current=0},g)},[g,_]);return W.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,F.jsx)(tV,{...d,children:(0,F.jsx)(gh,{scope:r,contentId:f,open:x,stateAttribute:y,trigger:h,onTriggerChange:u,onTriggerEnter:W.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:W.useCallback(()=>{m?w():(window.clearTimeout(p.current),p.current=0)},[w,m]),onOpen:b,onClose:w,disableHoverableContent:m,children:s})})};gf.displayName=gd;var gp="TooltipTrigger",gm=W.forwardRef((e,r)=>{let{__scopeTooltip:s,...i}=e,n=gu(gp,s),o=gl(gp,s),a=gi(s),l=W.useRef(null),c=(0,U.useComposedRefs)(r,l,n.onTriggerChange),d=W.useRef(!1),h=W.useRef(!1),u=W.useCallback(()=>d.current=!1,[]);return W.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),(0,F.jsx)(tX,{asChild:!0,...a,children:(0,F.jsx)(Z.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...i,ref:c,onPointerMove:K(e.onPointerMove,e=>{"touch"!==e.pointerType&&(h.current||o.isPointerInTransitRef.current||(n.onTriggerEnter(),h.current=!0))}),onPointerLeave:K(e.onPointerLeave,()=>{n.onTriggerLeave(),h.current=!1}),onPointerDown:K(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:K(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:K(e.onBlur,n.onClose),onClick:K(e.onClick,n.onClose)})})});gm.displayName=gp;var gg="TooltipPortal",[gv,gx]=gr(gg,{forceMount:void 0}),g_=e=>{let{__scopeTooltip:r,forceMount:s,children:i,container:n}=e,o=gu(gg,r);return(0,F.jsx)(gv,{scope:r,forceMount:s,children:(0,F.jsx)(t8,{present:s||o.open,children:(0,F.jsx)(t6,{asChild:!0,container:n,children:i})})})};g_.displayName=gg;var gy="TooltipContent",gb=W.forwardRef((e,r)=>{let s=gx(gy,e.__scopeTooltip),{forceMount:i=s.forceMount,side:n="top",...o}=e,a=gu(gy,e.__scopeTooltip);return(0,F.jsx)(t8,{present:i||a.open,children:a.disableHoverableContent?(0,F.jsx)(gj,{side:n,...o,ref:r}):(0,F.jsx)(gw,{side:n,...o,ref:r})})}),gw=W.forwardRef((e,r)=>{let s=gu(gy,e.__scopeTooltip),i=gl(gy,e.__scopeTooltip),n=W.useRef(null),o=(0,U.useComposedRefs)(r,n),[a,l]=W.useState(null),{trigger:c,onClose:d}=s,h=n.current,{onPointerInTransitChange:u}=i,f=W.useCallback(()=>{l(null),u(!1)},[u]),p=W.useCallback((e,r)=>{let s,i=e.currentTarget,n={x:e.clientX,y:e.clientY},o=function(e,r){let s=Math.abs(r.top-e.y),i=Math.abs(r.bottom-e.y),n=Math.abs(r.right-e.x),o=Math.abs(r.left-e.x);switch(Math.min(s,i,n,o)){case o:return"left";case n:return"right";case s:return"top";case i:return"bottom";default:throw Error("unreachable")}}(n,i.getBoundingClientRect());l(((s=[...function(e,r,s=5){let i=[];switch(r){case"top":i.push({x:e.x-s,y:e.y+s},{x:e.x+s,y:e.y+s});break;case"bottom":i.push({x:e.x-s,y:e.y-s},{x:e.x+s,y:e.y-s});break;case"left":i.push({x:e.x+s,y:e.y-s},{x:e.x+s,y:e.y+s});break;case"right":i.push({x:e.x-s,y:e.y-s},{x:e.x-s,y:e.y+s})}return i}(n,o),...function(e){let{top:r,right:s,bottom:i,left:n}=e;return[{x:n,y:r},{x:s,y:r},{x:s,y:i},{x:n,y:i}]}(r.getBoundingClientRect())].slice()).sort((e,r)=>e.x<r.x?-1:e.x>r.x?1:e.y<r.y?-1:1*!!(e.y>r.y)),function(e){if(e.length<=1)return e.slice();let r=[];for(let s=0;s<e.length;s++){let i=e[s];for(;r.length>=2;){let e=r[r.length-1],s=r[r.length-2];if((e.x-s.x)*(i.y-s.y)>=(e.y-s.y)*(i.x-s.x))r.pop();else break}r.push(i)}r.pop();let s=[];for(let r=e.length-1;r>=0;r--){let i=e[r];for(;s.length>=2;){let e=s[s.length-1],r=s[s.length-2];if((e.x-r.x)*(i.y-r.y)>=(e.y-r.y)*(i.x-r.x))s.pop();else break}s.push(i)}return(s.pop(),1===r.length&&1===s.length&&r[0].x===s[0].x&&r[0].y===s[0].y)?r:r.concat(s)}(s))),u(!0)},[u]);return W.useEffect(()=>()=>f(),[f]),W.useEffect(()=>{if(c&&h){let e=e=>p(e,h),r=e=>p(e,c);return c.addEventListener("pointerleave",e),h.addEventListener("pointerleave",r),()=>{c.removeEventListener("pointerleave",e),h.removeEventListener("pointerleave",r)}}},[c,h,p,f]),W.useEffect(()=>{if(a){let e=e=>{let r=e.target,s={x:e.clientX,y:e.clientY},i=c?.contains(r)||h?.contains(r),n=!function(e,r){let{x:s,y:i}=e,n=!1;for(let e=0,o=r.length-1;e<r.length;o=e++){let a=r[e],l=r[o],c=a.x,d=a.y,h=l.x,u=l.y;d>i!=u>i&&s<(h-c)*(i-d)/(u-d)+c&&(n=!n)}return n}(s,a);i?f():n&&(f(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,h,a,d,f]),(0,F.jsx)(gj,{...e,ref:o})}),[gS,gC]=gr(gd,{isInside:!1}),gk=(0,J.createSlottable)("TooltipContent"),gj=W.forwardRef((e,r)=>{let{__scopeTooltip:s,children:i,"aria-label":n,onEscapeKeyDown:o,onPointerDownOutside:a,...l}=e,c=gu(gy,s),d=gi(s),{onClose:h}=c;return W.useEffect(()=>(document.addEventListener(go,h),()=>document.removeEventListener(go,h)),[h]),W.useEffect(()=>{if(c.trigger){let e=e=>{let r=e.target;r?.contains(c.trigger)&&h()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[c.trigger,h]),(0,F.jsx)(ec,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:e=>e.preventDefault(),onDismiss:h,children:(0,F.jsxs)(tQ,{"data-state":c.stateAttribute,...d,...l,ref:r,style:{...l.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,F.jsx)(gk,{children:i}),(0,F.jsx)(gS,{scope:s,isInside:!0,children:(0,F.jsx)(oW,{id:c.contentId,role:"tooltip",children:n||i})})]})})});gb.displayName=gy;var gN="TooltipArrow",gE=W.forwardRef((e,r)=>{let{__scopeTooltip:s,...i}=e,n=gi(s);return gC(gN,s).isInside?null:(0,F.jsx)(t2,{...n,...i,ref:r})});gE.displayName=gN,e.s(["Arrow",()=>gE,"Content",()=>gb,"Portal",()=>g_,"Provider",()=>gc,"Root",()=>gf,"Tooltip",()=>gf,"TooltipArrow",()=>gE,"TooltipContent",()=>gb,"TooltipPortal",()=>g_,"TooltipProvider",()=>gc,"TooltipTrigger",()=>gm,"Trigger",()=>gm,"createTooltipScope",()=>gs],517964);var gR=e.i(517964),gR=gR;function gM({delayDuration:e=0,...r}){return(0,F.jsx)(gR.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...r})}function gD({...e}){return(0,F.jsx)(gR.Root,{"data-slot":"tooltip",...e})}function gT({...e}){return(0,F.jsx)(gR.Trigger,{"data-slot":"tooltip-trigger",...e})}function gP({className:e,sideOffset:r=0,children:s,...i}){return(0,F.jsx)(gR.Portal,{children:(0,F.jsxs)(gR.Content,{"data-slot":"tooltip-content",sideOffset:r,className:(0,iu.cn)("bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...i,children:[s,(0,F.jsx)(gR.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}let gL=(0,W.createContext)(null),gB=({className:e,children:r,defaultUrl:s="",onUrlChange:i,...n})=>{let[o,a]=(0,W.useState)(s),[l,c]=(0,W.useState)(!1);return(0,F.jsx)(gL.Provider,{value:{url:o,setUrl:e=>{a(e),i?.(e)},consoleOpen:l,setConsoleOpen:c},children:(0,F.jsx)("div",{className:(0,iu.cn)("flex size-full flex-col bg-card",e),...n,children:r})})},gA=({className:e,children:r,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("flex items-center gap-1 border-b p-2 h-14",e),...s,children:r}),gO=({onClick:e,disabled:r,tooltip:s,children:i,...n})=>(0,F.jsx)(gM,{children:(0,F.jsxs)(gD,{children:[(0,F.jsx)(gT,{asChild:!0,children:(0,F.jsx)($.Button,{className:"h-8 w-8 p-0 hover:text-foreground",disabled:r,onClick:e,size:"sm",variant:"ghost",...n,children:i})}),(0,F.jsx)(gP,{children:(0,F.jsx)("p",{children:s})})]})}),gI=({value:e,onChange:r,onKeyDown:s,...i})=>{let{url:n,setUrl:o}=(()=>{let e=(0,W.useContext)(gL);if(!e)throw Error("WebPreview components must be used within a WebPreview");return e})(),[a,l]=(0,W.useState)(n);return(0,W.useEffect)(()=>{l(n)},[n]),(0,F.jsx)(nM,{className:"h-8 flex-1 text-sm",onChange:r??(e=>{l(e.target.value),r?.(e)}),onKeyDown:e=>{"Enter"===e.key&&o(e.target.value),s?.(e)},placeholder:"Enter URL...",value:e??a,...i})};var gz=e.i(254824);function gF({projectId:e}){let r=(0,W.useRef)(null),s=(0,W.useRef)(null),{addFrame:i,updateFrameUrl:n,refreshFrame:o,hasFrame:a,claimFrame:l,getFrameUrl:c}=(0,gz.useBrowserFrames)(),d=e?c(e):void 0;(0,W.useEffect)(()=>{if(e&&d&&r.current){let i=setTimeout(()=>{r.current&&(s.current?.(),s.current=l(e,r.current))},50);return()=>{clearTimeout(i),s.current?.(),s.current=null}}return()=>{s.current?.(),s.current=null}},[e,d,l]);let h=(0,W.useCallback)(()=>{e&&o(e)},[e,o]),u=(0,W.useCallback)(()=>{d&&window.open(d,"_blank")},[d]),f=(0,W.useCallback)(r=>{e&&(a(e)?n(e,r):i(e,r))},[e,a,n,i]);return(0,F.jsx)("div",{className:"h-full flex flex-col",children:(0,F.jsxs)(gB,{defaultUrl:d??"",onUrlChange:f,className:"h-full",children:[(0,F.jsxs)(gA,{className:"h-10 p-1.5 gap-0.5",children:[(0,F.jsx)(gO,{tooltip:"Refresh",onClick:h,disabled:!d,children:(0,F.jsx)(mZ,{className:"h-3.5 w-3.5"})}),(0,F.jsx)(gO,{tooltip:"Open in browser",onClick:u,disabled:!d,children:(0,F.jsx)(gt,{className:"h-3.5 w-3.5"})}),(0,F.jsx)(gI,{className:"h-7 text-xs"})]}),d?(0,F.jsx)("div",{ref:r,className:"flex-1 bg-white"}):(0,F.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,F.jsx)(ib,{className:"h-8 w-8 opacity-40"}),(0,F.jsx)("p",{className:"text-sm",children:"Enter a URL above to preview"})]})})]})})}function gW({projectId:e,selectedBranch:r,onMergeRequest:s,project:i,onExecutorModeChange:n,agentSlot:o}){let[a,l]=function(e,r){let s=`vibedeckx:activeTab:${e??"none"}:${r??"main"}`,[i,n]=(0,W.useState)(()=>localStorage.getItem(s)??"agent");return(0,W.useEffect)(()=>{n(localStorage.getItem(s)??"agent")},[s]),[i,(0,W.useCallback)(e=>{n(e),localStorage.setItem(s,e)},[s])]}(e,r);return(0,F.jsxs)("div",{className:"h-full flex flex-col",children:[(0,F.jsxs)("div",{className:"flex items-center border-b border-border/60 h-10 px-2 gap-0.5 bg-muted/30",children:[(0,F.jsxs)("button",{onClick:()=>l("agent"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","agent"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(nA,{className:"h-3.5 w-3.5"}),"Agent"]}),(0,F.jsxs)("button",{onClick:()=>l("executors"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","executors"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5"}),"Executors"]}),(0,F.jsxs)("button",{onClick:()=>l("diff"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","diff"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(aU,{className:"h-3.5 w-3.5"}),"Diff"]}),(0,F.jsxs)("button",{onClick:()=>l("terminal"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","terminal"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(aq,{className:"h-3.5 w-3.5"}),"Terminal"]}),(0,F.jsxs)("button",{onClick:()=>l("preview"),className:(0,iu.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all duration-150","preview"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-background/50"),children:[(0,F.jsx)(ib,{className:"h-3.5 w-3.5"}),"Preview"]})]}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","agent"!==a&&"hidden"),children:o}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","executors"!==a&&"hidden"),children:(0,F.jsx)(mJ,{projectId:e,selectedBranch:r,project:i,onExecutorModeChange:n})}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","diff"!==a&&"hidden"),children:(0,F.jsx)(m7,{projectId:e,selectedBranch:r,onMergeRequest:s,project:i})}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","terminal"!==a&&"hidden"),children:(0,F.jsx)(ge,{projectId:e,selectedBranch:r,project:i})}),(0,F.jsx)("div",{className:(0,iu.cn)("flex-1 overflow-hidden","preview"!==a&&"hidden"),children:(0,F.jsx)(gF,{projectId:e,selectedBranch:r,project:i})})]})}var gH=Symbol.for("immer-nothing"),g$=Symbol.for("immer-draftable"),gK=Symbol.for("immer-state");function gU(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var gq=Object.getPrototypeOf;function gV(e){return!!e&&!!e[gK]}function gY(e){return!!e&&(gJ(e)||Array.isArray(e)||!!e[g$]||!!e.constructor?.[g$]||g2(e)||g5(e))}var gX=Object.prototype.constructor.toString(),gG=new WeakMap;function gJ(e){if(!e||"object"!=typeof e)return!1;let r=Object.getPrototypeOf(e);if(null===r||r===Object.prototype)return!0;let s=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;if(s===Object)return!0;if("function"!=typeof s)return!1;let i=gG.get(s);return void 0===i&&(i=Function.toString.call(s),gG.set(s,i)),i===gX}function gZ(e,r,s=!0){0===gQ(e)?(s?Reflect.ownKeys(e):Object.keys(e)).forEach(s=>{r(s,e[s],e)}):e.forEach((s,i)=>r(i,s,e))}function gQ(e){let r=e[gK];return r?r.type_:Array.isArray(e)?1:g2(e)?2:3*!!g5(e)}function g0(e,r){return 2===gQ(e)?e.has(r):Object.prototype.hasOwnProperty.call(e,r)}function g1(e,r,s){let i=gQ(e);2===i?e.set(r,s):3===i?e.add(s):e[r]=s}function g2(e){return e instanceof Map}function g5(e){return e instanceof Set}function g3(e){return e.copy_||e.base_}function g4(e,r){if(g2(e))return new Map(e);if(g5(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let s=gJ(e);if(!0!==r&&("class_only"!==r||s)){let r=gq(e);return null!==r&&s?{...e}:Object.assign(Object.create(r),e)}{let r=Object.getOwnPropertyDescriptors(e);delete r[gK];let s=Reflect.ownKeys(r);for(let i=0;i<s.length;i++){let n=s[i],o=r[n];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[n]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[n]})}return Object.create(gq(e),r)}}function g6(e,r=!1){return g7(e)||gV(e)||!gY(e)||(gQ(e)>1&&Object.defineProperties(e,{set:g8,add:g8,clear:g8,delete:g8}),Object.freeze(e),r&&Object.values(e).forEach(e=>g6(e,!0))),e}var g8={value:function(){gU(2)}};function g7(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var g9={};function ve(e){let r=g9[e];return r||gU(0,e),r}function vt(e,r){r&&(ve("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=r)}function vr(e){vs(e),e.drafts_.forEach(vn),e.drafts_=null}function vs(e){e===I&&(I=e.parent_)}function vi(e){return I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vn(e){let r=e[gK];0===r.type_||1===r.type_?r.revoke_():r.revoked_=!0}function vo(e,r){r.unfinalizedDrafts_=r.drafts_.length;let s=r.drafts_[0];return void 0!==e&&e!==s?(s[gK].modified_&&(vr(r),gU(4)),gY(e)&&(e=va(r,e),r.parent_||vc(r,e)),r.patches_&&ve("Patches").generateReplacementPatches_(s[gK].base_,e,r.patches_,r.inversePatches_)):e=va(r,s,[]),vr(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==gH?e:void 0}function va(e,r,s){if(g7(r))return r;let i=e.immer_.shouldUseStrictIteration(),n=r[gK];if(!n)return gZ(r,(i,o)=>vl(e,n,r,i,o,s),i),r;if(n.scope_!==e)return r;if(!n.modified_)return vc(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;let r=n.copy_,o=r,a=!1;3===n.type_&&(o=new Set(r),r.clear(),a=!0),gZ(o,(i,o)=>vl(e,n,r,i,o,s,a),i),vc(e,r,!1),s&&e.patches_&&ve("Patches").generatePatches_(n,s,e.patches_,e.inversePatches_)}return n.copy_}function vl(e,r,s,i,n,o,a){if(null==n||"object"!=typeof n&&!a)return;let l=g7(n);if(!l||a){if(gV(n)){let a=va(e,n,o&&r&&3!==r.type_&&!g0(r.assigned_,i)?o.concat(i):void 0);if(g1(s,i,a),!gV(a))return;e.canAutoFreeze_=!1}else a&&s.add(n);if(gY(n)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||r&&r.base_&&r.base_[i]===n&&l)return;va(e,n),(!r||!r.scope_.parent_)&&"symbol"!=typeof i&&(g2(s)?s.has(i):Object.prototype.propertyIsEnumerable.call(s,i))&&vc(e,n)}}}function vc(e,r,s=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&g6(r,s)}var vd={get(e,r){if(r===gK)return e;let s=g3(e);if(!g0(s,r)){var i;let n;return i=e,(n=vf(s,r))?"value"in n?n.value:n.get?.call(i.draft_):void 0}let n=s[r];return e.finalized_||!gY(n)?n:n===vu(e.base_,r)?(vm(e),e.copy_[r]=vg(n,e)):n},has:(e,r)=>r in g3(e),ownKeys:e=>Reflect.ownKeys(g3(e)),set(e,r,s){let i=vf(g3(e),r);if(i?.set)return i.set.call(e.draft_,s),!0;if(!e.modified_){let i=vu(g3(e),r),n=i?.[gK];if(n&&n.base_===s)return e.copy_[r]=s,e.assigned_[r]=!1,!0;if((s===i?0!==s||1/s==1/i:s!=s&&i!=i)&&(void 0!==s||g0(e.base_,r)))return!0;vm(e),vp(e)}return!!(e.copy_[r]===s&&(void 0!==s||r in e.copy_)||Number.isNaN(s)&&Number.isNaN(e.copy_[r]))||(e.copy_[r]=s,e.assigned_[r]=!0,!0)},deleteProperty:(e,r)=>(void 0!==vu(e.base_,r)||r in e.base_?(e.assigned_[r]=!1,vm(e),vp(e)):delete e.assigned_[r],e.copy_&&delete e.copy_[r],!0),getOwnPropertyDescriptor(e,r){let s=g3(e),i=Reflect.getOwnPropertyDescriptor(s,r);return i?{writable:!0,configurable:1!==e.type_||"length"!==r,enumerable:i.enumerable,value:s[r]}:i},defineProperty(){gU(11)},getPrototypeOf:e=>gq(e.base_),setPrototypeOf(){gU(12)}},vh={};function vu(e,r){let s=e[gK];return(s?g3(s):e)[r]}function vf(e,r){if(!(r in e))return;let s=gq(e);for(;s;){let e=Object.getOwnPropertyDescriptor(s,r);if(e)return e;s=gq(s)}}function vp(e){!e.modified_&&(e.modified_=!0,e.parent_&&vp(e.parent_))}function vm(e){e.copy_||(e.copy_=g4(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function vg(e,r){let s=g2(e)?ve("MapSet").proxyMap_(e,r):g5(e)?ve("MapSet").proxySet_(e,r):function(e,r){let s=Array.isArray(e),i={type_:+!!s,scope_:r?r.scope_:I,modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},n=i,o=vd;s&&(n=[i],o=vh);let{revoke:a,proxy:l}=Proxy.revocable(n,o);return i.draft_=l,i.revoke_=a,l}(e,r);return(r?r.scope_:I).drafts_.push(s),s}gZ(vd,(e,r)=>{vh[e]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),vh.deleteProperty=function(e,r){return vh.set.call(this,e,r,void 0)},vh.set=function(e,r,s){return vd.set.call(this,e[0],r,s,e[0])};var vv=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,r,s)=>{let i;if("function"==typeof e&&"function"!=typeof r){let s=r;r=e;let i=this;return function(e=s,...n){return i.produce(e,e=>r.call(this,e,...n))}}if("function"!=typeof r&&gU(6),void 0!==s&&"function"!=typeof s&&gU(7),gY(e)){let n=vi(this),o=vg(e,void 0),a=!0;try{i=r(o),a=!1}finally{a?vr(n):vs(n)}return vt(n,s),vo(i,n)}if(e&&"object"==typeof e)gU(1,e);else{if(void 0===(i=r(e))&&(i=e),i===gH&&(i=void 0),this.autoFreeze_&&g6(i,!0),s){let r=[],n=[];ve("Patches").generateReplacementPatches_(e,i,r,n),s(r,n)}return i}},this.produceWithPatches=(e,r)=>{let s,i;return"function"==typeof e?(r,...s)=>this.produceWithPatches(r,r=>e(r,...s)):[this.produce(e,r,(e,r)=>{s=e,i=r}),s,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var r;gY(e)||gU(8),gV(e)&&(gV(r=e)||gU(10,r),e=function e(r){let s;if(!gY(r)||g7(r))return r;let i=r[gK],n=!0;if(i){if(!i.modified_)return i.base_;i.finalized_=!0,s=g4(r,i.scope_.immer_.useStrictShallowCopy_),n=i.scope_.immer_.shouldUseStrictIteration()}else s=g4(r,!0);return gZ(s,(r,i)=>{g1(s,r,e(i))},n),i&&(i.finalized_=!1),s}(r));let s=vi(this),i=vg(e,void 0);return i[gK].isManual_=!0,vs(s),i}finishDraft(e,r){let s=e&&e[gK];s&&s.isManual_||gU(9);let{scope_:i}=s;return vt(i,r),vo(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,r){let s;for(s=r.length-1;s>=0;s--){let i=r[s];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}s>-1&&(r=r.slice(s+1));let i=ve("Patches").applyPatches_;return gV(e)?i(e,r):this.produce(e,e=>i(e,r))}}().produce,vx=e.i(754219);function v_(){return"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}function vy(e){let r={};e&&(r["Content-Type"]=e);let s=(0,iR.getAuthToken)();return s&&(r.Authorization=`Bearer ${s}`),r}async function vb(e,r,s,i){let n=await fetch(`${v_()}/api/projects/${e}/agent-sessions`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({branch:r,permissionMode:s,agentType:i})});if(!n.ok)throw Error("Failed to create session");return n.json()}async function vw(e,r){let s=await fetch(`${v_()}/api/agent-sessions/${e}/message`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({content:r})});if(!s.ok){let r="";try{let e=await s.json();if(e.errorCode){let s=[`${e.errorCode}`];e.attempts&&s.push(`${e.attempts} attempts`),e.totalDurationMs&&s.push(`${(e.totalDurationMs/1e3).toFixed(1)}s`),r=` (${s.join(", ")})`}else e.error&&(r=` — ${e.error}`)}catch{}throw console.error(`[AgentSession] /message failed: status=${s.status}, sessionId=${e}, detail=${r}`),Error(`Failed to send message [${s.status}]${r}`)}}async function vS(e,r){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/restart`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({agentType:r})})).ok)throw Error("Failed to restart session")}async function vC(e){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/stop`,{method:"POST",headers:vy()})).ok)throw Error("Failed to stop session")}async function vk(e,r){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/switch-mode`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({mode:r})})).ok)throw Error("Failed to switch mode")}async function vj(e,r){if(!(await fetch(`${v_()}/api/agent-sessions/${e}/accept-plan`,{method:"POST",headers:vy("application/json"),body:JSON.stringify({planContent:r})})).ok)throw Error("Failed to accept plan")}let vN=new Map;function vE(e,r){return`${e}:${r??""}`}let vR=(0,ic.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),vM=(0,ic.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),vD=(0,ic.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),vT=(0,ic.default)("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"}]]),vP=(0,ic.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),vL=(0,ic.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),vB=(0,ic.default)("file-check",[["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:"m9 15 2 2 4-4",key:"1grp1n"}]]),vA=(0,ic.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),vO=(0,ic.default)("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"}]]),vI=(0,ic.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),vz=(0,ic.default)("folder-search",[["path",{d:"M10.7 20H4a2 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.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]),vF=(0,ic.default)("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"}]]),vW=(0,ic.default)("file-pen-line",[["path",{d:"m18.226 5.226-2.52-2.52A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.351",key:"1k2beg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]),vH=(0,ic.default)("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"}]]),v$=(0,ic.default)("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"}]]),vK=(0,ic.default)("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),vU=(0,ic.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var vq="horizontal",vV=["horizontal","vertical"],vY=W.forwardRef((e,r)=>{var s;let{decorative:i,orientation:n=vq,...o}=e,a=(s=n,vV.includes(s))?n:vq;return(0,F.jsx)(Z.div,{"data-orientation":a,...i?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...o,ref:r})});vY.displayName="Separator",e.s(["Root",()=>vY,"Separator",()=>vY],691102),e.i(691102),(0,lo.cva)("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),(0,ic.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var vX=e.i(94265);let vG=({className:e,from:r,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("group flex w-full max-w-[95%] flex-col gap-2","user"===r?"is-user ml-auto justify-end":"is-assistant",e),...s}),vJ=({children:e,className:r,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",r),...s,children:e}),vZ=(0,W.memo)(({className:e,...r})=>(0,F.jsx)(vX.i,{className:(0,iu.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...r}),(e,r)=>e.children===r.children);function vQ({input:e,messageIndex:r}){let{sendMessage:s,messages:i}=yx(),n=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&Array.isArray(r.questions)&&r.questions.length>0&&r.questions.every(e=>"string"==typeof e.question&&"string"==typeof e.header&&Array.isArray(e.options)))return r}catch{}return null}(e),o=i[r+1],a=o?.type==="user",l=a?o.content:"",c="string"==typeof l?l:l.filter(e=>"text"===e.type).map(e=>e.text).join("\n");if(!n){let r="string"==typeof e?e:JSON.stringify(e,null,2);return(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r.length>500?r.substring(0,500)+"...":r})}return a?(0,F.jsx)(v0,{questions:n.questions,answeredText:c}):(0,F.jsx)(v1,{questions:n.questions,sendMessage:s})}function v0({questions:e,answeredText:r}){return(0,F.jsx)("div",{className:"space-y-3 mt-2",children:e.map((e,s)=>(0,F.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-3",children:[(0,F.jsx)("div",{className:"flex items-center gap-2 mb-1.5",children:(0,F.jsx)(ll,{variant:"secondary",className:"text-[10px]",children:e.header})}),(0,F.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:e.question}),(0,F.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[(0,F.jsx)(ok,{className:"h-4 w-4"}),(0,F.jsx)("span",{className:"font-medium",children:r})]})]},s))})}function v1({questions:e,sendMessage:r}){let[s,i]=(0,W.useState)(new Map),[n,o]=(0,W.useState)(new Map),[a,l]=(0,W.useState)(new Set),[c,d]=(0,W.useState)(!1);async function h(){let i=[];for(let r=0;r<e.length;r++)if(a.has(r)){let e=n.get(r)?.trim();e&&i.push(e)}else{let e=s.get(r);e&&e.size>0&&i.push(Array.from(e).join(", "))}if(i.length>0){d(!0);try{await r(i.join("\n"))}finally{d(!1)}}}let u=e.some((e,r)=>{if(a.has(r))return!!n.get(r)?.trim();let i=s.get(r);return i&&i.size>0});return(0,F.jsxs)("div",{className:"space-y-4 mt-2",children:[e.map((e,r)=>{let c=s.get(r)||new Set,d=n.get(r)||"",h=a.has(r);return(0,F.jsxs)("div",{className:"rounded-lg border bg-card p-3",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,F.jsx)(vL,{className:"h-3.5 w-3.5 text-violet-500"}),(0,F.jsx)(ll,{variant:"secondary",className:"text-[10px]",children:e.header})]}),(0,F.jsx)("p",{className:"text-sm font-medium mb-3",children:e.question}),(0,F.jsxs)("div",{className:"grid gap-2",children:[e.options.map(s=>{let n=c.has(s.label)&&!h;return(0,F.jsx)($.Button,{variant:n?"default":"outline",className:(0,iu.cn)("h-auto py-2 px-3 justify-start text-left whitespace-normal",n&&"ring-2 ring-primary/50"),onClick:()=>{var n,o;return n=s.label,o=e.multiSelect,void(i(e=>{let s=new Map(e),i=new Set(s.get(r)||[]);return o?i.has(n)?i.delete(n):i.add(n):i.has(n)?i.clear():(i.clear(),i.add(n)),s.set(r,i),s}),l(e=>{let s=new Set(e);return s.delete(r),s}))},children:(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:"font-medium text-sm",children:s.label}),s.description&&(0,F.jsx)("span",{className:"block text-xs text-muted-foreground mt-0.5",children:s.description})]})},s.label)}),(0,F.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,F.jsx)(nM,{placeholder:"Other...",value:d,onChange:e=>{var s;return s=e.target.value,void(o(e=>new Map(e).set(r,s)),s&&(i(e=>{let s=new Map(e);return s.set(r,new Set),s}),l(e=>new Set(e).add(r))))},className:"text-sm"})})]})]},r)}),(0,F.jsxs)($.Button,{onClick:h,disabled:!u||c,size:"sm",className:"active:scale-95 transition-transform",children:[c&&(0,F.jsx)(iE,{className:"h-3.5 w-3.5 animate-spin"}),c?"Submitting...":"Submit"]})]})}function v2(e){try{return JSON.parse(e)}catch{return null}}function v5({input:e,messageIndex:r}){let{messages:s,acceptPlan:i,permissionMode:n,agentType:o}=yx(),[a,l]=(0,W.useState)(!0),[c,d]=(0,W.useState)(!1),h=function(e,r,s){let i="string"==typeof e?v2(e):e;if(i&&"object"==typeof i&&"plan"in i){let e=i.plan;if(e)return e}if("claude-code"===s)for(let e=r.length-1;e>=0;e--){let s=r[e];if("tool_use"===s.type&&"Write"===s.tool){let e="string"==typeof s.input?v2(s.input):s.input;if(e&&"object"==typeof e&&e.file_path?.includes(".claude/plans/")&&e.content)return e.content}}return"Plan written to file"}(e,s,o),u=(0,W.useCallback)(async()=>{d(!0);try{await i(h)}catch{d(!1)}},[i,h]),f="edit"===n,p=!1,m="";for(let e=r+1;e<s.length;e++){let r=s[e];if(r?.type==="user"){p=!0;let e=r.content??"";m="string"==typeof e?e:e.filter(e=>"text"===e.type).map(e=>e.text).join("\n");break}}return(f&&!p&&(p=!0),f||p)?(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[f?(0,F.jsxs)(ll,{variant:"default",className:"bg-green-600 hover:bg-green-700 text-white",children:[(0,F.jsx)(ok,{className:"h-3 w-3 mr-1"}),"Plan Accepted"]}):(0,F.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,F.jsx)(f3,{className:"h-3.5 w-3.5"}),(0,F.jsxs)("span",{children:["Feedback sent: ",m.length>100?m.substring(0,100)+"...":m]})]}),(0,F.jsxs)("details",{open:!f,children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"View Plan"}),(0,F.jsx)("div",{className:"mt-2 rounded-lg border p-3 bg-muted/30",children:(0,F.jsx)("div",{className:"text-sm prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words",children:(0,F.jsx)(vZ,{children:h})})})]})]}):(0,F.jsxs)("div",{className:"space-y-3 mt-2",children:[(0,F.jsxs)("div",{className:"rounded-lg border p-3 bg-card",children:[(0,F.jsxs)("button",{onClick:()=>l(!a),className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground mb-2 block",children:[a?"Collapse":"Expand"," Plan"]}),a&&(0,F.jsx)("div",{className:"text-sm prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words max-h-96 overflow-y-auto",children:(0,F.jsx)(vZ,{children:h})})]}),(0,F.jsxs)($.Button,{onClick:u,disabled:c,className:"bg-green-600 hover:bg-green-700 text-white",size:"sm",children:[c?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):(0,F.jsx)(iC,{className:"h-3.5 w-3.5 mr-1.5"}),c?"Accepting Plan...":"Accept Plan & Start Editing"]})]})}function v3({requestId:e,command:r,cwd:s,messageIndex:i}){let{messages:n,sessionId:o}=yx(),[a,l]=(0,W.useState)(!1),[c,d]=(0,W.useState)(null),h=!1;for(let e=i+1;e<n.length;e++)if(n[e]?.type==="user"){h=!0;break}c&&(h=!0);let u=(0,W.useCallback)(async r=>{if(o){l(!0),d(r);try{await (0,iR.sendApprovalResponse)(o,e,r)}catch{d(null),l(!1)}}},[o,e]);return h?(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[(0,F.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-3",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"Command"})]}),(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r||"(empty)"}),s&&(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["cwd: ",s]})]}),(0,F.jsxs)(ll,{variant:"default",className:"decline"===c?"bg-red-600 hover:bg-red-700 text-white":"bg-green-600 hover:bg-green-700 text-white",children:[(0,F.jsx)(ok,{className:"h-3 w-3 mr-1"}),"decline"===c?"Denied":"Allowed"]})]}):(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[(0,F.jsxs)("div",{className:"rounded-lg border bg-card p-3",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,F.jsx)(nB.Terminal,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"Command"})]}),(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r||"(empty)"}),s&&(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["cwd: ",s]})]}),(0,F.jsxs)("div",{className:"flex gap-2",children:[(0,F.jsxs)($.Button,{onClick:()=>u("accept"),disabled:a,className:"bg-green-600 hover:bg-green-700 text-white",size:"sm",children:[a&&"accept"===c?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(ok,{className:"h-3.5 w-3.5 mr-1"}),"Allow"]}),(0,F.jsxs)($.Button,{onClick:()=>u("decline"),disabled:a,variant:"destructive",size:"sm",children:[a&&"decline"===c?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(nc,{className:"h-3.5 w-3.5 mr-1"}),"Deny"]})]})]})}function v4({requestId:e,changes:r,messageIndex:s}){let{messages:i,sessionId:n}=yx(),[o,a]=(0,W.useState)(!1),[l,c]=(0,W.useState)(null),d=!1;for(let e=s+1;e<i.length;e++)if(i[e]?.type==="user"){d=!0;break}l&&(d=!0);let h=(0,W.useCallback)(async r=>{if(n){a(!0),c(r);try{await (0,iR.sendApprovalResponse)(n,e,r)}catch{c(null),a(!1)}}},[n,e]),u=r??[],f=()=>(0,F.jsx)("div",{className:"rounded-lg border bg-muted/30 p-3 space-y-2",children:0===u.length?(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"No file changes"}):u.map((e,r)=>(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(vO,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),(0,F.jsx)("code",{className:"text-xs break-all",children:e.path}),(0,F.jsx)(ll,{variant:"secondary",className:`text-[10px] ${function(e){switch(e){case"added":case"add":return"bg-green-500/10 text-green-600";case"deleted":case"delete":return"bg-red-500/10 text-red-600";default:return"bg-blue-500/10 text-blue-600"}}(e.kind)}`,children:function(e){switch(e){case"added":case"add":return"added";case"deleted":case"delete":return"deleted";default:return"modified"}}(e.kind)})]}),e.diff&&(0,F.jsxs)("details",{className:"mt-1",children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"View diff"}),(0,F.jsx)("pre",{className:"mt-1 text-xs p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.diff.split("\n").map((e,r)=>{let s="";return e.startsWith("+")?s="bg-green-500/10 text-green-700 dark:text-green-400":e.startsWith("-")&&(s="bg-red-500/10 text-red-700 dark:text-red-400"),(0,F.jsx)("div",{className:s,children:e},r)})})]})]},r))});return d?(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[f(),(0,F.jsxs)(ll,{variant:"default",className:"decline"===l?"bg-red-600 hover:bg-red-700 text-white":"bg-green-600 hover:bg-green-700 text-white",children:[(0,F.jsx)(ok,{className:"h-3 w-3 mr-1"}),"decline"===l?"Denied":"Allowed"]})]}):(0,F.jsxs)("div",{className:"space-y-2 mt-2",children:[f(),(0,F.jsxs)("div",{className:"flex gap-2",children:[(0,F.jsxs)($.Button,{onClick:()=>h("accept"),disabled:o,className:"bg-green-600 hover:bg-green-700 text-white",size:"sm",children:[o&&"accept"===l?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(ok,{className:"h-3.5 w-3.5 mr-1"}),"Allow"]}),(0,F.jsxs)($.Button,{onClick:()=>h("decline"),disabled:o,variant:"destructive",size:"sm",children:[o&&"decline"===l?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):(0,F.jsx)(nc,{className:"h-3.5 w-3.5 mr-1"}),"Deny"]})]})]})}vZ.displayName="MessageResponse";let v6=(0,ic.default)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var v8=e.i(252512);let v7=(0,ic.default)("badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);function v9({status:e,className:r}){switch(e){case"completed":return(0,F.jsx)(ok,{className:(0,iu.cn)("h-4 w-4 text-green-500",r)});case"in_progress":return(0,F.jsx)(iE,{className:(0,iu.cn)("h-4 w-4 text-cyan-500 animate-spin",r)});case"pending":default:return(0,F.jsx)(ih,{className:(0,iu.cn)("h-4 w-4 text-muted-foreground",r)});case"deleted":return(0,F.jsx)(nc,{className:(0,iu.cn)("h-4 w-4 text-red-400",r)})}}function xe(e,r){try{let s="string"==typeof e?JSON.parse(e):e;if(s&&"object"==typeof s&&r(s))return s}catch{}return null}function xt({input:e}){let r="string"==typeof e?e:JSON.stringify(e,null,2);return(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r.length>500?r.substring(0,500)+"...":r})}function xr({input:e}){let r=xe(e,e=>Array.isArray(e.todos)&&e.todos.length>0);return r?(0,F.jsx)("div",{className:"mt-2 space-y-1",children:r.todos.map((e,r)=>(0,F.jsxs)("div",{className:"flex items-start gap-2 py-0.5",children:[(0,F.jsx)(v9,{status:e.status,className:"mt-0.5 flex-shrink-0"}),(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:(0,iu.cn)("text-sm break-words","completed"===e.status&&"line-through text-muted-foreground"),children:e.subject??e.content??"Untitled task"}),"in_progress"===e.status&&e.activeForm&&(0,F.jsx)("span",{className:"block text-xs italic text-cyan-500",children:e.activeForm})]})]},e.id??r))}):(0,F.jsx)(xt,{input:e})}function xs({input:e}){let r=xe(e,e=>"string"==typeof e.subject);return r?(0,F.jsxs)("div",{className:"mt-2 flex items-start gap-2",children:[(0,F.jsx)(v6,{className:"h-4 w-4 text-cyan-500 mt-0.5 flex-shrink-0"}),(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-words",children:r.subject}),r.description&&(0,F.jsx)("span",{className:"block text-xs text-muted-foreground mt-0.5 break-words",children:r.description.length>200?r.description.substring(0,200)+"...":r.description})]})]}):(0,F.jsx)(xt,{input:e})}function xi({input:e}){let r=xe(e,e=>"string"==typeof e.taskId);return r?(0,F.jsxs)("div",{className:"mt-2 flex items-start gap-2 flex-wrap",children:[r.status?(0,F.jsx)(v9,{status:r.status,className:"mt-0.5 flex-shrink-0"}):(0,F.jsx)(v8.ArrowRight,{className:"h-4 w-4 text-cyan-500 mt-0.5 flex-shrink-0"}),(0,F.jsxs)("span",{className:"text-sm break-words",children:["Task #",r.taskId,r.status&&(0,F.jsxs)(F.Fragment,{children:[" ",(0,F.jsx)(v8.ArrowRight,{className:"inline h-3 w-3 text-muted-foreground mx-0.5"})," ",r.status]}),r.subject&&(0,F.jsxs)("span",{className:"text-muted-foreground",children:[" — ",r.subject]})]}),r.addBlockedBy&&r.addBlockedBy.length>0&&(0,F.jsx)("div",{className:"flex gap-1 mt-1 w-full pl-6",children:r.addBlockedBy.map(e=>(0,F.jsxs)(ll,{variant:"outline",className:"text-[10px]",children:[(0,F.jsx)(v7,{className:"h-2.5 w-2.5 mr-0.5"}),"blocked by #",e]},e))}),r.addBlocks&&r.addBlocks.length>0&&(0,F.jsx)("div",{className:"flex gap-1 mt-1 w-full pl-6",children:r.addBlocks.map(e=>(0,F.jsxs)(ll,{variant:"outline",className:"text-[10px]",children:[(0,F.jsx)(v7,{className:"h-2.5 w-2.5 mr-0.5"}),"blocks #",e]},e))})]}):(0,F.jsx)(xt,{input:e})}function xn(){return(0,F.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-sm text-muted-foreground",children:[(0,F.jsx)(iE,{className:"h-4 w-4 animate-spin text-cyan-500"}),(0,F.jsx)("span",{children:"Listing tasks..."})]})}function xo({input:e}){let r=xe(e,e=>"string"==typeof e.taskId);return r?(0,F.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-sm text-muted-foreground",children:[(0,F.jsx)(iE,{className:"h-4 w-4 animate-spin text-cyan-500"}),(0,F.jsxs)("span",{children:["Fetching task #",r.taskId,"..."]})]}):(0,F.jsx)(xt,{input:e})}function xa({output:e}){let r=function(e){try{let r=JSON.parse(e);if(Array.isArray(r))return r.filter(e=>e.id&&e.subject).map(e=>({id:String(e.id),subject:String(e.subject),status:e.status||"pending",owner:e.owner?String(e.owner):void 0,blockedBy:Array.isArray(e.blockedBy)?e.blockedBy.map(String):void 0}));let s=r.tasks??r.items??r.data;if(Array.isArray(s))return s.filter(e=>e.id&&e.subject).map(e=>({id:String(e.id),subject:String(e.subject),status:e.status||"pending",owner:e.owner?String(e.owner):void 0,blockedBy:Array.isArray(e.blockedBy)?e.blockedBy.map(String):void 0}))}catch{let r=e.trim().split("\n").filter(Boolean),s=[];for(let e of r){let r=e.match(/^#?(\d+)[\s.:\-]+\[?(completed|in_progress|pending|deleted)\]?\s+(.+)/i);r&&s.push({id:r[1],status:r[2].toLowerCase(),subject:r[3].trim()})}if(s.length>0)return s}return null}(e);return r?(0,F.jsx)("div",{className:"mt-1 space-y-1",children:r.map(e=>(0,F.jsxs)("div",{className:"flex items-start gap-2 py-0.5",children:[(0,F.jsx)(v9,{status:e.status,className:"mt-0.5 flex-shrink-0"}),(0,F.jsxs)("div",{className:"min-w-0 flex items-center gap-1.5 flex-wrap",children:[(0,F.jsxs)("span",{className:"text-xs text-muted-foreground",children:["#",e.id]}),(0,F.jsx)("span",{className:(0,iu.cn)("text-sm break-words","completed"===e.status&&"line-through text-muted-foreground"),children:e.subject}),e.blockedBy&&e.blockedBy.length>0&&(0,F.jsx)(ll,{variant:"outline",className:"text-[10px]",children:"blocked"})]})]},e.id))}):null}function xl({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.file_path)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{file_path:s,offset:i,limit:n}=r,o=s.split("/"),a=o.pop()||s,l=o.join("/"),c=null!=i||null!=n,d="";if(c){let e=i??1;d=null!=n?`Lines ${e}\u2013${e+n-1}`:`From line ${e}`}return(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-all",children:a}),l&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:s,children:l})]}),c&&(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:d})]})}function xc({output:e}){let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["File contents (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xd({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.file_path)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{file_path:s,content:i}=r,n=s.split("/"),o=n.pop()||s,a=n.join("/"),l=i.split("\n").length;return(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-all",children:o}),a&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:s,children:a})]}),(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Content (",l," ",1===l?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:i.length>1e3?i.substring(0,1e3)+"...":i})]})]})}function xh({output:e}){return e&&""!==e.trim()?(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Result"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]}):(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"File written"})}function xu({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.command)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{command:s,description:i,timeout:n}=r;return(0,F.jsxs)("div",{className:"space-y-1",children:[i&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),(0,F.jsxs)("div",{className:"flex items-start gap-2",children:[(0,F.jsxs)("pre",{className:"flex-1 min-w-0 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-muted-foreground select-none",children:"$ "}),s]}),null!=n&&(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0 mt-1",children:function(e){if(e>=6e4){let r=e/6e4;return`${r%1==0?r:r.toFixed(1)}m`}return`${e/1e3}s`}(n)})]})]})}function xf({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Output (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xp({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.pattern)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let s=[];return r.path&&s.push({label:r.path}),r.glob&&s.push({label:r.glob}),r.type&&s.push({label:`.${r.type}`}),r.output_mode&&"files_with_matches"!==r.output_mode&&s.push({label:r.output_mode}),null!=r.context&&s.push({label:`context: ${r.context}`}),null!=r["-C"]&&s.push({label:`context: ${r["-C"]}`}),null!=r["-B"]&&s.push({label:`before: ${r["-B"]}`}),null!=r["-A"]&&s.push({label:`after: ${r["-A"]}`}),r["-i"]&&s.push({label:"case-insensitive"}),r.multiline&&s.push({label:"multiline"}),null!=r.head_limit&&s.push({label:`limit: ${r.head_limit}`}),null!=r.offset&&s.push({label:`offset: ${r.offset}`}),(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("div",{className:"flex items-start gap-2",children:(0,F.jsxs)("pre",{className:"flex-1 min-w-0 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-muted-foreground select-none",children:"/ "}),r.pattern]})}),s.length>0&&(0,F.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:s.map((e,r)=>(0,F.jsx)(ll,{variant:"outline",className:"text-xs",children:e.label},r))})]})}function xm({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No matches"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Results (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xg({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.pattern)return r;return null}catch{return null}}(e);return r?(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("div",{className:"flex items-start gap-2",children:(0,F.jsx)("pre",{className:"flex-1 min-w-0 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:r.pattern})}),r.path&&(0,F.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:(0,F.jsx)(ll,{variant:"outline",className:"text-xs",children:r.path})})]}):(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)})}function xv({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No matches"});let r=e.trim().split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:[r," ",1===r?"file":"files"," found"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}let xx={Explore:"Explore",Bash:"Bash",Plan:"Plan","general-purpose":"General","code-simplifier":"Simplify","superpowers:code-reviewer":"Review","memory-leak-detector":"Memory","directory-structure-validator":"Structure","tech-docs-finder":"Docs","claude-code-guide":"Guide","statusline-setup":"Status"};function x_({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.description&&"string"==typeof r.subagent_type)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{description:s,subagent_type:i,prompt:n,model:o,max_turns:a,resume:l,run_in_background:c}=r,d=[];return d.push({label:xx[i]||i}),o&&d.push({label:o}),null!=a&&d.push({label:`${a} turns`}),c&&d.push({label:"background"}),l&&d.push({label:"resume"}),(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsx)("span",{className:"text-sm",children:s}),d.map((e,r)=>(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:e.label},r))]}),n&&(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Prompt (",n.length>1e3?`${Math.round(n.length/1e3)}k chars`:`${n.length} chars`,")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:n.length>1e3?n.substring(0,1e3)+"...":n})]})]})}function xy({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Agent result (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xb(e,r){return e.length>r?e.substring(0,r)+"...":e}function xw({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.file_path&&"string"==typeof r.old_string&&"string"==typeof r.new_string)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{file_path:s,old_string:i,new_string:n,replace_all:o}=r,a=s.split("/"),l=a.pop()||s,c=a.join("/"),d=i.split("\n").length,h=n.split("\n").length;return(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsxs)("div",{className:"min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-medium break-all",children:l}),c&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:s,children:c})]}),(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:d===h?`${d} ${1===d?"line":"lines"}`:`${d}\u2192${h} lines`}),o&&(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:"replace all"})]}),(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Diff"}),(0,F.jsxs)("div",{className:"mt-1 text-xs rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full",children:[(0,F.jsxs)("pre",{className:"bg-red-500/10 p-1.5 rounded-t whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-red-500 select-none",children:"- "}),xb(i,500)]}),(0,F.jsxs)("pre",{className:"bg-green-500/10 p-1.5 rounded-b whitespace-pre-wrap break-all",children:[(0,F.jsx)("span",{className:"text-green-500 select-none",children:"+ "}),xb(n,500)]})]})]})]})}function xS({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});if(e.length<=200)return(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:e});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Result (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xC({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.url&&"string"==typeof r.prompt)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{display:s,href:i}=function(e){try{let r=new URL(e),s="/"===r.pathname?"":r.pathname,i=r.hostname+s;return{display:i.length>80?i.substring(0,77)+"...":i,href:e}}catch{return{display:e.length>80?e.substring(0,77)+"...":e,href:e}}}(r.url),n=r.prompt.length>150?r.prompt.substring(0,147)+"...":r.prompt;return(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"block text-xs font-mono text-blue-500 hover:underline truncate",children:s}),(0,F.jsxs)("p",{className:"text-xs text-muted-foreground",children:['"',n,'"']})]})}function xk({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No content fetched"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Response (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xj({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.query)return r;return null}catch{return null}}(e);return r?(0,F.jsxs)("div",{className:"space-y-1.5",children:[(0,F.jsx)("p",{className:"text-xs font-mono bg-muted/50 px-2 py-1 rounded break-words",children:r.query}),r.allowed_domains&&r.allowed_domains.length>0&&(0,F.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"only:"}),r.allowed_domains.map(e=>(0,F.jsx)(ll,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:e},e))]}),r.blocked_domains&&r.blocked_domains.length>0&&(0,F.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,F.jsx)("span",{className:"text-xs text-muted-foreground",children:"exclude:"}),r.blocked_domains.map(e=>(0,F.jsx)(ll,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:e},e))]})]}):(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)})}function xN({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No search results"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Results (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xE({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.skill)return r;return null}catch{return null}}(e);return r?(0,F.jsxs)("div",{className:"space-y-1",children:[(0,F.jsx)("p",{className:"text-xs font-mono text-pink-500",children:r.skill}),r.args&&(0,F.jsxs)("p",{className:"text-xs text-muted-foreground truncate",children:["args: ",r.args]})]}):(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)})}function xR({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Loaded (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xM({input:e}){let r=function(e){try{let r="string"==typeof e?JSON.parse(e):e;if(r&&"object"==typeof r&&"string"==typeof r.task_id)return r;return null}catch{return null}}(e);if(!r)return(0,F.jsx)("pre",{className:"text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:"string"==typeof e?e:JSON.stringify(e,null,2)});let{task_id:s,block:i,timeout:n}=r,o=[];return o.push({label:!1===i?"non-blocking":"blocking"}),null!=n&&o.push({label:`${Math.round(n/1e3)}s`}),(0,F.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,F.jsx)("code",{className:"text-sm bg-muted/50 px-1.5 py-0.5 rounded",children:s}),o.map((e,r)=>(0,F.jsx)(ll,{variant:"outline",className:"text-xs shrink-0",children:e.label},r))]})}function xD({output:e}){if(!e||""===e.trim())return(0,F.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No output"});let r=e.split("\n").length;return(0,F.jsxs)("details",{children:[(0,F.jsxs)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:["Task output (",r," ",1===r?"line":"lines",")"]}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.length>1e3?e.substring(0,1e3)+"...":e})]})}function xT({input:e}){let r="string"==typeof e?function(e){try{return JSON.parse(e)}catch{return null}}(e):e,s=r?.changes??[];return 0===s.length?(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"No file changes"}):(0,F.jsx)("div",{className:"space-y-2 mt-1",children:s.map((e,r)=>(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(vO,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),(0,F.jsx)("code",{className:"text-xs break-all",children:e.path}),(0,F.jsx)(ll,{variant:"secondary",className:`text-[10px] ${function(e){switch(e){case"added":case"add":return"bg-green-500/10 text-green-600";case"deleted":case"delete":return"bg-red-500/10 text-red-600";default:return"bg-blue-500/10 text-blue-600"}}(e.kind)}`,children:function(e){switch(e){case"added":case"add":return"added";case"deleted":case"delete":return"deleted";default:return"modified"}}(e.kind)})]}),e.diff&&(0,F.jsxs)("details",{className:"mt-1",children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"View diff"}),(0,F.jsx)("pre",{className:"mt-1 text-xs p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:e.diff.split("\n").map((e,r)=>{let s="";return e.startsWith("+")?s="bg-green-500/10 text-green-700 dark:text-green-400":e.startsWith("-")&&(s="bg-red-500/10 text-red-700 dark:text-red-400"),(0,F.jsx)("div",{className:s,children:e},r)})})]})]},r))})}function xP({output:e}){let r=e.toLowerCase(),s="text-muted-foreground";return r.includes("completed")||r.includes("success")?s="text-green-600 dark:text-green-400":r.includes("failed")||r.includes("error")?s="text-red-600 dark:text-red-400":(r.includes("declined")||r.includes("denied"))&&(s="text-amber-600 dark:text-amber-400"),(0,F.jsx)("p",{className:`text-xs ${s}`,children:e})}function xL({message:e,messageIndex:r}){switch(e.type){case"user":return(0,F.jsx)(xB,{content:e.content});case"assistant":return(0,F.jsx)(xA,{content:e.content});case"tool_use":return(0,F.jsx)(xO,{tool:e.tool,input:e.input,messageIndex:r});case"tool_result":return(0,F.jsx)(xI,{tool:e.tool,output:e.output});case"thinking":return(0,F.jsx)(xz,{content:e.content});case"error":return(0,F.jsx)(xF,{message:e.message});case"system":return(0,F.jsx)(xW,{content:e.content});case"approval_request":return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-amber-500/10 flex items-center justify-center",children:(0,F.jsx)(vU,{className:"w-4 h-4 text-amber-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-amber-500 mb-1",children:"command"===e.requestType?"Command Approval":"File Change Approval"}),"command"===e.requestType?(0,F.jsx)(v3,{requestId:e.requestId,command:e.command,cwd:e.cwd,messageIndex:r}):(0,F.jsx)(v4,{requestId:e.requestId,changes:e.changes,messageIndex:r})]})]});default:return null}}function xB({content:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,F.jsx)(vR,{className:"w-3.5 h-3.5 text-primary"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:"You"}),(0,F.jsx)("div",{className:"text-sm text-foreground prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words",children:"string"==typeof e?(0,F.jsx)(vZ,{children:e??""}):e.map((e,r)=>"text"===e.type?(0,F.jsx)(vZ,{children:e.text},r):(0,F.jsx)("img",{src:`data:${e.mediaType};base64,${e.data}`,alt:"Attached image",className:"max-w-sm rounded-lg mt-2"},r))})]})]})}function xA({content:e}){let r="codex"===function(){try{return yx().agentType}catch{return"claude-code"}}();return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:`flex-shrink-0 w-7 h-7 rounded-lg ${r?"bg-green-500/10":"bg-violet-500/10"} flex items-center justify-center`,children:(0,F.jsx)(nA,{className:`w-3.5 h-3.5 ${r?"text-green-500":"text-violet-500"}`})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:`text-sm font-medium ${r?"text-green-500":"text-violet-500"} mb-1`,children:r?"Codex":"Claude"}),(0,F.jsx)("div",{className:"text-sm text-foreground prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:max-w-full [&_code]:break-all [&_p]:break-words",children:(0,F.jsx)(vZ,{children:e??""})})]})]})}function xO({tool:e,input:r,messageIndex:s}){if("AskUserQuestion"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-violet-500/10 flex items-center justify-center",children:(0,F.jsx)(vL,{className:"w-4 h-4 text-violet-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-violet-500 mb-1",children:"Question"}),(0,F.jsx)(vQ,{input:r,messageIndex:s})]})]});if("ExitPlanMode"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-green-500/10 flex items-center justify-center",children:(0,F.jsx)(vB,{className:"w-4 h-4 text-green-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-green-500 mb-1",children:"Plan Ready"}),(0,F.jsx)(v5,{input:r,messageIndex:s})]})]});let i={TodoWrite:{label:"Tasks",ui:(0,F.jsx)(xr,{input:r})},TaskCreate:{label:"Create Task",ui:(0,F.jsx)(xs,{input:r})},TaskUpdate:{label:"Update Task",ui:(0,F.jsx)(xi,{input:r})},TaskList:{label:"Task List",ui:(0,F.jsx)(xn,{})},TaskGet:{label:"Get Task",ui:(0,F.jsx)(xo,{input:r})}}[e];if(i)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-cyan-500/10 flex items-center justify-center",children:(0,F.jsx)(vA,{className:"w-4 h-4 text-cyan-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-cyan-500 mb-1",children:i.label}),i.ui]})]});if("Read"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(vO,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"Read File"}),(0,F.jsx)(xl,{input:r})]})]});if("Edit"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(vW,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"Edit File"}),(0,F.jsx)(xw,{input:r})]})]});if("Write"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(v$,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"Write File"}),(0,F.jsx)(xd,{input:r})]})]});if("Bash"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-emerald-500/10 flex items-center justify-center",children:(0,F.jsx)(nB.Terminal,{className:"w-4 h-4 text-emerald-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-emerald-500 mb-1",children:"Run Command"}),(0,F.jsx)(xu,{input:r})]})]});if("Grep"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-orange-500/10 flex items-center justify-center",children:(0,F.jsx)(vI,{className:"w-4 h-4 text-orange-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-orange-500 mb-1",children:"Search"}),(0,F.jsx)(xp,{input:r})]})]});if("Glob"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-teal-500/10 flex items-center justify-center",children:(0,F.jsx)(vz,{className:"w-4 h-4 text-teal-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-teal-500 mb-1",children:"Glob"}),(0,F.jsx)(xg,{input:r})]})]});if("Task"===e||"Agent"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-purple-500/10 flex items-center justify-center",children:(0,F.jsx)(vF,{className:"w-4 h-4 text-purple-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-purple-500 mb-1",children:"Agent"}),(0,F.jsx)(x_,{input:r})]})]});if("TaskOutput"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-purple-500/10 flex items-center justify-center",children:(0,F.jsx)(vF,{className:"w-4 h-4 text-purple-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-purple-500 mb-1",children:"Task Output"}),(0,F.jsx)(xM,{input:r})]})]});if("WebFetch"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-blue-500/10 flex items-center justify-center",children:(0,F.jsx)(ib,{className:"w-4 h-4 text-blue-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-blue-500 mb-1",children:"Fetch Web Page"}),(0,F.jsx)(xC,{input:r})]})]});if("WebSearch"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-indigo-500/10 flex items-center justify-center",children:(0,F.jsx)(vK,{className:"w-4 h-4 text-indigo-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-indigo-500 mb-1",children:"Web Search"}),(0,F.jsx)(xj,{input:r})]})]});if("Skill"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-pink-500/10 flex items-center justify-center",children:(0,F.jsx)(vH,{className:"w-4 h-4 text-pink-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-pink-500 mb-1",children:"Skill"}),(0,F.jsx)(xE,{input:r})]})]});if("FileChange"===e)return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-sky-500/10 flex items-center justify-center",children:(0,F.jsx)(vW,{className:"w-4 h-4 text-sky-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-sky-500 mb-1",children:"File Changes"}),(0,F.jsx)(xT,{input:r})]})]});let n="string"==typeof r?r:JSON.stringify(r,null,2);return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-amber-500/10 flex items-center justify-center",children:(0,F.jsx)(vM,{className:"w-4 h-4 text-amber-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsxs)("p",{className:"text-sm font-medium text-amber-500 mb-1 break-words",children:["Tool: ",e]}),(0,F.jsxs)("details",{open:!0,children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Input"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-w-full whitespace-pre-wrap break-all",children:n.length>500?n.substring(0,500)+"...":n})]})]})]})}function xI({tool:e,output:r}){if(["TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"].includes(e)){let s="TaskList"===e?(0,F.jsx)(xa,{output:r}):null;return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mb-1",children:["Result (",e,")"]}),s||(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Output"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:r.length>1e3?r.substring(0,1e3)+"...":r})]})]})})}if("Read"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xc,{output:r})})});if("Edit"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xS,{output:r})})});if("Write"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xh,{output:r})})});if("Bash"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xf,{output:r})})});if("Grep"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xm,{output:r})})});if("Glob"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xv,{output:r})})});if("Task"===e||"Agent"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xy,{output:r})})});if("TaskOutput"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xD,{output:r})})});if("WebFetch"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xk,{output:r})})});if("WebSearch"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xN,{output:r})})});if("Skill"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xR,{output:r})})});if("FileChange"===e)return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)(xP,{output:r})})});let s=r.length>200;return(0,F.jsx)("div",{className:"flex gap-3 py-3 pl-11",children:(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsxs)("p",{className:"text-xs text-muted-foreground mb-1",children:["Result",e?` (${e})`:""]}),(0,F.jsxs)("details",{className:(0,iu.cn)(!s&&"open"),children:[(0,F.jsx)("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Output"}),(0,F.jsx)("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-48 overflow-y-auto max-w-full whitespace-pre-wrap break-all",children:r.length>1e3?r.substring(0,1e3)+"...":r})]})]})})}function xz({content:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-blue-500/10 flex items-center justify-center",children:(0,F.jsx)(vD,{className:"w-3.5 h-3.5 text-blue-500"})}),(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsxs)("details",{children:[(0,F.jsx)("summary",{className:"text-xs font-medium text-blue-500 cursor-pointer hover:underline",children:"Thinking..."}),(0,F.jsx)("div",{className:"mt-2 text-xs text-muted-foreground whitespace-pre-wrap break-words bg-blue-500/5 p-2 rounded-md overflow-hidden",children:(e??"").length>500?(e??"").substring(0,500)+"...":e??""})]})})]})}function xF({message:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-red-500/10 flex items-center justify-center",children:(0,F.jsx)(vT,{className:"w-3.5 h-3.5 text-red-500"})}),(0,F.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-red-500 mb-1",children:"Error"}),(0,F.jsx)("p",{className:"text-sm text-red-500/80 break-words",children:e})]})]})}function xW({content:e}){return(0,F.jsxs)("div",{className:"flex gap-3 py-2",children:[(0,F.jsx)("div",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-gray-500/10 flex items-center justify-center",children:(0,F.jsx)(vP,{className:"w-3.5 h-3.5 text-gray-500"})}),(0,F.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:(0,F.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:e??""})})]})}let xH={damping:.7,stiffness:.05,mass:1.25},x$=1e3/60,xK=!1;function xU(e,r){let s=(0,W.useCallback)(r=>(s.current=r,e(r)),r);return s}globalThis.document?.addEventListener("mousedown",()=>{xK=!0}),globalThis.document?.addEventListener("mouseup",()=>{xK=!1}),globalThis.document?.addEventListener("click",()=>{xK=!1});let xq=new Map;function xV(...e){let r={...xH},s=!1;for(let i of e){if("instant"===i){s=!0;continue}"object"==typeof i&&(s=!1,r.damping=i.damping??r.damping,r.stiffness=i.stiffness??r.stiffness,r.mass=i.mass??r.mass)}let i=JSON.stringify(r);return xq.has(i)||xq.set(i,Object.freeze(r)),s?"instant":xq.get(i)}let xY=(0,W.createContext)(null),xX="undefined"!=typeof window?W.useLayoutEffect:W.useEffect;function xG({instance:e,children:r,resize:s,initial:i,mass:n,damping:o,stiffness:a,targetScrollTop:l,contextRef:c,...d}){let h=(0,W.useRef)(null),u=((e={})=>{let[r,s]=(0,W.useState)(!1),[i,n]=(0,W.useState)(!1!==e.initial),[o,a]=(0,W.useState)(!1),l=(0,W.useRef)(null);l.current=e;let c=(0,W.useCallback)(()=>{if(!xK)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let r=e.getRangeAt(0);return r.commonAncestorContainer.contains(v.current)||v.current?.contains(r.commonAncestorContainer)},[]),d=(0,W.useCallback)(e=>{u.isAtBottom=e,n(e)},[]),h=(0,W.useCallback)(e=>{u.escapedFromLock=e,s(e)},[]),u=(0,W.useMemo)(()=>{let s;return{escapedFromLock:r,isAtBottom:i,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return v.current?.scrollTop??0},set scrollTop(scrollTop){v.current&&(v.current.scrollTop=scrollTop,u.ignoreScrollToTop=v.current.scrollTop)},get targetScrollTop(){if(!v.current||!x.current)return 0;return v.current.scrollHeight-1-v.current.clientHeight},get calculatedTargetScrollTop(){if(!v.current||!x.current)return 0;let{targetScrollTop:r}=this;if(!e.targetScrollTop)return r;if(s?.targetScrollTop===r)return s.calculatedScrollTop;let i=Math.max(Math.min(e.targetScrollTop(r,{scrollElement:v.current,contentElement:x.current}),r),0);return s={targetScrollTop:r,calculatedScrollTop:i},requestAnimationFrame(()=>{s=void 0}),i},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),f=(0,W.useCallback)((e={})=>{let r;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||d(!0);let s=Date.now()+(Number(e.wait)||0),i=xV(l.current,e.animation),{ignoreEscapes:n=!1}=e,o=u.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{r=Date.now()}):r=s+(e.duration??0);let a=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!u.isAtBottom)return u.animation=void 0,!1;let{scrollTop:d}=u,h=performance.now(),p=(h-(u.lastTick??h))/x$;if(u.animation||(u.animation={behavior:i,promise:e,ignoreEscapes:n}),u.animation.behavior===i&&(u.lastTick=h),c()||s>Date.now())return a();if(d<Math.min(o,u.calculatedTargetScrollTop)){if(u.animation?.behavior===i){if("instant"===i)return u.scrollTop=u.calculatedTargetScrollTop,a();u.velocity=(i.damping*u.velocity+i.stiffness*u.scrollDifference)/i.mass,u.accumulated+=u.velocity*p,u.scrollTop+=u.accumulated,u.scrollTop!==d&&(u.accumulated=0)}return a()}return r>Date.now()?(o=u.calculatedTargetScrollTop,a()):(u.animation=void 0,u.scrollTop<u.calculatedTargetScrollTop)?f({animation:xV(l.current,l.current.resize),ignoreEscapes:n,duration:Math.max(0,r-Date.now())||void 0}):u.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{u.animation||(u.lastTick=void 0,u.velocity=0)}),e))};return(!0!==e.wait&&(u.animation=void 0),u.animation?.behavior===i)?u.animation.promise:a()},[d,c,u]),p=(0,W.useCallback)(()=>{h(!0),d(!1)},[h,d]),m=(0,W.useCallback)(({target:e})=>{if(e!==v.current)return;let{scrollTop:r,ignoreScrollToTop:s}=u,{lastScrollTop:i=r}=u;u.lastScrollTop=r,u.ignoreScrollToTop=void 0,s&&s>r&&(i=s),a(u.isNearBottom),setTimeout(()=>{if(u.resizeDifference||r===s)return;if(c()){h(!0),d(!1);return}let e=r>i,n=r<i;if(u.animation?.ignoreEscapes){u.scrollTop=i;return}n&&(h(!0),d(!1)),e&&h(!1),!u.escapedFromLock&&u.isNearBottom&&d(!0)},1)},[h,d,c,u]),g=(0,W.useCallback)(({target:e,deltaY:r})=>{let s=e;for(;!["scroll","auto"].includes(getComputedStyle(s).overflow);){if(!s.parentElement)return;s=s.parentElement}s===v.current&&r<0&&v.current.scrollHeight>v.current.clientHeight&&!u.animation?.ignoreEscapes&&(h(!0),d(!1))},[h,d,u]),v=xU(e=>{v.current?.removeEventListener("scroll",m),v.current?.removeEventListener("wheel",g),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",g,{passive:!0})},[]),x=xU(e=>{let r;u.resizeObserver?.disconnect(),e&&(u.resizeObserver=new ResizeObserver(([e])=>{let{height:s}=e.contentRect,i=s-(r??s);if(u.resizeDifference=i,u.scrollTop>u.targetScrollTop&&(u.scrollTop=u.targetScrollTop),a(u.isNearBottom),i>=0){let e=xV(l.current,r?l.current.resize:l.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else u.isNearBottom&&(h(!1),d(!0));r=s,requestAnimationFrame(()=>{setTimeout(()=>{u.resizeDifference===i&&(u.resizeDifference=0)},1)})}),u.resizeObserver?.observe(e))},[]);return{contentRef:x,scrollRef:v,scrollToBottom:f,stopScroll:p,isAtBottom:i||o,isNearBottom:o,escapedFromLock:r,state:u}})({mass:n,damping:o,stiffness:a,resize:s,initial:i,targetScrollTop:W.useCallback((e,r)=>{let s=y?.targetScrollTop??l;return s?.(e,r)??e},[l])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:g,isAtBottom:v,escapedFromLock:x,state:_}=e??u,y=(0,W.useMemo)(()=>({scrollToBottom:m,stopScroll:g,scrollRef:f,isAtBottom:v,escapedFromLock:x,contentRef:p,state:_,get targetScrollTop(){return h.current},set targetScrollTop(targetScrollTop){h.current=targetScrollTop}}),[m,v,p,f,g,x,_]);return(0,W.useImperativeHandle)(c,()=>y,[y]),xX(()=>{f.current&&"visible"===getComputedStyle(f.current).overflow&&(f.current.style.overflow="auto")},[]),W.createElement(xY.Provider,{value:y},W.createElement("div",{...d},"function"==typeof r?r(y):r))}function xJ(){let e=(0,W.useContext)(xY);if(!e)throw Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}(xG||(xG={})).Content=function({children:e,scrollClassName:r,...s}){let i=xJ();return W.createElement("div",{ref:i.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},W.createElement("div",{...s,ref:i.contentRef},"function"==typeof e?e(i):e))};let xZ=({className:e,...r})=>(0,F.jsx)(xG,{className:(0,iu.cn)("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...r}),xQ=({className:e,...r})=>(0,F.jsx)(xG.Content,{className:(0,iu.cn)("flex flex-col gap-8 p-4",e),...r}),x0=({className:e,...r})=>{let{isAtBottom:s,scrollToBottom:i}=xJ(),n=(0,W.useCallback)(()=>{i()},[i]);return!s&&(0,F.jsx)($.Button,{className:(0,iu.cn)("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",...r,children:(0,F.jsx)(iS,{className:"size-4"})})};var x1=/[\\\/_+.#"@\[\(\{&]/,x2=/[\\\/_+.#"@\[\(\{&]/g,x5=/[\s-]/,x3=/[\s-]/g;function x4(e){return e.toLowerCase().replace(x3," ")}var x6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{let s=lr(`Primitive.${r}`),i=W.forwardRef((e,i)=>{let{asChild:n,...o}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,F.jsx)(n?s:r,{...o,ref:i})});return i.displayName=`Primitive.${r}`,{...e,[r]:i}},{}),x8='[cmdk-group=""]',x7='[cmdk-group-items=""]',x9='[cmdk-item=""]',_e=`${x9}:not([aria-disabled="true"])`,_t="cmdk-item-select",_r="data-value",_s=(e,r,s)=>{var i;return i=e,function e(r,s,i,n,o,a,l){if(a===s.length)return o===r.length?1:.99;var c=`${o},${a}`;if(void 0!==l[c])return l[c];for(var d,h,u,f,p=n.charAt(a),m=i.indexOf(p,o),g=0;m>=0;)(d=e(r,s,i,n,m+1,a+1,l))>g&&(m===o?d*=1:x1.test(r.charAt(m-1))?(d*=.8,(u=r.slice(o,m-1).match(x2))&&o>0&&(d*=Math.pow(.999,u.length))):x5.test(r.charAt(m-1))?(d*=.9,(f=r.slice(o,m-1).match(x3))&&o>0&&(d*=Math.pow(.999,f.length))):(d*=.17,o>0&&(d*=Math.pow(.999,m-o))),r.charAt(m)!==s.charAt(a)&&(d*=.9999)),(d<.1&&i.charAt(m-1)===n.charAt(a+1)||n.charAt(a+1)===n.charAt(a)&&i.charAt(m-1)!==n.charAt(a))&&.1*(h=e(r,s,i,n,m+1,a+2,l))>d&&(d=.1*h),d>g&&(g=d),m=i.indexOf(p,m+1);return l[c]=g,g}(i=s&&s.length>0?`${i+" "+s.join(" ")}`:i,r,x4(i),x4(r),0,0,{})},_i=W.createContext(void 0),_n=W.createContext(void 0),_o=W.createContext(void 0),_a=W.forwardRef((e,r)=>{let s=_g(()=>{var r,s;return{search:"",value:null!=(s=null!=(r=e.value)?r:e.defaultValue)?s:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=_g(()=>new Set),n=_g(()=>new Map),o=_g(()=>new Map),a=_g(()=>new Set),l=_p(e),{label:c,children:d,value:h,onValueChange:u,filter:f,shouldFilter:p,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,_=ej(),y=ej(),b=ej(),w=W.useRef(null),S=__();_m(()=>{if(void 0!==h){let e=h.trim();s.current.value=e,C.emit()}},[h]),_m(()=>{S(6,M)},[]);let C=W.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>s.current,setState:(e,r,i)=>{var n,o,a,c;if(!Object.is(s.current[e],r)){if(s.current[e]=r,"search"===e)R(),N(),S(1,E);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(b);e?e.focus():null==(n=document.getElementById(_))||n.focus()}if(S(7,()=>{var e;s.current.selectedItemId=null==(e=D())?void 0:e.id,C.emit()}),i||S(5,M),(null==(o=l.current)?void 0:o.value)!==void 0){null==(c=(a=l.current).onValueChange)||c.call(a,null!=r?r:"");return}}C.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),k=W.useMemo(()=>({value:(e,r,i)=>{var n;r!==(null==(n=o.current.get(e))?void 0:n.value)&&(o.current.set(e,{value:r,keywords:i}),s.current.filtered.items.set(e,j(r,i)),S(2,()=>{N(),C.emit()}))},item:(e,r)=>(i.current.add(e),r&&(n.current.has(r)?n.current.get(r).add(e):n.current.set(r,new Set([e]))),S(3,()=>{R(),N(),s.current.value||E(),C.emit()}),()=>{o.current.delete(e),i.current.delete(e),s.current.filtered.items.delete(e);let r=D();S(4,()=>{R(),(null==r?void 0:r.getAttribute("id"))===e&&E(),C.emit()})}),group:e=>(n.current.has(e)||n.current.set(e,new Set),()=>{o.current.delete(e),n.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:_,inputId:b,labelId:y,listInnerRef:w}),[]);function j(e,r){var i,n;let o=null!=(n=null==(i=l.current)?void 0:i.filter)?n:_s;return e?o(e,s.current.search,r):0}function N(){if(!s.current.search||!1===l.current.shouldFilter)return;let e=s.current.filtered.items,r=[];s.current.filtered.groups.forEach(s=>{let i=n.current.get(s),o=0;i.forEach(r=>{o=Math.max(e.get(r),o)}),r.push([s,o])});let i=w.current;T().sort((r,s)=>{var i,n;let o=r.getAttribute("id"),a=s.getAttribute("id");return(null!=(i=e.get(a))?i:0)-(null!=(n=e.get(o))?n:0)}).forEach(e=>{let r=e.closest(x7);r?r.appendChild(e.parentElement===r?e:e.closest(`${x7} > *`)):i.appendChild(e.parentElement===i?e:e.closest(`${x7} > *`))}),r.sort((e,r)=>r[1]-e[1]).forEach(e=>{var r;let s=null==(r=w.current)?void 0:r.querySelector(`${x8}[${_r}="${encodeURIComponent(e[0])}"]`);null==s||s.parentElement.appendChild(s)})}function E(){let e=T().find(e=>"true"!==e.getAttribute("aria-disabled")),r=null==e?void 0:e.getAttribute(_r);C.setState("value",r||void 0)}function R(){var e,r,a,c;if(!s.current.search||!1===l.current.shouldFilter){s.current.filtered.count=i.current.size;return}s.current.filtered.groups=new Set;let d=0;for(let n of i.current){let i=j(null!=(r=null==(e=o.current.get(n))?void 0:e.value)?r:"",null!=(c=null==(a=o.current.get(n))?void 0:a.keywords)?c:[]);s.current.filtered.items.set(n,i),i>0&&d++}for(let[e,r]of n.current)for(let i of r)if(s.current.filtered.items.get(i)>0){s.current.filtered.groups.add(e);break}s.current.filtered.count=d}function M(){var e,r,s;let i=D();i&&((null==(e=i.parentElement)?void 0:e.firstChild)===i&&(null==(s=null==(r=i.closest(x8))?void 0:r.querySelector('[cmdk-group-heading=""]'))||s.scrollIntoView({block:"nearest"})),i.scrollIntoView({block:"nearest"}))}function D(){var e;return null==(e=w.current)?void 0:e.querySelector(`${x9}[aria-selected="true"]`)}function T(){var e;return Array.from((null==(e=w.current)?void 0:e.querySelectorAll(_e))||[])}function P(e){let r=T()[e];r&&C.setState("value",r.getAttribute(_r))}function L(e){var r;let s=D(),i=T(),n=i.findIndex(e=>e===s),o=i[n+e];null!=(r=l.current)&&r.loop&&(o=n+e<0?i[i.length-1]:n+e===i.length?i[0]:i[n+e]),o&&C.setState("value",o.getAttribute(_r))}function B(e){let r=D(),s=null==r?void 0:r.closest(x8),i;for(;s&&!i;)i=null==(s=e>0?function(e,r){let s=e.nextElementSibling;for(;s;){if(s.matches(r))return s;s=s.nextElementSibling}}(s,x8):function(e,r){let s=e.previousElementSibling;for(;s;){if(s.matches(r))return s;s=s.previousElementSibling}}(s,x8))?void 0:s.querySelector(_e);i?C.setState("value",i.getAttribute(_r)):L(e)}let A=()=>P(T().length-1),O=e=>{e.preventDefault(),e.metaKey?A():e.altKey?B(1):L(1)},I=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?B(-1):L(-1)};return W.createElement(x6.div,{ref:r,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:e=>{var r;null==(r=x.onKeyDown)||r.call(x,e);let s=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":v&&e.ctrlKey&&O(e);break;case"ArrowDown":O(e);break;case"p":case"k":v&&e.ctrlKey&&I(e);break;case"ArrowUp":I(e);break;case"Home":e.preventDefault(),P(0);break;case"End":e.preventDefault(),A();break;case"Enter":{e.preventDefault();let r=D();if(r){let e=new Event(_t);r.dispatchEvent(e)}}}}},W.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:_b},c),_y(e,e=>W.createElement(_n.Provider,{value:C},W.createElement(_i.Provider,{value:k},e))))}),_l=W.forwardRef((e,r)=>{var s,i;let n=ej(),o=W.useRef(null),a=W.useContext(_o),l=W.useContext(_i),c=_p(e),d=null!=(i=null==(s=c.current)?void 0:s.forceMount)?i:null==a?void 0:a.forceMount;_m(()=>{if(!d)return l.item(n,null==a?void 0:a.id)},[d]);let h=_x(n,o,[e.value,e.children,o],e.keywords),u=W.useContext(_n),f=_v(e=>e.value&&e.value===h.current),p=_v(e=>!!d||!1===l.filter()||!e.search||e.filtered.items.get(n)>0);function m(){var e,r;g(),null==(r=(e=c.current).onSelect)||r.call(e,h.current)}function g(){u.setState("value",h.current,!0)}if(W.useEffect(()=>{let r=o.current;if(!(!r||e.disabled))return r.addEventListener(_t,m),()=>r.removeEventListener(_t,m)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:v,value:x,onSelect:_,forceMount:y,keywords:b,...w}=e;return W.createElement(x6.div,{ref:(0,U.composeRefs)(o,r),...w,id:n,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),_c=W.forwardRef((e,r)=>{let{heading:s,children:i,forceMount:n,...o}=e,a=ej(),l=W.useRef(null),c=W.useRef(null),d=ej(),h=W.useContext(_i),u=_v(e=>!!n||!1===h.filter()||!e.search||e.filtered.groups.has(a));_m(()=>h.group(a),[]),_x(a,l,[e.value,e.heading,c]);let f=W.useMemo(()=>({id:a,forceMount:n}),[n]);return W.createElement(x6.div,{ref:(0,U.composeRefs)(l,r),...o,"cmdk-group":"",role:"presentation",hidden:!u||void 0},s&&W.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},s),_y(e,e=>W.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":s?d:void 0},W.createElement(_o.Provider,{value:f},e))))}),_d=W.forwardRef((e,r)=>{let{alwaysRender:s,...i}=e,n=W.useRef(null),o=_v(e=>!e.search);return s||o?W.createElement(x6.div,{ref:(0,U.composeRefs)(n,r),...i,"cmdk-separator":"",role:"separator"}):null}),_h=W.forwardRef((e,r)=>{let{onValueChange:s,...i}=e,n=null!=e.value,o=W.useContext(_n),a=_v(e=>e.search),l=_v(e=>e.selectedItemId),c=W.useContext(_i);return W.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),W.createElement(x6.input,{ref:r,...i,"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":l,id:c.inputId,type:"text",value:n?e.value:a,onChange:e=>{n||o.setState("search",e.target.value),null==s||s(e.target.value)}})}),_u=W.forwardRef((e,r)=>{let{children:s,label:i="Suggestions",...n}=e,o=W.useRef(null),a=W.useRef(null),l=_v(e=>e.selectedItemId),c=W.useContext(_i);return W.useEffect(()=>{if(a.current&&o.current){let e=a.current,r=o.current,s,i=new ResizeObserver(()=>{s=requestAnimationFrame(()=>{let s=e.offsetHeight;r.style.setProperty("--cmdk-list-height",s.toFixed(1)+"px")})});return i.observe(e),()=>{cancelAnimationFrame(s),i.unobserve(e)}}},[]),W.createElement(x6.div,{ref:(0,U.composeRefs)(o,r),...n,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:c.listId},_y(e,e=>W.createElement("div",{ref:(0,U.composeRefs)(a,c.listInnerRef),"cmdk-list-sizer":""},e)))}),_f=W.forwardRef((e,r)=>{let{open:s,onOpenChange:i,overlayClassName:n,contentClassName:o,container:a,...l}=e;return W.createElement(iA,{open:s,onOpenChange:i},W.createElement(iW,{container:a},W.createElement(i$,{"cmdk-overlay":"",className:n}),W.createElement(iV,{"aria-label":e.label,"cmdk-dialog":"",className:o},W.createElement(_a,{ref:r,...l}))))});function _p(e){let r=W.useRef(e);return _m(()=>{r.current=e}),r}Object.assign(_a,{List:_u,Item:_l,Input:_h,Group:_c,Separator:_d,Dialog:_f,Empty:W.forwardRef((e,r)=>_v(e=>0===e.filtered.count)?W.createElement(x6.div,{ref:r,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:W.forwardRef((e,r)=>{let{progress:s,children:i,label:n="Loading...",...o}=e;return W.createElement(x6.div,{ref:r,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},_y(e,e=>W.createElement("div",{"aria-hidden":!0},e)))})});var _m="undefined"==typeof window?W.useEffect:W.useLayoutEffect;function _g(e){let r=W.useRef();return void 0===r.current&&(r.current=e()),r}function _v(e){let r=W.useContext(_n),s=()=>e(r.snapshot());return W.useSyncExternalStore(r.subscribe,s,s)}function _x(e,r,s,i=[]){let n=W.useRef(),o=W.useContext(_i);return _m(()=>{var a;let l=(()=>{var e;for(let r of s){if("string"==typeof r)return r.trim();if("object"==typeof r&&"current"in r)return r.current?null==(e=r.current.textContent)?void 0:e.trim():n.current}})(),c=i.map(e=>e.trim());o.value(e,l,c),null==(a=r.current)||a.setAttribute(_r,l),n.current=l}),n}var __=()=>{let[e,r]=W.useState(),s=_g(()=>new Map);return _m(()=>{s.current.forEach(e=>e()),s.current=new Map},[e]),(e,i)=>{s.current.set(e,i),r({})}};function _y({asChild:e,children:r},s){let i;return e&&W.isValidElement(r)?W.cloneElement("function"==typeof(i=r.type)?i(r.props):"render"in i?i.render(r.props):r,{ref:r.ref},s(r.props.children)):s(r)}var _b={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},_w="HoverCard",[_S,_C]=q(_w,[tK]),_k=tK(),[_j,_N]=_S(_w),_E=e=>{let{__scopeHoverCard:r,children:s,open:i,defaultOpen:n,onOpenChange:o,openDelay:a=700,closeDelay:l=300}=e,c=_k(r),d=W.useRef(0),h=W.useRef(0),u=W.useRef(!1),f=W.useRef(!1),[p,m]=X({prop:i,defaultProp:n??!1,onChange:o,caller:_w}),g=W.useCallback(()=>{clearTimeout(h.current),d.current=window.setTimeout(()=>m(!0),a)},[a,m]),v=W.useCallback(()=>{clearTimeout(d.current),u.current||f.current||(h.current=window.setTimeout(()=>m(!1),l))},[l,m]),x=W.useCallback(()=>m(!1),[m]);return W.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(h.current)},[]),(0,F.jsx)(_j,{scope:r,open:p,onOpenChange:m,onOpen:g,onClose:v,onDismiss:x,hasSelectionRef:u,isPointerDownOnContentRef:f,children:(0,F.jsx)(tV,{...c,children:s})})};_E.displayName=_w;var _R="HoverCardTrigger",_M=W.forwardRef((e,r)=>{let{__scopeHoverCard:s,...i}=e,n=_N(_R,s),o=_k(s);return(0,F.jsx)(tX,{asChild:!0,...o,children:(0,F.jsx)(Z.a,{"data-state":n.open?"open":"closed",...i,ref:r,onPointerEnter:K(e.onPointerEnter,_I(n.onOpen)),onPointerLeave:K(e.onPointerLeave,_I(n.onClose)),onFocus:K(e.onFocus,n.onOpen),onBlur:K(e.onBlur,n.onClose),onTouchStart:K(e.onTouchStart,e=>e.preventDefault())})})});_M.displayName=_R;var _D="HoverCardPortal",[_T,_P]=_S(_D,{forceMount:void 0}),_L=e=>{let{__scopeHoverCard:r,forceMount:s,children:i,container:n}=e,o=_N(_D,r);return(0,F.jsx)(_T,{scope:r,forceMount:s,children:(0,F.jsx)(t8,{present:s||o.open,children:(0,F.jsx)(t6,{asChild:!0,container:n,children:i})})})};_L.displayName=_D;var _B="HoverCardContent",_A=W.forwardRef((e,r)=>{let s=_P(_B,e.__scopeHoverCard),{forceMount:i=s.forceMount,...n}=e,o=_N(_B,e.__scopeHoverCard);return(0,F.jsx)(t8,{present:i||o.open,children:(0,F.jsx)(_O,{"data-state":o.open?"open":"closed",...n,onPointerEnter:K(e.onPointerEnter,_I(o.onOpen)),onPointerLeave:K(e.onPointerLeave,_I(o.onClose)),ref:r})})});_A.displayName=_B;var _O=W.forwardRef((e,r)=>{let{__scopeHoverCard:s,onEscapeKeyDown:i,onPointerDownOutside:n,onFocusOutside:o,onInteractOutside:a,...l}=e,c=_N(_B,s),d=_k(s),h=W.useRef(null),u=(0,U.useComposedRefs)(r,h),[f,p]=W.useState(!1);return W.useEffect(()=>{if(f){let e=document.body;return z=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=z,e.style.webkitUserSelect=z}}},[f]),W.useEffect(()=>{if(h.current){let e=()=>{p(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(c.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),W.useEffect(()=>{h.current&&(function(e){let r=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;s.nextNode();)r.push(s.currentNode);return r})(h.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,F.jsx)(ec,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:i,onPointerDownOutside:n,onFocusOutside:K(o,e=>{e.preventDefault()}),onDismiss:c.onDismiss,children:(0,F.jsx)(tQ,{...d,...l,onPointerDown:K(l.onPointerDown,e=>{e.currentTarget.contains(e.target)&&p(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:u,style:{...l.style,userSelect:f?"text":void 0,WebkitUserSelect:f?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function _I(e){return r=>"touch"===r.pointerType?void 0:e()}function _z({...e}){return(0,F.jsx)(_E,{"data-slot":"hover-card",...e})}function _F({...e}){return(0,F.jsx)(_M,{"data-slot":"hover-card-trigger",...e})}function _W({className:e,align:r="center",sideOffset:s=4,...i}){return(0,F.jsx)(_L,{"data-slot":"hover-card-portal",children:(0,F.jsx)(_A,{"data-slot":"hover-card-content",align:r,sideOffset:s,className:(0,iu.cn)("bg-popover text-popover-foreground 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 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...i})})}function _H({className:e,...r}){return(0,F.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,iu.cn)("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...r})}W.forwardRef((e,r)=>{let{__scopeHoverCard:s,...i}=e,n=_k(s);return(0,F.jsx)(t2,{...n,...i,ref:r})}).displayName="HoverCardArrow";let _$=(0,lo.cva)("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function _K({className:e,align:r="inline-start",...s}){return(0,F.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":r,className:(0,iu.cn)(_$({align:r}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}let _U=(0,lo.cva)("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function _q({className:e,type:r="button",variant:s="ghost",size:i="xs",...n}){return(0,F.jsx)($.Button,{type:r,"data-size":i,variant:s,className:(0,iu.cn)(_U({size:i}),e),...n})}function _V({className:e,...r}){return(0,F.jsx)(nD,{"data-slot":"input-group-control",className:(0,iu.cn)("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...r})}let _Y=(0,ic.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),_X=(0,ic.default)("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"}]]);(0,ic.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);let _G=(0,ic.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),_J=(e=21)=>{let r="",s=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)r+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&s[e]];return r},_Z=(0,W.createContext)(null),_Q=(0,W.createContext)(null),_0=()=>(0,W.useContext)(_Z),_1=(0,W.createContext)(null),_2=()=>{let e=(0,W.useContext)(_Q),r=(0,W.useContext)(_1),s=e??r;if(!s)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return s};function _5({data:e,className:r,...s}){let i=_2(),n=e.filename||"",o="image"==(e.mediaType?.startsWith("image/")&&e.url?"image":"file"),a=n||(o?"Image":"Attachment");return(0,F.jsxs)(yn,{children:[(0,F.jsx)(_F,{asChild:!0,children:(0,F.jsxs)("div",{className:(0,iu.cn)("group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",r),...s,children:[(0,F.jsxs)("div",{className:"relative size-5 shrink-0",children:[(0,F.jsx)("div",{className:"absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0",children:o?(0,F.jsx)("img",{alt:n||"attachment",className:"size-5 object-cover",height:20,src:e.url,width:20}):(0,F.jsx)("div",{className:"flex size-5 items-center justify-center text-muted-foreground",children:(0,F.jsx)(_G,{className:"size-3"})})}),(0,F.jsxs)($.Button,{"aria-label":"Remove attachment",className:"absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",onClick:r=>{r.stopPropagation(),i.remove(e.id)},type:"button",variant:"ghost",children:[(0,F.jsx)(i9,{}),(0,F.jsx)("span",{className:"sr-only",children:"Remove"})]})]}),(0,F.jsx)("span",{className:"flex-1 truncate",children:a})]},e.id)}),(0,F.jsx)(yo,{className:"w-auto p-2",children:(0,F.jsxs)("div",{className:"w-auto space-y-3",children:[o&&(0,F.jsx)("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:(0,F.jsx)("img",{alt:n||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:e.url,width:448})}),(0,F.jsx)("div",{className:"flex items-center gap-2.5",children:(0,F.jsxs)("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[(0,F.jsx)("h4",{className:"truncate font-semibold text-sm leading-none",children:n||(o?"Image":"Attachment")}),e.mediaType&&(0,F.jsx)("p",{className:"truncate font-mono text-muted-foreground text-xs",children:e.mediaType})]})})]})})]})}function _3({children:e,className:r,...s}){let i=_2();return i.files.length?(0,F.jsx)("div",{className:(0,iu.cn)("flex flex-wrap items-center gap-2 p-3 w-full",r),...s,children:i.files.map(r=>(0,F.jsx)(W.Fragment,{children:e(r)},r.id))}):null}let _4=({label:e="Add photos or files",...r})=>{let s=_2();return(0,F.jsxs)(iv,{...r,onSelect:e=>{e.preventDefault(),s.openFileDialog()},children:[(0,F.jsx)(_X,{className:"mr-2 size-4"})," ",e]})},_6=({className:e,accept:r,multiple:s,globalDrop:i,syncHiddenInput:n,maxFiles:o,maxFileSize:a,onError:l,onSubmit:c,children:d,...h})=>{let u=_0(),f=!!u,p=(0,W.useRef)(null),m=(0,W.useRef)(null),[g,v]=(0,W.useState)([]),x=f?u.attachments.files:g,_=(0,W.useRef)(x);_.current=x;let y=(0,W.useCallback)(()=>{p.current?.click()},[]),b=(0,W.useCallback)(e=>!r||""===r.trim()||r.split(",").map(e=>e.trim()).filter(Boolean).some(r=>{if(r.endsWith("/*")){let s=r.slice(0,-1);return e.type.startsWith(s)}return e.type===r}),[r]),w=(0,W.useCallback)(e=>{let r=Array.from(e),s=r.filter(e=>b(e));if(r.length&&0===s.length)return void l?.({code:"accept",message:"No files match the accepted types."});let i=s.filter(e=>!a||e.size<=a);s.length>0&&0===i.length?l?.({code:"max_file_size",message:"All files exceed the maximum size."}):v(e=>{let r="number"==typeof o?Math.max(0,o-e.length):void 0,s="number"==typeof r?i.slice(0,r):i;"number"==typeof r&&i.length>r&&l?.({code:"max_files",message:"Too many files. Some were not added."});let n=[];for(let e of s)n.push({id:_J(),type:"file",url:URL.createObjectURL(e),mediaType:e.type,filename:e.name});return e.concat(n)})},[b,o,a,l]),S=(0,W.useCallback)(e=>v(r=>{let s=r.find(r=>r.id===e);return s?.url&&URL.revokeObjectURL(s.url),r.filter(r=>r.id!==e)}),[]),C=(0,W.useCallback)(()=>v(e=>{for(let r of e)r.url&&URL.revokeObjectURL(r.url);return[]}),[]),k=f?u.attachments.add:w,j=f?u.attachments.remove:S,N=f?u.attachments.clear:C,E=f?u.attachments.openFileDialog:y;(0,W.useEffect)(()=>{f&&u.__registerFileInput(p,()=>p.current?.click())},[f,u]),(0,W.useEffect)(()=>{n&&p.current&&0===x.length&&(p.current.value="")},[x,n]),(0,W.useEffect)(()=>{let e=m.current;if(!e||i)return;let r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},s=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&k(e.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",s),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",s)}},[k,i]),(0,W.useEffect)(()=>{if(!i)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&k(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[k,i]),(0,W.useEffect)(()=>()=>{if(!f)for(let e of _.current)e.url&&URL.revokeObjectURL(e.url)},[f]);let R=async e=>{try{let r=await fetch(e),s=await r.blob();return new Promise(e=>{let r=new FileReader;r.onloadend=()=>e(r.result),r.onerror=()=>e(null),r.readAsDataURL(s)})}catch{return null}},M=(0,W.useMemo)(()=>({files:x.map(e=>({...e,id:e.id})),add:k,remove:j,clear:N,openFileDialog:E,fileInputRef:p}),[x,k,j,N,E]),D=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("input",{accept:r,"aria-label":"Upload files",className:"hidden",multiple:s,onChange:e=>{e.currentTarget.files&&k(e.currentTarget.files),e.currentTarget.value=""},ref:p,title:"Upload files",type:"file"}),(0,F.jsx)("form",{className:(0,iu.cn)("w-full",e),onSubmit:e=>{e.preventDefault();let r=e.currentTarget,s=f?u.textInput.value:new FormData(r).get("message")||"";f||r.reset(),Promise.all(x.map(async({id:e,...r})=>{if(r.url&&r.url.startsWith("blob:")){let e=await R(r.url);return{...r,url:e??r.url}}return r})).then(r=>{try{let i=c({text:s,files:r},e);i instanceof Promise?i.then(()=>{N(),f&&u.textInput.clear()}).catch(()=>{}):(N(),f&&u.textInput.clear())}catch{}}).catch(()=>{})},ref:m,...h,children:(0,F.jsx)(_H,{className:"overflow-hidden",children:d})})]});return f?D:(0,F.jsx)(_1.Provider,{value:M,children:D})},_8=({onChange:e,onKeyDown:r,className:s,placeholder:i="What would you like to know?",...n})=>{let o=_0(),a=_2(),[l,c]=(0,W.useState)(!1),d=o?{value:o.textInput.value,onChange:r=>{o.textInput.setInput(r.currentTarget.value),e?.(r)}}:{onChange:e};return(0,F.jsx)(_V,{className:(0,iu.cn)("field-sizing-content max-h-48 min-h-9",s),name:"message",onCompositionEnd:()=>c(!1),onCompositionStart:()=>c(!0),onKeyDown:e=>{if(r?.(e),!e.defaultPrevented){if("Enter"===e.key){if(l||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let r=e.currentTarget.form,s=r?.querySelector('button[type="submit"]');if(s?.disabled)return;r?.requestSubmit()}if("Backspace"===e.key&&""===e.currentTarget.value&&a.files.length>0){e.preventDefault();let r=a.files.at(-1);r&&a.remove(r.id)}}},onPaste:e=>{let r=e.clipboardData?.items;if(!r)return;let s=[];for(let e of r)if("file"===e.kind){let r=e.getAsFile();r&&s.push(r)}s.length>0&&(e.preventDefault(),a.add(s))},placeholder:i,...n,...d})},_7=({className:e,...r})=>(0,F.jsx)(_K,{align:"block-end",className:(0,iu.cn)("order-first flex-wrap gap-1",e),...r}),_9=({variant:e="ghost",className:r,size:s,...i})=>{let n=s??(W.Children.count(i.children)>1?"sm":"icon-sm");return(0,F.jsx)(_q,{className:(0,iu.cn)(r),size:n,type:"button",variant:e,...i})},ye=e=>(0,F.jsx)(ip,{...e}),yt=({className:e,children:r,...s})=>(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)(_9,{className:e,...s,children:r??(0,F.jsx)(nT,{className:"size-4"})})}),yr=({className:e,...r})=>(0,F.jsx)(ig,{align:"start",className:(0,iu.cn)(e),...r}),ys=({className:e,...r})=>(0,F.jsx)(iv,{className:(0,iu.cn)(e),...r}),yi=({className:e,variant:r="default",size:s="icon-sm",status:i,children:n,...o})=>{let a=(0,F.jsx)(_Y,{className:"size-4"});return"submitted"===i?a=(0,F.jsx)(iE,{className:"size-4 animate-spin"}):"streaming"===i?a=(0,F.jsx)(lc,{className:"size-4"}):"error"===i&&(a=(0,F.jsx)(i9,{className:"size-4"})),(0,F.jsx)(_q,{"aria-label":"Submit",className:(0,iu.cn)(e),size:s,type:"submit",variant:r,...o,children:n??a})},yn=({openDelay:e=0,closeDelay:r=0,...s})=>(0,F.jsx)(_z,{closeDelay:r,openDelay:e,...s}),yo=({align:e="start",...r})=>(0,F.jsx)(_W,{align:e,...r}),ya=({size:e=16})=>(0,F.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,F.jsx)("title",{children:"Loader"}),(0,F.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,F.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,F.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,F.jsx)("defs",{children:(0,F.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,F.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),yl=({className:e,size:r=16,...s})=>(0,F.jsx)("div",{className:(0,iu.cn)("inline-flex animate-spin items-center justify-center",e),...s,children:(0,F.jsx)(ya,{size:r})}),yc=(0,ic.default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),yd=(0,ic.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),yh=(0,ic.default)("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"}]]),yu=(0,ic.default)("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"}]]);function yf({mode:e,onModeChange:r,disabled:s}){return(0,F.jsxs)("div",{className:"inline-flex items-center rounded-md border bg-muted/50 p-0.5 text-xs",children:[(0,F.jsxs)("button",{onClick:()=>r("plan"),disabled:s,className:(0,iu.cn)("inline-flex items-center gap-1 rounded-sm px-2 py-0.5 transition-colors","plan"===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground",s&&"opacity-50 cursor-not-allowed"),children:[(0,F.jsx)(yu,{className:"h-3 w-3"}),"Plan"]}),(0,F.jsxs)("button",{onClick:()=>r("edit"),disabled:s,className:(0,iu.cn)("inline-flex items-center gap-1 rounded-sm px-2 py-0.5 transition-colors","edit"===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground",s&&"opacity-50 cursor-not-allowed"),children:[(0,F.jsx)(oL,{className:"h-3 w-3"}),"Edit"]})]})}function yp(e){let r=e.parentElement;for(;r;){let{overflowY:e}=getComputedStyle(r);if("auto"===e||"scroll"===e)return r;r=r.parentElement}return null}function ym({messages:e,contentRef:r}){let[s,i]=(0,W.useState)([]),[n,o]=(0,W.useState)(!1),[a,l]=(0,W.useState)(null),c=(0,W.useRef)(null),d=(0,W.useCallback)(()=>{let s=r.current;if(!s)return;c.current||(c.current=yp(s));let n=c.current;if(!n)return;let a=n.scrollHeight>n.clientHeight;if(o(a),!a)return void i([]);let l=s.querySelectorAll("[data-user-msg-idx]"),d=n.getBoundingClientRect(),h=[];l.forEach(r=>{let s=parseInt(r.dataset.userMsgIdx,10),i=(r.getBoundingClientRect().top-d.top+n.scrollTop)/n.scrollHeight;h.push({index:s,position:Math.max(0,Math.min(1,i)),preview:function(e){if("user"!==e.type)return"";let r=e.content,s="string"==typeof r?r:r.filter(e=>"text"===e.type).map(e=>e.text).join(" "),i="string"!=typeof r&&r.some(e=>"image"===e.type),n=s.split("\n")[0]??"";return(n.length>80?n.slice(0,77)+"...":n)||(i?"(Image)":"")}(e[s])})}),i(h)},[e,r]);(0,W.useEffect)(()=>{let e=r.current;if(!e)return;let s=yp(e);if(!s)return;c.current=s,d();let i=new ResizeObserver(d);return i.observe(s),i.observe(e),()=>{i.disconnect()}},[e,d,r]);let h=(0,W.useCallback)(e=>{let s=r.current;if(!s)return;let i=s.querySelector(`[data-user-msg-idx="${e}"]`);i&&i.scrollIntoView({block:"start",behavior:"smooth"})},[r]);return n&&0!==s.length?(0,F.jsx)("div",{className:"absolute right-0 top-0 bottom-0 w-5 z-20 pointer-events-none",children:s.map(e=>(0,F.jsxs)("div",{className:"absolute right-0.5 -translate-y-1/2 pointer-events-auto",style:{top:`${100*e.position}%`},children:[(0,F.jsx)("div",{className:"w-3 h-[3px] rounded-sm bg-primary/50 hover:bg-primary cursor-pointer transition-colors",onClick:()=>h(e.index),onMouseEnter:()=>l(e.index),onMouseLeave:()=>l(null)}),a===e.index&&e.preview&&(0,F.jsxs)("div",{className:"absolute right-full mr-2 top-1/2 -translate-y-1/2 max-w-64 px-2.5 py-1.5 bg-popover border border-border rounded-md shadow-md text-xs text-popover-foreground whitespace-nowrap overflow-hidden text-ellipsis pointer-events-none",children:[e.preview,(0,F.jsx)("div",{className:"absolute top-1/2 -translate-y-1/2 -right-1 w-2 h-2 bg-popover border-r border-t border-border rotate-45"})]})]},e.index))}):null}function yg(){return 0===_2().files.length?null:(0,F.jsx)(_7,{children:(0,F.jsx)(_3,{children:e=>(0,F.jsx)(_5,{data:e})})})}let yv=(0,W.createContext)(null);function yx(){let e=(0,W.useContext)(yv);if(!e)throw Error("useAgentConversation must be used within AgentConversationContext");return e}let y_=(0,W.forwardRef)(function({projectId:e,branch:r,project:s,onAgentModeChange:i,onTaskCompleted:n,onSessionStarted:o,onStatusChange:a},l){let c,d,h,u,f,p,m,[g,v]=(0,W.useState)(""),[x,_]=(0,W.useState)("edit"),[y,b]=(0,W.useState)(!1),[w,S]=(0,W.useState)(!1),[C,k]=(0,W.useState)("claude-code"),[j,N]=(0,W.useState)([]),E=(0,W.useRef)(null),R=(f=(0,W.useRef)([]),p=(0,W.useRef)(-1),m=(0,W.useRef)(""),{push:(0,W.useCallback)(e=>{let r=e.trim();if(!r)return;let s=f.current;if(s.length>0&&s[s.length-1]===r){p.current=-1;return}s.push(r),s.length>50&&s.shift(),p.current=-1},[]),handleKeyDown:(0,W.useCallback)(e=>{let r=e.currentTarget,s=f.current;if(0!==s.length)if("ArrowUp"===e.key){if(0!==r.selectionStart||0!==r.selectionEnd)return;if(e.preventDefault(),-1===p.current)m.current=r.value,p.current=s.length-1;else{if(!(p.current>0))return;p.current--}v(s[p.current])}else if("ArrowDown"===e.key){if(-1===p.current)return;let i=r.value.length;if(r.selectionStart!==i||r.selectionEnd!==i)return;e.preventDefault(),p.current<s.length-1?(p.current++,v(s[p.current])):(p.current=-1,v(m.current))}else -1!==p.current&&(p.current=-1)},[v])}),{remotes:M}=iM(s?.id??void 0),D=[];for(let e of(s?.path&&D.push({id:"local",label:"Local",icon:nO.Monitor}),M))D.push({id:e.remote_server_id,label:e.server_name,icon:nI});let{session:T,messages:P,status:L,isConnected:B,isInitialized:A,isLoading:O,error:I,remoteStatus:z,startSession:H,sendMessage:K,stopSession:U,restartSession:q,switchMode:V,acceptPlan:Y}=function(e,r,s,i,n){let[o,a]=(0,W.useState)(null),[l,c]=(0,W.useState)([]),[d,h]=(0,W.useState)("stopped"),[u,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[g,v]=(0,W.useState)(!1),[x,_]=(0,W.useState)(null),[y,b]=(0,W.useState)(null),w=(0,W.useRef)(null),S=(0,W.useRef)(null),C=(0,W.useRef)(null),k=(0,W.useRef)(0),j=(0,W.useRef)({entries:[],status:"stopped"}),N=(0,W.useRef)(!1),E=(0,W.useRef)(!0),R=(0,W.useRef)(null),M=(0,W.useRef)(null),D=(0,W.useRef)(0),T=(0,W.useRef)(!1),P=(0,W.useRef)(0),L=(0,W.useRef)(!1),B=(0,W.useRef)(!1),A=(0,W.useRef)(n?.onTaskCompleted),O=(0,W.useRef)(n?.onSessionStarted);(0,W.useEffect)(()=>{A.current=n?.onTaskCompleted,O.current=n?.onSessionStarted});let I=(0,W.useCallback)(s=>{if(w.current&&S.current!==s&&(console.log(`[AgentSession] Closing stale WS for ${S.current}, switching to ${s}`),w.current.close(1e3,"session-switch"),w.current=null,S.current=null),w.current?.readyState===WebSocket.OPEN||w.current?.readyState===WebSocket.CONNECTING)return;0===j.current.entries.filter(Boolean).length&&(j.current={entries:[],status:"running"}),N.current=!1,T.current=!0;let i=(0,iR.getWebSocketUrl)(`/api/agent-sessions/${s}/stream`);console.log("[AgentSession] Connecting to WebSocket:",i);let n=new WebSocket(i);w.current=n,S.current=s,n.onopen=()=>{console.log("[AgentSession] WebSocket connected"),f(!0),_(null),b(null),R.current=Date.now(),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{console.log("[AgentSession] Connection stable, resetting backoff counter"),k.current=0,D.current=0},5e3)},n.onmessage=s=>{try{let o=JSON.parse(s.data);if("JsonPatch"in o){var i;let s=o.JsonPatch;i=j.current,j.current=vv(i,e=>{for(let r of s){let{op:s,path:i,value:n}=r;if("/entries"===i&&"replace"===s&&n?.type==="ENTRY"&&n.content?.type==="system"&&n.content?.content==="__CLEAR_ALL__"){console.log("[JsonPatch] Received clearAll signal - clearing all entries"),e.entries=[];continue}if(i.startsWith("/entries/")){let r=parseInt(i.replace("/entries/",""),10);if(isNaN(r)){console.warn(`[JsonPatch] Invalid index in path: ${i}`);continue}if(n?.type!=="ENTRY"){console.warn("[JsonPatch] Expected ENTRY type for entries path");continue}switch(s){case"add":for(;e.entries.length<=r;)e.entries.push(null);e.entries[r]=n.content;break;case"replace":r<e.entries.length?e.entries[r]=n.content:console.warn(`[JsonPatch] Replace index out of bounds: ${r}`);break;case"remove":r<e.entries.length&&e.entries.splice(r,1)}}else"/status"===i&&n?.type==="STATUS"&&(e.status=n.content)}}),!T.current&&(c([...j.current.entries.filter(Boolean)]),h(j.current.status),("stopped"===j.current.status||"error"===j.current.status)&&e&&vN.delete(vE(e,r)));return}if("Ready"in o){console.log("[AgentSession] Received Ready signal - history complete"),T.current=!1,c([...j.current.entries.filter(Boolean)]),h(j.current.status),m(!0);return}if("finished"in o){console.log("[AgentSession] Received finished signal, invalidating cache"),N.current=!0,e&&vN.delete(vE(e,r)),n.close(1e3,"finished");return}if("taskCompleted"in o){let{duration_ms:e,cost_usd:r,input_tokens:s,output_tokens:i}=o.taskCompleted,n=[];if(null!=e){let r=(e/1e3).toFixed(1);n.push(`${r}s`)}if(null!=r)n.push(`$${r.toFixed(4)}`);else if(null!=s||null!=i){let e=(s??0)+(i??0),r=e>1e3?`${(e/1e3).toFixed(1)}K`:String(e);n.push(`${r} tokens`)}vx.toast.success("Task completed",{description:n.length>0?n.join(" · "):void 0}),A.current?.();return}if("remoteStatus"in o)return void b(o.remoteStatus);if("error"in o){console.error("[AgentSession] Server error:",o.error),_(o.error),"Session not found"===o.error&&(console.log("[AgentSession] Session invalid, invalidating cache, will create new session"),e&&vN.delete(vE(e,r)),N.current=!0,a(null),h("stopped"),m(!1),E.current=!0);return}}catch(e){console.error("[AgentSession] Failed to parse message:",e)}},n.onclose=s=>{let i,n;console.log("[AgentSession] WebSocket disconnected",s.code,s.reason),f(!1),M.current&&(clearTimeout(M.current),M.current=null);let o=R.current?Date.now()-R.current:0;if(R.current=null,o>0&&o<5e3){if(D.current++,console.log(`[AgentSession] Short-lived connection (${o}ms), count: ${D.current}, backoff attempt: ${k.current}`),D.current>=3){if(console.log("[AgentSession] Multiple short-lived connections detected, session likely invalid - will recreate"),L.current){console.log("[AgentSession] Skipping auto-restart: last session creation failed"),_("Unable to connect to remote server. Please check the server configuration.");return}e&&vN.delete(vE(e,r)),a(null),_(null),k.current=0,D.current=0,E.current=!0;return}}else o>=5e3&&(D.current=0);if(N.current||1e3===s.code)return;if(k.current>=10){console.log("[AgentSession] Max reconnect attempts reached"),_("Unable to connect to server. Please check if the backend is running.");return}let l=(n=(i=Math.min(3e4,1e3*Math.pow(2,k.current)))*Math.random()*.25,i+n);console.log(`[AgentSession] Reconnecting in ${Math.round(l)}ms (attempt ${k.current+1})`),k.current++,C.current=setTimeout(()=>{let e=S.current;e&&!N.current&&I(e)},l)},n.onerror=e=>{console.error("[AgentSession] WebSocket error:",e)}},[]),z=(0,W.useCallback)(async s=>{if(!e)return null;if(B.current)return console.log("[AgentSession] startSession already in progress, skipping"),null;B.current=!0;let n=P.current;_(null),b(null),m(!1),L.current=!1;let o=vE(e,r),l=vN.get(o);if(l)return console.log(`[AgentSession] Cache hit for ${o}, reconnecting WebSocket directly`),a(l),h(l.status),I(l.id),O.current?.(),B.current=!1,l;v(!0);try{console.log(`[AgentSession] Starting REST call: projectId=${e}, branch=${r}, agentType=${i}, generation=${n}`);let{session:l,messages:d}=await vb(e,r,s,i);if(console.log(`[AgentSession] REST response: sessionId=${l.id}, msgCount=${d?.length??0}`),P.current!==n)return console.log("[AgentSession] Discarding stale session response (generation mismatch)"),null;return vN.set(o,l),a(l),h(l.status),d&&d.length>0&&(c(d),j.current={entries:[...d],status:l.status}),I(l.id),O.current?.(),l}catch(e){if(console.error("[AgentSession] startSession error:",e),P.current!==n)return console.log("[AgentSession] Discarding error (generation mismatch)"),null;return _(e instanceof Error?e.message:"Failed to start session"),L.current=!0,null}finally{B.current=!1,P.current===n&&v(!1)}},[e,r,i,I]),F=(0,W.useCallback)(async(s,i)=>{let n=i||o?.id;if(!n)return void console.warn("[AgentSession] sendMessage: no session ID available (sessionId param:",i,", session?.id:",o?.id,")");if(("string"!=typeof s||s.trim())&&(!Array.isArray(s)||0!==s.length)){console.log(`[AgentSession] sendMessage: targetSessionId=${n}, source=${i?"explicit":"state"}`);try{let e="string"==typeof s?s.trim():s;await vw(n,e)}catch(i){let s=i instanceof Error?i.message:"Failed to send message";console.error("[AgentSession] Failed to send message:",s),s.includes("[404]")&&(e&&vN.delete(vE(e,r)),a(null),h("stopped"),m(!1),E.current=!0),_(s),vx.toast.error("Failed to send message",{description:s})}}},[o?.id]),H=(0,W.useCallback)(async()=>{if(o?.id)try{await vC(o.id)}catch(e){e instanceof Error&&e.message,console.error("[AgentSession] Failed to stop session:",e),vx.toast.error("Failed to stop session")}},[o?.id]),$=(0,W.useCallback)(async s=>{if(o?.id){e&&vN.delete(vE(e,r)),v(!0),_(null);try{await vS(o.id,s),s&&a(e=>e?{...e,agentType:s}:null)}catch(e){_(e instanceof Error?e.message:"Failed to restart session"),console.error("[AgentSession] Failed to restart session:",e)}finally{v(!1)}}},[o?.id]),K=(0,W.useCallback)(async s=>{if(o?.id){_(null);try{await vk(o.id,s),a(i=>{if(!i)return i;let n={...i,permissionMode:s};return e&&vN.set(vE(e,r),n),n})}catch(e){_(e instanceof Error?e.message:"Failed to switch mode"),console.error("[AgentSession] Failed to switch mode:",e)}}},[o?.id,e,r]),U=(0,W.useCallback)(async s=>{if(o?.id){_(null);try{await vj(o.id,s),a(s=>{if(!s)return s;let i={...s,permissionMode:"edit"};return e&&vN.set(vE(e,r),i),i})}catch(e){_(e instanceof Error?e.message:"Failed to accept plan"),console.error("[AgentSession] Failed to accept plan:",e)}}},[o?.id,e,r]);return(0,W.useEffect)(()=>()=>{w.current&&(N.current=!0,w.current.close(),S.current=null),C.current&&clearTimeout(C.current),M.current&&clearTimeout(M.current)},[]),(0,W.useEffect)(()=>{w.current&&(w.current.close(1e3,"branch-switch"),w.current=null,S.current=null),C.current&&(clearTimeout(C.current),C.current=null),M.current&&(clearTimeout(M.current),M.current=null),P.current+=1,a(null),h("stopped"),f(!1),m(!1),_(null),v(!1),b(null),c([]),j.current={entries:[],status:"stopped"},N.current=!1,k.current=0,R.current=null,D.current=0,L.current=!1,B.current=!1,E.current=!0,e&&vN.delete(vE(e,r))},[e,r,s]),(0,W.useEffect)(()=>{!E.current||!e||o||g||L.current||(E.current=!1,console.log(`[AgentSession] Auto-start: projectId=${e}, branch=${r}, agentMode=${s}`),z())},[e,o,g,z]),(0,W.useEffect)(()=>{let e=()=>{if("visible"===document.visibilityState&&o?.id&&!N.current){let e=w.current;e&&e.readyState!==WebSocket.CLOSED&&e.readyState!==WebSocket.CLOSING||(console.log("[AgentSession] Tab visible, WebSocket disconnected - reconnecting"),k.current=0,D.current=0,C.current&&(clearTimeout(C.current),C.current=null),I(o.id))}};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[o?.id,I]),(0,W.useEffect)(()=>{o?.id&&!N.current&&I(o.id)},[o?.id,I]),{session:o,messages:l,status:d,isConnected:u,isInitialized:p,isLoading:g,error:x,remoteStatus:y,startSession:z,sendMessage:F,stopSession:H,restartSession:$,switchMode:K,acceptPlan:U}}(e,r,s?.agent_mode,C,{onTaskCompleted:n,onSessionStarted:o});(0,W.useEffect)(()=>{(0,iR.getAgentProviders)().then(N).catch(()=>{})},[]),(0,W.useEffect)(()=>{T?.permissionMode&&_(T.permissionMode)},[T?.permissionMode]),(0,W.useEffect)(()=>{T?.agentType&&k(T.agentType)},[T?.agentType]);let X=(0,W.useRef)(!1);(0,W.useEffect)(()=>{let e="running"===L&&P.length>0;e&&!X.current&&a?.(),X.current=e},[L,P.length,a]);let G=async e=>{_(e),T&&await V(e)},J=async e=>{await Y(e),_("edit"),a?.()};(0,W.useImperativeHandle)(l,()=>({submitMessage:async e=>{if(T&&"running"===L)K(e);else{a?.();let r=await H(x);r&&"running"===r.status?K(e,r.id):r&&console.error(`[AgentConversation] Session ${r.id} is ${r.status}, not sending message`)}}}),[T,L,H,K,x]);let Z=async e=>{let r,s=e.text.trim(),i=e.files.length>0;if(s||i){if(v(""),R.push(s),i){let i=[];for(let r of(s&&i.push({type:"text",text:s}),e.files))if(r.mediaType&&r.url){let e=r.url.match(/^data:[^;]+;base64,(.+)$/);e&&i.push({type:"image",mediaType:r.mediaType,data:e[1]})}r=i}else r=s;if(y){let e="string"==typeof r?r:r.filter(e=>"text"===e.type).map(e=>e.text).join("\n");if(e.trim()){S(!0);try{let i=await (0,iR.translateText)(e);if(i.error){v(s),vx.toast.error("Translation failed",{description:"Disable translation to send the original text."});return}r="string"==typeof r?i.translatedText:r.map(e=>"text"===e.type?{...e,text:i.translatedText}:e)}catch{v(s),vx.toast.error("Translation failed",{description:"Disable translation to send the original text."});return}finally{S(!1)}}}if(T&&"running"===L)console.log(`[AgentConversation] handleSubmit: existing session ${T.id}, status=${L}`),K(r);else{console.log(`[AgentConversation] handleSubmit: no session or not running (session=${T?.id}, status=${L}), starting new session...`),a?.();let e=await H(x);console.log("[AgentConversation] handleSubmit: startSession returned",e?.id??"null",e?.status),e&&"running"===e.status?K(r,e.id):e&&console.error(`[AgentConversation] Session ${e.id} is ${e.status}, not sending message`)}}};return e?(0,F.jsxs)("div",{className:"h-full flex flex-col min-h-0",children:[(0,F.jsxs)("div",{className:"flex-shrink-0 flex items-center justify-between px-4 h-10 border-b border-border/60 bg-muted/20",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(nA,{className:`h-4 w-4 ${"codex"===C?"text-green-500":"text-violet-500"}`}),j.length>1?(0,F.jsx)("select",{className:"text-sm font-medium bg-transparent border border-border rounded px-1.5 py-0.5 outline-none",value:C,onChange:e=>{let r=e.target.value;k(r),T&&q(r)},disabled:null!==T&&P.length>0,children:j.map(e=>(0,F.jsx)("option",{value:e.type,disabled:!e.available,children:e.displayName},e.type))}):(0,F.jsx)("span",{className:"text-sm font-medium",children:"codex"===C?"Codex":"Claude Code"}),(0,F.jsx)(yf,{mode:x,onModeChange:G,disabled:O}),D.length>=1&&i&&(0,F.jsx)(nL,{targets:D,activeTarget:s?.agent_mode??"local",onTargetChange:i}),T&&(c=T.id.startsWith("remote-"),d="text-muted-foreground",h=(0,F.jsx)(yd,{className:"h-3 w-3"}),u="Disconnected",B&&(c&&"connected"!==z&&null!==z?"reconnecting"===z?(d="text-amber-500",h=(0,F.jsx)(yc,{className:"h-3 w-3 animate-pulse"}),u="Reconnecting..."):"disconnected"===z&&(d="text-red-500",h=(0,F.jsx)(yd,{className:"h-3 w-3"}),u="Remote disconnected"):(d="text-green-500",h=(0,F.jsx)(yc,{className:"h-3 w-3"}),u="Connected")),(0,F.jsxs)("span",{className:`flex items-center gap-1 text-xs ${d}`,children:[h,u]}))]}),T&&(0,F.jsxs)("div",{className:"flex items-center gap-1",children:[(0,F.jsx)($.Button,{variant:"ghost",size:"icon",onClick:()=>q(),disabled:O,className:"h-7 w-7",title:"New Conversation",children:(0,F.jsx)(ik,{className:"h-3.5 w-3.5"})}),"running"===T.status&&(0,F.jsxs)($.Button,{variant:"ghost",size:"sm",onClick:()=>U(),className:"h-7 text-xs",children:[(0,F.jsx)(lc,{className:"h-3 w-3 mr-1"}),"Stop"]})]})]}),(0,F.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[(0,F.jsxs)(xZ,{className:"h-full",initial:"instant",children:[(0,F.jsxs)(xQ,{className:"gap-1 p-4",children:[T||0!==P.length?(0,F.jsx)(yv.Provider,{value:{sendMessage:K,messages:P,acceptPlan:J,permissionMode:T?.permissionMode??x,agentType:T?.agentType??C,sessionId:T?.id??null},children:(0,F.jsxs)("div",{className:"space-y-1",ref:E,children:[P.map((e,r)=>"user"===e.type?(0,F.jsx)("div",{"data-user-msg-idx":r,children:(0,F.jsx)(xL,{message:e,messageIndex:r})},r):(0,F.jsx)(xL,{message:e,messageIndex:r},r)),O&&(0,F.jsxs)("div",{className:"flex items-center gap-2 py-4 text-muted-foreground",children:[(0,F.jsx)(yl,{className:"h-4 w-4"}),(0,F.jsx)("span",{className:"text-sm",children:"Connecting to agent..."})]})]})}):(0,F.jsx)("div",{className:"text-center py-16",children:O||e&&!A?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(yl,{className:"h-6 w-6 mx-auto mb-4"}),(0,F.jsx)("h3",{className:"text-sm font-semibold mb-1 text-foreground",children:"Connecting to agent..."}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Setting up the session for this worktree"})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"mx-auto w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mb-4",children:(0,F.jsx)(nA,{className:"h-6 w-6 text-primary/60"})}),(0,F.jsx)("h3",{className:"text-sm font-semibold mb-1 text-foreground",children:"Start a conversation"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ask the agent to help you with coding tasks in this worktree"})]})}),I&&(0,F.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-red-500/10 rounded-lg text-red-500 text-sm mt-4",children:[(0,F.jsx)(vT,{className:"h-4 w-4"}),I]})]}),(0,F.jsx)(x0,{})]}),(0,F.jsx)(ym,{messages:P,contentRef:E})]}),(0,F.jsx)("div",{className:"flex-shrink-0 border-t border-border/60 p-3",children:(0,F.jsxs)(_6,{onSubmit:Z,accept:"image/*",className:"w-full",children:[(0,F.jsx)(yg,{}),(0,F.jsxs)("div",{className:"relative flex w-full flex-col",children:[y&&(0,F.jsx)("div",{className:"flex items-center pl-12 pr-2 pt-1.5 pb-0.5",children:(0,F.jsxs)("button",{type:"button",onClick:()=>b(!1),className:"inline-flex shrink-0 items-center gap-1.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 px-2.5 py-0.5 text-xs font-medium hover:bg-blue-500/20 transition-colors",children:[w?(0,F.jsx)(iE,{className:"size-3 animate-spin"}):(0,F.jsx)(yh,{className:"size-3"}),"Translate",(0,F.jsx)(i9,{className:"size-3"})]})}),(0,F.jsxs)("div",{className:"flex w-full items-center",children:[(0,F.jsxs)(ye,{children:[(0,F.jsx)(yt,{className:"ml-1"}),(0,F.jsxs)(yr,{children:[(0,F.jsx)(_4,{label:"Add images"}),(0,F.jsxs)(ys,{onSelect:()=>{b(!y)},children:[(0,F.jsx)(yh,{className:"mr-2 size-4"}),y?"Disable translation":"Translate"]})]})]}),(0,F.jsx)(_8,{value:g,onChange:e=>v(e.target.value),onKeyDown:R.handleKeyDown,placeholder:T?"Ask the agent to help with your code...":"Type your first message to start...",className:"pr-12"}),(0,F.jsx)(yi,{className:"absolute bottom-1 right-1",disabled:!g.trim()&&!O||w,status:w?"submitted":O?"streaming":"ready"})]})]})]})})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nA,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to start coding"})]})})});function yy(){return"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}function yb(e){let r={};e&&(r["Content-Type"]=e);let s=(0,iR.getAuthToken)();return s&&(r.Authorization=`Bearer ${s}`),r}async function yw(e,r){let s=await fetch(`${yy()}/api/projects/${e}/chat-sessions`,{method:"POST",headers:yb("application/json"),body:JSON.stringify({branch:r})});if(!s.ok)throw Error("Failed to create chat session");return s.json()}async function yS(e,r){if(!(await fetch(`${yy()}/api/chat-sessions/${e}/message`,{method:"POST",headers:yb("application/json"),body:JSON.stringify({content:r})})).ok)throw Error("Failed to send message")}async function yC(e){if(!(await fetch(`${yy()}/api/chat-sessions/${e}/stop`,{method:"POST",headers:yb()})).ok)throw Error("Failed to stop generation")}let yk=new Map;function yj(e,r){return`chat:${e}:${r??""}`}var yN=e.i(286235);function yE({projectId:e,branch:r}){let{session:s,messages:i,status:n,isInitialized:o,isLoading:a,error:l,sendMessage:c,stopGeneration:d}=function(e,r){let[s,i]=(0,W.useState)(null),[n,o]=(0,W.useState)([]),[a,l]=(0,W.useState)("stopped"),[c,d]=(0,W.useState)(!1),[h,u]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,g]=(0,W.useState)(null),v=(0,W.useRef)(null),x=(0,W.useRef)(null),_=(0,W.useRef)(0),y=(0,W.useRef)({entries:[],status:"stopped"}),b=(0,W.useRef)(!1),w=(0,W.useRef)(!0),S=(0,W.useRef)(!1),C=(0,W.useRef)(0),k=(0,W.useRef)(null),j=(0,W.useRef)(null),N=(0,W.useRef)(0),E=(0,W.useRef)(!1),R=(0,W.useCallback)(n=>{if(v.current?.readyState===WebSocket.OPEN||v.current?.readyState===WebSocket.CONNECTING)return;y.current={entries:[],status:"stopped"},b.current=!1,S.current=!0;let a=new WebSocket((0,iR.getWebSocketUrl)(`/api/chat-sessions/${n}/stream`));v.current=a,a.onopen=()=>{d(!0),g(null),k.current=Date.now(),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{_.current=0,N.current=0},5e3)},a.onmessage=s=>{try{let c=JSON.parse(s.data);if("JsonPatch"in c){var i,n;i=y.current,n=c.JsonPatch,y.current=vv(i,e=>{for(let r of n){let{op:s,path:i,value:n}=r;if("/entries"===i&&"replace"===s&&n?.type==="ENTRY"&&n.content?.type==="system"&&n.content?.content==="__CLEAR_ALL__"){e.entries=[];continue}if(i.startsWith("/entries/")){let r=parseInt(i.replace("/entries/",""),10);if(isNaN(r)||n?.type!=="ENTRY")continue;switch(s){case"add":for(;e.entries.length<=r;)e.entries.push(null);e.entries[r]=n.content;break;case"replace":r<e.entries.length&&(e.entries[r]=n.content);break;case"remove":r<e.entries.length&&e.entries.splice(r,1)}}else"/status"===i&&n?.type==="STATUS"&&(e.status=n.content)}}),S.current||(o([...y.current.entries.filter(Boolean)]),l(y.current.status));return}if("Ready"in c){S.current=!1,o([...y.current.entries.filter(Boolean)]),l(y.current.status),u(!0);return}if("finished"in c){b.current=!0,a.close(1e3,"finished");return}if("openPreviewFrame"in c)return void(0,gz.openPreviewFrame)(c.openPreviewFrame.projectId,c.openPreviewFrame.url);if("browserCommand"in c){let r=c.browserCommand;e&&(0,gz.sendCommandToIframe)(e,{type:"vibedeckx-command",...r}).then(e=>{e&&a.readyState===WebSocket.OPEN&&a.send(JSON.stringify({type:"browser_result",result:{id:r.id,success:e.success??!1,error:e.error,content:e.content,found:e.found,tag:e.tag,text:e.text}}))});return}if("error"in c){g(c.error),"Session not found"===c.error&&(e&&yk.delete(yj(e,r)),b.current=!0);return}}catch(e){console.error("[ChatSession] Failed to parse message:",e)}},a.onclose=n=>{let o,a;d(!1),j.current&&(clearTimeout(j.current),j.current=null);let l=k.current?Date.now()-k.current:0;if(k.current=null,l>0&&l<5e3){if(N.current++,N.current>=3)return E.current?void g("Unable to connect to remote server. Please check the server configuration."):(e&&yk.delete(yj(e,r)),i(null),g(null),_.current=0,N.current=0,void(w.current=!0))}else l>=5e3&&(N.current=0);if(b.current||1e3===n.code)return;if(_.current>=10)return void g("Unable to connect to server.");let c=(a=(o=Math.min(3e4,1e3*Math.pow(2,_.current)))*Math.random()*.25,o+a);_.current++,x.current=setTimeout(()=>{s?.id&&!b.current&&R(s.id)},c)},a.onerror=()=>{}},[s?.id]),M=(0,W.useCallback)(async()=>{if(!e)return null;let s=C.current;g(null),u(!1),E.current=!1;let n=yj(e,r),a=yk.get(n);if(a)return i(a),l(a.status),R(a.id),a;p(!0);try{let{session:a,messages:c}=await yw(e,r);if(C.current!==s)return null;return yk.set(n,a),i(a),l(a.status),c&&c.length>0&&o(c),R(a.id),a}catch(e){if(C.current!==s)return null;return g(e instanceof Error?e.message:"Failed to start session"),E.current=!0,null}finally{C.current===s&&p(!1)}},[e,r,R]),D=(0,W.useCallback)(async e=>{let r=s?.id;if(r&&e.trim())try{await yS(r,e.trim())}catch(r){let e=r instanceof Error?r.message:"Failed to send message";g(e),vx.toast.error("Failed to send message",{description:e})}},[s?.id]),T=(0,W.useCallback)(async()=>{if(s?.id)try{await yC(s.id)}catch(e){console.error("[ChatSession] Failed to stop generation:",e)}},[s?.id]);return(0,W.useEffect)(()=>()=>{v.current&&(b.current=!0,v.current.close()),x.current&&clearTimeout(x.current),j.current&&clearTimeout(j.current)},[]),(0,W.useEffect)(()=>{v.current&&(v.current.close(1e3,"branch-switch"),v.current=null),x.current&&(clearTimeout(x.current),x.current=null),j.current&&(clearTimeout(j.current),j.current=null),C.current+=1,i(null),l("stopped"),d(!1),u(!1),g(null),p(!1),y.current={entries:[],status:"stopped"},b.current=!1,_.current=0,k.current=null,N.current=0,E.current=!1,w.current=!0},[e,r]),(0,W.useEffect)(()=>{!w.current||!e||s||f||E.current||(w.current=!1,M())},[e,s,f,M]),(0,W.useEffect)(()=>{!s?.id||c||b.current||R(s.id)},[s?.id,c,R]),{session:s,messages:n,status:a,isConnected:c,isInitialized:h,isLoading:f,error:m,sendMessage:D,stopGeneration:T}}(e,r),[h,u]=(0,W.useState)(""),[f,p]=(0,W.useState)(!1),m="running"===n,g=(0,W.useCallback)(async e=>{let r=e.text.trim();r&&(u(""),await c(r))},[c]);return e?(0,F.jsxs)("div",{className:"h-full flex flex-col min-h-0",children:[(0,F.jsxs)("div",{className:"flex-shrink-0 flex items-center justify-between px-4 h-10 border-b border-border/60 bg-muted/20",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(f3,{className:"h-3.5 w-3.5 text-primary"}),(0,F.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Main Chat"}),m&&(0,F.jsx)(iE,{className:"h-3 w-3 animate-spin text-primary/60"})]}),s&&(0,F.jsx)($.Button,{variant:"ghost",size:"icon",onClick:async()=>{let e=!f;try{await iR.api.setChatEventListening(s.id,e),p(e)}catch{vx.toast.error("Failed to toggle event listening")}},className:`h-7 w-7 ${f?"text-amber-500":""}`,title:f?"Listening to executor events (click to disable)":"Listen to executor events (click to enable)",children:(0,F.jsx)(yN.Radio,{className:"h-3.5 w-3.5"})})]}),(0,F.jsxs)(xZ,{className:"flex-1 min-h-0",initial:"instant",children:[(0,F.jsxs)(xQ,{className:"gap-4 p-4",children:[a&&0===i.length&&(0,F.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,F.jsx)(iE,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),!a&&o&&0===i.length&&(0,F.jsxs)("div",{className:"text-center py-16",children:[(0,F.jsx)("div",{className:"mx-auto w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mb-4",children:(0,F.jsx)(f3,{className:"h-6 w-6 text-primary/60"})}),(0,F.jsx)("h3",{className:"text-sm font-semibold mb-1 text-foreground",children:"Start a conversation"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Chat with the AI assistant about your project"})]}),i.map((e,r)=>"user"===e.type?(0,F.jsx)(vG,{from:"user",children:(0,F.jsx)(vJ,{children:e.content})},r):"assistant"===e.type?(0,F.jsx)(vG,{from:"assistant",children:(0,F.jsx)(vJ,{children:(0,F.jsx)(vZ,{children:e.content})})},r):"tool_use"===e.type?(0,F.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 text-xs text-muted-foreground",children:[(0,F.jsx)(vI,{className:"w-3.5 h-3.5 animate-pulse"}),(0,F.jsx)("span",{children:function(e){switch(e){case"getExecutorStatus":return"Checking executor status...";case"getAgentConversation":return"Checking agent conversation...";case"listTerminals":return"Listing terminals...";case"runInTerminal":return"Sending command to terminal...";default:return`Running ${e}...`}}(e.tool)})]},r):"tool_result"===e.type?(0,F.jsx)("div",{className:"px-4 py-2",children:(0,F.jsxs)("details",{className:"text-xs text-muted-foreground",children:[(0,F.jsx)("summary",{className:"cursor-pointer hover:text-foreground",children:"Tool result"}),(0,F.jsx)("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:e.output})]})},r):"error"===e.type?(0,F.jsx)("div",{className:"mx-auto max-w-[90%] rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:e.message},r):null),l&&(0,F.jsx)("div",{className:"mx-auto max-w-[90%] rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:l})]}),(0,F.jsx)(x0,{})]}),(0,F.jsxs)("div",{className:"flex-shrink-0 border-t border-border/60 p-3",children:[m&&(0,F.jsx)("div",{className:"flex justify-center mb-2",children:(0,F.jsxs)($.Button,{variant:"outline",size:"sm",onClick:d,className:"gap-1.5",children:[(0,F.jsx)(lc,{className:"h-3 w-3"}),"Stop generating"]})}),(0,F.jsxs)(_6,{onSubmit:g,className:"w-full",children:[(0,F.jsx)(_8,{disabled:!o||m,placeholder:o?m?"Waiting for response...":"Type a message...":"Connecting...",className:"pr-12",value:h,onChange:e=>u(e.currentTarget.value)}),(0,F.jsx)(yi,{className:"absolute bottom-1 right-1",disabled:!o||m||!h.trim()})]})]})]}):(0,F.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(f3,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to start chatting"})]})})}let yR=(0,W.createContext)(null);yR.displayName="PanelGroupContext";let yM="data-panel-group-direction",yD="data-panel-group-id",yT="data-resize-handle",yP="data-panel-resize-handle-id",yL=W.useLayoutEffect,yB=W["useId".toString()],yA="function"==typeof yB?yB:()=>null,yO=0;function yI(e=null){let r=yA(),s=(0,W.useRef)(e||r||null);return null===s.current&&(s.current=""+yO++),null!=e?e:s.current}function yz({children:e,className:r="",collapsedSize:s,collapsible:i,defaultSize:n,forwardedRef:o,id:a,maxSize:l,minSize:c,onCollapse:d,onExpand:h,onResize:u,order:f,style:p,tagName:m="div",...g}){let v=(0,W.useContext)(yR);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:x,expandPanel:_,getPanelSize:y,getPanelStyle:b,groupId:w,isPanelCollapsed:S,reevaluatePanelConstraints:C,registerPanel:k,resizePanel:j,unregisterPanel:N}=v,E=yI(a),R=(0,W.useRef)({callbacks:{onCollapse:d,onExpand:h,onResize:u},constraints:{collapsedSize:s,collapsible:i,defaultSize:n,maxSize:l,minSize:c},id:E,idIsFromProps:void 0!==a,order:f});(0,W.useRef)({didLogMissingDefaultSizeWarning:!1}),yL(()=>{let{callbacks:e,constraints:r}=R.current,o={...r};R.current.id=E,R.current.idIsFromProps=void 0!==a,R.current.order=f,e.onCollapse=d,e.onExpand=h,e.onResize=u,r.collapsedSize=s,r.collapsible=i,r.defaultSize=n,r.maxSize=l,r.minSize=c,(o.collapsedSize!==r.collapsedSize||o.collapsible!==r.collapsible||o.maxSize!==r.maxSize||o.minSize!==r.minSize)&&C(R.current,o)}),yL(()=>{let e=R.current;return k(e),()=>{N(e)}},[f,E,k,N]),(0,W.useImperativeHandle)(o,()=>({collapse:()=>{x(R.current)},expand:e=>{_(R.current,e)},getId:()=>E,getSize:()=>y(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{j(R.current,e)}}),[x,_,y,S,E,j]);let M=b(R.current,n);return(0,W.createElement)(m,{...g,children:e,className:r,id:E,style:{...M,...p},[yD]:w,"data-panel":"","data-panel-collapsible":i||void 0,"data-panel-id":E,"data-panel-size":parseFloat(""+M.flexGrow).toFixed(1)})}let yF=(0,W.forwardRef)((e,r)=>(0,W.createElement)(yz,{...e,forwardedRef:r}));yz.displayName="Panel",yF.displayName="forwardRef(Panel)";let yW=null,yH=-1,y$=null;function yK(e,s){var i,n,o;let a=function(e,r){if(r){let e=(r&y0)!=0,s=(r&y1)!=0,i=(r&y2)!=0,n=(r&y5)!=0;if(e)if(i)return"se-resize";else if(n)return"ne-resize";else return"e-resize";if(s)if(i)return"sw-resize";else if(n)return"nw-resize";else return"w-resize";if(i)return"s-resize";else if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,s);yW!==a&&(yW=a,null===y$&&(y$=document.createElement("style"),r&&y$.setAttribute("nonce",r),document.head.appendChild(y$)),yH>=0&&(null==(o=y$.sheet)||o.removeRule(yH)),yH=null!=(i=null==(n=y$.sheet)?void 0:n.insertRule(`*{cursor: ${a} !important;}`))?i:-1)}function yU(e){return"keydown"===e.type}function yq(e){return e.type.startsWith("pointer")}function yV(e){return e.type.startsWith("mouse")}function yY(e){if(yq(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(yV(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}let yX=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function yG(e){let r=e.length;for(;r--;){let s=e[r];if(bc(s,"Missing node"),function(e){var r;let s,i=getComputedStyle(e);return"fixed"===i.position||!!("auto"!==i.zIndex&&("static"!==i.position||"flex"===(s=getComputedStyle(null!=(r=yQ(e))?r:e).display)||"inline-flex"===s)||1>+i.opacity||"transform"in i&&"none"!==i.transform||"webkitTransform"in i&&"none"!==i.webkitTransform||"mixBlendMode"in i&&"normal"!==i.mixBlendMode||"filter"in i&&"none"!==i.filter||"webkitFilter"in i&&"none"!==i.webkitFilter||"isolation"in i&&"isolate"===i.isolation||yX.test(i.willChange))||"touch"===i.webkitOverflowScrolling}(s))return s}return null}function yJ(e){return e&&Number(getComputedStyle(e).zIndex)||0}function yZ(e){let r=[];for(;e;)r.push(e),e=yQ(e);return r}function yQ(e){let{parentNode:r}=e;return r&&r instanceof ShadowRoot?r.host:r}let y0=1,y1=2,y2=4,y5=8,y3="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}(),y4=[],y6=!1,y8=new Map,y7=new Map,y9=new Set;function be(e){let{target:r}=e,{x:s,y:i}=yY(e);y6=!0,bi({target:r,x:s,y:i}),ba(),y4.length>0&&(bl("down",e),e.preventDefault(),bs(r)||e.stopImmediatePropagation())}function bt(e){let{x:r,y:s}=yY(e);if(y6&&0===e.buttons&&(y6=!1,bl("up",e)),!y6){let{target:i}=e;bi({target:i,x:r,y:s})}bl("move",e),bn(),y4.length>0&&e.preventDefault()}function br(e){let{target:r}=e,{x:s,y:i}=yY(e);y7.clear(),y6=!1,y4.length>0&&(e.preventDefault(),bs(r)||e.stopImmediatePropagation()),bl("up",e),bi({target:r,x:s,y:i}),bn(),ba()}function bs(e){let r=e;for(;r;){if(r.hasAttribute(yT))return!0;r=r.parentElement}return!1}function bi({target:e,x:r,y:s}){y4.splice(0);let i=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(i=e),y9.forEach(e=>{let{element:n,hitAreaMargins:o}=e,a=n.getBoundingClientRect(),{bottom:l,left:c,right:d,top:h}=a,u=y3?o.coarse:o.fine;if(r>=c-u&&r<=d+u&&s>=h-u&&s<=l+u){if(null!==i&&document.contains(i)&&n!==i&&!n.contains(i)&&!i.contains(n)&&function(e,r){let s;if(e===r)throw Error("Cannot compare node with itself");let i={a:yZ(e),b:yZ(r)};for(;i.a.at(-1)===i.b.at(-1);)e=i.a.pop(),r=i.b.pop(),s=e;bc(s,"Stacking order can only be calculated for elements with a common ancestor");let n={a:yJ(yG(i.a)),b:yJ(yG(i.b))};if(n.a===n.b){let e=s.childNodes,r={a:i.a.at(-1),b:i.b.at(-1)},n=e.length;for(;n--;){let s=e[n];if(s===r.a)return 1;if(s===r.b)return -1}}return Math.sign(n.a-n.b)}(i,n)>0){let e=i,r=!1;for(;e;){var f;if(e.contains(n))break;if(f=e.getBoundingClientRect(),f.x<a.x+a.width&&f.x+f.width>a.x&&f.y<a.y+a.height&&f.y+f.height>a.y){r=!0;break}e=e.parentElement}if(r)return}y4.push(e)}})}function bn(){let e=!1,r=!1;y4.forEach(s=>{let{direction:i}=s;"horizontal"===i?e=!0:r=!0});let s=0;y7.forEach(e=>{s|=e}),e&&r?yK("intersection",s):e?yK("horizontal",s):r?yK("vertical",s):null!==y$&&(document.head.removeChild(y$),yW=null,y$=null,yH=-1)}let bo=new AbortController;function ba(){bo.abort();let e={capture:!0,signal:(bo=new AbortController).signal};y9.size&&(y6?(y4.length>0&&y8.forEach((r,s)=>{let{body:i}=s;r>0&&(i.addEventListener("contextmenu",br,e),i.addEventListener("pointerleave",bt,e),i.addEventListener("pointermove",bt,e))}),window.addEventListener("pointerup",br,e),window.addEventListener("pointercancel",br,e)):y8.forEach((r,s)=>{let{body:i}=s;r>0&&(i.addEventListener("pointerdown",be,e),i.addEventListener("pointermove",bt,e))}))}function bl(e,r){y9.forEach(s=>{let{setResizeHandlerState:i}=s;i(e,y4.includes(s),r)})}function bc(e,r){if(!e)throw console.error(r),Error(r)}function bd(e,r,s=10){return e.toFixed(s)===r.toFixed(s)?0:e>r?1:-1}function bh(e,r,s=10){return 0===bd(e,r,s)}function bu(e,r,s){return 0===bd(e,r,s)}function bf({panelConstraints:e,panelIndex:r,size:s}){let i=e[r];bc(null!=i,`Panel constraints not found for index ${r}`);let{collapsedSize:n=0,collapsible:o,maxSize:a=100,minSize:l=0}=i;return 0>bd(s,l)&&(s=o&&0>bd(s,(n+l)/2)?n:l),s=parseFloat((s=Math.min(a,s)).toFixed(10))}function bp({delta:e,initialLayout:r,panelConstraints:s,pivotIndices:i,prevLayout:n,trigger:o}){if(bu(e,0))return r;let a=[...r],[l,c]=i;bc(null!=l,"Invalid first pivot index"),bc(null!=c,"Invalid second pivot index");let d=0;if("keyboard"===o){{let i=e<0?c:l,n=s[i];bc(n,`Panel constraints not found for index ${i}`);let{collapsedSize:o=0,collapsible:a,minSize:d=0}=n;if(a){let s=r[i];if(bc(null!=s,`Previous layout not found for panel index ${i}`),bu(s,o)){let r=d-s;bd(r,Math.abs(e))>0&&(e=e<0?0-r:r)}}}{let i=e<0?l:c,n=s[i];bc(n,`No panel constraints found for index ${i}`);let{collapsedSize:o=0,collapsible:a,minSize:d=0}=n;if(a){let s=r[i];if(bc(null!=s,`Previous layout not found for panel index ${i}`),bu(s,d)){let r=s-o;bd(r,Math.abs(e))>0&&(e=e<0?0-r:r)}}}}{let i=e<0?1:-1,n=e<0?c:l,o=0;for(;;){let e=r[n];if(bc(null!=e,`Previous layout not found for panel index ${n}`),o+=bf({panelConstraints:s,panelIndex:n,size:100})-e,(n+=i)<0||n>=s.length)break}let a=Math.min(Math.abs(e),Math.abs(o));e=e<0?0-a:a}{let i=e<0?l:c;for(;i>=0&&i<s.length;){let n=Math.abs(e)-Math.abs(d),o=r[i];bc(null!=o,`Previous layout not found for panel index ${i}`);let l=bf({panelConstraints:s,panelIndex:i,size:o-n});if(!bu(o,l)&&(d+=o-l,a[i]=l,d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?i--:i++}}if(function(e,r,s){if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(!bu(e[s],r[s],void 0))return!1;return!0}(n,a))return n;{let i=e<0?c:l,n=r[i];bc(null!=n,`Previous layout not found for panel index ${i}`);let o=n+d,h=bf({panelConstraints:s,panelIndex:i,size:o});if(a[i]=h,!bu(h,o)){let r=o-h,i=e<0?c:l;for(;i>=0&&i<s.length;){let n=a[i];bc(null!=n,`Previous layout not found for panel index ${i}`);let o=bf({panelConstraints:s,panelIndex:i,size:n+r});if(bu(n,o)||(r-=o-n,a[i]=o),bu(r,0))break;e>0?i--:i++}}}return bu(a.reduce((e,r)=>r+e,0),100)?a:n}function bm(e,r=document){return Array.from(r.querySelectorAll(`[${yP}][data-panel-group-id="${e}"]`))}function bg(e,r,s=document){let i=bm(e,s).findIndex(e=>e.getAttribute(yP)===r);return null!=i?i:null}function bv(e,r,s){let i=bg(e,r,s);return null!=i?[i,i+1]:[-1,-1]}function bx(e,r=document){var s;if(r instanceof HTMLElement&&(null==r||null==(s=r.dataset)?void 0:s.panelGroupId)==e)return r;let i=r.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return i||null}function b_(e,r=document){let s=r.querySelector(`[${yP}="${e}"]`);return s||null}function by(e,r){if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==r[s])return!1;return!0}function bb(e,r){let{x:s,y:i}=yY(r);return"horizontal"===e?s:i}function bw(e,r,s){r.forEach((r,i)=>{let n=e[i];bc(n,`Panel data not found for index ${i}`);let{callbacks:o,constraints:a,id:l}=n,{collapsedSize:c=0,collapsible:d}=a,h=s[l];if(null==h||r!==h){s[l]=r;let{onCollapse:e,onExpand:i,onResize:n}=o;n&&n(r,h),d&&(e||i)&&(i&&(null==h||bh(h,c))&&!bh(r,c)&&i(),e&&(null==h||!bh(h,c))&&bh(r,c)&&e())}})}function bS(e,r){if(e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=r[s])return!1;return!0}function bC(e){try{if("undefined"!=typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw Error("localStorage not supported in this environment")}catch(r){console.error(r),e.getItem=()=>null,e.setItem=()=>{}}}function bk(e){return`react-resizable-panels:${e}`}function bj(e){return e.map(e=>{let{constraints:r,id:s,idIsFromProps:i,order:n}=e;return i?s:n?`${n}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function bN(e,r){try{let s=bk(e),i=r.getItem(s);if(i){let e=JSON.parse(i);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}function bE(e,r,s,i,n){var o;let a=bk(e),l=bj(r),c=null!=(o=bN(e,n))?o:{};c[l]={expandToSizes:Object.fromEntries(s.entries()),layout:i};try{n.setItem(a,JSON.stringify(c))}catch(e){console.error(e)}}function bR({layout:e,panelConstraints:r}){let s=[...e],i=s.reduce((e,r)=>e+r,0);if(s.length!==r.length)throw Error(`Invalid ${r.length} panel layout: ${s.map(e=>`${e}%`).join(", ")}`);if(!bu(i,100)&&s.length>0)for(let e=0;e<r.length;e++){let r=s[e];bc(null!=r,`No layout data found for index ${e}`);let n=100/i*r;s[e]=n}let n=0;for(let e=0;e<r.length;e++){let i=s[e];bc(null!=i,`No layout data found for index ${e}`);let o=bf({panelConstraints:r,panelIndex:e,size:i});i!=o&&(n+=i-o,s[e]=o)}if(!bu(n,0))for(let e=0;e<r.length;e++){let i=s[e];bc(null!=i,`No layout data found for index ${e}`);let o=bf({panelConstraints:r,panelIndex:e,size:i+n});if(i!==o&&(n-=o-i,s[e]=o,bu(n,0)))break}return s}let bM={getItem:e=>(bC(bM),bM.getItem(e)),setItem:(e,r)=>{bC(bM),bM.setItem(e,r)}},bD={};function bT({autoSaveId:e=null,children:r,className:s="",direction:i,forwardedRef:n,id:o=null,onLayout:a=null,keyboardResizeBy:l=null,storage:c=bM,style:d,tagName:h="div",...u}){let f=yI(o),p=(0,W.useRef)(null),[m,g]=(0,W.useState)(null),[v,x]=(0,W.useState)([]),_=function(){let[e,r]=(0,W.useState)(0);return(0,W.useCallback)(()=>r(e=>e+1),[])}(),y=(0,W.useRef)({}),b=(0,W.useRef)(new Map),w=(0,W.useRef)(0),S=(0,W.useRef)({autoSaveId:e,direction:i,dragState:m,id:f,keyboardResizeBy:l,onLayout:a,storage:c}),C=(0,W.useRef)({layout:v,panelDataArray:[],panelDataArrayChanged:!1});(0,W.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,W.useImperativeHandle)(n,()=>({getId:()=>S.current.id,getLayout:()=>{let{layout:e}=C.current;return e},setLayout:e=>{let{onLayout:r}=S.current,{layout:s,panelDataArray:i}=C.current,n=bR({layout:e,panelConstraints:i.map(e=>e.constraints)});by(s,n)||(x(n),C.current.layout=n,r&&r(n),bw(i,n,y.current))}}),[]),yL(()=>{S.current.autoSaveId=e,S.current.direction=i,S.current.dragState=m,S.current.id=f,S.current.onLayout=a,S.current.storage=c}),function({committedValuesRef:e,eagerValuesRef:r,groupId:s,layout:i,panelDataArray:n,panelGroupElement:o,setLayout:a}){(0,W.useRef)({didWarnAboutMissingResizeHandle:!1}),yL(()=>{if(!o)return;let e=bm(s,o);for(let r=0;r<n.length-1;r++){let{valueMax:s,valueMin:o,valueNow:a}=function({layout:e,panelsArray:r,pivotIndices:s}){let i=0,n=100,o=0,a=0,l=s[0];return bc(null!=l,"No pivot index found"),r.forEach((e,r)=>{let{constraints:s}=e,{maxSize:c=100,minSize:d=0}=s;r===l?(i=d,n=c):(o+=d,a+=c)}),{valueMax:Math.min(n,100-o),valueMin:Math.max(i,100-a),valueNow:e[l]}}({layout:i,panelsArray:n,pivotIndices:[r,r+1]}),l=e[r];if(null==l);else{let e=n[r];bc(e,`No panel data found for index "${r}"`),l.setAttribute("aria-controls",e.id),l.setAttribute("aria-valuemax",""+Math.round(s)),l.setAttribute("aria-valuemin",""+Math.round(o)),l.setAttribute("aria-valuenow",null!=a?""+Math.round(a):"")}}return()=>{e.forEach((e,r)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")})}},[s,i,n,o]),(0,W.useEffect)(()=>{if(!o)return;let e=r.current;bc(e,"Eager values not found");let{panelDataArray:n}=e;bc(null!=bx(s,o),`No group found for id "${s}"`);let l=bm(s,o);bc(l,`No resize handles found for group id "${s}"`);let c=l.map(e=>{let r=e.getAttribute(yP);bc(r,"Resize handle element has no handle id attribute");let[l,c]=function(e,r,s,i=document){var n,o,a,l;let c=b_(r,i),d=bm(e,i),h=c?d.indexOf(c):-1;return[null!=(n=null==(o=s[h])?void 0:o.id)?n:null,null!=(a=null==(l=s[h+1])?void 0:l.id)?a:null]}(s,r,n,o);if(null==l||null==c)return()=>{};let d=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let c=n.findIndex(e=>e.id===l);if(c>=0){let e=n[c];bc(e,`No panel data found for index ${c}`);let l=i[c],{collapsedSize:d=0,collapsible:h,minSize:u=0}=e.constraints;if(null!=l&&h){let e=bp({delta:bu(l,d)?u-d:d-l,initialLayout:i,panelConstraints:n.map(e=>e.constraints),pivotIndices:bv(s,r,o),prevLayout:i,trigger:"keyboard"});i!==e&&a(e)}}}};return e.addEventListener("keydown",d),()=>{e.removeEventListener("keydown",d)}});return()=>{c.forEach(e=>e())}},[o,e,r,s,i,n,a])}({committedValuesRef:S,eagerValuesRef:C,groupId:f,layout:v,panelDataArray:C.current.panelDataArray,setLayout:x,panelGroupElement:p.current}),(0,W.useEffect)(()=>{let{panelDataArray:r}=C.current;if(e){if(0===v.length||v.length!==r.length)return;let s=bD[e];null==s&&(s=function(e,r=10){let s=null;return(...i)=>{null!==s&&clearTimeout(s),s=setTimeout(()=>{e(...i)},r)}}(bE,100),bD[e]=s),s(e,[...r],new Map(b.current),v,c)}},[e,v,c]),(0,W.useEffect)(()=>{});let k=(0,W.useCallback)(e=>{let{onLayout:r}=S.current,{layout:s,panelDataArray:i}=C.current;if(e.constraints.collapsible){let n=i.map(e=>e.constraints),{collapsedSize:o=0,panelSize:a,pivotIndices:l}=bB(i,e,s);if(bc(null!=a,`Panel size not found for panel "${e.id}"`),!bh(a,o)){b.current.set(e.id,a);let c=bp({delta:bL(i,e)===i.length-1?a-o:o-a,initialLayout:s,panelConstraints:n,pivotIndices:l,prevLayout:s,trigger:"imperative-api"});bS(s,c)||(x(c),C.current.layout=c,r&&r(c),bw(i,c,y.current))}}},[]),j=(0,W.useCallback)((e,r)=>{let{onLayout:s}=S.current,{layout:i,panelDataArray:n}=C.current;if(e.constraints.collapsible){let o=n.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l=0,minSize:c=0,pivotIndices:d}=bB(n,e,i),h=null!=r?r:c;if(bh(l,a)){let r=b.current.get(e.id),a=null!=r&&r>=h?r:h,c=bp({delta:bL(n,e)===n.length-1?l-a:a-l,initialLayout:i,panelConstraints:o,pivotIndices:d,prevLayout:i,trigger:"imperative-api"});bS(i,c)||(x(c),C.current.layout=c,s&&s(c),bw(n,c,y.current))}}},[]),N=(0,W.useCallback)(e=>{let{layout:r,panelDataArray:s}=C.current,{panelSize:i}=bB(s,e,r);return bc(null!=i,`Panel size not found for panel "${e.id}"`),i},[]),E=(0,W.useCallback)((e,r)=>{let{panelDataArray:s}=C.current,i=bL(s,e);return function({defaultSize:e,dragState:r,layout:s,panelData:i,panelIndex:n,precision:o=3}){let a=s[n];return{flexBasis:0,flexGrow:null==a?void 0!=e?e.toPrecision(o):"1":1===i.length?"1":a.toPrecision(o),flexShrink:1,overflow:"hidden",pointerEvents:null!==r?"none":void 0}}({defaultSize:r,dragState:m,layout:v,panelData:s,panelIndex:i})},[m,v]),R=(0,W.useCallback)(e=>{let{layout:r,panelDataArray:s}=C.current,{collapsedSize:i=0,collapsible:n,panelSize:o}=bB(s,e,r);return bc(null!=o,`Panel size not found for panel "${e.id}"`),!0===n&&bh(o,i)},[]),M=(0,W.useCallback)(e=>{let{layout:r,panelDataArray:s}=C.current,{collapsedSize:i=0,collapsible:n,panelSize:o}=bB(s,e,r);return bc(null!=o,`Panel size not found for panel "${e.id}"`),!n||bd(o,i)>0},[]),D=(0,W.useCallback)(e=>{let{panelDataArray:r}=C.current;r.push(e),r.sort((e,r)=>{let s=e.order,i=r.order;return null==s&&null==i?0:null==s?-1:null==i?1:s-i}),C.current.panelDataArrayChanged=!0,_()},[_]);yL(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;let{autoSaveId:s,onLayout:i,storage:n}=S.current,{layout:o,panelDataArray:a}=C.current,l=null;if(s){var e,r;let i=null!=(r=(null!=(e=bN(s,n))?e:{})[bj(a)])?r:null;i&&(b.current=new Map(Object.entries(i.expandToSizes)),l=i.layout)}null==l&&(l=function({panelDataArray:e}){let r=Array(e.length),s=e.map(e=>e.constraints),i=0,n=100;for(let o=0;o<e.length;o++){let e=s[o];bc(e,`Panel constraints not found for index ${o}`);let{defaultSize:a}=e;null!=a&&(i++,r[o]=a,n-=a)}for(let o=0;o<e.length;o++){let a=s[o];bc(a,`Panel constraints not found for index ${o}`);let{defaultSize:l}=a;if(null!=l)continue;let c=n/(e.length-i);i++,r[o]=c,n-=c}return r}({panelDataArray:a}));let c=bR({layout:l,panelConstraints:a.map(e=>e.constraints)});by(o,c)||(x(c),C.current.layout=c,i&&i(c),bw(a,c,y.current))}}),yL(()=>{let e=C.current;return()=>{e.layout=[]}},[]);let T=(0,W.useCallback)(e=>{let r=!1,s=p.current;return s&&"rtl"===window.getComputedStyle(s,null).getPropertyValue("direction")&&(r=!0),function(s){var i,n;s.preventDefault();let o=p.current;if(!o)return()=>null;let{direction:a,dragState:l,id:c,keyboardResizeBy:d,onLayout:h}=S.current,{layout:u,panelDataArray:f}=C.current,{initialLayout:m}=null!=l?l:{},g=bv(c,e,o),v=function(e,r,s,i,n,o){if(yU(e)){let r="horizontal"===s,i=0;i=e.shiftKey?100:null!=n?n:10;let o=0;switch(e.key){case"ArrowDown":o=r?0:i;break;case"ArrowLeft":o=r?-i:0;break;case"ArrowRight":o=r?i:0;break;case"ArrowUp":o=r?0:-i;break;case"End":o=100;break;case"Home":o=-100}return o}return null==i?0:function(e,r,s,i,n){let o="horizontal"===s,a=b_(r,n);bc(a,`No resize handle element found for id "${r}"`);let l=a.getAttribute(yD);bc(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=i,d=bb(s,e),h=bx(l,n);bc(h,`No group element found for id "${l}"`);let u=h.getBoundingClientRect();return(d-c)/(o?u.width:u.height)*100}(e,r,s,i,o)}(s,e,a,l,d,o),_="horizontal"===a;_&&r&&(v=-v);let b=bp({delta:v,initialLayout:null!=m?m:u,panelConstraints:f.map(e=>e.constraints),pivotIndices:g,prevLayout:u,trigger:yU(s)?"keyboard":"mouse-or-touch"}),k=!bS(u,b);(yq(s)||yV(s))&&w.current!=v&&((w.current=v,k||0===v)?y7.set(e,0):_?(i=v<0?y0:y1,y7.set(e,i)):(n=v<0?y2:y5,y7.set(e,n))),k&&(x(b),C.current.layout=b,h&&h(b),bw(f,b,y.current))}},[]),P=(0,W.useCallback)((e,r)=>{let{onLayout:s}=S.current,{layout:i,panelDataArray:n}=C.current,o=n.map(e=>e.constraints),{panelSize:a,pivotIndices:l}=bB(n,e,i);bc(null!=a,`Panel size not found for panel "${e.id}"`);let c=bp({delta:bL(n,e)===n.length-1?a-r:r-a,initialLayout:i,panelConstraints:o,pivotIndices:l,prevLayout:i,trigger:"imperative-api"});bS(i,c)||(x(c),C.current.layout=c,s&&s(c),bw(n,c,y.current))},[]),L=(0,W.useCallback)((e,r)=>{let{layout:s,panelDataArray:i}=C.current,{collapsedSize:n=0,collapsible:o}=r,{collapsedSize:a=0,collapsible:l,maxSize:c=100,minSize:d=0}=e.constraints,{panelSize:h}=bB(i,e,s);null!=h&&(o&&l&&bh(h,n)?bh(n,a)||P(e,a):h<d?P(e,d):h>c&&P(e,c))},[P]),B=(0,W.useCallback)((e,r)=>{let{direction:s}=S.current,{layout:i}=C.current;if(!p.current)return;let n=b_(e,p.current);bc(n,`Drag handle element not found for id "${e}"`);let o=bb(s,r);g({dragHandleId:e,dragHandleRect:n.getBoundingClientRect(),initialCursorPosition:o,initialLayout:i})},[]),A=(0,W.useCallback)(()=>{g(null)},[]),O=(0,W.useCallback)(e=>{let{panelDataArray:r}=C.current,s=bL(r,e);s>=0&&(r.splice(s,1),delete y.current[e.id],C.current.panelDataArrayChanged=!0,_())},[_]),I=(0,W.useMemo)(()=>({collapsePanel:k,direction:i,dragState:m,expandPanel:j,getPanelSize:N,getPanelStyle:E,groupId:f,isPanelCollapsed:R,isPanelExpanded:M,reevaluatePanelConstraints:L,registerPanel:D,registerResizeHandle:T,resizePanel:P,startDragging:B,stopDragging:A,unregisterPanel:O,panelGroupElement:p.current}),[k,m,i,j,N,E,f,R,M,L,D,T,P,B,A,O]);return(0,W.createElement)(yR.Provider,{value:I},(0,W.createElement)(h,{...u,children:r,className:s,id:o,ref:p,style:{display:"flex",flexDirection:"horizontal"===i?"row":"column",height:"100%",overflow:"hidden",width:"100%",...d},"data-panel-group":"",[yM]:i,[yD]:f}))}let bP=(0,W.forwardRef)((e,r)=>(0,W.createElement)(bT,{...e,forwardedRef:r}));function bL(e,r){return e.findIndex(e=>e===r||e.id===r.id)}function bB(e,r,s){let i=bL(e,r),n=i===e.length-1,o=s[i];return{...r.constraints,panelSize:o,pivotIndices:n?[i-1,i]:[i,i+1]}}function bA({children:e=null,className:r="",disabled:s=!1,hitAreaMargins:i,id:n,onBlur:o,onClick:a,onDragging:l,onFocus:c,onPointerDown:d,onPointerUp:h,style:u={},tabIndex:f=0,tagName:p="div",...m}){var g,v;let x=(0,W.useRef)(null),_=(0,W.useRef)({onClick:a,onDragging:l,onPointerDown:d,onPointerUp:h});(0,W.useEffect)(()=>{_.current.onClick=a,_.current.onDragging=l,_.current.onPointerDown=d,_.current.onPointerUp=h});let y=(0,W.useContext)(yR);if(null===y)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:b,groupId:w,registerResizeHandle:S,startDragging:C,stopDragging:k,panelGroupElement:j}=y,N=yI(n),[E,R]=(0,W.useState)("inactive"),[M,D]=(0,W.useState)(!1),[T,P]=(0,W.useState)(null),L=(0,W.useRef)({state:E});yL(()=>{L.current.state=E}),(0,W.useEffect)(()=>{if(s)P(null);else{let e=S(N);P(()=>e)}},[s,N,S]);let B=null!=(g=null==i?void 0:i.coarse)?g:15,A=null!=(v=null==i?void 0:i.fine)?v:5;return(0,W.useEffect)(()=>{if(s||null==T)return;let e=x.current;bc(e,"Element ref not attached");let r=!1;return function(e,r,s,i,n){var o;let{ownerDocument:a}=r,l={direction:s,element:r,hitAreaMargins:i,setResizeHandlerState:n},c=null!=(o=y8.get(a))?o:0;return y8.set(a,c+1),y9.add(l),ba(),function(){var r;y7.delete(e),y9.delete(l);let s=null!=(r=y8.get(a))?r:1;if(y8.set(a,s-1),ba(),1===s&&y8.delete(a),y4.includes(l)){let e=y4.indexOf(l);e>=0&&y4.splice(e,1),bn(),n("up",!0,null)}}}(N,e,b,{coarse:B,fine:A},(e,s,i)=>{if(!s)return void R("inactive");switch(e){case"down":{R("drag"),r=!1,bc(i,'Expected event to be defined for "down" action'),C(N,i);let{onDragging:e,onPointerDown:s}=_.current;null==e||e(!0),null==s||s();break}case"move":{let{state:e}=L.current;r=!0,"drag"!==e&&R("hover"),bc(i,'Expected event to be defined for "move" action'),T(i);break}case"up":{R("hover"),k();let{onClick:e,onDragging:s,onPointerUp:i}=_.current;null==s||s(!1),null==i||i(),r||null==e||e()}}})},[B,b,s,A,S,N,T,C,k]),!function({disabled:e,handleId:r,resizeHandler:s,panelGroupElement:i}){(0,W.useEffect)(()=>{if(e||null==s||null==i)return;let n=b_(r,i);if(null==n)return;let o=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),s(e);break;case"F6":{e.preventDefault();let s=n.getAttribute(yD);bc(s,`No group element found for id "${s}"`);let o=bm(s,i),a=bg(s,r,i);bc(null!==a,`No resize element found for id "${r}"`);let l=e.shiftKey?a>0?a-1:o.length-1:a+1<o.length?a+1:0;o[l].focus()}}};return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}},[i,e,r,s])}({disabled:s,handleId:N,resizeHandler:T,panelGroupElement:j}),(0,W.createElement)(p,{...m,children:e,className:r,id:n,onBlur:()=>{D(!1),null==o||o()},onFocus:()=>{D(!0),null==c||c()},ref:x,role:"separator",style:{touchAction:"none",userSelect:"none",...u},tabIndex:f,[yM]:b,[yD]:w,[yT]:"","data-resize-handle-active":"drag"===E?"pointer":M?"keyboard":void 0,"data-panel-resize-handle-enabled":!s,[yP]:N,"data-resize-handle-state":E})}bT.displayName="PanelGroup",bP.displayName="forwardRef(PanelGroup)",bA.displayName="PanelResizeHandle";let bO=({className:e,...r})=>(0,F.jsx)(bP,{className:(0,iu.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...r}),bI=({withHandle:e,className:r,...s})=>(0,F.jsx)(bA,{className:(0,iu.cn)("relative flex w-px items-center justify-center bg-border/60 after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-[''] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:inset-x-0 data-[panel-group-direction=vertical]:after:-top-1 data-[panel-group-direction=vertical]:after:-bottom-1 data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:right-0 [&[data-resize-handle-active]]:bg-ring",r),...s,children:e&&(0,F.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,F.jsx)(lh,{className:"h-2.5 w-2.5"})})}),bz=(0,ic.default)("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),bF=(0,ic.default)("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"}]]);function bW({status:e}){return e&&"idle"!==e?"assigned"===e?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-yellow-500 shrink-0"}):"working"===e?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse shrink-0"}):(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0"}):(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/30 shrink-0"})}function bH({project:e}){let r=!!e.path,s=e.is_remote||!!e.remote_path;return r&&s?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-purple-500 shrink-0"}):s?(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0"}):(0,F.jsx)("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/30 shrink-0"})}function b$({activeView:e,onViewChange:r,worktrees:s,selectedBranch:i,onBranchChange:n,currentProject:o,onCreateWorktreeOpen:a,onDeleteWorktree:l,workspaceStatuses:c,hasProject:d=!0,projects:h,onSelectProject:u,onCreateProjectOpen:f}){return(0,F.jsxs)("nav",{className:"w-52 border-r border-border/60 bg-sidebar flex flex-col p-3",children:[(0,F.jsxs)("div",{className:"space-y-0.5",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-3 mb-2",children:[(0,F.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Projects"}),(0,F.jsx)("button",{onClick:f,className:"p-0.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors text-muted-foreground",title:"Create new project",children:(0,F.jsx)(nT,{className:"h-3 w-3"})})]}),h&&h.length>0?(0,F.jsx)(gM,{delayDuration:300,children:(0,F.jsx)("div",{className:"flex flex-col gap-0.5 max-h-40 overflow-y-auto",children:h.map(s=>{let i=o?.id===s.id,n=i&&"project-info"===e;return(0,F.jsxs)(gD,{children:[(0,F.jsx)(gT,{asChild:!0,children:(0,F.jsxs)("button",{onClick:()=>{u?.(s),r("project-info")},className:(0,iu.cn)("w-full flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs transition-all duration-150 min-w-0","hover:bg-accent/80 hover:text-accent-foreground",n?"bg-primary/10 text-primary font-medium shadow-sm":i?"font-medium text-foreground":"text-muted-foreground"),children:[(0,F.jsx)(bH,{project:s}),(0,F.jsx)("span",{className:"truncate flex-1 text-left",children:s.name}),i&&(0,F.jsx)(i_,{className:"h-3 w-3 shrink-0 text-primary ml-auto"})]})}),(0,F.jsx)(gP,{side:"right",children:s.name})]},s.id)})})}):(0,F.jsx)("span",{className:"px-3 text-xs text-muted-foreground/60",children:"No projects yet"})]}),(0,F.jsxs)("div",{className:"mt-4 space-y-0.5",children:[(0,F.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70 px-3 mb-2 block",children:"Navigation"}),(0,F.jsxs)("button",{onClick:()=>{d&&(n?.(null),r("tasks"))},disabled:!d,className:(0,iu.cn)("w-full flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-medium transition-all duration-150",d?"hover:bg-accent/80 hover:text-accent-foreground":"text-muted-foreground/40 cursor-not-allowed","tasks"===e&&d?"bg-primary/10 text-primary shadow-sm":d?"text-muted-foreground":""),children:[(0,F.jsx)(vA,{className:"h-3 w-3 shrink-0"}),(0,F.jsx)("span",{children:"Tasks"})]}),(0,F.jsxs)("button",{onClick:()=>{d&&r("files")},disabled:!d,className:(0,iu.cn)("w-full flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-medium transition-all duration-150",d?"hover:bg-accent/80 hover:text-accent-foreground":"text-muted-foreground/40 cursor-not-allowed","files"===e&&d?"bg-primary/10 text-primary shadow-sm":d?"text-muted-foreground":""),children:[(0,F.jsx)(i_,{className:"h-3 w-3 shrink-0"}),(0,F.jsx)("span",{children:"Files"})]})]}),(0,F.jsxs)("div",{className:"mt-4 space-y-0.5",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-3 mb-2",children:[(0,F.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Workspace"}),o&&(0,F.jsx)("button",{onClick:a,className:"p-0.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors text-muted-foreground",title:"Create new worktree",children:(0,F.jsx)(nT,{className:"h-3 w-3"})})]}),s&&s.length>0&&(0,F.jsx)(gM,{delayDuration:300,children:(0,F.jsx)("div",{className:"flex flex-col gap-0.5",children:s.map(s=>(0,F.jsxs)("div",{className:"group relative flex items-center min-w-0",children:[(0,F.jsxs)(gD,{children:[(0,F.jsx)(gT,{asChild:!0,children:(0,F.jsxs)("button",{onClick:()=>{n?.(s.branch),r("workspace")},className:(0,iu.cn)("flex-1 min-w-0 flex items-center gap-2 rounded-lg pl-3 pr-6 py-1.5 text-xs transition-all duration-150 overflow-hidden","hover:bg-accent/80 hover:text-accent-foreground","workspace"===e&&i===s.branch?"bg-primary/10 text-primary font-medium shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(bW,{status:c?.get(null===s.branch?"":s.branch)}),(0,F.jsx)("span",{className:"truncate",children:s.branch??"main"})]})}),(0,F.jsx)(gP,{side:"right",children:s.branch??"main"})]}),null!==s.branch&&(0,F.jsx)("button",{onClick:e=>{e.stopPropagation(),l?.(s)},className:"absolute right-1.5 p-0.5 rounded-md opacity-0 group-hover:opacity-100 hover:bg-destructive/15 hover:text-destructive transition-all",title:"Delete worktree",children:(0,F.jsx)(nz,{className:"h-3 w-3"})})]},s.branch??"__main__"))})}),(!s||0===s.length)&&(0,F.jsxs)("button",{onClick:()=>r("workspace"),className:(0,iu.cn)("w-full flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-150","hover:bg-accent/80 hover:text-accent-foreground","workspace"===e?"bg-primary/10 text-primary shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(bz,{className:"h-4 w-4 shrink-0"}),(0,F.jsx)("span",{children:"Workspace"})]})]}),(0,F.jsxs)("div",{className:"mt-auto space-y-0.5",children:[(0,F.jsx)("div",{className:"border-t border-border/40 mb-3"}),(0,F.jsxs)("button",{onClick:()=>r("remote-servers"),className:(0,iu.cn)("w-full flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-150","hover:bg-accent/80 hover:text-accent-foreground","remote-servers"===e?"bg-primary/10 text-primary shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(ib,{className:"h-4 w-4 shrink-0"}),(0,F.jsx)("span",{children:"Remote Servers"})]}),(0,F.jsxs)("button",{onClick:()=>r("settings"),className:(0,iu.cn)("w-full flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-150","hover:bg-accent/80 hover:text-accent-foreground","settings"===e?"bg-primary/10 text-primary shadow-sm":"text-muted-foreground"),children:[(0,F.jsx)(bF,{className:"h-4 w-4 shrink-0"}),(0,F.jsx)("span",{children:"Settings"})]})]})]})}var il=il,bK="Checkbox",[bU,bq]=q(bK),[bV,bY]=bU(bK);function bX(e){let{__scopeCheckbox:r,checked:s,children:i,defaultChecked:n,disabled:o,form:a,name:l,onCheckedChange:c,required:d,value:h="on",internal_do_not_use_render:u}=e,[f,p]=X({prop:s,defaultProp:n??!1,onChange:c,caller:bK}),[m,g]=W.useState(null),[v,x]=W.useState(null),_=W.useRef(!1),y=!m||!!a||!!m.closest("form"),b={checked:f,disabled:o,setChecked:p,control:m,setControl:g,name:l,form:a,value:h,hasConsumerStoppedPropagationRef:_,required:d,defaultChecked:!b5(n)&&n,isFormControl:y,bubbleInput:v,setBubbleInput:x};return(0,F.jsx)(bV,{scope:r,...b,children:"function"==typeof u?u(b):i})}var bG="CheckboxTrigger",bJ=W.forwardRef(({__scopeCheckbox:e,onKeyDown:r,onClick:s,...i},n)=>{let{control:o,value:a,disabled:l,checked:c,required:d,setControl:h,setChecked:u,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=bY(bG,e),g=(0,U.useComposedRefs)(n,h),v=W.useRef(c);return W.useEffect(()=>{let e=o?.form;if(e){let r=()=>u(v.current);return e.addEventListener("reset",r),()=>e.removeEventListener("reset",r)}},[o,u]),(0,F.jsx)(Z.button,{type:"button",role:"checkbox","aria-checked":b5(c)?"mixed":c,"aria-required":d,"data-state":b3(c),"data-disabled":l?"":void 0,disabled:l,value:a,...i,ref:g,onKeyDown:K(r,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:K(s,e=>{u(e=>!!b5(e)||!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});bJ.displayName=bG;var bZ=W.forwardRef((e,r)=>{let{__scopeCheckbox:s,name:i,checked:n,defaultChecked:o,required:a,disabled:l,value:c,onCheckedChange:d,form:h,...u}=e;return(0,F.jsx)(bX,{__scopeCheckbox:s,checked:n,defaultChecked:o,disabled:l,required:a,onCheckedChange:d,name:i,form:h,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(bJ,{...u,ref:r,__scopeCheckbox:s}),e&&(0,F.jsx)(b2,{__scopeCheckbox:s})]})})});bZ.displayName=bK;var bQ="CheckboxIndicator",b0=W.forwardRef((e,r)=>{let{__scopeCheckbox:s,forceMount:i,...n}=e,o=bY(bQ,s);return(0,F.jsx)(t8,{present:i||b5(o.checked)||!0===o.checked,children:(0,F.jsx)(Z.span,{"data-state":b3(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:r,style:{pointerEvents:"none",...e.style}})})});b0.displayName=bQ;var b1="CheckboxBubbleInput",b2=W.forwardRef(({__scopeCheckbox:e,...r},s)=>{let{control:i,hasConsumerStoppedPropagationRef:n,checked:o,defaultChecked:a,required:l,disabled:c,name:d,value:h,form:u,bubbleInput:f,setBubbleInput:p}=bY(b1,e),m=(0,U.useComposedRefs)(s,p),g=oz(o),v=tW(i);W.useEffect(()=>{if(!f)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,r=!n.current;if(g!==o&&e){let s=new Event("click",{bubbles:r});f.indeterminate=b5(o),e.call(f,!b5(o)&&o),f.dispatchEvent(s)}},[f,g,o,n]);let x=W.useRef(!b5(o)&&o);return(0,F.jsx)(Z.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??x.current,required:l,disabled:c,name:d,value:h,form:u,...r,tabIndex:-1,ref:m,style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function b5(e){return"indeterminate"===e}function b3(e){return b5(e)?"indeterminate":e?"checked":"unchecked"}b2.displayName=b1,e.s(["Checkbox",()=>bZ,"CheckboxIndicator",()=>b0,"Indicator",()=>b0,"Root",()=>bZ,"createCheckboxScope",()=>bq,"unstable_BubbleInput",()=>b2,"unstable_CheckboxBubbleInput",()=>b2,"unstable_CheckboxProvider",()=>bX,"unstable_CheckboxTrigger",()=>bJ,"unstable_Provider",()=>bX,"unstable_Trigger",()=>bJ],85402);var b4=e.i(85402),b4=b4;function b6({className:e,...r}){return(0,F.jsx)(b4.Root,{"data-slot":"checkbox",className:(0,iu.cn)("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:(0,F.jsx)(b4.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:(0,F.jsx)(il.default,{className:"size-3.5"})})})}let b8={todo:{label:"To Do",color:"bg-muted text-muted-foreground"},in_progress:{label:"In Progress",color:"bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300"},done:{label:"Done",color:"bg-green-100 text-green-800 dark:bg-green-900/40 dark:text-green-300"},cancelled:{label:"Cancelled",color:"bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400 line-through"}},b7={low:{label:"Low",color:"bg-muted text-muted-foreground"},medium:{label:"Medium",color:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/40 dark:text-yellow-300"},high:{label:"High",color:"bg-orange-100 text-orange-800 dark:bg-orange-900/40 dark:text-orange-300"},urgent:{label:"Urgent",color:"bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-300"}},b9=["todo","in_progress","done","cancelled"],we=["low","medium","high","urgent"];function wt({task:e,onUpdate:r,onDelete:s,onClick:i,worktrees:n,assignedBranches:o,onAssign:a}){let[l,c]=(0,W.useState)(!1),[d,h]=(0,W.useState)(e.title),u=(0,W.useRef)(null);(0,W.useEffect)(()=>{l&&(u.current?.focus(),u.current?.select())},[l]),(0,W.useEffect)(()=>{h(e.title)},[e.title]);let f=()=>{c(!1);let s=d.trim();s&&s!==e.title?r(e.id,{title:s}):h(e.title)},p="done"===e.status||"cancelled"===e.status;return(0,F.jsxs)(oD,{className:"group cursor-pointer",onClick:()=>i?.(e),children:[(0,F.jsx)(oP,{className:"w-10",onClick:e=>e.stopPropagation(),children:(0,F.jsx)(b6,{checked:"done"===e.status,onCheckedChange:s=>{r(e.id,{status:s?"done":"todo"})}})}),(0,F.jsx)(oP,{className:"font-medium",children:l?(0,F.jsx)("input",{ref:u,className:"w-full bg-transparent border-b border-primary outline-none text-sm py-0.5",value:d,onChange:e=>h(e.target.value),onBlur:f,onClick:e=>e.stopPropagation(),onKeyDown:r=>{"Enter"===r.key&&f(),"Escape"===r.key&&(h(e.title),c(!1))}}):(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:`cursor-pointer hover:underline text-sm ${p?"line-through text-muted-foreground":""}`,onClick:e=>{e.stopPropagation(),c(!0)},children:e.title}),e.description&&(0,F.jsx)("p",{className:"text-xs text-muted-foreground truncate max-w-[400px] mt-0.5",children:e.description.length>80?e.description.slice(0,80)+"...":e.description})]})}),(0,F.jsx)(oP,{onClick:e=>e.stopPropagation(),children:(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)("button",{className:"focus:outline-none",children:(0,F.jsx)(ll,{variant:"outline",className:`cursor-pointer text-xs ${b8[e.status].color}`,children:b8[e.status].label})})}),(0,F.jsx)(ig,{align:"start",children:b9.map(s=>(0,F.jsxs)(iv,{onClick:()=>r(e.id,{status:s}),children:[(0,F.jsx)("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${b8[s].color}`}),b8[s].label]},s))})]})}),(0,F.jsx)(oP,{onClick:e=>e.stopPropagation(),children:(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)("button",{className:"focus:outline-none",children:(0,F.jsx)(ll,{variant:"outline",className:`cursor-pointer text-xs ${b7[e.priority].color}`,children:b7[e.priority].label})})}),(0,F.jsx)(ig,{align:"start",children:we.map(s=>(0,F.jsxs)(iv,{onClick:()=>r(e.id,{priority:s}),children:[(0,F.jsx)("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${b7[s].color}`}),b7[s].label]},s))})]})}),(0,F.jsx)(oP,{onClick:e=>e.stopPropagation(),children:(0,F.jsxs)(ip,{children:[(0,F.jsx)(im,{asChild:!0,children:(0,F.jsx)("button",{className:"focus:outline-none",children:(0,F.jsxs)(ll,{variant:"outline",className:`cursor-pointer text-xs ${null!==e.assigned_branch?"bg-blue-500/10 text-blue-600 border-blue-500/30":"text-muted-foreground"}`,children:[(0,F.jsx)(aU,{className:"h-3 w-3 mr-1"}),null!==e.assigned_branch?""===e.assigned_branch?"main":e.assigned_branch:"Unassigned"]})})}),(0,F.jsxs)(ig,{align:"start",children:[null!==e.assigned_branch&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(iv,{onClick:()=>a(e.id,null),children:"Unassign"}),(0,F.jsx)(ix,{})]}),n.filter(r=>{let s=null===r.branch?"":r.branch;return!(e.assigned_branch===s||o.has(s))}).map(r=>{let s=null===r.branch?"":r.branch,i=r.branch??"main";return(0,F.jsxs)(iv,{onClick:()=>a(e.id,s),children:[(0,F.jsx)(aU,{className:"h-3 w-3 mr-2"}),i]},s)})]})]})}),(0,F.jsx)(oP,{className:"text-muted-foreground text-xs",children:new Date(e.created_at).toLocaleDateString()}),(0,F.jsx)(oP,{className:"w-10",onClick:e=>e.stopPropagation(),children:(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>s(e.id),children:(0,F.jsx)(nz,{className:"h-3.5 w-3.5 text-muted-foreground"})})})]})}function wr({task:e,open:r,onOpenChange:s}){return e?(0,F.jsx)(ne,{open:r,onOpenChange:s,children:(0,F.jsxs)(ns,{className:"sm:max-w-lg",children:[(0,F.jsx)(ni,{children:(0,F.jsx)(no,{className:"text-base leading-snug",children:e.title})}),(0,F.jsxs)("div",{className:"space-y-4",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2",children:[(0,F.jsx)(ll,{variant:"outline",className:`text-xs ${b8[e.status].color}`,children:b8[e.status].label}),(0,F.jsx)(ll,{variant:"outline",className:`text-xs ${b7[e.priority].color}`,children:b7[e.priority].label})]}),e.description&&(0,F.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.description}),(0,F.jsxs)("div",{className:"flex gap-4 text-xs text-muted-foreground pt-2 border-t",children:[(0,F.jsxs)("span",{children:["Created: ",new Date(e.created_at).toLocaleString()]}),(0,F.jsxs)("span",{children:["Updated: ",new Date(e.updated_at).toLocaleString()]})]})]})]})}):null}let ws={todo:0,in_progress:1,done:2,cancelled:3},wi={urgent:0,high:1,medium:2,low:3};function wn({tasks:e,onUpdate:r,onDelete:s,worktrees:i,onAssign:n}){let[o,a]=(0,W.useState)(null),[l,c]=(0,W.useState)("asc"),[d,h]=(0,W.useState)(null),[u,f]=(0,W.useState)(!1),p=e=>{o===e?c(e=>"asc"===e?"desc":"asc"):(a(e),c("asc"))},m=(0,W.useMemo)(()=>{if(!o)return e;let r="asc"===l?1:-1;return[...e].sort((e,s)=>{switch(o){case"title":return r*e.title.localeCompare(s.title);case"status":return r*(ws[e.status]-ws[s.status]);case"priority":return r*(wi[e.priority]-wi[s.priority]);case"created_at":return r*(new Date(e.created_at).getTime()-new Date(s.created_at).getTime());default:return 0}})},[e,o,l]),g=e=>o!==e?null:"asc"===l?" ↑":" ↓",v=(0,W.useMemo)(()=>new Set(e.filter(e=>null!==e.assigned_branch).map(e=>e.assigned_branch)),[e]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(oE,{children:[(0,F.jsx)(oR,{children:(0,F.jsxs)(oD,{children:[(0,F.jsx)(oT,{className:"w-10"}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none",onClick:()=>p("title"),children:["Title",g("title")]}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none w-32",onClick:()=>p("status"),children:["Status",g("status")]}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none w-28",onClick:()=>p("priority"),children:["Priority",g("priority")]}),(0,F.jsx)(oT,{className:"w-32",children:"Assign"}),(0,F.jsxs)(oT,{className:"cursor-pointer select-none w-28",onClick:()=>p("created_at"),children:["Created",g("created_at")]}),(0,F.jsx)(oT,{className:"w-10"})]})}),(0,F.jsxs)(oM,{children:[m.map(e=>(0,F.jsx)(wt,{task:e,onUpdate:r,onDelete:s,onClick:e=>{h(e),f(!0)},worktrees:i,assignedBranches:v,onAssign:n},e.id)),0===e.length&&(0,F.jsx)(oD,{children:(0,F.jsx)("td",{colSpan:7,className:"text-center text-muted-foreground py-12 text-sm",children:(0,F.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,F.jsx)("p",{className:"text-sm font-medium text-foreground/60",children:"No tasks yet"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground",children:"Create one to get started."})]})})})]})]}),(0,F.jsx)(wr,{task:d,open:u,onOpenChange:f})]})}function wo({open:e,onOpenChange:r,onSubmit:s}){let[i,n]=(0,W.useState)(""),[o,a]=(0,W.useState)("todo"),[l,c]=(0,W.useState)("medium");return(0,F.jsx)(ne,{open:e,onOpenChange:r,children:(0,F.jsxs)(ns,{className:"sm:max-w-md max-h-[85vh] flex flex-col",children:[(0,F.jsx)(ni,{children:(0,F.jsx)(no,{children:"Create Task"})}),(0,F.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i.trim()&&(s({description:i.trim(),status:o,priority:l}),n(""),a("todo"),c("medium"),r(!1))},className:"space-y-4 overflow-y-auto min-h-0 px-0.5",children:[(0,F.jsx)("div",{className:"space-y-2",children:(0,F.jsx)(nD,{placeholder:"Describe the task...",value:i,onChange:e=>n(e.target.value),className:"max-h-[40vh]",rows:3,autoFocus:!0})}),(0,F.jsxs)("div",{className:"flex gap-3",children:[(0,F.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,F.jsx)("label",{className:"text-xs text-muted-foreground",children:"Status"}),(0,F.jsxs)(aP,{value:o,onValueChange:e=>a(e),children:[(0,F.jsx)(aB,{children:(0,F.jsx)(aL,{})}),(0,F.jsx)(aA,{children:b9.map(e=>(0,F.jsx)(aO,{value:e,children:b8[e].label},e))})]})]}),(0,F.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,F.jsx)("label",{className:"text-xs text-muted-foreground",children:"Priority"}),(0,F.jsxs)(aP,{value:l,onValueChange:e=>c(e),children:[(0,F.jsx)(aB,{children:(0,F.jsx)(aL,{})}),(0,F.jsx)(aA,{children:we.map(e=>(0,F.jsx)(aO,{value:e,children:b7[e].label},e))})]})]})]}),(0,F.jsxs)(nn,{children:[(0,F.jsx)($.Button,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),(0,F.jsx)($.Button,{type:"submit",disabled:!i.trim(),children:"Create"})]})]})]})})}function wa({projectId:e,tasks:r,loading:s,worktrees:i,onCreateTask:n,onUpdateTask:o,onDeleteTask:a}){let[l,c]=(0,W.useState)(!1);return e?(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border/60 flex-shrink-0",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Tasks"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Manage and track your project tasks"})]}),(0,F.jsxs)($.Button,{size:"sm",onClick:()=>c(!0),className:"shadow-sm",children:[(0,F.jsx)(nT,{className:"h-3.5 w-3.5 mr-1.5"}),"New Task"]})]}),(0,F.jsx)("div",{className:"flex-1 overflow-auto px-5",children:s?(0,F.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading tasks..."}):(0,F.jsx)(wn,{tasks:r,onUpdate:o,onDelete:a,worktrees:i,onAssign:(e,r)=>{o(e,{assigned_branch:r})}})}),(0,F.jsx)(wo,{open:l,onOpenChange:c,onSubmit:n})]}):(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(nT,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to view tasks."})]})})}let wl=(0,ic.default)("file",[["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"}]]),wc=(0,ic.default)("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"}]]),wd=new Set(["ts","tsx","js","jsx","py","rb","go","rs","java","c","cpp","h","css","scss","html","vue","svelte","php","swift","kt","sh","bash","yaml","yml","toml","json","xml","sql","graphql","proto"]),wh=new Set(["md","txt","log","csv","env","gitignore","dockerignore","editorconfig"]);function wu({path:e}){let[r,s]=(0,W.useState)(!1),i=(0,W.useCallback)(r=>{r.stopPropagation(),navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)},[e]);return(0,F.jsx)("button",{onClick:i,className:"p-0.5 rounded hover:bg-muted-foreground/20 transition-colors",title:`Copy path: ${e}`,children:r?(0,F.jsx)(iN.Check,{className:"h-3 w-3 text-green-500"}):(0,F.jsx)(ij.Copy,{className:"h-3 w-3 text-muted-foreground"})})}function wf({entry:e,path:r,depth:s,expandedDirs:i,directoryContents:n,loadingDirs:o,selectedFile:a,onToggleDirectory:l,onSelectFile:c}){var d,h,u;let f,p,m,g,v,x=i.has(r),_=o.has(r),y=n.get(r);if("directory"===e.type){let d=x?i_:of;return(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"group flex items-center w-full px-2 py-1 text-sm rounded-sm hover:bg-accent transition-colors cursor-pointer",style:{paddingLeft:`${16*s+8}px`},onClick:()=>l(r),children:[(0,F.jsxs)("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[_?(0,F.jsx)(iE,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):(0,F.jsx)(x?aT:id,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,F.jsx)(d,{className:"h-4 w-4 shrink-0 text-blue-500"}),(0,F.jsx)("span",{className:"truncate",children:e.name})]}),(0,F.jsx)("div",{className:"shrink-0 hidden group-hover:block ml-1",children:(0,F.jsx)(wu,{path:r})})]}),x&&y&&(0,F.jsx)("div",{children:y.map(e=>{let d=r?`${r}/${e.name}`:e.name;return(0,F.jsx)(wf,{entry:e,path:d,depth:s+1,expandedDirs:i,directoryContents:n,loadingDirs:o,selectedFile:a,onToggleDirectory:l,onSelectFile:c},d)})})]})}let b=(d=e.name,f=d.split(".").pop()?.toLowerCase()??"",wd.has(f)?wc:wh.has(f)?vO:wl),w=a===r;return(0,F.jsxs)("div",{className:(0,iu.cn)("group flex items-center w-full px-2 py-1 text-sm rounded-sm transition-colors cursor-pointer",w?"bg-accent text-accent-foreground":"hover:bg-accent/50"),style:{paddingLeft:`${16*s+8+18}px`},onClick:()=>c(r),children:[(0,F.jsxs)("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[(0,F.jsx)(b,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,F.jsx)("span",{className:"truncate",children:e.name})]}),(0,F.jsxs)("div",{className:"shrink-0 flex items-center gap-2 ml-1",children:[(0,F.jsx)("span",{className:"text-[11px] text-muted-foreground/70 group-hover:hidden whitespace-nowrap w-[52px] text-right tabular-nums",children:e.mtime&&(h=e.mtime,p=Date.now(),v=Math.floor((g=Math.floor((m=Math.floor(Math.floor((p-new Date(h).getTime())/1e3)/60))/60))/24),m<1?"just now":m<60?`${m}m ago`:g<24?`${g}h ago`:v<30?`${v}d ago`:new Date(h).toLocaleDateString(void 0,{month:"short",day:"numeric"}))}),(0,F.jsx)("span",{className:"text-[11px] text-muted-foreground/70 group-hover:hidden whitespace-nowrap w-[52px] text-right tabular-nums",children:null!=e.size&&((u=e.size)<1024?`${u} B`:u<1048576?`${(u/1024).toFixed(1)} KB`:`${(u/1048576).toFixed(1)} MB`)}),(0,F.jsx)("div",{className:"hidden group-hover:block",children:(0,F.jsx)(wu,{path:r})})]})]})}function wp({entries:e,expandedDirs:r,directoryContents:s,loadingDirs:i,selectedFile:n,onToggleDirectory:o,onSelectFile:a}){return 0===e.length?(0,F.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:"No files found."}):(0,F.jsx)("div",{className:"py-1",children:e.map(e=>{let l=e.name;return(0,F.jsx)(wf,{entry:e,path:l,depth:0,expandedDirs:r,directoryContents:s,loadingDirs:i,selectedFile:n,onToggleDirectory:o,onSelectFile:a},l)})})}var wm=e.i(166520);let wg=(0,ic.default)("file-exclamation-point",[["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:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var il=il,wv=e.i(829692),wv=wv,wx=e.i(615742);let w_=(0,W.createContext)({code:""}),wy={name:"line-numbers",line(e,r){e.children.unshift({type:"element",tagName:"span",properties:{className:["inline-block","min-w-10","mr-4","text-right","select-none","text-muted-foreground"]},children:[{type:"text",value:String(r)}]})}};async function wb(e,r,s=!1){let i=s?[wy]:[];return await Promise.all([(0,wx.codeToHtml)(e,{lang:r,theme:"one-light",transformers:i}),(0,wx.codeToHtml)(e,{lang:r,theme:"one-dark-pro",transformers:i})])}let ww=({code:e,language:r,showLineNumbers:s=!1,className:i,children:n,...o})=>{let[a,l]=(0,W.useState)(""),[c,d]=(0,W.useState)(""),h=(0,W.useRef)(!1);return(0,W.useEffect)(()=>(wb(e,r,s).then(([e,r])=>{h.current||(l(e),d(r),h.current=!0)}),()=>{h.current=!1}),[e,r,s]),(0,F.jsx)(w_.Provider,{value:{code:e},children:(0,F.jsx)("div",{className:(0,iu.cn)("group relative w-full overflow-hidden rounded-md border bg-background text-foreground",i),...o,children:(0,F.jsxs)("div",{className:"relative",children:[(0,F.jsx)("div",{className:"overflow-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",dangerouslySetInnerHTML:{__html:a}}),(0,F.jsx)("div",{className:"hidden overflow-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",dangerouslySetInnerHTML:{__html:c}}),n&&(0,F.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})})},wS=({onCopy:e,onError:r,timeout:s=2e3,children:i,className:n,...o})=>{let[a,l]=(0,W.useState)(!1),{code:c}=(0,W.useContext)(w_),d=async()=>{if(!navigator?.clipboard?.writeText)return void r?.(Error("Clipboard API not available"));try{await navigator.clipboard.writeText(c),l(!0),e?.(),setTimeout(()=>l(!1),s)}catch(e){r?.(e)}},h=a?il.default:wv.default;return(0,F.jsx)($.Button,{className:(0,iu.cn)("shrink-0",n),onClick:d,size:"icon",variant:"ghost",...o,children:i??(0,F.jsx)(h,{size:14})})};function wC({className:e,...r}){return(0,F.jsx)("div",{"data-slot":"skeleton",className:(0,iu.cn)("bg-accent animate-pulse rounded-md",e),...r})}let wk={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",cs:"csharp",css:"css",scss:"scss",html:"html",vue:"vue",svelte:"svelte",php:"php",swift:"swift",kt:"kotlin",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",toml:"toml",json:"json",xml:"xml",sql:"sql",graphql:"graphql",md:"markdown",mdx:"mdx",dockerfile:"dockerfile",makefile:"makefile",lua:"lua",r:"r",scala:"scala",zig:"zig"};function wj(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function wN({filePath:e,fileContent:r,loading:s,downloadUrl:i}){let n;if(!e)return(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Select a file to preview."});if(s)return(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsx)("div",{className:"flex items-center justify-between px-4 py-2 border-b flex-shrink-0",children:(0,F.jsx)(wC,{className:"h-4 w-48"})}),(0,F.jsxs)("div",{className:"flex-1 p-4",children:[(0,F.jsx)(wC,{className:"h-4 w-full mb-2"}),(0,F.jsx)(wC,{className:"h-4 w-3/4 mb-2"}),(0,F.jsx)(wC,{className:"h-4 w-5/6 mb-2"}),(0,F.jsx)(wC,{className:"h-4 w-2/3"})]})]});if(!r)return(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Failed to load file."});let o=()=>{i&&window.open(i,"_blank")};return(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b flex-shrink-0 gap-2",children:[(0,F.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,F.jsx)("span",{className:"text-sm font-mono truncate",children:e}),(0,F.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:wj(r.size)})]}),(0,F.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{navigator.clipboard.writeText(e)},title:"Copy path",children:(0,F.jsx)(ij.Copy,{className:"h-3.5 w-3.5"})}),i&&(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:o,title:"Download",children:(0,F.jsx)(wm.Download,{className:"h-3.5 w-3.5"})})]})]}),(0,F.jsx)("div",{className:"flex-1 overflow-auto",children:r.tooLarge?(0,F.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[(0,F.jsx)(wg,{className:"h-10 w-10"}),(0,F.jsxs)("p",{className:"text-sm",children:["File too large to preview (",wj(r.size),")"]}),i&&(0,F.jsxs)($.Button,{variant:"outline",size:"sm",onClick:o,children:[(0,F.jsx)(wm.Download,{className:"h-4 w-4 mr-2"}),"Download"]})]}):r.binary?(0,F.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[(0,F.jsx)(wg,{className:"h-10 w-10"}),(0,F.jsxs)("p",{className:"text-sm",children:["Binary file (",wj(r.size),")"]}),i&&(0,F.jsxs)($.Button,{variant:"outline",size:"sm",onClick:o,children:[(0,F.jsx)(wm.Download,{className:"h-4 w-4 mr-2"}),"Download"]})]}):null!==r.content?(0,F.jsx)(ww,{code:r.content,language:"dockerfile"===(n=e.split("/").pop()?.toLowerCase()??"")?"dockerfile":"makefile"===n?"makefile":wk[n.split(".").pop()?.toLowerCase()??""]??"text",showLineNumbers:!0,className:"border-0 rounded-none",children:(0,F.jsx)(wS,{})}):(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Empty file."})})]})}function wE({projectId:e,project:r,selectedBranch:s}){let i=r&&!r.path?"remote":void 0,{rootEntries:n,directoryContents:o,expandedDirs:a,selectedFile:l,fileContent:c,fileLoading:d,rootLoading:h,loadingDirs:u,fetchRoot:f,toggleDirectory:p,selectFile:m}=function({projectId:e,branch:r,target:s}){let[i,n]=(0,W.useState)([]),[o,a]=(0,W.useState)(new Map),[l,c]=(0,W.useState)(new Set),[d,h]=(0,W.useState)(null),[u,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),[g,v]=(0,W.useState)(!1),[x,_]=(0,W.useState)(new Set),y=(0,W.useRef)(0),b=(0,W.useCallback)(async()=>{if(!e)return;v(!0);let i=++y.current;try{let o=await iR.api.browseProjectDirectory(e,void 0,r,s);if(i!==y.current)return;n(o.items),a(new Map),c(new Set),h(null),f(null)}catch(e){if(console.error("Failed to browse root directory:",e),i!==y.current)return;n([])}finally{i===y.current&&v(!1)}},[e,r,s]),w=(0,W.useCallback)(async i=>{if(e&&(c(e=>{let r=new Set(e);return r.has(i)?r.delete(i):r.add(i),r}),!o.has(i))){_(e=>new Set(e).add(i));try{let n=await iR.api.browseProjectDirectory(e,i,r,s);a(e=>{let r=new Map(e);return r.set(i,n.items),r})}catch(e){console.error("Failed to browse directory:",e)}finally{_(e=>{let r=new Set(e);return r.delete(i),r})}}},[e,r,s,o]);return{rootEntries:i,directoryContents:o,expandedDirs:l,selectedFile:d,fileContent:u,fileLoading:p,rootLoading:g,loadingDirs:x,fetchRoot:b,toggleDirectory:w,selectFile:(0,W.useCallback)(async i=>{if(e){h(i),m(!0),f(null);try{let n=await iR.api.getFileContent(e,i,r,s);f(n)}catch(e){console.error("Failed to get file content:",e),f(null)}finally{m(!1)}}},[e,r,s])}}({projectId:e,branch:s,target:i});if((0,W.useEffect)(()=>{f()},[f]),!e)return(0,F.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:(0,F.jsxs)("div",{className:"text-center",children:[(0,F.jsx)("div",{className:"mx-auto w-10 h-10 rounded-xl bg-muted flex items-center justify-center mb-3",children:(0,F.jsx)(mZ,{className:"h-5 w-5 text-muted-foreground/50"})}),(0,F.jsx)("p",{className:"text-sm",children:"Select a project to browse files."})]})});let g=l&&e?iR.api.getFileDownloadUrl(e,l,s,i):null;return(0,F.jsxs)("div",{className:"flex flex-col h-full",children:[(0,F.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border/60 flex-shrink-0",children:[(0,F.jsxs)("div",{children:[(0,F.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Files"}),(0,F.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Browse and preview project files"})]}),(0,F.jsx)($.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:f,title:"Refresh",children:(0,F.jsx)(mZ,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`})})]}),(0,F.jsxs)(bO,{direction:"horizontal",autoSaveId:"files-panels",className:"flex-1",children:[(0,F.jsx)(yF,{defaultSize:33,minSize:20,children:(0,F.jsx)(oh,{className:"h-full",children:h&&0===n.length?(0,F.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading files..."}):(0,F.jsx)(wp,{entries:n,expandedDirs:a,directoryContents:o,loadingDirs:u,selectedFile:l,onToggleDirectory:p,onSelectFile:m})})}),(0,F.jsx)(bI,{withHandle:!0}),(0,F.jsx)(yF,{defaultSize:67,minSize:25,children:(0,F.jsx)("div",{className:"h-full overflow-hidden",children:(0,F.jsx)(wN,{filePath:l,fileContent:c,loading:d,downloadUrl:g})})})]})]})}let wR=new Set(["workspace","tasks","files","remote-servers","settings","project-info"]),wM="tasks";function wD(){let e=window.location.pathname,r=new URLSearchParams(window.location.search),s=r.get("project");if(s){let e=r.get("tab");return{projectId:s,tab:e&&wR.has(e)?e:wM,branch:r.get("branch")}}let i=e.split("/").filter(Boolean);if(1===i.length&&wR.has(i[0])){let e=i[0];if("remote-servers"===e||"settings"===e)return{projectId:null,tab:e,branch:null}}let n=null,o=wM;if("p"===i[0]&&i[1]){n=i[1];let e=i[2];e&&wR.has(e)&&(o=e)}return{projectId:n,tab:o,branch:r.get("branch")}}function wT(e){let{projectId:r,tab:s,branch:i}=e;if("remote-servers"===s||"settings"===s)return`/${s}`;if(!r)return"/";let n=`/p/${r}`;return s&&s!==wM&&(n+=`/${s}`),i&&(n+=`?branch=${encodeURIComponent(i)}`),n}function wP(e){return null===e?"":e}function wL(e,r){let s=new Map(e);return s.set(wP(r),"working"),s}function wB(e,r){let s=new Map(e);return s.delete(wP(r)),s}function wA(){var e,r;let s,i,n,{projectId:o,tab:a,branch:l}=function(){let[e,r]=(0,W.useState)(wD);return(0,W.useEffect)(()=>{let e=()=>r(wD());return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]),e}();(0,W.useEffect)(()=>{if(new URLSearchParams(window.location.search).has("project")){let e=wT({projectId:o,tab:a,branch:l});window.history.replaceState(null,"",e)}},[]);let[c,d]=(0,W.useState)(!1),[h,u]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,g]=(0,W.useState)(null),[v,x]=(0,W.useState)(l),[_,y]=(0,W.useState)(a),b=(0,W.useRef)(null),w=(0,W.useRef)(void 0),[S,C]=(0,W.useTransition)(),{projects:k,currentProject:j,loading:N,addProject:E,createProject:R,updateProject:M,deleteProject:D,selectProject:T}=function(e){let[r,s]=(0,W.useState)([]),[i,n]=(0,W.useState)(null),[o,a]=(0,W.useState)(!0),l=(0,W.useCallback)(async()=>{a(!0);try{let r=await iR.api.getProjects();if(s(r),r.length>0&&!i){let s=e?r.find(r=>r.id===e):null;n(s??r[0])}}finally{a(!1)}},[i,e]);(0,W.useEffect)(()=>{l()},[]);let c=async(e,r)=>{let o=await iR.api.updateProject(e,r);return s(r=>r.map(r=>r.id===e?o:r)),i?.id===e&&n(o),o},d=async e=>{await iR.api.deleteProject(e),s(r=>r.filter(r=>r.id!==e)),i?.id===e&&n(r.find(r=>r.id!==e)??null)};return{projects:r,currentProject:i,loading:o,addProject:e=>{s(r=>[e,...r]),n(e)},createProject:async e=>{let r=await iR.api.createProject(e);return s(e=>[r,...e]),n(r),r},updateProject:c,deleteProject:d,selectProject:e=>{n(e)},refresh:l}}(o),{worktrees:P,loading:L,refetch:B}=function(e){let[r,s]=(0,W.useState)([]),[i,n]=(0,W.useState)(!0),o=(0,W.useCallback)(async()=>{if(!e){s([]),n(!1);return}try{let r=await iR.api.getProjectWorktrees(e);s(r)}catch(e){console.error("Failed to fetch worktrees:",e),s([{branch:null}])}finally{n(!1)}},[e]);return(0,W.useEffect)(()=>{o()},[o]),{worktrees:r,loading:i,refetch:o}}(j?.id??null),{tasks:A,loading:O,createTask:I,updateTask:z,deleteTask:H,refetch:K}=function(e){let[r,s]=(0,W.useState)([]),[i,n]=(0,W.useState)(!0),o=(0,W.useCallback)(async()=>{if(!e){s([]),n(!1);return}try{let r=await iR.api.getTasks(e);s(r)}catch(e){console.error("Failed to fetch tasks:",e)}finally{n(!1)}},[e]);(0,W.useEffect)(()=>{o()},[o]);let a=(0,W.useCallback)(async r=>{if(!e)return null;try{let i=await iR.api.createTask(e,r);return s(e=>[...e,i]),i}catch(e){return console.error("Failed to create task:",e),null}},[e]),l=(0,W.useCallback)(async(e,i)=>{s(r=>r.map(r=>r.id===e?{...r,...i,updated_at:new Date().toISOString()}:r));try{let r=await iR.api.updateTask(e,i);return s(s=>s.map(s=>s.id===e?r:s)),r}catch(e){return console.error("Failed to update task:",e),s(r),null}},[r]),c=(0,W.useCallback)(async e=>{s(r=>r.filter(r=>r.id!==e));try{await iR.api.deleteTask(e)}catch(e){console.error("Failed to delete task:",e),s(r)}},[r]),d=(0,W.useCallback)(async i=>{if(e){s(i.map(e=>r.find(r=>r.id===e)).filter(e=>void 0!==e));try{await iR.api.reorderTasks(e,i)}catch(e){console.error("Failed to reorder tasks:",e),s(r)}}},[e,r]);return{tasks:r,loading:i,createTask:a,updateTask:l,deleteTask:c,reorderTasks:d,refetch:o}}(j?.id??null),{statuses:U,refetch:q}=function(e){let[r,s]=(0,W.useState)(new Map),i=(0,W.useRef)(null),n=(0,W.useCallback)(async()=>{if(!e)return void s(new Map);try{let r={},i=(0,iR.getAuthToken)();i&&(r.Authorization=`Bearer ${i}`);let n=await fetch(`${"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}/api/projects/${e}/agent-sessions`,{headers:r});if(!n.ok)return;let o=await n.json(),a=new Map;for(let e of o.sessions)a.has(e.branch)&&"running"!==e.status||a.set(e.branch,e.status);s(a)}catch{}},[e]);return(0,W.useEffect)(()=>(n(),i.current=setInterval(n,5e3),()=>{i.current&&clearInterval(i.current)}),[n]),{statuses:r,refetch:n,updateStatus:(0,W.useCallback)((e,r)=>{s(s=>{let i=new Map(s);return i.set(e,r),i})},[])}}(j?.id??null),[V,Y]=(0,W.useState)(new Map),X=(0,W.useMemo)(()=>(function(e,r,s,i,n){let o=new Map;if(!e)return o;let a=wP(n);for(let n of e){let e=wP(n.branch),l=r.get(e);if(void 0!==l){o.set(e,l);continue}let c=e===a?void 0:s.get(e),d=i.find(r=>r.assigned_branch===e);d&&"done"===d.status?o.set(e,"completed"):"running"===c?o.set(e,"working"):d?o.set(e,"assigned"):o.set(e,"idle")}return o})(P,V,U,A,v),[P,U,A,v,V]),G=(0,W.useCallback)(()=>{Y(e=>wL(e,v))},[v]),J=(0,W.useCallback)(()=>{Y(e=>{let r;return(r=new Map(e)).set(wP(v),"completed"),r}),K(),q()},[v,K,q]),Z=(0,W.useCallback)(()=>{q()},[q]),Q=(0,W.useCallback)((e,r)=>{Y(s=>{let i="running"===r?{realtimeStatuses:wL(s,e),shouldRefetchTasks:!1}:{realtimeStatuses:wB(s,e),shouldRefetchTasks:!0};return i.shouldRefetchTasks&&K(),i.realtimeStatuses}),q()},[q,K]),ee=(0,W.useCallback)(e=>{Y(r=>wB(r,e)),K(),q()},[K,q]),et=(0,W.useCallback)(()=>{K()},[K]);e=j?.id??null,r={onSessionStatus:Q,onSessionFinished:ee,onTaskChanged:et},s=(0,W.useRef)(r.onSessionStatus),i=(0,W.useRef)(r.onSessionFinished),n=(0,W.useRef)(r.onTaskChanged),(0,W.useEffect)(()=>{s.current=r.onSessionStatus,i.current=r.onSessionFinished,n.current=r.onTaskChanged}),(0,W.useEffect)(()=>{if(!e)return;let r=(0,iR.getAuthToken)(),o=r?`?token=${encodeURIComponent(r)}`:"",a=new EventSource(`${"localhost"===window.location.hostname&&"3000"===window.location.port?"http://localhost:5173":""}/api/events${o}`);return a.onmessage=r=>{try{let o=JSON.parse(r.data);if(o.projectId!==e)return;"session:status"===o.type?s.current?.(o.branch,o.status):"session:finished"===o.type?i.current?.(o.branch):("task:created"===o.type||"task:updated"===o.type||"task:deleted"===o.type)&&n.current?.()}catch{}},()=>{a.close()}},[e]);let er=(0,W.useMemo)(()=>{let e=wP(v);return A.find(r=>r.assigned_branch===e)??null},[A,v]),es=(0,W.useCallback)(e=>{C(async()=>{await b.current?.submitMessage(e.description??e.title)})},[]),ei=(0,W.useCallback)(e=>{Y(e=>wB(e,v)),z(e,{assigned_branch:null})},[v,z]);(0,W.useEffect)(()=>{void 0!==w.current&&w.current!==j?.id&&x(null),w.current=j?.id},[j?.id]),(0,W.useEffect)(()=>{!L&&0!==P.length&&(P.some(e=>e.branch===v)||x(P[0].branch))},[P,L,v]),(0,W.useEffect)(()=>{if(N)return;let e=wT({projectId:j?.id,tab:_,branch:v});window.history.replaceState(null,"",e)},[j?.id,_,v,N]);let en=(0,W.useCallback)(e=>{B(),x(e)},[B]),eo=(0,W.useCallback)((e,r)=>{j&&r!==j.agent_mode?M(j.id,{agentMode:r}).then(()=>{b.current?.submitMessage(e)}):b.current?.submitMessage(e)},[j,M]),ea=(0,W.useCallback)(()=>{let e=`Please perform the following git operations for this worktree:
|
|
23
23
|
|
|
24
24
|
1. Commit all current uncommitted changes with an appropriate commit message
|
|
25
25
|
2. Fetch the latest changes from the remote main branch
|