import { Event } from "../../../../../base/common/event.js"; import { Disposable, IDisposable } from "../../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../../base/common/observable.js"; import { IAccessibilityService } from "../../../../../platform/accessibility/common/accessibility.service.js"; import { ICommandService } from "../../../../../platform/commands/common/commands.service.js"; import { IContextMenuService } from "../../../../../platform/contextview/browser/contextView.service.js"; import { IInstantiationService } from "../../../../../platform/instantiation/common/instantiation.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IHostService } from "../../../../services/host/browser/host.service.js"; import { IChatModel } from "../../common/model/chatModel.js"; import { ChatPetHorizontalAnchor, ChatPetHorizontalPosition, ChatPetVariant } from "../chatPetService.js"; import { IChatPetService } from "../chatPetService.service.js"; import { ChatPetColor } from "../chatPetColors.js"; import { IChatPetFixedOrientationDecoration } from "./chatPetAccessoryRenderer.js"; import { ChatPetJumpGame } from "./chatPetJumpGame.js"; export type ChatPetState = "idle" | "sleep" | "waking" | "typing" | "rendering" | "painting" | "achievementUnlocked" | "buttonPress" | "complete" | "love" | "clapping" | "jump" | "cool" | "yapping" | "yappingMouthOpen" | "sing" | "speechless" | "worry" | "dizzy" | "falling" | "wallImpact" | "splat" | "onTheRun" | "searching" | "searchingDown"; export type ChatPetClickInteraction = Extract; export interface IChatPetPlatformOccupation { readonly centerX: number; readonly top: number; readonly width: number; } /** Viewport-space top edge of a visible collision surface. */ export interface IChatPetPlatform { readonly left: number; readonly right: number; readonly top: number; readonly element?: HTMLElement; readonly isDefault?: boolean; readonly supportsJumpGame?: boolean; } export interface IChatPetWidgetHost { readonly parent: HTMLElement; readonly dragBounds: HTMLElement; readonly movementBounds: HTMLElement; /** Animation when arriving from a host with a different transition. Unset hosts move instantly. */ readonly transition?: "fall" | "teleport"; readonly model: IObservable; readonly hasInput: IObservable; readonly inputChanged: (listener: () => void) => IDisposable; readonly getPlatformTop: (petCenterX: number | undefined) => number | undefined; /** Includes lower surfaces so a fall from below a raised platform can hit them. */ readonly getPlatforms?: () => readonly IChatPetPlatform[]; readonly onDidChangePlatform: Event; readonly setPlatformOccupation?: (occupation: IChatPetPlatformOccupation | undefined) => void; } /** The layer the pet is positioned in, spanning its host. */ export declare const CHAT_PET_OVERLAY_CLASS = "chat-pet-overlay"; export declare const CHAT_PET_IDLE_SLEEP_DELAY = 20000; export declare const CHAT_PET_CONFIRMATION_ATTENTION_DURATION = 2000; export declare const CHAT_PET_ACHIEVEMENT_UNLOCKED_DURATION = 10000; export declare const CHAT_PET_ICON_TRANSFORMATION_CHANCE: number; export declare const CHAT_PET_YAPPING_CHANCE: number; export declare const CHAT_PET_WALL_IMPACT_DURATION = 48; export declare const CHAT_PET_MOUSE_BOUNCE_RELEASE_GRACE_DURATION = 500; export declare const CHAT_PET_BOUNCE_RESULT_DURATION = 5000; export declare const CHAT_PET_CONFETTI_SCORE = 20; export declare const CHAT_PET_WINDOW_OWNERSHIP_CHANNEL = "vscode-chat-pet-window-ownership"; interface ChatPetSpriteSource { readonly url: string; readonly frameWidth: number; readonly frameHeight?: number; readonly frameCount: number; /** Maps animation steps to source-sheet frames without duplicating identical poses. */ readonly frameIndices?: readonly number[]; readonly fixedOrientationDecorations?: readonly IChatPetFixedOrientationDecoration[]; readonly frameDurations: readonly number[]; readonly iterations: number; readonly accessoryRigFrame?: number; } interface ChatPetSpriteSources { readonly animated: ChatPetSpriteSource; readonly reducedMotion: ChatPetSpriteSource; } export declare const CHAT_PET_SING_FIXED_ORIENTATION_DECORATIONS: readonly IChatPetFixedOrientationDecoration[]; interface ChatPetPointerSample { readonly x: number; readonly y: number; readonly time: number; } interface ChatPetThrowVelocity { readonly x: number; readonly y: number; } interface ChatPetThrowMotion extends ChatPetThrowVelocity { readonly left: number; readonly top: number; } type ChatPetWall = "left" | "right"; interface ChatPetThrowBounds { readonly minimumLeft: number; readonly maximumLeft: number; readonly minimumTop: number; } interface ChatPetLanding { readonly left: number; readonly top: number; readonly platform: IChatPetPlatform | undefined; } interface ChatPetThrowStep extends ChatPetThrowMotion { readonly wall: ChatPetWall | undefined; } export declare function getChatPetBuddyName(quality: string | undefined): "buddy-idle-stable" | "buddy-idle-insiders"; export declare function doesChatPetStateTrackCursor(state: ChatPetState | undefined): boolean; export declare function doesChatPetStateBlink(state: ChatPetState | undefined, frameIndex?: number): boolean; export declare function getChatPetSpriteName(state: ChatPetState, quality: string | undefined): string; export declare function getChatPetFrameDurations(state: ChatPetState): readonly number[]; export declare function getChatPetSpeechFrameDurations(): readonly number[]; export declare function getChatPetRespawnFrameDurations(): readonly number[]; export declare function getChatPetSpriteSources(variant: ChatPetVariant): Record; export declare function drawChatPetAchievementStar(context: CanvasRenderingContext2D, color: ChatPetColor): void; export declare function isChatPetImageSource(image: Pick, source: string): boolean; export declare function getChatPetBaseState(hasActiveRequest: boolean, needsInput: boolean, confirmationAttentionExpired: boolean, hasInput: boolean, idleExpired: boolean, isGeneratingImage?: boolean): ChatPetState; export declare function getChatPetListPadding(enabled: boolean, visible: boolean, scale: number): number; export declare function isChatPetVisible(enabled: boolean, windowActive?: boolean): boolean; export declare function isChatPetWindowActive(activeWindowId: number, targetWindowId: number): boolean; export declare function shouldClaimChatPetWindowOnConstruction(windowActive: boolean, documentFocused: boolean): boolean; export declare function isChatPetKeyboardInteractionEnabled(enabled: boolean, isDead: boolean, hasPointerInteraction: boolean, isAirborne: boolean, onTheRun: boolean): boolean; export declare function getChatPetRenderedState(baseState: ChatPetState, transientState: ChatPetState | undefined, isDragging: boolean): ChatPetState; type ChatPetAnimationFrame = { frameIndex: number; complete: true; } | { frameIndex: number; complete: false; nextFrameDelay: number; }; export declare function getChatPetAnimationFrame(frameDurations: readonly number[], elapsed: number, iterations: number, reverse?: boolean): ChatPetAnimationFrame; export declare function getChatPetClickInteraction(random: number, previousInteraction?: ChatPetClickInteraction): ChatPetClickInteraction; export declare function getChatPetBlinkDelay(random: number): number; export declare function getChatPetGazeDirection(cursorX: number, cursorY: number, petCenterX: number, petCenterY: number): readonly [ number, number ]; export declare function getChatPetEyeAccessoryGazeOffset(gazeDirection: readonly [ number, number ]): readonly [ number, number ]; export declare class ChatPetBlinkController extends Disposable { private readonly onBlinkChange; private readonly random; private readonly _blinkScheduler; private _enabled; private _blinking; constructor(onBlinkChange: (blinking: boolean) => void, random?: () => number); setEnabled(enabled: boolean): void; onAnimationComplete(): void; private _scheduleBlink; private _startBlink; private _setBlinking; } type ChatPetFacingDirection = "left" | "right"; export declare class ChatPetFacingController { private _direction; private _tracksCursor; get direction(): ChatPetFacingDirection; setDirection(direction: ChatPetFacingDirection): void; setState(state: ChatPetState, isDragging: boolean): void; snapToCursor(cursorX: number, petCenterX: number): ChatPetFacingDirection; update(cursorX: number, petCenterX: number): ChatPetFacingDirection; } export declare class ChatPetDirectionChangeController { private readonly directionChangeCount; private readonly maxDirectionChangeInterval; private _lastDirection; private _lastDirectionChangeTime; private _directionChangeCount; constructor(directionChangeCount?: number, maxDirectionChangeInterval?: number); record(direction: ChatPetFacingDirection, timestamp: number): boolean; reset(): void; } export declare function getChatPetHorizontalPosition(left: number, minimumLeft: number, maximumLeft: number): number; export declare function getChatPetDefaultHorizontalPosition(minimumLeft: number, maximumLeft: number): number; export declare function getChatPetRestoredHorizontalPosition(position: ChatPetHorizontalPosition | undefined, minimumLeft: number, maximumLeft: number): number; export declare function getChatPetRelativeHorizontalPosition(left: number, minimumLeft: number, maximumLeft: number): number | undefined; export declare function getChatPetHorizontalAnchor(left: number, minimumLeft: number, maximumLeft: number): ChatPetHorizontalAnchor; export declare function getChatPetAnchoredHorizontalPosition(anchor: ChatPetHorizontalAnchor, minimumLeft: number, maximumLeft: number): number; export declare function getChatPetScale(scale: number, delta: number): number; export declare function getChatPetDragPosition(left: number, top: number, minimumLeft: number, maximumLeft: number, minimumTop: number, maximumTop: number): readonly [ number, number ]; export declare function getChatPetThrowVelocity(samples: readonly ChatPetPointerSample[], releaseTime: number): ChatPetThrowVelocity | undefined; export declare function getChatPetWallReboundVelocity(velocity: ChatPetThrowVelocity): ChatPetThrowVelocity; export declare function getChatPetMouseBounceVelocity(motion: ChatPetThrowVelocity, pointerVelocity: ChatPetThrowVelocity, pointerX: number, petLeft: number, petWidth: number): ChatPetThrowVelocity; export declare function isChatPetMouseContact(pointerX: number, pointerY: number, petBounds: Pick): boolean; export declare function isChatPetMouseBounceEligible(verticalVelocity: number): boolean; export declare function isChatPetMouseBounceGracePeriodElapsed(now: number, availableAt: number): boolean; export declare function shouldDismissChatPetBounceResult(state: ChatPetState): boolean; export declare function shouldCelebrateChatPetBounceScore(score: number): boolean; export declare function getChatPetMouseCollisionTime(previousLeft: number, previousTop: number, left: number, top: number, petWidth: number, petHeight: number, pointerX: number, pointerY: number): number | undefined; export declare function getChatPetThrowRotation(rotation: number, horizontalDistance: number, verticalVelocity: number, elapsed: number): number; export declare function advanceChatPetThrow(motion: ChatPetThrowMotion, elapsed: number, bounds: ChatPetThrowBounds, maximumFallSpeed?: number): ChatPetThrowStep; export declare function shouldSettleChatPetThrow(startTime: number, currentTime: number, top: number, verticalVelocity: number, floorTop: number): boolean; export declare function getChatPetFallTarget(petLeft: number, petTop: number, petWidth: number, petHeight: number, platforms: readonly IChatPetPlatform[], floorBottom: number): ChatPetLanding; export declare function getChatPetThrowLanding(previousLeft: number, previousTop: number, left: number, top: number, petWidth: number, petHeight: number, platforms: readonly IChatPetPlatform[], floorTop: number): ChatPetLanding | undefined; export declare function getChatPetFallDuration(distance: number, hasAnimatedPropeller?: boolean): number; export declare function getChatPetThrowMaximumFallSpeed(hasAnimatedPropeller: boolean): number | undefined; export declare function getChatPetVerticalOffset(hostTop: number, inputTop: number): number; export declare function getChatPetPlatformTop(hostTop: number, inputTop: number, substantiveSurfaceTop?: number): number; export declare function getChatPetHorizontalPlatformTop(petCenterX: number, platformBounds: readonly Pick[]): number | undefined; /** Topmost surface showing above the input, else the input itself. */ export declare function getChatPetStackPlatform(container: HTMLElement, inputContainer: HTMLElement, startAfter?: Element): IChatPetPlatform; /** Top of the topmost surface showing above the input, else the input's own top. */ export declare function getChatPetStackPlatformTop(container: HTMLElement, inputContainer: HTMLElement, startAfter?: Element): number; export declare function shouldPlaceChatPetSpeechBubbleLeft(state: ChatPetState | undefined, buttonRight: number, inputRight: number, scale?: number): boolean; export declare function getChatPetWideSpriteHorizontalOffset(state: ChatPetState | undefined, facingDirection: ChatPetFacingDirection, buttonLeft: number, buttonRight: number, inputLeft: number, inputRight: number, scale?: number): number; export declare function setChatPetWideLayerOffset(offset: number, layers: readonly HTMLElement[]): void; export declare class ChatPetHopController extends Disposable { private readonly callbacks; private readonly _stepScheduler; private readonly _restScheduler; private _direction; private _heldUntil; private _active; constructor(callbacks: { readonly onDirectionChange: (direction: number) => void; readonly onMove: (delta: number) => void; readonly onStart: () => void; readonly onReducedMotionStart: () => void; readonly onRequest: () => void; }); request(direction: number, motionReduced: boolean): void; cancel(): void; onAnimationComplete(): void; private _beginHop; private _applyStep; } export declare class ChatPetWidget extends Disposable { private readonly chatPetService; private readonly accessibilityService; private readonly contextMenuService; private readonly commandService; private readonly logService; private readonly hostService; private readonly instantiationService; private parent; private dragBounds; private movementBounds; private readonly _host; private readonly _isGeneratingImage; private readonly _hostLayoutDisposables; private readonly _hostTransition; private readonly _jumpGame; private readonly _jumpGameExit; private readonly _jumpGameFallLayer; private readonly _jumpGameActive; private _jumpGameFacing; private readonly _hostPositionScheduler; private _lastHostPosition; private readonly _overlay; private readonly _button; private readonly _visual; private readonly _bounceCounter; private readonly _confettiAnchor; private readonly _respawnEffect; private readonly _sprites; private readonly _speechBubble; private _speechBubbleState; private readonly _eyes; private readonly _propellerPoseContainer; private readonly _propellerContainer; private readonly _propeller; private readonly _eyeAccessoryContainer; private readonly _eyeAccessory; private _eyeAccessoryVisible; private _eyeAccessoryFixedOrientation; private _eyeAccessoryDimensions; private _eyeAccessoryGazeOffset; private _gazeDirection; private _redrawEyeAccessory; private readonly _pupils; private readonly _blinkController; private readonly _facingController; private readonly _directionChangeController; private readonly _gazeScheduler; private _dragOrigin; private _dragPosition; private readonly _animationVisibility; private readonly _onDidChangeAnimationVisibility; private readonly _dragMonitor; private readonly _idleExpired; private readonly _confirmationAttentionExpired; private readonly _transientState; private readonly _isDragging; private readonly _isDead; private readonly _idleScheduler; private readonly _confirmationAttentionScheduler; private readonly _transientScheduler; private readonly _clickSuppressionScheduler; private readonly _bounceResultScheduler; private readonly _spriteAnimation; private readonly _speechAnimation; private readonly _respawnAnimation; private readonly _throwAnimation; private readonly _respawnEffectScheduler; private readonly _respawnFallScheduler; private readonly _hopController; private readonly _contextMenuActions; private _cursorPosition; private readonly _cursorSamples; private _cursorContactingPet; private _mouseBounceArmed; private _mouseBounceAvailableAt; private _bounceCount; private _bounceResultVisible; private _throwBounceHandler; private _activeSprite; private _activeSource; private _pendingRender; private _pendingAccessorySwitch; private _renderGeneration; private _accessoryGeneration; private _activeFrameIndex; private _redrawActiveFrame; private readonly _failedAccessorySources; private _renderedState; private _motionReduced; private _enabled; private _busy; private _enablementInitialized; private _positionInitialized; private _hasCustomPosition; private _horizontalAnchor; private _suppressNextPointerClick; private _contextMenuVisible; private _lastClickInteraction; private _restingPlatform; private _fallThroughPlatform; private _throwWallImpact; private _throwGeometryDirty; private _deathPosition; private _respawnPhase; private _respawnPosition; private readonly _resizeObserver; private _variant; private _color; private _selectedAccessory; private _scale; constructor(host: IChatPetWidgetHost, options: { readonly resizeObserverCtor?: typeof ResizeObserver; readonly intersectionObserverCtor?: typeof IntersectionObserver; } | undefined, chatPetService: IChatPetService, accessibilityService: IAccessibilityService, contextMenuService: IContextMenuService, commandService: ICommandService, logService: ILogService, hostService: IHostService, instantiationService: IInstantiationService); get jumpGame(): ChatPetJumpGame | undefined; private _getJumpGamePlatform; private _tryStartJumpGame; private _stopJumpGame; setHost(host: IChatPetWidgetHost): void; private _isAnimationVisible; private _updateAnimationVisibility; private _getHostPosition; private _rememberHostPosition; private _getHostTransitionTarget; private _setHostTransitionPosition; private _updateHostTransition; private _prepareHostTransition; private _startHostTransition; private _beginHostTransitionFall; private _completeHostTeleport; private _finishHostTransition; private _observeHost; private _handleHostLayoutChange; private _updatePlatformPosition; private _updateRestingPosition; private _startDrag; private _commitDragPosition; private _setDragPosition; private _getFallTarget; private _getThrowGeometry; private _beginThrow; private _setThrowPosition; private _finishThrow; private _isAirborne; private _beginFall; private _completeFall; private _showContextMenu; private _onKeyDown; private _getAriaLabel; private _getCurrentLeft; private _getDisplaySize; private _setScale; private _setHorizontalPosition; private _setAnchoredHorizontalPosition; private _applyHorizontalPosition; private _setDefaultHorizontalPosition; private _getHorizontalBounds; private _getPlatforms; private _getInitialPlatform; private _updateRunLayer; private _setInitialVerticalPosition; private _reconcileRestingPlatform; private _setRestingPlatform; private _updatePlatformOccupation; private _clearPlatformOccupation; private _showRespawnSequence; private _updateRespawnEffectPosition; private _showRespawnEffect; private _startRespawnEffectAnimation; private _beginRespawnFall; private _updateSpeechBubblePosition; private _tryMouseBounce; private _trackCursor; private _getCursorVelocity; private _bounceAirbornePet; private _updateBounceCounterPosition; private _showBounceConfetti; private _resetBounceCount; private _showBounceResult; private _dismissBounceResult; private _updateGaze; private _snapFacingToCursor; private _setFacingDirection; private _recordDirectionChange; private _startEnableAnimation; private _restoreHorizontalPosition; private _startDisableAnimation; private _finishDisable; private _showTransientState; private _wake; private _beginWakeAnimation; private _renderState; private _getAccessoryImageSource; private _hasAnimatedPropeller; private _onBodyImageLoad; private _onBodyImageError; private _onAccessoryImageLoad; private _onAccessoryImageError; private _tryCompletePendingRender; private _switchAccessory; private _tryCompleteAccessorySwitch; private _completeAccessorySwitchWithoutAccessory; private _recordAccessoryFailure; private _clearUnusedAccessoryImages; private _clearAllAccessoryImages; private _setRenderedFacingState; private _updateEyes; private _onSpriteAnimationComplete; private _startSpriteAnimation; private _drawEyeAccessory; private _drawPropeller; private _restartPropellerPoseAnimation; private _updateSpeechBubble; } export {};