diff --git a/AGENTS.md b/AGENTS.md index c7803a2ab4fc8..8ca69d889228c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,7 +43,7 @@ bun run format # biome format via turbo bun run typecheck # tsc across workspace (8 GB heap) bun run test # full suite (run-all-tests.mjs) bun run test:server # core/agent/app-core/shared/vault/elizaos/skills/scenario-runner -bun run test:client # app/ui + lifeops/companion/training plugins +bun run test:client # app/ui + lifeops/training plugins bun run test:e2e # end-to-end lane bun run start # run an agent (packages/agent start) bun run clean # nuke dist/.turbo/node_modules, reinstall, rebuild @@ -88,7 +88,7 @@ plugins/ runtime plugins and app plugins plugin-native-*/ native device bridges (camera, contacts, calendar, location, …) plugin-local-inference/ on-device llama.cpp / omnivoice / whisper (git submodules under native/) plugin-sql/ plugin-localdb/ plugin-inmemorydb/ storage adapters - plugin-companion/ plugin-documents/ plugin-lifeops/ plugin-health/ … app plugins + plugin-documents/ plugin-lifeops/ plugin-health/ … app plugins scripts/ repo automation patches/ dependency patches skills/ runtime skill packages turbo.json knip.json build + dead-code config diff --git a/CLAUDE.md b/CLAUDE.md index c7803a2ab4fc8..8ca69d889228c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,7 +43,7 @@ bun run format # biome format via turbo bun run typecheck # tsc across workspace (8 GB heap) bun run test # full suite (run-all-tests.mjs) bun run test:server # core/agent/app-core/shared/vault/elizaos/skills/scenario-runner -bun run test:client # app/ui + lifeops/companion/training plugins +bun run test:client # app/ui + lifeops/training plugins bun run test:e2e # end-to-end lane bun run start # run an agent (packages/agent start) bun run clean # nuke dist/.turbo/node_modules, reinstall, rebuild @@ -88,7 +88,7 @@ plugins/ runtime plugins and app plugins plugin-native-*/ native device bridges (camera, contacts, calendar, location, …) plugin-local-inference/ on-device llama.cpp / omnivoice / whisper (git submodules under native/) plugin-sql/ plugin-localdb/ plugin-inmemorydb/ storage adapters - plugin-companion/ plugin-documents/ plugin-lifeops/ plugin-health/ … app plugins + plugin-documents/ plugin-lifeops/ plugin-health/ … app plugins scripts/ repo automation patches/ dependency patches skills/ runtime skill packages turbo.json knip.json build + dead-code config diff --git a/README.md b/README.md index 3e6029633a5e4..9913221f46dcc 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Pick a model in **Settings → Model Routing** and it downloads and pins; from t elizaOS runs **apps**, not just an agent. An app is a plugin that adds a surface inside Eliza; the runtime installs, launches, and tracks it like real software, and it survives restarts. - **Browse & install** — catalog at [plugins.elizacloud.ai](https://plugins.elizacloud.ai); curated entries in [`packages/registry`](packages/registry), plus any npm package tagged `elizaos`. -- **First-party apps** — [`plugin-companion`](plugins/plugin-companion), [`plugin-browser`](plugins/plugin-browser), [`plugin-documents`](plugins/plugin-documents), [`plugin-phone`](plugins/plugin-phone), [`plugin-task-coordinator`](plugins/plugin-task-coordinator). +- **First-party apps** — [`plugin-browser`](plugins/plugin-browser), [`plugin-documents`](plugins/plugin-documents), [`plugin-phone`](plugins/plugin-phone), [`plugin-task-coordinator`](plugins/plugin-task-coordinator). - **Earn** — apps deployed through Eliza Cloud can be metered and monetized. ## elizaOS — the operating system diff --git a/bun.lock b/bun.lock index 7023624a77b59..b85763b9dd86a 100644 --- a/bun.lock +++ b/bun.lock @@ -241,7 +241,6 @@ "@elizaos/plugin-agent-orchestrator": "workspace:*", "@elizaos/plugin-background-runner": "workspace:*", "@elizaos/plugin-blocker": "workspace:*", - "@elizaos/plugin-companion": "workspace:*", "@elizaos/plugin-contacts": "workspace:*", "@elizaos/plugin-elizacloud": "workspace:*", "@elizaos/plugin-facewear": "workspace:*", @@ -3189,49 +3188,6 @@ "vitest": "^4.0.18", }, }, - "plugins/plugin-companion": { - "name": "@elizaos/plugin-companion", - "version": "2.0.3-beta.7", - "dependencies": { - "@elizaos/agent": "workspace:*", - "@elizaos/app-core": "workspace:*", - "@elizaos/core": "workspace:*", - "@elizaos/plugin-wallet-ui": "workspace:*", - "@elizaos/shared": "workspace:*", - "@elizaos/ui": "workspace:*", - "lucide-react": "^1.0.0", - }, - "devDependencies": { - "@biomejs/biome": "^2.4.14", - "@pixiv/three-vrm": "^3.5.2", - "@playwright/test": "^1.58.2", - "@storybook/addon-a11y": "^10.0.0", - "@storybook/addon-docs": "^10.0.0", - "@storybook/addon-themes": "^10.0.0", - "@storybook/react": "^10.0.0", - "@storybook/react-vite": "^10.0.0", - "@types/node": "^25.0.6", - "@types/react": "^19.0.0", - "@types/react-dom": "^19.0.0", - "@types/three": "^0.184.0", - "dotenv": "^17.2.3", - "jsdom": "^29.0.0", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "storybook": "^10.0.0", - "three": "^0.184.0", - "tsup": "^8.5.1", - "typescript": "^6.0.3", - "vite": "^8.0.0", - "vitest": "^4.0.17", - }, - "peerDependencies": { - "@pixiv/three-vrm": "^3.4.5", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "three": "^0.184.0", - }, - }, "plugins/plugin-computeruse": { "name": "@elizaos/plugin-computeruse", "version": "2.0.3-beta.7", @@ -5455,69 +5411,69 @@ }, }, "trustedDependencies": [ - "nx", - "esbuild", + "@elizaos/plugin-starter", + "utf-8-validate", "@swc/core", - "keccak", "protobufjs", - "sharp", - "utf-8-validate", - "bigint-buffer", - "bufferutil", + "keccak", "secp256k1", - "@elizaos/plugin-starter", + "bufferutil", "workerd", - "electron", + "esbuild", + "sharp", "@biomejs/biome", + "electron", + "nx", + "bigint-buffer", ], "patchedDependencies": { - "@solana/rpc@5.5.1": "patches/@solana%2Frpc@5.5.1.patch", - "@solana/sysvars@5.5.1": "patches/@solana%2Fsysvars@5.5.1.patch", - "@solana/rpc-spec@5.5.1": "patches/@solana%2Frpc-spec@5.5.1.patch", - "@solana/rpc-subscriptions@5.5.1": "patches/@solana%2Frpc-subscriptions@5.5.1.patch", - "@farcaster/quick-auth@0.0.8": "patches/@farcaster%2Fquick-auth@0.0.8.patch", "@solana/rpc-subscriptions-spec@5.5.1": "patches/@solana%2Frpc-subscriptions-spec@5.5.1.patch", - "@solana/rpc-types@5.5.1": "patches/@solana%2Frpc-types@5.5.1.patch", - "@solana/instruction-plans@5.5.1": "patches/@solana%2Finstruction-plans@5.5.1.patch", - "@solana/codecs-strings@5.5.1": "patches/@solana%2Fcodecs-strings@5.5.1.patch", - "@solana/nominal-types@5.5.1": "patches/@solana%2Fnominal-types@5.5.1.patch", - "@solana/rpc-parsed-types@5.5.1": "patches/@solana%2Frpc-parsed-types@5.5.1.patch", - "@solana/fast-stable-stringify@5.5.1": "patches/@solana%2Ffast-stable-stringify@5.5.1.patch", - "@solana/rpc-spec-types@5.5.1": "patches/@solana%2Frpc-spec-types@5.5.1.patch", "@solana/rpc-transformers@5.5.1": "patches/@solana%2Frpc-transformers@5.5.1.patch", - "@solana/codecs-numbers@5.5.1": "patches/@solana%2Fcodecs-numbers@5.5.1.patch", - "tsup@8.5.1": "patches/tsup@8.5.1.patch", - "@vitest/mocker@4.1.5": "patches/@vitest%2Fmocker@4.1.5.patch", - "@solana/codecs-core@5.5.1": "patches/@solana%2Fcodecs-core@5.5.1.patch", - "@solana/errors@5.5.1": "patches/@solana%2Ferrors@5.5.1.patch", - "@solana/offchain-messages@5.5.1": "patches/@solana%2Foffchain-messages@5.5.1.patch", + "@solana/fast-stable-stringify@5.5.1": "patches/@solana%2Ffast-stable-stringify@5.5.1.patch", + "@solana/rpc-transport-http@5.5.1": "patches/@solana%2Frpc-transport-http@5.5.1.patch", + "@capacitor/barcode-scanner@3.0.2": "patches/@capacitor%2Fbarcode-scanner@3.0.2.patch", "electrobun@1.18.1": "patches/electrobun@1.18.1.patch", - "@solana/codecs@5.5.1": "patches/@solana%2Fcodecs@5.5.1.patch", "@solana/transactions@5.5.1": "patches/@solana%2Ftransactions@5.5.1.patch", - "vitest@4.1.5": "patches/vitest@4.1.5.patch", - "@solana/plugin-core@5.5.1": "patches/@solana%2Fplugin-core@5.5.1.patch", - "@solana/rpc-transport-http@5.5.1": "patches/@solana%2Frpc-transport-http@5.5.1.patch", - "@solana/rpc-subscriptions-api@5.5.1": "patches/@solana%2Frpc-subscriptions-api@5.5.1.patch", + "@solana/rpc-spec@5.5.1": "patches/@solana%2Frpc-spec@5.5.1.patch", + "@solana/codecs-data-structures@5.5.1": "patches/@solana%2Fcodecs-data-structures@5.5.1.patch", + "tsup@8.5.1": "patches/tsup@8.5.1.patch", + "@solana/codecs-core@5.5.1": "patches/@solana%2Fcodecs-core@5.5.1.patch", + "@solana/rpc-spec-types@5.5.1": "patches/@solana%2Frpc-spec-types@5.5.1.patch", "@solana/functional@5.5.1": "patches/@solana%2Ffunctional@5.5.1.patch", + "@solana/codecs-numbers@5.5.1": "patches/@solana%2Fcodecs-numbers@5.5.1.patch", + "@solana/sysvars@5.5.1": "patches/@solana%2Fsysvars@5.5.1.patch", "bigint-buffer@1.1.5": "patches/bigint-buffer@1.1.5.patch", - "@solana/addresses@5.5.1": "patches/@solana%2Faddresses@5.5.1.patch", - "telegraf@4.16.3": "patches/telegraf@4.16.3.patch", - "@solana/kit@5.5.1": "patches/@solana%2Fkit@5.5.1.patch", - "@solana/assertions@5.5.1": "patches/@solana%2Fassertions@5.5.1.patch", - "@solana/codecs-data-structures@5.5.1": "patches/@solana%2Fcodecs-data-structures@5.5.1.patch", - "@solana/promises@5.5.1": "patches/@solana%2Fpromises@5.5.1.patch", + "@solana/offchain-messages@5.5.1": "patches/@solana%2Foffchain-messages@5.5.1.patch", + "@solana/rpc-parsed-types@5.5.1": "patches/@solana%2Frpc-parsed-types@5.5.1.patch", + "@solana/rpc-subscriptions@5.5.1": "patches/@solana%2Frpc-subscriptions@5.5.1.patch", "@solana/keys@5.5.1": "patches/@solana%2Fkeys@5.5.1.patch", - "@solana/transaction-messages@5.5.1": "patches/@solana%2Ftransaction-messages@5.5.1.patch", - "@solana/rpc-subscriptions-channel-websocket@5.5.1": "patches/@solana%2Frpc-subscriptions-channel-websocket@5.5.1.patch", - "@solana/subscribable@5.5.1": "patches/@solana%2Fsubscribable@5.5.1.patch", - "@solana/rpc-api@5.5.1": "patches/@solana%2Frpc-api@5.5.1.patch", "@solana/transaction-confirmation@5.5.1": "patches/@solana%2Ftransaction-confirmation@5.5.1.patch", - "@solana/options@5.5.1": "patches/@solana%2Foptions@5.5.1.patch", + "@solana/addresses@5.5.1": "patches/@solana%2Faddresses@5.5.1.patch", + "@solana/transaction-messages@5.5.1": "patches/@solana%2Ftransaction-messages@5.5.1.patch", + "@solana/promises@5.5.1": "patches/@solana%2Fpromises@5.5.1.patch", + "@solana/errors@5.5.1": "patches/@solana%2Ferrors@5.5.1.patch", + "@solana/nominal-types@5.5.1": "patches/@solana%2Fnominal-types@5.5.1.patch", "@solana/instructions@5.5.1": "patches/@solana%2Finstructions@5.5.1.patch", + "@solana/kit@5.5.1": "patches/@solana%2Fkit@5.5.1.patch", + "@solana/rpc-api@5.5.1": "patches/@solana%2Frpc-api@5.5.1.patch", + "@solana/rpc-types@5.5.1": "patches/@solana%2Frpc-types@5.5.1.patch", "@solana/signers@5.5.1": "patches/@solana%2Fsigners@5.5.1.patch", - "@capacitor/barcode-scanner@3.0.2": "patches/@capacitor%2Fbarcode-scanner@3.0.2.patch", - "@solana/accounts@5.5.1": "patches/@solana%2Faccounts@5.5.1.patch", + "@solana/codecs-strings@5.5.1": "patches/@solana%2Fcodecs-strings@5.5.1.patch", + "vitest@4.1.5": "patches/vitest@4.1.5.patch", "@solana/programs@5.5.1": "patches/@solana%2Fprograms@5.5.1.patch", + "@solana/rpc@5.5.1": "patches/@solana%2Frpc@5.5.1.patch", + "@solana/assertions@5.5.1": "patches/@solana%2Fassertions@5.5.1.patch", + "@solana/options@5.5.1": "patches/@solana%2Foptions@5.5.1.patch", + "@farcaster/quick-auth@0.0.8": "patches/@farcaster%2Fquick-auth@0.0.8.patch", + "@solana/subscribable@5.5.1": "patches/@solana%2Fsubscribable@5.5.1.patch", + "@solana/accounts@5.5.1": "patches/@solana%2Faccounts@5.5.1.patch", + "@solana/instruction-plans@5.5.1": "patches/@solana%2Finstruction-plans@5.5.1.patch", + "telegraf@4.16.3": "patches/telegraf@4.16.3.patch", + "@vitest/mocker@4.1.5": "patches/@vitest%2Fmocker@4.1.5.patch", + "@solana/codecs@5.5.1": "patches/@solana%2Fcodecs@5.5.1.patch", + "@solana/plugin-core@5.5.1": "patches/@solana%2Fplugin-core@5.5.1.patch", + "@solana/rpc-subscriptions-api@5.5.1": "patches/@solana%2Frpc-subscriptions-api@5.5.1.patch", + "@solana/rpc-subscriptions-channel-websocket@5.5.1": "patches/@solana%2Frpc-subscriptions-channel-websocket@5.5.1.patch", }, "overrides": { "@ai-sdk/gateway": "3.0.109", @@ -6305,8 +6261,6 @@ "@elizaos/plugin-commands": ["@elizaos/plugin-commands@workspace:plugins/plugin-commands"], - "@elizaos/plugin-companion": ["@elizaos/plugin-companion@workspace:plugins/plugin-companion"], - "@elizaos/plugin-computeruse": ["@elizaos/plugin-computeruse@workspace:plugins/plugin-computeruse"], "@elizaos/plugin-contacts": ["@elizaos/plugin-contacts@workspace:plugins/plugin-contacts"], diff --git a/knip.json b/knip.json index 631d8d32de9fd..916decf543f04 100644 --- a/knip.json +++ b/knip.json @@ -501,9 +501,6 @@ "plugins/plugin-native-activity-tracker": { "ignoreBinaries": ["swiftc"] }, - "plugins/plugin-companion": { - "ignore": [".storybook-smoke/**", "public/vrm-decoders/draco/*.js"] - }, "packages/elizaos": { "entry": [ "src/**/*.ts", diff --git a/package.json b/package.json index adbbe7e170e32..c21f6e089ec7c 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "test:apple-entitlements": "bun run --cwd packages/app-core test:apple-entitlements", "test:cache-stability": "node packages/scripts/run-vitest.mjs run packages/core/src/runtime/__tests__/cache-key-stability.test.ts", "test:plugins": "bun run build:core && TEST_PACKAGE_FILTER='\\(plugins/' TEST_SCRIPT_FILTER='^test$' node packages/scripts/run-all-tests.mjs --only=test --no-cloud --concurrency=3", - "test:client": "bun run build:core && TEST_PACKAGE_FILTER='\\((packages/app|packages/ui|plugins/plugin-personal-assistant|plugins/plugin-companion|plugins/plugin-training)\\)' TEST_SCRIPT_FILTER='^test$' node packages/scripts/run-all-tests.mjs --no-cloud", + "test:client": "bun run build:core && TEST_PACKAGE_FILTER='\\((packages/app|packages/ui|plugins/plugin-personal-assistant|plugins/plugin-training)\\)' TEST_SCRIPT_FILTER='^test$' node packages/scripts/run-all-tests.mjs --no-cloud", "test:core": "node packages/scripts/with-test-runtime.mjs node packages/scripts/run-turbo.mjs run test --filter=./packages/core", "test:server": "bun run build:core && TEST_PACKAGE_FILTER='\\((packages/agent|packages/app-core|packages/shared|packages/core|packages/tui|packages/vault|packages/elizaos|packages/skills|packages/scenario-runner|packages/test)\\)' TEST_SCRIPT_FILTER='^test$' node packages/scripts/run-all-tests.mjs --no-cloud", "test:remote-capabilities": "bun run --cwd packages/agent test:remote-capabilities", diff --git a/packages/agent/scripts/build-mobile-bundle.mjs b/packages/agent/scripts/build-mobile-bundle.mjs index bce5d6822c270..c99175a1775a7 100644 --- a/packages/agent/scripts/build-mobile-bundle.mjs +++ b/packages/agent/scripts/build-mobile-bundle.mjs @@ -327,7 +327,7 @@ const nativeStubs = { // a per-boot passphrase if needed. Stub keeps the bundle building. "@napi-rs/keyring": path.join(stubsDir, "null-plugin.cjs"), // React + react-dom stubs: workspace plugins (`@elizaos/plugin-personal-assistant`, - // `@elizaos/plugin-companion`, etc.) re-export their UI subtree from + // etc.) re-export their UI subtree from // `src/index.ts` for the host app to consume. The agent only loads each // package's runtime plugin object, but Bun.build still has to resolve // every import in the dependency closure. Without these stubs Bun follows @@ -392,7 +392,7 @@ if (TARGET === "ios-jsc") { // closure pulls in `@elizaos/core@2.0.0-alpha.3` or `2.0.0-alpha.223`. // // Other packages — including `@elizaos/plugin-task-coordinator`, -// `@elizaos/plugin-companion`, `@elizaos/plugin-personal-assistant`, `@elizaos/plugin-training` +// `@elizaos/plugin-personal-assistant`, `@elizaos/plugin-training` // — are imported by `api/server.ts` as named functions (e.g. // `wireCoordinatorBridgesWhenReady`). Stubbing them with a Proxy doesn't // satisfy Bun's `__toESM` namespace builder (it iterates `ownKeys`), so we diff --git a/packages/agent/src/__tests__/plugin-tui-view-coverage.test.ts b/packages/agent/src/__tests__/plugin-tui-view-coverage.test.ts index 4741f4a3438a8..c29b61c0388fe 100644 --- a/packages/agent/src/__tests__/plugin-tui-view-coverage.test.ts +++ b/packages/agent/src/__tests__/plugin-tui-view-coverage.test.ts @@ -30,7 +30,6 @@ const repoRoot = resolve( ); const VIEW_MANIFESTS = [ - "plugins/plugin-companion/src/plugin.ts", "plugins/plugin-contacts/src/plugin.ts", "plugins/plugin-hyperliquid/src/plugin.ts", "plugins/plugin-messages/src/plugin.ts", @@ -49,12 +48,6 @@ const VIEW_MANIFESTS = [ ] as const; const TUI_PARITY_CAPABILITIES: Record = { - "plugins/plugin-companion/src/components/companion/CompanionView.tsx": [ - "terminal-companion-state", - "terminal-companion-emotes", - "terminal-companion-play-emote", - "terminal-companion-stop-emote", - ], // Each collapsed plugin re-exports its `View` componentExport and the // `interact` capability handler from a `-view-bundle.ts` entry file, so // that bundle entry owns the terminal parity capabilities (same pattern as diff --git a/packages/agent/src/__tests__/view-agent-surface-coverage.test.ts b/packages/agent/src/__tests__/view-agent-surface-coverage.test.ts index 8e1ae12622c9c..1c69e3f2c16fb 100644 --- a/packages/agent/src/__tests__/view-agent-surface-coverage.test.ts +++ b/packages/agent/src/__tests__/view-agent-surface-coverage.test.ts @@ -17,7 +17,6 @@ const CONVERTED_PLUGINS = [ "plugin-wallet-ui", "app-model-tester", "plugin-app-control", - "plugin-companion", "plugin-contacts", "plugin-facewear", "plugin-feed", @@ -141,7 +140,6 @@ const CONVERTED_SUBCOMPONENTS = [ "settings/AppsManagementSection", "settings/DesktopWorkspaceSection", "settings/LoadContentPackForm", - "settings/PolicyControlsView", "settings/RemotePluginHostSection", "settings/SecuritySettingsSection", "settings/VaultInventoryPanel", diff --git a/packages/agent/src/__tests__/view-bundle-lifecycle.test.ts b/packages/agent/src/__tests__/view-bundle-lifecycle.test.ts index 2b43602a07146..25aaf1612a98e 100644 --- a/packages/agent/src/__tests__/view-bundle-lifecycle.test.ts +++ b/packages/agent/src/__tests__/view-bundle-lifecycle.test.ts @@ -25,7 +25,6 @@ const repoRoot = resolve( ); const PLUGIN_VIEW_MANIFESTS = [ - "plugins/plugin-companion/src/plugin.ts", "plugins/plugin-contacts/src/plugin.ts", "plugins/plugin-hyperliquid/src/plugin.ts", "plugins/plugin-messages/src/plugin.ts", diff --git a/packages/agent/src/__tests__/view-user-journeys.ts b/packages/agent/src/__tests__/view-user-journeys.ts index 76f7fd68e1928..7b4897f33abff 100644 --- a/packages/agent/src/__tests__/view-user-journeys.ts +++ b/packages/agent/src/__tests__/view-user-journeys.ts @@ -42,8 +42,6 @@ export const PLUGIN_VIEW_LLM_MOCK_CASES: PluginViewMockCase[] = [ // packages/app/test/route-coverage.test.ts). Kept in exact lockstep by // plugin-view-llm-mock-coverage.test.ts; PLUGIN_VIEW_LLM_MOCK_JOURNEYS derives // one journey per case below. - { id: "companion", viewType: "gui", path: "/companion" }, - { id: "companion", viewType: "tui", path: "/companion" }, { id: "contacts", viewType: "gui", path: "/contacts" }, { id: "contacts", viewType: "tui", path: "/contacts" }, { id: "hyperliquid", viewType: "gui", path: "/hyperliquid" }, @@ -98,7 +96,6 @@ export const PLUGIN_VIEW_LLM_MOCK_CASES: PluginViewMockCase[] = [ { id: "training", viewType: "tui", path: "/apps/fine-tuning" }, { id: "facewear", viewType: "tui", path: "/apps/facewear" }, { id: "smartglasses", viewType: "tui", path: "/apps/smartglasses" }, - { id: "companion", viewType: "xr", path: "/companion" }, { id: "contacts", viewType: "xr", path: "/contacts" }, { id: "hyperliquid", viewType: "xr", path: "/hyperliquid" }, { id: "messages", viewType: "xr", path: "/messages" }, diff --git a/packages/agent/src/api/misc-routes.ts b/packages/agent/src/api/misc-routes.ts index f8ee1bf8577d1..c1b127b437c39 100644 --- a/packages/agent/src/api/misc-routes.ts +++ b/packages/agent/src/api/misc-routes.ts @@ -14,7 +14,6 @@ import { PostCustomActionGenerateRequestSchema, PostCustomActionRequestSchema, PostCustomActionTestRequestSchema, - PostEmoteRequestSchema, PostIngestShareRequestSchema, PostTerminalRunRequestSchema, PutCustomActionRequestSchema, @@ -69,39 +68,6 @@ function resolveTerminalShellCommand(): { }; } -type CompanionEmote = { - id: string; - path: string; - duration?: number; - loop?: boolean; - [key: string]: unknown; -}; - -const COMPANION_EMOTES_MODULE: string = "@elizaos/plugin-companion"; -let companionEmotesPromise: Promise<{ - catalog: CompanionEmote[]; - byId: Map; -}> | null = null; - -async function loadCompanionEmotes(): Promise<{ - catalog: CompanionEmote[]; - byId: Map; -}> { - companionEmotesPromise ??= import(/* @vite-ignore */ COMPANION_EMOTES_MODULE) - .then((loaded) => { - const catalog = Array.isArray(loaded.EMOTE_CATALOG) - ? (loaded.EMOTE_CATALOG as CompanionEmote[]) - : []; - const byId = - loaded.EMOTE_BY_ID instanceof Map - ? (loaded.EMOTE_BY_ID as Map) - : new Map(catalog.map((emote) => [emote.id, emote])); - return { catalog, byId }; - }) - .catch(() => ({ catalog: [], byId: new Map() })); - return companionEmotesPromise; -} - function toTerminalRunRequestBody( body: Record, ): TerminalRunRequestBody { @@ -234,44 +200,6 @@ export async function handleMiscRoutes( return true; } - // ── GET /api/emotes ────────────────────────────────────────────────── - if (method === "GET" && pathname === "/api/emotes") { - const emotes = await loadCompanionEmotes(); - json(res, { emotes: emotes.catalog }); - return true; - } - - // ── POST /api/emote ───────────────────────────────────────────────── - if (method === "POST" && pathname === "/api/emote") { - const rawEmote = await readJsonBody>(req, res); - if (rawEmote === null) return true; - const parsedEmote = PostEmoteRequestSchema.safeParse(rawEmote); - if (!parsedEmote.success) { - error( - res, - parsedEmote.error.issues[0]?.message ?? "Invalid request body", - 400, - ); - return true; - } - const body = parsedEmote.data; - const emotes = await loadCompanionEmotes(); - const emote = body.emoteId ? emotes.byId.get(body.emoteId) : undefined; - if (!emote) { - error(res, `Unknown emote: ${body.emoteId ?? "(none)"}`); - return true; - } - state.broadcastWs?.({ - type: "emote", - emoteId: emote.id, - path: emote.path, - duration: emote.duration, - loop: false, - }); - json(res, { ok: true }); - return true; - } - // ── POST /api/agent/event ────────────────────────────────────────────── if ( method === "POST" && diff --git a/packages/agent/src/api/server-lazy-routes.ts b/packages/agent/src/api/server-lazy-routes.ts index 1b6cf76556512..c4414f87b488c 100644 --- a/packages/agent/src/api/server-lazy-routes.ts +++ b/packages/agent/src/api/server-lazy-routes.ts @@ -411,8 +411,6 @@ export async function handleMiscRoutes( !( ctx.pathname === "/api/restart" || ctx.pathname === "/api/ingest/share" || - ctx.pathname === "/api/emotes" || - ctx.pathname === "/api/emote" || ctx.pathname === "/api/agent/event" || /^\/api\/agents\/[^/]+\/event$/.test(ctx.pathname) || ctx.pathname === "/api/terminal/run" || diff --git a/packages/agent/src/external-modules.d.ts b/packages/agent/src/external-modules.d.ts index 7a42dba524761..cac92fa3fb148 100644 --- a/packages/agent/src/external-modules.d.ts +++ b/packages/agent/src/external-modules.d.ts @@ -826,9 +826,6 @@ declare module "@elizaos/ui" { export type BrandingConfig = AnyValue; export type CharacterCatalogData = AnyValue; export type CodingAgentTasksPanelProps = AnyValue; - export type CompanionInferenceNotice = AnyValue; - export type CompanionSceneStatus = AnyValue; - export type CompanionShellComponentProps = AnyValue; export type ConversationMessage = AnyValue; export type FeedActivityItem = AnyValue; export type FeedAgentGoal = AnyValue; @@ -841,11 +838,7 @@ declare module "@elizaos/ui" { export type NetworkStatusChangeDetail = AnyValue; export type OverlayApp = AnyValue; export type OverlayAppContext = AnyValue; - export type ResolveCompanionInferenceNoticeArgs = AnyValue; export type ShareTargetPayload = AnyValue; - export type StewardApprovalQueueProps = AnyValue; - export type StewardLogoProps = AnyValue; - export type StewardTransactionHistoryProps = AnyValue; export type SurfaceTone = string; export interface IosLocalAgentNativeRequestOptions { diff --git a/packages/agent/src/runtime/core-plugins.ts b/packages/agent/src/runtime/core-plugins.ts index ee777b600001e..a0b11b1efbfc8 100644 --- a/packages/agent/src/runtime/core-plugins.ts +++ b/packages/agent/src/runtime/core-plugins.ts @@ -125,7 +125,6 @@ export const CORE_PLUGINS: readonly string[] = [ "@elizaos/plugin-sql", // database adapter — required "@elizaos/plugin-local-inference", // local Eliza-1 inference (text + embeddings + voice) — required for memory + on-device generation // @elizaos/plugin-form — standalone form plugin; load via plugin registry/config - "@elizaos/plugin-companion", // VRM companion emotes; actions gated until app session is active // @elizaos/plugin-agent-orchestrator — opt-in via ELIZA_AGENT_ORCHESTRATOR (Eliza app enables by default) // Recurring work uses runtime TaskService + triggers (no @elizaos/plugin-cron). "@elizaos/plugin-app-control", // launch, close, and list running Eliza apps from agent chat @@ -161,7 +160,6 @@ export const CORE_PLUGINS: readonly string[] = [ export const LEAN_CHAT_PLUGINS: readonly string[] = [ "@elizaos/plugin-sql", // database adapter — required "@elizaos/plugin-local-inference", // text + embeddings + voice — required for memory + generation - "@elizaos/plugin-companion", // VRM companion emotes for the app chat surface "@elizaos/plugin-app-control", // VIEWS navigation in the app chat surface "@elizaos/plugin-native-filesystem", // mobile-safe FILE target "@elizaos/plugin-agent-skills", // skill execution + enabled-skills provider @@ -227,7 +225,6 @@ export const BLOCKING_CORE_PLUGINS: readonly string[] = [ * first invocation would silently strip the capability from the planner's * awareness — the model cannot ask for an action or read a provider that has * not registered yet. Concretely, in this set: - * - companion — PLAY_EMOTE action + VRM views * - app-control — app launch/close/list actions * - shell — shell service + shell-history provider * - coding-tools — FILE/SHELL/WORKTREE actions + available-tools provider diff --git a/packages/agent/src/runtime/eliza-plugin.ts b/packages/agent/src/runtime/eliza-plugin.ts index 386c80370d7f1..98d45ca1373da 100644 --- a/packages/agent/src/runtime/eliza-plugin.ts +++ b/packages/agent/src/runtime/eliza-plugin.ts @@ -119,8 +119,6 @@ export function createElizaPlugin(config?: ElizaPluginConfig): Plugin { createOngoingTasksProvider(), ]; - // PLAY_EMOTE lives in @elizaos/plugin-companion (emote catalog + action). - const plugin: Plugin = { name: "eliza", description: "Eliza workspace context, session keys, and lifecycle actions", diff --git a/packages/agent/src/runtime/eliza.ts b/packages/agent/src/runtime/eliza.ts index 1537a89cad334..b8e6c6b0656db 100644 --- a/packages/agent/src/runtime/eliza.ts +++ b/packages/agent/src/runtime/eliza.ts @@ -73,15 +73,14 @@ export { // resolvePlugins is re-exported via index.ts from ./plugin-resolver -// `@elizaos/plugin-personal-assistant` and `@elizaos/plugin-companion` are NOT -// eagerly imported here. Both packages transitively import from -// `@elizaos/agent` (e.g. `hasOwnerAccess` from this package's barrel) — a -// top-level static import would form a module-init cycle that leaves named -// exports (like a plugin's actions array) as `undefined`, crashing -// `runtime.registerPlugin` when it iterates `plugin.actions`. +// `@elizaos/plugin-personal-assistant` is NOT eagerly imported here. It +// transitively imports from `@elizaos/agent` (e.g. `hasOwnerAccess` from this +// package's barrel) — a top-level static import would form a module-init cycle +// that leaves named exports (like a plugin's actions array) as `undefined`, +// crashing `runtime.registerPlugin` when it iterates `plugin.actions`. // -// Both still resolve at plugin-load time via headless dynamic-import -// entrypoints in `plugin-resolver.ts`, after the static module graph has fully +// It still resolves at plugin-load time via a headless dynamic-import +// entrypoint in `plugin-resolver.ts`, after the static module graph has fully // evaluated, so the cycle never forms and browser-only UI exports stay out of // the agent process. // Keep this here as a single sentinel: if we ever need a static reference, @@ -4435,7 +4434,7 @@ export async function startEliza( } // 7d. Register the roles capability (cheap, gates provider/action visibility). - // The remaining core plugins (companion, app-control, device-filesystem, + // The remaining core plugins (app-control, device-filesystem, // shell, coding-tools, agent-skills, commands, google, lifeops, browser, // video) are NOT essential to the chat path and are loaded in the // background after the runtime is ready — see runDeferredBoot below. @@ -5104,7 +5103,7 @@ export async function startEliza( return deferredResolvedPlugins; }; - // Deferred boot: non-essential core plugins (companion, app-control, + // Deferred boot: non-essential core plugins (app-control, // device-filesystem, shell, coding-tools, agent-skills, commands, google, // lifeops, browser, video), auto-enabled providers/connectors, custom // plugins, plus the post-init tail. Runs in the background after the runtime @@ -5211,8 +5210,7 @@ export async function startEliza( installActionAliases(runtime); // Same timing reason: validate the intent→action map only once the deferred // plugins have registered. Run during blocking init it would warn about - // actions like TASKS (agent-orchestrator) and PLAY_EMOTE (companion) that - // simply hadn't loaded yet. + // actions like TASKS (agent-orchestrator) that simply hadn't loaded yet. validateIntentActionMap( runtime.actions.map((a) => a.name), runtime.logger, diff --git a/packages/agent/src/runtime/plugin-resolver.test.ts b/packages/agent/src/runtime/plugin-resolver.test.ts index 9847fbb71ba69..3e7ad7925dacf 100644 --- a/packages/agent/src/runtime/plugin-resolver.test.ts +++ b/packages/agent/src/runtime/plugin-resolver.test.ts @@ -12,9 +12,6 @@ describe("resolveRuntimePluginImportSpecifier", () => { expect( resolveRuntimePluginImportSpecifier("@elizaos/plugin-personal-assistant"), ).toBe("@elizaos/plugin-personal-assistant/plugin"); - expect( - resolveRuntimePluginImportSpecifier("@elizaos/plugin-companion"), - ).toBe("@elizaos/plugin-companion/plugin"); expect( resolveRuntimePluginImportSpecifier("@elizaos/plugin-calendar"), ).toBe("@elizaos/plugin-calendar/plugin"); diff --git a/packages/agent/src/runtime/plugin-resolver.ts b/packages/agent/src/runtime/plugin-resolver.ts index c8a9b9a07b2b6..60ee284fb8c40 100644 --- a/packages/agent/src/runtime/plugin-resolver.ts +++ b/packages/agent/src/runtime/plugin-resolver.ts @@ -78,7 +78,6 @@ type GlobalWithLastFailedPluginDetails = typeof globalThis & { const RUNTIME_APP_PLUGIN_SUBPATHS = new Set([ "@elizaos/plugin-calendar", - "@elizaos/plugin-companion", "@elizaos/plugin-contacts", "@elizaos/plugin-inbox", "@elizaos/plugin-personal-assistant", diff --git a/packages/agent/src/runtime/prompt-compaction.ts b/packages/agent/src/runtime/prompt-compaction.ts index 0ae1e12f19256..ca90e536b3cf3 100644 --- a/packages/agent/src/runtime/prompt-compaction.ts +++ b/packages/agent/src/runtime/prompt-compaction.ts @@ -57,13 +57,6 @@ export function compactLoadedPluginLists(prompt: string): string { ); } -export function compactEmoteCatalog(prompt: string): string { - return prompt.replace( - /\n## Available Emotes[\s\S]*?(?=\n# Active Workspaces & Agents|\n## Project Context \(Workspace\)|$)/g, - "\n## Available Emotes\n[emote catalog omitted in compact mode]\n", - ); -} - export function compactWorkspaceContextForNonCoding(prompt: string): string { return prompt.replace( /\n## Project Context \(Workspace\)[\s\S]*?(?=\nAdmin trust:|\nThe current date and time is|\n# Conversation Messages|$)/g, @@ -73,7 +66,7 @@ export function compactWorkspaceContextForNonCoding(prompt: string): string { export function compactUiComponentCatalog(prompt: string): string { return prompt.replace( - /\n### Available components \((\d+) total\)[\s\S]*?(?=\n## Available Emotes|\n## Project Context \(Workspace\)|$)/g, + /\n### Available components \((\d+) total\)[\s\S]*?(?=\n## Project Context \(Workspace\)|$)/g, (_match, total: string) => `\n### Available components (${total} total)\n[component catalog omitted in compact mode]\n`, ); @@ -101,8 +94,6 @@ const PLUGIN_UI_INTENT_RE = // Terminal intent requires specific CLI/tool terms, not generic verbs. const TERMINAL_INTENT_RE = /\b(shell|command line|execute command|npm|bun|yarn|git\b|bash|terminal|script|pip|apt-get|brew)\b|터미널|명령어|스크립트|终端|命令行|脚本|\b(terminal|línea de comandos|linha de comando)\b/i; -const EMOTE_INTENT_RE = - /\b(emote|wave|dance|bow|clap|laugh|angry|sad|think|sit|play_emote)\b|이모트|춤|인사|笑|跳舞|鞠躬|\b(bailar)\b/i; // "close" and "label" removed — too generic ("close the file", "label this"). const ISSUE_INTENT_RE = /\b(issue|bug report|ticket|close issue|reopen issue|github issue|create issue|file a bug)\b|이슈|버그|티켓|问题|错误|工单|\b(problema|error|billete)\b/i; @@ -116,7 +107,7 @@ const WALLET_INTENT_RE = // the very fields the planner must fill to open the right view. Broad by design: // a false positive only preserves param detail, it never triggers an action. const VIEWS_INTENT_RE = - /\b(go to|take me to|switch to|navigate to|pull up|bring up|what'?s on|let me see|i want to)\b|\b(open|show|see|view|check)\b[\s\S]{0,40}\b(view|views|page|screen|tab|panel|dashboard|inbox|e-?mail|mail|messages?|calendar|schedule|agenda|wallet|balance|portfolio|finances?|spending|budget|settings|preferences|focus|health|sleep|goals?|routines?|reminders?|contacts?|relationships?|notes?|documents?|files?|todos?|tasks?|automations?|plugins?|companion|feed)\b|\bmy\s+(e-?mail|inbox|messages?|calendar|schedule|agenda|wallet|balance|portfolio|finances?|spending|budget|goals?|routines?|reminders?|health|sleep|contacts?|relationships?|todos?|tasks?|notes?|documents?|files?)\b|\b(add (a |an )?(new )?feature|build (me )?(an? )?app|app builder|coding view)\b|(?:mu[eé]strame|ll[eé]vame a|[aá]breme|abre|ver mi|mi (?:calendario|correo|bandeja|cartera|billetera|finanzas|salud|tareas|documentos|contactos|metas|objetivos))|(?:montre-moi|emm[eè]ne-moi|ouvre|ouvrir|mon (?:calendrier|courrier|portefeuille|agenda)|mes (?:messages|finances|t[aâ]ches|documents|contacts|objectifs))|(?:zeig mir|öffne|mein (?:kalender|postfach)|meine (?:nachrichten|brieftasche|finanzen|aufgaben|ziele|gesundheit))|打开|显示|查看|带我去|我的(?:日历|邮件|消息|钱包|财务|健康|待办|文档|联系人|目标)|開いて|見せて|表示して|私の(?:カレンダー|ウォレット)|열어|보여줘|내\s?(?:캘린더|메시지|지갑)/i; + /\b(go to|take me to|switch to|navigate to|pull up|bring up|what'?s on|let me see|i want to)\b|\b(open|show|see|view|check)\b[\s\S]{0,40}\b(view|views|page|screen|tab|panel|dashboard|inbox|e-?mail|mail|messages?|calendar|schedule|agenda|wallet|balance|portfolio|finances?|spending|budget|settings|preferences|focus|health|sleep|goals?|routines?|reminders?|contacts?|relationships?|notes?|documents?|files?|todos?|tasks?|automations?|plugins?|feed)\b|\bmy\s+(e-?mail|inbox|messages?|calendar|schedule|agenda|wallet|balance|portfolio|finances?|spending|budget|goals?|routines?|reminders?|health|sleep|contacts?|relationships?|todos?|tasks?|notes?|documents?|files?)\b|\b(add (a |an )?(new )?feature|build (me )?(an? )?app|app builder|coding view)\b|(?:mu[eé]strame|ll[eé]vame a|[aá]breme|abre|ver mi|mi (?:calendario|correo|bandeja|cartera|billetera|finanzas|salud|tareas|documentos|contactos|metas|objetivos))|(?:montre-moi|emm[eè]ne-moi|ouvre|ouvrir|mon (?:calendrier|courrier|portefeuille|agenda)|mes (?:messages|finances|t[aâ]ches|documents|contacts|objectifs))|(?:zeig mir|öffne|mein (?:kalender|postfach)|meine (?:nachrichten|brieftasche|finanzen|aufgaben|ziele|gesundheit))|打开|显示|查看|带我去|我的(?:日历|邮件|消息|钱包|财务|健康|待办|文档|联系人|目标)|開いて|見せて|表示して|私の(?:カレンダー|ウォレット)|열어|보여줘|내\s?(?:캘린더|메시지|지갑)/i; /** Actions that are always included at full detail. */ export const UNIVERSAL_ACTIONS = new Set(["REPLY", "NONE", "IGNORE"]); @@ -133,7 +124,6 @@ export const UNIVERSAL_ACTIONS = new Set(["REPLY", "NONE", "IGNORE"]); * RUNTIME — packages/agent/src/actions/runtime.ts:405 (op:"restart" * replaces the old RESTART_AGENT) * SHELL — packages/agent/src/actions/terminal.ts:261 - * PLAY_EMOTE — plugins/plugin-companion/src/actions/emote.ts:22 * * GitHub issue ops live under GITHUB_ISSUE in plugin-github but that plugin * isn't loaded by default — kept out of the map to avoid validator noise; it @@ -148,7 +138,6 @@ export const INTENT_ACTION_MAP: Record> = { coding: new Set(["TASKS"]), terminal: new Set(["SHELL", "RUNTIME"]), issues: new Set(["TASKS"]), - emote: new Set(["PLAY_EMOTE"]), plugin_ui: new Set(["RUNTIME"]), wallet: new Set(), views: new Set(["VIEWS"]), @@ -220,7 +209,6 @@ export function detectIntentCategories(prompt: string): string[] { if (hasIntent(prompt, CODING_INTENT_RE)) categories.push("coding"); if (hasIntent(prompt, TERMINAL_INTENT_RE)) categories.push("terminal"); if (hasIntent(prompt, ISSUE_INTENT_RE)) categories.push("issues"); - if (hasIntent(prompt, EMOTE_INTENT_RE)) categories.push("emote"); if (hasIntent(prompt, PLUGIN_UI_INTENT_RE)) categories.push("plugin_ui"); if (hasIntent(prompt, WALLET_INTENT_RE)) categories.push("wallet"); if (hasIntent(prompt, VIEWS_INTENT_RE)) categories.push("views"); @@ -304,7 +292,7 @@ export function compactConversationHistory(prompt: string): string { * Strip the task-agent examples provider section when no task/coding intent * is detected. These examples teach the LLM how to use START_CODING_TASK / * SPAWN_AGENT / FINALIZE_WORKSPACE and related aliases, which are unnecessary - * for general chat, emote, or plugin-config messages. + * for general chat or plugin-config messages. */ export function compactCodingExamplesForIntent(prompt: string): string { if (hasIntent(prompt, CODING_INTENT_RE)) return prompt; @@ -465,7 +453,6 @@ export function compactModelPrompt(prompt: string): string { // Action compaction is handled by installPromptOptimizations before // compactModelPrompt is called — no need to run it again here. next = compactLoadedPluginLists(next); - next = compactEmoteCatalog(next); if (!hasCodingIntent) { next = compactInstalledSkills(next); } diff --git a/packages/agent/src/runtime/view-action-affinity.test.ts b/packages/agent/src/runtime/view-action-affinity.test.ts index e2fbf02d03e4f..d30c8d064e710 100644 --- a/packages/agent/src/runtime/view-action-affinity.test.ts +++ b/packages/agent/src/runtime/view-action-affinity.test.ts @@ -33,18 +33,18 @@ describe("view-action-affinity", () => { it("stores and clears the active view", () => { expect(getActiveViewContext()).toBeNull(); setActiveViewContext({ - viewId: "companion", - viewLabel: "Companion", + viewId: "wallet", + viewLabel: "Wallet", viewType: "gui", - viewPath: "/companion", + viewPath: "/wallet", }); - expect(getActiveViewContext()?.viewId).toBe("companion"); + expect(getActiveViewContext()?.viewId).toBe("wallet"); clearActiveViewContext(); expect(getActiveViewContext()).toBeNull(); }); it("resolves scoped action names from the map", () => { - expect(viewScopedActionNames("companion")).toEqual(new Set(["PLAY_EMOTE"])); + expect(viewScopedActionNames("training")).toEqual(new Set(["RUNTIME"])); expect(viewScopedActionNames("orchestrator")).toEqual(new Set(["TASKS"])); expect(viewScopedActionNames("a-view-with-no-actions").size).toBe(0); expect(viewScopedActionNames(null).size).toBe(0); @@ -79,22 +79,22 @@ describe("view-action-affinity", () => { }); it("merges view-scoped actions into the full-param set", () => { - const set = buildFullParamActionSet([], viewScopedActionNames("companion")); + const set = buildFullParamActionSet([], viewScopedActionNames("wallet")); // Universal actions are always present… expect(set.has("REPLY")).toBe(true); // …and the active view's scoped action is kept full. - expect(set.has("PLAY_EMOTE")).toBe(true); + expect(set.has("EVM_SWAP")).toBe(true); }); it("flags drift when a mapped action is not registered", () => { const warnings: string[] = []; - validateViewActionMap(["REPLY", "PLAY_EMOTE"], { + validateViewActionMap(["REPLY", "TASKS"], { warn: (m) => warnings.push(m), }); - // TASKS / RUNTIME are not in the registered list → should warn. - expect(warnings.some((w) => w.includes("TASKS"))).toBe(true); + // RUNTIME is mapped but not in the registered list → should warn. expect(warnings.some((w) => w.includes("RUNTIME"))).toBe(true); - expect(warnings.some((w) => w.includes("PLAY_EMOTE"))).toBe(false); + // TASKS IS in the registered list → should not warn for it. + expect(warnings.some((w) => w.includes("TASKS"))).toBe(false); }); it("does not warn when every mapped action is registered", () => { @@ -310,8 +310,8 @@ describe("compactActionsForIntent with view-scoped actions", () => { "# Available Actions", "- REPLY: respond to the user", " parameters: { text: string }", - "- PLAY_EMOTE: play an avatar emote", - " parameters: { emote: string, intensity: number }", + "- EVM_SWAP: swap tokens on an EVM chain", + " parameters: { fromToken: string, amount: number }", "- WHATEVER: some unrelated action", " parameters: { foo: string }", "", @@ -321,9 +321,9 @@ describe("compactActionsForIntent with view-scoped actions", () => { it("summarizes an action's params when neither intent nor view keeps it", () => { const out = compactActionsForIntent(PROMPT); - // PLAY_EMOTE param schema is dropped for plain chat with no active view… - expect(out).toContain("- PLAY_EMOTE: play an avatar emote"); - expect(out).not.toContain("emote: string, intensity: number"); + // EVM_SWAP param schema is dropped for plain chat with no active view… + expect(out).toContain("- EVM_SWAP: swap tokens on an EVM chain"); + expect(out).not.toContain("fromToken: string, amount: number"); // …REPLY (universal) keeps its params. expect(out).toContain("text: string"); }); @@ -331,10 +331,10 @@ describe("compactActionsForIntent with view-scoped actions", () => { it("keeps the active view's scoped action at full param detail", () => { const out = compactActionsForIntent( PROMPT, - viewScopedActionNames("companion"), + viewScopedActionNames("wallet"), ); - // The companion view scopes PLAY_EMOTE → its params survive compaction. - expect(out).toContain("emote: string, intensity: number"); + // The wallet view scopes EVM_SWAP → its params survive compaction. + expect(out).toContain("fromToken: string, amount: number"); // The unrelated action still loses param detail. expect(out).not.toContain("foo: string"); }); @@ -345,10 +345,10 @@ describe("compactActionsForIntent with view-scoped actions", () => { // integration contract the prompt-optimization wiring implements. it("end-to-end: active view weights its action AND injects awareness", () => { setActiveViewContext({ - viewId: "companion", - viewLabel: "Companion", + viewId: "wallet", + viewLabel: "Wallet", viewType: "gui", - viewPath: "/companion", + viewPath: "/wallet", }); const active = getActiveViewContext(); let prompt = compactActionsForIntent( @@ -358,8 +358,8 @@ describe("compactActionsForIntent with view-scoped actions", () => { if (active && prompt.includes("# Available Actions")) { prompt = applyActiveViewAwareness(prompt, active); } - // Weighting: the companion view's PLAY_EMOTE keeps full params… - expect(prompt).toContain("emote: string, intensity: number"); + // Weighting: the wallet view's EVM_SWAP keeps full params… + expect(prompt).toContain("fromToken: string, amount: number"); // …unrelated action stays summarized… expect(prompt).not.toContain("foo: string"); // …and awareness is injected once, before the action catalogue. diff --git a/packages/agent/src/runtime/view-action-affinity.ts b/packages/agent/src/runtime/view-action-affinity.ts index 181249052014a..f65d882c045ef 100644 --- a/packages/agent/src/runtime/view-action-affinity.ts +++ b/packages/agent/src/runtime/view-action-affinity.ts @@ -107,7 +107,6 @@ export function setActiveViewElements( * * Verified action names (2026-05-31): * TASKS — plugin-agent-orchestrator tasks action (coding/orchestration) - * PLAY_EMOTE — plugin-companion/src/actions/emote.ts * RUNTIME — packages/agent/src/actions/runtime.ts (restart/config ops) * * Verified action names + view ids (2026-06-02) — view id from each plugin's @@ -140,7 +139,6 @@ export function setActiveViewElements( * relationship graph via GET /api/lifeops/{entities,relationships}) */ export const VIEW_ACTION_MAP: Record = { - companion: ["PLAY_EMOTE"], "task-coordinator": ["TASKS"], orchestrator: ["TASKS"], "trajectory-logger": ["TASKS"], diff --git a/packages/agent/src/runtime/view-capability-audit.test.ts b/packages/agent/src/runtime/view-capability-audit.test.ts index cbbf4844dff1a..5cf3dba71d55c 100644 --- a/packages/agent/src/runtime/view-capability-audit.test.ts +++ b/packages/agent/src/runtime/view-capability-audit.test.ts @@ -55,7 +55,6 @@ const VIEW_SOURCE_DIRS: Readonly> = { todos: "plugin-todos", relationships: "plugin-relationships", documents: "plugin-documents", - companion: "plugin-companion", orchestrator: "plugin-task-coordinator", facewear: "plugin-facewear", polymarket: "plugin-polymarket", diff --git a/packages/agent/tsconfig.json b/packages/agent/tsconfig.json index eab48a776883b..0b122b7303acd 100644 --- a/packages/agent/tsconfig.json +++ b/packages/agent/tsconfig.json @@ -131,9 +131,6 @@ "@elizaos/ui/api/client-types-cloud": [ "../ui/src/api/client-types-cloud.ts" ], - "@elizaos/plugin-companion": [ - "../../plugins/plugin-companion/src/index.ts" - ], "@elizaos/app-knowledge": [ "../../plugins/app-knowledge/src/index.ts" ], diff --git a/packages/app-core/scripts/assert-required-bundled-packages.test.ts b/packages/app-core/scripts/assert-required-bundled-packages.test.ts index 70a51e352604e..b97e6656fd5f3 100644 --- a/packages/app-core/scripts/assert-required-bundled-packages.test.ts +++ b/packages/app-core/scripts/assert-required-bundled-packages.test.ts @@ -120,7 +120,7 @@ describe("assertRequiredBundledPackagesLanded", () => { it("lists ALL missing packages, not just the first one", () => { writePackageJson("@elizaos/core"); - // plugin-sql, plugin-local-inference, app-companion all missing + // plugin-sql, plugin-local-inference, plugin-feed all missing try { assertRequiredBundledPackagesLanded( @@ -129,7 +129,7 @@ describe("assertRequiredBundledPackagesLanded", () => { "@elizaos/core", "@elizaos/plugin-sql", "@elizaos/plugin-local-inference", - "@elizaos/plugin-companion", + "@elizaos/plugin-feed", ]), ); throw new Error("expected assertRequiredBundledPackagesLanded to throw"); @@ -137,7 +137,7 @@ describe("assertRequiredBundledPackagesLanded", () => { const message = err instanceof Error ? err.message : String(err); expect(message).toContain("@elizaos/plugin-sql"); expect(message).toContain("@elizaos/plugin-local-inference"); - expect(message).toContain("@elizaos/plugin-companion"); + expect(message).toContain("@elizaos/plugin-feed"); // Count of missing should be in the header expect(message).toContain("3 required runtime package"); } diff --git a/packages/app-core/scripts/collect-docker-runtime-deps.mjs b/packages/app-core/scripts/collect-docker-runtime-deps.mjs index 998230771d977..ee69755a52e30 100644 --- a/packages/app-core/scripts/collect-docker-runtime-deps.mjs +++ b/packages/app-core/scripts/collect-docker-runtime-deps.mjs @@ -71,7 +71,6 @@ const LINKED_WORKSPACE_PACKAGES = [ // @elizaos/plugin-remote-manifest/worker-runtime but still needs a linked // workspace package in Docker images. "packages/plugin-worker-runtime", - "plugins/plugin-companion", "plugins/plugin-documents", "plugins/plugin-personal-assistant", "plugins/plugin-task-coordinator", diff --git a/packages/app-core/scripts/copy-runtime-node-modules.ts b/packages/app-core/scripts/copy-runtime-node-modules.ts index f0c92cf43af01..a19c29006e182 100644 --- a/packages/app-core/scripts/copy-runtime-node-modules.ts +++ b/packages/app-core/scripts/copy-runtime-node-modules.ts @@ -727,15 +727,6 @@ export function shouldKeepPackageRelativePath( } } - if (packageName === "@elizaos/plugin-companion") { - if ( - normalizedPath === "public_src" || - normalizedPath.startsWith("public_src/") - ) { - return false; - } - } - if (packageName === "@elizaos/agent") { if ( normalizedPath === "dist-mobile" || diff --git a/packages/app-core/scripts/ensure-avatars.mjs b/packages/app-core/scripts/ensure-avatars.mjs index 7cb0abf5b1a59..6c4b89dd41d3c 100644 --- a/packages/app-core/scripts/ensure-avatars.mjs +++ b/packages/app-core/scripts/ensure-avatars.mjs @@ -2,10 +2,12 @@ /** * Ensure avatar assets (VRMs, animations, backgrounds) are present in the app. * - * On a fresh clone, the companion plugin's public/vrms/ and animations/ - * may be empty or contain only Git LFS pointers. This script clones the + * On a fresh clone, the app's public/vrms/ and public/animations/ may be + * empty or contain only Git LFS pointers. This script clones the * elizaos/avatars repository (org-owned) into a temp directory and copies - * the assets into eliza/plugins/plugin-companion/public/. + * the assets into the app public dir (apps/app/public/) — the same target + * the sibling process-vrms.mjs writes and the static file server serves + * /vrms and /animations from. * * Run automatically via the `postinstall` hook, or manually: * node scripts/ensure-avatars.mjs @@ -37,7 +39,7 @@ const cleanupHelperScript = join( "scripts", "rm-path-recursive.mjs", ); -const PUBLIC = join(ROOT, "eliza", "plugins", "app-companion", "public"); +const PUBLIC = join(ROOT, "apps", "app", "public"); const VRMS_DIR = join(PUBLIC, "vrms"); const ANIMATIONS_DIR = join(PUBLIC, "animations"); const BUNDLED_VRM_SOURCE_IDS = [1, 2, 3, 4, 5, 6, 7, 8]; @@ -324,7 +326,7 @@ export function runEnsureAvatars({ const message = err instanceof Error ? err.message : String(err); logError(`${TAG} Failed to clone avatar assets: ${message}`); logError( - `${TAG} You can manually clone: git clone ${AVATARS_REPO} /tmp/avatars && cp -r /tmp/avatars/vrms/ packages/app/public/vrms/ && cp -r /tmp/avatars/animations/ packages/app/public/animations/`, + `${TAG} You can manually clone: git clone ${AVATARS_REPO} /tmp/avatars && cp -r /tmp/avatars/vrms/ apps/app/public/vrms/ && cp -r /tmp/avatars/animations/ apps/app/public/animations/`, ); return { cloned: false, reason: "clone-failed", error: message }; } finally { diff --git a/packages/app-core/scripts/link-docker-local-app-packages.mjs b/packages/app-core/scripts/link-docker-local-app-packages.mjs index 554be38b22c59..59fe9a0f339a6 100644 --- a/packages/app-core/scripts/link-docker-local-app-packages.mjs +++ b/packages/app-core/scripts/link-docker-local-app-packages.mjs @@ -41,7 +41,6 @@ const localPackages = [ // @elizaos/plugin-worker-runtime. Keep it linked so those historical imports // resolve inside local Docker app packages. "eliza/packages/plugin-worker-runtime", - "eliza/plugins/plugin-companion", "eliza/plugins/plugin-documents", "eliza/plugins/plugin-personal-assistant", "eliza/plugins/plugin-task-coordinator", diff --git a/packages/app-core/scripts/playwright-ui-smoke-api-stub.mjs b/packages/app-core/scripts/playwright-ui-smoke-api-stub.mjs index b2ee9a0920d4c..b09f4e40e47e5 100644 --- a/packages/app-core/scripts/playwright-ui-smoke-api-stub.mjs +++ b/packages/app-core/scripts/playwright-ui-smoke-api-stub.mjs @@ -1,7 +1,6 @@ import { existsSync, readFileSync } from "node:fs"; import http from "node:http"; import path from "node:path"; -import { gunzipSync } from "node:zlib"; import { WebSocketServer } from "ws"; const port = Number(process.env.ELIZA_UI_SMOKE_API_PORT || "31337"); @@ -54,28 +53,6 @@ const SMOKE_VOICE_TRANSCRIPT = "this is the voice smoke transcript"; // The spoken reply the stub returns for that transcript — a clean sentence so // the overlay's TTS output is non-empty and the assistant bubble is assertable. const SMOKE_VOICE_REPLY = "Got it, this is the spoken reply."; -function readSmokeVrm() { - const candidates = [ - new URL( - "../../../plugins/plugin-companion/public/vrms/eliza-1.vrm.gz", - import.meta.url, - ), - new URL( - "../../../plugins/plugin-companion/public_src/vrms/eliza-1.vrm", - import.meta.url, - ), - ]; - - for (const candidate of candidates) { - if (!existsSync(candidate)) continue; - const body = readFileSync(candidate); - return candidate.pathname.endsWith(".gz") ? gunzipSync(body) : body; - } - - return Buffer.alloc(4); -} - -const SMOKE_VRM = readSmokeVrm(); // A collapsed plugin declares ONE view that draws gui + tui (+ xr) from the // same `View` componentExport and the same bundle on the same `/` @@ -85,14 +62,6 @@ const SMOKE_VRM = readSmokeVrm(); // Plugins that still declare a standalone tui route (training) keep a separate // `tui` row with its own `//tui` path below. const smokeViewDeclarations = [ - [ - "companion", - "Companion", - "plugin-companion", - "/companion", - "CompanionView", - ["gui", "tui"], - ], [ "contacts", "Contacts", @@ -472,12 +441,6 @@ const stubCatalogApps = [ capabilities: ["logs", "debug", "viewer"], heroImage: "/app-heroes/log-viewer.png", }), - stubCatalogApp({ - name: "@elizaos/plugin-companion", - displayName: "Companion", - description: "The companion overlay shell for ambient agent presence.", - category: "social", - }), stubCatalogApp({ name: "@elizaos/plugin-shopify", displayName: "Shopify", @@ -3176,14 +3139,6 @@ const server = http.createServer(async (req, res) => { return; } - if ( - (req.method === "GET" || req.method === "HEAD") && - url.pathname === "/api/avatar/vrm" - ) { - sendBinary(req, res, 200, "application/octet-stream", SMOKE_VRM); - return; - } - if ( (req.method === "GET" || req.method === "HEAD") && url.pathname === "/api/avatar/background" @@ -3347,15 +3302,6 @@ const server = http.createServer(async (req, res) => { return; } - if (req.method === "POST" && url.pathname === "/api/emote") { - const body = (await readJsonBody(req)) || {}; - sendJson(req, res, 200, { - ok: true, - emoteId: typeof body.emoteId === "string" ? body.emoteId : null, - }); - return; - } - if (req.method === "GET" && url.pathname === "/api/status") { sendJson(req, res, 200, { state: "running", diff --git a/packages/app-core/scripts/run-local-plugin-live-smoke.mjs b/packages/app-core/scripts/run-local-plugin-live-smoke.mjs index 2c7b7af207070..68e2ca449edb0 100644 --- a/packages/app-core/scripts/run-local-plugin-live-smoke.mjs +++ b/packages/app-core/scripts/run-local-plugin-live-smoke.mjs @@ -36,11 +36,6 @@ const runtimePackageBuildPrerequisites = [ packageRoot: path.join(repoRoot, "eliza", "packages", "app-core"), requiredPaths: [path.join("dist", "index.js")], }, - { - name: "@elizaos/plugin-companion", - packageRoot: path.join(repoRoot, "eliza", "plugins", "plugin-companion"), - requiredPaths: [path.join("dist", "plugin.js")], - }, { name: "@elizaos/plugin-personal-assistant", packageRoot: path.join(repoRoot, "eliza", "plugins", "plugin-personal-assistant"), diff --git a/packages/app-core/src/api/dev-route-catalog.ts b/packages/app-core/src/api/dev-route-catalog.ts index 593ce5f08d263..cef90c25a30c4 100644 --- a/packages/app-core/src/api/dev-route-catalog.ts +++ b/packages/app-core/src/api/dev-route-catalog.ts @@ -322,7 +322,7 @@ const ROUTES: DevRouteEntry[] = [ label: "Character Select", group: "Character", visibility: "all", - featureFlag: "VITE_ENABLE_COMPANION_MODE", + featureFlag: null, requiresAuth: true, platformGate: null, }, @@ -396,16 +396,6 @@ const ROUTES: DevRouteEntry[] = [ requiresAuth: true, platformGate: null, }, - { - tabId: "companion", - path: "/companion", - label: "Companion", - group: "Hidden", - visibility: "all", - featureFlag: "VITE_ENABLE_COMPANION_MODE", - requiresAuth: true, - platformGate: null, - }, { tabId: "rolodex", path: "/rolodex", diff --git a/packages/app-core/src/platform/empty-node-module.ts b/packages/app-core/src/platform/empty-node-module.ts index 326868cb35ee3..098003c5babb4 100644 --- a/packages/app-core/src/platform/empty-node-module.ts +++ b/packages/app-core/src/platform/empty-node-module.ts @@ -146,7 +146,7 @@ export const validateMcpServerConfig = noop; // ── Extra @elizaos/agent browser aliases surfaced by plugin dist files ──────── // Upstream's enumeration only walked app-core/dist; the broader plugin -// graph (app-companion, app-knowledge, etc.) static-imports additional +// graph (app-knowledge, etc.) static-imports additional // names. Append rather than edit upstream aliases to keep merge churn // minimal. export type AccountCredentialRecord = unknown; diff --git a/packages/app-core/src/runtime/desktop/AppWindowRenderer.tsx b/packages/app-core/src/runtime/desktop/AppWindowRenderer.tsx index 16ea7a2b1a6eb..d45b5152eac35 100644 --- a/packages/app-core/src/runtime/desktop/AppWindowRenderer.tsx +++ b/packages/app-core/src/runtime/desktop/AppWindowRenderer.tsx @@ -3,7 +3,7 @@ * * Each Electrobun app window mounts exactly one of: * 1. an internal-tool tab component (plugins, skills, lifeops, …) - * 2. a registered overlay app's Component (e.g. companion) + * 2. a registered overlay app's Component * 3. a registry/catalog app viewer iframe (with postMessage auth handshake) * * The renderer never mounts the main shell (sidebars, header, chat panes). @@ -549,8 +549,8 @@ function resolveAppShellPageFromSlug( /** * Reverse-lookup an overlay app name from its slug. * - * Overlay apps register by package name (e.g. `@elizaos/plugin-companion`); the - * slug is `getAppSlug(name)`. We iterate the registry to find a match. + * Overlay apps register by package name; the slug is `getAppSlug(name)`. We + * iterate the registry to find a match. */ function resolveOverlayAppNameFromSlug(slug: string): string | null { for (const app of getAvailableOverlayApps()) { diff --git a/packages/app-core/test/app/first-run-companion.live.e2e.test.ts b/packages/app-core/test/app/first-run-companion.live.e2e.test.ts deleted file mode 100644 index dd2b49456b0a3..0000000000000 --- a/packages/app-core/test/app/first-run-companion.live.e2e.test.ts +++ /dev/null @@ -1,881 +0,0 @@ -import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process"; -import { existsSync } from "node:fs"; -import { access, mkdir, mkdtemp, readFile, rm } from "node:fs/promises"; -import { - createServer, - type IncomingMessage, - type Server, - type ServerResponse, -} from "node:http"; -import net from "node:net"; -import os from "node:os"; -import path from "node:path"; -import { setTimeout as sleep } from "node:timers/promises"; -import { buildFirstRunRuntimeConfig } from "@elizaos/ui"; -import { - type Browser, - type BrowserContext, - chromium, - type Page, -} from "playwright-core"; -import { afterAll, beforeAll, expect, it } from "vitest"; -import { WebSocket, WebSocketServer } from "ws"; -import { describeIf } from "../helpers/conditional-tests.ts"; -import { - getFirstRunProviderForLiveProvider, - selectLiveProvider, -} from "../helpers/live-provider.ts"; -import { captureScreenshotWithQualityRetry } from "./screenshot-quality.ts"; - -const LIVE_TESTS_ENABLED = process.env.ELIZA_LIVE_TEST === "1"; -const LIVE_PROVIDER = - (LIVE_TESTS_ENABLED && selectLiveProvider("openai")) || - (LIVE_TESTS_ENABLED ? selectLiveProvider() : null); -const LIVE_PROVIDER_LABELS = { - anthropic: "Anthropic", - google: "Gemini", - groq: "Groq", - openai: "OpenAI", - openrouter: "OpenRouter", -} as const; -const LIVE_PROVIDER_LABEL = LIVE_PROVIDER - ? LIVE_PROVIDER_LABELS[LIVE_PROVIDER.name] - : null; -const describeLive = describeIf(LIVE_TESTS_ENABLED && LIVE_PROVIDER !== null); -const REPO_ROOT = path.resolve( - import.meta.dirname, - "..", - "..", - "..", - "..", - "..", -); -const APP_DIR = path.join(REPO_ROOT, "packages", "app"); -const APP_DIST_DIR = path.join(APP_DIR, "dist"); -const SCREENSHOT_DIR = path.join(REPO_ROOT, "test-results", "live-onboarding"); -const READY_TIMEOUT_MS = 120_000; -const UI_SETTLE_MS = 4_000; -const CHROME_PATH = - process.env.ELIZA_CHROME_PATH ?? - "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; - -type StartedStack = { - apiBase: string; - apiChild: ChildProcessWithoutNullStreams; - browser: Browser; - stateDir: string; - uiBase: string; - uiServer: Server; -}; - -function contentTypeFor(filePath: string): string { - switch (path.extname(filePath).toLowerCase()) { - case ".css": - return "text/css; charset=utf-8"; - case ".html": - return "text/html; charset=utf-8"; - case ".ico": - return "image/x-icon"; - case ".jpeg": - case ".jpg": - return "image/jpeg"; - case ".js": - return "application/javascript; charset=utf-8"; - case ".json": - return "application/json; charset=utf-8"; - case ".png": - return "image/png"; - case ".svg": - return "image/svg+xml"; - case ".woff": - return "font/woff"; - case ".woff2": - return "font/woff2"; - default: - return "application/octet-stream"; - } -} - -function resolveDistAssetPath(requestedPath: string): string | null { - const normalizedPath = requestedPath.replace(/^\/+/, ""); - const segments = normalizedPath.split("/").filter(Boolean); - for (let index = 0; index < segments.length; index += 1) { - const candidatePath = path.resolve( - APP_DIST_DIR, - segments.slice(index).join("/"), - ); - if ( - candidatePath.startsWith(APP_DIST_DIR) && - existsSync(candidatePath) && - path.extname(candidatePath).length > 0 - ) { - return candidatePath; - } - } - return null; -} - -async function readRequestBody(request: IncomingMessage): Promise { - const chunks: Buffer[] = []; - for await (const chunk of request) { - chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)); - } - return Buffer.concat(chunks); -} - -async function proxyUiRequest(args: { - apiBase: string; - request: IncomingMessage; - response: ServerResponse; -}): Promise { - const requestUrl = new URL(args.request.url ?? "/", "http://127.0.0.1"); - - if (requestUrl.pathname.startsWith("/api/")) { - const body = await readRequestBody(args.request); - const headers: Record = {}; - const contentType = args.request.headers["content-type"]; - if (typeof contentType === "string") { - headers["content-type"] = contentType; - } - const authorization = args.request.headers.authorization; - if (typeof authorization === "string") { - headers.authorization = authorization; - } - - const upstream = await fetch( - `${args.apiBase}${requestUrl.pathname}${requestUrl.search}`, - { - body: body.byteLength > 0 ? body : undefined, - headers, - method: args.request.method ?? "GET", - }, - ); - const proxyHeaders: Record = {}; - upstream.headers.forEach((value, key) => { - if (key.toLowerCase() === "transfer-encoding") { - return; - } - proxyHeaders[key] = value; - }); - args.response.writeHead(upstream.status, proxyHeaders); - args.response.end(Buffer.from(await upstream.arrayBuffer())); - return; - } - - const requestedPath = - requestUrl.pathname === "/" - ? "index.html" - : requestUrl.pathname.replace(/^\/+/, ""); - let filePath = resolveDistAssetPath(requestedPath); - const isAssetRequest = path.extname(requestedPath).length > 0; - if (!filePath && !isAssetRequest) { - filePath = path.join(APP_DIST_DIR, "index.html"); - } - - let body: Buffer; - try { - body = await readFile(filePath ?? path.join(APP_DIST_DIR, "index.html")); - } catch { - body = await readFile(path.join(APP_DIST_DIR, "index.html")); - filePath = path.join(APP_DIST_DIR, "index.html"); - } - - args.response.writeHead(200, { - "Content-Type": contentTypeFor( - filePath ?? path.join(APP_DIST_DIR, "index.html"), - ), - }); - args.response.end(body); -} - -function relayWebSocket(args: { - apiBase: string; - request: IncomingMessage; - clientSocket: WebSocket; -}): void { - const requestUrl = new URL(args.request.url ?? "/ws", "http://127.0.0.1"); - const upstreamUrl = new URL(args.apiBase); - upstreamUrl.protocol = upstreamUrl.protocol === "https:" ? "wss:" : "ws:"; - upstreamUrl.pathname = requestUrl.pathname; - upstreamUrl.search = requestUrl.search; - - const upstreamSocket = new WebSocket(upstreamUrl, { - headers: - typeof args.request.headers.authorization === "string" - ? { authorization: args.request.headers.authorization } - : undefined, - }); - - const pendingClientMessages: Array<{ - data: Parameters[0]; - isBinary: boolean; - }> = []; - - const closeSocket = (socket: WebSocket) => { - if ( - socket.readyState === WebSocket.OPEN || - socket.readyState === WebSocket.CONNECTING - ) { - socket.close(); - } - }; - - args.clientSocket.on("message", (data, isBinary) => { - if (upstreamSocket.readyState === WebSocket.OPEN) { - upstreamSocket.send(data, { binary: isBinary }); - return; - } - if (upstreamSocket.readyState === WebSocket.CONNECTING) { - pendingClientMessages.push({ data, isBinary }); - } - }); - - upstreamSocket.on("open", () => { - for (const message of pendingClientMessages.splice(0)) { - upstreamSocket.send(message.data, { binary: message.isBinary }); - } - }); - - upstreamSocket.on("message", (data, isBinary) => { - if (args.clientSocket.readyState !== WebSocket.OPEN) { - return; - } - args.clientSocket.send(data, { binary: isBinary }); - }); - - args.clientSocket.on("close", () => { - closeSocket(upstreamSocket); - }); - upstreamSocket.on("close", () => { - closeSocket(args.clientSocket); - }); - - args.clientSocket.on("error", () => { - closeSocket(upstreamSocket); - }); - upstreamSocket.on("error", () => { - closeSocket(args.clientSocket); - }); -} - -async function startUiProxyServer(args: { - apiBase: string; - port: number; -}): Promise { - const server = createServer(async (request, response) => { - try { - await proxyUiRequest({ - apiBase: args.apiBase, - request, - response, - }); - } catch (error) { - console.error("[onboarding-companion e2e] proxy error:", error); - response.writeHead(500, { - "Content-Type": "application/json; charset=utf-8", - }); - response.end(JSON.stringify({ error: "Internal proxy error" })); - } - }); - const wss = new WebSocketServer({ noServer: true }); - - server.on("upgrade", (request, socket, head) => { - const requestUrl = new URL(request.url ?? "/", "http://127.0.0.1"); - if (requestUrl.pathname !== "/ws") { - socket.destroy(); - return; - } - wss.handleUpgrade(request, socket, head, (clientSocket) => { - relayWebSocket({ - apiBase: args.apiBase, - request, - clientSocket, - }); - }); - }); - server.on("close", () => { - for (const client of wss.clients) { - client.close(); - } - wss.close(); - }); - - await new Promise((resolve, reject) => { - server.once("error", reject); - server.listen(args.port, "127.0.0.1", () => resolve()); - }); - return server; -} - -async function waitForChildExit( - child: ChildProcessWithoutNullStreams, - timeoutMs: number, -): Promise { - if (child.exitCode != null) { - return true; - } - - return await new Promise((resolve) => { - const timeout = setTimeout(() => { - cleanup(); - resolve(false); - }, timeoutMs); - - const handleExit = () => { - cleanup(); - resolve(true); - }; - - const cleanup = () => { - clearTimeout(timeout); - child.off("exit", handleExit); - child.off("close", handleExit); - }; - - child.once("exit", handleExit); - child.once("close", handleExit); - }); -} - -async function getFreePort(): Promise { - return await new Promise((resolve, reject) => { - const server = net.createServer(); - server.once("error", reject); - server.listen(0, "127.0.0.1", () => { - const address = server.address(); - if (!address || typeof address === "string") { - server.close(); - reject(new Error("Could not allocate a loopback port")); - return; - } - server.close((error) => { - if (error) reject(error); - else resolve(address.port); - }); - }); - }); -} - -async function fetchJson(url: string): Promise { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`Request failed (${response.status}): ${url}`); - } - return (await response.json()) as T; -} - -async function waitForJson( - url: string, - timeoutMs: number = READY_TIMEOUT_MS, -): Promise { - const deadline = Date.now() + timeoutMs; - let lastError: unknown = null; - while (Date.now() < deadline) { - try { - return await fetchJson(url); - } catch (error) { - lastError = error; - await sleep(1_000); - } - } - throw lastError instanceof Error - ? lastError - : new Error(`Timed out waiting for ${url}`); -} - -async function waitForJsonPredicate( - url: string, - predicate: (value: T) => boolean, - timeoutMs: number = READY_TIMEOUT_MS, -): Promise { - const deadline = Date.now() + timeoutMs; - let lastValue: T | null = null; - let lastError: unknown = null; - - while (Date.now() < deadline) { - try { - const value = await fetchJson(url); - lastValue = value; - if (predicate(value)) { - return value; - } - } catch (error) { - lastError = error; - } - await sleep(1_000); - } - - if (lastValue != null) { - throw new Error(`Timed out waiting for predicate match: ${url}`); - } - - throw lastError instanceof Error - ? lastError - : new Error(`Timed out waiting for ${url}`); -} - -async function waitForVisibleText( - page: Page, - labels: readonly (string | RegExp)[], - timeoutMs: number = 30_000, -) { - const deadline = Date.now() + timeoutMs; - while (Date.now() < deadline) { - for (const label of labels) { - const locator = - typeof label === "string" - ? page.getByText(label, { exact: true }).first() - : page.getByText(label).first(); - if (await locator.isVisible().catch(() => false)) { - await locator.waitFor({ state: "visible", timeout: 5_000 }); - return locator; - } - } - await page.waitForTimeout(250); - } - throw new Error( - `Could not find any of: ${labels.map((label) => String(label)).join(", ")}`, - ); -} - -async function clickVisibleText( - page: Page, - labels: readonly (string | RegExp)[], - timeoutMs?: number, -) { - const deadline = Date.now() + (timeoutMs ?? 30_000); - let lastError: unknown = null; - - while (Date.now() < deadline) { - for (const label of labels) { - const textLocator = - typeof label === "string" - ? page.getByText(label, { exact: true }).first() - : page.getByText(label).first(); - const buttonByRole = - typeof label === "string" - ? page.getByRole("button", { exact: true, name: label }).first() - : page.getByRole("button", { name: label }).first(); - const roleButtonAncestor = textLocator.locator( - "xpath=ancestor-or-self::*[@role='button'][1]", - ); - const buttonAncestor = textLocator.locator( - "xpath=ancestor-or-self::button[1]", - ); - - for (const locator of [ - buttonByRole, - roleButtonAncestor, - buttonAncestor, - textLocator, - ]) { - if (!(await locator.isVisible().catch(() => false))) { - continue; - } - try { - await locator.click({ force: true, timeout: 5_000 }); - return; - } catch (error) { - lastError = error; - } - } - } - - await page.waitForTimeout(250); - } - - if (lastError instanceof Error) { - throw lastError; - } - - throw new Error( - `Could not click any of: ${labels.map((label) => String(label)).join(", ")}`, - ); -} - -async function startRealStack(): Promise { - await ensureUiDistReady(); - await mkdir(SCREENSHOT_DIR, { recursive: true }); - - const stateDir = await mkdtemp( - path.join(os.tmpdir(), "eliza-onboarding-live-"), - ); - const apiPort = await getFreePort(); - const uiPort = await getFreePort(); - const apiBase = `http://127.0.0.1:${apiPort}`; - - const apiChild = spawn( - "node", - [ - path.join(REPO_ROOT, "eliza/packages/app-core/scripts/run-node-tsx.mjs"), - path.join(REPO_ROOT, "eliza/packages/app-core/src/runtime/eliza.ts"), - ], - { - cwd: REPO_ROOT, - env: { - ...process.env, - ALLOW_NO_DATABASE: "", - FORCE_COLOR: "0", - ELIZA_API_PORT: String(apiPort), - ELIZA_HOME_PORT: String(uiPort), - ELIZA_PORT: String(apiPort), - ELIZA_STATE_DIR: stateDir, - }, - stdio: ["ignore", "pipe", "pipe"], - }, - ); - - apiChild.stdout.on("data", (chunk) => { - process.stdout.write(`[live-onboarding][api] ${chunk}`); - }); - apiChild.stderr.on("data", (chunk) => { - process.stdout.write(`[live-onboarding][api-err] ${chunk}`); - }); - - const onboardingStatus = await waitForJson<{ complete: boolean }>( - `${apiBase}/api/first-run/status`, - ); - if (onboardingStatus.complete) { - throw new Error( - "Fresh live onboarding stack unexpectedly started complete", - ); - } - - const uiServer = await startUiProxyServer({ - apiBase, - port: uiPort, - }); - process.env.ELIZA_API_PORT = String(apiPort); - - if (!existsSync(CHROME_PATH)) { - throw new Error( - `Chrome was not found at ${CHROME_PATH}; set ELIZA_CHROME_PATH to a valid browser executable.`, - ); - } - - const browser = await chromium.launch({ - executablePath: CHROME_PATH, - args: ["--use-angle=swiftshader"], - headless: true, - }); - - return { - apiBase, - apiChild, - browser, - stateDir, - uiBase: `http://127.0.0.1:${uiPort}`, - uiServer, - }; -} - -async function stopRealStack(stack: StartedStack | null): Promise { - if (!stack) return; - - try { - await stack.browser.close(); - } catch { - // Best effort during cleanup. - } - try { - await new Promise((resolve, reject) => - stack.uiServer.close((error) => (error ? reject(error) : resolve())), - ); - } catch { - // Best effort during cleanup. - } - - if (stack.apiChild.exitCode == null) { - stack.apiChild.kill("SIGTERM"); - const exitedAfterTerm = await waitForChildExit(stack.apiChild, 5_000); - if (!exitedAfterTerm && stack.apiChild.exitCode == null) { - stack.apiChild.kill("SIGKILL"); - await waitForChildExit(stack.apiChild, 5_000); - } - } - - await rm(stack.stateDir, { force: true, recursive: true }); -} - -async function ensureUiDistReady(): Promise { - const distIndex = path.join(APP_DIST_DIR, "index.html"); - try { - await access(distIndex); - return; - } catch { - // Build the renderer bundle when this checkout only has partial assets. - } - - const logs: string[] = []; - const child = spawn("bun", ["scripts/build.mjs"], { - cwd: APP_DIR, - env: { - ...process.env, - FORCE_COLOR: "0", - }, - stdio: ["ignore", "pipe", "pipe"], - }); - - child.stdout.on("data", (chunk) => logs.push(String(chunk))); - child.stderr.on("data", (chunk) => logs.push(String(chunk))); - - const exited = await waitForChildExit(child, 300_000); - if (!exited || child.exitCode !== 0) { - throw new Error( - `packages/app renderer build failed.\n${logs.join("").slice(-8_000)}`, - ); - } -} - -async function newLivePage( - stack: StartedStack, -): Promise<{ context: BrowserContext; page: Page }> { - const context = await stack.browser.newContext({ - reducedMotion: "reduce", - viewport: { height: 900, width: 1440 }, - }); - await context.addInitScript(() => { - localStorage.clear(); - sessionStorage.clear(); - localStorage.setItem("eliza:ui-language", "en"); - localStorage.setItem("eliza:ui-language", "en"); - localStorage.setItem("eliza:ui-theme", "dark"); - localStorage.setItem("eliza:ui-theme", "dark"); - localStorage.setItem("eliza:first-run-complete", "1"); - localStorage.setItem("eliza:setup:step", "activate"); - localStorage.setItem( - "elizaos:active-server", - JSON.stringify({ - id: "local:embedded", - kind: "local", - label: "This device", - }), - ); - }); - - const page = await context.newPage(); - page.on("console", (message) => { - console.log( - `[live-onboarding][browser:${message.type()}] ${message.text()}`, - ); - }); - page.on("pageerror", (error) => { - console.log(`[live-onboarding][pageerror] ${error.message}`); - }); - - return { context, page }; -} - -async function verifyWalletRpcRoundtrip( - stack: StartedStack, - page: Page, -): Promise { - const expectedSelections = { - evm: "infura", - bsc: "nodereal", - solana: "helius-birdeye", - } as const; - - await page.goto(`${stack.uiBase}/wallets`, { waitUntil: "domcontentloaded" }); - await waitForVisibleText(page, ["Tokens"]); - - const walletRpcButton = page.getByTestId("wallet-rpc-popup"); - await walletRpcButton.waitFor({ - state: "visible", - timeout: READY_TIMEOUT_MS, - }); - await walletRpcButton.click({ force: true, timeout: READY_TIMEOUT_MS }); - - await waitForVisibleText(page, [/^Custom RPC$/i, /Custom RPC Providers/i]); - await clickVisibleText(page, [/^Custom RPC$/i]); - await waitForVisibleText(page, [/Custom RPC Providers/i]); - await clickVisibleText(page, [/^Testnet$/i]); - await clickVisibleText(page, [/^Infura$/i]); - await clickVisibleText(page, [/^NodeReal$/i]); - await clickVisibleText(page, [/^Helius \+ Birdeye$/i]); - await clickVisibleText(page, [/^Save$/i]); - - const savedConfig = await waitForJsonPredicate<{ - selectedRpcProviders?: { - evm?: string | null; - bsc?: string | null; - solana?: string | null; - }; - walletNetwork?: string | null; - }>( - `${stack.apiBase}/api/wallet/config`, - (config) => - config.walletNetwork === "testnet" && - config.selectedRpcProviders?.evm === expectedSelections.evm && - config.selectedRpcProviders?.bsc === expectedSelections.bsc && - config.selectedRpcProviders?.solana === expectedSelections.solana, - READY_TIMEOUT_MS, - ); - - expect(savedConfig.walletNetwork).toBe("testnet"); - expect(savedConfig.selectedRpcProviders).toMatchObject(expectedSelections); - - await page.reload({ waitUntil: "domcontentloaded" }); - await waitForVisibleText(page, ["Tokens"]); - await walletRpcButton.waitFor({ - state: "visible", - timeout: READY_TIMEOUT_MS, - }); - await walletRpcButton.click({ force: true, timeout: READY_TIMEOUT_MS }); - await waitForVisibleText(page, [/Custom RPC Providers/i]); - await waitForVisibleText(page, ["Infura API Key"]); - await waitForVisibleText(page, ["NodeReal BSC RPC URL"]); - await waitForVisibleText(page, ["Helius API Key"]); - await waitForVisibleText(page, ["Birdeye API Key"]); -} - -async function submitFirstRun(apiBase: string): Promise { - if (!LIVE_PROVIDER) { - throw new Error("A live provider is required to complete onboarding."); - } - - const runtimeConfig = buildFirstRunRuntimeConfig({ - firstRunRuntimeTarget: "local", - firstRunCloudApiKey: "", - firstRunProvider: getFirstRunProviderForLiveProvider(LIVE_PROVIDER), - firstRunApiKey: LIVE_PROVIDER.apiKey, - firstRunVoiceProvider: "", - firstRunVoiceApiKey: "", - firstRunPrimaryModel: LIVE_PROVIDER.largeModel, - firstRunOpenRouterModel: LIVE_PROVIDER.largeModel, - firstRunRemoteConnected: false, - firstRunRemoteApiBase: "", - firstRunRemoteToken: "", - firstRunSmallModel: LIVE_PROVIDER.smallModel, - firstRunLargeModel: LIVE_PROVIDER.largeModel, - }); - - const response = await fetch(`${apiBase}/api/first-run`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - name: "Live Onboarding", - bio: ["A test agent for live onboarding coverage."], - systemPrompt: "You are a concise assistant for live browser tests.", - language: "en", - presetId: "default", - avatarIndex: 0, - deploymentTarget: runtimeConfig.deploymentTarget, - ...(runtimeConfig.linkedAccounts - ? { linkedAccounts: runtimeConfig.linkedAccounts } - : {}), - ...(runtimeConfig.serviceRouting - ? { serviceRouting: runtimeConfig.serviceRouting } - : {}), - ...(runtimeConfig.credentialInputs - ? { credentialInputs: runtimeConfig.credentialInputs } - : {}), - }), - }); - - if (!response.ok) { - throw new Error( - `Onboarding failed with ${response.status}: ${await response.text()}`, - ); - } - - await waitForJsonPredicate<{ complete: boolean }>( - `${apiBase}/api/first-run/status`, - (status) => status.complete === true, - READY_TIMEOUT_MS, - ); -} - -describeLive("real onboarding handoff to companion mode", () => { - let stack: StartedStack | null = null; - - beforeAll(async () => { - if (!LIVE_PROVIDER || !LIVE_PROVIDER_LABEL) { - throw new Error( - "ELIZA_LIVE_TEST=1 requires a configured live model provider", - ); - } - stack = await startRealStack(); - await submitFirstRun(stack.apiBase); - }, READY_TIMEOUT_MS); - - afterAll(async () => { - await stopRealStack(stack); - stack = null; - }, 30_000); - - it( - "finishes onboarding against the live server and lands in companion mode", - async () => { - if (!stack) { - throw new Error("Live onboarding stack did not start"); - } - - const { context, page } = await newLivePage(stack); - try { - const companionRoot = page.getByTestId("companion-root"); - const companionHeader = page.getByTestId("companion-header-shell"); - const companionShellToggle = page.getByTestId("companion-shell-toggle"); - const companionCenterControls = page.getByTestId( - "companion-header-center-controls", - ); - await page.goto(`${stack.uiBase}/apps/companion`, { - waitUntil: "domcontentloaded", - }); - - await page - .waitForURL(/\/apps\/companion(?:$|[?#/])/, { - timeout: READY_TIMEOUT_MS, - }) - .catch(() => {}); - await companionRoot.waitFor({ - state: "visible", - timeout: READY_TIMEOUT_MS, - }); - await companionHeader.waitFor({ - state: "visible", - timeout: READY_TIMEOUT_MS, - }); - await companionShellToggle.waitFor({ - state: "visible", - timeout: READY_TIMEOUT_MS, - }); - await companionCenterControls.waitFor({ - state: "visible", - timeout: READY_TIMEOUT_MS, - }); - await page.waitForTimeout(UI_SETTLE_MS); - - await captureScreenshotWithQualityRetry(page, "onboarding companion", { - path: path.join( - SCREENSHOT_DIR, - "onboarding-live-companion-after-enter.png", - ), - timeout: READY_TIMEOUT_MS, - }); - - expect(page.url()).toContain("/apps/companion"); - expect(await companionRoot.isVisible()).toBe(true); - expect(await companionHeader.isVisible()).toBe(true); - expect(await companionShellToggle.isVisible()).toBe(true); - expect(await companionCenterControls.isVisible()).toBe(true); - - const onboardingStatus = await waitForJsonPredicate<{ - complete: boolean; - }>( - `${stack.apiBase}/api/first-run/status`, - (status) => status.complete === true, - READY_TIMEOUT_MS, - ); - expect(onboardingStatus.complete).toBe(true); - - await verifyWalletRpcRoundtrip(stack, page); - } finally { - await context.close(); - } - }, - READY_TIMEOUT_MS * 2, - ); -}); diff --git a/packages/app-core/test/app/qa-checklist.real.e2e.test.ts b/packages/app-core/test/app/qa-checklist.real.e2e.test.ts index d1228aab19e44..c647606705d21 100644 --- a/packages/app-core/test/app/qa-checklist.real.e2e.test.ts +++ b/packages/app-core/test/app/qa-checklist.real.e2e.test.ts @@ -103,38 +103,6 @@ type QaRequestFailure = { duringResetTransition: boolean; }; -type QaEmoteEventRecord = { - type: string; - emoteId: string | null; - path: string | null; - duration: number | null; - loop: boolean | null; - at: number; -}; - -type QaPlayEmoteRecord = { - role: string | null; - vrmPath: string | null; - path: string | null; - duration: number | null; - loop: boolean | null; - at: number; -}; - -type QaTeleportRecord = { - type: string; - at: number; -}; - -type QaVrmRegistryEntry = { - role: string | null; - vrmPath: string | null; - worldUrl: string | null; - avatarLoaded: boolean; - avatarReady: boolean; - cameraProfile: string | null; -}; - type QaVoiceStats = { audioStarts: number; speechCalls: number; @@ -150,19 +118,6 @@ type QaRemoteSnapshot = { remoteTokenLength: number; }; -type CharacterRosterState = { - labels: string[]; - selectedLabel: string | null; - selectedTestId: string | null; -}; - -type CharacterRosterEntryState = { - label: string; - testId: string | null; - selected: boolean; - previewSrc: string | null; -}; - type Profile = { id: "desktop" | "mobile"; label: string; @@ -356,16 +311,12 @@ describeIf(CAN_RUN)("Live QA checklist", () => { ]; try { logQaStep(profile, "open onboarding"); - await navigate(page, `${UI_URL}/?test_force_vrm=1`); + await navigate(page, `${UI_URL}/`); logQaStep(profile, "complete local provider onboarding"); await completeLocalProviderOnboarding(page); expect(await firstRunComplete()).toBe(true); - logQaStep(profile, "enter companion mode"); - await enterCompanionMode(page); - await waitForCompanionReady(page, 120_000); - logQaStep(profile, "companion shell ready"); if (REQUIRE_STRICT_TTS_ASSERTIONS) { const voiceConfig = await waitFor(async () => { @@ -382,9 +333,6 @@ describeIf(CAN_RUN)("Live QA checklist", () => { }, 60_000); expect(voiceConfig.elevenlabs?.voiceId).toBe(EXPECTED_SARAH_VOICE_ID); } - await page.evaluate(() => { - window.dispatchEvent(new Event("eliza:vrm-teleport-complete")); - }); await page.waitForSelector('[data-testid="chat-composer-textarea"]'); await page.mouse.click(24, 24); @@ -444,10 +392,6 @@ describeIf(CAN_RUN)("Live QA checklist", () => { body: JSON.stringify({ enabled: true }), }); - await clickSelector( - page, - '[data-testid="companion-shell-toggle-desktop"]', - ); await navigate(page, `${UI_URL}/character/documents`); await page.waitForSelector('[data-testid="documents-view"]', { visible: true, @@ -581,8 +525,6 @@ describeIf(CAN_RUN)("Live QA checklist", () => { await smokeTabs(page, profile); logQaStep(profile, "wallet rpc provider roundtrip"); await qaWalletRpcRoundtrip(page, profile); - logQaStep(profile, "verify character switch dance emote and voice"); - await qaCharacterSwitchAndDance(page, profile); logQaStep(profile, "reset back to onboarding"); await navigate(page, `${UI_URL}/settings`); @@ -663,7 +605,7 @@ describeIf(CAN_RUN)("Live QA checklist", () => { try { logQaStep(profile, "avatar-voice QA open onboarding"); - await navigate(page, `${UI_URL}/?test_force_vrm=1`); + await navigate(page, `${UI_URL}/`); logQaStep( profile, @@ -671,15 +613,6 @@ describeIf(CAN_RUN)("Live QA checklist", () => { ); await completeLocalProviderOnboarding(page); - logQaStep(profile, "avatar-voice QA enter companion mode"); - await enterCompanionMode(page); - - logQaStep(profile, "avatar-voice QA verify companion avatar"); - await waitForCompanionReady(page, 120_000); - logQaStep(profile, "avatar-voice QA companion avatar ready"); - await page.evaluate(() => { - window.dispatchEvent(new Event("eliza:vrm-teleport-complete")); - }); await page.waitForSelector('[data-testid="chat-composer-textarea"]'); await page.mouse.click(24, 24); @@ -727,12 +660,6 @@ describeIf(CAN_RUN)("Live QA checklist", () => { 45_000, ); - logQaStep( - profile, - "avatar-voice QA validate character switch dance and emotes", - ); - await qaCharacterSwitchAndDance(page, profile); - expect(pageErrors).toEqual([]); expect(actionableQaRequestFailures(sameOriginFailures)).toEqual([]); } catch (error) { @@ -1389,108 +1316,15 @@ async function qaWalletRpcRoundtrip(page: Page, profile: Profile) { async function installQaInstrumentation(page: Page) { await page.evaluateOnNewDocument(() => { - type QaRegistryEngine = { - playEmote?: (...args: unknown[]) => unknown; - __qaPlayEmoteWrapped?: boolean; - }; - - type QaRegistryEntry = { - engine?: QaRegistryEngine; - role?: string; - vrmPath?: string; - }; - const qaWindow = window as typeof window & { __qaAudioStarts?: Array<{ at: number }>; - __qaEmoteEvents?: QaEmoteEventRecord[]; __qaFetches?: QaFetchRecord[]; - __qaPlayEmoteCalls?: QaPlayEmoteRecord[]; __qaSpeechCalls?: Array<{ text: string; at: number }>; - __qaTeleportEvents?: QaTeleportRecord[]; }; qaWindow.__qaAudioStarts = []; - qaWindow.__qaEmoteEvents = []; qaWindow.__qaFetches = []; - qaWindow.__qaPlayEmoteCalls = []; qaWindow.__qaSpeechCalls = []; - qaWindow.__qaTeleportEvents = []; - - const QA_EMOTE_EVENT_NAME = "eliza:app-emote"; - const QA_TELEPORT_EVENT_NAME = "eliza:vrm-teleport-complete"; - let vrmRegistryStore: QaRegistryEntry[] = []; - - const recordWindowEvent = (event: Event) => { - if (event.type === QA_EMOTE_EVENT_NAME) { - const detail = - event instanceof CustomEvent && typeof event.detail === "object" - ? (event.detail as Record | null) - : null; - qaWindow.__qaEmoteEvents?.push({ - type: event.type, - emoteId: typeof detail?.emoteId === "string" ? detail.emoteId : null, - path: typeof detail?.path === "string" ? detail.path : null, - duration: - typeof detail?.duration === "number" && - Number.isFinite(detail.duration) - ? detail.duration - : null, - loop: typeof detail?.loop === "boolean" ? detail.loop : null, - at: Date.now(), - }); - } - if (event.type === QA_TELEPORT_EVENT_NAME) { - qaWindow.__qaTeleportEvents?.push({ - type: event.type, - at: Date.now(), - }); - } - }; - - const originalDispatchEvent = window.dispatchEvent.bind(window); - window.dispatchEvent = (event: Event) => { - recordWindowEvent(event); - return originalDispatchEvent(event); - }; - - const patchRegistryEntry = (entry: QaRegistryEntry) => { - const engine = entry.engine; - if (!engine || typeof engine.playEmote !== "function") { - return; - } - if (engine.__qaPlayEmoteWrapped === true) { - return; - } - const originalPlayEmote = engine.playEmote.bind(engine); - engine.playEmote = (...args: unknown[]) => { - qaWindow.__qaPlayEmoteCalls?.push({ - role: typeof entry.role === "string" ? entry.role : null, - vrmPath: typeof entry.vrmPath === "string" ? entry.vrmPath : null, - path: typeof args[0] === "string" ? args[0] : null, - duration: - typeof args[1] === "number" && Number.isFinite(args[1]) - ? args[1] - : null, - loop: typeof args[2] === "boolean" ? args[2] : null, - at: Date.now(), - }); - return originalPlayEmote(...args); - }; - engine.__qaPlayEmoteWrapped = true; - }; - - Object.defineProperty(window, "__ELIZA_VRM_ENGINES__", { - configurable: true, - get() { - return vrmRegistryStore; - }, - set(value) { - vrmRegistryStore = Array.isArray(value) ? value : []; - vrmRegistryStore.forEach((entry) => { - patchRegistryEntry(entry); - }); - }, - }); const OriginalAudioContext = window.AudioContext || @@ -1732,21 +1566,6 @@ async function waitForOnboardingEntry(page: Page, timeout = 45_000) { ); } -async function waitForCompanionReady(page: Page, timeout = 90_000) { - await page.waitForSelector('[data-testid="companion-root"]', { - visible: true, - timeout, - }); - await page.waitForSelector('[data-testid="companion-header-shell"]', { - visible: true, - timeout, - }); - await page.waitForSelector('[data-testid="chat-composer-textarea"]', { - visible: true, - timeout, - }); -} - async function pageContainsText(page: Page, text: string): Promise { const bodyText = await page.evaluate(() => { const body = document.body; @@ -1757,160 +1576,6 @@ async function pageContainsText(page: Page, text: string): Promise { return bodyText.includes(text.toLowerCase()); } -async function currentVrmRegistry(page: Page): Promise { - return page.evaluate(() => { - const qaWindow = window as typeof window & { - __ELIZA_VRM_ENGINES__?: Array<{ - role?: string; - vrmPath?: string; - worldUrl?: string | null; - getDebugInfo?: () => { - avatar?: { - loaded?: boolean; - ready?: boolean; - }; - cameraProfile?: string; - }; - }>; - }; - - return (qaWindow.__ELIZA_VRM_ENGINES__ ?? []).map((entry) => { - const debug = - typeof entry.getDebugInfo === "function" ? entry.getDebugInfo() : null; - return { - role: typeof entry.role === "string" ? entry.role : null, - vrmPath: typeof entry.vrmPath === "string" ? entry.vrmPath : null, - worldUrl: - typeof entry.worldUrl === "string" || entry.worldUrl === null - ? entry.worldUrl - : null, - avatarLoaded: debug?.avatar?.loaded === true, - avatarReady: debug?.avatar?.ready === true, - cameraProfile: - typeof debug?.cameraProfile === "string" ? debug.cameraProfile : null, - }; - }); - }); -} - -async function _waitForWorldStageAvatar( - page: Page, - expectedSlug?: string | null, - timeout = 90_000, -): Promise { - return waitFor(async () => { - const entries = await currentVrmRegistry(page); - const worldStage = - entries.find((entry) => entry.role === "world-stage") ?? null; - if (!worldStage) return null; - if (!worldStage.avatarLoaded || !worldStage.avatarReady) return null; - if (expectedSlug && assetSlug(worldStage.vrmPath) !== expectedSlug) - return null; - return worldStage; - }, timeout); -} - -async function qaEmoteEvents(page: Page): Promise { - return page.evaluate(() => { - const qaWindow = window as typeof window & { - __qaEmoteEvents?: QaEmoteEventRecord[]; - }; - return qaWindow.__qaEmoteEvents ?? []; - }); -} - -async function _qaPlayEmoteCalls(page: Page): Promise { - return page.evaluate(() => { - const qaWindow = window as typeof window & { - __qaPlayEmoteCalls?: QaPlayEmoteRecord[]; - }; - return qaWindow.__qaPlayEmoteCalls ?? []; - }); -} - -async function _qaTeleportEvents(page: Page): Promise { - return page.evaluate(() => { - const qaWindow = window as typeof window & { - __qaTeleportEvents?: QaTeleportRecord[]; - }; - return qaWindow.__qaTeleportEvents ?? []; - }); -} - -async function waitForCharacterRoster( - page: Page, - timeout = 90_000, -): Promise { - await page.waitForSelector('[data-testid="character-roster-grid"]', { - visible: true, - timeout, - }); - await waitFor(async () => { - const roster = await page.$$eval( - '[data-testid^="character-preset-"]', - (buttons) => { - const visibleButtons = buttons.filter((button) => { - const style = window.getComputedStyle(button); - return style.display !== "none" && style.visibility !== "hidden"; - }); - const selected = visibleButtons.find( - (button) => button.getAttribute("aria-pressed") === "true", - ); - return visibleButtons.length > 0 && selected - ? { - count: visibleButtons.length, - selectedTestId: selected.getAttribute("data-testid"), - } - : null; - }, - ); - return roster?.count ? roster : null; - }, timeout); - - return page.$$eval('[data-testid^="character-preset-"]', (buttons) => { - const labels = buttons - .map((button) => (button.textContent ?? "").trim()) - .filter(Boolean); - const selected = buttons.find( - (button) => button.getAttribute("aria-pressed") === "true", - ); - - return { - labels, - selectedLabel: selected?.textContent?.trim() || null, - selectedTestId: selected?.getAttribute("data-testid") ?? null, - }; - }); -} - -async function characterRosterEntries( - page: Page, -): Promise { - return page.$$eval('[data-testid^="character-preset-"]', (buttons) => { - return buttons.map((button) => { - const image = button.querySelector("img"); - return { - label: (button.textContent ?? "").trim(), - testId: button.getAttribute("data-testid"), - selected: button.getAttribute("aria-pressed") === "true", - previewSrc: - image?.getAttribute("src") ?? image?.getAttribute("data-src") ?? null, - }; - }); - }); -} - -async function _selectedCharacterPreviewSrc(page: Page): Promise { - const previewSrc = await page.$eval( - '[data-testid^="character-preset-"][aria-pressed="true"] img', - (img) => img.getAttribute("src"), - ); - if (!previewSrc) { - throw new Error("Selected character preview src was empty."); - } - return previewSrc; -} - async function clickByText(page: Page, text: string) { await clickByTextWithin(page, text); } @@ -2219,140 +1884,6 @@ async function completeLocalProviderOnboarding(page: Page) { await waitFor(async () => (await firstRunComplete()) || null, 120_000); } -async function enterCompanionMode(page: Page) { - try { - await clickSelector(page, '[data-testid="ui-shell-toggle-companion"]'); - } catch { - await navigate(page, `${UI_URL}/apps/companion`); - } - await page.waitForFunction( - () => { - return ( - window.location.pathname.endsWith("/apps/companion") && - Boolean(document.querySelector('[data-testid="companion-root"]')) && - Boolean( - document.querySelector('[data-testid="companion-header-shell"]'), - ) - ); - }, - { timeout: 30_000 }, - ); -} - -async function qaCharacterSwitchAndDance(page: Page, profile?: Profile) { - if (profile) { - logQaStep(profile, "character-switch QA open companion character view"); - } - await enterCompanionMode(page); - await clickSelector(page, '[data-testid="companion-shell-toggle-character"]'); - const roster = await waitForCharacterRoster(page, 120_000); - const entries = await characterRosterEntries(page); - const currentEntry = entries.find((entry) => entry.selected); - expect(currentEntry?.testId).toBe(roster.selectedTestId); - - const nextEntry = entries.find( - (entry) => entry.testId && entry.testId !== roster.selectedTestId, - ); - if (!nextEntry?.testId) { - throw new Error( - "No alternate character entry was available for switching.", - ); - } - - if (profile) { - logQaStep(profile, `character-switch QA select ${nextEntry.testId}`); - } - await clickSelector(page, `[data-testid="${nextEntry.testId}"]`); - await page - .waitForSelector( - `[data-testid="${nextEntry.testId}"][aria-pressed="true"]`, - { - visible: true, - timeout: 20_000, - }, - ) - .catch(() => null); - - const danceFetchBaseline = (await qaFetches(page)).length; - const danceEmoteBaseline = (await qaEmoteEvents(page)).length; - - if (profile) { - logQaStep(profile, "character-switch QA open dance emote picker"); - } - await page.evaluate(() => { - document.dispatchEvent(new Event("eliza:emote-picker")); - }); - await page.waitForSelector('button[title="Dance Happy"]', { - visible: true, - timeout: 30_000, - }); - await clickSelector(page, 'button[title="Dance Happy"]'); - await waitFor( - async () => { - const overlayVisible = await page - .waitForSelector( - '[data-testid="global-emote-overlay"][data-emote-id="dance-happy"]', - { - visible: true, - timeout: 1000, - }, - ) - .then(() => true) - .catch(() => false); - if (overlayVisible) { - return true; - } - - const events = await qaEmoteEvents(page); - return events - .slice(danceEmoteBaseline) - .some((event) => event.emoteId === "dance-happy") - ? true - : null; - }, - 45_000, - 1000, - ); - - if (profile) { - logQaStep(profile, "character-switch QA wait for dance emote API"); - } - const emoteFetches = await waitFor(async () => { - const fetches = await qaFetches(page); - const latest = fetches.slice(danceFetchBaseline); - return latest.some( - (record) => - record.method === "POST" && - String(record.url).includes("/api/emote") && - record.status === 200, - ) - ? latest - : null; - }, 45_000); - expect( - emoteFetches.some( - (record) => - record.method === "POST" && - String(record.url).includes("/api/emote") && - record.status === 200, - ), - ).toBe(true); - - if (profile) { - logQaStep(profile, "character-switch QA wait for dance emote event"); - } - const danceEvents = await waitFor(async () => { - const events = await qaEmoteEvents(page); - const latest = events.slice(danceEmoteBaseline); - return latest.some((event) => event.emoteId === "dance-happy") - ? latest - : null; - }, 45_000); - expect(danceEvents.some((event) => event.emoteId === "dance-happy")).toBe( - true, - ); -} - async function writeDocumentFile(profileId: string): Promise { const filename = `eliza-qa-knowledge-${profileId}.txt`; const fullPath = path.join(os.tmpdir(), filename); @@ -2703,18 +2234,6 @@ function expectValidGreetingMessage(value: string): void { expect(normalized).not.toContain("qa codeword from the uploaded file"); } -function assetSlug(value: string | null | undefined): string | null { - if (!value) return null; - try { - const pathname = value.startsWith("http") ? new URL(value).pathname : value; - const filename = pathname.split("/").pop() ?? ""; - if (!filename) return null; - return filename.replace(/\.vrm(\.gz)?$/i, "").replace(/\.png$/i, ""); - } catch { - return null; - } -} - function ensureBrowser(value: Browser | null): Browser { if (!value) { throw new Error("Browser was not started"); diff --git a/packages/app-core/test/eliza-package-paths.ts b/packages/app-core/test/eliza-package-paths.ts index 1c9de7afc76d9..69772e9e40970 100644 --- a/packages/app-core/test/eliza-package-paths.ts +++ b/packages/app-core/test/eliza-package-paths.ts @@ -35,11 +35,6 @@ function getRepoLocalWorkspaceRoot( "eliza/packages/shared", "../eliza/packages/shared", ], - "@elizaos/plugin-companion": [ - "plugins/plugin-companion", - "eliza/plugins/plugin-companion", - "../eliza/plugins/plugin-companion", - ], }; for (const relativeRoot of relativeRoots[packageName] ?? []) { diff --git a/packages/app-core/test/regression-matrix.json b/packages/app-core/test/regression-matrix.json index 9e0d3e2b77f19..a1eafb5de8ddc 100644 --- a/packages/app-core/test/regression-matrix.json +++ b/packages/app-core/test/regression-matrix.json @@ -290,12 +290,6 @@ "tier": "heavy", "rationale": "requires the browser QA harness and stays out of the default live API/runtime lane" }, - { - "path": "eliza/packages/app-core/test/app/first-run-companion.live.e2e.test.ts", - "suite": "e2e-heavy", - "tier": "heavy", - "rationale": "drives the built dashboard in a browser and belongs in the heavy nightly or release gate" - }, { "path": "eliza/packages/app-core/test/app/qa-checklist.real.e2e.test.ts", "suite": "e2e-heavy", diff --git a/packages/app-core/vitest.app-real-e2e.config.ts b/packages/app-core/vitest.app-real-e2e.config.ts index ff4dd2e15c7fb..cad49e6879bd4 100644 --- a/packages/app-core/vitest.app-real-e2e.config.ts +++ b/packages/app-core/vitest.app-real-e2e.config.ts @@ -11,7 +11,7 @@ const here = path.dirname(fileURLToPath(import.meta.url)); /** * Config for the `test/app/*.{real,live}.e2e.test.ts` browser-driven real e2e - * suite (qa-checklist, first-run-companion, memory-relationships, + * suite (qa-checklist, memory-relationships, * streaming-visible-text). These drive a real renderer via puppeteer/playwright * against a real app-core runtime + a real model provider; each self-skips * (`describeIf`/CAN_RUN) unless `ELIZA_LIVE_TEST=1` + a provider is present. diff --git a/packages/app-core/vitest.config.ts b/packages/app-core/vitest.config.ts index 8a2b1783122b6..50a8af0184106 100644 --- a/packages/app-core/vitest.config.ts +++ b/packages/app-core/vitest.config.ts @@ -26,7 +26,6 @@ const pluginAppManagerSrc = path.join( monorepoRoot, "plugins/plugin-app-manager/src", ); -const appCompanionSrc = path.join(monorepoRoot, "plugins/plugin-companion/src"); const appWalletSrc = path.join(monorepoRoot, "plugins/plugin-wallet-ui/src"); const pluginSqlSrc = path.join(monorepoRoot, "plugins/plugin-sql/src"); const pluginAgentSkillsSrc = path.join( @@ -177,7 +176,6 @@ export default defineConfig({ ".claude/**", "test/app/memory-relationships.real.e2e.test.ts", "test/app/qa-checklist.real.e2e.test.ts", - "test/app/first-run-companion.live.e2e.test.ts", "test/helpers/__tests__/live-agent-test.smoke.test.ts", ...(includeLiveE2e ? [] @@ -263,18 +261,6 @@ export default defineConfig({ find: /^@elizaos\/app-lifeops\/(.+)$/, replacement: path.join(appLifeopsSrc, "$1"), }, - { - find: /^@elizaos\/app-companion$/, - replacement: path.join(appCompanionSrc, "index.ts"), - }, - { - find: /^@elizaos\/app-companion\/ui$/, - replacement: path.join(appCompanionSrc, "ui.ts"), - }, - { - find: /^@elizaos\/app-companion\/(.+)$/, - replacement: path.join(appCompanionSrc, "$1"), - }, { find: /^@elizaos\/app-wallet$/, replacement: path.join(appWalletSrc, "index.ts"), diff --git a/packages/app/.env.example b/packages/app/.env.example index 81c34b3ca5c13..949705e4ac2a3 100644 --- a/packages/app/.env.example +++ b/packages/app/.env.example @@ -3,9 +3,6 @@ # Set to https://blob.elizacloud.ai for production or a custom CDN domain. VITE_ASSET_BASE_URL=https://blob.elizacloud.ai -# Feature flags -VITE_ENABLE_COMPANION_MODE= - # iOS runtime modes: # - cloud: use bundled web assets and Eliza Cloud # - remote-mac: connect the phone build to a Mac-hosted Eliza API diff --git a/packages/app/docs/E2E_LIVE_COVERAGE.md b/packages/app/docs/E2E_LIVE_COVERAGE.md index dd8eddf3eea39..f0dd6cbae9790 100644 --- a/packages/app/docs/E2E_LIVE_COVERAGE.md +++ b/packages/app/docs/E2E_LIVE_COVERAGE.md @@ -226,8 +226,6 @@ This was extended into broad, **enforced** interaction coverage: `/documents` view path collides with the built-in `documents` tab (`/character/documents`) via `App.tsx` `findView`, so it stays tracked debt (`MAX_INTERACTION_DEBT = 1`) until that path is disambiguated. -- `chat-viewmanager-companion-interactions.spec.ts` — view-catalog refresh, - companion TUI controls. **Enforcement:** `view-interaction-coverage.test.ts` now runs with `INTERACTION_DEBT = {}` and `MAX_INTERACTION_DEBT = 0` — every view-matrix entry diff --git a/packages/app/package.json b/packages/app/package.json index bff4ef518b4ef..654aeb6dd6905 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -126,7 +126,6 @@ "@elizaos/plugin-agent-orchestrator": "workspace:*", "@elizaos/plugin-background-runner": "workspace:*", "@elizaos/plugin-blocker": "workspace:*", - "@elizaos/plugin-companion": "workspace:*", "@elizaos/plugin-contacts": "workspace:*", "@elizaos/plugin-native-settings": "workspace:*", "@elizaos/plugin-elizacloud": "workspace:*", diff --git a/packages/app/src/cloud-apps-view.ts b/packages/app/src/cloud-apps-view.ts index d48444e439f38..6c57eb3605aca 100644 --- a/packages/app/src/cloud-apps-view.ts +++ b/packages/app/src/cloud-apps-view.ts @@ -10,7 +10,7 @@ * `NativeAppsStudio` (a `MemoryRouter` + cloud providers + native Steward auth * context; see `@elizaos/ui/cloud/applications/NativeAppsStudio`). * - * This mirrors `mobile-plugin-views.ts` (the same mechanism `companion` / + * This uses the in-process app-shell registration mechanism (the same one * `orchestrator` / `wallet.inventory` use). It is gated to non-web platforms so * it never competes with the web shell's route, and the import stays **lazy** * (the studio chunk — and the whole applications domain it pulls — loads only diff --git a/packages/app/src/main.tsx b/packages/app/src/main.tsx index d9c21c1abf602..971d3bb6ffab0 100644 --- a/packages/app/src/main.tsx +++ b/packages/app/src/main.tsx @@ -1,9 +1,5 @@ import { ErrorBoundary } from "@elizaos/ui/components/ui/error-boundary"; import "@elizaos/ui/styles"; -// Native-only: register bundled plugin views as in-process app-shell pages so -// they load from the view catalog on iOS/Android (where DynamicViewLoader is -// disabled). No-op off-device. -import "./mobile-plugin-views"; // Native-only (ios/android/desktop): register the Eliza Cloud Applications // dashboard as an in-process app-shell page (`/cloud-apps`) that mounts the // self-contained NativeAppsStudio. No-op on web, where CloudRouterShell serves @@ -54,11 +50,7 @@ import { ShellRoleProvider } from "@elizaos/ui/components/ShellRoleProvider"; import type { BrandingConfig, CodingAgentTasksPanelProps, - CompanionInferenceNotice, - CompanionSceneStatus, - CompanionShellComponentProps, FineTuningViewProps, - ResolveCompanionInferenceNoticeArgs, } from "@elizaos/ui/config"; import { type AppBootConfig, @@ -199,34 +191,6 @@ function importAppCore() { ); } -function importCompanionAppRegistration() { - return cachedDynamicImport( - "@elizaos/plugin-companion/components/companion/companion-app", - () => - import("@elizaos/plugin-companion/components/companion/companion-app"), - ); -} - -function importCompanionSceneStatusContext() { - return cachedDynamicImport( - "@elizaos/plugin-companion/components/companion/companion-scene-status-context", - () => - import( - "@elizaos/plugin-companion/components/companion/companion-scene-status-context" - ), - ); -} - -function importCompanionInferenceNotice() { - return cachedDynamicImport( - "@elizaos/plugin-companion/components/companion/resolve-companion-inference-notice", - () => - import( - "@elizaos/plugin-companion/components/companion/resolve-companion-inference-notice" - ), - ); -} - function importPersonalAssistant() { return cachedDynamicImport( "@elizaos/plugin-personal-assistant", @@ -268,46 +232,6 @@ function lazyNamedComponent( return lazy(async () => ({ default: await load() })) as ComponentType; } -const CompanionShell = lazyNamedComponent( - async () => - ( - await cachedDynamicImport( - "@elizaos/plugin-companion/components/companion/CompanionShell", - () => - import( - "@elizaos/plugin-companion/components/companion/CompanionShell" - ), - ) - ).CompanionShell, -); -const GlobalEmoteOverlay = lazyNamedComponent>( - async () => - ( - await cachedDynamicImport( - "@elizaos/plugin-companion/components/companion/GlobalEmoteOverlay", - () => - import( - "@elizaos/plugin-companion/components/companion/GlobalEmoteOverlay" - ), - ) - ).GlobalEmoteOverlay, -); -const InferenceCloudAlertButton = lazyNamedComponent<{ - notice: CompanionInferenceNotice; - onClick: () => void; - onPointerDown?: (...args: unknown[]) => unknown; -}>( - async () => - ( - await cachedDynamicImport( - "@elizaos/plugin-companion/components/companion/InferenceCloudAlertButton", - () => - import( - "@elizaos/plugin-companion/components/companion/InferenceCloudAlertButton" - ), - ) - ).InferenceCloudAlertButton, -); const PhoneCompanionApp = lazyNamedComponent>( async () => (await importAppPhone()).PhoneCompanionApp, ); @@ -331,17 +255,6 @@ const FineTuningView = lazyNamedComponent( async () => (await importAppTraining()).FineTuningView, ); -let loadedCompanionSceneStatusHook: (() => CompanionSceneStatus) | null = null; - -function useLoadedCompanionSceneStatus(): CompanionSceneStatus { - return ( - loadedCompanionSceneStatusHook?.() ?? { - avatarReady: false, - teleportKey: "", - } - ); -} - const BRANDED_WINDOW_KEYS = { apiBase: `__${APP_ENV_PREFIX}_API_BASE__`, characterEditor: `__${APP_ENV_PREFIX}_CHARACTER_EDITOR__`, @@ -608,13 +521,7 @@ function scheduleDeferredAppModuleLoadsAfterPaint(): void { }); } -function buildAppBootConfig({ - resolveCompanionInferenceNotice, -}: { - resolveCompanionInferenceNotice: ( - args: ResolveCompanionInferenceNoticeArgs, - ) => CompanionInferenceNotice | null; -}): AppBootConfig { +function buildAppBootConfig(): AppBootConfig { const current = getBootConfig(); return { @@ -628,11 +535,6 @@ function buildAppBootConfig({ vrmAssets: APP_VRM_ASSETS, firstRunStyles: APP_STYLE_PRESETS, characterEditor: CharacterEditor, - companionShell: CompanionShell, - resolveCompanionInferenceNotice, - companionInferenceAlertButton: InferenceCloudAlertButton, - companionGlobalOverlay: GlobalEmoteOverlay, - useCompanionSceneStatus: useLoadedCompanionSceneStatus, codingAgentTasksPanel: CodingAgentTasksPanel, codingAgentSettingsSection: CodingAgentSettingsSection, codingAgentControlChip: CodingAgentControlChip, @@ -675,33 +577,12 @@ const BOOT_CONFIG_DEFERRED_MODULE_LOADERS: readonly SideEffectAppModuleLoader[] function initializeAppModules(): Promise { appModulesInitialized ??= (async () => { + // app-core owns the AppBootConfig singleton, so it must load before the + // config is assembled. Everything else exposed through the boot config is a + // React.lazy handle that loads on render, so its import is deferred onto the + // idle path instead of gating the first visible shell (#9565). await importAppCore(); - - // Block first paint ONLY on the modules whose exports buildAppBootConfig - // reads synchronously: companion app registration, the scene-status hook, - // and the inference-notice resolver. Everything else exposed through the - // boot config is a React.lazy handle that loads on render, so its import is - // deferred below instead of gating the first visible shell (#9565). - const [ - companionRegistrationModule, - companionSceneStatusModule, - companionInferenceNoticeModule, - ] = await Promise.all([ - importCompanionAppRegistration(), - importCompanionSceneStatusContext(), - importCompanionInferenceNotice(), - ]); - - companionRegistrationModule.registerCompanionApp(); - loadedCompanionSceneStatusHook = - companionSceneStatusModule.useCompanionSceneStatus; - - setBootConfig( - buildAppBootConfig({ - resolveCompanionInferenceNotice: - companionInferenceNoticeModule.resolveCompanionInferenceNotice, - }), - ); + setBootConfig(buildAppBootConfig()); })(); return appModulesInitialized; diff --git a/packages/app/src/mobile-plugin-views.ts b/packages/app/src/mobile-plugin-views.ts deleted file mode 100644 index 726b7632dfcd9..0000000000000 --- a/packages/app/src/mobile-plugin-views.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * In-process app-shell registration for plugin views on iOS/Android. - * - * On native, `DynamicViewLoader` is disabled (store policy: no remote JS at - * runtime) and the agent strips `bundleUrl` views from `GET /api/views`, so - * these bundled plugin views have no render path and show up as unloadable - * "Get more" cards in the view catalog. Their React components ARE shipped in - * the renderer bundle (the plugins are imported via `main.tsx`), so we register - * them as in-process app-shell pages — the same mechanism - * `orchestrator` / `wallet.inventory` / `facewear` use — so they load directly - * from the view catalog on device. - * - * This module only covers plugins the app resolves to their `index.ts` barrel - * (companion / steward). Plugins the app aliases to their `register.ts` - * (polymarket, hyperliquid, shopify, trajectory-logger) register their - * own app-shell page inside that `register.ts` instead, so the lazy loader can - * import the view component directly and stay code-split. - * - * Web/desktop keep loading every one of these via `DynamicViewLoader` from the - * agent-served bundle (deduped by view id), so the registration is native-only - * and changes nothing off-device. - */ -import { registerAppShellPage } from "@elizaos/ui/app-shell-registry"; -import { getFrontendPlatform } from "@elizaos/ui/platform"; - -const platform = getFrontendPlatform(); - -if (platform === "android" || platform === "ios") { - registerAppShellPage({ - id: "companion", - viewKind: "release", - pluginId: "@elizaos/plugin-companion", - label: "Companion", - icon: "Bot", - path: "/companion", - loader: () => - import("@elizaos/plugin-companion").then((m) => ({ - default: m.CompanionView, - })), - }); -} diff --git a/packages/app/src/types/app-plugin-module-exports.d.ts b/packages/app/src/types/app-plugin-module-exports.d.ts index d6d3fb7de74fd..c2d2a65ee40ca 100644 --- a/packages/app/src/types/app-plugin-module-exports.d.ts +++ b/packages/app/src/types/app-plugin-module-exports.d.ts @@ -1,58 +1,3 @@ -declare module "@elizaos/plugin-companion" { - export const CompanionShell: import("react").ComponentType< - import("@elizaos/ui").CompanionShellComponentProps - >; - export const GlobalEmoteOverlay: import("react").ComponentType< - Record - >; - export const InferenceCloudAlertButton: import("react").ComponentType<{ - notice: import("@elizaos/ui").CompanionInferenceNotice; - onClick: () => void; - onPointerDown?: (...args: unknown[]) => unknown; - }>; - export const THREE: unknown; - export function createVectorBrowserRenderer(): Promise; - export function registerCompanionApp(): void; - export function resolveCompanionInferenceNotice( - args: import("@elizaos/ui").ResolveCompanionInferenceNoticeArgs, - ): import("@elizaos/ui").CompanionInferenceNotice | null; - export function useCompanionSceneStatus(): import("@elizaos/ui").CompanionSceneStatus; -} - -declare module "@elizaos/plugin-companion/components/companion/companion-app" { - export function registerCompanionApp(): void; -} - -declare module "@elizaos/plugin-companion/components/companion/companion-scene-status-context" { - export function useCompanionSceneStatus(): import("@elizaos/ui").CompanionSceneStatus; -} - -declare module "@elizaos/plugin-companion/components/companion/resolve-companion-inference-notice" { - export function resolveCompanionInferenceNotice( - args: import("@elizaos/ui").ResolveCompanionInferenceNoticeArgs, - ): import("@elizaos/ui").CompanionInferenceNotice | null; -} - -declare module "@elizaos/plugin-companion/components/companion/CompanionShell" { - export const CompanionShell: import("react").ComponentType< - import("@elizaos/ui").CompanionShellComponentProps - >; -} - -declare module "@elizaos/plugin-companion/components/companion/GlobalEmoteOverlay" { - export const GlobalEmoteOverlay: import("react").ComponentType< - Record - >; -} - -declare module "@elizaos/plugin-companion/components/companion/InferenceCloudAlertButton" { - export const InferenceCloudAlertButton: import("react").ComponentType<{ - notice: import("@elizaos/ui").CompanionInferenceNotice; - onClick: () => void; - onPointerDown?: (...args: unknown[]) => unknown; - }>; -} - declare module "@elizaos/plugin-personal-assistant" { export const AppBlockerSettingsCard: import("react").ComponentType< import("@elizaos/ui").AppBlockerSettingsCardProps diff --git a/packages/app/src/types/app-plugin-modules.d.ts b/packages/app/src/types/app-plugin-modules.d.ts index bb3bc4721434f..eaf9cca63e07f 100644 --- a/packages/app/src/types/app-plugin-modules.d.ts +++ b/packages/app/src/types/app-plugin-modules.d.ts @@ -2,13 +2,7 @@ import type { AppBlockerSettingsCardProps, WebsiteBlockerSettingsCardProps, } from "@elizaos/shared"; -import type { - CodingAgentTasksPanelProps, - CompanionInferenceNotice, - CompanionSceneStatus, - CompanionShellComponentProps, - ResolveCompanionInferenceNoticeArgs, -} from "@elizaos/ui/config"; +import type { CodingAgentTasksPanelProps } from "@elizaos/ui/config"; import type { ComponentType } from "react"; type EmptyComponent = ComponentType>; @@ -78,75 +72,6 @@ declare module "@elizaos/app-core" { }; } -declare module "@elizaos/app-companion" { - export const CompanionShell: ComponentType; - export const GlobalEmoteOverlay: EmptyComponent; - export const InferenceCloudAlertButton: ComponentType<{ - notice: CompanionInferenceNotice; - onClick: () => void; - onPointerDown?: (...args: unknown[]) => unknown; - }>; - export const THREE: unknown; - export function createVectorBrowserRenderer( - ...args: unknown[] - ): Promise; - export function registerCompanionApp(): void; - export function resolveCompanionInferenceNotice( - args: ResolveCompanionInferenceNoticeArgs, - ): CompanionInferenceNotice | null; - export function useCompanionSceneStatus(): CompanionSceneStatus; - export const CompanionView: ComponentType>; -} - -declare module "@elizaos/plugin-companion" { - export * from "@elizaos/app-companion"; -} - -declare module "@elizaos/plugin-companion/components/companion/companion-app" { - export function registerCompanionApp(): void; -} - -declare module "@elizaos/plugin-companion/components/companion/companion-scene-status-context" { - import type { CompanionSceneStatus } from "@elizaos/ui/config"; - - export function useCompanionSceneStatus(): CompanionSceneStatus; -} - -declare module "@elizaos/plugin-companion/components/companion/resolve-companion-inference-notice" { - import type { - CompanionInferenceNotice, - ResolveCompanionInferenceNoticeArgs, - } from "@elizaos/ui/config"; - - export function resolveCompanionInferenceNotice( - args: ResolveCompanionInferenceNoticeArgs, - ): CompanionInferenceNotice | null; -} - -declare module "@elizaos/plugin-companion/components/companion/CompanionShell" { - import type { CompanionShellComponentProps } from "@elizaos/ui/config"; - import type { ComponentType } from "react"; - - export const CompanionShell: ComponentType; -} - -declare module "@elizaos/plugin-companion/components/companion/GlobalEmoteOverlay" { - import type { ComponentType } from "react"; - - export const GlobalEmoteOverlay: ComponentType>; -} - -declare module "@elizaos/plugin-companion/components/companion/InferenceCloudAlertButton" { - import type { CompanionInferenceNotice } from "@elizaos/ui/config"; - import type { ComponentType } from "react"; - - export const InferenceCloudAlertButton: ComponentType<{ - notice: CompanionInferenceNotice; - onClick: () => void; - onPointerDown?: (...args: unknown[]) => unknown; - }>; -} - declare module "@elizaos/plugin-personal-assistant" { export const AppBlockerSettingsCard: ComponentType; export const WebsiteBlockerSettingsCard: ComponentType; diff --git a/packages/app/test/design-review/run-design-review.ts b/packages/app/test/design-review/run-design-review.ts index 9d68a6011d05f..dee33b46a77a3 100644 --- a/packages/app/test/design-review/run-design-review.ts +++ b/packages/app/test/design-review/run-design-review.ts @@ -17,10 +17,9 @@ import { import { captureScreenshotWithQualityRetry } from "../ui-smoke/helpers/screenshot-quality"; import { getFreePort } from "../utils/get-free-port.mjs"; -type ShellMode = "companion" | "native"; +type ShellMode = "native"; type ViewId = | "first-run" - | "companion" | "chat" | "stream" | "character" @@ -201,14 +200,6 @@ const views: ViewSpec[] = [ { selector: '[data-testid="choice-__first_run__:runtime:cloud"]' }, ], }, - { - id: "companion", - label: "Companion", - path: "/companion", - shellMode: "companion", - lastNativeTab: "chat", - readyChecks: [{ selector: '[data-testid="companion-root"]' }], - }, { id: "chat", label: "Chat", diff --git a/packages/app/test/electrobun-packaged/electrobun-packaged-regressions.e2e.spec.ts b/packages/app/test/electrobun-packaged/electrobun-packaged-regressions.e2e.spec.ts index 3e2589f340a6d..20c0476af6125 100644 --- a/packages/app/test/electrobun-packaged/electrobun-packaged-regressions.e2e.spec.ts +++ b/packages/app/test/electrobun-packaged/electrobun-packaged-regressions.e2e.spec.ts @@ -284,8 +284,6 @@ async function setPersistedSettingsState( await waitForMediaSettingsRoute(harness); const result = await harness.eval< EvalResult<{ - vrmPower: string | null; - animateWhenHidden: string | null; provider: unknown; }> >( @@ -293,23 +291,6 @@ async function setPersistedSettingsState( try { ${getRouteNavigationScript(SETTINGS_MEDIA_ROUTE)} - const powerRoot = document.querySelector('[data-testid="settings-companion-vrm-power"]'); - const animateSwitch = document.querySelector('[data-testid="settings-companion-animate-when-hidden"] [role="switch"]'); - const powerButtons = powerRoot ? Array.from(powerRoot.querySelectorAll("button")) : []; - const qualityButton = powerButtons.find((button) => - /always quality/i.test((button.textContent || "").trim()), - ); - - qualityButton?.click(); - if ( - animateSwitch && - animateSwitch.getAttribute("aria-checked") !== "true" - ) { - animateSwitch.click(); - } - localStorage.setItem("eliza:companion-vrm-power", "quality"); - localStorage.setItem("eliza:companion-animate-when-hidden", "1"); - const apiBase = ${getApiBaseExpression()}; if (!apiBase) { return { ok: false, error: "Desktop renderer did not expose an API base." }; @@ -338,10 +319,6 @@ async function setPersistedSettingsState( return { ok: true, - vrmPower: localStorage.getItem("eliza:companion-vrm-power"), - animateWhenHidden: localStorage.getItem( - "eliza:companion-animate-when-hidden", - ), provider: { success: true, provider: "openai" }, }; } catch (error) { @@ -358,24 +335,18 @@ async function setPersistedSettingsState( return; } - expect(result.vrmPower).toBe("quality"); - expect(result.animateWhenHidden).toBe("1"); expect(result.provider).toMatchObject({ success: true, provider: "openai" }); } async function readPersistedSettingsState( harness: PackagedDesktopHarness, ): Promise<{ - vrmPower: string | null; - animateWhenHidden: string | null; providerLabel: string | null; backend: string | null; }> { await waitForProviderTrigger(harness); const result = await harness.eval< EvalResult<{ - vrmPower: string | null; - animateWhenHidden: string | null; providerLabel: string | null; backend: string | null; }> @@ -409,10 +380,6 @@ async function readPersistedSettingsState( return { ok: true, - vrmPower: localStorage.getItem("eliza:companion-vrm-power"), - animateWhenHidden: localStorage.getItem( - "eliza:companion-animate-when-hidden", - ), providerLabel: backend === "openai" ? "OpenAI" : backend, backend, }; @@ -484,13 +451,11 @@ async function seedResettableState( EvalResult<{ firstRunComplete: string | null; activeServer: string | null; - vrmPower: string | null; }> >( `(() => { try { localStorage.setItem("eliza:first-run-complete", "1"); - localStorage.setItem("eliza:companion-vrm-power", "quality"); localStorage.setItem( "elizaos:active-server", JSON.stringify({ @@ -503,7 +468,6 @@ async function seedResettableState( ok: true, firstRunComplete: localStorage.getItem("eliza:first-run-complete"), activeServer: localStorage.getItem("elizaos:active-server"), - vrmPower: localStorage.getItem("eliza:companion-vrm-power"), }; } catch (error) { return { @@ -1085,8 +1049,6 @@ test("packaged desktop persists media, provider, and plugin state across relaunc await openRouteAndWait(harness, SETTINGS_ROUTE, SETTINGS_SELECTOR); const settingsState = await readPersistedSettingsState(harness); - expect(settingsState.vrmPower).toBe("quality"); - expect(settingsState.animateWhenHidden).toBe("1"); expect(settingsState.providerLabel).toContain("OpenAI"); expect(settingsState.backend).toBe("openai"); await writeHarnessScreenshot( diff --git a/packages/app/test/first-paint-guard.test.ts b/packages/app/test/first-paint-guard.test.ts index f3081261cde33..50d1e63f44ff4 100644 --- a/packages/app/test/first-paint-guard.test.ts +++ b/packages/app/test/first-paint-guard.test.ts @@ -2,14 +2,14 @@ * First-paint critical-path guard (issue #9565). * * `initializeAppModules()` blocks the first React mount: `main()` awaits it - * before `mountReactApp()`. Anything added to its blocking `await Promise.all` - * delays the first visible startup shell on every device boot. This test pins - * the blocking set to exactly the modules the boot config reads SYNCHRONOUSLY - * (companion registration + scene-status hook + inference-notice resolver) so a - * future eager `import("@elizaos/plugin-…")` added to that await fails CI here - * instead of silently expanding cold start. Everything else must ride the - * deferred idle path after React has had a paint opportunity - * (BOOT_CONFIG_DEFERRED_MODULE_LOADERS / SIDE_EFFECT_APP_MODULE_LOADERS). + * before `mountReactApp()`. Anything added to its blocking path delays the first + * visible startup shell on every device boot. The boot config reads no plugin + * module synchronously, so the initializer must load only `@elizaos/app-core` + * (the boot-config singleton owner) and never eagerly `import("@elizaos/plugin-…")`. + * This test fails CI if a future eager plugin import is added to that path + * instead of riding the deferred idle loaders + * (BOOT_CONFIG_DEFERRED_MODULE_LOADERS / SIDE_EFFECT_APP_MODULE_LOADERS) after + * React has had a paint opportunity. */ import { readFileSync } from "node:fs"; import { join } from "node:path"; @@ -18,13 +18,6 @@ import { describe, expect, it } from "vitest"; const root = join(import.meta.dirname, ".."); const mainSrc = readFileSync(join(root, "src", "main.tsx"), "utf8"); -/** Importers allowed to block the first paint inside initializeAppModules(). */ -const ALLOWED_BLOCKING_IMPORTERS = new Set([ - "importCompanionAppRegistration", - "importCompanionSceneStatusContext", - "importCompanionInferenceNotice", -]); - /** Heavy app plugins that must NOT block first paint — deferred to idle. */ const MUST_BE_DEFERRED = [ "importPersonalAssistant", @@ -45,30 +38,7 @@ function initializeAppModulesSource(): string { return mainSrc.slice(start, end); } -/** The single blocking `await Promise.all([...])` inside initializeAppModules. */ -function blockingAwaitSource(): string { - const fn = initializeAppModulesSource(); - const awaitStart = fn.indexOf("await Promise.all(["); - expect(awaitStart).toBeGreaterThan(-1); - const awaitEnd = fn.indexOf("]);", awaitStart); - expect(awaitEnd).toBeGreaterThan(awaitStart); - return fn.slice(awaitStart, awaitEnd); -} - describe("first-paint critical path", () => { - it("blocks first paint only on the allow-listed companion importers", () => { - const blocking = blockingAwaitSource(); - const importers = [...blocking.matchAll(/import[A-Z]\w*\(\)/g)].map((m) => - m[0].replace("()", ""), - ); - - expect(importers).toEqual([...ALLOWED_BLOCKING_IMPORTERS]); - const disallowed = importers.filter( - (name) => !ALLOWED_BLOCKING_IMPORTERS.has(name), - ); - expect(disallowed).toEqual([]); - }); - it("rejects direct dynamic plugin imports on the blocking initializer path", () => { const blockingPluginImports = [ ...initializeAppModulesSource().matchAll( @@ -80,17 +50,16 @@ describe("first-paint critical path", () => { }); it("keeps the heavy plugin imports on the deferred idle path", () => { - const blocking = blockingAwaitSource(); + const initializer = initializeAppModulesSource(); for (const importer of MUST_BE_DEFERRED) { - // Not in the blocking await… - expect(blocking).not.toContain(`${importer}()`); + // Not called on the blocking initializer path… + expect(initializer).not.toContain(`${importer}()`); // …but still referenced so the deferred loader actually loads it. expect(mainSrc).toContain(importer); } // The deferred loader list exists and is scheduled after React has a paint // opportunity, not from initializeAppModules() before mount. expect(mainSrc).toContain("BOOT_CONFIG_DEFERRED_MODULE_LOADERS"); - const initializer = initializeAppModulesSource(); expect(initializer).not.toMatch( /scheduleAppModuleIdleLoads\(\s*BOOT_CONFIG_DEFERRED_MODULE_LOADERS\s*\)/, ); diff --git a/packages/app/test/fixtures/plugin-view-visual-review.md b/packages/app/test/fixtures/plugin-view-visual-review.md index 8a742b48de5cf..49780a4611dce 100644 --- a/packages/app/test/fixtures/plugin-view-visual-review.md +++ b/packages/app/test/fixtures/plugin-view-visual-review.md @@ -9,8 +9,6 @@ Review rubric: | View | Type | Path | Likes | Concerns | Next proof | | --- | --- | --- | --- | --- | --- | -| `companion` | `gui` | `/companion` | Avatar-first surface with dedicated emote controls and visual scene affordances. | Needs screenshot pass for avatar framing, emote overlay polish, and non-text control density. | Verify avatar asset loads, emote controls render as icons, and scene is nonblank in visual smoke artifacts. | -| `companion` | `tui` | `/companion` | Terminal contract exposes companion state and emote commands. | Needs command-output review for terse, scan-friendly status. | Confirm every terminal command returns command-specific output and no pending states. | | `contacts` | `gui` | `/contacts` | Familiar contact-list workflow and clear account/contact actions. | Needs visual pass for list density and empty/error states. | Verify create/import/search controls, contact rows, and avatar/initial indicators. | | `contacts` | `tui` | `/contacts` | Terminal view has list/create/import command surface. | Needs proof that command output remains compact and structured. | Click every terminal command and verify semantic output. | | `hyperliquid` | `gui` | `/hyperliquid` | Market/trading domain has strong metric-card potential. | Needs screenshot review for chart/table density and risk/status indicators. | Verify market, execution, and account panels render without broken assets. | diff --git a/packages/app/test/hmr/hmr-dependency-levels.spec.ts b/packages/app/test/hmr/hmr-dependency-levels.spec.ts index 0c6203c61db4a..d034720f5b211 100644 --- a/packages/app/test/hmr/hmr-dependency-levels.spec.ts +++ b/packages/app/test/hmr/hmr-dependency-levels.spec.ts @@ -25,10 +25,6 @@ const LEVELS = [ // character-presets instead: main.tsx calls getStylePresets() at module scope, // so this source file is guaranteed in the live graph. { name: "@elizaos/shared", file: "packages/shared/src/character-presets.ts" }, - { - name: "plugin view companion", - file: "plugins/plugin-companion/src/components/companion/CompanionView.tsx", - }, { name: "plugin view contacts", file: "plugins/plugin-contacts/src/components/ContactsAppView.tsx", diff --git a/packages/app/test/route-coverage.test.ts b/packages/app/test/route-coverage.test.ts index 80b335d584dab..081b6a9ecb848 100644 --- a/packages/app/test/route-coverage.test.ts +++ b/packages/app/test/route-coverage.test.ts @@ -71,7 +71,6 @@ type PluginViewManifestContract = { }; const PLUGIN_VIEW_MANIFESTS = [ - "plugins/plugin-companion/src/plugin.ts", "plugins/plugin-contacts/src/plugin.ts", "plugins/plugin-hyperliquid/src/plugin.ts", "plugins/plugin-messages/src/plugin.ts", @@ -136,18 +135,6 @@ const NOT_APP_BOOT_LOADED_VIEW_MANIFESTS: Readonly> = { const BOOT_PLUGIN_VIEW_MANIFEST_BY_MODULE: Record = { "@elizaos/app-core": null, - "@elizaos/plugin-companion/components/companion/CompanionShell": - "plugins/plugin-companion/src/plugin.ts", - "@elizaos/plugin-companion/components/companion/GlobalEmoteOverlay": - "plugins/plugin-companion/src/plugin.ts", - "@elizaos/plugin-companion/components/companion/InferenceCloudAlertButton": - "plugins/plugin-companion/src/plugin.ts", - "@elizaos/plugin-companion/components/companion/companion-app": - "plugins/plugin-companion/src/plugin.ts", - "@elizaos/plugin-companion/components/companion/companion-scene-status-context": - "plugins/plugin-companion/src/plugin.ts", - "@elizaos/plugin-companion/components/companion/resolve-companion-inference-notice": - "plugins/plugin-companion/src/plugin.ts", "@elizaos/plugin-contacts": "plugins/plugin-contacts/src/plugin.ts", "@elizaos/plugin-native-settings": null, "@elizaos/plugin-facewear": "plugins/plugin-facewear/src/index.ts", @@ -177,12 +164,6 @@ const BOOT_PLUGIN_VIEW_MANIFEST_BY_MODULE: Record = { }; const KNOWN_XR_VIEW_CASES: readonly PluginViewCase[] = [ - { - manifestPath: "plugins/plugin-companion/src/plugin.ts", - id: "companion", - viewType: "xr", - path: "/companion", - }, { manifestPath: "plugins/plugin-contacts/src/plugin.ts", id: "contacts", diff --git a/packages/app/test/ui-smoke/all-pages-clicksafe.spec.ts b/packages/app/test/ui-smoke/all-pages-clicksafe.spec.ts index 47d61daa5f899..73a2635e2a615 100644 --- a/packages/app/test/ui-smoke/all-pages-clicksafe.spec.ts +++ b/packages/app/test/ui-smoke/all-pages-clicksafe.spec.ts @@ -184,12 +184,6 @@ const CORE_ROUTE_PROBES: readonly RouteProbe[] = [ readyChecks: [{ selector: "#root" }], timeoutMs: 60_000, }, - { - name: "companion deep link", - path: "/companion", - readyChecks: [{ selector: "#root" }], - timeoutMs: 60_000, - }, { name: "rolodex", path: "/rolodex", @@ -1411,12 +1405,6 @@ async function expectMainShell(page: Page, route: RouteProbe): Promise { if (route.path === "/" || route.path === "/chat") { return; } - if (route.path === "/apps/companion") { - await expect(page.getByTestId("companion-root").first()).toBeVisible({ - timeout: route.timeoutMs, - }); - return; - } await expect( page .locator( diff --git a/packages/app/test/ui-smoke/all-views-aesthetic-audit.spec.ts b/packages/app/test/ui-smoke/all-views-aesthetic-audit.spec.ts index 7d0a78a296cbb..eeac6cbd7c6ac 100644 --- a/packages/app/test/ui-smoke/all-views-aesthetic-audit.spec.ts +++ b/packages/app/test/ui-smoke/all-views-aesthetic-audit.spec.ts @@ -68,7 +68,6 @@ const BUILTIN_TAB_PATHS: Record = { camera: "/camera", tasks: "/apps/tasks", browser: "/browser", - companion: "/companion", stream: "/stream", apps: "/apps", views: "/views", diff --git a/packages/app/test/ui-smoke/all-views-interaction.spec.ts b/packages/app/test/ui-smoke/all-views-interaction.spec.ts index d8c36b2b77a12..eb217c5ee0c30 100644 --- a/packages/app/test/ui-smoke/all-views-interaction.spec.ts +++ b/packages/app/test/ui-smoke/all-views-interaction.spec.ts @@ -28,7 +28,6 @@ const VIEW_ROUTES: Array<{ id: string; path: string }> = [ { id: "camera", path: "/camera" }, { id: "tasks", path: "/apps/tasks" }, { id: "browser", path: "/browser" }, - { id: "companion", path: "/companion" }, { id: "stream", path: "/stream" }, { id: "apps", path: "/apps" }, { id: "views", path: "/views" }, diff --git a/packages/app/test/ui-smoke/apps-session-route-cases.ts b/packages/app/test/ui-smoke/apps-session-route-cases.ts index 6a775f66a54d3..a62c76c1bffcd 100644 --- a/packages/app/test/ui-smoke/apps-session-route-cases.ts +++ b/packages/app/test/ui-smoke/apps-session-route-cases.ts @@ -37,15 +37,6 @@ function viewCardTestId(viewId: string): string { } export const DIRECT_ROUTE_CASES: readonly DirectRouteCase[] = [ - { - name: "companion", - path: "/apps/companion", - readyChecks: [ - { text: "Companion" }, - { selector: '[data-testid="companion-root"]' }, - ], - timeoutMs: 90_000, - }, { name: "plugins app window", path: "/apps/plugins", @@ -234,7 +225,6 @@ export const DIRECT_ROUTE_CASES: readonly DirectRouteCase[] = [ const managerVisibleViewTileCases = [ { viewId: "calendar", path: "/calendar" }, - { viewId: "companion", path: "/companion" }, { viewId: "contacts", path: "/contacts" }, { viewId: "documents", path: "/documents" }, { viewId: "feed", path: "/feed" }, @@ -281,7 +271,6 @@ export const MANAGER_VISIBLE_VIEW_TILE_CASES: readonly SafeViewTileCase[] = * without turning all-pages click safety into a long game/app bootstrap loop. */ export const SAFE_VIEW_TILE_CASES: readonly SafeViewTileCase[] = [ - { viewId: "companion", path: "/companion" }, { viewId: "model-tester", path: "/model-tester" }, ].map(({ viewId, path }) => ({ viewId, diff --git a/packages/app/test/ui-smoke/apps-session.spec.ts b/packages/app/test/ui-smoke/apps-session.spec.ts index 2c1bf92ee6c79..18f7b021fd2e0 100644 --- a/packages/app/test/ui-smoke/apps-session.spec.ts +++ b/packages/app/test/ui-smoke/apps-session.spec.ts @@ -18,7 +18,7 @@ test("apps view can route into internal tool pages and survive a reload", async await assertReadyChecks( page, "apps-view", - [{ text: "Companion" }, { text: "LifeOps" }], + [{ text: "LifeOps" }], "all", 90_000, ); @@ -29,7 +29,7 @@ test("apps view can route into internal tool pages and survive a reload", async await assertReadyChecks( page, "apps-view-reload", - [{ text: "Companion" }, { text: "LifeOps" }], + [{ text: "LifeOps" }], "all", 90_000, ); diff --git a/packages/app/test/ui-smoke/apps-utility-interactions.spec.ts b/packages/app/test/ui-smoke/apps-utility-interactions.spec.ts index d450229c27031..6f5a92f67302f 100644 --- a/packages/app/test/ui-smoke/apps-utility-interactions.spec.ts +++ b/packages/app/test/ui-smoke/apps-utility-interactions.spec.ts @@ -104,16 +104,7 @@ async function expectNoIssues( } async function openAppWindow(page: Page, routeCase: RouteCase): Promise { - if (routeCase.name === "companion") { - await page.goto( - `/?appWindow=1&qaApp=${encodeURIComponent(routeCase.name)}#${routeCase.path}`, - { - waitUntil: "domcontentloaded", - }, - ); - } else { - await openAppPath(page, routeCase.path); - } + await openAppPath(page, routeCase.path); await expect(page.locator("#root")).toBeVisible({ timeout: routeTimeout(routeCase), }); @@ -210,126 +201,6 @@ test.beforeEach(async ({ page }) => { await hideContinuousChatOverlay(page); }); -test("companion app controls are interactive and error-free", async ({ - page, -}) => { - test.skip( - !DIRECT_ROUTE_CASES.some((routeCase) => routeCase.name === "companion"), - "Companion app route is not registered in this smoke stack.", - ); - const issues = installIssueGuards(page); - let newConversationRequests = 0; - let lastEmoteId: string | null = null; - - await page.route("**/api/conversations", async (route) => { - if (route.request().method() === "POST") { - newConversationRequests += 1; - } - await route.fallback(); - }); - - await page.route("**/api/emote", async (route) => { - const raw = route.request().postData(); - const body = raw ? (JSON.parse(raw) as { emoteId?: string }) : {}; - lastEmoteId = typeof body.emoteId === "string" ? body.emoteId : null; - await route.fulfill({ - status: 200, - contentType: "application/json", - body: JSON.stringify({ ok: true, emoteId: lastEmoteId }), - }); - }); - - const companion = DIRECT_ROUTE_CASES.find( - (routeCase) => routeCase.name === "companion", - ); - expect(companion).toBeTruthy(); - await openAppWindow(page, companion as RouteCase); - - await expect(page.getByTestId("companion-vrm-canvas")).toBeVisible(); - await expect(page.getByTestId("companion-vrm-stage")).toHaveAttribute( - "data-vrm-loaded", - "true", - { timeout: 90_000 }, - ); - await expect(page.getByTestId("companion-root")).toHaveAttribute( - "data-avatar-ready", - "true", - { timeout: 90_000 }, - ); - - const headerShell = page.getByTestId("companion-header-shell"); - if ((await headerShell.count()) > 0) { - await expect(headerShell).toBeVisible(); - - const voiceToggle = page.getByTestId("companion-voice-toggle"); - const initialVoicePressed = await voiceToggle.getAttribute("aria-pressed"); - await voiceToggle.click(); - await expect(voiceToggle).not.toHaveAttribute( - "aria-pressed", - initialVoicePressed ?? "", - ); - - await page.getByTestId("companion-new-chat").click(); - await expect - .poll(() => newConversationRequests, { - message: "new chat posts a conversation request", - }) - .toBeGreaterThan(0); - - await page.getByTestId("companion-shell-toggle-settings").click(); - await expect(page.getByTestId("companion-settings-panel")).toBeVisible(); - await page.getByTestId("settings-companion-vrm-power-efficiency").click(); - await expect( - page.getByTestId("settings-companion-vrm-power-efficiency"), - ).toHaveAttribute("aria-pressed", "true"); - await page.getByTestId("settings-companion-half-framerate-always").click(); - await expect( - page.getByTestId("settings-companion-half-framerate-always"), - ).toHaveAttribute("aria-pressed", "true"); - const backgroundToggle = page.getByTestId( - "settings-companion-animate-when-hidden-toggle", - ); - const initialBackgroundChecked = - await backgroundToggle.getAttribute("aria-checked"); - await backgroundToggle.focus(); - await backgroundToggle.press("Space"); - await expect(backgroundToggle).not.toHaveAttribute( - "aria-checked", - initialBackgroundChecked ?? "", - ); - - await page.getByTestId("companion-shell-toggle-character").click(); - await expect(page.getByTestId("companion-character-editor")).toBeVisible(); - await page.getByTestId("companion-shell-toggle-companion").click(); - await expect(page.getByTestId("companion-vrm-stage")).toBeVisible(); - - await page.getByTestId("companion-emote-toggle").click(); - await expect(page.getByTestId("emote-picker")).toBeVisible(); - await page.getByTestId("emote-picker-search").fill("wave"); - await page.getByTestId("emote-picker-item-wave").click(); - await expect.poll(() => lastEmoteId).toBe("wave"); - await page.getByTestId("emote-picker-stop").click(); - await page.getByTestId("emote-picker-close").click(); - await expect(page.getByTestId("emote-picker")).toBeHidden(); - } - - const canvas = page.getByTestId("companion-vrm-canvas"); - const canvasBox = await canvas.boundingBox(); - if (!canvasBox) { - throw new Error("Companion VRM canvas did not produce a bounding box"); - } - const dragStart = { - x: canvasBox.x + canvasBox.width * 0.5, - y: canvasBox.y + canvasBox.height * 0.35, - }; - await page.mouse.move(dragStart.x, dragStart.y); - await page.mouse.down(); - await page.mouse.move(dragStart.x + 60, dragStart.y - 20, { steps: 5 }); - await page.mouse.up(); - - await expectNoIssues(page, issues, "companion interactions"); -}); - test("utility app-window routes render without red errors or overflow", async ({ page, }) => { diff --git a/packages/app/test/ui-smoke/builtin-views-visual.spec.ts b/packages/app/test/ui-smoke/builtin-views-visual.spec.ts index 0cd0a8f251e9e..98aad300a2acf 100644 --- a/packages/app/test/ui-smoke/builtin-views-visual.spec.ts +++ b/packages/app/test/ui-smoke/builtin-views-visual.spec.ts @@ -32,7 +32,6 @@ const BUILTIN_VIEW_CASES: Array<{ id: string; path: string }> = [ { id: "camera", path: "/camera" }, { id: "tasks", path: "/apps/tasks" }, { id: "browser", path: "/browser" }, - { id: "companion", path: "/companion" }, { id: "stream", path: "/stream" }, { id: "apps", path: "/apps" }, { id: "views", path: "/views" }, diff --git a/packages/app/test/ui-smoke/chat-viewmanager-companion-interactions.spec.ts b/packages/app/test/ui-smoke/chat-viewmanager-companion-interactions.spec.ts deleted file mode 100644 index 8c92f6e676b65..0000000000000 --- a/packages/app/test/ui-smoke/chat-viewmanager-companion-interactions.spec.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Button-level interaction coverage for controls the existing view-manager / -// companion specs don't drive: the view catalog refresh and the companion TUI -// controls. Keyless against the stub; asserts each control DOES something. - -import { expect, type Page, test } from "@playwright/test"; -import { - installDefaultAppRoutes, - openAppPath, - seedAppStorage, -} from "./helpers"; - -test.beforeEach(async ({ page }) => { - await seedAppStorage(page); - await installDefaultAppRoutes(page); -}); - -test("view catalog: loading the page queries the views list", async ({ - page, -}) => { - // The minimal launcher redesign dropped the manual Refresh button — the - // catalog loads its views from /api/views on mount (and re-queries on - // register/delete). Assert the load path: the section renders and the - // views endpoint is queried, surfacing at least one catalog entry. - let viewsReqs = 0; - page.on("request", (req) => { - if (/\/api\/views(?:\?|$)/.test(req.url())) viewsReqs += 1; - }); - - await openAppPath(page, "/views"); - const catalog = page.getByTestId("views-catalog-section").first(); - await expect(catalog).toBeVisible({ timeout: 60_000 }); - await expect.poll(() => viewsReqs).toBeGreaterThan(0); - - // The fetched list actually populates the launcher grid. - await expect(page.locator('[data-testid^="view-card-"]').first()).toBeVisible( - { - timeout: 15_000, - }, - ); -}); - -async function readViewState(page: Page): Promise> { - const raw = await page - .locator("[data-view-state]") - .first() - .getAttribute("data-view-state"); - return raw ? (JSON.parse(raw) as Record) : {}; -} - -test("companion TUI: toggling emotes flips the view state", async ({ - page, -}) => { - await openAppPath(page, "/companion/tui"); - const emotes = page.locator('[data-agent-id="tui-toggle-emotes"]'); - await expect(emotes).toBeVisible({ timeout: 60_000 }); - - const before = (await readViewState(page)).emotePickerOpen; - await emotes.click(); - await expect - .poll(async () => (await readViewState(page)).emotePickerOpen) - .not.toBe(before); -}); diff --git a/packages/app/test/ui-smoke/onboarding-to-home.shared.ts b/packages/app/test/ui-smoke/onboarding-to-home.shared.ts index 9d2aac9d5a6ca..17a0e11403c50 100644 --- a/packages/app/test/ui-smoke/onboarding-to-home.shared.ts +++ b/packages/app/test/ui-smoke/onboarding-to-home.shared.ts @@ -817,8 +817,8 @@ async function pickTutorial( * Drive the REAL in-chat onboarding to completion via Local → on-device * inference → tutorial-or-skip, then assert the post-onboarding HOME inside the * SAME floating ContinuousChatOverlay we use everywhere else. This is the - * keyless path that calls completeFirstRun("chat", { launchCompanionOverlay: - * true }) without a cloud sign-in (all-local needs no cloud connect). `click` + * keyless path that calls completeFirstRun("chat") without a cloud sign-in + * (all-local needs no cloud connect). `click` * lets the mobile lane TAP the inline choice buttons while desktop clicks. */ export async function completeOnboardingToHome( diff --git a/packages/app/test/ui-smoke/plugin-view-cases.ts b/packages/app/test/ui-smoke/plugin-view-cases.ts index 650e55ef48116..0ef095967be33 100644 --- a/packages/app/test/ui-smoke/plugin-view-cases.ts +++ b/packages/app/test/ui-smoke/plugin-view-cases.ts @@ -19,8 +19,6 @@ export const VIEW_CASES: ViewCase[] = ( // Collapsed plugins: every modality (gui/tui/xr) is drawn from one single // view declaration that shares ONE route, so the tui case uses the same // path as its gui case, not a separate `//tui` route. - ["companion", "gui", "/companion"], - ["companion", "tui", "/companion"], ["contacts", "gui", "/contacts"], ["contacts", "tui", "/contacts"], ["hyperliquid", "gui", "/hyperliquid"], diff --git a/packages/app/test/ui-smoke/plugin-views-lifecycle.spec.ts b/packages/app/test/ui-smoke/plugin-views-lifecycle.spec.ts index 8295eb114d17e..cdbe495eb34aa 100644 --- a/packages/app/test/ui-smoke/plugin-views-lifecycle.spec.ts +++ b/packages/app/test/ui-smoke/plugin-views-lifecycle.spec.ts @@ -11,28 +11,21 @@ import { VIEW_CASES, type ViewCase } from "./plugin-view-cases"; async function expectLoadedView(page: Page, view: ViewCase, phase: string) { const viewRoot = page.locator("main").first(); - const isCompanionGui = view.id === "companion" && view.viewType === "gui"; await expect(viewRoot).toBeVisible({ timeout: 60_000 }); - if (isCompanionGui) { - await expect(viewRoot.getByTestId("companion-root").first()).toBeVisible({ - timeout: 60_000, - }); - } else { - await expect - .poll( - async () => { - const text = await viewRoot.evaluate((root) => - root.innerText.trim().replace(/\s+/g, " "), - ); - return text.length > 20 && !/^Loading view\b/.test(text); - }, - { - message: `${view.id} ${view.viewType} should load during ${phase}`, - timeout: 60_000, - }, - ) - .toBe(true); - } + await expect + .poll( + async () => { + const text = await viewRoot.evaluate((root) => + root.innerText.trim().replace(/\s+/g, " "), + ); + return text.length > 20 && !/^Loading view\b/.test(text); + }, + { + message: `${view.id} ${view.viewType} should load during ${phase}`, + timeout: 60_000, + }, + ) + .toBe(true); await expect(page.getByText(/Loading view/)).toHaveCount(0); await expect(page.getByText("Failed to load view")).toHaveCount(0); await expectNoRenderTelemetryErrors( @@ -51,9 +44,6 @@ async function expectViewManagerPage(page: Page) { await expect( main.getByRole("button", { name: "Refresh views" }), ).toBeVisible(); - await expect( - main.getByRole("button", { name: "Open Companion" }), - ).toBeVisible(); } else { // #8597 moved the views search out of
and into the floating chat // composer ("Search views…"). The catalog renders as a flat launcher grid diff --git a/packages/app/test/ui-smoke/plugin-views-visual.spec.ts b/packages/app/test/ui-smoke/plugin-views-visual.spec.ts index 9ec8963ae5cd5..43f130e40b04e 100644 --- a/packages/app/test/ui-smoke/plugin-views-visual.spec.ts +++ b/packages/app/test/ui-smoke/plugin-views-visual.spec.ts @@ -98,36 +98,28 @@ test.describe("registered plugin views visual coverage", () => { `${view.id} ${view.viewType} initial load`, ); - const isCompanionGui = view.id === "companion" && view.viewType === "gui"; const minVisibleTextLength = MIN_VISIBLE_TEXT_LENGTH_BY_VIEW_ID.get(view.id) ?? DEFAULT_MIN_VISIBLE_TEXT_LENGTH; const viewRoot = page.locator("main").first(); await expect(viewRoot).toBeVisible({ timeout: 60_000 }); - if (isCompanionGui) { - await expect( - viewRoot.getByTestId("companion-root").first(), - `${view.id} ${view.viewType} should mount its canvas-first companion root before audit`, - ).toBeVisible({ timeout: 60_000 }); - } else { - await expect - .poll( - async () => { - const text = await viewRoot.evaluate((root) => - (root.textContent ?? "").trim().replace(/\s+/g, " "), - ); - return ( - text.length >= minVisibleTextLength && - !/^Loading view\b/.test(text) - ); - }, - { - message: `${view.id} ${view.viewType} should finish dynamic view loading before audit`, - timeout: 60_000, - }, - ) - .toBe(true); - } + await expect + .poll( + async () => { + const text = await viewRoot.evaluate((root) => + (root.textContent ?? "").trim().replace(/\s+/g, " "), + ); + return ( + text.length >= minVisibleTextLength && + !/^Loading view\b/.test(text) + ); + }, + { + message: `${view.id} ${view.viewType} should finish dynamic view loading before audit`, + timeout: 60_000, + }, + ) + .toBe(true); await expect(page.getByText(/Loading view/)).toHaveCount(0); await expectNoFailedView( page, @@ -175,17 +167,10 @@ test.describe("registered plugin views visual coverage", () => { }, ); - if (isCompanionGui) { - await expect( - viewRoot.getByTestId("companion-root").first(), - `${view.id} ${view.viewType} should expose its companion scene root before opening the assistant overlay`, - ).toBeVisible(); - } else { - expect( - preOverlayAudit.visibleText.length, - `${view.id} ${view.viewType} should expose readable view text before opening the assistant overlay`, - ).toBeGreaterThanOrEqual(minVisibleTextLength); - } + expect( + preOverlayAudit.visibleText.length, + `${view.id} ${view.viewType} should expose readable view text before opening the assistant overlay`, + ).toBeGreaterThanOrEqual(minVisibleTextLength); if (view.id !== "views-manager") { expect( preOverlayAudit.visibleText, @@ -335,17 +320,10 @@ test.describe("registered plugin views visual coverage", () => { }, ); - if (isCompanionGui) { - await expect( - viewRoot.getByTestId("companion-root").first(), - `${view.id} ${view.viewType} should expose its companion scene root after assistant overlay interaction`, - ).toBeVisible(); - } else { - expect( - audit.visibleText.length, - `${view.id} ${view.viewType} should expose readable text`, - ).toBeGreaterThanOrEqual(minVisibleTextLength); - } + expect( + audit.visibleText.length, + `${view.id} ${view.viewType} should expose readable text`, + ).toBeGreaterThanOrEqual(minVisibleTextLength); if (view.viewType === "tui" && hasVisibleLegacyTuiRoot) { expect( audit.controls.length, diff --git a/packages/app/test/ui-smoke/walkthrough/SURFACE_DECISION.md b/packages/app/test/ui-smoke/walkthrough/SURFACE_DECISION.md index 3a22fa20da6fd..860471a694c45 100644 --- a/packages/app/test/ui-smoke/walkthrough/SURFACE_DECISION.md +++ b/packages/app/test/ui-smoke/walkthrough/SURFACE_DECISION.md @@ -41,8 +41,7 @@ the composer, and step 14 deletes the **draft** — all overlay-native. - **If the journey is later extended** to edit/delete a *sent* message, that step must run against desktop `ChatView` (e.g. via the Electrobun harness) and the spec must document the surface switch — see the desktop chat specs under - `packages/app/test/ui-smoke/` (`chat-view-memory-stability.spec.ts`, - `chat-viewmanager-companion-interactions.spec.ts`). + `packages/app/test/ui-smoke/` (`chat-view-memory-stability.spec.ts`). ## Follow-up diff --git a/packages/app/test/view-interaction-coverage.test.ts b/packages/app/test/view-interaction-coverage.test.ts index 84185e20f3a9d..8651b63b1a41d 100644 --- a/packages/app/test/view-interaction-coverage.test.ts +++ b/packages/app/test/view-interaction-coverage.test.ts @@ -106,18 +106,6 @@ const GUI_INTERACTION_OWNERS: Readonly< signals: ["todos decomposed view", "/todos"], }, ], - companion: [ - { - spec: "packages/app/test/ui-smoke/apps-utility-interactions.spec.ts", - proves: - "Drives companion chat dock, emote picker, microphone toggles, and VRM canvas drag controls.", - signals: [ - "companion interactions", - "emote-picker", - "companion-vrm-canvas", - ], - }, - ], contacts: [ { spec: "packages/app/test/ui-smoke/apps-comms-device-interactions.spec.ts", diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json index 41d4eecc450f2..d62cd4921c304 100644 --- a/packages/app/tsconfig.json +++ b/packages/app/tsconfig.json @@ -7,9 +7,6 @@ "@elizaos/plugin-task-coordinator": [ "../../plugins/plugin-task-coordinator/src/index.ts" ], - "@elizaos/plugin-companion": [ - "../../plugins/plugin-companion/src/index.ts" - ], "@elizaos/plugin-personal-assistant": [ "../../plugins/plugin-personal-assistant/src/index.ts" ], diff --git a/packages/app/tsconfig.typecheck.json b/packages/app/tsconfig.typecheck.json index 8efdb791bee7f..d15aa2b870912 100644 --- a/packages/app/tsconfig.typecheck.json +++ b/packages/app/tsconfig.typecheck.json @@ -14,7 +14,6 @@ "@elizaos/plugin-task-coordinator": [ "./src/types/app-plugin-modules.d.ts" ], - "@elizaos/plugin-companion": ["./src/types/app-plugin-modules.d.ts"], "@elizaos/plugin-personal-assistant": [ "./src/types/app-plugin-modules.d.ts" ], diff --git a/packages/app/vite.config.ts b/packages/app/vite.config.ts index 4e359b891560f..e8de7d1fca203 100644 --- a/packages/app/vite.config.ts +++ b/packages/app/vite.config.ts @@ -695,9 +695,6 @@ function isKnownToleratedBuildWarning(message: unknown): boolean { text.includes( "../../plugins/plugin-facewear/src/protocol/smartglasses.ts", ) || - text.includes( - "../../plugins/plugin-companion/src/components/companion/CompanionAppView.tsx", - ) || text.includes( "../../plugins/app-model-tester/src/ModelTesterAppView.tsx", ) || @@ -1737,49 +1734,6 @@ function watchWorkspacePackagesPlugin(): Plugin { }; } -/** - * Serve @elizaos/plugin-companion's public/ assets alongside the app's own - * public/ directory. In dev the companion dir is served as a fallback - * middleware; in build the files are copied into the output. - */ -function companionAssetsPlugin(): Plugin { - const companionPublic = path.resolve( - elizaRoot, - "plugins/plugin-companion/public", - ); - return { - name: "companion-assets", - configureServer(server) { - // Serve companion public as fallback (after app public) - server.middlewares.use((req, res, next) => { - if (!req.url) return next(); - const clean = req.url.split("?")[0]; - const filePath = path.join(companionPublic, clean); - if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) { - res.setHeader( - "Content-Type", - filePath.endsWith(".wasm") - ? "application/wasm" - : filePath.endsWith(".js") - ? "application/javascript" - : "application/octet-stream", - ); - fs.createReadStream(filePath).pipe(res); - } else { - next(); - } - }); - }, - closeBundle() { - // Copy companion public to dist at build time - if (fs.existsSync(companionPublic)) { - const outDir = path.resolve(here, "dist"); - fs.cpSync(companionPublic, outDir, { recursive: true, force: false }); - } - }, - }; -} - function workspaceJsxInJsPlugin(): Plugin { const normalizedAppCoreSrcRoot = appCoreSrcRoot.split(path.sep).join("/"); @@ -2153,7 +2107,6 @@ export default defineConfig({ appShellMetadataPlugin(), rendererBuildManifestPlugin(), appDevWsBasePlugin(), - companionAssetsPlugin(), elizaCoreBrowserEntryFallbackPlugin(), nativeModuleStubPlugin({ isCapacitorMobileBuild: IS_CAPACITOR_MOBILE_BUILD, @@ -2441,35 +2394,6 @@ export const INVALID_TRACER_PROVIDER = {}; find: /^@elizaos\/plugin-browser$/, replacement: path.join(pluginBrowserBridgeSrcRoot, "index.ts"), }, - ...[ - [ - "@elizaos/plugin-companion/components/companion/companion-app", - "plugins/plugin-companion/src/components/companion/companion-app.ts", - ], - [ - "@elizaos/plugin-companion/components/companion/companion-scene-status-context", - "plugins/plugin-companion/src/components/companion/companion-scene-status-context.ts", - ], - [ - "@elizaos/plugin-companion/components/companion/resolve-companion-inference-notice", - "plugins/plugin-companion/src/components/companion/resolve-companion-inference-notice.ts", - ], - [ - "@elizaos/plugin-companion/components/companion/CompanionShell", - "plugins/plugin-companion/src/components/companion/CompanionShell.tsx", - ], - [ - "@elizaos/plugin-companion/components/companion/GlobalEmoteOverlay", - "plugins/plugin-companion/src/components/companion/GlobalEmoteOverlay.tsx", - ], - [ - "@elizaos/plugin-companion/components/companion/InferenceCloudAlertButton", - "plugins/plugin-companion/src/components/companion/InferenceCloudAlertButton.tsx", - ], - ].map(([pkgName, relativeEntry]) => ({ - find: new RegExp(`^${escapeRegExp(pkgName)}$`), - replacement: path.resolve(elizaRoot, relativeEntry), - })), // Side-effect app modules are loaded by the renderer only to register // UI surfaces/pages. Route handlers and runtime services stay server-side. ...[ diff --git a/packages/core/src/generated/action-docs.ts b/packages/core/src/generated/action-docs.ts index f872542f83df5..d5b0e7989c329 100644 --- a/packages/core/src/generated/action-docs.ts +++ b/packages/core/src/generated/action-docs.ts @@ -7539,47 +7539,6 @@ export const allActionsSpec = { }, ], }, - { - name: "PLAY_EMOTE", - description: - "Play a one-shot emote animation on your 3D VRM avatar, then return to idle. ", - parameters: [ - { - name: "emote", - description: - "Required emote ID to play once silently before returning to idle. ", - required: true, - schema: { - type: "string", - }, - descriptionCompressed: - "Required emote ID to play once silently before returning to idle.", - }, - ], - descriptionCompressed: - "Play one-shot VRM avatar emote animation. Silent visual side-action.", - similes: [ - "EMOTE", - "ANIMATE", - "GESTURE", - "DANCE", - "WAVE", - "PLAY_ANIMATION", - "DO_EMOTE", - "PERFORM", - ], - exampleCalls: [ - { - user: "Use PLAY_EMOTE with the provided parameters.", - actions: ["PLAY_EMOTE"], - params: { - PLAY_EMOTE: { - emote: "example", - }, - }, - }, - ], - }, { name: "PRIORITIZE", description: diff --git a/packages/core/src/testing/eliza-package-paths.ts b/packages/core/src/testing/eliza-package-paths.ts index 61cf5ce2eb838..1d431077b0277 100644 --- a/packages/core/src/testing/eliza-package-paths.ts +++ b/packages/core/src/testing/eliza-package-paths.ts @@ -24,10 +24,6 @@ function getRepoLocalWorkspaceRoot( "../eliza/packages/app-core", ], "@elizaos/shared": ["eliza/packages/shared", "../eliza/packages/shared"], - "@elizaos/plugin-companion": [ - "eliza/plugins/plugin-companion", - "../eliza/plugins/plugin-companion", - ], }; for (const relativeRoot of relativeRoots[packageName] ?? []) { diff --git a/packages/docs/action-catalog.md b/packages/docs/action-catalog.md index a9ef00e5236b2..087bfd5cfdcd9 100644 --- a/packages/docs/action-catalog.md +++ b/packages/docs/action-catalog.md @@ -913,17 +913,6 @@ _Catalog snapshot from 2026-04-16. Total actions: 147._ - **Handler:** ✅ yes - **Examples:** ✅ yes -## App / app-companion - -### PLAY_EMOTE - -- **File:** `eliza/plugins/plugin-companion/src/actions/emote.ts` -- **Description:** Play a one-shot emote animation on your 3D VRM avatar, then return to idle. -- **Similes:** `EMOTE`, `ANIMATE`, `GESTURE`, `DANCE`, `WAVE`, `PLAY_ANIMATION`, `DO_EMOTE`, `PERFORM` -- **Validate:** ✅ yes -- **Handler:** ✅ yes -- **Examples:** ❌ no - ## Core / @elizaos/core / advanced-memory ### RESET_SESSION @@ -948,7 +937,6 @@ Notable actions without examples (first 10): - `BROWSER_ACTION` (plugin-computeruse) - `FILE_ACTION` (plugin-computeruse) - `MANAGE_WINDOW` (plugin-computeruse) - - `PLAY_EMOTE` (app-app-companion) - `TERMINAL_ACTION` (plugin-computeruse) - `UPDATE_OWNER_PROFILE` (app-app-lifeops) diff --git a/packages/docs/architecture.mdx b/packages/docs/architecture.mdx index 05b2b1bec66e0..e959022ba13c6 100644 --- a/packages/docs/architecture.mdx +++ b/packages/docs/architecture.mdx @@ -203,7 +203,6 @@ The `createElizaPlugin()` function (`eliza/packages/app-core/src/runtime/eliza-p - Register trigger task workers - Start autonomous state tracking - Bind custom action runtime references -- Remove `PLAY_EMOTE` action when `character.settings.DISABLE_EMOTES` is set ### Error Boundaries @@ -299,7 +298,7 @@ Eliza registers 7+ providers through the Eliza plugin, plus any providers from l ### Actions Actions are operations the agent can invoke based on conversation context. Each action defines: -- `name` -- unique identifier (e.g., `RESTART`, `MESSAGE`, `PLAY_EMOTE`) +- `name` -- unique identifier (e.g., `RESTART`, `MESSAGE`, `MUTE_ROOM`) - `similes` -- alternative names the agent can use - `validate()` -- whether the action can run in the current context - `handler()` -- the execution logic diff --git a/packages/elizaos/templates/project/apps/app/src/optional-eliza-app-stub.tsx b/packages/elizaos/templates/project/apps/app/src/optional-eliza-app-stub.tsx index a340c2aa20329..15fda1d16a605 100644 --- a/packages/elizaos/templates/project/apps/app/src/optional-eliza-app-stub.tsx +++ b/packages/elizaos/templates/project/apps/app/src/optional-eliza-app-stub.tsx @@ -6,22 +6,15 @@ const optionalPlugin = Object.freeze({ routes: [], }); -export const CompanionShell = EmptyComponent; -export const GlobalEmoteOverlay = EmptyComponent; export const InferenceCloudAlertButton = EmptyComponent; export const AppBlockerSettingsCard = EmptyComponent; export const WebsiteBlockerSettingsCard = EmptyComponent; -export const ApprovalQueue = EmptyComponent; -export const StewardLogo = EmptyComponent; -export const TransactionHistory = EmptyComponent; export const CodingAgentControlChip = EmptyComponent; export const CodingAgentSettingsSection = EmptyComponent; export const CodingAgentTasksPanel = EmptyComponent; export const PtyConsoleDrawer = EmptyComponent; export const FineTuningView = EmptyComponent; -export const EMOTE_BY_ID = Object.freeze({}); -export const EMOTE_CATALOG = Object.freeze([]); export const LIFEOPS_CONNECTOR_DEGRADATION_AXES = Object.freeze([]); export const appPlugin = optionalPlugin; export const defaultPlugin = optionalPlugin; @@ -41,18 +34,6 @@ export function createVectorBrowserRenderer(): Promise { return Promise.resolve(null); } -export function prefetchVrmToCache(): Promise { - return Promise.resolve(); -} - -export function resolveCompanionInferenceNotice(): null { - return null; -} - -export function useCompanionSceneStatus() { - return { avatarReady: false, teleportKey: "" }; -} - export function clearBackendCache() {} export async function detectAvailableBackends() { return { available: false, backends: [] }; diff --git a/packages/elizaos/templates/project/apps/app/test/design-review/run-design-review.ts b/packages/elizaos/templates/project/apps/app/test/design-review/run-design-review.ts index 89da0b961a2c4..ecb4ea8a770ec 100644 --- a/packages/elizaos/templates/project/apps/app/test/design-review/run-design-review.ts +++ b/packages/elizaos/templates/project/apps/app/test/design-review/run-design-review.ts @@ -15,9 +15,8 @@ import { startMockApiServer, } from "../electrobun-packaged/mock-api"; -type ShellMode = "companion" | "native"; +type ShellMode = "native"; type ViewId = - | "companion" | "chat" | "stream" | "character" @@ -179,14 +178,6 @@ const viewports: ViewportSpec[] = [ ]; const views: ViewSpec[] = [ - { - id: "companion", - label: "Companion", - path: "/companion", - shellMode: "companion", - lastNativeTab: "chat", - readyChecks: [{ selector: '[data-testid="companion-root"]' }], - }, { id: "chat", label: "Chat", diff --git a/packages/elizaos/templates/project/apps/app/vite.config.ts b/packages/elizaos/templates/project/apps/app/vite.config.ts index 765bd25ae48de..53dbe2f385f28 100644 --- a/packages/elizaos/templates/project/apps/app/vite.config.ts +++ b/packages/elizaos/templates/project/apps/app/vite.config.ts @@ -1000,50 +1000,6 @@ function watchWorkspacePackagesPlugin(): Plugin { }; } -/** - * Serve @elizaos/plugin-companion's public/ assets alongside the app's own - * public/ directory. In dev the companion dir is served as a fallback - * middleware; in build the files are copied into the output. - */ -function companionAssetsPlugin(): Plugin { - const companionPublic = path.resolve( - elizaRoot, - "plugins/plugin-companion/public", - ); - return { - name: "companion-assets", - configureServer(server) { - if (!fs.existsSync(companionPublic)) return; - // Serve companion public as fallback (after app public) - server.middlewares.use((req, res, next) => { - if (!req.url) return next(); - const clean = req.url.split("?")[0]; - const filePath = path.join(companionPublic, clean); - if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) { - res.setHeader( - "Content-Type", - filePath.endsWith(".wasm") - ? "application/wasm" - : filePath.endsWith(".js") - ? "application/javascript" - : "application/octet-stream", - ); - fs.createReadStream(filePath).pipe(res); - } else { - next(); - } - }); - }, - closeBundle() { - // Copy companion public to dist at build time - if (fs.existsSync(companionPublic)) { - const outDir = path.resolve(here, "dist"); - fs.cpSync(companionPublic, outDir, { recursive: true, force: false }); - } - }, - }; -} - function workspaceJsxInJsPlugin(): Plugin { const normalizedAppCoreSrcRoot = appCoreSrcRoot.split(path.sep).join("/"); @@ -1090,7 +1046,6 @@ export default defineConfig({ ), }, plugins: [ - companionAssetsPlugin(), nativeModuleStubPlugin(), asyncLocalStoragePatchPlugin(), watchWorkspacePackagesPlugin(), diff --git a/packages/elizaos/templates/project/scripts/ensure-elizaos-optional-app-stubs.mjs b/packages/elizaos/templates/project/scripts/ensure-elizaos-optional-app-stubs.mjs index 4e92f3682a870..86bfa17c0615b 100644 --- a/packages/elizaos/templates/project/scripts/ensure-elizaos-optional-app-stubs.mjs +++ b/packages/elizaos/templates/project/scripts/ensure-elizaos-optional-app-stubs.mjs @@ -13,7 +13,6 @@ const nodeModulesDir = path.join(repoRoot, "node_modules"); const cleanupHelperPath = path.join(scriptDir, "rm-path-recursive.mjs"); const optionalPackages = [ - "@elizaos/plugin-companion", "@elizaos/plugin-hyperliquid", "@elizaos/plugin-documents", "@elizaos/plugin-personal-assistant", @@ -30,8 +29,6 @@ const stubSource = `const optionalStub = Object.freeze({ routes: [], }); -export const EMOTE_BY_ID = Object.freeze({}); -export const EMOTE_CATALOG = Object.freeze([]); export const LIFEOPS_CONNECTOR_DEGRADATION_AXES = Object.freeze([]); export const appPlugin = optionalStub; export const defaultPlugin = optionalStub; diff --git a/packages/elizaos/templates/project/test/eliza-package-paths.ts b/packages/elizaos/templates/project/test/eliza-package-paths.ts index d3f05a9fb5829..bf55f8d833d27 100644 --- a/packages/elizaos/templates/project/test/eliza-package-paths.ts +++ b/packages/elizaos/templates/project/test/eliza-package-paths.ts @@ -40,7 +40,6 @@ function getRepoLocalWorkspaceRoot( "@elizaos/core": ["eliza/packages/core"], "@elizaos/shared": ["eliza/packages/shared"], "@elizaos/ui": ["eliza/packages/ui"], - "@elizaos/plugin-companion": ["eliza/plugins/plugin-companion"], }; for (const relativeRoot of relativeRoots[packageName] ?? []) { diff --git a/packages/os/android/system-ui/DEFERRED.md b/packages/os/android/system-ui/DEFERRED.md index 2914d7fe42abf..a43c8b95fc265 100644 --- a/packages/os/android/system-ui/DEFERRED.md +++ b/packages/os/android/system-ui/DEFERRED.md @@ -43,9 +43,6 @@ for this session. - **Wallpaper / clouds.** Re-export `SlowClouds` from `@elizaos/ui/backgrounds` once that module exists, then pass it into `} />`. -- **CompanionBar.** Once `packages/ui/src/desktop-runtime/` exports a - `CompanionBar` component + types, pass it to - `} />`. ## Markers in source diff --git a/packages/os/android/system-ui/src/components/LockScreen.tsx b/packages/os/android/system-ui/src/components/LockScreen.tsx index 774b9e85f4817..d25edad570659 100644 --- a/packages/os/android/system-ui/src/components/LockScreen.tsx +++ b/packages/os/android/system-ui/src/components/LockScreen.tsx @@ -2,11 +2,10 @@ import { type ReactNode, useMemo } from "react"; import { useSystemProvider } from "../providers/context"; export interface LockScreenProps { - companionBar?: ReactNode; cloudsModule?: ReactNode; } -export function LockScreen({ companionBar, cloudsModule }: LockScreenProps) { +export function LockScreen({ cloudsModule }: LockScreenProps) { const { time } = useSystemProvider(); const formatted = useMemo(() => { @@ -72,6 +71,7 @@ export function LockScreen({ companionBar, cloudsModule }: LockScreenProps) { {formatted.date} + {/* Bottom anchor reserved for the lock-screen voice-unlock pill (see DEFERRED.md). */}
- {companionBar ?? null} -
+ /> ); } diff --git a/packages/os/linux/scripts/prepare-elizaos-app-overlay.mjs b/packages/os/linux/scripts/prepare-elizaos-app-overlay.mjs index f08757453b066..5d6feb4b419aa 100755 --- a/packages/os/linux/scripts/prepare-elizaos-app-overlay.mjs +++ b/packages/os/linux/scripts/prepare-elizaos-app-overlay.mjs @@ -278,19 +278,6 @@ export const modelTesterPlugin = { routes: [], }; export default modelTesterPlugin; -`, - "@elizaos/plugin-companion": ` -export const appCompanionPlugin = { - name: "companion", - description: "Live-safe companion overlay for elizaOS Live. The full 3D companion bundle can be installed through app updates.", - actions: [], - providers: [], - services: [], - routes: [], -}; -export const companionPlugin = appCompanionPlugin; -export const registerCompanionApp = () => undefined; -export default appCompanionPlugin; `, "@elizaos/plugin-personal-assistant": ` export const personalAssistantPlugin = { @@ -485,7 +472,6 @@ export default undefined; const forceLiveStubPackages = new Set([ "@elizaos/app-model-tester", - "@elizaos/plugin-companion", "@elizaos/plugin-documents", "@elizaos/plugin-google", "@elizaos/plugin-hyperliquid", diff --git a/packages/os/linux/scripts/static-smoke.sh b/packages/os/linux/scripts/static-smoke.sh index e610382e9580b..ec67c19b1d413 100755 --- a/packages/os/linux/scripts/static-smoke.sh +++ b/packages/os/linux/scripts/static-smoke.sh @@ -1255,7 +1255,6 @@ for (const root of [ } const forcedLiveStubs = new Map([ ["@elizaos/app-model-tester", "model-tester"], - ["@elizaos/plugin-companion", "companion"], ["@elizaos/plugin-documents", "documents"], ["@elizaos/plugin-google", "google"], ["@elizaos/plugin-hyperliquid", "hyperliquid"], diff --git a/packages/prompts/specs/actions/plugins.generated.json b/packages/prompts/specs/actions/plugins.generated.json index 0ebc13b01e9a2..1dd0616b50a5f 100644 --- a/packages/prompts/specs/actions/plugins.generated.json +++ b/packages/prompts/specs/actions/plugins.generated.json @@ -3580,42 +3580,6 @@ } ] }, - { - "name": "PLAY_EMOTE", - "description": "Play a one-shot emote animation on your 3D VRM avatar, then return to idle. ", - "parameters": [ - { - "name": "emote", - "description": "Required emote ID to play once silently before returning to idle. ", - "required": true, - "schema": { - "type": "string" - } - } - ], - "descriptionCompressed": "Play one-shot VRM avatar emote animation. Silent visual side-action.", - "similes": [ - "EMOTE", - "ANIMATE", - "GESTURE", - "DANCE", - "WAVE", - "PLAY_ANIMATION", - "DO_EMOTE", - "PERFORM" - ], - "exampleCalls": [ - { - "user": "Use PLAY_EMOTE with the provided parameters.", - "actions": ["PLAY_EMOTE"], - "params": { - "PLAY_EMOTE": { - "emote": "example" - } - } - } - ] - }, { "name": "PRIORITIZE", "description": "Rank owner open todos, message threads, pending decisions by urgency × importance. LLM pass. Subactions: rank_todos, rank_threads, rank_decisions.", diff --git a/packages/registry/src/first-party/curated-app-definitions.json b/packages/registry/src/first-party/curated-app-definitions.json index b1722fabd325f..64371661c9fd2 100644 --- a/packages/registry/src/first-party/curated-app-definitions.json +++ b/packages/registry/src/first-party/curated-app-definitions.json @@ -1,9 +1,4 @@ [ - { - "slug": "companion", - "canonicalName": "@elizaos/plugin-companion", - "aliases": [] - }, { "slug": "contacts", "canonicalName": "@elizaos/plugin-contacts", diff --git a/packages/registry/src/first-party/generated.json b/packages/registry/src/first-party/generated.json index 965afd4316378..1e4554bb93992 100644 --- a/packages/registry/src/first-party/generated.json +++ b/packages/registry/src/first-party/generated.json @@ -1249,40 +1249,6 @@ "kind": "plugin", "subtype": "automation" }, - { - "id": "companion", - "name": "Companion", - "description": "The companion overlay shell for ambient agent presence.", - "npmName": "@elizaos/plugin-companion", - "source": "bundled", - "tags": [], - "config": {}, - "render": { - "visible": true, - "pinTo": [], - "style": "card", - "icon": "Bot", - "group": "Curated", - "groupOrder": 0, - "actions": ["launch", "configure"] - }, - "resources": {}, - "dependsOn": [], - "channels": [], - "curatedApp": { - "slug": "companion", - "order": 0, - "aliases": [] - }, - "kind": "app", - "subtype": "shell", - "launch": { - "type": "overlay", - "target": "companion", - "capabilities": [], - "curatedSlug": "companion" - } - }, { "id": "computeruse", "name": "Computeruse", diff --git a/packages/registry/src/first-party/schema.ts b/packages/registry/src/first-party/schema.ts index 458752d95ab9e..d1137bc861d8e 100644 --- a/packages/registry/src/first-party/schema.ts +++ b/packages/registry/src/first-party/schema.ts @@ -117,7 +117,6 @@ const renderActionSchema = z.enum([ const secondarySurfaceSchema = z.enum([ "chat-apps-section", - "companion-shell", "settings-integrations", // OS-mode launcher. OS-level system entries (contacts, phone, wifi) set // `visible: false` + `pinTo: ["os-shell"]` so they are hidden from the diff --git a/packages/scenario-runner/src/__tests__/deterministic-action-coverage.test.ts b/packages/scenario-runner/src/__tests__/deterministic-action-coverage.test.ts index f6ce3d59d2f83..ec5479d4547e8 100644 --- a/packages/scenario-runner/src/__tests__/deterministic-action-coverage.test.ts +++ b/packages/scenario-runner/src/__tests__/deterministic-action-coverage.test.ts @@ -152,15 +152,16 @@ const ACTIONLESS_CORE_PLUGINS: Record = { }; /** - * Core plugin actions behind heavy UI deps that cannot be imported under node - * (companion's VRM/Three.js stack). Verified by source instead. + * Core plugin actions that the keyless lane resolves from source instead of a + * live import: the app-control VIEWS aliases are wired in source but are not + * registered as top-level runtime actions in this lane, so the live action + * surface never exposes them. Verified by source instead. */ const SOURCE_ONLY_ACTIONS: Record = { "plugins/plugin-app-control/src/actions/views.ts": [ "CLOSE_ALL_VIEWS", "CLOSE_VIEW", ], - "plugins/plugin-companion/src/actions/emote.ts": ["PLAY_EMOTE"], }; /** @@ -175,7 +176,7 @@ const SOURCE_VERIFIED_IMPORTED_ACTIONS: Record = { /** * The stable-core keyless surface that the ratchet drives to completion: the - * importable core plugins plus the source-only companion action. Big, volatile + * importable core plugins plus the source-only VIEWS aliases. Big, volatile * surfaces (browser, lifeops) are NOT here — their coverage is tracked by the * coverage registry instead, so adding a lifeops scenario never has to edit a * 150-entry surface list. @@ -262,7 +263,6 @@ const COVERED_ACTIONS: readonly string[] = [ "MCP_LIST_CONNECTIONS", "MCP_READ_RESOURCE", "MCP_SEARCH_ACTIONS", - "PLAY_EMOTE", "SKILL", "SKILL_DETAILS", "SKILL_INSTALL", @@ -622,7 +622,6 @@ const STRICT_LLM_ROUTED_ACTIONS: readonly string[] = [ "MCP_LIST_CONNECTIONS", "MCP_READ_RESOURCE", "MCP_SEARCH_ACTIONS", - "PLAY_EMOTE", "SCHEDULED_TASKS", "SHELL", "SKILL", @@ -706,9 +705,9 @@ const STRICT_LLM_ROUTING_SCENARIOS: Record< actionNames: ["GIT_PATHOLOGY"], minMessageTurns: 1, }, - "deterministic-media-emote-actions": { - actionNames: ["GENERATE_MEDIA", "PLAY_EMOTE"], - minMessageTurns: 3, + "deterministic-media-actions": { + actionNames: ["GENERATE_MEDIA"], + minMessageTurns: 2, }, "deterministic-lifeops-scheduled-tasks": { actionNames: ["SCHEDULED_TASKS"], diff --git a/packages/scenario-runner/src/scenario-pr-workflow.test.ts b/packages/scenario-runner/src/scenario-pr-workflow.test.ts index eadb66066dcca..08ef5134f0263 100644 --- a/packages/scenario-runner/src/scenario-pr-workflow.test.ts +++ b/packages/scenario-runner/src/scenario-pr-workflow.test.ts @@ -124,9 +124,9 @@ const deterministicAgentSkillsActionsScenarioPath = resolve( import.meta.dirname, "../test/scenarios/deterministic-agent-skills-actions.scenario.ts", ); -const deterministicMediaEmoteActionsScenarioPath = resolve( +const deterministicMediaActionsScenarioPath = resolve( import.meta.dirname, - "../test/scenarios/deterministic-media-emote-actions.scenario.ts", + "../test/scenarios/deterministic-media-actions.scenario.ts", ); const deterministicScenarioReadmePath = resolve( import.meta.dirname, @@ -200,8 +200,8 @@ describe("scenario PR workflow contract", () => { deterministicAgentSkillsActionsScenarioPath, "utf8", ); - const deterministicMediaEmoteActionsScenario = readFileSync( - deterministicMediaEmoteActionsScenarioPath, + const deterministicMediaActionsScenario = readFileSync( + deterministicMediaActionsScenarioPath, "utf8", ); const deterministicScenarioReadme = readFileSync( @@ -527,13 +527,12 @@ describe("scenario PR workflow contract", () => { expect(deterministicAgentSkillsActionsScenario).toContain( "SKILL_UNINSTALL", ); - expect(deterministicMediaEmoteActionsScenario).toContain( - "Deterministic media generation and companion emote actions", + expect(deterministicMediaActionsScenario).toContain( + "Deterministic media generation actions", ); - expect(deterministicMediaEmoteActionsScenario).toContain( + expect(deterministicMediaActionsScenario).toContain( "GENERATE_MEDIA_AUDIO", ); - expect(deterministicMediaEmoteActionsScenario).toContain("PLAY_EMOTE"); expect(deterministicScenarioReadme).toContain( "strict Stage 1 and planner fixtures", ); diff --git a/packages/scenario-runner/test/scenarios/README.md b/packages/scenario-runner/test/scenarios/README.md index 1b1556d3df3ab..62a8898580065 100644 --- a/packages/scenario-runner/test/scenarios/README.md +++ b/packages/scenario-runner/test/scenarios/README.md @@ -61,9 +61,8 @@ catalog with `SCENARIO_USE_LLM_PROXY=1` and promoted virtual actions: search, details, install, toggle, sync, uninstall, and `USE_SKILL`, with a mocked ClawHub registry/download endpoint and real skill storage side effects. -- `deterministic-media-emote-actions` covers `GENERATE_MEDIA` image/audio - dispatch through deterministic runtime model handlers and `PLAY_EMOTE` - through the real companion emote action with a mocked `/api/emote` endpoint. +- `deterministic-media-actions` covers `GENERATE_MEDIA` image/audio + dispatch through deterministic runtime model handlers. The direct action scenarios assert handler parameters, `ActionResult` fields, and exact loopback request/response ledgers. The natural-language scenario @@ -93,9 +92,9 @@ requires a real provider key for live natural-language planner runs. - The scenario runtime currently removes `UPDATE_ENTITY` from `runtime.actions`, so entity-update realism is intentionally lower than a production runtime until action-selection ambiguity is resolved. -- `GENERATE_MEDIA` and `PLAY_EMOTE` are covered at the action-contract layer - with deterministic model/API doubles; they still do not render real model - output or animate an actual companion scene in the zero-key PR catalog. +- `GENERATE_MEDIA` is covered at the action-contract layer with deterministic + model doubles; it still does not render real model output in the zero-key PR + catalog. - MCP resource reads and tool calls are keyless-covered with a real stdio MCP fixture; the tool-call path uses strict LLM JSON fixtures for selection and argument generation, then executes the real stdio tool. diff --git a/packages/scenario-runner/test/scenarios/deterministic-inbound-attachment-actions.scenario.ts b/packages/scenario-runner/test/scenarios/deterministic-inbound-attachment-actions.scenario.ts index 87f601bc0ca23..a2b4b86e22f4f 100644 --- a/packages/scenario-runner/test/scenarios/deterministic-inbound-attachment-actions.scenario.ts +++ b/packages/scenario-runner/test/scenarios/deterministic-inbound-attachment-actions.scenario.ts @@ -7,7 +7,7 @@ import { matchesScenarioInput } from "./_helpers/strict-llm-action-fixtures"; // carries a `Media` attachment must flow end-to-end through a real AgentRuntime // under the mock (deterministic) LLM and produce a reply — i.e. an inbound // attachment never breaks the message pipeline. (Media GENERATION is covered by -// deterministic-media-emote-actions.scenario.ts; the agent-facing read tool is +// deterministic-media-actions.scenario.ts; the agent-facing read tool is // the core `ATTACHMENT` action, unit-tested in core.) The attachment is // surfaced into the agent's context with its stored-content hint, and the agent // replies. Runs keyless + strict under the deterministic LLM proxy. diff --git a/packages/scenario-runner/test/scenarios/deterministic-media-emote-actions.scenario.ts b/packages/scenario-runner/test/scenarios/deterministic-media-actions.scenario.ts similarity index 74% rename from packages/scenario-runner/test/scenarios/deterministic-media-emote-actions.scenario.ts rename to packages/scenario-runner/test/scenarios/deterministic-media-actions.scenario.ts index 3bb8e67a0153e..0253ca53324de 100644 --- a/packages/scenario-runner/test/scenarios/deterministic-media-emote-actions.scenario.ts +++ b/packages/scenario-runner/test/scenarios/deterministic-media-actions.scenario.ts @@ -5,7 +5,6 @@ import type { ScenarioTurnExecution, } from "@elizaos/scenario-runner/schema"; import { scenario } from "@elizaos/scenario-runner/schema"; -import { emoteAction } from "../../../../plugins/plugin-companion/src/actions/emote.ts"; import { generateMediaAction } from "../../../../plugins/plugin-local-inference/src/actions/generate-media.ts"; import { type RuntimeWithScenarioLlmFixtures, @@ -21,9 +20,7 @@ const wavBytes = new Uint8Array([ 0x61, 0x00, 0x00, 0x00, 0x00, ]); -let restoreFetch: (() => void) | null = null; const modelCalls: Array<{ modelType: string; payload: unknown }> = []; -const emoteRequests: Array<{ url: string; body: unknown }> = []; const imageGenerateMediaParameters = { mediaType: "image", @@ -33,9 +30,8 @@ const audioGenerateMediaParameters = { mediaType: "audio", prompt: "scenario audio", }; -const playEmoteParameters = { emote: "wave" }; -const strictMediaEmoteRoutes = [ +const strictMediaRoutes = [ { actionName: "GENERATE_MEDIA", args: imageGenerateMediaParameters, @@ -50,13 +46,6 @@ const strictMediaEmoteRoutes = [ input: "Say scenario audio", messageToUser: "Here's the audio you asked for.", }, - { - actionName: "PLAY_EMOTE", - args: playEmoteParameters, - contextIds: ["general"], - input: "Run the companion avatar wave emote action", - messageToUser: "Playing wave emote.", - }, ]; type JsonRecord = Record; @@ -167,41 +156,12 @@ function expectAction( ); } -function installEmoteFetchMock(): void { - const originalFetch = globalThis.fetch.bind(globalThis); - globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => { - const href = - typeof input === "string" - ? input - : input instanceof URL - ? input.href - : input.url; - const url = new URL(href); - if (url.hostname === "localhost" && url.pathname === "/api/emote") { - let body: unknown; - if (typeof init?.body === "string") { - body = JSON.parse(init.body) as unknown; - } - emoteRequests.push({ url: url.href, body }); - return new Response(JSON.stringify({ ok: true }), { - status: 200, - headers: { "content-type": "application/json" }, - }); - } - return originalFetch(input, init); - }) as typeof fetch; - restoreFetch = () => { - globalThis.fetch = originalFetch; - restoreFetch = null; - }; -} - const deterministicMediaPlugin: Plugin = { name: "scenario-deterministic-media-actions", description: - "Scenario-only media/emote action registration with deterministic model backends.", + "Scenario-only media action registration with deterministic model backends.", priority: 1_000, - actions: [generateMediaAction, emoteAction], + actions: [generateMediaAction], models: { [ModelType.IMAGE]: async (_runtime, payload) => { modelCalls.push({ modelType: ModelType.IMAGE, payload }); @@ -217,13 +177,11 @@ const deterministicMediaPlugin: Plugin = { async function finalLedgerCheck( ctx: ScenarioContext, ): Promise { - restoreFetch?.(); - const names = (ctx.actionsCalled ?? []).map((call) => call.actionName); const orderFailure = expectEqual( names, - ["GENERATE_MEDIA", "GENERATE_MEDIA", "PLAY_EMOTE"], - "media/emote action order", + ["GENERATE_MEDIA", "GENERATE_MEDIA"], + "media action order", ); if (orderFailure) return orderFailure; @@ -231,7 +189,7 @@ async function finalLedgerCheck( (call) => call.result?.success !== true, ); if (failed.length > 0) { - return `expected every media/emote action to succeed, saw ${stableStringify(failed)}`; + return `expected every media action to succeed, saw ${stableStringify(failed)}`; } const modelFailure = expectEqual( @@ -249,21 +207,15 @@ async function finalLedgerCheck( if (readPath(audioPayload, "text") !== "scenario audio") { return `expected TTS text to be stripped to scenario audio, saw ${stableStringify(audioPayload)}`; } - const emoteFailure = expectEqual( - emoteRequests, - [{ url: "http://localhost:2138/api/emote", body: { emoteId: "wave" } }], - "emote requests", - ); - if (emoteFailure) return emoteFailure; return undefined; } export default scenario({ - id: "deterministic-media-emote-actions", + id: "deterministic-media-actions", lane: "pr-deterministic", - title: "Deterministic media generation and companion emote actions", + title: "Deterministic media generation actions", domain: "scenario-runner", - tags: ["pr", "deterministic", "zero-cost", "media", "companion"], + tags: ["pr", "deterministic", "zero-cost", "media"], isolation: "shared-runtime", requires: { plugins: ["scenario-deterministic-media-actions"], @@ -271,11 +223,9 @@ export default scenario({ seed: [ { type: "custom", - name: "register deterministic media model handlers and emote endpoint", + name: "register deterministic media model handlers", apply: async (ctx) => { modelCalls.length = 0; - emoteRequests.length = 0; - installEmoteFetchMock(); const runtime = ctx.runtime as | (RuntimeWithScenarioLlmFixtures & { @@ -293,10 +243,9 @@ export default scenario({ ) ) { runtime.unregisterAction?.("GENERATE_MEDIA"); - runtime.unregisterAction?.("PLAY_EMOTE"); await runtime.registerPlugin(deterministicMediaPlugin); } - registerStrictActionRouteFixtures(runtime, strictMediaEmoteRoutes); + registerStrictActionRouteFixtures(runtime, strictMediaRoutes); return undefined; }, }, @@ -305,7 +254,7 @@ export default scenario({ { id: "main", source: "client_chat", - title: "Deterministic Media And Emotes", + title: "Deterministic Media", }, ], turns: [ @@ -355,19 +304,6 @@ export default scenario({ }, }), }, - { - kind: "message", - name: "post deterministic companion emote request", - text: "Run the companion avatar wave emote action", - assertTurn: (execution) => - expectAction(execution, { - actionName: "PLAY_EMOTE", - parameters: playEmoteParameters, - resultFields: { - "data.emoteId": "wave", - }, - }), - }, ], finalChecks: [ { @@ -376,20 +312,14 @@ export default scenario({ status: "success", minCount: 2, }, - { - type: "actionCalled", - actionName: "PLAY_EMOTE", - status: "success", - minCount: 1, - }, { type: "selectedActionArguments", - actionName: ["GENERATE_MEDIA", "PLAY_EMOTE"], - includesAll: [/wave/], + actionName: ["GENERATE_MEDIA"], + includesAll: [/scenario sunset/], }, { type: "custom", - name: "media model handlers and companion emote endpoint were called exactly", + name: "media model handlers were called exactly", predicate: finalLedgerCheck, }, ], diff --git a/packages/scripts/audit-build-typecheck.mjs b/packages/scripts/audit-build-typecheck.mjs index 78d0ecf1bf2c7..e8a5f5633ce9c 100644 --- a/packages/scripts/audit-build-typecheck.mjs +++ b/packages/scripts/audit-build-typecheck.mjs @@ -37,7 +37,6 @@ const ALLOW = { // kept on `tsc` until those are resolved. tscTypecheck: new Set([ "@elizaos/plugin-social-alpha", - "@elizaos/plugin-companion", "@elizaos/plugin-personal-assistant", ]), }; diff --git a/packages/scripts/dev-all.mjs b/packages/scripts/dev-all.mjs index 090da7392c8f1..5dc4050d5eba2 100644 --- a/packages/scripts/dev-all.mjs +++ b/packages/scripts/dev-all.mjs @@ -132,7 +132,6 @@ const agentEnv = { ), ELIZA_SKIP_PLUGINS: [ process.env.ELIZA_SKIP_PLUGINS, - "@elizaos/plugin-companion", "@elizaos/plugin-personal-assistant", "@elizaos/plugin-wallet", ] diff --git a/packages/scripts/e2e-coverage/keyless-e2e-baseline.json b/packages/scripts/e2e-coverage/keyless-e2e-baseline.json index 3c4db27a13403..9ac1fd8f737b4 100644 --- a/packages/scripts/e2e-coverage/keyless-e2e-baseline.json +++ b/packages/scripts/e2e-coverage/keyless-e2e-baseline.json @@ -9,7 +9,6 @@ "plugin-calendar", "plugin-calendly", "plugin-commands", - "plugin-companion", "plugin-computeruse", "plugin-facewear", "plugin-feishu", diff --git a/packages/shared/src/config/__tests__/plugin-manifest.test.ts b/packages/shared/src/config/__tests__/plugin-manifest.test.ts index 4bd200bdda56c..76ae79721edea 100644 --- a/packages/shared/src/config/__tests__/plugin-manifest.test.ts +++ b/packages/shared/src/config/__tests__/plugin-manifest.test.ts @@ -76,8 +76,8 @@ describe("pluginShortId", () => { expect(pluginShortId("custom-plugin")).toBe("custom-plugin"); }); it("handles @scope/app- (does not match the /plugin- guard)", () => { - expect(pluginShortId("@elizaos/plugin-companion")).toBe( - "@elizaos/plugin-companion", + expect(pluginShortId("@elizaos/app-model-tester")).toBe( + "@elizaos/app-model-tester", ); }); }); diff --git a/packages/shared/src/config/plugin-manifest.ts b/packages/shared/src/config/plugin-manifest.ts index d49de5257adc5..0f6e338a595a6 100644 --- a/packages/shared/src/config/plugin-manifest.ts +++ b/packages/shared/src/config/plugin-manifest.ts @@ -124,9 +124,6 @@ export interface PluginManifestVerdict { * Mirrors the logic in plugin-auto-enable-engine.addToAllowlist. */ export function pluginShortId(packageName: string): string { - if (packageName === "@elizaos/plugin-companion") { - return packageName; - } return packageName.includes("/plugin-") ? packageName.slice(packageName.lastIndexOf("/plugin-") + "/plugin-".length) : packageName; diff --git a/packages/shared/src/contracts/apps.test.ts b/packages/shared/src/contracts/apps.test.ts index 0b1e1f7315ed9..62dd8d9f1d3e6 100644 --- a/packages/shared/src/contracts/apps.test.ts +++ b/packages/shared/src/contracts/apps.test.ts @@ -32,9 +32,9 @@ const HEALTH_DETAILS = { const RUN_SUMMARY = { runId: "run-1", - appName: "companion", - displayName: "Companion", - pluginName: "@elizaos/plugin-companion", + appName: "feed", + displayName: "Feed", + pluginName: "@elizaos/plugin-feed", launchType: "viewer", launchUrl: "http://x", viewer: null, @@ -172,7 +172,7 @@ describe("AppSessionStateSchema", () => { it("accepts a minimal session", () => { const v = { sessionId: "s1", - appName: "companion", + appName: "feed", mode: "viewer" as const, status: "active", }; @@ -182,7 +182,7 @@ describe("AppSessionStateSchema", () => { it("accepts a populated session", () => { const v = { sessionId: "s1", - appName: "companion", + appName: "feed", mode: "spectate-and-steer" as const, status: "active", controls: ["pause", "resume"] as const, @@ -297,7 +297,7 @@ describe("AppLaunchResultSchema", () => { const v = { pluginInstalled: true, needsRestart: false, - displayName: "Companion", + displayName: "Feed", launchType: "viewer", launchUrl: null, viewer: null, @@ -311,7 +311,7 @@ describe("AppLaunchResultSchema", () => { const v = { pluginInstalled: true, needsRestart: false, - displayName: "Companion", + displayName: "Feed", launchType: "viewer", launchUrl: "http://x", viewer: { url: "http://x" }, @@ -327,7 +327,7 @@ describe("AppStopResultSchema", () => { it("accepts the canonical stop result", () => { const v = { success: true, - appName: "companion", + appName: "feed", runId: "run-1", stoppedAt: "2026-05-11T01:00:00Z", pluginUninstalled: false, @@ -371,7 +371,7 @@ describe("PostRelaunchAppResponseSchema", () => { const launch = { pluginInstalled: true, needsRestart: false, - displayName: "Companion", + displayName: "Feed", launchType: "viewer", launchUrl: null, viewer: null, diff --git a/packages/shared/src/contracts/misc-routes.test.ts b/packages/shared/src/contracts/misc-routes.test.ts index c1ea9fd4df65d..e3fbd28d4e296 100644 --- a/packages/shared/src/contracts/misc-routes.test.ts +++ b/packages/shared/src/contracts/misc-routes.test.ts @@ -4,7 +4,6 @@ import { PostCustomActionGenerateRequestSchema, PostCustomActionRequestSchema, PostCustomActionTestRequestSchema, - PostEmoteRequestSchema, PostIngestShareRequestSchema, PostTerminalRunRequestSchema, PutCustomActionRequestSchema, @@ -32,24 +31,6 @@ describe("PostIngestShareRequestSchema", () => { }); }); -describe("PostEmoteRequestSchema", () => { - it("accepts emoteId", () => { - expect(PostEmoteRequestSchema.parse({ emoteId: "wave" })).toEqual({ - emoteId: "wave", - }); - }); - - it("accepts empty body", () => { - expect(PostEmoteRequestSchema.parse({})).toEqual({}); - }); - - it("rejects extra fields", () => { - expect(() => - PostEmoteRequestSchema.parse({ emoteId: "x", looped: true }), - ).toThrow(); - }); -}); - describe("PostAgentEventRequestSchema", () => { it("trims stream and roomId, keeps data", () => { expect( diff --git a/packages/shared/src/contracts/misc-routes.ts b/packages/shared/src/contracts/misc-routes.ts index c8f7e30190b78..b4f53c9baa4e2 100644 --- a/packages/shared/src/contracts/misc-routes.ts +++ b/packages/shared/src/contracts/misc-routes.ts @@ -1,12 +1,11 @@ /** - * Zod schemas for miscellaneous HTTP routes — share intake, emote - * trigger, agent event ingest, terminal run, and custom-actions CRUD. + * Zod schemas for miscellaneous HTTP routes — share intake, agent event + * ingest, terminal run, and custom-actions CRUD. * * Routes covered (body-bearing only — /api/restart and the GET * variants don't read a body): * * POST /api/ingest/share { source?, title?, url?, text? } - * POST /api/emote { emoteId? } * POST /api/agent/event { stream, data?, roomId? } * POST /api/terminal/run { command, clientId?, terminalToken?, * captureOutput? } @@ -21,7 +20,7 @@ import z from "zod"; // --------------------------------------------------------------------------- -// share intake / emote / agent event +// share intake / agent event // --------------------------------------------------------------------------- /** @@ -38,12 +37,6 @@ export const PostIngestShareRequestSchema = z }) .strict(); -export const PostEmoteRequestSchema = z - .object({ - emoteId: z.string().optional(), - }) - .strict(); - export const PostAgentEventRequestSchema = z .object({ stream: z.string().regex(/\S/, "stream is required"), @@ -173,7 +166,6 @@ export const PutCustomActionRequestSchema = z export type PostIngestShareRequest = z.infer< typeof PostIngestShareRequestSchema >; -export type PostEmoteRequest = z.infer; export type PostAgentEventRequest = z.infer; export type PostTerminalRunRequest = z.infer< typeof PostTerminalRunRequestSchema diff --git a/packages/test/vitest/real.config.ts b/packages/test/vitest/real.config.ts index 76d5e1db172a5..aee43c406da98 100644 --- a/packages/test/vitest/real.config.ts +++ b/packages/test/vitest/real.config.ts @@ -244,7 +244,6 @@ const realResolveAlias: ModuleAlias[] = [ "plugin-wallet", ]), ...getWorkspacePluginAliases(repoRoot, [ - "plugin-companion", "plugin-documents", "plugin-personal-assistant", "plugin-scheduling", diff --git a/packages/ui/.storybook/README.md b/packages/ui/.storybook/README.md index 0d18b043cc208..dd2b154c98029 100644 --- a/packages/ui/.storybook/README.md +++ b/packages/ui/.storybook/README.md @@ -10,7 +10,7 @@ bun run --cwd packages/ui build-storybook # static build ## How it's wired -- `main.ts` — stories glob (`src/**/*.stories.tsx` + plugin-companion), addons +- `main.ts` — stories glob (`src/**/*.stories.tsx`), addons (docs/a11y/themes), and a `viteFinal` that mirrors `vitest.config.ts`: the `@tailwindcss/vite` plugin (the UI is Tailwind v4 — without it utilities never generate and components paint invisible), the `@elizaos/*` source diff --git a/packages/ui/.storybook/main.ts b/packages/ui/.storybook/main.ts index cff9b9c80ed35..312709c9881df 100644 --- a/packages/ui/.storybook/main.ts +++ b/packages/ui/.storybook/main.ts @@ -54,12 +54,9 @@ try { } const config: StorybookConfig = { - // Cover @elizaos/ui's own stories plus the plugin-companion CSF files, so the - // whole component library lives in one catalog. - stories: [ - "../src/**/*.stories.@(ts|tsx)", - "../../../plugins/plugin-companion/src/**/*.stories.@(ts|tsx)", - ], + // Cover @elizaos/ui's own stories so the whole component library lives in + // one catalog. + stories: ["../src/**/*.stories.@(ts|tsx)"], addons: [ "@storybook/addon-docs", "@storybook/addon-a11y", diff --git a/packages/ui/.storybook/preview.tsx b/packages/ui/.storybook/preview.tsx index 8020693baef28..c43e47cbf0eca 100644 --- a/packages/ui/.storybook/preview.tsx +++ b/packages/ui/.storybook/preview.tsx @@ -74,7 +74,6 @@ const preview: Preview = { "Views", "Composites", "*", - "Companion", // plugin stories (globbed in from plugins/plugin-companion) "Primitives", // 300+ base components — the parts bin, kept last ], }, diff --git a/packages/ui/AGENTS.md b/packages/ui/AGENTS.md index 555027710d051..f4fadfb8b2c15 100644 --- a/packages/ui/AGENTS.md +++ b/packages/ui/AGENTS.md @@ -10,7 +10,7 @@ A single design-system + runtime-glue package consumed by every elizaOS front-end and by plugin UIs. Importers include `@elizaos/app` (web + desktop shell), `@elizaos/app-core`, `@elizaos/cloud-frontend`, `@elizaos/os-homepage`, the `eliza-app` homepage, and many plugin UI packages (`plugin-wallet-ui`, -`plugin-companion`, `plugin-messages`, `plugin-training`, `plugin-feed`, etc.). +`plugin-messages`, `plugin-training`, `plugin-feed`, etc.). Plugins consume the agent-surface hooks, the registries (`app-shell-registry`, widgets, overlay-apps), and the component/primitive exports. React/react-dom are **peer** deps (19.2.5) — the host owns React; plugin view bundles externalise @@ -82,7 +82,6 @@ src/ state/useDisplayPreferences + state/persistence; the /background view and the BACKGROUND action (plugin-app-control) both drive the same store. - companion/ Companion bar (desktop) — CompanionBar, push-to-talk views/ View event bus + interact protocol (STANDARD_CAPABILITIES) hooks/ ~35 hooks (useMediaQuery, useActivityEvents, useRenderGuard, ...); many more use* hooks live alongside their features diff --git a/packages/ui/CLAUDE.md b/packages/ui/CLAUDE.md index 555027710d051..f4fadfb8b2c15 100644 --- a/packages/ui/CLAUDE.md +++ b/packages/ui/CLAUDE.md @@ -10,7 +10,7 @@ A single design-system + runtime-glue package consumed by every elizaOS front-end and by plugin UIs. Importers include `@elizaos/app` (web + desktop shell), `@elizaos/app-core`, `@elizaos/cloud-frontend`, `@elizaos/os-homepage`, the `eliza-app` homepage, and many plugin UI packages (`plugin-wallet-ui`, -`plugin-companion`, `plugin-messages`, `plugin-training`, `plugin-feed`, etc.). +`plugin-messages`, `plugin-training`, `plugin-feed`, etc.). Plugins consume the agent-surface hooks, the registries (`app-shell-registry`, widgets, overlay-apps), and the component/primitive exports. React/react-dom are **peer** deps (19.2.5) — the host owns React; plugin view bundles externalise @@ -82,7 +82,6 @@ src/ state/useDisplayPreferences + state/persistence; the /background view and the BACKGROUND action (plugin-app-control) both drive the same store. - companion/ Companion bar (desktop) — CompanionBar, push-to-talk views/ View event bus + interact protocol (STANDARD_CAPABILITIES) hooks/ ~35 hooks (useMediaQuery, useActivityEvents, useRenderGuard, ...); many more use* hooks live alongside their features diff --git a/packages/ui/docs/minimal-redesign/01-builtin-system-views.md b/packages/ui/docs/minimal-redesign/01-builtin-system-views.md index 30d3fde22dfc3..f0f147ebc2859 100644 --- a/packages/ui/docs/minimal-redesign/01-builtin-system-views.md +++ b/packages/ui/docs/minimal-redesign/01-builtin-system-views.md @@ -158,7 +158,7 @@ Metric note: `border=` counts below are raw `grep -c border` occurrences (includ The Settings shell (`pages/SettingsView.tsx`, 399 lines) is **well-architected and on-direction**: a nav rail (desktop) / grouped hub (mobile) built from the standardized `SettingsStack`/`SettingsGroup`/`SettingsRow` iOS-grouped-list primitives (`settings/settings-layout.tsx`). Sections are data-driven from `settings-section-meta.ts` (16 built-ins in 3 groups: Agent / System / Security) + a registry. `ShellViewAgentSurface viewId="settings"`, one agent element per nav row (`section-${id}`). **The shell is the reference for the redesign; the problem is the section *bodies* that ignore the primitives and hand-roll chrome.** Full settings directory file list (`packages/ui/src/components/settings/`): -`AdvancedSection.tsx`, `AdvancedToggle.tsx`, `ApiKeyConfig.tsx`, `AppearanceSettingsSection.tsx`, `AppPermissionsSection.tsx`, `AppsManagementSection.tsx`, `CapabilitiesSection.tsx`, `CloudAgentsSection.tsx`, `ConnectorsSection.tsx`, `DesktopWorkspaceDisplay.tsx`, `DesktopWorkspaceSection.tsx`, `IdentitySettingsSection.tsx`, `LoadContentPackForm.tsx`, `LoadedPacksList.tsx`, `permission-controls.tsx`, `PermissionsSection.tsx`, `PolicyControlsView.tsx`, `ProviderCard.tsx`, `ProviderPanels.tsx`, `ProviderRoutingPanel.tsx`, `ProviderSwitcher.tsx`, `RemotePluginHostSection.tsx`, `RuntimeSettingsSection.tsx`, `SecretsManagerSection.tsx`, `SecuritySettingsSection.tsx`, `settings-agent-rows.tsx`, `settings-control-primitives.tsx`, `settings-layout.tsx`, `settings-section-*.ts`, `SubscriptionStatus.tsx`, `VaultInventoryPanel.tsx`, `VoiceConfigView.tsx`, `VoiceProfileSection.tsx`, `VoiceSection*.tsx`, `VoiceTierBanner.tsx`, `WalletKeysSection.tsx`, `WalletRpcSection.tsx`, `XRSettingsSection.tsx`, plus `vault-tabs/` and `*.stories.tsx`/`*.test.tsx`/`*.hooks.ts` helpers. (Voice section is a separate review track.) +`AdvancedSection.tsx`, `AdvancedToggle.tsx`, `ApiKeyConfig.tsx`, `AppearanceSettingsSection.tsx`, `AppPermissionsSection.tsx`, `AppsManagementSection.tsx`, `CapabilitiesSection.tsx`, `CloudAgentsSection.tsx`, `ConnectorsSection.tsx`, `DesktopWorkspaceDisplay.tsx`, `DesktopWorkspaceSection.tsx`, `IdentitySettingsSection.tsx`, `LoadContentPackForm.tsx`, `LoadedPacksList.tsx`, `permission-controls.tsx`, `PermissionsSection.tsx`, `ProviderCard.tsx`, `ProviderPanels.tsx`, `ProviderRoutingPanel.tsx`, `ProviderSwitcher.tsx`, `RemotePluginHostSection.tsx`, `RuntimeSettingsSection.tsx`, `SecretsManagerSection.tsx`, `SecuritySettingsSection.tsx`, `settings-agent-rows.tsx`, `settings-control-primitives.tsx`, `settings-layout.tsx`, `settings-section-*.ts`, `SubscriptionStatus.tsx`, `VaultInventoryPanel.tsx`, `VoiceConfigView.tsx`, `VoiceProfileSection.tsx`, `VoiceSection*.tsx`, `VoiceTierBanner.tsx`, `WalletKeysSection.tsx`, `WalletRpcSection.tsx`, `XRSettingsSection.tsx`, plus `vault-tabs/` and `*.stories.tsx`/`*.test.tsx`/`*.hooks.ts` helpers. (Voice section is a separate review track.) Conformance verdict per assessed section (heaviest → cleanest), with verified inline `grep border` counts: diff --git a/packages/ui/src/App.navigate-view-wiring.test.tsx b/packages/ui/src/App.navigate-view-wiring.test.tsx index eecf326399f30..21f6517ebf54e 100644 --- a/packages/ui/src/App.navigate-view-wiring.test.tsx +++ b/packages/ui/src/App.navigate-view-wiring.test.tsx @@ -254,7 +254,7 @@ vi.mock("./state", () => { }); vi.mock("./config/boot-config-react.hooks", () => ({ - useBootConfig: () => ({ companionShell: null }), + useBootConfig: () => ({}), })); vi.mock("./components/shell/ShellControllerContext", () => ({ diff --git a/packages/ui/src/App.screen-background-fuzz.test.tsx b/packages/ui/src/App.screen-background-fuzz.test.tsx index 47f178c27753e..597b135b893a1 100644 --- a/packages/ui/src/App.screen-background-fuzz.test.tsx +++ b/packages/ui/src/App.screen-background-fuzz.test.tsx @@ -206,7 +206,7 @@ vi.mock("./state", () => { }; }); vi.mock("./config/boot-config-react.hooks", () => ({ - useBootConfig: () => ({ companionShell: null }), + useBootConfig: () => ({}), })); vi.mock("./components/shell/ShellControllerContext", () => ({ ShellControllerProvider: ({ children }: { children: React.ReactNode }) => ( @@ -319,7 +319,6 @@ const BUILTIN_TABS: { tab: BuiltinTab; path: string }[] = [ { tab: "tasks", path: "/tasks" }, { tab: "automations", path: "/automations" }, { tab: "browser", path: "/browser" }, - { tab: "companion", path: "/companion" }, { tab: "stream", path: "/stream" }, { tab: "apps", path: "/apps" }, { tab: "views", path: "/views" }, diff --git a/packages/ui/src/App.tsx b/packages/ui/src/App.tsx index 6e4f017dc25e4..c4e8fc0bdca64 100644 --- a/packages/ui/src/App.tsx +++ b/packages/ui/src/App.tsx @@ -73,7 +73,6 @@ import { KeepAliveViewHost } from "./components/views/KeepAliveViewHost"; import { ViewErrorBoundary } from "./components/views/ViewErrorBoundary"; import { AppWorkspaceChrome } from "./components/workspace/AppWorkspaceChrome"; import { useBootConfig } from "./config/boot-config-react.hooks"; -import type { CompanionShellComponentProps } from "./config/boot-config-store"; import { FOCUS_CONNECTOR_EVENT, type FocusConnectorEventDetail, @@ -1080,7 +1079,6 @@ function renderStaticViewRouterTab({ ), chat: , browser: , - companion: , stream: , tasks: ( @@ -1390,13 +1388,11 @@ function ShellBackButton({ onBack }: { onBack: () => void }): ReactNode { } type ShellContentProps = { - CompanionShell: ComponentType | undefined; actionNotice: ActionNotice | null; availableViewsForLayout: ViewRegistryEntry[]; customActionsPanelOpen: boolean; desktopTabBar: ReactNode; isChat: boolean; - isCompanionTab: boolean; isFullBleed: boolean; screenBackgroundPolicy: AppShellBackgroundPolicy; setCustomActionsEditorOpen: (open: boolean) => void; @@ -1410,19 +1406,6 @@ type ShellContentProps = { onNavigateBack: () => void; }; -function CompanionShellContent(props: ShellContentProps): ReactNode { - if ( - props.uiShellMode === "companion" && - props.isCompanionTab && - props.CompanionShell - ) { - const CompanionShell = props.CompanionShell; - return ; - } - if (!props.isCompanionTab) return null; - return
; -} - function ChatRouteShellContent(props: ShellContentProps): ReactNode { // The /chat route is the ambient conversational home: open space behind the // always-present ContinuousChatOverlay (mounted at the shell root), which is @@ -1522,8 +1505,6 @@ function FullBleedShellContent(props: ShellContentProps): ReactNode { function ShellContent(props: ShellContentProps): ReactNode { if (props.isFullBleed) return ; if (props.isChat) return ; - const companionContent = CompanionShellContent(props); - if (companionContent) return companionContent; return ; } @@ -1675,8 +1656,6 @@ export function App() { uiShellMode: s.uiShellMode, t: s.t, })); - const { companionShell: CompanionShell } = useBootConfig(); - const isPopout = useIsPopout(); const shellMode = useShellMode(); // Auth gate — only active after the coordinator reaches "ready". @@ -1823,7 +1802,6 @@ export function App() { >(null); const [desktopShuttingDown, setDesktopShuttingDown] = useState(false); - const isCompanionTab = tab === "companion"; const isChat = tab === "chat"; const isSettingsPage = tab === "settings"; const isFullBleed = useTabIsFullBleed(tab); @@ -2065,17 +2043,15 @@ export function App() { // shellContent is memoized before early returns to satisfy the Rules of Hooks. // Deps are local state/callbacks — not high-frequency AppContext fields like - // ptySessions/agentStatus — so CompanionSceneHost stays stable across polls. + // ptySessions/agentStatus — so the shell subtree stays stable across polls. const shellContent = useMemo( () => ( ), [ - CompanionShell, tab, uiShellMode, - isCompanionTab, actionNotice, isChat, isFullBleed, diff --git a/packages/ui/src/api/client-agent.ts b/packages/ui/src/api/client-agent.ts index 3747a2a2303f1..7b4159364cc34 100644 --- a/packages/ui/src/api/client-agent.ts +++ b/packages/ui/src/api/client-agent.ts @@ -486,7 +486,6 @@ declare module "./client-base" { setTradeMode( mode: string, ): Promise<{ ok: boolean; tradePermissionMode: string }>; - playEmote(emoteId: string): Promise<{ ok: boolean }>; runTerminalCommand(command: string): Promise<{ ok: boolean }>; getFirstRunStatus(): Promise<{ complete: boolean; @@ -1355,13 +1354,6 @@ ElizaClient.prototype.setTradeMode = async function (this: ElizaClient, mode) { }); }; -ElizaClient.prototype.playEmote = async function (this: ElizaClient, emoteId) { - return this.fetch("/api/emote", { - method: "POST", - body: JSON.stringify({ emoteId }), - }); -}; - ElizaClient.prototype.runTerminalCommand = async function ( this: ElizaClient, command, diff --git a/packages/ui/src/browser.ts b/packages/ui/src/browser.ts index 126025cd3a737..9fa047923e942 100644 --- a/packages/ui/src/browser.ts +++ b/packages/ui/src/browser.ts @@ -134,10 +134,6 @@ export * from "./components/workspace/AppWorkspaceChrome.tsx"; // === Phase 5C: ./config/app-config moved to @elizaos/app-core/config/app-config === export * from "./config/boot-config.ts"; export * from "./config/boot-config-react.hooks.ts"; -export type { - CompanionInferenceNotice, - CompanionSceneStatus, -} from "./config/boot-config-store.ts"; export * from "./config/branding.ts"; export * from "./config/cloud-only.ts"; export * from "./config/config-catalog.ts"; @@ -179,7 +175,6 @@ export * from "./navigation/index.ts"; export * from "./platform/index.ts"; export * from "./slots/task-coordinator-slots.helpers.ts"; export * from "./slots/task-coordinator-slots.tsx"; -export * from "./state/CompanionSceneConfigContext.hooks.ts"; export * from "./state/index.ts"; export * from "./themes/index.ts"; export * from "./types/index.ts"; diff --git a/packages/ui/src/chat/index.ts b/packages/ui/src/chat/index.ts index e845a376cf683..5cfc1c024149a 100644 --- a/packages/ui/src/chat/index.ts +++ b/packages/ui/src/chat/index.ts @@ -148,7 +148,6 @@ export const NAV_COMMANDS: readonly { id: string; label: string; tab: Tab }[] = tab: "relationships", }, { id: "nav-browser", label: "Open Browser", tab: "browser" }, - { id: "nav-companion", label: "Open Companion", tab: "companion" }, { id: "nav-skills", label: "Open Skills", tab: "skills" }, { id: "nav-transcripts", label: "Open Transcripts", tab: "transcripts" }, { id: "nav-memories", label: "Open Memories", tab: "memories" }, diff --git a/packages/ui/src/components/accounts/AccountCard.stories.tsx b/packages/ui/src/components/accounts/AccountCard.stories.tsx index 6828f2d1c3ee1..7cdcc7589cf1d 100644 --- a/packages/ui/src/components/accounts/AccountCard.stories.tsx +++ b/packages/ui/src/components/accounts/AccountCard.stories.tsx @@ -11,7 +11,6 @@ const mockAppContext = new Proxy({} as AppContextValue, { opts?.defaultValue ?? ""; } if (prop === "uiLanguage") return "en"; - if (prop === "companionHalfFramerateMode") return "when_saving_power"; if (prop === "navigation") { return { scheduleAfterTabCommit: (fn: () => void) => { diff --git a/packages/ui/src/components/accounts/AddAccountDialog.stories.tsx b/packages/ui/src/components/accounts/AddAccountDialog.stories.tsx index 804d6db702946..d2f5ae9847310 100644 --- a/packages/ui/src/components/accounts/AddAccountDialog.stories.tsx +++ b/packages/ui/src/components/accounts/AddAccountDialog.stories.tsx @@ -10,7 +10,6 @@ const mockAppContext = new Proxy({} as AppContextValue, { opts?.defaultValue ?? ""; } if (prop === "uiLanguage") return "en"; - if (prop === "companionHalfFramerateMode") return "when_saving_power"; if (prop === "navigation") { return { scheduleAfterTabCommit: (fn: () => void) => { diff --git a/packages/ui/src/components/accounts/RotationStrategyPicker.stories.tsx b/packages/ui/src/components/accounts/RotationStrategyPicker.stories.tsx index 6bb92c60af865..7c551abb811f5 100644 --- a/packages/ui/src/components/accounts/RotationStrategyPicker.stories.tsx +++ b/packages/ui/src/components/accounts/RotationStrategyPicker.stories.tsx @@ -10,7 +10,6 @@ const mockAppContext = new Proxy({} as AppContextValue, { opts?.defaultValue ?? ""; } if (prop === "uiLanguage") return "en"; - if (prop === "companionHalfFramerateMode") return "when_saving_power"; if (prop === "navigation") { return { scheduleAfterTabCommit: (fn: () => void) => { diff --git a/packages/ui/src/components/apps/AppsSidebar.stories.tsx b/packages/ui/src/components/apps/AppsSidebar.stories.tsx index f8f15fb7c2851..178a669f2b6c6 100644 --- a/packages/ui/src/components/apps/AppsSidebar.stories.tsx +++ b/packages/ui/src/components/apps/AppsSidebar.stories.tsx @@ -44,11 +44,6 @@ const apps: RegistryAppInfo[] = [ displayName: "Personal Assistant", category: "utility", }), - makeApp({ - name: "@elizaos/plugin-companion", - displayName: "Companion", - category: "game", - }), makeApp({ name: "@elizaos/plugin-hyperliquid", displayName: "Hyperliquid", @@ -157,6 +152,6 @@ export const Empty: Story = { export const SelectedItem: Story = { args: { - selectedAppName: "@elizaos/plugin-companion", + selectedAppName: "@elizaos/plugin-feed", }, }; diff --git a/packages/ui/src/components/apps/catalog-loader.test.ts b/packages/ui/src/components/apps/catalog-loader.test.ts index dee316f1c2323..1fca8918f9ebb 100644 --- a/packages/ui/src/components/apps/catalog-loader.test.ts +++ b/packages/ui/src/components/apps/catalog-loader.test.ts @@ -126,7 +126,7 @@ describe("loadMergedCatalogApps AOSP filter", () => { makeServerApp("@elizaos/plugin-phone"), makeServerApp("@elizaos/plugin-contacts"), makeServerApp("@elizaos/plugin-wifi"), - makeServerApp("@elizaos/plugin-companion"), + makeServerApp("@elizaos/plugin-feed"), ]); capacitorState.platform = "android"; navigatorMock.userAgent = STOCK_ANDROID_UA; @@ -154,7 +154,7 @@ describe("loadMergedCatalogApps AOSP filter", () => { const apps = await loadMergedCatalogApps({ includeHiddenApps: true }); const names = apps.map((a) => a.name); expect(pickAndroidOnly(names)).toEqual([]); - expect(names).toContain("@elizaos/plugin-companion"); + expect(names).toContain("@elizaos/plugin-feed"); }); it("shows androidOnly apps once on AOSP Eliza-derived Android, deduped across overlay+installed", async () => { @@ -173,6 +173,6 @@ describe("loadMergedCatalogApps AOSP filter", () => { const apps = await loadMergedCatalogApps({ includeHiddenApps: true }); const names = apps.map((a) => a.name); expect(pickAndroidOnly(names)).toEqual([]); - expect(names).toContain("@elizaos/plugin-companion"); + expect(names).toContain("@elizaos/plugin-feed"); }); }); diff --git a/packages/ui/src/components/apps/helpers.ts b/packages/ui/src/components/apps/helpers.ts index 3226944d9164b..a7b81b8506ba5 100644 --- a/packages/ui/src/components/apps/helpers.ts +++ b/packages/ui/src/components/apps/helpers.ts @@ -60,12 +60,9 @@ const APPS_VIEW_HIDDEN_APP_NAME_SET = new Set( const FEATURED_APP_NAMES = new Set([ "@elizaos/plugin-personal-assistant", - "@elizaos/plugin-companion", ]); -const DEFAULT_VISIBLE_GAME_APP_NAMES = new Set([ - "@elizaos/plugin-companion", -]); +const DEFAULT_VISIBLE_GAME_APP_NAMES = new Set([]); const DEFAULT_HIDDEN_APP_NAMES = new Set([ "@elizaos/plugin-hyperliquid", @@ -336,8 +333,6 @@ export function getAppCatalogSectionKey( const canonicalName = normalizeElizaCuratedAppName(app.name) ?? app.name; switch (canonicalName) { - case "@elizaos/plugin-companion": - return "games"; case "@elizaos/plugin-shopify": case "@elizaos/plugin-hyperliquid": case "@elizaos/plugin-polymarket": diff --git a/packages/ui/src/components/apps/overlay-app-api.ts b/packages/ui/src/components/apps/overlay-app-api.ts index 845774856c56d..0596ffb7bd8f6 100644 --- a/packages/ui/src/components/apps/overlay-app-api.ts +++ b/packages/ui/src/components/apps/overlay-app-api.ts @@ -26,7 +26,7 @@ export interface OverlayAppContext { * lifecycle — load assets on mount, dispose on unmount. */ export interface OverlayApp { - /** Unique app identifier (npm-style, e.g. "@elizaos/plugin-companion"). */ + /** Unique app identifier (npm-style, e.g. "@elizaos/plugin-feed"). */ readonly name: string; /** Display name shown in the apps catalog. */ readonly displayName: string; diff --git a/packages/ui/src/components/apps/overlay-app-registry.test.ts b/packages/ui/src/components/apps/overlay-app-registry.test.ts index 81fd1b963b6d6..894860128b8a5 100644 --- a/packages/ui/src/components/apps/overlay-app-registry.test.ts +++ b/packages/ui/src/components/apps/overlay-app-registry.test.ts @@ -37,7 +37,7 @@ describe("overlay-app-registry AOSP gating", () => { registerOverlayApp(makeOverlayApp("@elizaos/plugin-phone", true)); registerOverlayApp(makeOverlayApp("@elizaos/plugin-contacts", true)); registerOverlayApp(makeOverlayApp("@elizaos/plugin-wifi", true)); - registerOverlayApp(makeOverlayApp("@elizaos/plugin-companion", false)); + registerOverlayApp(makeOverlayApp("@elizaos/plugin-feed", false)); }); afterEach(() => { @@ -51,7 +51,7 @@ describe("overlay-app-registry AOSP gating", () => { platform: "android", userAgent: STOCK_ANDROID_UA, }); - expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-companion"]); + expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-feed"]); }); it("hides androidOnly apps on iOS even if a phantom AOSP marker leaks in", () => { @@ -59,7 +59,7 @@ describe("overlay-app-registry AOSP gating", () => { platform: "ios", userAgent: ELIZAOS_AOSP_UA, }); - expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-companion"]); + expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-feed"]); }); it("hides androidOnly apps on desktop Linux", () => { @@ -67,7 +67,7 @@ describe("overlay-app-registry AOSP gating", () => { platform: "web", userAgent: DESKTOP_LINUX_UA, }); - expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-companion"]); + expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-feed"]); }); it("shows androidOnly apps on AOSP elizaOS Android", () => { @@ -76,7 +76,7 @@ describe("overlay-app-registry AOSP gating", () => { userAgent: ELIZAOS_AOSP_UA, }); expect(apps.map((a) => a.name).sort()).toEqual([ - "@elizaos/plugin-companion", + "@elizaos/plugin-feed", "@elizaos/plugin-contacts", "@elizaos/plugin-phone", "@elizaos/plugin-wifi", @@ -89,7 +89,7 @@ describe("overlay-app-registry AOSP gating", () => { userAgent: WHITE_LABEL_AOSP_UA, }); expect(apps.map((a) => a.name).sort()).toEqual([ - "@elizaos/plugin-companion", + "@elizaos/plugin-feed", "@elizaos/plugin-contacts", "@elizaos/plugin-phone", "@elizaos/plugin-wifi", @@ -98,7 +98,7 @@ describe("overlay-app-registry AOSP gating", () => { it("legacy string-context API hides androidOnly apps without explicit AOSP flag", () => { const apps = getAvailableOverlayApps("android"); - expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-companion"]); + expect(apps.map((a) => a.name)).toEqual(["@elizaos/plugin-feed"]); }); it("isAospAndroid agrees with the gate semantics", () => { diff --git a/packages/ui/src/components/companion/injected.hooks.ts b/packages/ui/src/components/companion/injected.hooks.ts deleted file mode 100644 index 757358f0fd94e..0000000000000 --- a/packages/ui/src/components/companion/injected.hooks.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { - CompanionInferenceNotice, - CompanionSceneStatus, - ResolveCompanionInferenceNoticeArgs, -} from "../../config/boot-config"; -import { getBootConfig } from "../../config/boot-config"; - -export function resolveCompanionInferenceNotice( - args: ResolveCompanionInferenceNoticeArgs, -): CompanionInferenceNotice | null { - return getBootConfig().resolveCompanionInferenceNotice?.(args) ?? null; -} - -const DEFAULT_COMPANION_SCENE_STATUS: CompanionSceneStatus = { - avatarReady: false, - teleportKey: "", -}; - -export function useCompanionSceneStatus(): CompanionSceneStatus { - return ( - getBootConfig().useCompanionSceneStatus?.() ?? - DEFAULT_COMPANION_SCENE_STATUS - ); -} diff --git a/packages/ui/src/components/companion/injected.stories.tsx b/packages/ui/src/components/companion/injected.stories.tsx deleted file mode 100644 index 6ed0df18c3d8b..0000000000000 --- a/packages/ui/src/components/companion/injected.stories.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import type { CompanionInferenceNotice } from "../../config/boot-config"; -import { AppBootContext } from "../../config/boot-config-react.hooks"; -import { - type AppBootConfig, - DEFAULT_BOOT_CONFIG, -} from "../../config/boot-config-store"; -import { - CompanionGlobalOverlay, - CompanionInferenceAlertButton, -} from "./injected"; - -// Mock companion components that the host app would normally inject via boot -// config. Stories render these slot-injected wrappers so we can preview shapes -// without depending on the real host bundle. - -function MockAlertButton({ - notice, - onClick, -}: { - notice: CompanionInferenceNotice; - onClick: () => void; -}) { - const palette = - notice.kind === "cloud" && notice.variant === "danger" - ? "border-red-500 bg-red-500/10 text-red-300" - : "border-yellow-500 bg-yellow-500/10 text-yellow-300"; - return ( - - ); -} - -function MockGlobalOverlay() { - return ( -
-
- Mock global companion overlay -
-
- ); -} - -function withBootConfig(overrides: Partial) { - const value: AppBootConfig = { ...DEFAULT_BOOT_CONFIG, ...overrides }; - return function Decorator(Story: React.ComponentType) { - return ( - -
- -
-
- ); - }; -} - -const cloudDangerNotice: CompanionInferenceNotice = { - kind: "cloud", - variant: "danger", - tooltip: "Cloud credits exhausted — local inference will be used.", -}; - -const cloudWarnNotice: CompanionInferenceNotice = { - kind: "cloud", - variant: "warn", - tooltip: "Cloud credits low — top up to keep streaming.", -}; - -const settingsWarnNotice: CompanionInferenceNotice = { - kind: "settings", - variant: "warn", - tooltip: "No inference provider configured. Open settings to fix.", -}; - -// --------------------------------------------------------------------------- -// CompanionInferenceAlertButton -// --------------------------------------------------------------------------- - -const alertMeta = { - title: "Companion/CompanionInferenceAlertButton", - component: CompanionInferenceAlertButton, - tags: ["autodocs"], - argTypes: { - onClick: { action: "clicked" }, - }, - args: { - notice: cloudDangerNotice, - onClick: () => {}, - }, - decorators: [ - withBootConfig({ companionInferenceAlertButton: MockAlertButton }), - ], -} satisfies Meta; - -export default alertMeta; -type AlertStory = StoryObj; - -export const CloudDanger: AlertStory = { - args: { notice: cloudDangerNotice }, -}; - -export const CloudWarn: AlertStory = { - args: { notice: cloudWarnNotice }, -}; - -export const SettingsWarn: AlertStory = { - args: { notice: settingsWarnNotice }, -}; - -export const NoHostComponent: AlertStory = { - name: "No Host Component (renders null)", - args: { notice: cloudWarnNotice }, - decorators: [withBootConfig({ companionInferenceAlertButton: undefined })], -}; - -// --------------------------------------------------------------------------- -// CompanionGlobalOverlay -// --------------------------------------------------------------------------- - -export const GlobalOverlay: StoryObj = { - name: "CompanionGlobalOverlay / Rendered", - render: () => , - decorators: [withBootConfig({ companionGlobalOverlay: MockGlobalOverlay })], -}; - -export const GlobalOverlayMissing: StoryObj = { - name: "CompanionGlobalOverlay / No Host Component", - render: () => ( -
- CompanionGlobalOverlay renders nothing when the host has not injected one. -
- ), - decorators: [withBootConfig({ companionGlobalOverlay: undefined })], -}; diff --git a/packages/ui/src/components/companion/injected.tsx b/packages/ui/src/components/companion/injected.tsx deleted file mode 100644 index a9dd8826ce7cc..0000000000000 --- a/packages/ui/src/components/companion/injected.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import type { CompanionInferenceNotice } from "../../config/boot-config"; -import { useBootConfig } from "../../config/boot-config-react.hooks"; - -export function CompanionInferenceAlertButton({ - notice, - onClick, -}: { - notice: CompanionInferenceNotice; - onClick: () => void; -}) { - const { - companionInferenceAlertButton: CompanionInferenceAlertButtonComponent, - } = useBootConfig(); - return CompanionInferenceAlertButtonComponent ? ( - - ) : null; -} - -export function CompanionGlobalOverlay() { - const { companionGlobalOverlay: CompanionGlobalOverlayComponent } = - useBootConfig(); - return CompanionGlobalOverlayComponent ? ( - - ) : null; -} diff --git a/packages/ui/src/components/custom-actions/CustomActionEditor.stories.tsx b/packages/ui/src/components/custom-actions/CustomActionEditor.stories.tsx index 71a5cda664e06..acc22e3b42029 100644 --- a/packages/ui/src/components/custom-actions/CustomActionEditor.stories.tsx +++ b/packages/ui/src/components/custom-actions/CustomActionEditor.stories.tsx @@ -11,7 +11,6 @@ const mockAppContext = new Proxy({} as AppContextValue, { opts?.defaultValue ?? ""; } if (prop === "uiLanguage") return "en"; - if (prop === "companionHalfFramerateMode") return "when_saving_power"; if (prop === "navigation") { return { scheduleAfterTabCommit: (fn: () => void) => { diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts index 3a6e295d1b303..9901b6418b857 100644 --- a/packages/ui/src/components/index.ts +++ b/packages/ui/src/components/index.ts @@ -253,7 +253,6 @@ export * from "./ShellModalityProvider.tsx"; export * from "./ShellRoleProvider.tsx"; export * from "./settings/ApiKeyConfig"; export * from "./settings/PermissionsSection"; -export * from "./settings/PolicyControlsView"; export * from "./settings/ProviderSwitcher"; export * from "./settings/permission-types"; export * from "./settings/SubscriptionStatus"; diff --git a/packages/ui/src/components/pages/AppsView.mockapp.test.tsx b/packages/ui/src/components/pages/AppsView.mockapp.test.tsx index 2a107900ee2e1..500cef060a9d5 100644 --- a/packages/ui/src/components/pages/AppsView.mockapp.test.tsx +++ b/packages/ui/src/components/pages/AppsView.mockapp.test.tsx @@ -41,8 +41,8 @@ describe("AppsView under mockApp()", () => { it("builds the favorite-names Set from the favoriteApps override and renders the catalog (with-favorites shape)", () => { const { getByTestId } = renderUnderMockApp({ - favoriteApps: ["companion", "feed", "wallet"], - recentApps: ["feed", "companion"], + favoriteApps: ["feed", "wallet"], + recentApps: ["feed"], }); // A non-array `favoriteApps` would throw at `new Set(favoriteApps)`; the // grid only mounts once that Set is constructed from the real array. diff --git a/packages/ui/src/components/pages/AppsView.stories.tsx b/packages/ui/src/components/pages/AppsView.stories.tsx index 90a7c9a1f75d3..3fd02207ab9b7 100644 --- a/packages/ui/src/components/pages/AppsView.stories.tsx +++ b/packages/ui/src/components/pages/AppsView.stories.tsx @@ -33,8 +33,8 @@ export const WalletEnabled: Story = { export const WithFavoritesAndRecents: Story = { decorators: [ mockApp({ - favoriteApps: ["companion", "feed", "wallet"], - recentApps: ["feed", "companion"], + favoriteApps: ["feed", "wallet"], + recentApps: ["feed"], }), ], }; diff --git a/packages/ui/src/components/pages/chat-view-hooks.test.tsx b/packages/ui/src/components/pages/chat-view-hooks.test.tsx index 0c7f08c763fa5..5decdb7614d47 100644 --- a/packages/ui/src/components/pages/chat-view-hooks.test.tsx +++ b/packages/ui/src/components/pages/chat-view-hooks.test.tsx @@ -41,10 +41,6 @@ vi.mock("../../hooks/useVoiceChat", () => ({ useVoiceChat: vi.fn(), })); -vi.mock("../companion/injected", () => ({ - useCompanionSceneStatus: vi.fn(() => ({ avatarReady: true })), -})); - const useVoiceChatMock = vi.mocked(useVoiceChat); function makeVoiceState( diff --git a/packages/ui/src/components/pages/chat-view-hooks.tsx b/packages/ui/src/components/pages/chat-view-hooks.tsx index 5dbb9d7c4793a..7e89fb758e85a 100644 --- a/packages/ui/src/components/pages/chat-view-hooks.tsx +++ b/packages/ui/src/components/pages/chat-view-hooks.tsx @@ -33,7 +33,6 @@ import { type VoiceTranscriptEvent, } from "../../voice/voice-chat-types"; import { buildVoiceTurnSignal } from "../../voice/voice-turn-signal"; -import { useCompanionSceneStatus } from "../companion/injected.hooks"; /* ── Shared constants ──────────────────────────────────────────────── */ @@ -189,7 +188,6 @@ export function useChatVoiceController(options: { continuousMode?: VoiceContinuousMode; }) { const { setTimeout } = useTimeout(); - const { avatarReady: companionSceneAvatarReady } = useCompanionSceneStatus(); const { agentVoiceMuted, chatFirstTokenReceived, @@ -559,7 +557,6 @@ export function useChatVoiceController(options: { if (agentVoiceMuted || voice.isListening) { return; } - if (isGameModal && !companionSceneAvatarReady) return; if (voiceBootstrapTick === 0) return; // Skip the stale replay when the view just became active (mode switch). if (isGameModal && gameModalJustActivatedRef.current) { @@ -709,7 +706,6 @@ export function useChatVoiceController(options: { agentVoiceMuted, activeConversationId, chatSending, - companionSceneAvatarReady, conversationMessages, isGameModal, queueAssistantSpeech, diff --git a/packages/ui/src/components/policy-controls/ApprovedAddressesSection.helpers.ts b/packages/ui/src/components/policy-controls/ApprovedAddressesSection.helpers.ts deleted file mode 100644 index 625eaf273195b..0000000000000 --- a/packages/ui/src/components/policy-controls/ApprovedAddressesSection.helpers.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ApprovedAddressesConfig } from "./types"; - -export function addressSummary(config: ApprovedAddressesConfig): string { - const count = config.addresses?.length ?? 0; - const mode = config.mode === "whitelist" ? "allowed" : "blocked"; - return count === 0 ? `No addresses ${mode}` : `${count} ${mode}`; -} diff --git a/packages/ui/src/components/policy-controls/ApprovedAddressesSection.stories.tsx b/packages/ui/src/components/policy-controls/ApprovedAddressesSection.stories.tsx deleted file mode 100644 index d1282abfd3db2..0000000000000 --- a/packages/ui/src/components/policy-controls/ApprovedAddressesSection.stories.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { useState } from "react"; -import { TranslationProvider } from "../../state/TranslationProvider"; -import { ApprovedAddressesSection } from "./ApprovedAddressesSection"; -import type { ApprovedAddressesConfig } from "./types"; - -const meta = { - title: "PolicyControls/ApprovedAddressesSection", - component: ApprovedAddressesSection, - tags: ["autodocs"], - parameters: { layout: "padded" }, - decorators: [ - (Story) => ( - -
- -
-
- ), - ], -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -function Interactive({ initial }: { initial: ApprovedAddressesConfig }) { - const [config, setConfig] = useState(initial); - return ; -} - -export const EmptyAllowlist: Story = { - render: () => ( - - ), -}; - -export const Populated: Story = { - render: () => ( - - ), -}; - -export const Blocklist: Story = { - render: () => ( - - ), -}; diff --git a/packages/ui/src/components/policy-controls/ApprovedAddressesSection.tsx b/packages/ui/src/components/policy-controls/ApprovedAddressesSection.tsx deleted file mode 100644 index d4b2cc6d3785d..0000000000000 --- a/packages/ui/src/components/policy-controls/ApprovedAddressesSection.tsx +++ /dev/null @@ -1,217 +0,0 @@ -import { Plus, Trash2 } from "lucide-react"; -import { useCallback, useMemo, useState } from "react"; -import { useTranslation } from "../../state/TranslationContext.hooks"; -import { Button } from "../ui/button"; -import { Input } from "../ui/input"; -import { - approvedAddressValue, - chainTypeLabel, - isValidAddress, -} from "./helpers"; -import type { ApprovedAddressEntry, ApprovedAddressesConfig } from "./types"; - -export function ApprovedAddressesSection({ - config, - onChange, -}: { - config: ApprovedAddressesConfig; - onChange: (config: ApprovedAddressesConfig) => void; -}) { - const { t } = useTranslation(); - const [newAddress, setNewAddress] = useState(""); - const [newLabel, setNewLabel] = useState(""); - const [addressError, setAddressError] = useState(null); - - const entries: ApprovedAddressEntry[] = useMemo( - () => - (config.addresses ?? []).map((addr) => { - if (typeof addr !== "string") { - return { - address: addr.address, - label: addr.label, - }; - } - return { - address: addr, - label: config.labels?.[addr] ?? "", - }; - }), - [config], - ); - - const handleAdd = useCallback(() => { - const trimmed = newAddress.trim(); - if (!trimmed) return; - if (!isValidAddress(trimmed)) { - setAddressError( - t("approvedaddresses.invalidFormat", { - defaultValue: "Invalid address format (EVM 0x... or Solana base58)", - }), - ); - return; - } - if ( - config.addresses.some((entry) => approvedAddressValue(entry) === trimmed) - ) { - setAddressError( - t("approvedaddresses.alreadyInList", { - defaultValue: "Already in list", - }), - ); - return; - } - onChange({ - ...config, - addresses: [...config.addresses, trimmed], - labels: { - ...config.labels, - ...(newLabel.trim() ? { [trimmed]: newLabel.trim() } : {}), - }, - }); - setNewAddress(""); - setNewLabel(""); - setAddressError(null); - }, [newAddress, newLabel, config, onChange, t]); - - const handleRemove = useCallback( - (addr: string) => { - const labels = { ...config.labels }; - delete labels[addr]; - onChange({ - ...config, - addresses: config.addresses.filter( - (entry) => approvedAddressValue(entry) !== addr, - ), - labels, - }); - }, - [config, onChange], - ); - - return ( -
- {/* Mode toggle */} -
- - {config.mode === "whitelist" - ? t("approvedaddresses.allowlist", { defaultValue: "Allowlist" }) - : t("approvedaddresses.blocklist", { defaultValue: "Blocklist" })} - - -
- - {/* Address list */} - {entries.length > 0 ? ( -
- {entries.map((entry) => { - const chain = chainTypeLabel(entry.address); - return ( -
-
-
- - {entry.address} - - {chain && ( - - {chain} - - )} -
- {entry.label && ( -
{entry.label}
- )} -
- -
- ); - })} -
- ) : ( -
- {config.mode === "whitelist" - ? t("approvedaddresses.emptyAllowlist", { - defaultValue: "No addresses — agent can't send anywhere yet.", - }) - : t("approvedaddresses.emptyBlocklist", { - defaultValue: "No addresses blocked.", - })} -
- )} - - {/* Add new */} -
- { - setNewAddress(e.target.value); - setAddressError(null); - }} - className="flex-1 h-8 text-xs font-mono" - /> - setNewLabel(e.target.value)} - className="w-24 h-8 text-xs" - /> - -
- {addressError && ( -
{addressError}
- )} -
- ); -} diff --git a/packages/ui/src/components/policy-controls/AutoApproveSection.helpers.ts b/packages/ui/src/components/policy-controls/AutoApproveSection.helpers.ts deleted file mode 100644 index e92f2de401640..0000000000000 --- a/packages/ui/src/components/policy-controls/AutoApproveSection.helpers.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { AutoApproveConfig } from "./types"; - -export function autoApproveSummary(config: AutoApproveConfig): string { - return `Under $${config.threshold}`; -} diff --git a/packages/ui/src/components/policy-controls/AutoApproveSection.stories.tsx b/packages/ui/src/components/policy-controls/AutoApproveSection.stories.tsx deleted file mode 100644 index 05a41a331011e..0000000000000 --- a/packages/ui/src/components/policy-controls/AutoApproveSection.stories.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { useState } from "react"; -import { TranslationProvider } from "../../state/TranslationProvider"; -import { AutoApproveSection } from "./AutoApproveSection"; -import { DEFAULT_AUTO_APPROVE } from "./constants"; -import type { AutoApproveConfig } from "./types"; - -const meta = { - title: "PolicyControls/AutoApproveSection", - component: AutoApproveSection, - tags: ["autodocs"], - parameters: { layout: "padded" }, - decorators: [ - (Story) => ( - -
- -
-
- ), - ], -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -function Interactive({ initial }: { initial: AutoApproveConfig }) { - const [config, setConfig] = useState(initial); - return ; -} - -export const Default: Story = { - render: () => , -}; - -export const HigherThreshold: Story = { - render: () => , -}; - -export const ZeroThreshold: Story = { - render: () => , -}; diff --git a/packages/ui/src/components/policy-controls/AutoApproveSection.tsx b/packages/ui/src/components/policy-controls/AutoApproveSection.tsx deleted file mode 100644 index f8434078c2ea5..0000000000000 --- a/packages/ui/src/components/policy-controls/AutoApproveSection.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { ShieldCheck } from "lucide-react"; -import { useTranslation } from "../../state/TranslationContext.hooks"; -import { Input } from "../ui/input"; -import { Label } from "../ui/label"; -import { parseAmount } from "./helpers"; -import type { AutoApproveConfig } from "./types"; - -export function AutoApproveSection({ - config, - onChange, -}: { - config: AutoApproveConfig; - onChange: (config: AutoApproveConfig) => void; -}) { - const { t } = useTranslation(); - return ( -
-
- -
- - $ - - { - const v = e.target.value.slice(0, 32); - if (/^(?:\d+(?:\.\d*)?|\.\d*)?$/.test(v)) - onChange({ threshold: v }); - }} - className="h-8 text-sm pl-7 tabular-nums" - placeholder="5" - /> -
-
-
- -
- {t("autoapprove.summaryPrefix", { defaultValue: "Under" })}{" "} - - ${parseAmount(config.threshold)} - {" "} - {t("autoapprove.summarySuffix", { - defaultValue: "auto-approved across all chains", - })} -
-
-
- ); -} diff --git a/packages/ui/src/components/policy-controls/PolicyToggle.stories.tsx b/packages/ui/src/components/policy-controls/PolicyToggle.stories.tsx deleted file mode 100644 index 11110f0184a95..0000000000000 --- a/packages/ui/src/components/policy-controls/PolicyToggle.stories.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { ShieldCheck } from "lucide-react"; -import { useState } from "react"; -import { TranslationProvider } from "../../state/TranslationProvider"; -import { PolicyToggle } from "./PolicyToggle"; - -const meta = { - title: "PolicyControls/PolicyToggle", - component: PolicyToggle, - tags: ["autodocs"], - parameters: { layout: "padded" }, - args: { - icon: ShieldCheck, - title: "Spending Limit", - summary: "$50/tx · $500/day · $2000/wk", - enabled: true, - }, - decorators: [ - (Story) => ( - -
- -
-
- ), - ], -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const Enabled: Story = { - render: (args) => { - const [enabled, setEnabled] = useState(args.enabled); - return ( - -
- Expanded policy detail goes here. -
-
- ); - }, -}; - -export const Disabled: Story = { - render: (args) => { - const [enabled, setEnabled] = useState(false); - return ( - -
- Expanded policy detail goes here. -
-
- ); - }, -}; - -export const WithoutSummary: Story = { - args: { summary: undefined, title: "Approved Addresses" }, - render: (args) => { - const [enabled, setEnabled] = useState(args.enabled); - return ( - -
Address list editor goes here.
-
- ); - }, -}; diff --git a/packages/ui/src/components/policy-controls/PolicyToggle.tsx b/packages/ui/src/components/policy-controls/PolicyToggle.tsx deleted file mode 100644 index a5d04f157b6db..0000000000000 --- a/packages/ui/src/components/policy-controls/PolicyToggle.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import type React from "react"; -import { useState } from "react"; -import { useTranslation } from "../../state/TranslationContext.hooks"; -import { Switch } from "../ui/switch"; - -/** - * Collapsible policy card with toggle, summary in header, and expand-on-click. - */ -export function PolicyToggle({ - icon: Icon, - title, - summary, - enabled, - onToggle, - children, -}: { - icon: React.ComponentType<{ className?: string }>; - title: string; - summary?: string; - enabled: boolean; - onToggle: (enabled: boolean) => void; - children?: React.ReactNode; -}) { - const { t } = useTranslation(); - const [expanded, setExpanded] = useState(false); - - return ( -
- {/* Header — click to expand, toggle on right */} -
- - -
- - {/* Content — only when enabled + expanded */} - {enabled && expanded && children && ( -
{children}
- )} -
- ); -} diff --git a/packages/ui/src/components/policy-controls/RateLimitSection.helpers.ts b/packages/ui/src/components/policy-controls/RateLimitSection.helpers.ts deleted file mode 100644 index 20badd8a4c294..0000000000000 --- a/packages/ui/src/components/policy-controls/RateLimitSection.helpers.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RateLimitConfig } from "./types"; - -export function rateLimitSummary(config: RateLimitConfig): string { - return `${config.maxTxPerHour}/hr · ${config.maxTxPerDay}/day`; -} diff --git a/packages/ui/src/components/policy-controls/RateLimitSection.stories.tsx b/packages/ui/src/components/policy-controls/RateLimitSection.stories.tsx deleted file mode 100644 index 5ec31292cdf8a..0000000000000 --- a/packages/ui/src/components/policy-controls/RateLimitSection.stories.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { useState } from "react"; -import { TranslationProvider } from "../../state/TranslationProvider"; -import { DEFAULT_RATE_LIMIT } from "./constants"; -import { RateLimitSection } from "./RateLimitSection"; -import type { RateLimitConfig } from "./types"; - -const meta = { - title: "PolicyControls/RateLimitSection", - component: RateLimitSection, - tags: ["autodocs"], - parameters: { layout: "padded" }, - decorators: [ - (Story) => ( - -
- -
-
- ), - ], -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -function Interactive({ initial }: { initial: RateLimitConfig }) { - const [config, setConfig] = useState(initial); - return ; -} - -export const Default: Story = { - render: () => , -}; - -export const HighThroughput: Story = { - render: () => ( - - ), -}; - -export const Conservative: Story = { - render: () => , -}; diff --git a/packages/ui/src/components/policy-controls/RateLimitSection.tsx b/packages/ui/src/components/policy-controls/RateLimitSection.tsx deleted file mode 100644 index cd657e549f50e..0000000000000 --- a/packages/ui/src/components/policy-controls/RateLimitSection.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { useTranslation } from "../../state/TranslationContext.hooks"; -import { Label } from "../ui/label"; -import { Slider } from "../ui/slider"; -import type { RateLimitConfig } from "./types"; - -function LabeledSlider({ - label, - value, - min, - max, - step, - unit, - onChange, -}: { - label: string; - value: number; - min: number; - max: number; - step: number; - unit: string; - onChange: (value: number) => void; -}) { - return ( -
-
- - - {value} {unit} - -
- onChange(v)} - /> -
- ); -} - -export function RateLimitSection({ - config, - onChange, -}: { - config: RateLimitConfig; - onChange: (config: RateLimitConfig) => void; -}) { - const { t } = useTranslation(); - return ( -
- onChange({ ...config, maxTxPerHour: v })} - /> - onChange({ ...config, maxTxPerDay: v })} - /> -
- ); -} diff --git a/packages/ui/src/components/policy-controls/SpendingLimitSection.helpers.ts b/packages/ui/src/components/policy-controls/SpendingLimitSection.helpers.ts deleted file mode 100644 index bd5db5a7bb4df..0000000000000 --- a/packages/ui/src/components/policy-controls/SpendingLimitSection.helpers.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { SpendingLimitConfig } from "./types"; - -export function spendingSummary(config: SpendingLimitConfig): string { - return `$${config.maxPerTx}/tx · $${config.maxPerDay}/day · $${config.maxPerWeek}/wk`; -} diff --git a/packages/ui/src/components/policy-controls/SpendingLimitSection.stories.tsx b/packages/ui/src/components/policy-controls/SpendingLimitSection.stories.tsx deleted file mode 100644 index 0f7e9f7d1d27e..0000000000000 --- a/packages/ui/src/components/policy-controls/SpendingLimitSection.stories.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { useState } from "react"; -import { TranslationProvider } from "../../state/TranslationProvider"; -import { DEFAULT_SPENDING } from "./constants"; -import { SpendingLimitSection } from "./SpendingLimitSection"; -import type { SpendingLimitConfig } from "./types"; - -const meta = { - title: "PolicyControls/SpendingLimitSection", - component: SpendingLimitSection, - tags: ["autodocs"], - parameters: { layout: "padded" }, - decorators: [ - (Story) => ( - -
- -
-
- ), - ], -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -function Interactive({ initial }: { initial: SpendingLimitConfig }) { - const [config, setConfig] = useState(initial); - return ; -} - -export const Default: Story = { - render: () => , -}; - -export const Empty: Story = { - render: () => ( - - ), -}; - -export const HighLimits: Story = { - render: () => ( - - ), -}; diff --git a/packages/ui/src/components/policy-controls/SpendingLimitSection.tsx b/packages/ui/src/components/policy-controls/SpendingLimitSection.tsx deleted file mode 100644 index 3732c3aed7ba5..0000000000000 --- a/packages/ui/src/components/policy-controls/SpendingLimitSection.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { useTranslation } from "../../state/TranslationContext.hooks"; -import { Input } from "../ui/input"; -import { Label } from "../ui/label"; -import type { SpendingLimitConfig } from "./types"; - -function UsdInput({ - label, - value, - onChange, -}: { - label: string; - value: string; - onChange: (value: string) => void; -}) { - return ( -
- -
- - $ - - { - const v = e.target.value.slice(0, 32); - if (/^(?:\d+(?:\.\d*)?|\.\d*)?$/.test(v)) onChange(v); - }} - className="h-8 text-sm pl-7 tabular-nums" - placeholder="0" - /> -
-
- ); -} - -export function SpendingLimitSection({ - config, - onChange, -}: { - config: SpendingLimitConfig; - onChange: (config: SpendingLimitConfig) => void; -}) { - const { t } = useTranslation(); - return ( -
- onChange({ ...config, maxPerTx: v })} - /> - onChange({ ...config, maxPerDay: v })} - /> - onChange({ ...config, maxPerWeek: v })} - /> -
- ); -} diff --git a/packages/ui/src/components/policy-controls/TimeWindowSection.helpers.ts b/packages/ui/src/components/policy-controls/TimeWindowSection.helpers.ts deleted file mode 100644 index 8ada2dc3036e6..0000000000000 --- a/packages/ui/src/components/policy-controls/TimeWindowSection.helpers.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { formatHour } from "./helpers"; -import type { TimeWindowConfig } from "./types"; - -export function timeWindowSummary(config: TimeWindowConfig): string { - const hours = config.allowedHours[0]; - if (!hours) return "No hours set"; - const days = config.allowedDays.length; - const fmtStart = formatHour(hours.start); - const fmtEnd = formatHour(hours.end); - return `${fmtStart}–${fmtEnd} · ${days} days`; -} diff --git a/packages/ui/src/components/policy-controls/TimeWindowSection.stories.tsx b/packages/ui/src/components/policy-controls/TimeWindowSection.stories.tsx deleted file mode 100644 index 2b007d22c9fa0..0000000000000 --- a/packages/ui/src/components/policy-controls/TimeWindowSection.stories.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { useState } from "react"; -import { TranslationProvider } from "../../state/TranslationProvider"; -import { DEFAULT_TIME_WINDOW } from "./constants"; -import { TimeWindowSection } from "./TimeWindowSection"; -import type { TimeWindowConfig } from "./types"; - -const meta = { - title: "PolicyControls/TimeWindowSection", - component: TimeWindowSection, - tags: ["autodocs"], - parameters: { layout: "padded" }, - decorators: [ - (Story) => ( - -
- -
-
- ), - ], -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -function Interactive({ initial }: { initial: TimeWindowConfig }) { - const [config, setConfig] = useState(initial); - return ; -} - -export const BusinessHours: Story = { - render: () => , -}; - -export const AllWeek: Story = { - render: () => ( - - ), -}; - -export const WeekendsOnly: Story = { - render: () => ( - - ), -}; diff --git a/packages/ui/src/components/policy-controls/TimeWindowSection.tsx b/packages/ui/src/components/policy-controls/TimeWindowSection.tsx deleted file mode 100644 index 2f8fb34c0ee1f..0000000000000 --- a/packages/ui/src/components/policy-controls/TimeWindowSection.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import { useTranslation } from "../../state/TranslationContext.hooks"; -import { Button } from "../ui/button"; -import { Label } from "../ui/label"; -import { DAY_NAMES, TIMEZONES } from "./constants"; -import { formatHour } from "./helpers"; -import type { TimeWindowConfig } from "./types"; - -/** Static hour options — avoids array-index-as-key lint errors. */ -const HOUR_OPTIONS = Array.from({ length: 24 }, (_, i) => ({ - value: i, - label: formatHour(i), -})); - -export function TimeWindowSection({ - config, - onChange, -}: { - config: TimeWindowConfig; - onChange: (config: TimeWindowConfig) => void; -}) { - const { t } = useTranslation(); - const hours = config.allowedHours[0] ?? { start: 9, end: 17 }; - - return ( -
- {/* Hours — start/end */} -
-
- - -
- -
- - -
-
- - {/* Days — compact row */} -
- -
- {DAY_NAMES.map((name, i) => { - const active = config.allowedDays.includes(i); - return ( - - ); - })} -
-
- - {/* Timezone */} -
- - -
-
- ); -} diff --git a/packages/ui/src/components/policy-controls/__tests__/policycontrols-stories-smoke.test.tsx b/packages/ui/src/components/policy-controls/__tests__/policycontrols-stories-smoke.test.tsx deleted file mode 100644 index eb35c66c9866d..0000000000000 --- a/packages/ui/src/components/policy-controls/__tests__/policycontrols-stories-smoke.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -// @vitest-environment jsdom -/** - * Portable-stories smoke test for the policycontrols surface. Composes every - * policycontrols *.stories.tsx and renders it in jsdom. See test/portable-stories.tsx. - */ -import { smokeStoryModules } from "../../../../test/portable-stories"; - -const modules = import.meta.glob("../**/*.stories.tsx", { eager: true }); - -smokeStoryModules("policycontrols", modules, { minModules: 1 }); diff --git a/packages/ui/src/components/policy-controls/constants.ts b/packages/ui/src/components/policy-controls/constants.ts deleted file mode 100644 index 6200a49dd6dd0..0000000000000 --- a/packages/ui/src/components/policy-controls/constants.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { - ApprovedAddressesConfig, - AutoApproveConfig, - RateLimitConfig, - SpendingLimitConfig, - TimeWindowConfig, -} from "./types"; - -/** All monetary values are in USD for cross-chain compatibility. */ -export const DEFAULT_SPENDING: SpendingLimitConfig = { - maxPerTx: "50", - maxPerDay: "500", - maxPerWeek: "2000", -}; - -export const DEFAULT_APPROVED_ADDRESSES: ApprovedAddressesConfig = { - addresses: [], - labels: {}, - mode: "whitelist", -}; - -export const DEFAULT_RATE_LIMIT: RateLimitConfig = { - maxTxPerHour: 10, - maxTxPerDay: 50, -}; - -export const DEFAULT_TIME_WINDOW: TimeWindowConfig = { - allowedHours: [{ start: 9, end: 17 }], - allowedDays: [1, 2, 3, 4, 5], - timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, -}; - -/** Threshold in USD. */ -export const DEFAULT_AUTO_APPROVE: AutoApproveConfig = { - threshold: "5", -}; - -export const TIMEZONES = [ - "America/New_York", - "America/Chicago", - "America/Denver", - "America/Los_Angeles", - "America/Anchorage", - "Pacific/Honolulu", - "Europe/London", - "Europe/Berlin", - "Europe/Paris", - "Asia/Tokyo", - "Asia/Shanghai", - "Asia/Kolkata", - "Australia/Sydney", - "UTC", -]; - -export const DAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; diff --git a/packages/ui/src/components/policy-controls/helpers.ts b/packages/ui/src/components/policy-controls/helpers.ts deleted file mode 100644 index 3ed6314ecf53c..0000000000000 --- a/packages/ui/src/components/policy-controls/helpers.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { ApprovedAddressEntry, PolicyRule, PolicyType } from "./types"; - -export function findPolicy( - policies: PolicyRule[], - type: PolicyType, -): PolicyRule | undefined { - return policies.find((p) => p.type === type); -} - -/** Parse a numeric string (USD amount). Returns 0 for invalid input. */ -export function parseAmount(value: string): number { - const n = Number.parseFloat(value); - return Number.isNaN(n) ? 0 : n; -} - -export function formatHour(h: number): string { - if (h === 0) return "12:00 AM"; - if (h === 12) return "12:00 PM"; - if (h < 12) return `${h}:00 AM`; - return `${h - 12}:00 PM`; -} - -const EVM_RE = /^0x[a-fA-F0-9]{40}$/; -const SOLANA_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/; - -/** Validate an address (EVM or Solana). */ -export function isValidAddress(addr: string): boolean { - return EVM_RE.test(addr) || SOLANA_RE.test(addr); -} - -/** Detect chain type from address format. */ -export function detectChainType(addr: string): "evm" | "solana" | null { - if (EVM_RE.test(addr)) return "evm"; - if (SOLANA_RE.test(addr)) return "solana"; - return null; -} - -/** Format a chain type label for display. */ -export function chainTypeLabel(addr: string): string { - const type = detectChainType(addr); - if (type === "evm") return "EVM"; - if (type === "solana") return "Solana"; - return ""; -} - -export function approvedAddressValue( - entry: string | ApprovedAddressEntry, -): string { - return typeof entry === "string" ? entry : entry.address; -} diff --git a/packages/ui/src/components/policy-controls/index.ts b/packages/ui/src/components/policy-controls/index.ts deleted file mode 100644 index 3346358d3c28e..0000000000000 --- a/packages/ui/src/components/policy-controls/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -export { ApprovedAddressesSection } from "./ApprovedAddressesSection"; -export { addressSummary } from "./ApprovedAddressesSection.helpers"; -export { AutoApproveSection } from "./AutoApproveSection"; -export { autoApproveSummary } from "./AutoApproveSection.helpers"; -export * from "./constants"; -export { - approvedAddressValue, - chainTypeLabel, - detectChainType, - findPolicy, - isValidAddress, - parseAmount, -} from "./helpers"; -export { PolicyToggle } from "./PolicyToggle"; -export { RateLimitSection } from "./RateLimitSection"; -export { rateLimitSummary } from "./RateLimitSection.helpers"; -export { SpendingLimitSection } from "./SpendingLimitSection"; -export { spendingSummary } from "./SpendingLimitSection.helpers"; -export { TimeWindowSection } from "./TimeWindowSection"; -export { timeWindowSummary } from "./TimeWindowSection.helpers"; -export * from "./types"; diff --git a/packages/ui/src/components/policy-controls/types.ts b/packages/ui/src/components/policy-controls/types.ts deleted file mode 100644 index 3c3ed2dacbb09..0000000000000 --- a/packages/ui/src/components/policy-controls/types.ts +++ /dev/null @@ -1,73 +0,0 @@ -export type PolicyType = - | "spending-limit" - | "approved-addresses" - | "auto-approve-threshold" - | "time-window" - | "rate-limit"; - -export interface PolicyRule { - id: string; - type: PolicyType; - enabled: boolean; - config: Record; -} - -/** All monetary amounts are USD strings for cross-chain compatibility. */ -export interface SpendingLimitConfig { - /** USD amount per transaction */ - maxPerTx: string; - /** USD amount per day */ - maxPerDay: string; - /** USD amount per week */ - maxPerWeek: string; -} - -export interface ApprovedAddressEntry { - address: string; - label: string; - /** Detected chain type based on address format */ - chainType?: "evm" | "solana"; -} - -export interface ApprovedAddressesConfig { - addresses: Array; - labels?: Record; - mode: "whitelist" | "blacklist"; -} - -export interface RateLimitConfig { - maxTxPerHour: number; - maxTxPerDay: number; -} - -export interface TimeWindowConfig { - allowedHours: { start: number; end: number }[]; - allowedDays: number[]; - timezone?: string; -} - -/** Threshold is a USD string for cross-chain compatibility. */ -export interface AutoApproveConfig { - /** USD amount */ - threshold: string; -} - -/** Maps each policy type to its strongly-typed config shape. */ -export interface PolicyConfigMap { - "spending-limit": SpendingLimitConfig; - "approved-addresses": ApprovedAddressesConfig; - "auto-approve-threshold": AutoApproveConfig; - "time-window": TimeWindowConfig; - "rate-limit": RateLimitConfig; -} - -/** - * Extract a policy's config with the correct type for its `type` discriminant. - * Falls back to `fallback` when the policy is missing. - */ -export function getPolicyConfig( - policy: PolicyRule | undefined, - fallback: PolicyConfigMap[T], -): PolicyConfigMap[T] { - return policy?.config ? { ...fallback, ...policy.config } : fallback; -} diff --git a/packages/ui/src/components/release-center/shared.stories.tsx b/packages/ui/src/components/release-center/shared.stories.tsx index 8112623f79392..14d315691afe1 100644 --- a/packages/ui/src/components/release-center/shared.stories.tsx +++ b/packages/ui/src/components/release-center/shared.stories.tsx @@ -10,7 +10,6 @@ const mockAppContext = new Proxy({} as AppContextValue, { opts?.defaultValue ?? "Unavailable"; } if (prop === "uiLanguage") return "en"; - if (prop === "companionHalfFramerateMode") return "when_saving_power"; if (prop === "navigation") { return { scheduleAfterTabCommit: (fn: () => void) => { diff --git a/packages/ui/src/components/settings/PolicyControlsView.stories.tsx b/packages/ui/src/components/settings/PolicyControlsView.stories.tsx deleted file mode 100644 index a0371cd573578..0000000000000 --- a/packages/ui/src/components/settings/PolicyControlsView.stories.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { mockApp, withMockApp } from "../../storybook/mock-providers.helpers"; -import { PolicyControlsView } from "./PolicyControlsView"; - -/** - * `PolicyControlsView` manages Steward wallet policy guardrails (auto-approve, - * spending limits, rate limits, approved addresses, time windows). - * - * It takes no props and loads its data from the API client on mount. In - * Storybook there is no backend, so `getStewardStatus()` rejects/hangs: the - * component renders its in-flight loading spinner and then settles into the - * "Steward Not Connected" empty state. Both are valid, useful states to review. - */ -const meta = { - title: "Settings/PolicyControlsView", - component: PolicyControlsView, - tags: ["autodocs"], - parameters: { - layout: "padded", - }, - decorators: [withMockApp], - render: () => ( -
- -
- ), -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -/** - * Default mount: shows the loading spinner, then the "Steward Not Connected" - * empty state once the (unbacked) status request settles. - */ -export const Default: Story = {}; - -/** - * Same view wrapped via `mockApp({...})` to demonstrate AppContext overrides; - * the running agent status does not change the rendered policy states here, but - * shows how to drive the harness for state-coupled siblings. - */ -export const RunningAgent: Story = { - decorators: [mockApp({ agentStatus: { state: "running" } })], -}; diff --git a/packages/ui/src/components/settings/PolicyControlsView.tsx b/packages/ui/src/components/settings/PolicyControlsView.tsx deleted file mode 100644 index d5e81eb7bc2b7..0000000000000 --- a/packages/ui/src/components/settings/PolicyControlsView.tsx +++ /dev/null @@ -1,1121 +0,0 @@ -import { asRecord as asSharedRecord } from "@elizaos/shared"; -import { AlertTriangle } from "lucide-react"; -import type React from "react"; -import { useCallback, useEffect, useMemo, useState } from "react"; -import { useAgentElement } from "../../agent-surface"; -import { client } from "../../api"; -import { useTranslation } from "../../state/TranslationContext.hooks"; -import type { - ApprovedAddressesConfig, - PolicyRule, - PolicyType, - TimeWindowConfig, -} from "../policy-controls"; -import { - approvedAddressValue, - chainTypeLabel, - DAY_NAMES, - DEFAULT_APPROVED_ADDRESSES, - DEFAULT_AUTO_APPROVE, - DEFAULT_RATE_LIMIT, - DEFAULT_SPENDING, - DEFAULT_TIME_WINDOW, - findPolicy, - getPolicyConfig, - isValidAddress, - TIMEZONES, -} from "../policy-controls"; -import { StewardLogo } from "../steward/injected"; -import { Button } from "../ui/button"; -import { ConfirmDialog } from "../ui/confirm-dialog"; -import { Input } from "../ui/input"; -import { Label } from "../ui/label"; -import { Select, SelectContent, SelectItem, SelectValue } from "../ui/select"; -import { SettingsSelectTrigger } from "../ui/settings-controls"; -import { Slider } from "../ui/slider"; -import { Spinner } from "../ui/spinner"; -import { Switch } from "../ui/switch"; -import { useSettingsSave } from "./settings-control-primitives.hooks"; -import { SettingsGroup, SettingsRow, SettingsStack } from "./settings-layout"; - -const asRecord = (value: unknown): Record => - asSharedRecord(value) ?? {}; - -/** Static hour options to avoid array-index-as-key lint issues. */ -const HOUR_FROM_OPTIONS = Array.from({ length: 24 }, (_, i) => ({ - key: `from-${i}`, - value: i, - label: `${String(i).padStart(2, "0")}:00`, -})); - -const HOUR_TO_OPTIONS = Array.from({ length: 24 }, (_, i) => ({ - key: `to-${i + 1}`, - value: i + 1, - label: `${String(i + 1).padStart(2, "0")}:00`, -})); - -export function PolicyControlsView() { - const { t } = useTranslation(); - const [policies, setPolicies] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - const [stewardConnected, setStewardConnected] = useState(false); - const [dirty, setDirty] = useState(false); - const [confirmOpen, setConfirmOpen] = useState(false); - const [confirmMessage, setConfirmMessage] = useState(""); - const [confirmCallback, setConfirmCallback] = useState<(() => void) | null>( - null, - ); - - useEffect(() => { - let cancelled = false; - async function load() { - try { - const status = await client.getStewardStatus(); - if (cancelled) return; - setStewardConnected(status.connected); - if (!status.connected) { - setLoading(false); - return; - } - const result = await client.getStewardPolicies(); - if (cancelled) return; - setPolicies(result as PolicyRule[]); - } catch (err) { - if (cancelled) return; - setError( - err instanceof Error - ? err.message - : t("policycontrols.error.loadFailed", { - defaultValue: "Failed to load policies", - }), - ); - } finally { - if (!cancelled) setLoading(false); - } - } - void load(); - return () => { - cancelled = true; - }; - }, [t]); - - const performSave = useCallback(async () => { - setError(null); - try { - await client.setStewardPolicies(policies); - setDirty(false); - } catch (err) { - setError( - err instanceof Error - ? err.message - : t("policycontrols.error.saveFailed", { - defaultValue: "Failed to save policies", - }), - ); - throw err; - } - }, [policies, t]); - - const { - saving, - saveSuccess, - handleSave, - resetStatus: resetSaveStatus, - } = useSettingsSave({ - onSave: performSave, - errorFallback: t("policycontrols.error.saveFailed", { - defaultValue: "Failed to save policies", - }), - }); - - const getPolicy = useCallback( - (type: PolicyType) => findPolicy(policies, type), - [policies], - ); - - const updatePolicy = useCallback( - (type: PolicyType, updates: Partial) => { - setPolicies((prev) => { - const existing = prev.find((p) => p.type === type); - if (existing) { - return prev.map((p) => (p.type === type ? { ...p, ...updates } : p)); - } - return [ - ...prev, - { - id: `${type}-${Date.now()}`, - type, - enabled: true, - config: {}, - ...updates, - }, - ]; - }); - setDirty(true); - resetSaveStatus(); - }, - [resetSaveStatus], - ); - - const togglePolicy = useCallback( - ( - type: PolicyType, - enabled: boolean, - defaultConfig: Record, - ) => { - const existing = findPolicy(policies, type); - if (!enabled && existing?.enabled) { - setConfirmMessage( - t("policycontrols.confirm.message", { - defaultValue: - "Disabling this removes a safety guardrail. Are you sure?", - }), - ); - setConfirmCallback(() => () => updatePolicy(type, { enabled: false })); - setConfirmOpen(true); - return; - } - updatePolicy(type, { - enabled, - config: existing?.config ?? defaultConfig, - }); - }, - [policies, updatePolicy, t], - ); - - // Extract configs (must be before early returns so hooks are unconditional) - const autoApprovePolicy = getPolicy("auto-approve-threshold"); - const autoApproveConfig = getPolicyConfig<"auto-approve-threshold">( - autoApprovePolicy, - DEFAULT_AUTO_APPROVE, - ); - - const spendingPolicy = getPolicy("spending-limit"); - const spendingConfig = getPolicyConfig<"spending-limit">( - spendingPolicy, - DEFAULT_SPENDING, - ); - - const addressPolicy = getPolicy("approved-addresses"); - const addressConfig = getPolicyConfig<"approved-addresses">( - addressPolicy, - DEFAULT_APPROVED_ADDRESSES, - ); - - const rateLimitPolicy = getPolicy("rate-limit"); - const rateLimitConfig = getPolicyConfig<"rate-limit">( - rateLimitPolicy, - DEFAULT_RATE_LIMIT, - ); - - const timeWindowPolicy = getPolicy("time-window"); - const timeWindowConfig = getPolicyConfig<"time-window">( - timeWindowPolicy, - DEFAULT_TIME_WINDOW, - ); - - const normalizedAddresses = useMemo( - () => - (addressConfig.addresses ?? []).map((addr) => approvedAddressValue(addr)), - [addressConfig.addresses], - ); - - const { ref: saveRef, agentProps: saveAgentProps } = - useAgentElement({ - id: "policy-save", - role: "button", - label: "Save policies", - group: "policy-controls", - description: "Persist wallet policy changes", - onActivate: () => void handleSave(), - }); - - if (loading) { - return ( -
- - - {t("policycontrols.loading", { defaultValue: "Loading…" })} - -
- ); - } - - if (!stewardConnected) { - return ( -
- -

- {t("policycontrols.notConnected.title", { - defaultValue: "Steward Not Connected", - })} -

-

- {t("policycontrols.notConnected.description", { - defaultValue: - "Connect your Steward instance to manage wallet policies.", - })} -

-
- ); - } - - return ( - - {error && ( -
- - {error} -
- )} - - - {/* Auto-Approve */} - - togglePolicy( - "auto-approve-threshold", - v, - asRecord(DEFAULT_AUTO_APPROVE), - ) - } - > -
- - - updatePolicy("auto-approve-threshold", { - config: asRecord({ threshold: v }), - }) - } - /> -
-
- - {/* Spending Limits */} - - togglePolicy("spending-limit", v, asRecord(DEFAULT_SPENDING)) - } - > -
- - updatePolicy("spending-limit", { - config: asRecord({ ...spendingConfig, maxPerTx: v }), - }) - } - /> - - updatePolicy("spending-limit", { - config: asRecord({ ...spendingConfig, maxPerDay: v }), - }) - } - /> - - updatePolicy("spending-limit", { - config: asRecord({ ...spendingConfig, maxPerWeek: v }), - }) - } - /> -
-
- - {/* Rate Limits */} - - togglePolicy("rate-limit", v, asRecord(DEFAULT_RATE_LIMIT)) - } - > -
- - updatePolicy("rate-limit", { - config: asRecord({ ...rateLimitConfig, maxTxPerHour: v }), - }) - } - /> - - updatePolicy("rate-limit", { - config: asRecord({ ...rateLimitConfig, maxTxPerDay: v }), - }) - } - /> -
-
- - {/* Address Controls */} - - togglePolicy( - "approved-addresses", - v, - asRecord(DEFAULT_APPROVED_ADDRESSES), - ) - } - > - - updatePolicy("approved-addresses", { config: asRecord(cfg) }) - } - /> - - - {/* Time Restrictions */} - - togglePolicy("time-window", v, asRecord(DEFAULT_TIME_WINDOW)) - } - > - - updatePolicy("time-window", { config: asRecord(cfg) }) - } - /> - -
- - {/* Save */} - {dirty && ( -
- - {t("policycontrols.unsavedChanges", { - defaultValue: "Unsaved changes", - })} - - -
- )} - {saveSuccess && !dirty && ( -
- - {t("policycontrols.saved", { defaultValue: "Saved" })} - -
- )} - - { - confirmCallback?.(); - setConfirmOpen(false); - }} - onCancel={() => setConfirmOpen(false)} - /> -
- ); -} - -/* ── Sub-components ──────────────────────────────────────────────────── */ - -function PolicyRow({ - agentId, - title, - desc, - enabled, - onToggle, - children, -}: { - agentId: string; - title: string; - desc: string; - enabled: boolean; - onToggle: (v: boolean) => void; - children?: React.ReactNode; -}) { - const { ref, agentProps } = useAgentElement({ - id: `policy-toggle-${agentId}`, - role: "toggle", - label: `Toggle ${title}`, - group: "policy-controls", - status: enabled ? "active" : "inactive", - onActivate: () => onToggle(!enabled), - }); - return ( - - } - > - {enabled && children ? children : null} - - ); -} - -function UsdField({ - agentId, - agentLabel, - value, - onChange, -}: { - agentId: string; - agentLabel: string; - value: string; - onChange: (v: string) => void; -}) { - const { ref, agentProps } = useAgentElement({ - id: `policy-usd-${agentId}`, - role: "number-input", - label: agentLabel, - group: "policy-controls", - getValue: () => value, - onFill: (v) => { - if (/^(?:\d+(?:\.\d*)?|\.\d*)?$/.test(v)) onChange(v.slice(0, 32)); - }, - }); - return ( -
- - $ - - { - const v = e.target.value.slice(0, 32); - if (/^(?:\d+(?:\.\d*)?|\.\d*)?$/.test(v)) onChange(v); - }} - className="h-8 text-xs pl-6 tabular-nums" - placeholder="0" - /> -
- ); -} - -function UsdFieldLabeled({ - agentId, - label, - value, - onChange, -}: { - agentId: string; - label: string; - value: string; - onChange: (v: string) => void; -}) { - return ( -
- - -
- ); -} - -function SliderField({ - agentId, - label, - value, - min, - max, - onChange, -}: { - agentId: string; - label: string; - value: number; - min: number; - max: number; - onChange: (v: number) => void; -}) { - const { ref, agentProps } = useAgentElement({ - id: `policy-slider-${agentId}`, - role: "slider", - label, - group: "policy-controls", - getValue: () => value, - onFill: (v) => { - const n = Number(v); - if (Number.isFinite(n)) onChange(Math.min(max, Math.max(min, n))); - }, - }); - return ( -
-
- - - {value} - -
- onChange(v)} - /> -
- ); -} - -function AddressRow({ - address, - chain, - onRemove, -}: { - address: string; - chain: string; - onRemove: () => void; -}) { - const { t } = useTranslation(); - const removeControl = useAgentElement({ - id: `policy-address-remove-${address}`, - role: "button", - label: t("policycontrols.address.remove", { defaultValue: "remove" }), - group: "policy-addresses", - description: `Remove ${address} from the address policy list`, - onActivate: onRemove, - }); - return ( -
-
- {address} - {chain && ( - - {chain} - - )} -
- -
- ); -} - -function AddressSection({ - config, - addresses, - onUpdate, -}: { - config: ApprovedAddressesConfig; - addresses: string[]; - onUpdate: (cfg: ApprovedAddressesConfig) => void; -}) { - const { t } = useTranslation(); - const [newAddr, setNewAddr] = useState(""); - const [addrError, setAddrError] = useState(null); - - const { ref: allowlistRef, agentProps: allowlistAgentProps } = - useAgentElement({ - id: "policy-address-allowlist", - role: "button", - label: "Address allowlist mode", - group: "policy-address", - status: config.mode === "whitelist" ? "active" : "inactive", - onActivate: () => onUpdate({ ...config, mode: "whitelist" }), - }); - const { ref: blocklistRef, agentProps: blocklistAgentProps } = - useAgentElement({ - id: "policy-address-blocklist", - role: "button", - label: "Address blocklist mode", - group: "policy-address", - status: config.mode === "blacklist" ? "active" : "inactive", - onActivate: () => onUpdate({ ...config, mode: "blacklist" }), - }); - const { ref: newAddrRef, agentProps: newAddrAgentProps } = - useAgentElement({ - id: "policy-address-input", - role: "text-input", - label: "New policy address", - group: "policy-address", - getValue: () => newAddr, - onFill: (v) => { - setNewAddr(v); - setAddrError(null); - }, - }); - const { ref: addRef, agentProps: addAgentProps } = - useAgentElement({ - id: "policy-address-add", - role: "button", - label: "Add policy address", - group: "policy-address", - }); - - const handleAdd = () => { - const trimmed = newAddr.trim(); - if (!trimmed) return; - if (!isValidAddress(trimmed)) { - setAddrError( - t("policycontrols.address.invalid", { - defaultValue: "Invalid address (EVM 0x... or Solana base58)", - }), - ); - return; - } - if ( - config.addresses.some((entry) => approvedAddressValue(entry) === trimmed) - ) { - setAddrError( - t("policycontrols.address.duplicate", { - defaultValue: "Already in list", - }), - ); - return; - } - onUpdate({ ...config, addresses: [...config.addresses, trimmed] }); - setNewAddr(""); - setAddrError(null); - }; - - const handleRemove = (addr: string) => { - const labels = { ...config.labels }; - delete labels[addr]; - onUpdate({ - ...config, - addresses: config.addresses.filter( - (entry) => approvedAddressValue(entry) !== addr, - ), - labels, - }); - }; - - return ( -
-
- - -
- - {addresses.length > 0 && ( -
- {addresses.map((addr) => ( - handleRemove(addr)} - /> - ))} -
- )} - -
- { - setNewAddr(e.target.value); - setAddrError(null); - }} - onKeyDown={(e) => e.key === "Enter" && handleAdd()} - placeholder={t("policycontrols.address.placeholder", { - defaultValue: "EVM or Solana address", - })} - className="h-8 text-xs font-mono flex-1" - /> - -
- {addrError &&
{addrError}
} -
- ); -} - -function TimeSection({ - config, - onUpdate, -}: { - config: TimeWindowConfig; - onUpdate: (cfg: TimeWindowConfig) => void; -}) { - const { t } = useTranslation(); - const hours = config.allowedHours?.[0] ?? { start: 9, end: 17 }; - const days = config.allowedDays ?? [1, 2, 3, 4, 5]; - const timezone = - config.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone; - - const { ref: fromRef, agentProps: fromAgentProps } = - useAgentElement({ - id: "policy-time-from", - role: "select", - label: t("policycontrols.time.from", { defaultValue: "From" }), - group: "policy-time", - options: HOUR_FROM_OPTIONS.map((h) => String(h.value)), - getValue: () => String(hours.start), - onFill: (v) => - onUpdate({ - ...config, - allowedHours: [{ start: Number(v), end: hours.end }], - }), - }); - const { ref: toRef, agentProps: toAgentProps } = - useAgentElement({ - id: "policy-time-to", - role: "select", - label: t("policycontrols.time.to", { defaultValue: "To" }), - group: "policy-time", - options: HOUR_TO_OPTIONS.map((h) => String(h.value)), - getValue: () => String(hours.end), - onFill: (v) => - onUpdate({ - ...config, - allowedHours: [{ start: hours.start, end: Number(v) }], - }), - }); - const { ref: tzRef, agentProps: tzAgentProps } = - useAgentElement({ - id: "policy-time-timezone", - role: "select", - label: t("policycontrols.time.timezone", { defaultValue: "Timezone" }), - group: "policy-time", - options: TIMEZONES.map((tz) => String(tz)), - getValue: () => timezone, - onFill: (v) => onUpdate({ ...config, timezone: v }), - }); - - const toggleDay = (i: number) => { - const next = days.includes(i) - ? days.filter((d) => d !== i) - : [...days, i].sort(); - onUpdate({ ...config, allowedDays: next }); - }; - - return ( -
-
-
- - -
- -
- - -
-
- -
- {DAY_NAMES.map((name, i) => ( - - ))} -
- -
- - -
-
- ); -} - -function DayToggle({ - name, - index, - active, - onToggle, -}: { - name: string; - index: number; - active: boolean; - onToggle: (index: number) => void; -}) { - const { ref, agentProps } = useAgentElement({ - id: `policy-day-${index}`, - role: "toggle", - label: `Allow ${name}`, - group: "policy-time", - status: active ? "on" : "off", - getValue: () => active, - onActivate: () => onToggle(index), - }); - return ( - - ); -} diff --git a/packages/ui/src/components/shell/ShellHeaderControls.tsx b/packages/ui/src/components/shell/ShellHeaderControls.tsx index 52f5ae79e7e4f..db8f4c71f6d95 100644 --- a/packages/ui/src/components/shell/ShellHeaderControls.tsx +++ b/packages/ui/src/components/shell/ShellHeaderControls.tsx @@ -7,7 +7,6 @@ import { PencilLine, Save, Smartphone, - UserRound, Volume2, VolumeX, } from "lucide-react"; @@ -123,11 +122,6 @@ export function ShellHeaderControls({ label: string; Icon: LucideIcon; }> = [ - { - view: "companion", - label: t("header.companionMode"), - Icon: UserRound, - }, { view: "character", label: t("header.characterMode"), diff --git a/packages/ui/src/components/shell/ShellOverlays.tsx b/packages/ui/src/components/shell/ShellOverlays.tsx index 61b4faa652924..6981cc9828b2a 100644 --- a/packages/ui/src/components/shell/ShellOverlays.tsx +++ b/packages/ui/src/components/shell/ShellOverlays.tsx @@ -9,7 +9,6 @@ import { TOAST_TTL_MS } from "../../state/action-notice"; import { useAppSelector } from "../../state/app-store"; import type { AppContextValue } from "../../state/internal"; import type { ActionNotice } from "../../state/types"; -import { CompanionGlobalOverlay as GlobalEmoteOverlay } from "../companion/injected"; import { Spinner } from "../ui/spinner"; import { BugReportModal } from "./BugReportModal"; import { CommandPalette } from "./CommandPalette"; @@ -109,7 +108,6 @@ export function ShellOverlays({ - {actionNotice && (
{}, }), diff --git a/packages/ui/src/components/steward/__tests__/steward-stories-smoke.test.tsx b/packages/ui/src/components/steward/__tests__/steward-stories-smoke.test.tsx deleted file mode 100644 index 1d596cec8abf0..0000000000000 --- a/packages/ui/src/components/steward/__tests__/steward-stories-smoke.test.tsx +++ /dev/null @@ -1,5 +0,0 @@ -// @vitest-environment jsdom -import { smokeStoryModules } from "../../../../test/portable-stories"; - -const modules = import.meta.glob("../**/*.stories.tsx", { eager: true }); -smokeStoryModules("steward", modules, { minModules: 1 }); diff --git a/packages/ui/src/components/steward/injected.stories.tsx b/packages/ui/src/components/steward/injected.stories.tsx deleted file mode 100644 index 8e8ae71c1d705..0000000000000 --- a/packages/ui/src/components/steward/injected.stories.tsx +++ /dev/null @@ -1,181 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import type { ComponentType, ReactNode } from "react"; -import type { - AppBootStewardPendingApproval, - StewardApprovalQueueProps, - StewardLogoProps, - StewardTransactionHistoryProps, -} from "../../config/boot-config"; -import { AppBootContext } from "../../config/boot-config-react.hooks"; -import { - type AppBootConfig, - DEFAULT_BOOT_CONFIG, -} from "../../config/boot-config-store"; -import { ApprovalQueue, StewardLogo, TransactionHistory } from "./injected"; - -const MockStewardLogo: ComponentType = ({ - size = 32, - className, -}) => ( -
- S -
-); - -const MOCK_PENDING: AppBootStewardPendingApproval[] = [ - { - queueId: "queue-1", - status: "pending", - requestedAt: new Date().toISOString(), - transaction: { - id: "tx-1", - agentId: "agent-alpha", - status: "pending", - request: { - agentId: "agent-alpha", - tenantId: "tenant-1", - to: "0xAbCdEf0123456789abcdef0123456789AbCdEf01", - value: "0.05", - chainId: 1, - }, - policyResults: [], - createdAt: new Date().toISOString(), - }, - }, -]; - -const MockApprovalQueue: ComponentType = ({ - embedded, -}) => ( -
-
Approval Queue
- {MOCK_PENDING.map((p) => ( -
- Send {p.transaction.request.value} ETH to{" "} - {p.transaction.request.to.slice(0, 10)}… -
- ))} -
-); - -const MockTransactionHistory: ComponentType = ({ - embedded, -}) => ( -
-
Transaction History
-
0xdead…beef · confirmed · 0.10 ETH
-
0xfeed…face · pending · 0.05 ETH
-
-); - -const noopApprovalProps: StewardApprovalQueueProps = { - getStewardPending: async () => MOCK_PENDING, - approveStewardTx: async () => ({ ok: true }), - rejectStewardTx: async () => ({ ok: true }), - copyToClipboard: async () => {}, - setActionNotice: () => {}, -}; - -const noopHistoryProps: StewardTransactionHistoryProps = { - getStewardHistory: async () => ({ - records: [], - total: 0, - offset: 0, - limit: 25, - }), - copyToClipboard: async () => {}, - setActionNotice: () => {}, -}; - -function withBootConfig(overrides: Partial) { - return (Story: () => ReactNode) => ( - - - - ); -} - -const meta = { - title: "Steward/Injected", - component: StewardLogo, - tags: ["autodocs"], - parameters: { - docs: { - description: { - component: - "Thin wrappers that resolve host-provided Steward components from the boot config. Each renders `null` when the host has not injected an implementation.", - }, - }, - }, -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const LogoDefault: Story = { - args: { size: 40 }, - decorators: [withBootConfig({ stewardLogo: MockStewardLogo })], -}; - -export const LogoSmall: Story = { - args: { size: 16 }, - decorators: [withBootConfig({ stewardLogo: MockStewardLogo })], -}; - -export const LogoNotConfigured: Story = { - args: { size: 40 }, - parameters: { - docs: { - description: { - story: - "Without a host-provided `stewardLogo`, the wrapper renders nothing.", - }, - }, - }, -}; - -export const ApprovalQueueInjected: StoryObj = { - render: () => ( - - ), - decorators: [withBootConfig({ stewardApprovalQueue: MockApprovalQueue })], -}; - -export const TransactionHistoryInjected: StoryObj = { - render: () => , - decorators: [ - withBootConfig({ stewardTransactionHistory: MockTransactionHistory }), - ], -}; diff --git a/packages/ui/src/components/steward/injected.tsx b/packages/ui/src/components/steward/injected.tsx deleted file mode 100644 index 9c466eeb3d23b..0000000000000 --- a/packages/ui/src/components/steward/injected.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import type { - StewardApprovalQueueProps, - StewardLogoProps, - StewardTransactionHistoryProps, -} from "../../config/boot-config"; -import { useBootConfig } from "../../config/boot-config-react.hooks"; - -export function StewardLogo(props: StewardLogoProps) { - const { stewardLogo: StewardLogoComponent } = useBootConfig(); - return StewardLogoComponent ? : null; -} - -export function ApprovalQueue(props: StewardApprovalQueueProps) { - const { stewardApprovalQueue: ApprovalQueueComponent } = useBootConfig(); - return ApprovalQueueComponent ? : null; -} - -export function TransactionHistory(props: StewardTransactionHistoryProps) { - const { stewardTransactionHistory: TransactionHistoryComponent } = - useBootConfig(); - return TransactionHistoryComponent ? ( - - ) : null; -} diff --git a/packages/ui/src/components/ui/tooltip-extended.tsx b/packages/ui/src/components/ui/tooltip-extended.tsx index 3d938710fe302..fa6b154cde53b 100644 --- a/packages/ui/src/components/ui/tooltip-extended.tsx +++ b/packages/ui/src/components/ui/tooltip-extended.tsx @@ -5,11 +5,11 @@ import { cn } from "../../lib/utils"; // is kept inline so the scanner emits the utility. /** - * Hover-only tooltip with optional shortcut hint. Used as the icon-button - * affordance pattern in plugins/plugin-companion. The other extended-tooltip - * primitives (HoverTooltip, Spotlight, useGuidedTour, TourStep) were - * deleted as zero-consumer in the Layer 5b sweep — their last shipping - * surface was a guided-tour feature that was never wired up. + * Hover-only tooltip with optional shortcut hint — the icon-button affordance + * primitive exported from the kit. The other extended-tooltip primitives + * (HoverTooltip, Spotlight, useGuidedTour, TourStep) were deleted as + * zero-consumer in the Layer 5b sweep — their last shipping surface was a + * guided-tour feature that was never wired up. */ export function IconTooltip({ children, diff --git a/packages/ui/src/config/boot-config-store.ts b/packages/ui/src/config/boot-config-store.ts index ea73f00f88a79..4226541e34d4e 100644 --- a/packages/ui/src/config/boot-config-store.ts +++ b/packages/ui/src/config/boot-config-store.ts @@ -11,13 +11,10 @@ import type { AppBlockerSettingsCardProps, - StewardPolicyResult, WebsiteBlockerSettingsCardProps, } from "@elizaos/shared"; import type { ComponentType, ReactNode } from "react"; import type { CodingAgentSession } from "../api/client-types-cloud"; -import type { Tab } from "../navigation"; -import type { ActionNotice } from "../state/action-notice"; import type { BrandingConfig } from "./branding"; export { syncBrandEnvToEliza, syncElizaEnvToBrand } from "@elizaos/core"; @@ -76,11 +73,6 @@ export interface ClientMiddleware { desktopPermissions?: boolean; } -export interface CompanionShellComponentProps { - tab: Tab; - actionNotice: ActionNotice | null; -} - /** Where a home tile sends you. Mirrors HomeTileTarget in shell/HomeScreen. */ export type HomeScreenNavTarget = | { kind: "tab"; tab: string } @@ -94,30 +86,6 @@ export interface HomeScreenComponentProps { showNativeOsTiles?: boolean; } -export type CompanionInferenceNotice = - | { kind: "cloud"; variant: "danger" | "warn"; tooltip: string } - | { kind: "settings"; variant: "warn"; tooltip: string }; - -export interface ResolveCompanionInferenceNoticeArgs { - elizaCloudConnected: boolean; - elizaCloudAuthRejected: boolean; - elizaCloudCreditsError: string | null | undefined; - elizaCloudEnabled: boolean; - chatLastUsageModel?: string; - hasInterruptedAssistant: boolean; - t: (key: string) => string; -} - -export interface CompanionSceneStatus { - avatarReady: boolean; - teleportKey: string; -} - -export interface CompanionVectorBrowserRuntime { - THREE: unknown; - createVectorBrowserRenderer: () => Promise; -} - export interface CodingAgentTasksPanelProps { fullPage?: boolean; } @@ -134,92 +102,6 @@ export interface FineTuningViewProps { contentHeader?: ReactNode; } -export interface StewardLogoProps { - size?: number; - className?: string; -} - -export type AppBootStewardTxStatus = - | "pending" - | "approved" - | "rejected" - | "signed" - | "broadcast" - | "confirmed" - | "failed"; - -export interface AppBootStewardTxRecord { - id: string; - agentId: string; - status: AppBootStewardTxStatus; - request: { - agentId: string; - tenantId: string; - to: string; - value: string; - data?: string; - chainId: number; - }; - txHash?: string; - policyResults: StewardPolicyResult[]; - createdAt: string; - signedAt?: string; - confirmedAt?: string; -} - -export interface AppBootStewardPendingApproval { - queueId: string; - status: "pending" | "approved" | "rejected"; - requestedAt: string; - transaction: AppBootStewardTxRecord; -} - -export interface AppBootStewardApprovalActionResponse { - ok: boolean; - txHash?: string; - error?: string; -} - -export interface StewardApprovalQueueProps { - embedded?: boolean; - refreshKey?: number | string; - getStewardPending: () => Promise; - approveStewardTx: ( - txId: string, - ) => Promise; - rejectStewardTx: ( - txId: string, - reason?: string, - ) => Promise; - copyToClipboard: (text: string) => Promise; - setActionNotice: ( - text: string, - tone?: "info" | "success" | "error", - ttlMs?: number, - ) => void; - onPendingCountChange?: (count: number) => void; -} - -export interface StewardTransactionHistoryProps { - embedded?: boolean; - getStewardHistory: (opts?: { - status?: string; - limit?: number; - offset?: number; - }) => Promise<{ - records: AppBootStewardTxRecord[]; - total: number; - offset: number; - limit: number; - }>; - copyToClipboard: (text: string) => Promise; - setActionNotice: ( - text: string, - tone?: "info" | "success" | "error", - ttlMs?: number, - ) => void; -} - export interface AppBootConfig { /** Branding overrides (product name, URLs, etc.). */ branding: Partial; @@ -253,24 +135,6 @@ export interface AppBootConfig { * shows its own logo, not the elizaOS mark). Receives an optional className. */ brandMark?: ComponentType<{ className?: string }>; - /** Companion shell implementation provided by the host app. */ - companionShell?: ComponentType; - /** Companion cloud/settings warning resolver provided by the host app. */ - resolveCompanionInferenceNotice?: ( - args: ResolveCompanionInferenceNoticeArgs, - ) => CompanionInferenceNotice | null; - /** Companion warning button implementation provided by the host app. */ - companionInferenceAlertButton?: ComponentType<{ - notice: CompanionInferenceNotice; - onClick: () => void; - onPointerDown?: (...args: unknown[]) => unknown; - }>; - /** Companion global overlay implementation provided by the host app. */ - companionGlobalOverlay?: ComponentType>; - /** Companion scene state hook provided by the host app. */ - useCompanionSceneStatus?: () => CompanionSceneStatus; - /** Optional vector browser runtime owned by the host app. */ - companionVectorBrowser?: CompanionVectorBrowserRuntime; /** Coding-agent tasks panel provided by the host app. */ codingAgentTasksPanel?: ComponentType; /** Coding-agent settings panel provided by the host app. */ @@ -287,12 +151,6 @@ export interface AppBootConfig { appBlockerSettingsCard?: ComponentType; /** Website blocker settings card provided by the host app. */ websiteBlockerSettingsCard?: ComponentType; - /** Steward brand mark provided by the host app. */ - stewardLogo?: ComponentType; - /** Steward approval queue provided by the host app. */ - stewardApprovalQueue?: ComponentType; - /** Steward transaction history provided by the host app. */ - stewardTransactionHistory?: ComponentType; /** Shortcut behavior switches. Natural-language shortcuts are off by default. */ shortcutFlags?: { naturalLanguage?: boolean; diff --git a/packages/ui/src/first-run/first-run-finish.ts b/packages/ui/src/first-run/first-run-finish.ts index b5450a8c30841..9941ec1c41bf0 100644 --- a/packages/ui/src/first-run/first-run-finish.ts +++ b/packages/ui/src/first-run/first-run-finish.ts @@ -37,7 +37,6 @@ import { savePersistedActiveServer, } from "../state"; import type { ActionBanner } from "../state/action-banner"; -import type { CompleteFirstRunOptions } from "../state/types"; import { isCloudStatusAuthenticated } from "../utils"; import { autoDownloadRecommendedLocalModelInBackground } from "./auto-download-recommended"; import { @@ -82,10 +81,7 @@ export interface FirstRunFinishPorts { setTab: (tab: string) => void; switchAgentProfile: (profileId: string) => void; /** Injected client-side finalizer (flips firstRunComplete; never POSTs). */ - completeFirstRun: ( - landingTab?: string, - options?: CompleteFirstRunOptions, - ) => void; + completeFirstRun: (landingTab?: string) => void; /** Status text (e.g. "Starting local agent") surfaced into the chat transcript. */ onStatus?: (text: string | null) => void; } @@ -435,7 +431,7 @@ async function finishLocal( } clearPersistedFirstRunState(); ports.onStatus?.(null); - ports.completeFirstRun("chat", { launchCompanionOverlay: true }); + ports.completeFirstRun("chat"); return { kind: "done" }; } @@ -504,7 +500,7 @@ async function finishRemote( await persistFirstRun(plan, ports); clearPersistedFirstRunState(); ports.onStatus?.(null); - ports.completeFirstRun("chat", { launchCompanionOverlay: true }); + ports.completeFirstRun("chat"); return { kind: "done" }; } @@ -573,7 +569,7 @@ export async function bindCloudAgent( } clearPersistedFirstRunState(); ports.onStatus?.(null); - ports.completeFirstRun("chat", { launchCompanionOverlay: true }); + ports.completeFirstRun("chat"); // Seamless shared→dedicated cloud-agent handoff (background). Flag OFF → // `selectedAgent` is the dedicated agent itself and this branch is skipped. diff --git a/packages/ui/src/first-run/use-first-run-conductor.ts b/packages/ui/src/first-run/use-first-run-conductor.ts index 006261f23b6c2..d580106fb1ece 100644 --- a/packages/ui/src/first-run/use-first-run-conductor.ts +++ b/packages/ui/src/first-run/use-first-run-conductor.ts @@ -373,7 +373,7 @@ export function useFirstRunConductor(): void { if (group === "tutorial") { // The single real completion: flip the gate (deactivates the conductor), // then optionally launch the interactive tutorial. - completeFirstRun("chat", { launchCompanionOverlay: true }); + completeFirstRun("chat"); if (id === "start") startTutorial(); return true; } diff --git a/packages/ui/src/hooks/useAvailableViews.ts b/packages/ui/src/hooks/useAvailableViews.ts index eded2061df0a3..8bed7877f73d7 100644 --- a/packages/ui/src/hooks/useAvailableViews.ts +++ b/packages/ui/src/hooks/useAvailableViews.ts @@ -192,7 +192,6 @@ const TAB_ICON_NAMES: Partial> = { camera: "AppWindow", tasks: "ListTodo", browser: "Globe", - companion: "Bot", stream: "Radio", apps: "LayoutGrid", views: "LayoutGrid", diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index bbf0d502fb511..652fa8737cc3e 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -341,9 +341,6 @@ export type { CharacterCatalogData, ClientMiddleware, CodingAgentTasksPanelProps, - CompanionInferenceNotice, - CompanionSceneStatus, - CompanionShellComponentProps, CondExpr, CustomProviderOption, DynamicProp, @@ -360,13 +357,9 @@ export type { PatchOp, PathVisibility, RepeatConfig, - ResolveCompanionInferenceNoticeArgs, ResolvedCharacterAsset, ResolvedField, ResolvedInjectedCharacter, - StewardApprovalQueueProps, - StewardLogoProps, - StewardTransactionHistoryProps, UIStreamConfig, UiAction, UiComponentType, @@ -539,8 +532,6 @@ export { } from "./state/bounded-view-lru"; export type { ActionNotice, - CompanionHalfFramerateMode, - CompanionVrmPowerMode, InventoryChainFilters, } from "./state/index"; export * from "./state/index"; @@ -552,7 +543,6 @@ export { mergeStreamingText, useAppSelector, useAppSelectorShallow, - useCompanionSceneConfig, usePtySessions, useTranslation, useWalletState, diff --git a/packages/ui/src/navigation/index.ts b/packages/ui/src/navigation/index.ts index 3beff3f98aea3..68f9f164106ce 100644 --- a/packages/ui/src/navigation/index.ts +++ b/packages/ui/src/navigation/index.ts @@ -36,11 +36,6 @@ export const APPS_ENABLED = viteEnvFlagEnabled("VITE_ENABLE_APPS", true); /** Stream routes stay addressable; the nav hides the tab unless streaming is enabled. */ export const STREAM_ENABLED = true; -/** Companion tab — enabled by default; opt-out via VITE_ENABLE_COMPANION_MODE=false. */ -export const COMPANION_ENABLED = viteEnvFlagEnabled( - "VITE_ENABLE_COMPANION_MODE", - true, -); /** Built-in tab identifiers. */ export type BuiltinTab = @@ -52,7 +47,6 @@ export type BuiltinTab = | "tasks" | "automations" | "browser" - | "companion" | "stream" | "apps" | "views" @@ -286,7 +280,6 @@ export const TAB_PATHS: Record = { camera: "/camera", tasks: "/apps/tasks", browser: "/browser", - companion: "/companion", stream: "/stream", apps: "/apps", views: "/views", @@ -385,8 +378,6 @@ const APPS_SUB_TABS: Record = { // tools, but the renderer mounts the tab the original `targetTab` pointed // at (e.g. wallet for steward). inventory: "inventory", - // Note: "companion" is intentionally NOT here — /apps/companion is an app slug - // that AppsView auto-launches as an overlay, not a tool tab. }; export function tabFromPath(pathname: string, basePath = ""): Tab | null { @@ -403,14 +394,6 @@ export function tabFromPath(pathname: string, basePath = ""): Tab | null { return "automations"; } - // Companion disabled unless explicitly feature-flagged - if ( - !COMPANION_ENABLED && - (normalized === "/character-select" || normalized === "/character/select") - ) { - return "chat"; - } - // Apps disabled in production builds — redirect to chat if ( !APPS_ENABLED && @@ -471,7 +454,6 @@ export function tabFromPath(pathname: string, basePath = ""): Tab | null { // `/contacts/tui` that are not built-in tabs; the Views tab can then match // the exact registry path and mount the remote bundle. const knownTab = PATH_TO_TAB.get(normalized); - if (knownTab === "companion") return "views"; if (knownTab) return knownTab; if (APPS_ENABLED && normalized.startsWith("/") && normalized !== "/") { return "views"; @@ -525,8 +507,6 @@ export function titleForTab(tab: Tab): string { return "Camera"; case "browser": return "Browser"; - case "companion": - return "Companion"; case "apps": return "Launcher"; case "views": diff --git a/packages/ui/src/state/AppContext.tsx b/packages/ui/src/state/AppContext.tsx index aa5d5e719a62f..f070f5624b850 100644 --- a/packages/ui/src/state/AppContext.tsx +++ b/packages/ui/src/state/AppContext.tsx @@ -54,7 +54,6 @@ import { useChatComposerDraftPersistence, } from "./ChatComposerContext.hooks"; import { ChatTurnStatusCtx } from "./ChatTurnStatusContext.hooks"; -import { CompanionSceneConfigCtx } from "./CompanionSceneConfigContext.hooks"; import { ConversationMessagesCtx } from "./ConversationMessagesContext.hooks"; import { AppContext, type AppContextValue, type AppState } from "./internal"; import { PtySessionsCtx } from "./PtySessionsContext.hooks"; @@ -150,17 +149,11 @@ function AppProviderInner({ state: { uiTheme, uiThemeMode, - companionVrmPowerMode, - companionAnimateWhenHidden, - companionHalfFramerateMode, backgroundConfig, canUndoBackground, }, setUiTheme, setUiThemeMode, - setCompanionVrmPowerMode, - setCompanionAnimateWhenHidden, - setCompanionHalfFramerateMode, setBackgroundConfig, undoBackgroundConfig, } = displayPrefs; @@ -345,7 +338,6 @@ function AppProviderInner({ chatSendNonceRef, greetingFiredRef, greetingInFlightConversationRef, - companionStaleConversationRefreshRef, autonomousStoreRef, autonomousEventsRef, autonomousLatestEventIdRef, @@ -917,7 +909,6 @@ function AppProviderInner({ activeGamePostMessagePayload, activeGameSession, gameOverlayEnabled, - companionAppRunning, activeOverlayApp, activeInboxChat, activeTerminalSessionId, @@ -1194,7 +1185,6 @@ function AppProviderInner({ const chatCallbacks = useChatCallbacks({ t, uiLanguage, - uiShellMode, tab, agentStatus, chatInput, @@ -1226,7 +1216,6 @@ function AppProviderInner({ chatSendNonceRef, greetingFiredRef, greetingInFlightConversationRef, - companionStaleConversationRefreshRef, lifecycleAction, beginLifecycleAction, finishLifecycleAction, @@ -1409,7 +1398,6 @@ function AppProviderInner({ // ── First-run callbacks (extracted to useFirstRunCallbacks) ────── const firstRunCallbacks = useFirstRunCallbacks({ firstRun, - setActiveOverlayApp, setSetupStep, setFirstRunMode, setFirstRunActiveGuide, @@ -1585,8 +1573,6 @@ function AppProviderInner({ appRuns: setAppRuns, activeGameRunId: setActiveGameRunId, gameOverlayEnabled: setGameOverlayEnabled, - companionAppRunning: (v: boolean) => - setActiveOverlayApp(v ? "@elizaos/plugin-companion" : null), activeOverlayApp: setActiveOverlayApp, activeInboxChat: setActiveInboxChat, activeTerminalSessionId: setActiveTerminalSessionId, @@ -1856,29 +1842,6 @@ function AppProviderInner({ // Cloud auth-rejected effect is now inside useCloudState. - const companionSceneConfig = useMemo( - () => ({ - selectedVrmIndex, - customVrmUrl, - customWorldUrl, - uiTheme, - tab, - companionVrmPowerMode, - companionHalfFramerateMode, - companionAnimateWhenHidden, - }), - [ - selectedVrmIndex, - customVrmUrl, - customWorldUrl, - uiTheme, - tab, - companionVrmPowerMode, - companionHalfFramerateMode, - companionAnimateWhenHidden, - ], - ); - // chatInput/chatSending/chatPendingImages live in ChatComposerContext so that // keystrokes don't cascade through AppContext to all subscribers. const composerValue = useMemo( @@ -1971,9 +1934,6 @@ function AppProviderInner({ uiThemeMode, backgroundConfig, canUndoBackground, - companionVrmPowerMode, - companionAnimateWhenHidden, - companionHalfFramerateMode, connected, agentStatus, firstRunComplete, @@ -2235,7 +2195,6 @@ function AppProviderInner({ activeGamePostMessageAuth, activeGameSession, gameOverlayEnabled, - companionAppRunning, activeOverlayApp, activeInboxChat, activeTerminalSessionId, @@ -2260,9 +2219,6 @@ function AppProviderInner({ setUiThemeMode, setBackgroundConfig, undoBackgroundConfig, - setCompanionVrmPowerMode, - setCompanionAnimateWhenHidden, - setCompanionHalfFramerateMode, handleStart, handleStop, @@ -2390,9 +2346,6 @@ function AppProviderInner({ uiThemeMode, backgroundConfig, canUndoBackground, - companionVrmPowerMode, - companionAnimateWhenHidden, - companionHalfFramerateMode, connected, agentStatus, firstRunComplete, @@ -2661,7 +2614,6 @@ function AppProviderInner({ activeGamePostMessageAuth, activeGameSession, gameOverlayEnabled, - companionAppRunning, activeOverlayApp, activeInboxChat, activeTerminalSessionId, @@ -2686,9 +2638,6 @@ function AppProviderInner({ setUiThemeMode, setBackgroundConfig, undoBackgroundConfig, - setCompanionVrmPowerMode, - setCompanionAnimateWhenHidden, - setCompanionHalfFramerateMode, handleStart, handleStop, handleRestart, @@ -2834,8 +2783,7 @@ function AppProviderInner({ return ( - - + @@ -2850,7 +2798,6 @@ function AppProviderInner({ - ); diff --git a/packages/ui/src/state/CompanionSceneConfigContext.hooks.ts b/packages/ui/src/state/CompanionSceneConfigContext.hooks.ts deleted file mode 100644 index a55daa794d583..0000000000000 --- a/packages/ui/src/state/CompanionSceneConfigContext.hooks.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Lightweight context for companion scene configuration. - * - * CompanionSceneSurface (and VrmStage via its props) only needs a small subset - * of app state — VRM/theme/tab preferences that change rarely. By reading from - * this dedicated context instead of useApp(), those components avoid re-rendering - * on unrelated state changes (WebSocket churn, chat messages, wallet updates, etc.). - * - * The context value is memoized in AppContext.tsx so it only propagates when - * one of its 7 fields actually changes. The context object + hook live here (not - * in the sibling .tsx) so the Provider file stays React Fast Refresh-compatible. - */ - -import { createContext, useContext } from "react"; -import type { Tab } from "../navigation"; -import type { UiTheme } from "./persistence"; -import type { - CompanionHalfFramerateMode, - CompanionVrmPowerMode, -} from "./types"; - -export interface CompanionSceneConfig { - selectedVrmIndex: number; - customVrmUrl: string; - customWorldUrl: string; - uiTheme: UiTheme; - tab: Tab; - companionVrmPowerMode: CompanionVrmPowerMode; - companionHalfFramerateMode: CompanionHalfFramerateMode; - companionAnimateWhenHidden: boolean; -} - -export const CompanionSceneConfigCtx = - createContext(null); - -export function useCompanionSceneConfig(): CompanionSceneConfig { - const ctx = useContext(CompanionSceneConfigCtx); - if (!ctx) { - if (typeof process !== "undefined" && process.env.NODE_ENV === "test") { - return { - selectedVrmIndex: 1, - customVrmUrl: "", - customWorldUrl: "", - uiTheme: "dark", - tab: "chat", - companionVrmPowerMode: "balanced", - companionHalfFramerateMode: "when_saving_power", - companionAnimateWhenHidden: false, - }; - } - throw new Error("useCompanionSceneConfig must be used within AppProvider"); - } - return ctx; -} diff --git a/packages/ui/src/state/app-store.ts b/packages/ui/src/state/app-store.ts index 205b01e48fffd..f7a4f3e99dd25 100644 --- a/packages/ui/src/state/app-store.ts +++ b/packages/ui/src/state/app-store.ts @@ -90,7 +90,6 @@ function getTestFallbackValue(): AppContextValue { get(_target, prop) { if (prop === "t") return identityT; if (prop === "uiLanguage") return "en"; - if (prop === "companionHalfFramerateMode") return "when_saving_power"; if (prop === "navigation") return navigation; return noop; }, diff --git a/packages/ui/src/state/index.ts b/packages/ui/src/state/index.ts index e6baae6276260..4f17ed0501f97 100644 --- a/packages/ui/src/state/index.ts +++ b/packages/ui/src/state/index.ts @@ -10,7 +10,6 @@ export { } from "./app-store"; export * from "./ChatComposerContext.hooks"; export * from "./ChatTurnStatusContext.hooks"; -export * from "./CompanionSceneConfigContext.hooks"; export * from "./ConversationMessagesContext.hooks"; export * from "./internal"; export * from "./PtySessionsContext.hooks"; diff --git a/packages/ui/src/state/internal.ts b/packages/ui/src/state/internal.ts index cf8887d0724d0..1e5e3afcbc136 100644 --- a/packages/ui/src/state/internal.ts +++ b/packages/ui/src/state/internal.ts @@ -38,10 +38,7 @@ export { loadAvatarIndex, loadChatAvatarVisible, loadChatVoiceMuted, - loadCompanionAnimateWhenHidden, - loadCompanionHalfFramerateMode, loadCompanionMessageCutoffTs, - loadCompanionVrmPowerMode, loadLastNativeTab, loadPersistedActiveServer, loadPersistedFirstRunComplete, @@ -49,8 +46,6 @@ export { loadUiLanguage, loadUiShellMode, loadUiTheme, - normalizeCompanionHalfFramerateMode, - normalizeCompanionVrmPowerMode, normalizeUiShellMode, normalizeUiTheme, type PersistedActiveServer, @@ -58,10 +53,7 @@ export { saveAvatarIndex, saveChatAvatarVisible, saveChatVoiceMuted, - saveCompanionAnimateWhenHidden, - saveCompanionHalfFramerateMode, saveCompanionMessageCutoffTs, - saveCompanionVrmPowerMode, saveLastNativeTab, savePersistedActiveServer, savePersistedFirstRunComplete, @@ -90,8 +82,6 @@ export { type AppContextValue, type AppState, type ChatTurnUsage, - type CompanionHalfFramerateMode, - type CompanionVrmPowerMode, FIRST_RUN_PERMISSION_LABELS, type FirstRunMode, type FirstRunNextOptions, diff --git a/packages/ui/src/state/persistence.ts b/packages/ui/src/state/persistence.ts index 65c3ea2a791e0..b730ec43348a3 100644 --- a/packages/ui/src/state/persistence.ts +++ b/packages/ui/src/state/persistence.ts @@ -11,11 +11,7 @@ import { detectClientLanguage } from "../i18n/region"; import type { Tab } from "../navigation"; import { normalizeDirectCloudSharedAgentApiBase } from "../utils/cloud-agent-base"; import { DEFAULT_LOCAL_ASR_AUTO_STOP } from "../voice/local-asr-capture"; -import type { - CompanionHalfFramerateMode, - CompanionVrmPowerMode, - SetupStep, -} from "./types"; +import type { SetupStep } from "./types"; import { type BackgroundConfig, DEFAULT_BACKGROUND_COLOR, @@ -219,150 +215,6 @@ export function saveBackgroundHistory(history: BackgroundConfig[]): void { }, undefined); } -const COMPANION_VRM_POWER_STORAGE_KEY = "eliza:companion-vrm-power"; -/** Legacy; migrated into `eliza:companion-vrm-power` on first read. */ -const LEGACY_COMPANION_EFFICIENCY_KEY = "eliza:companion-efficiency"; -/** Legacy; migrated into `eliza:companion-vrm-power` on first read. */ -const LEGACY_COMPANION_QUALITY_ON_BATTERY_KEY = - "eliza:companion-quality-on-battery"; - -export function normalizeCompanionVrmPowerMode( - value: unknown, -): CompanionVrmPowerMode { - return value === "quality" || value === "efficiency" ? value : "balanced"; -} - -/** - * Persisted 3D companion power preference. Migrates legacy boolean keys once. - */ -export function loadCompanionVrmPowerMode(): CompanionVrmPowerMode { - try { - const raw = localStorage.getItem(COMPANION_VRM_POWER_STORAGE_KEY); - if (raw === "quality" || raw === "balanced" || raw === "efficiency") { - return raw; - } - const legacyEffPresent = - localStorage.getItem(LEGACY_COMPANION_EFFICIENCY_KEY) != null; - const legacyQobPresent = - localStorage.getItem(LEGACY_COMPANION_QUALITY_ON_BATTERY_KEY) != null; - if (legacyEffPresent || legacyQobPresent) { - const effOn = - localStorage.getItem(LEGACY_COMPANION_EFFICIENCY_KEY) === "1"; - const qobOn = - localStorage.getItem(LEGACY_COMPANION_QUALITY_ON_BATTERY_KEY) === "1"; - const migrated: CompanionVrmPowerMode = effOn - ? "efficiency" - : qobOn - ? "quality" - : "balanced"; - saveCompanionVrmPowerMode(migrated); - localStorage.removeItem(LEGACY_COMPANION_EFFICIENCY_KEY); - localStorage.removeItem(LEGACY_COMPANION_QUALITY_ON_BATTERY_KEY); - return migrated; - } - if (raw != null && raw !== "") { - saveCompanionVrmPowerMode("balanced"); - } - return "balanced"; - } catch (err) { - logger.warn( - `[persistence] failed to load companion VRM power mode: ${describePersistenceError(err)}`, - ); - return "balanced"; - } -} - -export function saveCompanionVrmPowerMode(mode: CompanionVrmPowerMode): void { - try { - const next = normalizeCompanionVrmPowerMode(mode); - localStorage.setItem(COMPANION_VRM_POWER_STORAGE_KEY, next); - localStorage.removeItem(LEGACY_COMPANION_EFFICIENCY_KEY); - localStorage.removeItem(LEGACY_COMPANION_QUALITY_ON_BATTERY_KEY); - } catch (err) { - logger.warn( - `[persistence] failed to save companion VRM power mode: ${describePersistenceError(err)}`, - ); - } -} - -const COMPANION_ANIMATE_WHEN_HIDDEN_KEY = "eliza:companion-animate-when-hidden"; - -/** When true, keep the VRM loop running when the document is hidden; 3D environment is hidden. */ -export function loadCompanionAnimateWhenHidden(): boolean { - try { - return localStorage.getItem(COMPANION_ANIMATE_WHEN_HIDDEN_KEY) === "1"; - } catch (err) { - logger.warn( - `[persistence] failed to load companion animate-when-hidden flag: ${describePersistenceError(err)}`, - ); - return false; - } -} - -export function saveCompanionAnimateWhenHidden(enabled: boolean): void { - try { - localStorage.setItem( - COMPANION_ANIMATE_WHEN_HIDDEN_KEY, - enabled ? "1" : "0", - ); - } catch (err) { - logger.warn( - `[persistence] failed to save companion animate-when-hidden flag: ${describePersistenceError(err)}`, - ); - } -} - -const COMPANION_HALF_FRAMERATE_STORAGE_KEY = "eliza:companion-half-framerate"; - -const COMPANION_HALF_FRAMERATE_VALUES = new Set([ - "off", - "when_saving_power", - "always", -]); - -function isCompanionHalfFramerateMode( - value: unknown, -): value is CompanionHalfFramerateMode { - return ( - typeof value === "string" && COMPANION_HALF_FRAMERATE_VALUES.has(value) - ); -} - -export function normalizeCompanionHalfFramerateMode( - raw: string | null | undefined, -): CompanionHalfFramerateMode { - if (isCompanionHalfFramerateMode(raw)) return raw; - return "when_saving_power"; -} - -export function loadCompanionHalfFramerateMode(): CompanionHalfFramerateMode { - try { - return normalizeCompanionHalfFramerateMode( - localStorage.getItem(COMPANION_HALF_FRAMERATE_STORAGE_KEY), - ); - } catch (err) { - logger.warn( - `[persistence] failed to load companion half-framerate mode: ${describePersistenceError(err)}`, - ); - return "when_saving_power"; - } -} - -export function saveCompanionHalfFramerateMode( - mode: CompanionHalfFramerateMode, -): void { - try { - localStorage.setItem( - COMPANION_HALF_FRAMERATE_STORAGE_KEY, - normalizeCompanionHalfFramerateMode(mode), - ); - } catch (err) { - logger.warn( - `[persistence] failed to save companion half-framerate mode: ${describePersistenceError(err)}`, - ); - } -} - /** * Apply the theme to the document root. * Sets both `data-theme` attribute and `.dark` class so both CSS selectors @@ -550,8 +402,8 @@ export function hasStoredUiLanguage(): boolean { ); } -function normalizeUiShellMode(mode: unknown): UiShellMode { - return mode === "native" ? "native" : "companion"; +function normalizeUiShellMode(_mode: unknown): UiShellMode { + return "native"; } export { normalizeUiShellMode }; @@ -559,7 +411,7 @@ export { normalizeUiShellMode }; export function loadUiShellMode(): UiShellMode { return tryLocalStorage( () => normalizeUiShellMode(localStorage.getItem(UI_SHELL_MODE_STORAGE_KEY)), - "companion", + "native", ); } diff --git a/packages/ui/src/state/shell-routing.ts b/packages/ui/src/state/shell-routing.ts index 8909688bdc840..5f4ed79a4bdf1 100644 --- a/packages/ui/src/state/shell-routing.ts +++ b/packages/ui/src/state/shell-routing.ts @@ -2,23 +2,19 @@ import type { Tab } from "../navigation"; import type { FirstRunMode, ShellView } from "./types"; import type { UiShellMode } from "./ui-preferences"; -export function deriveUiShellModeForTab(tab: Tab): UiShellMode { - return tab === "companion" ? "companion" : "native"; +export function deriveUiShellModeForTab(_tab: Tab): UiShellMode { + return "native"; } export function getTabForShellView(view: ShellView, lastNativeTab: Tab): Tab { - if (view === "companion") { - return "companion"; - } - if (view === "character") { return "character"; } - // Guard against companion-only tabs leaking into native/desktop mode. + // Guard against the character-select tab leaking into native/desktop mode. // lastNativeTab should already be sanitized by normalizeLastNativeTab, - // but be defensive: character-select and companion are never valid here. - if (lastNativeTab === "character-select" || lastNativeTab === "companion") { + // but be defensive: character-select is never valid here. + if (lastNativeTab === "character-select") { return "chat"; } diff --git a/packages/ui/src/state/startup-phase-hydrate.ts b/packages/ui/src/state/startup-phase-hydrate.ts index 90eb66f3ecd70..2107baeb289b0 100644 --- a/packages/ui/src/state/startup-phase-hydrate.ts +++ b/packages/ui/src/state/startup-phase-hydrate.ts @@ -269,7 +269,7 @@ export async function runHydrating( void deps.loadCharacter(); } else if (isRoot) deps.setTab(resolveDefaultLandingTab()); } - if (urlTab && urlTab !== "chat" && urlTab !== "companion") { + if (urlTab && urlTab !== "chat") { deps.setTabRaw(urlTab); if (urlTab === "plugins") { void deps.loadPlugins(); diff --git a/packages/ui/src/state/types.ts b/packages/ui/src/state/types.ts index 92adb767c7494..7efd9a3e0f66b 100644 --- a/packages/ui/src/state/types.ts +++ b/packages/ui/src/state/types.ts @@ -84,24 +84,7 @@ import type { export type { UiShellMode } from "./ui-preferences"; -/** 3D companion render power: full quality, OS/battery-aware default, or always efficient. */ -export type CompanionVrmPowerMode = "quality" | "balanced" | "efficiency"; - -/** When to cap the companion VRM loop at ~half the display refresh rate. */ -export type CompanionHalfFramerateMode = "off" | "when_saving_power" | "always"; -export type ShellView = "companion" | "character" | "desktop"; - -/** - * Optional flags for {@link AppActions.completeFirstRun} when finishing the - * first-run setup. - */ -export interface CompleteFirstRunOptions { - /** - * When true, opens the `@elizaos/plugin-companion` overlay and syncs the URL to - * `/apps/companion`. Ignored when companion mode or the apps surface is disabled. - */ - launchCompanionOverlay?: boolean; -} +export type ShellView = "character" | "desktop"; /** Deferred work scheduling for multi-step navigation. */ export interface NavigationEventsApi { @@ -353,15 +336,6 @@ export interface AppState { /** True when there is a previous background config to undo to. */ canUndoBackground: boolean; ownerName: string | null; - /** VRM quality vs GPU use: always full quality, battery-aware (default), or always efficient. */ - companionVrmPowerMode: CompanionVrmPowerMode; - /** - * When true and the document is hidden, keep the VRM render loop alive - * but hide the 3D environment (lower GPU than full scene). - */ - companionAnimateWhenHidden: boolean; - /** When to cap companion at ~half display Hz (independent of DPR/shadows). */ - companionHalfFramerateMode: CompanionHalfFramerateMode; connected: boolean; agentStatus: AgentStatus | null; firstRunComplete: boolean; @@ -734,8 +708,6 @@ export interface AppState { /** When true, the game iframe persists as a floating overlay across all tabs. */ gameOverlayEnabled: boolean; - /** When true, the companion app is actively running (full-screen VRM scene). */ - companionAppRunning: boolean; /** Name of the active full-screen overlay app, or null if none. */ activeOverlayApp: string | null; @@ -801,9 +773,6 @@ export interface AppActions { setBackgroundConfig: (config: BackgroundConfig) => void; /** Restore the most recent previous background config (no-op when empty). */ undoBackgroundConfig: () => void; - setCompanionVrmPowerMode: (mode: CompanionVrmPowerMode) => void; - setCompanionAnimateWhenHidden: (enabled: boolean) => void; - setCompanionHalfFramerateMode: (mode: CompanionHalfFramerateMode) => void; // Lifecycle handleStart: () => Promise; @@ -1007,14 +976,8 @@ export interface AppActions { * Dispatches FIRST_RUN_COMPLETE to the startup coordinator. * * The full first-run flow passes an explicit landing tab when needed. - * - * Passing `{ launchCompanionOverlay: true }` lands first-time setup in - * `@elizaos/plugin-companion` at `/apps/companion`. */ - completeFirstRun: ( - landingTab?: Tab, - options?: CompleteFirstRunOptions, - ) => void; + completeFirstRun: (landingTab?: Tab) => void; // Cloud handleCloudLogin: (prePoppedWindow?: Window | null) => Promise; diff --git a/packages/ui/src/state/ui-preferences.ts b/packages/ui/src/state/ui-preferences.ts index f20cefe32b854..ce3123817d0e8 100644 --- a/packages/ui/src/state/ui-preferences.ts +++ b/packages/ui/src/state/ui-preferences.ts @@ -7,7 +7,7 @@ export type UiTheme = "light" | "dark"; */ export type UiThemeMode = "light" | "dark" | "system"; -export type UiShellMode = "companion" | "native"; +export type UiShellMode = "native"; /** * How the unified app background is rendered. `shader` paints the animated diff --git a/packages/ui/src/state/useApp.ts b/packages/ui/src/state/useApp.ts index b857d77464d39..ba4a660a27a7a 100644 --- a/packages/ui/src/state/useApp.ts +++ b/packages/ui/src/state/useApp.ts @@ -25,7 +25,6 @@ export function useApp(): AppContextValue { get(_, prop) { if (prop === "t") return (k: string) => k; if (prop === "uiLanguage") return "en"; - if (prop === "companionHalfFramerateMode") return "when_saving_power"; if (prop === "navigation") { return { scheduleAfterTabCommit: (fn: () => void) => { diff --git a/packages/ui/src/state/useChatCallbacks.ts b/packages/ui/src/state/useChatCallbacks.ts index 07f64954e9bdf..01191501326b0 100644 --- a/packages/ui/src/state/useChatCallbacks.ts +++ b/packages/ui/src/state/useChatCallbacks.ts @@ -24,7 +24,7 @@ import { isConversationRecord, normalizeConversationList, } from "./chat-conversation-guards"; -import type { AppState, LifecycleAction, UiShellMode } from "./internal"; +import type { AppState, LifecycleAction } from "./internal"; import { type LoadConversationMessagesResult, loadActiveConversationId, @@ -79,11 +79,6 @@ function traceGreeting(phase: string, detail?: Record): void { } } -import { isRoutineCodingAgentMessage } from "../chat"; - -const COMPANION_STALE_THREAD_MAX_AGE_MS = 30 * 60 * 1000; -const COMPANION_STALE_THREAD_VISIBLE_MESSAGE_LIMIT = 2; - function isPersistedGreetingMessage(message: ConversationMessage): boolean { return ( message.role === "assistant" && @@ -324,34 +319,6 @@ export async function hydrateInitialConversation( } } -function shouldStartFreshCompanionConversation( - messages: ConversationMessage[], - now = Date.now(), -): boolean { - const visibleMessages = messages - .filter((message) => shouldKeepConversationMessage(message)) - .filter((message) => !isRoutineCodingAgentMessage(message)) - .slice(-COMPANION_STALE_THREAD_VISIBLE_MESSAGE_LIMIT); - - if (visibleMessages.length === 0) { - return false; - } - - if ( - visibleMessages.length === 1 && - isPersistedGreetingMessage(visibleMessages[0]) - ) { - return false; - } - - return visibleMessages.every((message) => { - if (!Number.isFinite(message.timestamp)) { - return false; - } - return now - message.timestamp > COMPANION_STALE_THREAD_MAX_AGE_MS; - }); -} - // ── Deps interface ────────────────────────────────────────────────── export interface UseChatCallbacksDeps { @@ -360,7 +327,6 @@ export interface UseChatCallbacksDeps { // UI state uiLanguage: string; - uiShellMode: UiShellMode; tab: Tab; // Agent status @@ -415,7 +381,6 @@ export interface UseChatCallbacksDeps { chatSendNonceRef: MutableRefObject; greetingFiredRef: MutableRefObject; greetingInFlightConversationRef: MutableRefObject; - companionStaleConversationRefreshRef: MutableRefObject; // Lifecycle lifecycleAction: LifecycleAction | null; @@ -519,7 +484,6 @@ export function useChatCallbacks(deps: UseChatCallbacksDeps) { const { t, uiLanguage, - uiShellMode, tab, agentStatus, activeConversationId, @@ -549,7 +513,6 @@ export function useChatCallbacks(deps: UseChatCallbacksDeps) { chatSendNonceRef, greetingFiredRef, greetingInFlightConversationRef, - companionStaleConversationRefreshRef, lifecycleAction, beginLifecycleAction, finishLifecycleAction, @@ -1062,35 +1025,6 @@ export function useChatCallbacks(deps: UseChatCallbacksDeps) { ], ); - useEffect(() => { - if (uiShellMode !== "companion" || tab !== "companion") { - companionStaleConversationRefreshRef.current = null; - return; - } - - if (!activeConversationId) { - return; - } - - if (!shouldStartFreshCompanionConversation(conversationMessages)) { - companionStaleConversationRefreshRef.current = null; - return; - } - - if (companionStaleConversationRefreshRef.current === activeConversationId) { - return; - } - - companionStaleConversationRefreshRef.current = activeConversationId; - void handleNewConversation(); - }, [ - activeConversationId, - conversationMessages, - handleNewConversation, - tab, - uiShellMode, - companionStaleConversationRefreshRef, - ]); const handleSelectConversation = useCallback( async (id: string) => { diff --git a/packages/ui/src/state/useChatState.ts b/packages/ui/src/state/useChatState.ts index 3f528692a92f2..dd692aaf9c771 100644 --- a/packages/ui/src/state/useChatState.ts +++ b/packages/ui/src/state/useChatState.ts @@ -211,7 +211,6 @@ export interface ChatStateHook { chatSendNonceRef: React.MutableRefObject; greetingFiredRef: React.RefObject; greetingInFlightConversationRef: React.RefObject; - companionStaleConversationRefreshRef: React.RefObject; // Autonomy refs autonomousStoreRef: React.MutableRefObject; @@ -240,7 +239,6 @@ export function useChatState(): ChatStateHook { const chatSendNonceRef = useRef(0); const greetingFiredRef = useRef(false); const greetingInFlightConversationRef = useRef(null); - const companionStaleConversationRefreshRef = useRef(null); // Autonomy refs const autonomousStoreRef = useRef({ @@ -421,7 +419,6 @@ export function useChatState(): ChatStateHook { chatSendNonceRef, greetingFiredRef, greetingInFlightConversationRef, - companionStaleConversationRefreshRef, autonomousStoreRef, autonomousEventsRef, autonomousLatestEventIdRef, diff --git a/packages/ui/src/state/useDisplayPreferences.ts b/packages/ui/src/state/useDisplayPreferences.ts index 44a371773e98b..f4ed78a20fb30 100644 --- a/packages/ui/src/state/useDisplayPreferences.ts +++ b/packages/ui/src/state/useDisplayPreferences.ts @@ -1,5 +1,5 @@ /** - * Display preferences — theme and companion rendering settings. + * Display preferences — theme and background settings. * * Extracted from AppContext. Each preference persists to localStorage * and normalizes on set. @@ -11,28 +11,16 @@ import { getSystemTheme, loadBackgroundConfig, loadBackgroundHistory, - loadCompanionAnimateWhenHidden, - loadCompanionHalfFramerateMode, - loadCompanionVrmPowerMode, loadUiThemeMode, MAX_BACKGROUND_HISTORY, normalizeBackgroundConfig, - normalizeCompanionHalfFramerateMode, - normalizeCompanionVrmPowerMode, normalizeUiThemeMode, resolveUiTheme, saveBackgroundConfig, saveBackgroundHistory, - saveCompanionAnimateWhenHidden, - saveCompanionHalfFramerateMode, - saveCompanionVrmPowerMode, saveUiTheme, saveUiThemeMode, } from "./persistence"; -import type { - CompanionHalfFramerateMode, - CompanionVrmPowerMode, -} from "./types"; import { type BackgroundConfig, backgroundConfigsEqual, @@ -46,12 +34,6 @@ export function useDisplayPreferences() { const [uiTheme, setUiThemeState] = useState(() => resolveUiTheme(loadUiThemeMode()), ); - const [companionVrmPowerMode, setCompanionVrmPowerModeState] = - useState(loadCompanionVrmPowerMode); - const [companionAnimateWhenHidden, setCompanionAnimateWhenHiddenState] = - useState(loadCompanionAnimateWhenHidden); - const [companionHalfFramerateMode, setCompanionHalfFramerateModeState] = - useState(loadCompanionHalfFramerateMode); const [backgroundConfig, setBackgroundConfigState] = useState(loadBackgroundConfig); // Bounded undo stack: the previous configs, most-recent last. Refs mirror the @@ -78,26 +60,6 @@ export function useDisplayPreferences() { [setUiThemeMode], ); - const setCompanionVrmPowerMode = useCallback( - (mode: CompanionVrmPowerMode) => { - setCompanionVrmPowerModeState(normalizeCompanionVrmPowerMode(mode)); - }, - [], - ); - - const setCompanionAnimateWhenHidden = useCallback((enabled: boolean) => { - setCompanionAnimateWhenHiddenState(enabled); - }, []); - - const setCompanionHalfFramerateMode = useCallback( - (mode: CompanionHalfFramerateMode) => { - setCompanionHalfFramerateModeState( - normalizeCompanionHalfFramerateMode(mode), - ); - }, - [], - ); - // Setting pushes the outgoing config onto the undo stack (unless unchanged). const setBackgroundConfig = useCallback((config: BackgroundConfig) => { const next = normalizeBackgroundConfig(config); @@ -143,18 +105,6 @@ export function useDisplayPreferences() { applyUiTheme(uiTheme); }, [uiTheme]); - useEffect(() => { - saveCompanionVrmPowerMode(companionVrmPowerMode); - }, [companionVrmPowerMode]); - - useEffect(() => { - saveCompanionAnimateWhenHidden(companionAnimateWhenHidden); - }, [companionAnimateWhenHidden]); - - useEffect(() => { - saveCompanionHalfFramerateMode(companionHalfFramerateMode); - }, [companionHalfFramerateMode]); - useEffect(() => { saveBackgroundConfig(backgroundConfig); }, [backgroundConfig]); @@ -167,17 +117,11 @@ export function useDisplayPreferences() { state: { uiTheme, uiThemeMode, - companionVrmPowerMode, - companionAnimateWhenHidden, - companionHalfFramerateMode, backgroundConfig, canUndoBackground: backgroundHistory.length > 0, }, setUiTheme, setUiThemeMode, - setCompanionVrmPowerMode, - setCompanionAnimateWhenHidden, - setCompanionHalfFramerateMode, setBackgroundConfig, undoBackgroundConfig, }; diff --git a/packages/ui/src/state/useFirstRunCallbacks.ts b/packages/ui/src/state/useFirstRunCallbacks.ts index bc725398e038a..f75abed1bfe49 100644 --- a/packages/ui/src/state/useFirstRunCallbacks.ts +++ b/packages/ui/src/state/useFirstRunCallbacks.ts @@ -39,14 +39,14 @@ import { resolveSetupPreviousStep, } from "../first-run/setup-steps"; import type { UiLanguage } from "../i18n"; -import { APPS_ENABLED, COMPANION_ENABLED, type Tab } from "../navigation"; +import type { Tab } from "../navigation"; import { clearPersistedActiveServer, clearPersistedSetupStep, createPersistedActiveServer, savePersistedActiveServer, } from "./internal"; -import type { AppState, CompleteFirstRunOptions, SetupStep } from "./types"; +import type { AppState, SetupStep } from "./types"; import type { FirstRunStateHook } from "./useFirstRunState"; // ── Helpers copied from AppContext (module-level, no React deps) ────────── @@ -70,24 +70,6 @@ function isPrivateNetworkHost(host: string): boolean { return false; } -function replaceNavigationPathForCompanionLaunch(): void { - if (typeof window === "undefined") return; - const path = "/apps/companion"; - try { - if (window.location.protocol === "file:") { - window.location.hash = path; - } else { - window.history.replaceState( - null, - "", - `${path}${window.location.search}${window.location.hash}`, - ); - } - } catch { - /* ignore — sandboxed iframe */ - } -} - function normalizeRemoteApiBaseInput(rawValue: string): string { const trimmed = rawValue.trim(); if (!trimmed) { @@ -119,8 +101,6 @@ export interface FirstRunCallbacksDeps { /** Full result of useFirstRunState — state + all dispatch helpers. */ firstRun: FirstRunStateHook; - setActiveOverlayApp: (appName: string | null) => void; - /** * Compat setter functions that already wrap firstRun.setField / dispatch. * Passed in from AppContext so we don't duplicate them here. @@ -173,7 +153,6 @@ export interface FirstRunCallbacksDeps { export function useFirstRunCallbacks(deps: FirstRunCallbacksDeps) { const { firstRun, - setActiveOverlayApp, setSetupStep, setFirstRunMode: _setFirstRunMode, setFirstRunActiveGuide, @@ -219,10 +198,7 @@ export function useFirstRunCallbacks(deps: FirstRunCallbacksDeps) { // ── completeFirstRun ──────────────────────────────────────────── const completeFirstRun = useCallback( - ( - landingTab: Tab = defaultLandingTab, - options?: CompleteFirstRunOptions, - ) => { + (landingTab: Tab = defaultLandingTab) => { clearPersistedSetupStep(); firstRunCompletionCommittedRef.current = true; _setFirstRunMode("basic"); @@ -237,17 +213,7 @@ export function useFirstRunCallbacks(deps: FirstRunCallbacksDeps) { setFirstRunComplete(true); coordinatorFirstRunCompleteRef.current?.(); initialTabSetRef.current = true; - const launchCompanionOverlay = - options?.launchCompanionOverlay === true && - COMPANION_ENABLED && - APPS_ENABLED; - if (launchCompanionOverlay && landingTab !== "chat") { - setActiveOverlayApp("@elizaos/plugin-companion"); - replaceNavigationPathForCompanionLaunch(); - setTab("apps"); - } else { - setTab(landingTab); - } + setTab(landingTab); void loadCharacter(); }, [ @@ -258,7 +224,6 @@ export function useFirstRunCallbacks(deps: FirstRunCallbacksDeps) { setFirstRunDetectedProviders, _setFirstRunMode, setPostFirstRunChecklistDismissed, - setActiveOverlayApp, setTab, defaultLandingTab, loadCharacter, diff --git a/packages/ui/src/state/useMiscUiState.ts b/packages/ui/src/state/useMiscUiState.ts index bd40d21cdc90c..86b24f2b71ef3 100644 --- a/packages/ui/src/state/useMiscUiState.ts +++ b/packages/ui/src/state/useMiscUiState.ts @@ -92,7 +92,6 @@ export function useMiscUiState() { }, []); const [gameOverlayEnabled, setGameOverlayEnabled] = useState(false); const [activeOverlayApp, setActiveOverlayApp] = useState(null); - const companionAppRunning = activeOverlayApp === "@elizaos/plugin-companion"; const activeGameRun = useMemo( () => appRuns.find((run) => run.runId === activeGameRunId) ?? null, @@ -177,7 +176,6 @@ export function useMiscUiState() { activeGamePostMessagePayload, activeGameSession, gameOverlayEnabled, - companionAppRunning, activeOverlayApp, activeInboxChat, activeTerminalSessionId, diff --git a/packages/ui/src/state/useNavigationState.ts b/packages/ui/src/state/useNavigationState.ts index 8adf377088f45..541d3372e857c 100644 --- a/packages/ui/src/state/useNavigationState.ts +++ b/packages/ui/src/state/useNavigationState.ts @@ -18,7 +18,6 @@ import { pathForTab, shouldUseHashNavigation, type Tab } from "../navigation"; import { isNavAllowed } from "../navigation/nav-lock"; import { loadLastNativeTab, - normalizeUiShellMode, type ShellView, saveLastNativeTab, saveUiShellMode, @@ -98,39 +97,19 @@ export function useNavigationState(deps: NavigationStateDeps) { // ── Shell mode toggles ────────────────────────────────────────────── const setUiShellMode = useCallback( - (mode: UiShellMode) => { - const nextMode = normalizeUiShellMode(mode); - if (nextMode === "companion") { - setTab("companion"); - return; - } + (_mode: UiShellMode) => { setTab(lastNativeTab); }, [lastNativeTab, setTab], ); useEffect(() => { - // Remember all tabs except companion (which is now an app overlay, not a nav tab). - if (tab === "companion") { - return; - } setLastNativeTabState((prev) => (prev === tab ? prev : tab)); }, [tab]); - const switchUiShellMode = useCallback( - (mode: UiShellMode) => { - const nextMode = normalizeUiShellMode(mode); - if (nextMode === uiShellMode) { - return; - } - if (nextMode === "native") { - setTab(lastNativeTab); - return; - } - setTab("companion"); - }, - [lastNativeTab, setTab, uiShellMode], - ); + const switchUiShellMode = useCallback((_mode: UiShellMode) => { + // Only one shell mode remains ("native"); nothing to switch. + }, []); const switchShellView = useCallback( (view: ShellView) => { diff --git a/packages/ui/src/storybook/mock-providers.tsx b/packages/ui/src/storybook/mock-providers.tsx index 41362a26def1b..619f62528587b 100644 --- a/packages/ui/src/storybook/mock-providers.tsx +++ b/packages/ui/src/storybook/mock-providers.tsx @@ -36,7 +36,6 @@ const baseMockApp: Partial = { commandActiveIndex: 0, commandPaletteOpen: false, commandQuery: "", - companionHalfFramerateMode: "when_saving_power", dismissBackendDisconnectedBanner: noop, dismissSystemWarning: noop, actionBanner: null, diff --git a/packages/ui/src/widgets/registry.ts b/packages/ui/src/widgets/registry.ts index 27aa2c370a3d3..9c2924ae9e412 100644 --- a/packages/ui/src/widgets/registry.ts +++ b/packages/ui/src/widgets/registry.ts @@ -135,13 +135,6 @@ const APP_HOME_DEFAULT_WIDGET_DECLARATIONS: PluginWidgetDeclaration[] = ( defaultWidget: "notifications", signalKinds: ["blocked", "reminder", "notification"], }, - { - pluginId: "companion", - label: "Companion", - icon: "Sparkles", - defaultWidget: "activity", - signalKinds: ["check-in", "nudge", "activity"], - }, { pluginId: "contacts", label: "Contacts", diff --git a/packages/ui/stories/src/stories/feature-surfaces.tsx b/packages/ui/stories/src/stories/feature-surfaces.tsx index b1f4997455197..876f01b83bd79 100644 --- a/packages/ui/stories/src/stories/feature-surfaces.tsx +++ b/packages/ui/stories/src/stories/feature-surfaces.tsx @@ -14,20 +14,6 @@ import { type VoiceUpdatePreferencesView, } from "@ui-src/components/local-inference/ModelUpdatesPanel.tsx"; import { PermissionRecoveryCallout } from "@ui-src/components/permissions/PermissionRecoveryCallout.tsx"; -import { ApprovedAddressesSection } from "@ui-src/components/policy-controls/ApprovedAddressesSection.tsx"; -import { AutoApproveSection } from "@ui-src/components/policy-controls/AutoApproveSection.tsx"; -import { PolicyToggle } from "@ui-src/components/policy-controls/PolicyToggle.tsx"; -import { RateLimitSection } from "@ui-src/components/policy-controls/RateLimitSection.tsx"; -import { SpendingLimitSection } from "@ui-src/components/policy-controls/SpendingLimitSection.tsx"; -import { TimeWindowSection } from "@ui-src/components/policy-controls/TimeWindowSection.tsx"; -import type { - ApprovedAddressesConfig, - AutoApproveConfig, - RateLimitConfig, - SpendingLimitConfig, - TimeWindowConfig, -} from "@ui-src/components/policy-controls/types.ts"; -import { ShieldCheck } from "lucide-react"; import { useState } from "react"; import type { StoryDefinition } from "../Story.tsx"; @@ -228,92 +214,6 @@ function ModelUpdatesStory() { ); } -function PolicyToggleStory() { - const [enabled, setEnabled] = useState(true); - return ( -
- -

- Expanded content renders only when the policy is enabled. -

-
-
- ); -} - -function RateLimitStory() { - const [config, setConfig] = useState({ - maxTxPerHour: 12, - maxTxPerDay: 80, - }); - return ( -
- -
- ); -} - -function SpendingLimitStory() { - const [config, setConfig] = useState({ - maxPerTx: "25", - maxPerDay: "250", - maxPerWeek: "1000", - }); - return ( -
- -
- ); -} - -function AutoApproveStory() { - const [config, setConfig] = useState({ - threshold: "5", - }); - return ( -
- -
- ); -} - -function TimeWindowStory() { - const [config, setConfig] = useState({ - allowedHours: [{ start: 9, end: 17 }], - allowedDays: [1, 2, 3, 4, 5], - timezone: "America/New_York", - }); - return ( -
- -
- ); -} - -function ApprovedAddressesStory() { - const [config, setConfig] = useState({ - mode: "whitelist", - addresses: [ - { - address: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", - label: "Treasury", - }, - ], - labels: {}, - }); - return ( -
- -
- ); -} - function PermissionRecoveryStory() { return (
@@ -381,48 +281,6 @@ export const featureSurfaceStories: StoryDefinition[] = [ 'import { ModelUpdatesPanel } from "@elizaos/ui/components/local-inference/ModelUpdatesPanel"', render: () => , }, - { - id: "feature-policy-toggle", - name: "PolicyToggle", - importPath: - 'import { PolicyToggle } from "@elizaos/ui/components/policy-controls/PolicyToggle"', - render: () => , - }, - { - id: "feature-rate-limit-section", - name: "RateLimitSection", - importPath: - 'import { RateLimitSection } from "@elizaos/ui/components/policy-controls/RateLimitSection"', - render: () => , - }, - { - id: "feature-spending-limit-section", - name: "SpendingLimitSection", - importPath: - 'import { SpendingLimitSection } from "@elizaos/ui/components/policy-controls/SpendingLimitSection"', - render: () => , - }, - { - id: "feature-auto-approve-section", - name: "AutoApproveSection", - importPath: - 'import { AutoApproveSection } from "@elizaos/ui/components/policy-controls/AutoApproveSection"', - render: () => , - }, - { - id: "feature-time-window-section", - name: "TimeWindowSection", - importPath: - 'import { TimeWindowSection } from "@elizaos/ui/components/policy-controls/TimeWindowSection"', - render: () => , - }, - { - id: "feature-approved-addresses-section", - name: "ApprovedAddressesSection", - importPath: - 'import { ApprovedAddressesSection } from "@elizaos/ui/components/policy-controls/ApprovedAddressesSection"', - render: () => , - }, { id: "feature-permission-recovery-callout", name: "PermissionRecoveryCallout", diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json index 9037fddb8363c..9427d51a2c721 100644 --- a/packages/ui/tsconfig.json +++ b/packages/ui/tsconfig.json @@ -70,9 +70,6 @@ "../plugin-worker-runtime/src/index.ts" ], "@elizaos/plugin-worker-runtime/*": ["../plugin-worker-runtime/src/*"], - "@elizaos/plugin-companion": [ - "../../plugins/plugin-companion/src/index.ts" - ], "@capacitor/app": [ "../app/node_modules/@capacitor/app/dist/esm/index.d.ts" ], @@ -137,12 +134,7 @@ "@elizaos/*": ["../../node_modules/@elizaos/*"] } }, - "exclude": [ - "src/**/*.stories.ts", - "src/**/*.stories.tsx", - "../../plugins/plugin-companion/src/**/*.stories.tsx", - "../../plugins/plugin-companion/src/**/*.stories.ts" - ], + "exclude": ["src/**/*.stories.ts", "src/**/*.stories.tsx"], "include": [ "src", "../app-core/src/ambient-modules.d.ts", diff --git a/packages/vault/test/profiles.test.ts b/packages/vault/test/profiles.test.ts index b0d879437fab6..4852e9b2a9c89 100644 --- a/packages/vault/test/profiles.test.ts +++ b/packages/vault/test/profiles.test.ts @@ -139,7 +139,7 @@ describe("profiles — resolveActiveValue", () => { rules: [ { keyPattern: KEY, - scope: { kind: "app", appName: "@elizaos/plugin-companion" }, + scope: { kind: "app", appName: "@elizaos/plugin-feed" }, profileId: "for-app", }, { @@ -152,7 +152,7 @@ describe("profiles — resolveActiveValue", () => { expect( await resolveActiveValue(vault, KEY, { - appName: "@elizaos/plugin-companion", + appName: "@elizaos/plugin-feed", }), ).toBe("sk-app"); expect( diff --git a/plugins/app-model-tester/tsconfig.json b/plugins/app-model-tester/tsconfig.json index 86d19e87cd01d..0d1ed023e8d0d 100644 --- a/plugins/app-model-tester/tsconfig.json +++ b/plugins/app-model-tester/tsconfig.json @@ -27,7 +27,6 @@ "@elizaos/ui/*": ["../../packages/ui/src/*"], "@elizaos/shared": ["../../packages/shared/src/index.ts"], "@elizaos/shared/*": ["../../packages/shared/src/*"], - "lucide-react": ["../plugin-companion/node_modules/lucide-react"], "react": ["../../packages/app-core/node_modules/@types/react/index.d.ts"], "react/jsx-runtime": [ "../../packages/app-core/node_modules/@types/react/jsx-runtime.d.ts" diff --git a/plugins/plugin-app-control/src/actions/app-launch.ts b/plugins/plugin-app-control/src/actions/app-launch.ts index 82ec3ec46c527..6aea9797610fb 100644 --- a/plugins/plugin-app-control/src/actions/app-launch.ts +++ b/plugins/plugin-app-control/src/actions/app-launch.ts @@ -27,7 +27,7 @@ export async function runLaunch({ const target = extractLaunchTarget(message, options); if (!target) { const text = - 'I need the app name to launch. Try: "launch shopify" or pass { app: "companion" }.'; + 'I need the app name to launch. Try: "launch shopify" or pass { app: "feed" }.'; await callback?.({ text }); return { success: false, text }; } diff --git a/plugins/plugin-app-control/src/actions/app.ts b/plugins/plugin-app-control/src/actions/app.ts index 70da3d2838ccf..ac5dc6f2b803b 100644 --- a/plugins/plugin-app-control/src/actions/app.ts +++ b/plugins/plugin-app-control/src/actions/app.ts @@ -360,7 +360,7 @@ export function createAppAction(deps: AppActionDeps = {}): Action { { name: "{{agentName}}", content: { - text: "Installed apps (2):\n - Shopify (shopify) — running x1 [run_abc]\n - Companion (companion)", + text: "Installed apps (2):\n - Shopify (shopify) — running x1 [run_abc]\n - Feed (feed)", action: "APP", }, }, diff --git a/plugins/plugin-app-control/src/actions/view-command-matcher.test.ts b/plugins/plugin-app-control/src/actions/view-command-matcher.test.ts index 185799c9677b6..384094a7754e9 100644 --- a/plugins/plugin-app-control/src/actions/view-command-matcher.test.ts +++ b/plugins/plugin-app-control/src/actions/view-command-matcher.test.ts @@ -31,7 +31,6 @@ describe("matchViewCommand — explicit user examples", () => { ["show my files", "documents"], ["switch to focus mode", "focus"], ["open my goals", "goals"], - ["show me my companion", "companion"], ]; for (const [text, view] of cases) { it(`"${text}" → ${view}`, () => { @@ -107,8 +106,6 @@ describe("matchViewCommand — precision (must NOT match)", () => { "can you summarize this article", "i love using this app", "remind me to call mom", // a task, not a view command - "run the companion avatar wave emote action", - "make my avatar wave", "how are you doing today", "", " ", diff --git a/plugins/plugin-app-control/src/actions/view-command-matcher.ts b/plugins/plugin-app-control/src/actions/view-command-matcher.ts index d9431f3a7b80e..4ffef9882802e 100644 --- a/plugins/plugin-app-control/src/actions/view-command-matcher.ts +++ b/plugins/plugin-app-control/src/actions/view-command-matcher.ts @@ -631,24 +631,6 @@ const VIEW_NOUNS: Record = { "danh bạ", "liên hệ", ], - companion: [ - "companion", - "avatar", - "vrm", - "compañero", - "companero", - "companheiro", - "compagnon", - "begleiter", - "伙伴", - "化身", - "コンパニオン", - "アバター", - "동반자", - "아바타", - "người đồng hành", - "nguoi dong hanh", - ], chat: [ "home", "home screen", @@ -816,7 +798,6 @@ const VIEW_PRIORITY = [ "health", "todos", "notes", - "companion", "character", "plugins-page", "camera", diff --git a/plugins/plugin-app-control/src/actions/views-show.ts b/plugins/plugin-app-control/src/actions/views-show.ts index 74d06f3a54f3b..4184604f1758b 100644 --- a/plugins/plugin-app-control/src/actions/views-show.ts +++ b/plugins/plugin-app-control/src/actions/views-show.ts @@ -186,10 +186,6 @@ const INTENT_VIEW_RULES: ReadonlyArray<{ re: RegExp; viewId: string }> = [ re: /\b(my (contacts?|relationships?|people|network|address book)|who do i know|my rolodex)\b/i, viewId: "relationships", }, - { - re: /\b(my companion|the companion|companion view|my avatar)\b/i, - viewId: "companion", - }, { re: /\b(my (settings|preferences)|(change|update|edit|open|go to|show|take me to) (my |the |app )?(settings|preferences|configuration)|app settings|settings (page|screen|menu)|configure (the )?app)\b/i, viewId: "settings", diff --git a/plugins/plugin-app-control/src/actions/views.ts b/plugins/plugin-app-control/src/actions/views.ts index 44d9d871ffecc..adab2ea60ee6e 100644 --- a/plugins/plugin-app-control/src/actions/views.ts +++ b/plugins/plugin-app-control/src/actions/views.ts @@ -2045,8 +2045,6 @@ export function createViewsAction(deps: ViewsActionDeps = {}): Action { "relationships", "people", "network", - "companion", - "avatar", "settings", "preferences", "coding", diff --git a/plugins/plugin-app-control/src/evaluators/view-command-shortcut.test.ts b/plugins/plugin-app-control/src/evaluators/view-command-shortcut.test.ts index 00de489d322be..ef4c90ce96705 100644 --- a/plugins/plugin-app-control/src/evaluators/view-command-shortcut.test.ts +++ b/plugins/plugin-app-control/src/evaluators/view-command-shortcut.test.ts @@ -114,10 +114,6 @@ describe("viewCommandShortcutEvaluator — does NOT fire", () => { expect(await run("i need to fix the login bug")).toBeNull(); expect(await run("I want to add a new feature to my app")).toBeNull(); }); - it("on companion emote commands", async () => { - expect(await run("run the companion avatar wave emote action")).toBeNull(); - expect(await run("make my avatar wave")).toBeNull(); - }); it("on XR camera perception requests owned by XR_QUERY_VISION", async () => { expect( await run( diff --git a/plugins/plugin-app-control/src/evaluators/view-context.test.ts b/plugins/plugin-app-control/src/evaluators/view-context.test.ts index 3a78dde860dae..d9c87c004f605 100644 --- a/plugins/plugin-app-control/src/evaluators/view-context.test.ts +++ b/plugins/plugin-app-control/src/evaluators/view-context.test.ts @@ -20,7 +20,6 @@ const REGISTERED_VIEW_IDS = [ "documents", "relationships", "focus", - "companion", "task-coordinator", ]; diff --git a/plugins/plugin-app-control/src/evaluators/view-context.ts b/plugins/plugin-app-control/src/evaluators/view-context.ts index 1778469476667..1f11c771ca4f2 100644 --- a/plugins/plugin-app-control/src/evaluators/view-context.ts +++ b/plugins/plugin-app-control/src/evaluators/view-context.ts @@ -29,7 +29,6 @@ export const CONTEXT_VIEWS = [ "documents", "relationships", "focus", - "companion", "task-coordinator", ] as const; diff --git a/plugins/plugin-app-control/src/protected-apps.test.ts b/plugins/plugin-app-control/src/protected-apps.test.ts index 40a97300bf6d7..9373a0fe2ede8 100644 --- a/plugins/plugin-app-control/src/protected-apps.test.ts +++ b/plugins/plugin-app-control/src/protected-apps.test.ts @@ -3,7 +3,7 @@ import { isProtected, resolveProtectedApps } from "./protected-apps.js"; /** * Protected-apps resolution stops a foreign package from registering under a - * first-party slug (e.g. spoofing companion) — a security boundary, so the + * first-party slug (e.g. spoofing knowledge) — a security boundary, so the * name-form matching (full / basename / app-stripped, case-insensitive) is pinned. */ @@ -21,9 +21,9 @@ const NO_REPO = "/definitely-not-a-real-repo-root-9f3a"; describe("resolveProtectedApps", () => { it("reads + trims the env list and tolerates a missing apps dir", async () => { process.env.ELIZA_PROTECTED_APPS = - " @elizaos/app-companion , app-wallet ,, "; + " @elizaos/app-knowledge , app-wallet ,, "; const res = await resolveProtectedApps(NO_REPO); - expect(res.fromEnv).toEqual(["@elizaos/app-companion", "app-wallet"]); + expect(res.fromEnv).toEqual(["@elizaos/app-knowledge", "app-wallet"]); expect(res.fromFirstPartyDir).toEqual([]); }); @@ -37,25 +37,25 @@ describe("resolveProtectedApps", () => { describe("isProtected — name-form matching", () => { it("matches the full name, basename, and app-stripped suffix, case-insensitively", async () => { - process.env.ELIZA_PROTECTED_APPS = "@elizaos/app-companion,app-wallet"; + process.env.ELIZA_PROTECTED_APPS = "@elizaos/app-knowledge,app-wallet"; const res = await resolveProtectedApps(NO_REPO); - expect(isProtected("@elizaos/app-companion", res)).toBe(true); - expect(isProtected("app-companion", res)).toBe(true); - expect(isProtected("companion", res)).toBe(true); - expect(isProtected("COMPANION", res)).toBe(true); + expect(isProtected("@elizaos/app-knowledge", res)).toBe(true); + expect(isProtected("app-knowledge", res)).toBe(true); + expect(isProtected("knowledge", res)).toBe(true); + expect(isProtected("KNOWLEDGE", res)).toBe(true); expect(isProtected("wallet", res)).toBe(true); }); it("blocks a foreign package that reuses a protected slug (anti-spoof)", async () => { - process.env.ELIZA_PROTECTED_APPS = "@elizaos/app-companion"; + process.env.ELIZA_PROTECTED_APPS = "@elizaos/app-knowledge"; const res = await resolveProtectedApps(NO_REPO); - // Attacker scopes their own package but reuses the "companion" slug. - expect(isProtected("@attacker/companion", res)).toBe(true); - expect(isProtected("@attacker/app-companion", res)).toBe(true); + // Attacker scopes their own package but reuses the "knowledge" slug. + expect(isProtected("@attacker/knowledge", res)).toBe(true); + expect(isProtected("@attacker/app-knowledge", res)).toBe(true); }); it("does not protect unrelated names or invalid inputs", async () => { - process.env.ELIZA_PROTECTED_APPS = "app-companion"; + process.env.ELIZA_PROTECTED_APPS = "app-knowledge"; const res = await resolveProtectedApps(NO_REPO); expect(isProtected("calculator", res)).toBe(false); expect(isProtected("@x/calculator", res)).toBe(false); diff --git a/plugins/plugin-app-control/src/protected-apps.ts b/plugins/plugin-app-control/src/protected-apps.ts index 6f2783ea9154d..6dc087a2830c4 100644 --- a/plugins/plugin-app-control/src/protected-apps.ts +++ b/plugins/plugin-app-control/src/protected-apps.ts @@ -11,7 +11,7 @@ * 2. First-party apps shipped in this repo under `eliza/apps/` — every * subdirectory there is implicitly protected so a malicious or careless * `load_from_directory` cannot register a foreign package under a - * first-party slug (e.g., `@elizaos/plugin-companion`). + * first-party slug (e.g., `@elizaos/plugin-feed`). * * Lookups are case-insensitive and accept the full package name * (`@scope/app-foo`), the package basename (`app-foo`), or the suffix diff --git a/plugins/plugin-blocker/tsconfig.json b/plugins/plugin-blocker/tsconfig.json index 65924a98d46b6..9a4c4b031d48f 100644 --- a/plugins/plugin-blocker/tsconfig.json +++ b/plugins/plugin-blocker/tsconfig.json @@ -48,8 +48,7 @@ ], "react-dom": [ "../../packages/app-core/node_modules/@types/react-dom/index.d.ts" - ], - "lucide-react": ["../plugin-companion/node_modules/lucide-react"] + ] } }, "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"], diff --git a/plugins/plugin-browser/tsconfig.json b/plugins/plugin-browser/tsconfig.json index dfe3a27dfbd97..2f3f8b903ed23 100644 --- a/plugins/plugin-browser/tsconfig.json +++ b/plugins/plugin-browser/tsconfig.json @@ -37,9 +37,6 @@ "@elizaos/plugin-personal-assistant": [ "../../plugins/plugin-personal-assistant/src/index.ts" ], - "@elizaos/plugin-companion": [ - "../../plugins/plugin-companion/src/index.ts" - ], "@elizaos/capacitor-appblocker": [ "../../plugins/plugin-native-appblocker/src/index.ts" ], @@ -48,7 +45,7 @@ ] } }, - "include": ["src", "../../plugins/plugin-companion/src/ambient-modules.d.ts"], + "include": ["src"], "references": [], "exclude": [ "**/__tests__/**", diff --git a/plugins/plugin-companion/.storybook-smoke/main.ts b/plugins/plugin-companion/.storybook-smoke/main.ts deleted file mode 100644 index 9f1e80d29cb21..0000000000000 --- a/plugins/plugin-companion/.storybook-smoke/main.ts +++ /dev/null @@ -1,41 +0,0 @@ -import path from "node:path"; -import type { StorybookConfig } from "@storybook/react-vite"; - -const companionRoot = path.resolve(__dirname, ".."); -const elizaRoot = path.resolve(companionRoot, "../.."); - -const config: StorybookConfig = { - stories: [ - "../src/components/chat/ChatAvatar.stories.tsx", - "../src/components/companion/InferenceCloudAlertButton.stories.tsx", - "../src/components/companion/shell-control-styles.stories.tsx", - ], - addons: [ - "@storybook/addon-essentials", - "@storybook/addon-a11y", - "@storybook/addon-themes", - ], - typescript: { - reactDocgen: false, - }, - framework: { - name: "@storybook/react-vite", - options: {}, - }, - docs: { - autodocs: "tag", - }, - staticDirs: ["../public"], - viteFinal: async (config) => { - config.resolve ??= {}; - config.resolve.alias = { - ...(config.resolve.alias ?? {}), - "@elizaos/app-core": path.resolve(elizaRoot, "packages/app-core/src"), - "@elizaos/core": path.resolve(elizaRoot, "packages/core/src"), - "@elizaos/ui": path.resolve(elizaRoot, "packages/ui/src"), - }; - return config; - }, -}; - -export default config; diff --git a/plugins/plugin-companion/.storybook-smoke/preview.ts b/plugins/plugin-companion/.storybook-smoke/preview.ts deleted file mode 100644 index edcca0cb43907..0000000000000 --- a/plugins/plugin-companion/.storybook-smoke/preview.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "../.storybook/preview"; diff --git a/plugins/plugin-companion/.storybook/main.ts b/plugins/plugin-companion/.storybook/main.ts deleted file mode 100644 index ce98505dd7946..0000000000000 --- a/plugins/plugin-companion/.storybook/main.ts +++ /dev/null @@ -1,36 +0,0 @@ -import path from "node:path"; -import type { StorybookConfig } from "@storybook/react-vite"; - -const companionRoot = path.resolve(__dirname, ".."); -const elizaRoot = path.resolve(companionRoot, "../.."); - -const config: StorybookConfig = { - stories: ["../src/**/*.stories.@(ts|tsx)"], - addons: [ - "@storybook/addon-docs", - "@storybook/addon-a11y", - "@storybook/addon-themes", - ], - framework: { - name: "@storybook/react-vite", - options: {}, - }, - docs: { - autodocs: "tag", - }, - staticDirs: ["../public"], - viteFinal: async (config) => { - config.resolve ??= {}; - config.resolve.alias = { - ...(config.resolve.alias ?? {}), - "@elizaos/app-core": path.resolve( - elizaRoot, - "packages/app-core/src/index.ts", - ), - "@elizaos/core": path.resolve(elizaRoot, "packages/core/src/index.ts"), - }; - return config; - }, -}; - -export default config; diff --git a/plugins/plugin-companion/.storybook/preview.ts b/plugins/plugin-companion/.storybook/preview.ts deleted file mode 100644 index b9343d4554a33..0000000000000 --- a/plugins/plugin-companion/.storybook/preview.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { withThemeByClassName } from "@storybook/addon-themes"; -import type { Preview } from "@storybook/react"; -import "@elizaos/ui"; - -const preview: Preview = { - parameters: { - controls: { - matchers: { - color: /(background|color)$/i, - date: /Date$/i, - }, - }, - layout: "centered", - viewport: { - options: { - companionPortrait: { - name: "Companion Portrait", - styles: { width: "390px", height: "844px" }, - type: "mobile", - }, - companionDesktop: { - name: "Companion Desktop", - styles: { width: "1280px", height: "800px" }, - type: "desktop", - }, - companionPip: { - name: "Companion PIP", - styles: { width: "320px", height: "480px" }, - type: "mobile", - }, - }, - }, - }, - decorators: [ - withThemeByClassName({ - themes: { - light: "", - dark: "dark", - }, - defaultTheme: "light", - }), - ], -}; - -export default preview; diff --git a/plugins/plugin-companion/AGENTS.md b/plugins/plugin-companion/AGENTS.md deleted file mode 100644 index ca27b22b17e63..0000000000000 --- a/plugins/plugin-companion/AGENTS.md +++ /dev/null @@ -1,189 +0,0 @@ -# @elizaos/plugin-companion - -VRM companion overlay: 3D avatar runtime, emote system, and companion app views for Eliza agents. - -## Purpose / role - -Adds a 3D VRM avatar companion surface to an Eliza agent. It registers the `PLAY_EMOTE` action so agents can trigger one-shot avatar animations, and exposes a single registered view spanning GUI, XR, and TUI modalities (the GUI/XR surface hosts the Three.js VRM scene; the TUI modality renders the spatial operator panel via the terminal registry). The plugin is **opt-in** — it only activates when the agent session is for the companion hosted app (gated via `gatePluginSessionForHostedApp`). Load it by including the package in the agent's plugin list. - -## Plugin surface - -### Actions -- **`PLAY_EMOTE`** (`src/actions/emote.ts`) — Posts to `/api/emote` to play a one-shot named animation on the active VRM avatar. Validates via `runtime.character.settings?.DISABLE_EMOTES` and requires `message.content.source === "client_chat"`. Enum of valid emote IDs is derived from `AGENT_EMOTE_CATALOG`. - -### Views (registered in `src/plugin.ts`) -- **`companion`** — one declaration, `modalities: ["gui", "xr", "tui"]`, `componentExport: "CompanionView"`, path `/companion`. The GUI/XR surface renders the Three.js VRM scene via `CompanionView`; the TUI modality renders the spatial operator panel (`CompanionSpatialView`) through the terminal registry (`register-terminal-view.tsx`), not a separate componentExport. - -### Overlay app -- `registerCompanionApp()` (`src/register.ts` / `src/components/companion/companion-app.ts`) — registers the companion as a named overlay app in `@elizaos/ui`'s `OverlayApp` registry. Called automatically on module import of `src/register.ts`. - -## Layout - -``` -src/ - plugin.ts Plugin definition (PLAY_EMOTE action + 1 tri-modal view); export: appCompanionPlugin - register.ts Side-effect entry: calls registerCompanionApp() on import - register-terminal-view.tsx Side-effect entry: registers the terminal/TUI view - ui.ts Re-exports all UI/component public surface - index.ts Full public API re-export barrel - character-catalog.ts Re-exports character asset helpers from @elizaos/ui - vrm-assets.ts VRM asset URL helpers (getVrmUrl, getVrmPreviewUrl, etc.) - - types/ - render-modes.ts Render mode type definitions - - actions/ - emote.ts PLAY_EMOTE action implementation - - emotes/ - catalog.ts EMOTE_CATALOG, AGENT_EMOTE_CATALOG, EmoteDef type, getEmote, getEmotesByCategory - index.ts Re-export barrel - - components/ - avatar/ - VrmEngine.ts Core Three.js + @pixiv/three-vrm scene engine (loads VRM, runs animation loop) - VrmViewer.tsx React wrapper around VrmEngine - VrmAnimationLoader.ts Loads GLB/FBX emote clips; handles gzip (.gz) assets - VrmBlinkController.ts Automated eye blink behaviour - VrmCameraManager.ts Camera positioning and look-at logic - SceneOverlayManager.ts Manages in-scene overlays (chat bubbles, agent status, triggers) - scene-overlay-renderer.ts AgentStatusOverlay / ChatOverlayMessage / TriggerOverlay types + rendering - retargetMixamoFbxToVrm.ts Mixamo FBX → VRM bone retargeting - retargetMixamoGltfToVrm.ts Mixamo glTF → VRM bone retargeting - mixamoVRMRigMap.ts Bone name mapping table - VrmFootShadow.ts Ground shadow plane - VrmTeleportEffect.ts Sparkle teleport particle effect - MathEnvironment.ts Math utilities for scene calculations - scene-theme-tokens.ts Light/dark theme color tokens for scene materials - vrm-desktop-energy.ts Desktop energy / idle animation management - vector-browser-three.ts Browser-compatible Three.js vector helpers - vector-browser-utils.ts General browser utility helpers for the scene - - companion/ - CompanionView.tsx Main overlay view (avatar + chat + emote picker + settings) - CompanionView.helpers.ts Helper utilities for CompanionView - CompanionView.interact.ts Interaction logic for CompanionView - CompanionAppView.tsx Outermost app wrapper loaded by the overlay app registry - CompanionShell.tsx Shell with tab management and VRM prefetch gate - CompanionSceneHost.tsx VrmStage host: wires zoom, pointer events, prefetch, scene context - CompanionSpatialView.tsx Spatial/XR companion view - CompanionStageBackdrop.tsx Stage backdrop component - CompanionHeader.tsx Top bar with view tab switcher - CompanionSettingsPanel.tsx Settings panel (avatar selection, performance toggles) - CompanionPerformanceSettings.tsx VRM power / framerate / animate-when-hidden toggles - EmotePicker.tsx UI grid of triggerable emotes (AGENT_EMOTE_CATALOG) - emote-picker-grid.ts Emote picker grid layout logic - GlobalEmoteOverlay.tsx Full-screen emote trigger overlay - InferenceCloudAlertButton.tsx Alert button when cloud inference is unavailable - VrmStage.tsx Three.js canvas mount and VrmEngine lifecycle - companion-view-bundle.ts View bundle entry point / exports for Vite build - scene-overlay-bridge.ts SceneOverlayDataBridge React component — syncs app state into SceneOverlayManager - companion-app.ts companionApp OverlayApp definition + registerCompanionApp() - companion-scene-status-context.ts React context for scene load/ready status - shared-companion-scene-context.ts Shared context between CompanionSceneHost and children - resolve-companion-inference-notice.ts Derives cloud-inference alert state from app config - companion-shell-styles.ts COMPANION_OVERLAY_TABS constant + CSS helpers - shell-control-styles.ts Control button CSS - walletUtils.ts Wallet display helpers used in companion header - - chat/ - ChatAvatar.tsx Small avatar thumbnail for chat message rows -``` - -## Commands - -```bash -bun run --cwd plugins/plugin-companion typecheck -bun run --cwd plugins/plugin-companion lint -bun run --cwd plugins/plugin-companion test -bun run --cwd plugins/plugin-companion build -bun run --cwd plugins/plugin-companion build:js # tsup — runtime JS bundle -bun run --cwd plugins/plugin-companion build:views # Vite — companion view bundle (dist/views/) -bun run --cwd plugins/plugin-companion build:types # tsc declarations -bun run --cwd plugins/plugin-companion clean -bun run --cwd plugins/plugin-companion storybook # Storybook dev on :6007 -``` - -## Config / env vars - -| Name | Required | Default | Where used | -|------|----------|---------|------------| -| `API_PORT` | No | `2138` | `emote.ts` — port for `POST /api/emote` | -| `SERVER_PORT` | No | `2138` | `emote.ts` — fallback if `API_PORT` unset | -| `character.settings.DISABLE_EMOTES` | No | unset | `emote.ts` validate — set to any truthy value in character config to disable `PLAY_EMOTE` | - -## How to extend - -### Add an emote - -1. Add an `EmoteDef` entry to `RAW_EMOTE_CATALOG` in `src/emotes/catalog.ts`. Set `path` to the animation file served from the static bundle (`.glb` or `.fbx`; the catalog automatically appends `.gz`). -2. The new ID is automatically available in `AGENT_EMOTE_CATALOG` (and thus in `PLAY_EMOTE`'s `enum`) unless you add it to `AGENT_EMOTE_EXCLUDED_IDS`. - -### Add a new action - -1. Create `src/actions/.ts` implementing `Action` from `@elizaos/core`. -2. Import and add it to the `actions` array in `src/plugin.ts`. -3. Export it from `src/index.ts` if it needs to be part of the public API. - -### Add a new view - -1. Create the React component under `src/components/companion/`. -2. Export it from `src/ui.ts`. -3. Add a view registration entry to the `views` array in `src/plugin.ts` with a unique `id`, `path`, `bundlePath`, and `componentExport` matching the export name in the Vite views bundle. - -### Add a provider or service - -The current plugin registers no providers, evaluators, or services beyond the `PLAY_EMOTE` action. To add one, import and include it in the `rawCompanionPlugin` object in `src/plugin.ts` using the standard `@elizaos/core` `Plugin` fields (`providers`, `services`, `evaluators`). - -## Conventions / gotchas - -- **Session gating.** `appCompanionPlugin` is wrapped by `gatePluginSessionForHostedApp(rawCompanionPlugin, "@elizaos/plugin-companion")`. Actions and views only run when the agent session is scoped to this hosted app. Do not remove the gate. -- **Two build steps.** The JS/types build (tsup + tsc) and the Vite views build are separate. The views bundle (`dist/views/bundle.js`) is what the `bundlePath` in each view registration points to. Both must be run for a complete build. -- **Peer dependencies.** `three`, `@pixiv/three-vrm`, `react`, and `react-dom` are peer deps — they must be present in the host application. Do not import them as direct deps. -- **Animation assets are gzip-compressed.** `VrmAnimationLoader` expects `.glb.gz` and `.fbx.gz` paths. `gzipAnimationPath()` in the catalog appends `.gz` automatically — do not double-suffix. -- **`__ELIZA_VRM_ENGINES__`** is a debug global on `window` that `scene-overlay-bridge.ts` uses to locate the active `VrmEngine` instance at runtime. Do not remove this registration from `VrmViewer`. -- **Emote HTTP call is fire-and-forget.** `PLAY_EMOTE` returns success/failure but does not await animation completion. The 2 500 ms `AbortController` timeout prevents indefinite hangs when the dashboard server is unreachable. -- **Storybook** dev requires the Three.js and VRM peer deps. Run `bun run --cwd plugins/plugin-companion storybook` from within the plugin directory. -- See the root `AGENTS.md` for repo-wide architecture rules, naming conventions, logger requirements, and ESM/module standards. - - -## ⛔ NON-NEGOTIABLE — evidence, trajectories & real end-to-end tests - -> The binding, repo-wide standard is **[PR_EVIDENCE.md](../../PR_EVIDENCE.md)**. Read it. -> Nothing in this package is *done* until it is *proven* done — a reviewer must confirm it -> works **without reading the code**, from the artifacts you attach. This applies to **every** -> feature, fix, refactor, and chore here. "Tests pass" is not proof; "CI is green" is not proof. - -- **Record AND read model trajectories.** Capture the *actual* inputs and outputs of the model - from a **live** LLM — not the deterministic proxy, not a mock: the prompt, the - providers/context, the raw model output, every tool/action call, and the result. Then **open - the trajectory and review it by hand.** A captured-but-unread trajectory is not evidence - (`packages/scenario-runner/bin/eliza-scenarios run --report `). -- **Real, full-featured E2E — no larp.** Every feature ships detailed end-to-end tests that - drive the *real* path end to end. Not the happy "front door" only: cover error paths, - edge/empty/invalid input, concurrency, roles/permissions, and adversarial input. A test that - asserts against a mock/stub/fixture standing in for the thing under test **does not count**. - If the real model/device/chain/connector/account is hard to reach, **make it reachable — that - is the work**, not an excuse to mock. If the existing tests here are shallow or mocked, fixing - them is part of your change. -- **Screenshots + logs at every phase**, plus a **complete walkthrough video/run-through** of - the entire feature or view, start to finish (`bun run test:e2e:record`). -- **Manually review every artifact the change touches** — never just the green check: client - logs (console + network), server logs (`[ClassName] …`), the model trajectories in and out, - before/after full-page screenshots, **and the domain artifacts listed below for this package.** -- **No residuals. No shortcuts.** The goal is not "done" — it is *everything* done. Clear every - blocker by the **hard path**: build the real architecture, stand up the real - model/device/service, actually test it. Never leave a TODO, a stub, a stepping-stone, or a - "follow-up." When unsure, research thoroughly, weigh the options, and ship the best, - highest-effort, production-ready version. Keep going until every possibility is exhausted. - -Artifacts → `.github/issue-evidence/-.`; attach each evidence type **or** -explicitly mark it N/A with a reason — never leave it blank. If `develop` moved and changed -behavior, **re-capture** evidence; stale proof is worse than none. - -**Capture & manually review for this package — agent behavior / app plugin:** -- A **live-LLM** scenario trajectory showing the behavior end to end and asserting the **outcome**, not just that routing/an action was selected (see #9970). -- The artifacts the behavior creates — memories, knowledge, scheduled-task rows, relationships, documents, outputs — inspected after the run. -- Backend `[ClassName]` logs of the action/service/runner firing, plus error/edge/permission paths. -- The empty-state and adversarial-input behavior, not just one happy scenario. - diff --git a/plugins/plugin-companion/CLAUDE.md b/plugins/plugin-companion/CLAUDE.md deleted file mode 100644 index ca27b22b17e63..0000000000000 --- a/plugins/plugin-companion/CLAUDE.md +++ /dev/null @@ -1,189 +0,0 @@ -# @elizaos/plugin-companion - -VRM companion overlay: 3D avatar runtime, emote system, and companion app views for Eliza agents. - -## Purpose / role - -Adds a 3D VRM avatar companion surface to an Eliza agent. It registers the `PLAY_EMOTE` action so agents can trigger one-shot avatar animations, and exposes a single registered view spanning GUI, XR, and TUI modalities (the GUI/XR surface hosts the Three.js VRM scene; the TUI modality renders the spatial operator panel via the terminal registry). The plugin is **opt-in** — it only activates when the agent session is for the companion hosted app (gated via `gatePluginSessionForHostedApp`). Load it by including the package in the agent's plugin list. - -## Plugin surface - -### Actions -- **`PLAY_EMOTE`** (`src/actions/emote.ts`) — Posts to `/api/emote` to play a one-shot named animation on the active VRM avatar. Validates via `runtime.character.settings?.DISABLE_EMOTES` and requires `message.content.source === "client_chat"`. Enum of valid emote IDs is derived from `AGENT_EMOTE_CATALOG`. - -### Views (registered in `src/plugin.ts`) -- **`companion`** — one declaration, `modalities: ["gui", "xr", "tui"]`, `componentExport: "CompanionView"`, path `/companion`. The GUI/XR surface renders the Three.js VRM scene via `CompanionView`; the TUI modality renders the spatial operator panel (`CompanionSpatialView`) through the terminal registry (`register-terminal-view.tsx`), not a separate componentExport. - -### Overlay app -- `registerCompanionApp()` (`src/register.ts` / `src/components/companion/companion-app.ts`) — registers the companion as a named overlay app in `@elizaos/ui`'s `OverlayApp` registry. Called automatically on module import of `src/register.ts`. - -## Layout - -``` -src/ - plugin.ts Plugin definition (PLAY_EMOTE action + 1 tri-modal view); export: appCompanionPlugin - register.ts Side-effect entry: calls registerCompanionApp() on import - register-terminal-view.tsx Side-effect entry: registers the terminal/TUI view - ui.ts Re-exports all UI/component public surface - index.ts Full public API re-export barrel - character-catalog.ts Re-exports character asset helpers from @elizaos/ui - vrm-assets.ts VRM asset URL helpers (getVrmUrl, getVrmPreviewUrl, etc.) - - types/ - render-modes.ts Render mode type definitions - - actions/ - emote.ts PLAY_EMOTE action implementation - - emotes/ - catalog.ts EMOTE_CATALOG, AGENT_EMOTE_CATALOG, EmoteDef type, getEmote, getEmotesByCategory - index.ts Re-export barrel - - components/ - avatar/ - VrmEngine.ts Core Three.js + @pixiv/three-vrm scene engine (loads VRM, runs animation loop) - VrmViewer.tsx React wrapper around VrmEngine - VrmAnimationLoader.ts Loads GLB/FBX emote clips; handles gzip (.gz) assets - VrmBlinkController.ts Automated eye blink behaviour - VrmCameraManager.ts Camera positioning and look-at logic - SceneOverlayManager.ts Manages in-scene overlays (chat bubbles, agent status, triggers) - scene-overlay-renderer.ts AgentStatusOverlay / ChatOverlayMessage / TriggerOverlay types + rendering - retargetMixamoFbxToVrm.ts Mixamo FBX → VRM bone retargeting - retargetMixamoGltfToVrm.ts Mixamo glTF → VRM bone retargeting - mixamoVRMRigMap.ts Bone name mapping table - VrmFootShadow.ts Ground shadow plane - VrmTeleportEffect.ts Sparkle teleport particle effect - MathEnvironment.ts Math utilities for scene calculations - scene-theme-tokens.ts Light/dark theme color tokens for scene materials - vrm-desktop-energy.ts Desktop energy / idle animation management - vector-browser-three.ts Browser-compatible Three.js vector helpers - vector-browser-utils.ts General browser utility helpers for the scene - - companion/ - CompanionView.tsx Main overlay view (avatar + chat + emote picker + settings) - CompanionView.helpers.ts Helper utilities for CompanionView - CompanionView.interact.ts Interaction logic for CompanionView - CompanionAppView.tsx Outermost app wrapper loaded by the overlay app registry - CompanionShell.tsx Shell with tab management and VRM prefetch gate - CompanionSceneHost.tsx VrmStage host: wires zoom, pointer events, prefetch, scene context - CompanionSpatialView.tsx Spatial/XR companion view - CompanionStageBackdrop.tsx Stage backdrop component - CompanionHeader.tsx Top bar with view tab switcher - CompanionSettingsPanel.tsx Settings panel (avatar selection, performance toggles) - CompanionPerformanceSettings.tsx VRM power / framerate / animate-when-hidden toggles - EmotePicker.tsx UI grid of triggerable emotes (AGENT_EMOTE_CATALOG) - emote-picker-grid.ts Emote picker grid layout logic - GlobalEmoteOverlay.tsx Full-screen emote trigger overlay - InferenceCloudAlertButton.tsx Alert button when cloud inference is unavailable - VrmStage.tsx Three.js canvas mount and VrmEngine lifecycle - companion-view-bundle.ts View bundle entry point / exports for Vite build - scene-overlay-bridge.ts SceneOverlayDataBridge React component — syncs app state into SceneOverlayManager - companion-app.ts companionApp OverlayApp definition + registerCompanionApp() - companion-scene-status-context.ts React context for scene load/ready status - shared-companion-scene-context.ts Shared context between CompanionSceneHost and children - resolve-companion-inference-notice.ts Derives cloud-inference alert state from app config - companion-shell-styles.ts COMPANION_OVERLAY_TABS constant + CSS helpers - shell-control-styles.ts Control button CSS - walletUtils.ts Wallet display helpers used in companion header - - chat/ - ChatAvatar.tsx Small avatar thumbnail for chat message rows -``` - -## Commands - -```bash -bun run --cwd plugins/plugin-companion typecheck -bun run --cwd plugins/plugin-companion lint -bun run --cwd plugins/plugin-companion test -bun run --cwd plugins/plugin-companion build -bun run --cwd plugins/plugin-companion build:js # tsup — runtime JS bundle -bun run --cwd plugins/plugin-companion build:views # Vite — companion view bundle (dist/views/) -bun run --cwd plugins/plugin-companion build:types # tsc declarations -bun run --cwd plugins/plugin-companion clean -bun run --cwd plugins/plugin-companion storybook # Storybook dev on :6007 -``` - -## Config / env vars - -| Name | Required | Default | Where used | -|------|----------|---------|------------| -| `API_PORT` | No | `2138` | `emote.ts` — port for `POST /api/emote` | -| `SERVER_PORT` | No | `2138` | `emote.ts` — fallback if `API_PORT` unset | -| `character.settings.DISABLE_EMOTES` | No | unset | `emote.ts` validate — set to any truthy value in character config to disable `PLAY_EMOTE` | - -## How to extend - -### Add an emote - -1. Add an `EmoteDef` entry to `RAW_EMOTE_CATALOG` in `src/emotes/catalog.ts`. Set `path` to the animation file served from the static bundle (`.glb` or `.fbx`; the catalog automatically appends `.gz`). -2. The new ID is automatically available in `AGENT_EMOTE_CATALOG` (and thus in `PLAY_EMOTE`'s `enum`) unless you add it to `AGENT_EMOTE_EXCLUDED_IDS`. - -### Add a new action - -1. Create `src/actions/.ts` implementing `Action` from `@elizaos/core`. -2. Import and add it to the `actions` array in `src/plugin.ts`. -3. Export it from `src/index.ts` if it needs to be part of the public API. - -### Add a new view - -1. Create the React component under `src/components/companion/`. -2. Export it from `src/ui.ts`. -3. Add a view registration entry to the `views` array in `src/plugin.ts` with a unique `id`, `path`, `bundlePath`, and `componentExport` matching the export name in the Vite views bundle. - -### Add a provider or service - -The current plugin registers no providers, evaluators, or services beyond the `PLAY_EMOTE` action. To add one, import and include it in the `rawCompanionPlugin` object in `src/plugin.ts` using the standard `@elizaos/core` `Plugin` fields (`providers`, `services`, `evaluators`). - -## Conventions / gotchas - -- **Session gating.** `appCompanionPlugin` is wrapped by `gatePluginSessionForHostedApp(rawCompanionPlugin, "@elizaos/plugin-companion")`. Actions and views only run when the agent session is scoped to this hosted app. Do not remove the gate. -- **Two build steps.** The JS/types build (tsup + tsc) and the Vite views build are separate. The views bundle (`dist/views/bundle.js`) is what the `bundlePath` in each view registration points to. Both must be run for a complete build. -- **Peer dependencies.** `three`, `@pixiv/three-vrm`, `react`, and `react-dom` are peer deps — they must be present in the host application. Do not import them as direct deps. -- **Animation assets are gzip-compressed.** `VrmAnimationLoader` expects `.glb.gz` and `.fbx.gz` paths. `gzipAnimationPath()` in the catalog appends `.gz` automatically — do not double-suffix. -- **`__ELIZA_VRM_ENGINES__`** is a debug global on `window` that `scene-overlay-bridge.ts` uses to locate the active `VrmEngine` instance at runtime. Do not remove this registration from `VrmViewer`. -- **Emote HTTP call is fire-and-forget.** `PLAY_EMOTE` returns success/failure but does not await animation completion. The 2 500 ms `AbortController` timeout prevents indefinite hangs when the dashboard server is unreachable. -- **Storybook** dev requires the Three.js and VRM peer deps. Run `bun run --cwd plugins/plugin-companion storybook` from within the plugin directory. -- See the root `AGENTS.md` for repo-wide architecture rules, naming conventions, logger requirements, and ESM/module standards. - - -## ⛔ NON-NEGOTIABLE — evidence, trajectories & real end-to-end tests - -> The binding, repo-wide standard is **[PR_EVIDENCE.md](../../PR_EVIDENCE.md)**. Read it. -> Nothing in this package is *done* until it is *proven* done — a reviewer must confirm it -> works **without reading the code**, from the artifacts you attach. This applies to **every** -> feature, fix, refactor, and chore here. "Tests pass" is not proof; "CI is green" is not proof. - -- **Record AND read model trajectories.** Capture the *actual* inputs and outputs of the model - from a **live** LLM — not the deterministic proxy, not a mock: the prompt, the - providers/context, the raw model output, every tool/action call, and the result. Then **open - the trajectory and review it by hand.** A captured-but-unread trajectory is not evidence - (`packages/scenario-runner/bin/eliza-scenarios run --report `). -- **Real, full-featured E2E — no larp.** Every feature ships detailed end-to-end tests that - drive the *real* path end to end. Not the happy "front door" only: cover error paths, - edge/empty/invalid input, concurrency, roles/permissions, and adversarial input. A test that - asserts against a mock/stub/fixture standing in for the thing under test **does not count**. - If the real model/device/chain/connector/account is hard to reach, **make it reachable — that - is the work**, not an excuse to mock. If the existing tests here are shallow or mocked, fixing - them is part of your change. -- **Screenshots + logs at every phase**, plus a **complete walkthrough video/run-through** of - the entire feature or view, start to finish (`bun run test:e2e:record`). -- **Manually review every artifact the change touches** — never just the green check: client - logs (console + network), server logs (`[ClassName] …`), the model trajectories in and out, - before/after full-page screenshots, **and the domain artifacts listed below for this package.** -- **No residuals. No shortcuts.** The goal is not "done" — it is *everything* done. Clear every - blocker by the **hard path**: build the real architecture, stand up the real - model/device/service, actually test it. Never leave a TODO, a stub, a stepping-stone, or a - "follow-up." When unsure, research thoroughly, weigh the options, and ship the best, - highest-effort, production-ready version. Keep going until every possibility is exhausted. - -Artifacts → `.github/issue-evidence/-.`; attach each evidence type **or** -explicitly mark it N/A with a reason — never leave it blank. If `develop` moved and changed -behavior, **re-capture** evidence; stale proof is worse than none. - -**Capture & manually review for this package — agent behavior / app plugin:** -- A **live-LLM** scenario trajectory showing the behavior end to end and asserting the **outcome**, not just that routing/an action was selected (see #9970). -- The artifacts the behavior creates — memories, knowledge, scheduled-task rows, relationships, documents, outputs — inspected after the run. -- Backend `[ClassName]` logs of the action/service/runner firing, plus error/edge/permission paths. -- The empty-state and adversarial-input behavior, not just one happy scenario. - diff --git a/plugins/plugin-companion/README.md b/plugins/plugin-companion/README.md deleted file mode 100644 index 7bd42efc60e54..0000000000000 --- a/plugins/plugin-companion/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# @elizaos/plugin-companion - -Companion overlay plugin for elizaOS. Adds a 3D VRM avatar to an Eliza agent, with animated emotes, a chat overlay, and performance controls — rendered in a Three.js scene directly on the agent surface. - -## What it does - -- Renders a VRM (Virtual Reality Model) avatar in a 3D Three.js scene on the agent's companion surface. -- Enables the agent to play named emote animations via the `PLAY_EMOTE` action (wave, dance, cry, salute, and ~35 others). -- Provides three view surfaces: standard overlay, XR overlay, and a terminal (TUI) view. -- Bridges live agent state (chat messages, agent status, active coding sessions, triggers/heartbeats) into in-scene overlays rendered above the avatar. -- Ships a full emote catalog (`EMOTE_CATALOG`) of GLB and Mixamo FBX animations, all served as gzip-compressed assets. - -## Capabilities added to the agent - -### `PLAY_EMOTE` action - -The agent can call this action to play a one-shot emote on the VRM avatar. It is silent — it does not generate chat text — and is intended to run alongside speech or reply actions. - -Valid emote IDs (sample): - -| ID | Description | -|----|-------------| -| `wave` | Waves both hands in greeting | -| `dance-happy` | Happy dance (loops) | -| `gangnam-style` | Gangnam style dance (loops) | -| `crying` | Cries sadly (loops) | -| `angry` | Expresses anger | -| `thinking` | Hand-to-chin thinking (loops) | -| `salute` | Sharp salute | -| `joyful-jump` | Jumps for joy | - -Full catalog: `src/emotes/catalog.ts` — `AGENT_EMOTE_CATALOG` lists all IDs the agent can use. - -## Required configuration - -No env vars are required for basic use. Optional: - -| Variable | Default | Description | -|----------|---------|-------------| -| `API_PORT` | `2138` | Port of the agent dashboard API server for emote delivery | -| `SERVER_PORT` | `2138` | Fallback if `API_PORT` is not set | - -To disable emote playback for a specific character, set `character.settings.DISABLE_EMOTES` to any truthy value in the character configuration. - -## How to enable - -Add `@elizaos/plugin-companion` to the agent's plugin list. The plugin is session-gated — it only activates when the agent session is scoped to the companion app context. - -```ts -import { appCompanionPlugin } from "@elizaos/plugin-companion"; - -// In your agent character/plugin config: -plugins: [appCompanionPlugin] -``` - -Alternatively, to register the companion as an overlay app (for hosts that use the overlay app registry): - -```ts -import "@elizaos/plugin-companion/register"; // side-effect: calls registerCompanionApp() -// or explicitly: -import { registerCompanionApp } from "@elizaos/plugin-companion"; -registerCompanionApp(); -``` - -## Peer dependencies - -Three.js, `@pixiv/three-vrm`, `react`, and `react-dom` must be installed by the host: - -```bash -bun add three @pixiv/three-vrm react react-dom -``` - -## Build - -```bash -bun run --cwd plugins/plugin-companion build # full build (JS + views bundle + types) -bun run --cwd plugins/plugin-companion build:views # Vite bundle for companion view components -bun run --cwd plugins/plugin-companion typecheck -bun run --cwd plugins/plugin-companion test -``` diff --git a/plugins/plugin-companion/assets.json b/plugins/plugin-companion/assets.json deleted file mode 100644 index 090d31ddcdd1c..0000000000000 --- a/plugins/plugin-companion/assets.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "description": "Public assets required by @elizaos/plugin-companion at runtime. Consuming apps must serve these from their public/ root.", - "publicAssets": { - "vrm-decoders/draco/": { - "source": "vendored", - "required": true, - "note": "Draco WASM decompressor for glTF/VRM geometry. Shipped with the plugin." - }, - "animations/idle.glb.gz": { - "source": "ensure-avatars", - "required": true, - "note": "Default idle animation loaded on engine init." - }, - "animations/emotes/": { - "source": "ensure-avatars", - "required": true, - "note": "Emote animations (GLB). Referenced by EmotePicker." - }, - "animations/greetings/": { - "source": "ensure-avatars", - "required": false, - "note": "Greeting animations (FBX). Used in companion mode." - }, - "animations/mixamo/": { - "source": "ensure-avatars", - "required": false, - "note": "Mixamo base animations (FBX). Retargeted to VRM at runtime." - }, - "vrms/": { - "source": "ensure-avatars", - "required": true, - "note": "Bundled VRM avatar models (.vrm.gz). Roster configured via boot config." - }, - "vrms/previews/": { - "source": "ensure-avatars", - "required": true, - "note": "PNG thumbnail previews for avatar selector." - }, - "vrms/backgrounds/": { - "source": "ensure-avatars", - "required": true, - "note": "PNG background images per avatar." - } - } -} diff --git a/plugins/plugin-companion/assets/hero.png b/plugins/plugin-companion/assets/hero.png deleted file mode 100644 index 2f92901374a5f..0000000000000 Binary files a/plugins/plugin-companion/assets/hero.png and /dev/null differ diff --git a/plugins/plugin-companion/package.json b/plugins/plugin-companion/package.json deleted file mode 100644 index 7a03c91d5d8ae..0000000000000 --- a/plugins/plugin-companion/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "@elizaos/plugin-companion", - "version": "2.0.3-beta.7", - "type": "module", - "description": "Companion app package with the VRM scene runtime and avatar utilities.", - "main": "./dist/index.js", - "scripts": { - "typecheck": "tsc --noEmit -p tsconfig.json", - "lint": "bunx @biomejs/biome check src/", - "test": "bunx vitest run --config ./vitest.config.ts", - "storybook": "storybook dev -p 6007", - "build-storybook": "storybook build", - "build": "bun run build:js && bun run build:views && bun run build:types", - "clean": "node ../../packages/scripts/rm-path-recursive.mjs dist", - "build:js": "tsup --config ../tsup.plugin-packages.shared.ts", - "build:views": "bunx --bun vite build --config vite.config.views.ts", - "build:types": "tsc --noCheck -p tsconfig.build.json" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/index.d.ts", - "eliza-source": { - "types": "./src/index.ts", - "import": "./src/index.ts", - "default": "./src/index.ts" - }, - "import": "./dist/index.js", - "default": "./dist/index.js" - }, - "./plugin": { - "types": "./dist/plugin.d.ts", - "import": "./dist/plugin.js", - "default": "./dist/plugin.js" - }, - "./*.css": "./dist/*.css", - "./*": { - "types": "./dist/*.d.ts", - "eliza-source": { - "types": "./src/*.ts", - "import": "./src/*.ts", - "default": "./src/*.ts" - }, - "import": "./dist/*.js", - "default": "./dist/*.js" - } - }, - "dependencies": { - "@elizaos/agent": "workspace:*", - "@elizaos/app-core": "workspace:*", - "@elizaos/plugin-wallet-ui": "workspace:*", - "@elizaos/core": "workspace:*", - "@elizaos/shared": "workspace:*", - "@elizaos/ui": "workspace:*", - "lucide-react": "^1.0.0" - }, - "devDependencies": { - "@biomejs/biome": "^2.4.14", - "@pixiv/three-vrm": "^3.5.2", - "@playwright/test": "^1.58.2", - "@storybook/addon-a11y": "^10.0.0", - "@storybook/addon-docs": "^10.0.0", - "@storybook/addon-themes": "^10.0.0", - "@storybook/react": "^10.0.0", - "@storybook/react-vite": "^10.0.0", - "@types/node": "^25.0.6", - "@types/react": "^19.0.0", - "@types/react-dom": "^19.0.0", - "@types/three": "^0.184.0", - "dotenv": "^17.2.3", - "jsdom": "^29.0.0", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "storybook": "^10.0.0", - "three": "^0.184.0", - "tsup": "^8.5.1", - "typescript": "^6.0.3", - "vitest": "^4.0.17", - "vite": "^8.0.0" - }, - "peerDependencies": { - "@pixiv/three-vrm": "^3.4.5", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "three": "^0.184.0" - }, - "elizaos": { - "app": { - "displayName": "Eliza Companion", - "category": "game", - "heroImage": "assets/hero.png" - } - }, - "publishConfig": { - "access": "public" - }, - "types": "./dist/index.d.ts", - "files": [ - "registry-entry.json", - "dist" - ] -} diff --git a/plugins/plugin-companion/public/animations/emotes/chopping.glb.gz b/plugins/plugin-companion/public/animations/emotes/chopping.glb.gz deleted file mode 100644 index e16394ecf90dd..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/chopping.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/crawling.glb.gz b/plugins/plugin-companion/public/animations/emotes/crawling.glb.gz deleted file mode 100644 index a20cdb7af5383..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/crawling.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/crying.glb.gz b/plugins/plugin-companion/public/animations/emotes/crying.glb.gz deleted file mode 100644 index 47bd7ef149fd4..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/crying.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/dance-breaking.glb.gz b/plugins/plugin-companion/public/animations/emotes/dance-breaking.glb.gz deleted file mode 100644 index 64bc04029b006..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/dance-breaking.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/dance-hiphop.glb.gz b/plugins/plugin-companion/public/animations/emotes/dance-hiphop.glb.gz deleted file mode 100644 index ebca75933c597..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/dance-hiphop.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/death.glb.gz b/plugins/plugin-companion/public/animations/emotes/death.glb.gz deleted file mode 100644 index 9cdea8f2a4bb2..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/death.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/fall.glb.gz b/plugins/plugin-companion/public/animations/emotes/fall.glb.gz deleted file mode 100644 index 7f9e3d7af58a0..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/fall.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/firing-gun.glb.gz b/plugins/plugin-companion/public/animations/emotes/firing-gun.glb.gz deleted file mode 100644 index bd6dc667de8d4..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/firing-gun.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/fishing.glb.gz b/plugins/plugin-companion/public/animations/emotes/fishing.glb.gz deleted file mode 100644 index f366065dd3832..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/fishing.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/flip.glb.gz b/plugins/plugin-companion/public/animations/emotes/flip.glb.gz deleted file mode 100644 index b36efdd059ec2..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/flip.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/float.glb.gz b/plugins/plugin-companion/public/animations/emotes/float.glb.gz deleted file mode 100644 index 2966068f74401..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/float.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/hook-punch.glb.gz b/plugins/plugin-companion/public/animations/emotes/hook-punch.glb.gz deleted file mode 100644 index 575008b5f5933..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/hook-punch.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/jump.glb.gz b/plugins/plugin-companion/public/animations/emotes/jump.glb.gz deleted file mode 100644 index 5ef9204b3b7eb..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/jump.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/kiss.glb.gz b/plugins/plugin-companion/public/animations/emotes/kiss.glb.gz deleted file mode 100644 index 78470d56e2279..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/kiss.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/looking-around.glb.gz b/plugins/plugin-companion/public/animations/emotes/looking-around.glb.gz deleted file mode 100644 index 43df0b873bebe..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/looking-around.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/punching.glb.gz b/plugins/plugin-companion/public/animations/emotes/punching.glb.gz deleted file mode 100644 index 68f79885bc7f1..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/punching.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/range.glb.gz b/plugins/plugin-companion/public/animations/emotes/range.glb.gz deleted file mode 100644 index a24b1bbbd7a11..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/range.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/rude-gesture.glb.gz b/plugins/plugin-companion/public/animations/emotes/rude-gesture.glb.gz deleted file mode 100644 index eb25a566e7e33..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/rude-gesture.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/run.glb.gz b/plugins/plugin-companion/public/animations/emotes/run.glb.gz deleted file mode 100644 index 71421e7e78fa0..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/run.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/sorrow.glb.gz b/plugins/plugin-companion/public/animations/emotes/sorrow.glb.gz deleted file mode 100644 index 6da986306f9e7..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/sorrow.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/spell-cast.glb.gz b/plugins/plugin-companion/public/animations/emotes/spell-cast.glb.gz deleted file mode 100644 index 4b02eeade9370..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/spell-cast.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/squat.glb.gz b/plugins/plugin-companion/public/animations/emotes/squat.glb.gz deleted file mode 100644 index 4653559d548e3..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/squat.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/sword_swing.glb.gz b/plugins/plugin-companion/public/animations/emotes/sword_swing.glb.gz deleted file mode 100644 index 6de5433efa2f6..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/sword_swing.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/talk.glb.gz b/plugins/plugin-companion/public/animations/emotes/talk.glb.gz deleted file mode 100644 index 7388d8da5f92f..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/talk.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/walk.glb.gz b/plugins/plugin-companion/public/animations/emotes/walk.glb.gz deleted file mode 100644 index 9d27bc6c4a6ce..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/walk.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/emotes/waving-both-hands.glb.gz b/plugins/plugin-companion/public/animations/emotes/waving-both-hands.glb.gz deleted file mode 100644 index 353990b20e0d9..0000000000000 Binary files a/plugins/plugin-companion/public/animations/emotes/waving-both-hands.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting-test.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting-test.fbx.gz deleted file mode 100644 index 344b29526c458..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting-test.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting1.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting1.fbx.gz deleted file mode 100644 index dc2d50387436c..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting1.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting2.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting2.fbx.gz deleted file mode 100644 index f90572715f5e6..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting2.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting3.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting3.fbx.gz deleted file mode 100644 index 455cd55b4e949..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting3.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting4.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting4.fbx.gz deleted file mode 100644 index 61956247a346d..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting4.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting5.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting5.fbx.gz deleted file mode 100644 index 1ca93b23f96a5..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting5.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting6.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting6.fbx.gz deleted file mode 100644 index c3e381e9471c3..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting6.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting7.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting7.fbx.gz deleted file mode 100644 index 8a5d0329871d8..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting7.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting8.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting8.fbx.gz deleted file mode 100644 index 61fe432ce7bfa..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting8.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/greetings/greeting9.fbx.gz b/plugins/plugin-companion/public/animations/greetings/greeting9.fbx.gz deleted file mode 100644 index e6e6e901ede61..0000000000000 Binary files a/plugins/plugin-companion/public/animations/greetings/greeting9.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/idle.glb.gz b/plugins/plugin-companion/public/animations/idle.glb.gz deleted file mode 100644 index 19670dc71d31c..0000000000000 Binary files a/plugins/plugin-companion/public/animations/idle.glb.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Acknowledging.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Acknowledging.fbx.gz deleted file mode 100644 index 89ce55ab1c6ba..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Acknowledging.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Agreeing 2.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Agreeing 2.fbx.gz deleted file mode 100644 index 82ba88741a392..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Agreeing 2.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Agreeing.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Agreeing.fbx.gz deleted file mode 100644 index 91201ded86546..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Agreeing.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Blow A Kiss.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Blow A Kiss.fbx.gz deleted file mode 100644 index b1018511b5f92..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Blow A Kiss.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Breakdance Freeze Var 4.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Breakdance Freeze Var 4.fbx.gz deleted file mode 100644 index 69ba7ac18070a..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Breakdance Freeze Var 4.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Breathing Idle.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Breathing Idle.fbx.gz deleted file mode 100644 index 8865b2f2482e2..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Breathing Idle.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Cheering.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Cheering.fbx.gz deleted file mode 100644 index c7236bd9c2b24..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Cheering.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Clapping.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Clapping.fbx.gz deleted file mode 100644 index 5748fb58062e9..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Clapping.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Fallen Idle.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Fallen Idle.fbx.gz deleted file mode 100644 index 9da0dbb8e7702..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Fallen Idle.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Gangnam Style.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Gangnam Style.fbx.gz deleted file mode 100644 index 637f7879e6c69..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Gangnam Style.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Happy Idle.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Happy Idle.fbx.gz deleted file mode 100644 index 73247b2735462..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Happy Idle.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Hard Head Nod.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Hard Head Nod.fbx.gz deleted file mode 100644 index 1751c63dd8647..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Hard Head Nod.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Hip Hop Dancing.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Hip Hop Dancing.fbx.gz deleted file mode 100644 index 6060f90da172e..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Hip Hop Dancing.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Joyful Jump.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Joyful Jump.fbx.gz deleted file mode 100644 index 1905bc18567c9..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Joyful Jump.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Kneeling Idle.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Kneeling Idle.fbx.gz deleted file mode 100644 index 4ab5e2227930a..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Kneeling Idle.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Looking.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Looking.fbx.gz deleted file mode 100644 index fb4fe2920b6e6..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Looking.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Mma Kick.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Mma Kick.fbx.gz deleted file mode 100644 index 3cf8cadfddebe..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Mma Kick.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Rejected.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Rejected.fbx.gz deleted file mode 100644 index 611b1a94db76f..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Rejected.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Relieved Sigh.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Relieved Sigh.fbx.gz deleted file mode 100644 index 33ad1bca46cf2..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Relieved Sigh.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Rumba Dancing.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Rumba Dancing.fbx.gz deleted file mode 100644 index 79e82ff28e4e8..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Rumba Dancing.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Salute.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Salute.fbx.gz deleted file mode 100644 index 7d52c38139ee2..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Salute.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Shoulder Rubbing.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Shoulder Rubbing.fbx.gz deleted file mode 100644 index 3e9e0ed722b86..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Shoulder Rubbing.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Spin In Place.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Spin In Place.fbx.gz deleted file mode 100644 index ace9b236cc023..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Spin In Place.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Standing Greeting 2.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Standing Greeting 2.fbx.gz deleted file mode 100644 index a8d657dcd0e8a..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Standing Greeting 2.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Surprised.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Surprised.fbx.gz deleted file mode 100644 index e2c11818fd9d6..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Surprised.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Thankful.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Thankful.fbx.gz deleted file mode 100644 index a11943748c35f..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Thankful.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Thinking.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Thinking.fbx.gz deleted file mode 100644 index a48509ce7ae3b..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Thinking.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/animations/mixamo/Whatever Gesture.fbx.gz b/plugins/plugin-companion/public/animations/mixamo/Whatever Gesture.fbx.gz deleted file mode 100644 index 8af66076a334b..0000000000000 Binary files a/plugins/plugin-companion/public/animations/mixamo/Whatever Gesture.fbx.gz and /dev/null differ diff --git a/plugins/plugin-companion/public/vrm-decoders/draco/draco_decoder.js b/plugins/plugin-companion/public/vrm-decoders/draco/draco_decoder.js deleted file mode 100644 index 04b1253b32063..0000000000000 --- a/plugins/plugin-companion/public/vrm-decoders/draco/draco_decoder.js +++ /dev/null @@ -1,50616 +0,0 @@ -var DracoDecoderModule = (() => { - var _scriptDir = - typeof document !== "undefined" && document.currentScript - ? document.currentScript.src - : undefined; - if (typeof __filename !== "undefined") _scriptDir = _scriptDir || __filename; - return (DracoDecoderModule = {}) => { - var Module = - typeof DracoDecoderModule != "undefined" ? DracoDecoderModule : {}; - var readyPromiseResolve, readyPromiseReject; - Module["ready"] = new Promise((resolve, reject) => { - readyPromiseResolve = resolve; - readyPromiseReject = reject; - }); - var isRuntimeInitialized = false; - var isModuleParsed = false; - Module["onRuntimeInitialized"] = () => { - isRuntimeInitialized = true; - if (isModuleParsed) { - if (typeof Module["onModuleLoaded"] === "function") { - Module["onModuleLoaded"](Module); - } - } - }; - Module["onModuleParsed"] = () => { - isModuleParsed = true; - if (isRuntimeInitialized) { - if (typeof Module["onModuleLoaded"] === "function") { - Module["onModuleLoaded"](Module); - } - } - }; - function isVersionSupported(versionString) { - if (typeof versionString !== "string") return false; - const version = versionString.split("."); - if (version.length < 2 || version.length > 3) return false; - if (version[0] == 1 && version[1] >= 0 && version[1] <= 5) return true; - if (version[0] != 0 || version[1] > 10) return false; - return true; - } - Module["isVersionSupported"] = isVersionSupported; - var moduleOverrides = Object.assign({}, Module); - var arguments_ = []; - var thisProgram = "./this.program"; - var quit_ = (status, toThrow) => { - throw toThrow; - }; - var ENVIRONMENT_IS_WEB = typeof window == "object"; - var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; - var ENVIRONMENT_IS_NODE = - typeof process == "object" && - typeof process.versions == "object" && - typeof process.versions.node == "string"; - var scriptDirectory = ""; - function locateFile(path) { - if (Module["locateFile"]) { - return Module["locateFile"](path, scriptDirectory); - } - return scriptDirectory + path; - } - var read_, readAsync, readBinary, setWindowTitle; - function logExceptionOnExit(e) { - if (e instanceof ExitStatus) return; - const toLog = e; - err("exiting due to exception: " + toLog); - } - if (ENVIRONMENT_IS_NODE) { - var fs = require("fs"); - var nodePath = require("path"); - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = nodePath.dirname(scriptDirectory) + "/"; - } else { - scriptDirectory = __dirname + "/"; - } - read_ = (filename, binary) => { - var ret = tryParseAsDataURI(filename); - if (ret) { - return binary ? ret : ret.toString(); - } - filename = isFileURI(filename) - ? new URL(filename) - : nodePath.normalize(filename); - return fs.readFileSync(filename, binary ? undefined : "utf8"); - }; - readBinary = (filename) => { - var ret = read_(filename, true); - if (!ret.buffer) { - ret = new Uint8Array(ret); - } - return ret; - }; - readAsync = (filename, onload, onerror) => { - var ret = tryParseAsDataURI(filename); - if (ret) { - onload(ret); - } - filename = isFileURI(filename) - ? new URL(filename) - : nodePath.normalize(filename); - fs.readFile(filename, (err, data) => { - if (err) onerror(err); - else onload(data.buffer); - }); - }; - if (process["argv"].length > 1) { - thisProgram = process["argv"][1].replace(/\\/g, "/"); - } - arguments_ = process["argv"].slice(2); - quit_ = (status, toThrow) => { - if (keepRuntimeAlive()) { - process["exitCode"] = status; - throw toThrow; - } - logExceptionOnExit(toThrow); - process["exit"](status); - }; - Module["inspect"] = () => "[Emscripten Module object]"; - } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = self.location.href; - } else if (typeof document != "undefined" && document.currentScript) { - scriptDirectory = document.currentScript.src; - } - if (_scriptDir) { - scriptDirectory = _scriptDir; - } - if (scriptDirectory.indexOf("blob:") !== 0) { - scriptDirectory = scriptDirectory.substr( - 0, - scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1, - ); - } else { - scriptDirectory = ""; - } - read_ = (url) => { - try { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, false); - xhr.send(null); - return xhr.responseText; - } catch (err) { - var data = tryParseAsDataURI(url); - if (data) { - return intArrayToString(data); - } - throw err; - } - }; - if (ENVIRONMENT_IS_WORKER) { - readBinary = (url) => { - try { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, false); - xhr.responseType = "arraybuffer"; - xhr.send(null); - return new Uint8Array(xhr.response); - } catch (err) { - var data = tryParseAsDataURI(url); - if (data) { - return data; - } - throw err; - } - }; - } - readAsync = (url, onload, onerror) => { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, true); - xhr.responseType = "arraybuffer"; - xhr.onload = () => { - if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { - onload(xhr.response); - return; - } - var data = tryParseAsDataURI(url); - if (data) { - onload(data.buffer); - return; - } - onerror(); - }; - xhr.onerror = onerror; - xhr.send(null); - }; - setWindowTitle = (title) => (document.title = title); - } else { - } - var out = Module["print"] || console.log.bind(console); - var err = Module["printErr"] || console.warn.bind(console); - Object.assign(Module, moduleOverrides); - moduleOverrides = null; - if (Module["arguments"]) arguments_ = Module["arguments"]; - if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; - if (Module["quit"]) quit_ = Module["quit"]; - var wasmBinary; - if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; - var noExitRuntime = Module["noExitRuntime"] || true; - var WebAssembly = { - Memory: function (opts) { - this.buffer = new ArrayBuffer(opts["initial"] * 65536); - }, - Module: (binary) => {}, - Instance: function (module, info) { - this.exports = - // EMSCRIPTEN_START_ASM - (function instantiate(ia) { - function c(d) { - d.set = function (a, b) { - this[a] = b; - }; - d.get = function (a) { - return this[a]; - }; - return d; - } - var e; - var f = new Uint8Array(123); - for (var a = 25; a >= 0; --a) { - f[48 + a] = 52 + a; - f[65 + a] = a; - f[97 + a] = 26 + a; - } - f[43] = 62; - f[47] = 63; - function l(m, n, o) { - var g, - h, - a = 0, - i = n, - j = o.length, - k = n + ((j * 3) >> 2) - (o[j - 2] == "=") - (o[j - 1] == "="); - for (; a < j; a += 4) { - g = f[o.charCodeAt(a + 1)]; - h = f[o.charCodeAt(a + 2)]; - m[i++] = (f[o.charCodeAt(a)] << 2) | (g >> 4); - if (i < k) m[i++] = (g << 4) | (h >> 2); - if (i < k) m[i++] = (h << 6) | f[o.charCodeAt(a + 3)]; - } - } - function p(q) { - l( - e, - 1028, - "YAQAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAE41ZHJhY28yOEF0dHJpYnV0ZU9jdGFoZWRyb25UcmFuc2Zvcm1FAADYKwAAOAQAAOAGAABfX25leHRfcHJpbWUgb3ZlcmZsb3cAdmVjdG9yAHN0ZDo6ZXhjZXB0aW9uAHNraXBfYXR0cmlidXRlX3RyYW5zZm9ybQBiYWRfYXJyYXlfbmV3X2xlbmd0aABiYXNpY19zdHJpbmcAc3RkOjpiYWRfYWxsb2MARFJBQ08AVXNpbmcgaW5jb21wYXRpYmxlIGRlY29kZXIgZm9yIHRoZSBpbnB1dCBnZW9tZXRyeS4ARmFpbGVkIHRvIGRlY29kZSBwb2ludCBhdHRyaWJ1dGVzLgBGYWlsZWQgdG8gaW5pdGlhbGl6ZSB0aGUgZGVjb2Rlci4AVW5zdXBwb3J0ZWQgbWlub3IgdmVyc2lvbi4AVW5zdXBwb3J0ZWQgbWFqb3IgdmVyc2lvbi4ASW5wdXQgaXMgbm90IGEgbWVzaC4AVW5zdXBwb3J0ZWQgZ2VvbWV0cnkgdHlwZS4ATm90IGEgRHJhY28gZmlsZS4AVW5zdXBwb3J0ZWQgZW5jb2RpbmcgbWV0aG9kLgBGYWlsZWQgdG8gZGVjb2RlIG1ldGFkYXRhLgBGYWlsZWQgdG8gZGVjb2RlIGdlb21ldHJ5IGRhdGEuAFB1cmUgdmlydHVhbCBmdW5jdGlvbiBjYWxsZWQhAAAAAAAAALQGAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAALAAAAGAAAABkAAABONWRyYWNvMzBBdHRyaWJ1dGVRdWFudGl6YXRpb25UcmFuc2Zvcm1FAAAAANgrAACIBgAA4AYAAE41ZHJhY28xOEF0dHJpYnV0ZVRyYW5zZm9ybUUAAAAAsCsAAMAGAAAAAAAAbAcAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAACAAAAAhAAAAIgAAACMAAAAkAAAAJQAAAE41ZHJhY28xN0F0dHJpYnV0ZXNEZWNvZGVyRQBONWRyYWNvMjZBdHRyaWJ1dGVzRGVjb2RlckludGVyZmFjZUUAAAAAsCsAADwHAADYKwAAIAcAAGQHAAAAAAAAzAcAACYAAAAnAAAAKAAAACkAAAAqAAAAKwAAACwAAAAtAAAALgAAAE41ZHJhY28yNlNlcXVlbnRpYWxBdHRyaWJ1dGVEZWNvZGVyRQAAAACwKwAApAcAAP////8AAAAARAgAAC8AAAAwAAAAHAAAADEAAAAyAAAAHwAAACAAAAAhAAAAMwAAADQAAAA1AAAANgAAADcAAABONWRyYWNvMzdTZXF1ZW50aWFsQXR0cmlidXRlRGVjb2RlcnNDb250cm9sbGVyRQDYKwAAFAgAAGwHAAAAAAAAuAgAADgAAAA5AAAAOgAAACkAAAAqAAAAKwAAADsAAAAtAAAAPAAAAD0AAAA+AAAAPwAAAEAAAABONWRyYWNvMzNTZXF1ZW50aWFsSW50ZWdlckF0dHJpYnV0ZURlY29kZXJFANgrAACMCAAAzAcAAAAAAABECwAAQQAAAEIAAABDAAAARAAAAEUAAABGAAAARwAAAEgAAABJAAAASgAAAEsAAABMAAAATjVkcmFjbzQwTWVzaFByZWRpY3Rpb25TY2hlbWVQYXJhbGxlbG9ncmFtRGVjb2RlcklpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVFRUVFAE41ZHJhY28yN01lc2hQcmVkaWN0aW9uU2NoZW1lRGVjb2RlcklpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVFRUVFAE41ZHJhY28yM1ByZWRpY3Rpb25TY2hlbWVEZWNvZGVySWlOU18zN1ByZWRpY3Rpb25TY2hlbWVXcmFwRGVjb2RpbmdUcmFuc2Zvcm1JaWlFRUVFAE41ZHJhY28zN1ByZWRpY3Rpb25TY2hlbWVUeXBlZERlY29kZXJJbnRlcmZhY2VJaWlFRQBONWRyYWNvMzJQcmVkaWN0aW9uU2NoZW1lRGVjb2RlckludGVyZmFjZUUATjVkcmFjbzI1UHJlZGljdGlvblNjaGVtZUludGVyZmFjZUUAsCsAAOgKAADYKwAAvQoAAAwLAADYKwAAiQoAABQLAADYKwAANQoAACALAADYKwAAnwkAACwLAADYKwAA/AgAADgLAAAAAAAAOAsAAEEAAABNAAAAIwAAAEQAAAAjAAAARgAAAEcAAABIAAAASQAAAEoAAABLAAAAIwAAAAAAAAAsCwAAQQAAAE4AAAAjAAAARAAAACMAAABGAAAARwAAAEgAAABJAAAASgAAAEsAAAAjAAAAAAAAAKwMAABPAAAAUAAAAFEAAABEAAAAUgAAAEYAAABHAAAASAAAAEkAAABKAAAAUwAAAFQAAABONWRyYWNvNTZNZXNoUHJlZGljdGlvblNjaGVtZUNvbnN0cmFpbmVkTXVsdGlQYXJhbGxlbG9ncmFtRGVjb2RlcklpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVFRUVFAADYKwAA+AsAADgLAAAAAAAAmA0AAFUAAABWAAAAVwAAAEQAAABYAAAAWQAAAFoAAABbAAAASQAAAEoAAABcAAAAXQAAAE41ZHJhY280NE1lc2hQcmVkaWN0aW9uU2NoZW1lVGV4Q29vcmRzUG9ydGFibGVEZWNvZGVySWlOU18zN1ByZWRpY3Rpb25TY2hlbWVXcmFwRGVjb2RpbmdUcmFuc2Zvcm1JaWlFRU5TXzI0TWVzaFByZWRpY3Rpb25TY2hlbWVEYXRhSU5TXzI0TWVzaEF0dHJpYnV0ZUNvcm5lclRhYmxlRUVFRUUAANgrAADwDAAAOAsAAAAAAACEDgAAXgAAAF8AAABgAAAARAAAAGEAAABiAAAAYwAAAGQAAABJAAAASgAAAGUAAABmAAAATjVkcmFjbzQyTWVzaFByZWRpY3Rpb25TY2hlbWVHZW9tZXRyaWNOb3JtYWxEZWNvZGVySWlOU18zN1ByZWRpY3Rpb25TY2hlbWVXcmFwRGVjb2RpbmdUcmFuc2Zvcm1JaWlFRU5TXzI0TWVzaFByZWRpY3Rpb25TY2hlbWVEYXRhSU5TXzI0TWVzaEF0dHJpYnV0ZUNvcm5lclRhYmxlRUVFRUUAAAAA2CsAANwNAAA4CwAAAAAAAAwQAABnAAAAaAAAAGkAAABqAAAAawAAAE41ZHJhY280OE1lc2hQcmVkaWN0aW9uU2NoZW1lR2VvbWV0cmljTm9ybWFsUHJlZGljdG9yQXJlYUlpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVFRUVFAE41ZHJhY280OE1lc2hQcmVkaWN0aW9uU2NoZW1lR2VvbWV0cmljTm9ybWFsUHJlZGljdG9yQmFzZUlpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVFRUVFAAAAsCsAAFcPAADYKwAArA4AAAQQAAAAAAAABBAAAGcAAABsAAAAIwAAAGoAAAAjAAAAAAAAAJgRAABBAAAAbQAAAG4AAABEAAAAbwAAAEYAAABHAAAASAAAAEkAAABKAAAASwAAAHAAAABONWRyYWNvNDBNZXNoUHJlZGljdGlvblNjaGVtZVBhcmFsbGVsb2dyYW1EZWNvZGVySWlOU18zN1ByZWRpY3Rpb25TY2hlbWVXcmFwRGVjb2RpbmdUcmFuc2Zvcm1JaWlFRU5TXzI0TWVzaFByZWRpY3Rpb25TY2hlbWVEYXRhSU5TXzExQ29ybmVyVGFibGVFRUVFRQBONWRyYWNvMjdNZXNoUHJlZGljdGlvblNjaGVtZURlY29kZXJJaU5TXzM3UHJlZGljdGlvblNjaGVtZVdyYXBEZWNvZGluZ1RyYW5zZm9ybUlpaUVFTlNfMjRNZXNoUHJlZGljdGlvblNjaGVtZURhdGFJTlNfMTFDb3JuZXJUYWJsZUVFRUVFAADYKwAAAhEAACwLAADYKwAAbBAAAIwRAAAAAAAAjBEAAEEAAABxAAAAIwAAAEQAAAAjAAAARgAAAEcAAABIAAAASQAAAEoAAABLAAAAIwAAAAAAAAC8EgAAcgAAAHMAAAB0AAAARAAAAHUAAABGAAAARwAAAEgAAABJAAAASgAAAHYAAAB3AAAATjVkcmFjbzU2TWVzaFByZWRpY3Rpb25TY2hlbWVDb25zdHJhaW5lZE11bHRpUGFyYWxsZWxvZ3JhbURlY29kZXJJaU5TXzM3UHJlZGljdGlvblNjaGVtZVdyYXBEZWNvZGluZ1RyYW5zZm9ybUlpaUVFTlNfMjRNZXNoUHJlZGljdGlvblNjaGVtZURhdGFJTlNfMTFDb3JuZXJUYWJsZUVFRUVFAAAA2CsAABQSAACMEQAAAAAAAJwTAAB4AAAAeQAAAHoAAABEAAAAewAAAHwAAAB9AAAAfgAAAEkAAABKAAAAfwAAAIAAAABONWRyYWNvNDRNZXNoUHJlZGljdGlvblNjaGVtZVRleENvb3Jkc1BvcnRhYmxlRGVjb2RlcklpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18xMUNvcm5lclRhYmxlRUVFRUUAAADYKwAAABMAAIwRAAAAAAAAeBQAAIEAAACCAAAAgwAAAEQAAACEAAAAhQAAAIYAAACHAAAASQAAAEoAAACIAAAAiQAAAE41ZHJhY280Mk1lc2hQcmVkaWN0aW9uU2NoZW1lR2VvbWV0cmljTm9ybWFsRGVjb2RlcklpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18xMUNvcm5lclRhYmxlRUVFRUUA2CsAAOATAACMEQAAAAAAAOQVAACKAAAAiwAAAIwAAACNAAAAjgAAAE41ZHJhY280OE1lc2hQcmVkaWN0aW9uU2NoZW1lR2VvbWV0cmljTm9ybWFsUHJlZGljdG9yQXJlYUlpTlNfMzdQcmVkaWN0aW9uU2NoZW1lV3JhcERlY29kaW5nVHJhbnNmb3JtSWlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18xMUNvcm5lclRhYmxlRUVFRUUATjVkcmFjbzQ4TWVzaFByZWRpY3Rpb25TY2hlbWVHZW9tZXRyaWNOb3JtYWxQcmVkaWN0b3JCYXNlSWlOU18zN1ByZWRpY3Rpb25TY2hlbWVXcmFwRGVjb2RpbmdUcmFuc2Zvcm1JaWlFRU5TXzI0TWVzaFByZWRpY3Rpb25TY2hlbWVEYXRhSU5TXzExQ29ybmVyVGFibGVFRUVFRQCwKwAAPhUAANgrAACgFAAA3BUAAAAAAADcFQAAigAAAI8AAAAjAAAAjQAAACMAAAAAAAAAoBYAAEEAAACQAAAAkQAAAEQAAACSAAAARgAAAEcAAABIAAAASQAAAEoAAABLAAAAkwAAAE41ZHJhY28yOFByZWRpY3Rpb25TY2hlbWVEZWx0YURlY29kZXJJaU5TXzM3UHJlZGljdGlvblNjaGVtZVdyYXBEZWNvZGluZ1RyYW5zZm9ybUlpaUVFRUUAAAAA2CsAAEQWAAAsCwAAAAAAABQXAACUAAAAlQAAAJYAAAApAAAAKgAAAJcAAAA7AAAALQAAADwAAACYAAAAmQAAAJoAAACbAAAATjVkcmFjbzMyU2VxdWVudGlhbE5vcm1hbEF0dHJpYnV0ZURlY29kZXJFAADYKwAA6BYAALgIAAAAAAAASBkAAJwAAACdAAAAngAAAJ8AAACgAAAAoQAAAKIAAACjAAAApAAAAKUAAACmAAAApwAAAE41ZHJhY280Mk1lc2hQcmVkaWN0aW9uU2NoZW1lR2VvbWV0cmljTm9ybWFsRGVjb2RlcklpTlNfNjJQcmVkaWN0aW9uU2NoZW1lTm9ybWFsT2N0YWhlZHJvbkNhbm9uaWNhbGl6ZWREZWNvZGluZ1RyYW5zZm9ybUlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVFRUVFAE41ZHJhY28yN01lc2hQcmVkaWN0aW9uU2NoZW1lRGVjb2RlcklpTlNfNjJQcmVkaWN0aW9uU2NoZW1lTm9ybWFsT2N0YWhlZHJvbkNhbm9uaWNhbGl6ZWREZWNvZGluZ1RyYW5zZm9ybUlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVFRUVFAE41ZHJhY28yM1ByZWRpY3Rpb25TY2hlbWVEZWNvZGVySWlOU182MlByZWRpY3Rpb25TY2hlbWVOb3JtYWxPY3RhaGVkcm9uQ2Fub25pY2FsaXplZERlY29kaW5nVHJhbnNmb3JtSWlFRUVFAADYKwAAwxgAACALAADYKwAAFRgAADAZAADYKwAAWBcAADwZAAAAAAAAABsAAKgAAACpAAAAqgAAAKsAAACsAAAATjVkcmFjbzQ4TWVzaFByZWRpY3Rpb25TY2hlbWVHZW9tZXRyaWNOb3JtYWxQcmVkaWN0b3JBcmVhSWlOU182MlByZWRpY3Rpb25TY2hlbWVOb3JtYWxPY3RhaGVkcm9uQ2Fub25pY2FsaXplZERlY29kaW5nVHJhbnNmb3JtSWlFRU5TXzI0TWVzaFByZWRpY3Rpb25TY2hlbWVEYXRhSU5TXzI0TWVzaEF0dHJpYnV0ZUNvcm5lclRhYmxlRUVFRUUATjVkcmFjbzQ4TWVzaFByZWRpY3Rpb25TY2hlbWVHZW9tZXRyaWNOb3JtYWxQcmVkaWN0b3JCYXNlSWlOU182MlByZWRpY3Rpb25TY2hlbWVOb3JtYWxPY3RhaGVkcm9uQ2Fub25pY2FsaXplZERlY29kaW5nVHJhbnNmb3JtSWlFRU5TXzI0TWVzaFByZWRpY3Rpb25TY2hlbWVEYXRhSU5TXzI0TWVzaEF0dHJpYnV0ZUNvcm5lclRhYmxlRUVFRUUAAACwKwAAMxoAANgrAABwGQAA+BoAAAAAAACkHAAArQAAAK4AAACvAAAAnwAAALAAAACxAAAAsgAAALMAAACkAAAApQAAALQAAAC1AAAATjVkcmFjbzQyTWVzaFByZWRpY3Rpb25TY2hlbWVHZW9tZXRyaWNOb3JtYWxEZWNvZGVySWlOU182MlByZWRpY3Rpb25TY2hlbWVOb3JtYWxPY3RhaGVkcm9uQ2Fub25pY2FsaXplZERlY29kaW5nVHJhbnNmb3JtSWlFRU5TXzI0TWVzaFByZWRpY3Rpb25TY2hlbWVEYXRhSU5TXzExQ29ybmVyVGFibGVFRUVFRQBONWRyYWNvMjdNZXNoUHJlZGljdGlvblNjaGVtZURlY29kZXJJaU5TXzYyUHJlZGljdGlvblNjaGVtZU5vcm1hbE9jdGFoZWRyb25DYW5vbmljYWxpemVkRGVjb2RpbmdUcmFuc2Zvcm1JaUVFTlNfMjRNZXNoUHJlZGljdGlvblNjaGVtZURhdGFJTlNfMTFDb3JuZXJUYWJsZUVFRUVFAAAAANgrAAD0GwAAMBkAANgrAABEGwAAmBwAAAAAAABAHgAAtgAAALcAAAC4AAAAuQAAALoAAABONWRyYWNvNDhNZXNoUHJlZGljdGlvblNjaGVtZUdlb21ldHJpY05vcm1hbFByZWRpY3RvckFyZWFJaU5TXzYyUHJlZGljdGlvblNjaGVtZU5vcm1hbE9jdGFoZWRyb25DYW5vbmljYWxpemVkRGVjb2RpbmdUcmFuc2Zvcm1JaUVFTlNfMjRNZXNoUHJlZGljdGlvblNjaGVtZURhdGFJTlNfMTFDb3JuZXJUYWJsZUVFRUVFAE41ZHJhY280OE1lc2hQcmVkaWN0aW9uU2NoZW1lR2VvbWV0cmljTm9ybWFsUHJlZGljdG9yQmFzZUlpTlNfNjJQcmVkaWN0aW9uU2NoZW1lTm9ybWFsT2N0YWhlZHJvbkNhbm9uaWNhbGl6ZWREZWNvZGluZ1RyYW5zZm9ybUlpRUVOU18yNE1lc2hQcmVkaWN0aW9uU2NoZW1lRGF0YUlOU18xMUNvcm5lclRhYmxlRUVFRUUAsCsAAIIdAADYKwAAzBwAADgeAAAAAAAA+B4AALsAAAC8AAAAvQAAAJ8AAAC+AAAAvwAAAMAAAADBAAAApAAAAKUAAADCAAAAwwAAAE41ZHJhY28yOFByZWRpY3Rpb25TY2hlbWVEZWx0YURlY29kZXJJaU5TXzYyUHJlZGljdGlvblNjaGVtZU5vcm1hbE9jdGFoZWRyb25DYW5vbmljYWxpemVkRGVjb2RpbmdUcmFuc2Zvcm1JaUVFRUUAAAAA2CsAAIQeAAAwGQAAAAAAAHwfAADEAAAAxQAAAMYAAAApAAAAKgAAAMcAAAA7AAAALQAAADwAAADIAAAAPgAAAD8AAADJAAAAygAAAMsAAABONWRyYWNvMzhTZXF1ZW50aWFsUXVhbnRpemF0aW9uQXR0cmlidXRlRGVjb2RlckUAAAAA2CsAAEgfAAC4CAAAAAAAANwfAADMAAAAzQAAAM4AAADPAAAAIwAAANAAAADRAAAA0gAAANMAAADUAAAA1QAAANYAAAAjAAAATjVkcmFjbzExTWVzaERlY29kZXJFAAAA2CsAAMQfAACcJwAAAAAAAEggAADXAAAA2AAAAM4AAADZAAAA2gAAANAAAADRAAAA0gAAANsAAADcAAAA3QAAAN4AAADfAAAATjVkcmFjbzIyTWVzaEVkZ2VicmVha2VyRGVjb2RlckUAAAAA2CsAACQgAADcHwAAAAAAADwhAADgAAAA4QAAAOIAAADjAAAA5AAAAOUAAADmAAAA5wAAAOgAAADpAAAA/////wAAAACcIQAA6gAAAOsAAADsAAAA7QAAAO4AAADvAAAA8AAAAPEAAADyAAAA8wAAAE41ZHJhY28yNk1lc2hFZGdlYnJlYWtlckRlY29kZXJJbXBsSU5TXzMxTWVzaEVkZ2VicmVha2VyVHJhdmVyc2FsRGVjb2RlckVFRQBONWRyYWNvMzVNZXNoRWRnZWJyZWFrZXJEZWNvZGVySW1wbEludGVyZmFjZUUAAACwKwAABCEAANgrAAC4IAAANCEAAE41ZHJhY28yNk1lc2hFZGdlYnJlYWtlckRlY29kZXJJbXBsSU5TXzM4TWVzaEVkZ2VicmVha2VyVHJhdmVyc2FsVmFsZW5jZURlY29kZXJFRUUAANgrAABIIQAANCEAAAAAAACYIgAA9AAAAPUAAAD2AAAATjVkcmFjbzE5RGVwdGhGaXJzdFRyYXZlcnNlcklOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVOU18zNk1lc2hBdHRyaWJ1dGVJbmRpY2VzRW5jb2RpbmdPYnNlcnZlcklTMV9FRUVFAE41ZHJhY28xM1RyYXZlcnNlckJhc2VJTlNfMjRNZXNoQXR0cmlidXRlQ29ybmVyVGFibGVFTlNfMzZNZXNoQXR0cmlidXRlSW5kaWNlc0VuY29kaW5nT2JzZXJ2ZXJJUzFfRUVFRQCwKwAAKSIAANgrAAC8IQAAkCIAAAAAAACQIgAA9wAAAPgAAAD2", - ); - l( - e, - 8900, - "AQAAAAMAAAAFAAAABwAAAAAAAACYIwAA+QAAAPoAAAD7AAAA/AAAAE41ZHJhY28yMk1lc2hUcmF2ZXJzYWxTZXF1ZW5jZXJJTlNfMjhNYXhQcmVkaWN0aW9uRGVncmVlVHJhdmVyc2VySU5TXzExQ29ybmVyVGFibGVFTlNfMzZNZXNoQXR0cmlidXRlSW5kaWNlc0VuY29kaW5nT2JzZXJ2ZXJJUzJfRUVFRUVFAE41ZHJhY28xNVBvaW50c1NlcXVlbmNlckUAAAAAsCsAAHMjAADYKwAA7CIAAJAjAAD/////AAAAAIgkAAD9AAAA/gAAAP8AAABONWRyYWNvMjhNYXhQcmVkaWN0aW9uRGVncmVlVHJhdmVyc2VySU5TXzExQ29ybmVyVGFibGVFTlNfMzZNZXNoQXR0cmlidXRlSW5kaWNlc0VuY29kaW5nT2JzZXJ2ZXJJUzFfRUVFRQBONWRyYWNvMTNUcmF2ZXJzZXJCYXNlSU5TXzExQ29ybmVyVGFibGVFTlNfMzZNZXNoQXR0cmlidXRlSW5kaWNlc0VuY29kaW5nT2JzZXJ2ZXJJUzFfRUVFRQAAsCsAACUkAADYKwAAvCMAAIAkAAAAAAAAgCQAAAABAAABAQAA/wAAAAAAAABAJQAAAgEAAAMBAAAEAQAABQEAAE41ZHJhY28yMk1lc2hUcmF2ZXJzYWxTZXF1ZW5jZXJJTlNfMTlEZXB0aEZpcnN0VHJhdmVyc2VySU5TXzExQ29ybmVyVGFibGVFTlNfMzZNZXNoQXR0cmlidXRlSW5kaWNlc0VuY29kaW5nT2JzZXJ2ZXJJUzJfRUVFRUVFAAAA2CsAAMAkAACQIwAAAAAAAMAlAAAGAQAABwEAAP8AAABONWRyYWNvMTlEZXB0aEZpcnN0VHJhdmVyc2VySU5TXzExQ29ybmVyVGFibGVFTlNfMzZNZXNoQXR0cmlidXRlSW5kaWNlc0VuY29kaW5nT2JzZXJ2ZXJJUzFfRUVFRQDYKwAAYCUAAIAkAAAAAAAAcCYAAAgBAAAJAQAACgEAAAsBAABONWRyYWNvMjJNZXNoVHJhdmVyc2FsU2VxdWVuY2VySU5TXzE5RGVwdGhGaXJzdFRyYXZlcnNlcklOU18yNE1lc2hBdHRyaWJ1dGVDb3JuZXJUYWJsZUVOU18zNk1lc2hBdHRyaWJ1dGVJbmRpY2VzRW5jb2RpbmdPYnNlcnZlcklTMl9FRUVFRUUAANgrAADkJQAAkCM=", - ); - l( - e, - 9860, - "3CYAAMwAAAAMAQAAzgAAAM8AAAANAQAA0AAAANEAAADSAAAA0wAAANQAAADVAAAA1gAAAA4BAABONWRyYWNvMjFNZXNoU2VxdWVudGlhbERlY29kZXJFANgrAAC8JgAA3B8AAAAAAAAcJwAADwEAABABAAARAQAAEgEAAE41ZHJhY28xNUxpbmVhclNlcXVlbmNlckUAAADYKwAAACcAAJAjAAAAAAAAnCcAAMwAAAATAQAAFAEAAM8AAAAjAAAAFQEAANEAAADSAAAA0w==", - ); - l( - e, - 10080, - "RmFpbGVkIHRvIHBhcnNlIERyYWNvIGhlYWRlci4ATjVkcmFjbzE3UG9pbnRDbG91ZERlY29kZXJFAAAAsCsAAH4nAAABAAAAAQAAAAIAAAACAAAABAAAAAQAAAAIAAAACAAAAAQAAAAIAAAAAQ==", - ); - l( - e, - 10211, - "wAAAAMAAAADAAAAAwP//////////AAAAACAoAAAWAQAAFwEAABgBAAAZAQAATjVkcmFjbzRNZXNoRQAAANgrAAAQKAAAZCgAAP////8AAAAAAAAAAGQoAAAaAQAAGwEAABwBAAAdAQAATjVkcmFjbzEwUG9pbnRDbG91ZEUAAAAAsCsAAEwo", - ); - l( - e, - 10356, - "AgAAAAMAAAAFAAAABwAAAAsAAAANAAAAEQAAABMAAAAXAAAAHQAAAB8AAAAlAAAAKQAAACsAAAAvAAAANQAAADsAAAA9AAAAQwAAAEcAAABJAAAATwAAAFMAAABZAAAAYQAAAGUAAABnAAAAawAAAG0AAABxAAAAfwAAAIMAAACJAAAAiwAAAJUAAACXAAAAnQAAAKMAAACnAAAArQAAALMAAAC1AAAAvwAAAMEAAADFAAAAxwAAANMAAAABAAAACwAAAA0AAAARAAAAEwAAABcAAAAdAAAAHwAAACUAAAApAAAAKwAAAC8AAAA1AAAAOwAAAD0AAABDAAAARwAAAEkAAABPAAAAUwAAAFkAAABhAAAAZQAAAGcAAABrAAAAbQAAAHEAAAB5AAAAfwAAAIMAAACJAAAAiwAAAI8AAACVAAAAlwAAAJ0AAACjAAAApwAAAKkAAACtAAAAswAAALUAAAC7AAAAvwAAAMEAAADFAAAAxwAAANEAAAAAAAAACgAAAGQAAADoAwAAECcAAKCGAQBAQg8AgJaYAADh9QUAypo7AAAAAAAAAAAwMDAxMDIwMzA0MDUwNjA3MDgwOTEwMTExMjEzMTQxNTE2MTcxODE5MjAyMTIyMjMyNDI1MjYyNzI4MjkzMDMxMzIzMzM0MzUzNjM3MzgzOTQwNDE0MjQzNDQ0NTQ2NDc0ODQ5NTA1MTUyNTM1NDU1NTY1NzU4NTk2MDYxNjI2MzY0NjU2NjY3Njg2OTcwNzE3MjczNzQ3NTc2Nzc3ODc5ODA4MTgyODM4NDg1ODY4Nzg4ODk5MDkxOTI5Mzk0OTU5Njk3OTg5OU4xMF9fY3h4YWJpdjExNl9fc2hpbV90eXBlX2luZm9FAAAAANgrAADoKgAAbC0AAE4xMF9fY3h4YWJpdjExN19fY2xhc3NfdHlwZV9pbmZvRQAAANgrAAAYKwAADCsAAE4xMF9fY3h4YWJpdjExN19fcGJhc2VfdHlwZV9pbmZvRQAAANgrAABIKwAADCsAAE4xMF9fY3h4YWJpdjExOV9fcG9pbnRlcl90eXBlX2luZm9FANgrAAB4KwAAbCsAAAAAAAA8KwAAHgEAAB8BAAAgAQAAIQEAACIBAAAjAQAAJAEAACUBAAAAAAAAICwAAB4BAAAmAQAAIAEAACEBAAAiAQAAJwEAACgBAAApAQAATjEwX19jeHhhYml2MTIwX19zaV9jbGFzc190eXBlX2luZm9FAAAAANgrAAD4KwAAPCsAAAAAAACQLAAADgAAACoBAAArAQAAAAAAALgsAAAOAAAALAEAAC0BAAAAAAAAeCwAAA4AAAAuAQAALwEAAFN0OWV4Y2VwdGlvbgAAAACwKwAAaCwAAFN0OWJhZF9hbGxvYwAAAADYKwAAgCwAAHgsAABTdDIwYmFkX2FycmF5X25ld19sZW5ndGgAAAAA2CsAAJwsAACQLAAAAAAAAOgsAAABAAAAMAEAADEBAABTdDExbG9naWNfZXJyb3IA2CsAANgsAAB4LAAAAAAAABwtAAABAAAAMgEAADEBAABTdDEybGVuZ3RoX2Vycm9yAAAAANgrAAAILQAA6CwAAAAAAABQLQAAAQAAADMBAAAxAQAAU3QxMm91dF9vZl9yYW5nZQAAAADYKwAAPC0AAOgsAABTdDl0eXBlX2luZm8AAAAAsCsAAFwt", - ); - l(e, 11636, "8C8B"); - } - var r = new ArrayBuffer(16); - var s = new Int32Array(r); - var t = new Float32Array(r); - var u = new Float64Array(r); - function v() { - throw new Error("abort"); - } - function w(x) { - t[2] = x; - } - function y(z) { - return s[z]; - } - function ha(q) { - var A = q.a; - var B = A.a; - var C = B.buffer; - B.grow = fa; - var D = new Int8Array(C); - var E = new Int16Array(C); - var F = new Int32Array(C); - var G = new Uint8Array(C); - var H = new Uint16Array(C); - var I = new Uint32Array(C); - var J = new Float32Array(C); - var K = new Float64Array(C); - var L = Math.imul; - var M = Math.fround; - var N = Math.abs; - var O = Math.clz32; - var P = Math.min; - var Q = Math.max; - var R = Math.floor; - var S = Math.ceil; - var T = Math.trunc; - var U = Math.sqrt; - var V = A.b; - var W = A.c; - var X = A.d; - var Y = A.e; - var Z = 77808; - var _ = 0; - // EMSCRIPTEN_START_FUNCS - function mc(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0, - y = 0, - z = 0; - if (!a) { - return 1; - } - e = F[(c + 20) >> 2]; - o = F[(c + 12) >> 2]; - g = F[(c + 16) >> 2]; - a: { - if ( - (((e | 0) >= (o | 0)) & (g >>> 0 >= I[(c + 8) >> 2])) | - ((e | 0) > (o | 0)) - ) { - break a; - } - o = G[(g + F[c >> 2]) | 0]; - g = (g + 1) | 0; - e = g ? e : (e + 1) | 0; - F[(c + 16) >> 2] = g; - F[(c + 20) >> 2] = e; - b: { - switch (o | 0) { - case 0: - e = a; - f = b; - g = d; - a = 0; - d = 0; - j = (Z + -64) | 0; - Z = j; - F[(j + 56) >> 2] = 0; - F[(j + 48) >> 2] = 0; - F[(j + 52) >> 2] = 0; - F[(j + 40) >> 2] = 0; - F[(j + 44) >> 2] = 0; - F[(j + 32) >> 2] = 0; - F[(j + 36) >> 2] = 0; - F[(j + 24) >> 2] = 0; - F[(j + 28) >> 2] = 0; - F[(j + 16) >> 2] = 0; - F[(j + 20) >> 2] = 0; - F[(j + 8) >> 2] = 0; - F[(j + 12) >> 2] = 0; - c: { - if (!Nd((j + 8) | 0, c)) { - break c; - } - if ( - !Md((j + 8) | 0, c) | (F[(j + 20) >> 2] ? 0 : e) - ) { - break c; - } - hc(c, 0, 0); - if (e) { - s = f << 2; - t = F[(j + 36) >> 2]; - u = F[(j + 48) >> 2]; - x = F[(j + 24) >> 2]; - l = F[(j + 56) >> 2]; - i = F[(j + 52) >> 2]; - while (1) { - d: { - if (l >>> 0 > 16383) { - break d; - } - while (1) { - if ((i | 0) <= 0) { - break d; - } - i = (i - 1) | 0; - F[(j + 52) >> 2] = i; - l = G[(i + u) | 0] | (l << 8); - F[(j + 56) >> 2] = l; - if (l >>> 0 < 16384) { - continue; - } - break; - } - } - a = l & 4095; - r = F[((a << 2) + x) >> 2]; - b = ((r << 3) + t) | 0; - l = - (((L(F[b >> 2], (l >>> 12) | 0) + a) | 0) - - F[(b + 4) >> 2]) | - 0; - F[(j + 56) >> 2] = l; - if ((f | 0) > 0) { - a = 0; - if (!G[(c + 36) | 0] | (r >>> 0 > 32)) { - break c; - } - o = (d + f) | 0; - e: { - if (!r) { - ma((g + (d << 2)) | 0, 0, s); - break e; - } - y = r & -2; - z = r & 1; - b = F[(c + 32) >> 2]; - h = F[(c + 28) >> 2]; - q = F[(c + 24) >> 2]; - while (1) { - k = 0; - a = b; - m = 0; - n = 0; - if ((r | 0) != 1) { - while (1) { - p = (q + ((a >>> 3) | 0)) | 0; - f: { - if (p >>> 0 >= h >>> 0) { - p = 0; - break f; - } - p = G[p | 0]; - b = (a + 1) | 0; - F[(c + 32) >> 2] = b; - p = (p >>> (a & 7)) & 1; - a = b; - } - p = (p << k) | m; - m = 0; - v = (q + ((a >>> 3) | 0)) | 0; - if (v >>> 0 < h >>> 0) { - m = G[v | 0]; - b = (a + 1) | 0; - F[(c + 32) >> 2] = b; - m = (m >>> (a & 7)) & 1; - a = b; - } - v = k | 1; - k = (k + 2) | 0; - m = p | (m << v); - n = (n + 2) | 0; - if ((y | 0) != (n | 0)) { - continue; - } - break; - } - } - n = (g + (d << 2)) | 0; - if (z) { - p = (q + ((a >>> 3) | 0)) | 0; - if (p >>> 0 < h >>> 0) { - p = G[p | 0]; - b = (a + 1) | 0; - F[(c + 32) >> 2] = b; - a = (p >>> (a & 7)) & 1; - } else { - a = 0; - } - m = (a << k) | m; - } - F[n >> 2] = m; - d = (d + 1) | 0; - if ((o | 0) != (d | 0)) { - continue; - } - break; - } - } - d = o; - } - w = (f + w) | 0; - if (e >>> 0 > w >>> 0) { - continue; - } - break; - } - } - D[(c + 36) | 0] = 0; - f = F[(c + 20) >> 2]; - a = 0; - m = (F[(c + 32) >> 2] + 7) | 0; - a = m >>> 0 < 7 ? 1 : a; - m = (a << 29) | (m >>> 3); - b = (m + F[(c + 16) >> 2]) | 0; - a = (((a >>> 3) | 0) + f) | 0; - F[(c + 16) >> 2] = b; - F[(c + 20) >> 2] = - b >>> 0 < m >>> 0 ? (a + 1) | 0 : a; - a = 1; - } - b = F[(j + 36) >> 2]; - if (b) { - F[(j + 40) >> 2] = b; - ja(b); - } - b = F[(j + 24) >> 2]; - if (b) { - F[(j + 28) >> 2] = b; - ja(b); - } - b = F[(j + 8) >> 2]; - if (b) { - F[(j + 12) >> 2] = b; - ja(b); - } - Z = (j - -64) | 0; - return a; - case 1: - break b; - default: - break a; - } - } - b = 0; - e = F[(c + 20) >> 2]; - o = F[(c + 12) >> 2]; - g = F[(c + 16) >> 2]; - g: { - if ( - (((e | 0) >= (o | 0)) & (g >>> 0 >= I[(c + 8) >> 2])) | - ((e | 0) > (o | 0)) - ) { - break g; - } - o = G[(g + F[c >> 2]) | 0]; - g = (g + 1) | 0; - e = g ? e : (e + 1) | 0; - F[(c + 16) >> 2] = g; - F[(c + 20) >> 2] = e; - h: { - switch ((o - 1) | 0) { - case 8: - o = a; - r = d; - e = (Z + -64) | 0; - Z = e; - F[(e + 56) >> 2] = 0; - F[(e + 48) >> 2] = 0; - F[(e + 52) >> 2] = 0; - F[(e + 40) >> 2] = 0; - F[(e + 44) >> 2] = 0; - F[(e + 32) >> 2] = 0; - F[(e + 36) >> 2] = 0; - F[(e + 24) >> 2] = 0; - F[(e + 28) >> 2] = 0; - F[(e + 16) >> 2] = 0; - F[(e + 20) >> 2] = 0; - F[(e + 8) >> 2] = 0; - F[(e + 12) >> 2] = 0; - h = (e + 8) | 0; - i: { - j: { - if (!H[(c + 38) >> 1]) { - break j; - } - if (!Ta(1, (h + 12) | 0, c)) { - break j; - } - b = F[(c + 8) >> 2]; - d = F[(c + 16) >> 2]; - f = (b - d) | 0; - i = F[(h + 12) >> 2]; - b = - (F[(c + 12) >> 2] - - ((F[(c + 20) >> 2] + (b >>> 0 < d >>> 0)) | - 0)) | - 0; - if ( - ((f >>> 0 < (i >>> 6) >>> 0) & ((b | 0) <= 0)) | - ((b | 0) < 0) - ) { - break j; - } - b = F[h >> 2]; - a = (F[(h + 4) >> 2] - b) >> 2; - k: { - if (a >>> 0 < i >>> 0) { - qa(h, (i - a) | 0); - i = F[(h + 12) >> 2]; - break k; - } - if (a >>> 0 <= i >>> 0) { - break k; - } - F[(h + 4) >> 2] = b + (i << 2); - } - g = 1; - if (!i) { - break i; - } - f = F[(c + 16) >> 2]; - d = F[(c + 20) >> 2]; - s = F[h >> 2]; - j = F[(c + 8) >> 2]; - n = F[(c + 12) >> 2]; - b = 0; - while (1) { - g = 0; - if ( - (((d | 0) >= (n | 0)) & - (f >>> 0 >= j >>> 0)) | - ((d | 0) > (n | 0)) - ) { - break i; - } - g = F[c >> 2]; - p = G[(g + f) | 0]; - a = d; - f = (f + 1) | 0; - a = f ? a : (a + 1) | 0; - F[(c + 16) >> 2] = f; - d = a; - F[(c + 20) >> 2] = a; - a = (p >>> 2) | 0; - l = 0; - l: { - m: { - n: { - o: { - t = p & 3; - switch (t | 0) { - case 0: - break m; - case 3: - break o; - default: - break n; - } - } - a = (a + b) | 0; - g = 0; - if (a >>> 0 >= i >>> 0) { - break i; - } - ma( - (s + (b << 2)) | 0, - 0, - ((p & 252) + 4) | 0, - ); - b = a; - break l; - } - while (1) { - if ( - ((f | 0) == (j | 0)) & - ((d | 0) == (n | 0)) - ) { - break j; - } - i = G[(f + g) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - a = (i << ((l << 3) | 6)) | a; - l = (l + 1) | 0; - if ((t | 0) != (l | 0)) { - continue; - } - break; - } - } - F[(s + (b << 2)) >> 2] = a; - } - b = (b + 1) | 0; - i = F[(h + 12) >> 2]; - if (b >>> 0 < i >>> 0) { - continue; - } - break; - } - a = (h + 16) | 0; - n = F[h >> 2]; - d = F[(h + 16) >> 2]; - b = (F[(h + 20) >> 2] - d) | 0; - p: { - if (b >>> 0 <= 32767) { - qa(a, (8192 - ((b >>> 2) | 0)) | 0); - break p; - } - if ((b | 0) == 32768) { - break p; - } - F[(h + 20) >> 2] = d + 32768; - } - d = (h + 28) | 0; - b = F[d >> 2]; - f = (F[(h + 32) >> 2] - b) >> 3; - q: { - if (f >>> 0 < i >>> 0) { - _a(d, (i - f) | 0); - b = F[d >> 2]; - break q; - } - if (f >>> 0 > i >>> 0) { - F[(h + 32) >> 2] = (i << 3) + b; - } - if (!i) { - break j; - } - } - j = F[a >> 2]; - f = 0; - d = 0; - while (1) { - g = (n + (f << 2)) | 0; - l = F[g >> 2]; - h = ((f << 3) + b) | 0; - a = d; - F[(h + 4) >> 2] = a; - F[h >> 2] = l; - g = F[g >> 2]; - d = (g + a) | 0; - if (d >>> 0 > 8192) { - break j; - } - r: { - if (a >>> 0 >= d >>> 0) { - break r; - } - l = 0; - h = g & 7; - if (h) { - while (1) { - F[(j + (a << 2)) >> 2] = f; - a = (a + 1) | 0; - l = (l + 1) | 0; - if ((h | 0) != (l | 0)) { - continue; - } - break; - } - } - if ((g - 1) >>> 0 <= 6) { - break r; - } - while (1) { - g = (j + (a << 2)) | 0; - F[g >> 2] = f; - F[(g + 28) >> 2] = f; - F[(g + 24) >> 2] = f; - F[(g + 20) >> 2] = f; - F[(g + 16) >> 2] = f; - F[(g + 12) >> 2] = f; - F[(g + 8) >> 2] = f; - F[(g + 4) >> 2] = f; - a = (a + 8) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - } - f = (f + 1) | 0; - if ((i | 0) != (f | 0)) { - continue; - } - break; - } - k = (d | 0) == 8192; - } - g = k; - } - s: { - if (!g | (F[(e + 20) >> 2] ? 0 : o)) { - break s; - } - d = 0; - k = (Z - 16) | 0; - Z = k; - t: { - if (!Sa(1, (k + 8) | 0, c)) { - break t; - } - a = F[(c + 8) >> 2]; - f = F[(c + 16) >> 2]; - g = (a - f) | 0; - j = F[(k + 12) >> 2]; - i = F[(c + 20) >> 2]; - a = - (F[(c + 12) >> 2] - - ((i + (a >>> 0 < f >>> 0)) | 0)) | - 0; - b = F[(k + 8) >> 2]; - if ( - (((j | 0) == (a | 0)) & (g >>> 0 < b >>> 0)) | - (a >>> 0 < j >>> 0) - ) { - break t; - } - a = (i + j) | 0; - g = (b + f) | 0; - a = g >>> 0 < f >>> 0 ? (a + 1) | 0 : a; - F[(c + 16) >> 2] = g; - F[(c + 20) >> 2] = a; - if ((b | 0) <= 0) { - break t; - } - a = (f + F[c >> 2]) | 0; - F[(e + 48) >> 2] = a; - c = (b - 1) | 0; - f = (c + a) | 0; - g = G[f | 0]; - u: { - if (g >>> 0 <= 63) { - F[(e + 52) >> 2] = c; - a = G[f | 0] & 63; - break u; - } - v: { - switch ((((g >>> 6) | 0) - 1) | 0) { - case 0: - if (b >>> 0 < 2) { - break t; - } - b = (b - 2) | 0; - F[(e + 52) >> 2] = b; - a = (a + b) | 0; - a = - ((G[(a + 1) | 0] << 8) & 16128) | - G[a | 0]; - break u; - case 1: - if (b >>> 0 < 3) { - break t; - } - b = (b - 3) | 0; - F[(e + 52) >> 2] = b; - a = (a + b) | 0; - a = - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) & 4128768) | - G[a | 0]; - break u; - default: - break v; - } - } - b = (b - 4) | 0; - F[(e + 52) >> 2] = b; - a = (a + b) | 0; - a = - (G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | - (G[(a + 3) | 0] << 24))) & - 1073741823; - } - F[(e + 56) >> 2] = a + 32768; - d = a >>> 0 < 8355840; - } - Z = (k + 16) | 0; - if (!d) { - break s; - } - if (!o) { - m = 1; - break s; - } - b = F[(e + 52) >> 2]; - a = F[(e + 56) >> 2]; - c = F[(e + 36) >> 2]; - d = F[(e + 48) >> 2]; - f = F[(e + 24) >> 2]; - while (1) { - w: { - if (a >>> 0 > 32767) { - break w; - } - while (1) { - if ((b | 0) <= 0) { - break w; - } - b = (b - 1) | 0; - F[(e + 52) >> 2] = b; - a = G[(b + d) | 0] | (a << 8); - F[(e + 56) >> 2] = a; - if (a >>> 0 < 32768) { - continue; - } - break; - } - } - m = a & 8191; - k = F[(f + (m << 2)) >> 2]; - g = (c + (k << 3)) | 0; - a = - (((L(F[g >> 2], (a >>> 13) | 0) + m) | 0) - - F[(g + 4) >> 2]) | - 0; - F[(e + 56) >> 2] = a; - F[(r + (q << 2)) >> 2] = k; - m = 1; - q = (q + 1) | 0; - if ((o | 0) != (q | 0)) { - continue; - } - break; - } - } - a = F[(e + 36) >> 2]; - if (a) { - F[(e + 40) >> 2] = a; - ja(a); - } - a = F[(e + 24) >> 2]; - if (a) { - F[(e + 28) >> 2] = a; - ja(a); - } - a = F[(e + 8) >> 2]; - if (a) { - F[(e + 12) >> 2] = a; - ja(a); - } - Z = (e - -64) | 0; - b = m; - break g; - case 9: - o = a; - r = d; - g = (Z + -64) | 0; - Z = g; - F[(g + 56) >> 2] = 0; - F[(g + 48) >> 2] = 0; - F[(g + 52) >> 2] = 0; - F[(g + 40) >> 2] = 0; - F[(g + 44) >> 2] = 0; - F[(g + 32) >> 2] = 0; - F[(g + 36) >> 2] = 0; - F[(g + 24) >> 2] = 0; - F[(g + 28) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - F[(g + 8) >> 2] = 0; - F[(g + 12) >> 2] = 0; - h = (g + 8) | 0; - x: { - y: { - if (!H[(c + 38) >> 1]) { - break y; - } - if (!Ta(1, (h + 12) | 0, c)) { - break y; - } - b = F[(c + 8) >> 2]; - d = F[(c + 16) >> 2]; - f = (b - d) | 0; - i = F[(h + 12) >> 2]; - b = - (F[(c + 12) >> 2] - - ((F[(c + 20) >> 2] + (b >>> 0 < d >>> 0)) | - 0)) | - 0; - if ( - ((f >>> 0 < (i >>> 6) >>> 0) & ((b | 0) <= 0)) | - ((b | 0) < 0) - ) { - break y; - } - b = F[h >> 2]; - a = (F[(h + 4) >> 2] - b) >> 2; - z: { - if (a >>> 0 < i >>> 0) { - qa(h, (i - a) | 0); - i = F[(h + 12) >> 2]; - break z; - } - if (a >>> 0 <= i >>> 0) { - break z; - } - F[(h + 4) >> 2] = b + (i << 2); - } - e = 1; - if (!i) { - break x; - } - f = F[(c + 16) >> 2]; - d = F[(c + 20) >> 2]; - s = F[h >> 2]; - j = F[(c + 8) >> 2]; - n = F[(c + 12) >> 2]; - b = 0; - while (1) { - e = 0; - if ( - (((d | 0) >= (n | 0)) & - (f >>> 0 >= j >>> 0)) | - ((d | 0) > (n | 0)) - ) { - break x; - } - t = F[c >> 2]; - p = G[(t + f) | 0]; - e = d; - f = (f + 1) | 0; - e = f ? e : (e + 1) | 0; - F[(c + 16) >> 2] = f; - d = e; - F[(c + 20) >> 2] = e; - a = (p >>> 2) | 0; - l = 0; - A: { - B: { - C: { - D: { - e = p & 3; - switch (e | 0) { - case 0: - break B; - case 3: - break D; - default: - break C; - } - } - a = (a + b) | 0; - e = 0; - if (a >>> 0 >= i >>> 0) { - break x; - } - ma( - (s + (b << 2)) | 0, - 0, - ((p & 252) + 4) | 0, - ); - b = a; - break A; - } - while (1) { - if ( - ((f | 0) == (j | 0)) & - ((d | 0) == (n | 0)) - ) { - break y; - } - i = G[(f + t) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - a = (i << ((l << 3) | 6)) | a; - l = (l + 1) | 0; - if ((e | 0) != (l | 0)) { - continue; - } - break; - } - } - F[(s + (b << 2)) >> 2] = a; - } - b = (b + 1) | 0; - i = F[(h + 12) >> 2]; - if (b >>> 0 < i >>> 0) { - continue; - } - break; - } - a = (h + 16) | 0; - n = F[h >> 2]; - d = F[(h + 16) >> 2]; - b = (F[(h + 20) >> 2] - d) | 0; - E: { - if (b >>> 0 <= 131071) { - qa(a, (32768 - ((b >>> 2) | 0)) | 0); - break E; - } - if ((b | 0) == 131072) { - break E; - } - F[(h + 20) >> 2] = d + 131072; - } - d = (h + 28) | 0; - b = F[d >> 2]; - f = (F[(h + 32) >> 2] - b) >> 3; - F: { - if (f >>> 0 < i >>> 0) { - _a(d, (i - f) | 0); - b = F[d >> 2]; - break F; - } - if (f >>> 0 > i >>> 0) { - F[(h + 32) >> 2] = (i << 3) + b; - } - if (!i) { - break y; - } - } - j = F[a >> 2]; - f = 0; - d = 0; - while (1) { - e = (n + (f << 2)) | 0; - l = F[e >> 2]; - h = ((f << 3) + b) | 0; - a = d; - F[(h + 4) >> 2] = a; - F[h >> 2] = l; - e = F[e >> 2]; - d = (e + a) | 0; - if (d >>> 0 > 32768) { - break y; - } - G: { - if (a >>> 0 >= d >>> 0) { - break G; - } - l = 0; - h = e & 7; - if (h) { - while (1) { - F[(j + (a << 2)) >> 2] = f; - a = (a + 1) | 0; - l = (l + 1) | 0; - if ((h | 0) != (l | 0)) { - continue; - } - break; - } - } - if ((e - 1) >>> 0 <= 6) { - break G; - } - while (1) { - e = (j + (a << 2)) | 0; - F[e >> 2] = f; - F[(e + 28) >> 2] = f; - F[(e + 24) >> 2] = f; - F[(e + 20) >> 2] = f; - F[(e + 16) >> 2] = f; - F[(e + 12) >> 2] = f; - F[(e + 8) >> 2] = f; - F[(e + 4) >> 2] = f; - a = (a + 8) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - } - f = (f + 1) | 0; - if ((i | 0) != (f | 0)) { - continue; - } - break; - } - k = (d | 0) == 32768; - } - e = k; - } - H: { - if (!e | (F[(g + 20) >> 2] ? 0 : o)) { - break H; - } - d = 0; - f = (Z - 16) | 0; - Z = f; - I: { - if (!Sa(1, (f + 8) | 0, c)) { - break I; - } - e = F[(c + 8) >> 2]; - b = F[(c + 16) >> 2]; - k = (e - b) | 0; - j = F[(f + 12) >> 2]; - i = F[(c + 20) >> 2]; - e = - (F[(c + 12) >> 2] - - ((i + (b >>> 0 > e >>> 0)) | 0)) | - 0; - a = F[(f + 8) >> 2]; - if ( - (((j | 0) == (e | 0)) & (k >>> 0 < a >>> 0)) | - (e >>> 0 < j >>> 0) - ) { - break I; - } - e = (i + j) | 0; - k = (a + b) | 0; - e = k >>> 0 < b >>> 0 ? (e + 1) | 0 : e; - F[(c + 16) >> 2] = k; - F[(c + 20) >> 2] = e; - if ((a | 0) <= 0) { - break I; - } - b = (b + F[c >> 2]) | 0; - F[(g + 48) >> 2] = b; - c = (a - 1) | 0; - e = (c + b) | 0; - k = G[e | 0]; - J: { - if (k >>> 0 <= 63) { - F[(g + 52) >> 2] = c; - a = G[e | 0] & 63; - break J; - } - K: { - switch ((((k >>> 6) | 0) - 1) | 0) { - case 0: - if (a >>> 0 < 2) { - break I; - } - a = (a - 2) | 0; - F[(g + 52) >> 2] = a; - a = (a + b) | 0; - a = - ((G[(a + 1) | 0] << 8) & 16128) | - G[a | 0]; - break J; - case 1: - if (a >>> 0 < 3) { - break I; - } - a = (a - 3) | 0; - F[(g + 52) >> 2] = a; - a = (a + b) | 0; - a = - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) & 4128768) | - G[a | 0]; - break J; - default: - break K; - } - } - a = (a - 4) | 0; - F[(g + 52) >> 2] = a; - a = (a + b) | 0; - a = - (G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | - (G[(a + 3) | 0] << 24))) & - 1073741823; - } - F[(g + 56) >> 2] = a + 131072; - d = a >>> 0 < 33423360; - } - Z = (f + 16) | 0; - if (!d) { - break H; - } - if (!o) { - m = 1; - break H; - } - b = F[(g + 52) >> 2]; - a = F[(g + 56) >> 2]; - c = F[(g + 36) >> 2]; - d = F[(g + 48) >> 2]; - f = F[(g + 24) >> 2]; - while (1) { - L: { - if (a >>> 0 > 131071) { - break L; - } - while (1) { - if ((b | 0) <= 0) { - break L; - } - b = (b - 1) | 0; - F[(g + 52) >> 2] = b; - a = G[(b + d) | 0] | (a << 8); - F[(g + 56) >> 2] = a; - if (a >>> 0 < 131072) { - continue; - } - break; - } - } - m = a & 32767; - e = F[(f + (m << 2)) >> 2]; - k = (c + (e << 3)) | 0; - a = - (((L(F[k >> 2], (a >>> 15) | 0) + m) | 0) - - F[(k + 4) >> 2]) | - 0; - F[(g + 56) >> 2] = a; - F[(r + (q << 2)) >> 2] = e; - m = 1; - q = (q + 1) | 0; - if ((o | 0) != (q | 0)) { - continue; - } - break; - } - } - a = F[(g + 36) >> 2]; - if (a) { - F[(g + 40) >> 2] = a; - ja(a); - } - a = F[(g + 24) >> 2]; - if (a) { - F[(g + 28) >> 2] = a; - ja(a); - } - a = F[(g + 8) >> 2]; - if (a) { - F[(g + 12) >> 2] = a; - ja(a); - } - Z = (g - -64) | 0; - b = m; - break g; - case 10: - o = a; - r = d; - g = (Z + -64) | 0; - Z = g; - F[(g + 56) >> 2] = 0; - F[(g + 48) >> 2] = 0; - F[(g + 52) >> 2] = 0; - F[(g + 40) >> 2] = 0; - F[(g + 44) >> 2] = 0; - F[(g + 32) >> 2] = 0; - F[(g + 36) >> 2] = 0; - F[(g + 24) >> 2] = 0; - F[(g + 28) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - F[(g + 8) >> 2] = 0; - F[(g + 12) >> 2] = 0; - h = (g + 8) | 0; - M: { - N: { - if (!H[(c + 38) >> 1]) { - break N; - } - if (!Ta(1, (h + 12) | 0, c)) { - break N; - } - b = F[(c + 8) >> 2]; - d = F[(c + 16) >> 2]; - f = (b - d) | 0; - i = F[(h + 12) >> 2]; - b = - (F[(c + 12) >> 2] - - ((F[(c + 20) >> 2] + (b >>> 0 < d >>> 0)) | - 0)) | - 0; - if ( - ((f >>> 0 < (i >>> 6) >>> 0) & ((b | 0) <= 0)) | - ((b | 0) < 0) - ) { - break N; - } - b = F[h >> 2]; - a = (F[(h + 4) >> 2] - b) >> 2; - O: { - if (a >>> 0 < i >>> 0) { - qa(h, (i - a) | 0); - i = F[(h + 12) >> 2]; - break O; - } - if (a >>> 0 <= i >>> 0) { - break O; - } - F[(h + 4) >> 2] = b + (i << 2); - } - e = 1; - if (!i) { - break M; - } - f = F[(c + 16) >> 2]; - d = F[(c + 20) >> 2]; - s = F[h >> 2]; - j = F[(c + 8) >> 2]; - n = F[(c + 12) >> 2]; - b = 0; - while (1) { - e = 0; - if ( - (((d | 0) >= (n | 0)) & - (f >>> 0 >= j >>> 0)) | - ((d | 0) > (n | 0)) - ) { - break M; - } - t = F[c >> 2]; - p = G[(t + f) | 0]; - a = d; - f = (f + 1) | 0; - a = f ? a : (a + 1) | 0; - F[(c + 16) >> 2] = f; - d = a; - F[(c + 20) >> 2] = a; - a = (p >>> 2) | 0; - l = 0; - P: { - Q: { - R: { - S: { - u = p & 3; - switch (u | 0) { - case 0: - break Q; - case 3: - break S; - default: - break R; - } - } - a = (a + b) | 0; - e = 0; - if (a >>> 0 >= i >>> 0) { - break M; - } - ma( - (s + (b << 2)) | 0, - 0, - ((p & 252) + 4) | 0, - ); - b = a; - break P; - } - while (1) { - if ( - ((f | 0) == (j | 0)) & - ((d | 0) == (n | 0)) - ) { - break N; - } - i = G[(f + t) | 0]; - e = d; - f = (f + 1) | 0; - e = f ? e : (e + 1) | 0; - F[(c + 16) >> 2] = f; - d = e; - F[(c + 20) >> 2] = e; - a = (i << ((l << 3) | 6)) | a; - l = (l + 1) | 0; - if ((u | 0) != (l | 0)) { - continue; - } - break; - } - } - F[(s + (b << 2)) >> 2] = a; - } - b = (b + 1) | 0; - i = F[(h + 12) >> 2]; - if (b >>> 0 < i >>> 0) { - continue; - } - break; - } - a = (h + 16) | 0; - n = F[h >> 2]; - d = F[(h + 16) >> 2]; - b = (F[(h + 20) >> 2] - d) | 0; - T: { - if (b >>> 0 <= 262143) { - qa(a, (65536 - ((b >>> 2) | 0)) | 0); - break T; - } - if ((b | 0) == 262144) { - break T; - } - F[(h + 20) >> 2] = d + 262144; - } - d = (h + 28) | 0; - b = F[d >> 2]; - f = (F[(h + 32) >> 2] - b) >> 3; - U: { - if (f >>> 0 < i >>> 0) { - _a(d, (i - f) | 0); - b = F[d >> 2]; - break U; - } - if (f >>> 0 > i >>> 0) { - F[(h + 32) >> 2] = (i << 3) + b; - } - if (!i) { - break N; - } - } - j = F[a >> 2]; - f = 0; - d = 0; - while (1) { - e = (n + (f << 2)) | 0; - l = F[e >> 2]; - h = ((f << 3) + b) | 0; - a = d; - F[(h + 4) >> 2] = a; - F[h >> 2] = l; - e = F[e >> 2]; - d = (e + a) | 0; - if (d >>> 0 > 65536) { - break N; - } - V: { - if (a >>> 0 >= d >>> 0) { - break V; - } - l = 0; - h = e & 7; - if (h) { - while (1) { - F[(j + (a << 2)) >> 2] = f; - a = (a + 1) | 0; - l = (l + 1) | 0; - if ((h | 0) != (l | 0)) { - continue; - } - break; - } - } - if ((e - 1) >>> 0 <= 6) { - break V; - } - while (1) { - e = (j + (a << 2)) | 0; - F[e >> 2] = f; - F[(e + 28) >> 2] = f; - F[(e + 24) >> 2] = f; - F[(e + 20) >> 2] = f; - F[(e + 16) >> 2] = f; - F[(e + 12) >> 2] = f; - F[(e + 8) >> 2] = f; - F[(e + 4) >> 2] = f; - a = (a + 8) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - } - f = (f + 1) | 0; - if ((i | 0) != (f | 0)) { - continue; - } - break; - } - k = (d | 0) == 65536; - } - e = k; - } - W: { - if (!e | (F[(g + 20) >> 2] ? 0 : o)) { - break W; - } - d = 0; - e = (Z - 16) | 0; - Z = e; - X: { - if (!Sa(1, (e + 8) | 0, c)) { - break X; - } - a = F[(c + 8) >> 2]; - f = F[(c + 16) >> 2]; - k = (a - f) | 0; - j = F[(e + 12) >> 2]; - i = F[(c + 20) >> 2]; - a = - (F[(c + 12) >> 2] - - ((i + (a >>> 0 < f >>> 0)) | 0)) | - 0; - b = F[(e + 8) >> 2]; - if ( - (((j | 0) == (a | 0)) & (k >>> 0 < b >>> 0)) | - (a >>> 0 < j >>> 0) - ) { - break X; - } - a = (i + j) | 0; - k = (b + f) | 0; - a = k >>> 0 < f >>> 0 ? (a + 1) | 0 : a; - F[(c + 16) >> 2] = k; - F[(c + 20) >> 2] = a; - if ((b | 0) <= 0) { - break X; - } - a = (f + F[c >> 2]) | 0; - F[(g + 48) >> 2] = a; - c = (b - 1) | 0; - f = (c + a) | 0; - k = G[f | 0]; - Y: { - if (k >>> 0 <= 63) { - F[(g + 52) >> 2] = c; - a = G[f | 0] & 63; - break Y; - } - Z: { - switch ((((k >>> 6) | 0) - 1) | 0) { - case 0: - if (b >>> 0 < 2) { - break X; - } - b = (b - 2) | 0; - F[(g + 52) >> 2] = b; - a = (a + b) | 0; - a = - ((G[(a + 1) | 0] << 8) & 16128) | - G[a | 0]; - break Y; - case 1: - if (b >>> 0 < 3) { - break X; - } - b = (b - 3) | 0; - F[(g + 52) >> 2] = b; - a = (a + b) | 0; - a = - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) & 4128768) | - G[a | 0]; - break Y; - default: - break Z; - } - } - b = (b - 4) | 0; - F[(g + 52) >> 2] = b; - a = (a + b) | 0; - a = - (G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | - (G[(a + 3) | 0] << 24))) & - 1073741823; - } - F[(g + 56) >> 2] = a + 262144; - d = a >>> 0 < 66846720; - } - Z = (e + 16) | 0; - if (!d) { - break W; - } - if (!o) { - m = 1; - break W; - } - b = F[(g + 52) >> 2]; - a = F[(g + 56) >> 2]; - c = F[(g + 36) >> 2]; - d = F[(g + 48) >> 2]; - f = F[(g + 24) >> 2]; - while (1) { - _: { - if (a >>> 0 > 262143) { - break _; - } - while (1) { - if ((b | 0) <= 0) { - break _; - } - b = (b - 1) | 0; - F[(g + 52) >> 2] = b; - a = G[(b + d) | 0] | (a << 8); - F[(g + 56) >> 2] = a; - if (a >>> 0 < 262144) { - continue; - } - break; - } - } - m = a & 65535; - e = F[(f + (m << 2)) >> 2]; - k = (c + (e << 3)) | 0; - a = - (((L(F[k >> 2], (a >>> 16) | 0) + m) | 0) - - F[(k + 4) >> 2]) | - 0; - F[(g + 56) >> 2] = a; - F[(r + (q << 2)) >> 2] = e; - m = 1; - q = (q + 1) | 0; - if ((o | 0) != (q | 0)) { - continue; - } - break; - } - } - a = F[(g + 36) >> 2]; - if (a) { - F[(g + 40) >> 2] = a; - ja(a); - } - a = F[(g + 24) >> 2]; - if (a) { - F[(g + 28) >> 2] = a; - ja(a); - } - a = F[(g + 8) >> 2]; - if (a) { - F[(g + 12) >> 2] = a; - ja(a); - } - Z = (g - -64) | 0; - b = m; - break g; - case 11: - o = a; - r = d; - g = (Z + -64) | 0; - Z = g; - F[(g + 56) >> 2] = 0; - F[(g + 48) >> 2] = 0; - F[(g + 52) >> 2] = 0; - F[(g + 40) >> 2] = 0; - F[(g + 44) >> 2] = 0; - F[(g + 32) >> 2] = 0; - F[(g + 36) >> 2] = 0; - F[(g + 24) >> 2] = 0; - F[(g + 28) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - F[(g + 8) >> 2] = 0; - F[(g + 12) >> 2] = 0; - h = (g + 8) | 0; - $: { - aa: { - if (!H[(c + 38) >> 1]) { - break aa; - } - if (!Ta(1, (h + 12) | 0, c)) { - break aa; - } - b = F[(c + 8) >> 2]; - d = F[(c + 16) >> 2]; - f = (b - d) | 0; - i = F[(h + 12) >> 2]; - b = - (F[(c + 12) >> 2] - - ((F[(c + 20) >> 2] + (b >>> 0 < d >>> 0)) | - 0)) | - 0; - if ( - ((f >>> 0 < (i >>> 6) >>> 0) & ((b | 0) <= 0)) | - ((b | 0) < 0) - ) { - break aa; - } - b = F[h >> 2]; - a = (F[(h + 4) >> 2] - b) >> 2; - ba: { - if (a >>> 0 < i >>> 0) { - qa(h, (i - a) | 0); - i = F[(h + 12) >> 2]; - break ba; - } - if (a >>> 0 <= i >>> 0) { - break ba; - } - F[(h + 4) >> 2] = b + (i << 2); - } - e = 1; - if (!i) { - break $; - } - f = F[(c + 16) >> 2]; - d = F[(c + 20) >> 2]; - s = F[h >> 2]; - j = F[(c + 8) >> 2]; - n = F[(c + 12) >> 2]; - b = 0; - while (1) { - e = 0; - if ( - (((d | 0) >= (n | 0)) & - (f >>> 0 >= j >>> 0)) | - ((d | 0) > (n | 0)) - ) { - break $; - } - t = F[c >> 2]; - p = G[(t + f) | 0]; - e = d; - f = (f + 1) | 0; - e = f ? e : (e + 1) | 0; - F[(c + 16) >> 2] = f; - d = e; - F[(c + 20) >> 2] = e; - a = (p >>> 2) | 0; - l = 0; - ca: { - da: { - ea: { - fa: { - e = p & 3; - switch (e | 0) { - case 0: - break da; - case 3: - break fa; - default: - break ea; - } - } - a = (a + b) | 0; - e = 0; - if (a >>> 0 >= i >>> 0) { - break $; - } - ma( - (s + (b << 2)) | 0, - 0, - ((p & 252) + 4) | 0, - ); - b = a; - break ca; - } - while (1) { - if ( - ((f | 0) == (j | 0)) & - ((d | 0) == (n | 0)) - ) { - break aa; - } - i = G[(f + t) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - a = (i << ((l << 3) | 6)) | a; - l = (l + 1) | 0; - if ((e | 0) != (l | 0)) { - continue; - } - break; - } - } - F[(s + (b << 2)) >> 2] = a; - } - b = (b + 1) | 0; - i = F[(h + 12) >> 2]; - if (b >>> 0 < i >>> 0) { - continue; - } - break; - } - a = (h + 16) | 0; - n = F[h >> 2]; - d = F[(h + 16) >> 2]; - b = (F[(h + 20) >> 2] - d) | 0; - ga: { - if (b >>> 0 <= 1048575) { - qa(a, (262144 - ((b >>> 2) | 0)) | 0); - break ga; - } - if ((b | 0) == 1048576) { - break ga; - } - F[(h + 20) >> 2] = d - -1048576; - } - d = (h + 28) | 0; - b = F[d >> 2]; - f = (F[(h + 32) >> 2] - b) >> 3; - ha: { - if (f >>> 0 < i >>> 0) { - _a(d, (i - f) | 0); - b = F[d >> 2]; - break ha; - } - if (f >>> 0 > i >>> 0) { - F[(h + 32) >> 2] = (i << 3) + b; - } - if (!i) { - break aa; - } - } - j = F[a >> 2]; - f = 0; - d = 0; - while (1) { - e = (n + (f << 2)) | 0; - l = F[e >> 2]; - h = ((f << 3) + b) | 0; - a = d; - F[(h + 4) >> 2] = a; - F[h >> 2] = l; - e = F[e >> 2]; - d = (e + a) | 0; - if (d >>> 0 > 262144) { - break aa; - } - ia: { - if (a >>> 0 >= d >>> 0) { - break ia; - } - l = 0; - h = e & 7; - if (h) { - while (1) { - F[(j + (a << 2)) >> 2] = f; - a = (a + 1) | 0; - l = (l + 1) | 0; - if ((h | 0) != (l | 0)) { - continue; - } - break; - } - } - if ((e - 1) >>> 0 <= 6) { - break ia; - } - while (1) { - e = (j + (a << 2)) | 0; - F[e >> 2] = f; - F[(e + 28) >> 2] = f; - F[(e + 24) >> 2] = f; - F[(e + 20) >> 2] = f; - F[(e + 16) >> 2] = f; - F[(e + 12) >> 2] = f; - F[(e + 8) >> 2] = f; - F[(e + 4) >> 2] = f; - a = (a + 8) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - } - f = (f + 1) | 0; - if ((i | 0) != (f | 0)) { - continue; - } - break; - } - k = (d | 0) == 262144; - } - e = k; - } - ja: { - if (!e | (F[(g + 20) >> 2] ? 0 : o)) { - break ja; - } - d = 0; - f = (Z - 16) | 0; - Z = f; - ka: { - if (!Sa(1, (f + 8) | 0, c)) { - break ka; - } - e = F[(c + 8) >> 2]; - b = F[(c + 16) >> 2]; - k = (e - b) | 0; - j = F[(f + 12) >> 2]; - i = F[(c + 20) >> 2]; - e = - (F[(c + 12) >> 2] - - ((i + (b >>> 0 > e >>> 0)) | 0)) | - 0; - a = F[(f + 8) >> 2]; - if ( - (((j | 0) == (e | 0)) & (k >>> 0 < a >>> 0)) | - (e >>> 0 < j >>> 0) - ) { - break ka; - } - e = (i + j) | 0; - k = (a + b) | 0; - e = k >>> 0 < b >>> 0 ? (e + 1) | 0 : e; - F[(c + 16) >> 2] = k; - F[(c + 20) >> 2] = e; - if ((a | 0) <= 0) { - break ka; - } - b = (b + F[c >> 2]) | 0; - F[(g + 48) >> 2] = b; - c = (a - 1) | 0; - e = (c + b) | 0; - k = G[e | 0]; - la: { - if (k >>> 0 <= 63) { - F[(g + 52) >> 2] = c; - a = G[e | 0] & 63; - break la; - } - ma: { - switch ((((k >>> 6) | 0) - 1) | 0) { - case 0: - if (a >>> 0 < 2) { - break ka; - } - a = (a - 2) | 0; - F[(g + 52) >> 2] = a; - a = (a + b) | 0; - a = - ((G[(a + 1) | 0] << 8) & 16128) | - G[a | 0]; - break la; - case 1: - if (a >>> 0 < 3) { - break ka; - } - a = (a - 3) | 0; - F[(g + 52) >> 2] = a; - a = (a + b) | 0; - a = - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) & 4128768) | - G[a | 0]; - break la; - default: - break ma; - } - } - a = (a - 4) | 0; - F[(g + 52) >> 2] = a; - a = (a + b) | 0; - a = - (G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | - (G[(a + 3) | 0] << 24))) & - 1073741823; - } - F[(g + 56) >> 2] = a - -1048576; - d = a >>> 0 < 267386880; - } - Z = (f + 16) | 0; - if (!d) { - break ja; - } - if (!o) { - m = 1; - break ja; - } - b = F[(g + 52) >> 2]; - a = F[(g + 56) >> 2]; - c = F[(g + 36) >> 2]; - d = F[(g + 48) >> 2]; - f = F[(g + 24) >> 2]; - while (1) { - na: { - if (a >>> 0 > 1048575) { - break na; - } - while (1) { - if ((b | 0) <= 0) { - break na; - } - b = (b - 1) | 0; - F[(g + 52) >> 2] = b; - a = G[(b + d) | 0] | (a << 8); - F[(g + 56) >> 2] = a; - if (a >>> 0 < 1048576) { - continue; - } - break; - } - } - m = a & 262143; - e = F[(f + (m << 2)) >> 2]; - k = (c + (e << 3)) | 0; - a = - (((L(F[k >> 2], (a >>> 18) | 0) + m) | 0) - - F[(k + 4) >> 2]) | - 0; - F[(g + 56) >> 2] = a; - F[(r + (q << 2)) >> 2] = e; - m = 1; - q = (q + 1) | 0; - if ((o | 0) != (q | 0)) { - continue; - } - break; - } - } - a = F[(g + 36) >> 2]; - if (a) { - F[(g + 40) >> 2] = a; - ja(a); - } - a = F[(g + 24) >> 2]; - if (a) { - F[(g + 28) >> 2] = a; - ja(a); - } - a = F[(g + 8) >> 2]; - if (a) { - F[(g + 12) >> 2] = a; - ja(a); - } - Z = (g - -64) | 0; - b = m; - break g; - case 12: - o = a; - r = d; - e = (Z + -64) | 0; - Z = e; - F[(e + 56) >> 2] = 0; - F[(e + 48) >> 2] = 0; - F[(e + 52) >> 2] = 0; - F[(e + 40) >> 2] = 0; - F[(e + 44) >> 2] = 0; - F[(e + 32) >> 2] = 0; - F[(e + 36) >> 2] = 0; - F[(e + 24) >> 2] = 0; - F[(e + 28) >> 2] = 0; - F[(e + 16) >> 2] = 0; - F[(e + 20) >> 2] = 0; - F[(e + 8) >> 2] = 0; - F[(e + 12) >> 2] = 0; - h = (e + 8) | 0; - oa: { - pa: { - if (!H[(c + 38) >> 1]) { - break pa; - } - if (!Ta(1, (h + 12) | 0, c)) { - break pa; - } - b = F[(c + 8) >> 2]; - d = F[(c + 16) >> 2]; - f = (b - d) | 0; - i = F[(h + 12) >> 2]; - b = - (F[(c + 12) >> 2] - - ((F[(c + 20) >> 2] + (b >>> 0 < d >>> 0)) | - 0)) | - 0; - if ( - ((f >>> 0 < (i >>> 6) >>> 0) & ((b | 0) <= 0)) | - ((b | 0) < 0) - ) { - break pa; - } - b = F[h >> 2]; - a = (F[(h + 4) >> 2] - b) >> 2; - qa: { - if (a >>> 0 < i >>> 0) { - qa(h, (i - a) | 0); - i = F[(h + 12) >> 2]; - break qa; - } - if (a >>> 0 <= i >>> 0) { - break qa; - } - F[(h + 4) >> 2] = b + (i << 2); - } - g = 1; - if (!i) { - break oa; - } - f = F[(c + 16) >> 2]; - d = F[(c + 20) >> 2]; - s = F[h >> 2]; - j = F[(c + 8) >> 2]; - n = F[(c + 12) >> 2]; - b = 0; - while (1) { - g = 0; - if ( - (((d | 0) >= (n | 0)) & - (f >>> 0 >= j >>> 0)) | - ((d | 0) > (n | 0)) - ) { - break oa; - } - g = F[c >> 2]; - p = G[(g + f) | 0]; - a = d; - f = (f + 1) | 0; - a = f ? a : (a + 1) | 0; - F[(c + 16) >> 2] = f; - d = a; - F[(c + 20) >> 2] = a; - a = (p >>> 2) | 0; - l = 0; - ra: { - sa: { - ta: { - ua: { - t = p & 3; - switch (t | 0) { - case 0: - break sa; - case 3: - break ua; - default: - break ta; - } - } - a = (a + b) | 0; - g = 0; - if (a >>> 0 >= i >>> 0) { - break oa; - } - ma( - (s + (b << 2)) | 0, - 0, - ((p & 252) + 4) | 0, - ); - b = a; - break ra; - } - while (1) { - if ( - ((f | 0) == (j | 0)) & - ((d | 0) == (n | 0)) - ) { - break pa; - } - i = G[(f + g) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - a = (i << ((l << 3) | 6)) | a; - l = (l + 1) | 0; - if ((t | 0) != (l | 0)) { - continue; - } - break; - } - } - F[(s + (b << 2)) >> 2] = a; - } - b = (b + 1) | 0; - i = F[(h + 12) >> 2]; - if (b >>> 0 < i >>> 0) { - continue; - } - break; - } - a = (h + 16) | 0; - n = F[h >> 2]; - d = F[(h + 16) >> 2]; - b = (F[(h + 20) >> 2] - d) | 0; - va: { - if (b >>> 0 <= 2097151) { - qa(a, (524288 - ((b >>> 2) | 0)) | 0); - break va; - } - if ((b | 0) == 2097152) { - break va; - } - F[(h + 20) >> 2] = d + 2097152; - } - d = (h + 28) | 0; - b = F[d >> 2]; - f = (F[(h + 32) >> 2] - b) >> 3; - wa: { - if (f >>> 0 < i >>> 0) { - _a(d, (i - f) | 0); - b = F[d >> 2]; - break wa; - } - if (f >>> 0 > i >>> 0) { - F[(h + 32) >> 2] = (i << 3) + b; - } - if (!i) { - break pa; - } - } - j = F[a >> 2]; - f = 0; - d = 0; - while (1) { - g = (n + (f << 2)) | 0; - l = F[g >> 2]; - h = ((f << 3) + b) | 0; - a = d; - F[(h + 4) >> 2] = a; - F[h >> 2] = l; - g = F[g >> 2]; - d = (g + a) | 0; - if (d >>> 0 > 524288) { - break pa; - } - xa: { - if (a >>> 0 >= d >>> 0) { - break xa; - } - l = 0; - h = g & 7; - if (h) { - while (1) { - F[(j + (a << 2)) >> 2] = f; - a = (a + 1) | 0; - l = (l + 1) | 0; - if ((h | 0) != (l | 0)) { - continue; - } - break; - } - } - if ((g - 1) >>> 0 <= 6) { - break xa; - } - while (1) { - g = (j + (a << 2)) | 0; - F[g >> 2] = f; - F[(g + 28) >> 2] = f; - F[(g + 24) >> 2] = f; - F[(g + 20) >> 2] = f; - F[(g + 16) >> 2] = f; - F[(g + 12) >> 2] = f; - F[(g + 8) >> 2] = f; - F[(g + 4) >> 2] = f; - a = (a + 8) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - } - f = (f + 1) | 0; - if ((i | 0) != (f | 0)) { - continue; - } - break; - } - k = (d | 0) == 524288; - } - g = k; - } - ya: { - if (!g | (F[(e + 20) >> 2] ? 0 : o)) { - break ya; - } - d = 0; - k = (Z - 16) | 0; - Z = k; - za: { - if (!Sa(1, (k + 8) | 0, c)) { - break za; - } - a = F[(c + 8) >> 2]; - f = F[(c + 16) >> 2]; - g = (a - f) | 0; - j = F[(k + 12) >> 2]; - i = F[(c + 20) >> 2]; - a = - (F[(c + 12) >> 2] - - ((i + (a >>> 0 < f >>> 0)) | 0)) | - 0; - b = F[(k + 8) >> 2]; - if ( - (((j | 0) == (a | 0)) & (g >>> 0 < b >>> 0)) | - (a >>> 0 < j >>> 0) - ) { - break za; - } - a = (i + j) | 0; - g = (b + f) | 0; - a = g >>> 0 < f >>> 0 ? (a + 1) | 0 : a; - F[(c + 16) >> 2] = g; - F[(c + 20) >> 2] = a; - if ((b | 0) <= 0) { - break za; - } - a = (f + F[c >> 2]) | 0; - F[(e + 48) >> 2] = a; - c = (b - 1) | 0; - f = (c + a) | 0; - g = G[f | 0]; - Aa: { - if (g >>> 0 <= 63) { - F[(e + 52) >> 2] = c; - a = G[f | 0] & 63; - break Aa; - } - Ba: { - switch ((((g >>> 6) | 0) - 1) | 0) { - case 0: - if (b >>> 0 < 2) { - break za; - } - b = (b - 2) | 0; - F[(e + 52) >> 2] = b; - a = (a + b) | 0; - a = - ((G[(a + 1) | 0] << 8) & 16128) | - G[a | 0]; - break Aa; - case 1: - if (b >>> 0 < 3) { - break za; - } - b = (b - 3) | 0; - F[(e + 52) >> 2] = b; - a = (a + b) | 0; - a = - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) & 4128768) | - G[a | 0]; - break Aa; - default: - break Ba; - } - } - b = (b - 4) | 0; - F[(e + 52) >> 2] = b; - a = (a + b) | 0; - a = - (G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | - (G[(a + 3) | 0] << 24))) & - 1073741823; - } - F[(e + 56) >> 2] = a + 2097152; - d = a >>> 0 < 534773760; - } - Z = (k + 16) | 0; - if (!d) { - break ya; - } - if (!o) { - m = 1; - break ya; - } - b = F[(e + 52) >> 2]; - a = F[(e + 56) >> 2]; - c = F[(e + 36) >> 2]; - d = F[(e + 48) >> 2]; - f = F[(e + 24) >> 2]; - while (1) { - Ca: { - if (a >>> 0 > 2097151) { - break Ca; - } - while (1) { - if ((b | 0) <= 0) { - break Ca; - } - b = (b - 1) | 0; - F[(e + 52) >> 2] = b; - a = G[(b + d) | 0] | (a << 8); - F[(e + 56) >> 2] = a; - if (a >>> 0 < 2097152) { - continue; - } - break; - } - } - m = a & 524287; - k = F[(f + (m << 2)) >> 2]; - g = (c + (k << 3)) | 0; - a = - (((L(F[g >> 2], (a >>> 19) | 0) + m) | 0) - - F[(g + 4) >> 2]) | - 0; - F[(e + 56) >> 2] = a; - F[(r + (q << 2)) >> 2] = k; - m = 1; - q = (q + 1) | 0; - if ((o | 0) != (q | 0)) { - continue; - } - break; - } - } - a = F[(e + 36) >> 2]; - if (a) { - F[(e + 40) >> 2] = a; - ja(a); - } - a = F[(e + 24) >> 2]; - if (a) { - F[(e + 28) >> 2] = a; - ja(a); - } - a = F[(e + 8) >> 2]; - if (a) { - F[(e + 12) >> 2] = a; - ja(a); - } - Z = (e - -64) | 0; - b = m; - break g; - case 17: - b = Ld(a, c, d); - break g; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - b = (Z + -64) | 0; - Z = b; - F[(b + 56) >> 2] = 0; - F[(b + 48) >> 2] = 0; - F[(b + 52) >> 2] = 0; - F[(b + 40) >> 2] = 0; - F[(b + 44) >> 2] = 0; - F[(b + 32) >> 2] = 0; - F[(b + 36) >> 2] = 0; - F[(b + 24) >> 2] = 0; - F[(b + 28) >> 2] = 0; - F[(b + 16) >> 2] = 0; - F[(b + 20) >> 2] = 0; - F[(b + 8) >> 2] = 0; - F[(b + 12) >> 2] = 0; - Da: { - if ( - !Nd((b + 8) | 0, c) | (F[(b + 20) >> 2] ? 0 : a) - ) { - break Da; - } - if (!Md((b + 8) | 0, c)) { - break Da; - } - if (!a) { - f = 1; - break Da; - } - m = F[(b + 52) >> 2]; - c = F[(b + 56) >> 2]; - e = F[(b + 36) >> 2]; - g = F[(b + 48) >> 2]; - o = F[(b + 24) >> 2]; - while (1) { - Ea: { - if (c >>> 0 > 16383) { - break Ea; - } - while (1) { - if ((m | 0) <= 0) { - break Ea; - } - m = (m - 1) | 0; - F[(b + 52) >> 2] = m; - c = G[(g + m) | 0] | (c << 8); - F[(b + 56) >> 2] = c; - if (c >>> 0 < 16384) { - continue; - } - break; - } - } - f = c & 4095; - j = F[(o + (f << 2)) >> 2]; - r = (e + (j << 3)) | 0; - c = - (((L(F[r >> 2], (c >>> 12) | 0) + f) | 0) - - F[(r + 4) >> 2]) | - 0; - F[(b + 56) >> 2] = c; - F[((k << 2) + d) >> 2] = j; - f = 1; - k = (k + 1) | 0; - if ((k | 0) != (a | 0)) { - continue; - } - break; - } - } - a = F[(b + 36) >> 2]; - if (a) { - F[(b + 40) >> 2] = a; - ja(a); - } - a = F[(b + 24) >> 2]; - if (a) { - F[(b + 28) >> 2] = a; - ja(a); - } - a = F[(b + 8) >> 2]; - if (a) { - F[(b + 12) >> 2] = a; - ja(a); - } - Z = (b - -64) | 0; - b = f; - break g; - case 13: - case 14: - case 15: - case 16: - break h; - default: - break g; - } - } - b = Ld(a, c, d); - } - f = b; - } - return f; - } - function ih(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - J = 0, - K = 0, - M = 0, - N = 0, - O = 0, - P = 0; - u = (Z + -64) | 0; - Z = u; - F[(a + 132) >> 2] = 0; - if (F[(a + 148) >> 2]) { - b = F[(a + 144) >> 2]; - if (b) { - while (1) { - f = F[b >> 2]; - ja(b); - b = f; - if (b) { - continue; - } - break; - } - } - b = 0; - F[(a + 144) >> 2] = 0; - f = F[(a + 140) >> 2]; - a: { - if (!f) { - break a; - } - if (f >>> 0 >= 4) { - c = f & -4; - while (1) { - e = b << 2; - F[(e + F[(a + 136) >> 2]) >> 2] = 0; - F[(F[(a + 136) >> 2] + (e | 4)) >> 2] = 0; - F[(F[(a + 136) >> 2] + (e | 8)) >> 2] = 0; - F[(F[(a + 136) >> 2] + (e | 12)) >> 2] = 0; - b = (b + 4) | 0; - d = (d + 4) | 0; - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - } - f = f & 3; - if (!f) { - break a; - } - d = 0; - while (1) { - F[(F[(a + 136) >> 2] + (b << 2)) >> 2] = 0; - b = (b + 1) | 0; - d = (d + 1) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 148) >> 2] = 0; - } - b: { - c: { - if (!Da(1, (u + 60) | 0, F[(F[(a + 4) >> 2] + 32) >> 2])) { - break c; - } - F[(a + 156) >> 2] = F[(u + 60) >> 2]; - if (!Da(1, (u + 56) | 0, F[(F[(a + 4) >> 2] + 32) >> 2])) { - break c; - } - e = F[(u + 56) >> 2]; - if ( - (e >>> 0 > 1431655765) | - (I[(a + 156) >> 2] > L(e, 3) >>> 0) - ) { - break c; - } - b = F[(F[(a + 4) >> 2] + 32) >> 2]; - c = F[(b + 8) >> 2]; - k = F[(b + 12) >> 2]; - d = F[(b + 20) >> 2]; - f = F[(b + 16) >> 2]; - if ( - (((k | 0) <= (d | 0)) & (f >>> 0 >= c >>> 0)) | - ((d | 0) > (k | 0)) - ) { - break c; - } - k = G[(f + F[b >> 2]) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = d; - if (!Da(1, (u + 52) | 0, b)) { - break c; - } - q = F[(u + 52) >> 2]; - if ( - (q >>> 0 > e >>> 0) | - (e >>> 0 > (q + (((q >>> 0) / 3) | 0)) >>> 0) - ) { - break c; - } - if (!Da(1, (u + 48) | 0, F[(F[(a + 4) >> 2] + 32) >> 2])) { - break c; - } - d = F[(u + 48) >> 2]; - if (d >>> 0 > q >>> 0) { - break c; - } - F[(a + 28) >> 2] = F[(a + 24) >> 2]; - f = Zb(ka(88)); - b = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = f; - if (b) { - Za(b); - if (!F[(a + 8) >> 2]) { - break c; - } - } - F[(a + 164) >> 2] = F[(a + 160) >> 2]; - Ib((a + 160) | 0, e); - F[(a + 176) >> 2] = F[(a + 172) >> 2]; - Ib((a + 172) | 0, e); - F[(a - -64) >> 2] = 0; - F[(a + 92) >> 2] = -1; - F[(a + 84) >> 2] = -1; - F[(a + 88) >> 2] = -1; - F[(a + 40) >> 2] = F[(a + 36) >> 2]; - F[(a + 52) >> 2] = F[(a + 48) >> 2]; - F[(a + 76) >> 2] = F[(a + 72) >> 2]; - A = (a + 216) | 0; - Dd(A); - Cd(A, k); - if (!_c(F[(a + 8) >> 2], e, (d + F[(a + 156) >> 2]) | 0)) { - break c; - } - b = F[(a + 156) >> 2]; - D[(u + 8) | 0] = 1; - Ea((a + 120) | 0, (b + d) | 0, (u + 8) | 0); - if ((Bd(a, F[(F[(a + 4) >> 2] + 32) >> 2]) | 0) == -1) { - break c; - } - c = (a + 232) | 0; - b = c; - F[(b + 144) >> 2] = a; - f = F[(($[F[(F[a >> 2] + 32) >> 2]](a) | 0) + 32) >> 2]; - f = (F[f >> 2] + F[(f + 16) >> 2]) | 0; - e = F[(($[F[(F[a >> 2] + 32) >> 2]](a) | 0) + 32) >> 2]; - e = (F[(e + 8) >> 2] - F[(e + 16) >> 2]) | 0; - (O = b), - (P = - H[ - (F[(($[F[(F[a >> 2] + 32) >> 2]](a) | 0) + 32) >> 2] + - 38) >> - 1 - ]), - (E[(O + 38) >> 1] = P); - F[b >> 2] = f; - F[(b + 16) >> 2] = 0; - F[(b + 20) >> 2] = 0; - F[(b + 8) >> 2] = e; - F[(b + 12) >> 2] = 0; - (O = b), - (P = $[F[(F[a >> 2] + 36) >> 2]](a) | 0), - (F[(O + 148) >> 2] = P); - F[(a + 372) >> 2] = k; - F[(a + 384) >> 2] = d + F[(a + 156) >> 2]; - K = Ja((u + 8) | 0); - k = K; - f = 0; - j = (Z - 16) | 0; - Z = j; - d: { - if (!Aa((b + 80) | 0, b)) { - break d; - } - if (!yd(c)) { - break d; - } - b = F[(c + 4) >> 2]; - F[k >> 2] = F[c >> 2]; - F[(k + 4) >> 2] = b; - b = F[(c + 36) >> 2]; - F[(k + 32) >> 2] = F[(c + 32) >> 2]; - F[(k + 36) >> 2] = b; - b = F[(c + 28) >> 2]; - F[(k + 24) >> 2] = F[(c + 24) >> 2]; - F[(k + 28) >> 2] = b; - b = F[(c + 20) >> 2]; - F[(k + 16) >> 2] = F[(c + 16) >> 2]; - F[(k + 20) >> 2] = b; - b = F[(c + 12) >> 2]; - F[(k + 8) >> 2] = F[(c + 8) >> 2]; - F[(k + 12) >> 2] = b; - F[(c + 176) >> 2] = 2; - F[(c + 180) >> 2] = 7; - b = F[(c + 152) >> 2]; - if ((b | 0) < 0) { - break d; - } - F[(j + 12) >> 2] = 0; - f = 2; - h = F[(c + 156) >> 2]; - e = (F[(c + 160) >> 2] - h) >> 2; - e: { - if (e >>> 0 < b >>> 0) { - Fa((c + 156) | 0, (b - e) | 0, (j + 12) | 0); - f = F[(c + 176) >> 2]; - d = F[(c + 180) >> 2]; - break e; - } - d = 7; - if (b >>> 0 >= e >>> 0) { - break e; - } - F[(c + 160) >> 2] = h + (b << 2); - } - e = (c + 184) | 0; - d = (((d - f) | 0) + 1) | 0; - b = F[(c + 188) >> 2]; - f = F[(c + 184) >> 2]; - s = (((b - f) | 0) / 12) | 0; - f: { - if (d >>> 0 > s >>> 0) { - h = 0; - b = (d - s) | 0; - o = F[(e + 8) >> 2]; - f = F[(e + 4) >> 2]; - g: { - if (b >>> 0 <= (((o - f) | 0) / 12) >>> 0) { - if (b) { - b = (L(b, 12) - 12) | 0; - b = - (((b - (((b >>> 0) % 12) | 0)) | 0) + 12) | 0; - f = (ma(f, 0, b) + b) | 0; - } - F[(e + 4) >> 2] = f; - break g; - } - h: { - i: { - j: { - s = F[e >> 2]; - g = (((f - s) | 0) / 12) | 0; - d = (g + b) | 0; - if (d >>> 0 < 357913942) { - o = (((o - s) | 0) / 12) | 0; - i = o << 1; - o = - o >>> 0 >= 178956970 - ? 357913941 - : d >>> 0 < i >>> 0 - ? i - : d; - if (o) { - if (o >>> 0 >= 357913942) { - break j; - } - h = ka(L(o, 12)); - } - d = (L(g, 12) + h) | 0; - b = (L(b, 12) - 12) | 0; - g = - (((b - (((b >>> 0) % 12) | 0)) | 0) + - 12) | - 0; - b = ma(d, 0, g); - g = (b + g) | 0; - h = (L(o, 12) + h) | 0; - if ((f | 0) == (s | 0)) { - break i; - } - while (1) { - d = (d - 12) | 0; - f = (f - 12) | 0; - F[d >> 2] = F[f >> 2]; - F[(d + 4) >> 2] = F[(f + 4) >> 2]; - F[(d + 8) >> 2] = F[(f + 8) >> 2]; - F[(f + 8) >> 2] = 0; - F[f >> 2] = 0; - F[(f + 4) >> 2] = 0; - if ((f | 0) != (s | 0)) { - continue; - } - break; - } - F[(e + 8) >> 2] = h; - b = F[(e + 4) >> 2]; - F[(e + 4) >> 2] = g; - f = F[e >> 2]; - F[e >> 2] = d; - if ((b | 0) == (f | 0)) { - break h; - } - while (1) { - d = (b - 12) | 0; - h = F[d >> 2]; - if (h) { - F[(b - 8) >> 2] = h; - ja(h); - } - b = d; - if ((f | 0) != (b | 0)) { - continue; - } - break; - } - break h; - } - break b; - } - oa(); - v(); - } - F[(e + 8) >> 2] = h; - F[(e + 4) >> 2] = g; - F[e >> 2] = b; - } - if (f) { - ja(f); - } - } - d = F[(c + 188) >> 2]; - break f; - } - if (d >>> 0 >= s >>> 0) { - d = b; - break f; - } - d = (f + L(d, 12)) | 0; - if ((d | 0) != (b | 0)) { - while (1) { - f = (b - 12) | 0; - h = F[f >> 2]; - if (h) { - F[(b - 8) >> 2] = h; - ja(h); - } - b = f; - if ((d | 0) != (b | 0)) { - continue; - } - break; - } - } - F[(c + 188) >> 2] = d; - } - s = (c + 196) | 0; - f = F[(c + 184) >> 2]; - b = (((d - f) | 0) / 12) | 0; - o = F[(c + 196) >> 2]; - h = (F[(c + 200) >> 2] - o) >> 2; - k: { - if (b >>> 0 > h >>> 0) { - qa(s, (b - h) | 0); - f = F[(c + 184) >> 2]; - d = F[(c + 188) >> 2]; - break k; - } - if (b >>> 0 >= h >>> 0) { - break k; - } - F[(c + 200) >> 2] = o + (b << 2); - } - if ((d | 0) == (f | 0)) { - f = 1; - break d; - } - b = 0; - while (1) { - l: { - if (!Da(1, (j + 8) | 0, k)) { - break l; - } - f = F[(j + 8) >> 2]; - d = F[(c + 148) >> 2]; - if ( - f >>> 0 > - ((((F[(d + 4) >> 2] - F[d >> 2]) >> 2) >>> 0) / - 3) >>> - 0 - ) { - break l; - } - if (f) { - g = L(b, 12); - h = (g + F[e >> 2]) | 0; - d = F[h >> 2]; - o = (F[(h + 4) >> 2] - d) >> 2; - m: { - if (o >>> 0 < f >>> 0) { - qa(h, (f - o) | 0); - d = F[(g + F[e >> 2]) >> 2]; - break m; - } - if (f >>> 0 >= o >>> 0) { - break m; - } - F[(h + 4) >> 2] = (f << 2) + d; - } - mc(f, 1, k, d); - F[(F[s >> 2] + (b << 2)) >> 2] = f; - } - f = 1; - b = (b + 1) | 0; - if ( - b >>> 0 < - (((F[(c + 188) >> 2] - F[(c + 184) >> 2]) | 0) / - 12) >>> - 0 - ) { - continue; - } - break d; - } - break; - } - f = 0; - } - Z = (j + 16) | 0; - n: { - if (!f) { - break n; - } - e = 0; - c = 0; - d = 0; - b = 0; - k = 0; - f = 0; - s = 0; - o = 0; - l = (Z - 96) | 0; - Z = l; - F[(l + 72) >> 2] = 0; - F[(l + 64) >> 2] = 0; - F[(l + 68) >> 2] = 0; - F[(l + 48) >> 2] = 0; - F[(l + 52) >> 2] = 0; - F[(l + 40) >> 2] = 0; - F[(l + 44) >> 2] = 0; - F[(l + 56) >> 2] = 1065353216; - F[(l + 32) >> 2] = 0; - F[(l + 24) >> 2] = 0; - F[(l + 28) >> 2] = 0; - j = a; - C = F[(a + 124) >> 2]; - o: { - p: { - q: { - r: { - s: { - if ((q | 0) <= 0) { - break s; - } - J = (j + 232) | 0; - M = F[(j + 216) >> 2] != F[(j + 220) >> 2]; - B = 1; - t: { - while (1) { - h = s; - s = (h + 1) | 0; - u: { - v: { - w: { - g = F[(j + 404) >> 2]; - if ((g | 0) == -1) { - F[(j + 400) >> 2] = 7; - break w; - } - a = -1; - i = - (F[(j + 428) >> 2] + (g << 2)) | 0; - m = F[i >> 2]; - g = (m - 1) | 0; - F[i >> 2] = g; - if ((m | 0) <= 0) { - break r; - } - g = - F[ - (F[ - (F[(j + 416) >> 2] + - L(F[(j + 404) >> 2], 12)) >> - 2 - ] + - (g << 2)) >> - 2 - ]; - if (g >>> 0 > 4) { - break r; - } - i = F[((g << 2) + 8896) >> 2]; - F[(j + 400) >> 2] = i; - if (!g) { - if ((b | 0) == (c | 0)) { - break r; - } - i = -1; - m = F[(j + 8) >> 2]; - B = F[(m + 24) >> 2]; - t = (c - 4) | 0; - e = F[t >> 2]; - g = -1; - x: { - if ((e | 0) == -1) { - break x; - } - p = (e + 1) | 0; - p = - ((p >>> 0) % 3) | 0 - ? p - : (e - 2) | 0; - g = -1; - if ((p | 0) == -1) { - break x; - } - g = - F[(F[m >> 2] + (p << 2)) >> 2]; - } - n = F[(B + (g << 2)) >> 2]; - if ((n | 0) != -1) { - i = (n + 1) | 0; - i = - ((i >>> 0) % 3) | 0 - ? i - : (n - 2) | 0; - } - if ( - (((e | 0) != -1) & - (F[ - (F[(m + 12) >> 2] + - (e << 2)) >> - 2 - ] != - -1)) | - ((e | 0) == (i | 0)) - ) { - break r; - } - n = F[(m + 12) >> 2]; - if ( - ((i | 0) != -1) & - (F[(n + (i << 2)) >> 2] != -1) - ) { - break r; - } - p = L(h, 3); - h = (p + 1) | 0; - F[(n + (e << 2)) >> 2] = h; - x = h << 2; - F[(x + n) >> 2] = e; - r = (p + 2) | 0; - F[(n + (i << 2)) >> 2] = r; - w = r << 2; - F[(w + n) >> 2] = i; - n = -1; - h = -1; - y: { - if ((e | 0) == -1) { - break y; - } - z: { - if (((e >>> 0) % 3) | 0) { - e = (e - 1) | 0; - break z; - } - e = (e + 2) | 0; - h = -1; - if ((e | 0) == -1) { - break y; - } - } - h = - F[(F[m >> 2] + (e << 2)) >> 2]; - } - e = h; - A: { - if ((i | 0) == -1) { - break A; - } - h = (i + 1) | 0; - h = - ((h >>> 0) % 3) | 0 - ? h - : (i - 2) | 0; - if ((h | 0) == -1) { - break A; - } - n = - F[(F[m >> 2] + (h << 2)) >> 2]; - } - if ( - ((e | 0) == (g | 0)) | - ((g | 0) == (n | 0)) - ) { - break r; - } - a = F[m >> 2]; - F[(a + (p << 2)) >> 2] = g; - F[(a + x) >> 2] = n; - F[(a + w) >> 2] = e; - if ((e | 0) != -1) { - F[(B + (e << 2)) >> 2] = r; - } - a = - (F[(j + 120) >> 2] + - ((g >>> 3) & 536870908)) | - 0; - e = F[a >> 2]; - (O = a), - (P = oi(g) & e), - (F[O >> 2] = P); - F[t >> 2] = p; - e = b; - kc(J, p); - break u; - } - B: { - switch ((i - 1) | 0) { - case 2: - case 4: - if ((b | 0) == (c | 0)) { - break r; - } - r = (c - 4) | 0; - e = F[r >> 2]; - i = F[(j + 8) >> 2]; - m = F[(i + 12) >> 2]; - if ( - ((e | 0) != -1) & - (F[(m + (e << 2)) >> 2] != -1) - ) { - break r; - } - c = L(h, 3); - n = (g | 0) == 3; - g = (c + (n ? 2 : 1)) | 0; - t = g << 2; - F[(t + m) >> 2] = e; - F[(m + (e << 2)) >> 2] = g; - Ma((i + 24) | 0, 8324); - p = F[(j + 8) >> 2]; - m = F[(p + 24) >> 2]; - if ( - (F[(p + 28) >> 2] - m) >> 2 > - (C | 0) - ) { - break r; - } - a = F[p >> 2]; - w = (a + t) | 0; - p = F[(i + 28) >> 2]; - i = F[(i + 24) >> 2]; - t = (((p - i) >> 2) - 1) | 0; - F[w >> 2] = t; - if ((i | 0) != (p | 0)) { - F[(m + (t << 2)) >> 2] = g; - } - g = n ? c : (c + 2) | 0; - w = (a + ((c + n) << 2)) | 0; - C: { - if ((e | 0) == -1) { - F[(a + (g << 2)) >> 2] = -1; - i = -1; - break C; - } - D: { - E: { - F: { - if ( - ((e >>> 0) % 3) | - 0 - ) { - i = (e - 1) | 0; - break F; - } - i = (e + 2) | 0; - if ((i | 0) == -1) { - break E; - } - } - i = - F[(a + (i << 2)) >> 2]; - F[(a + (g << 2)) >> 2] = - i; - if ((i | 0) == -1) { - break D; - } - F[(m + (i << 2)) >> 2] = - g; - break D; - } - F[(a + (g << 2)) >> 2] = -1; - } - i = (e + 1) | 0; - e = - ((i >>> 0) % 3) | 0 - ? i - : (e - 2) | 0; - i = -1; - if ((e | 0) == -1) { - break C; - } - i = F[(a + (e << 2)) >> 2]; - } - F[w >> 2] = i; - F[r >> 2] = c; - e = b; - break v; - case 6: - break w; - case 0: - break B; - default: - break r; - } - } - if ((e | 0) == (c | 0)) { - break r; - } - f = (c - 4) | 0; - m = F[f >> 2]; - F[(l + 68) >> 2] = f; - n = F[(l + 44) >> 2]; - G: { - if (!n) { - break G; - } - g = F[(l + 40) >> 2]; - p = ni(n) >>> 0 > 1; - a = h & (n + 2147483647); - H: { - if (!p) { - break H; - } - a = h; - if (a >>> 0 < n >>> 0) { - break H; - } - a = ((h >>> 0) % (n >>> 0)) | 0; - } - i = a; - a = F[(g + (i << 2)) >> 2]; - if (!a) { - break G; - } - a = F[a >> 2]; - if (!a) { - break G; - } - I: { - if (!p) { - g = (n - 1) | 0; - while (1) { - n = F[(a + 4) >> 2]; - J: { - if ((n | 0) != (h | 0)) { - if ((i | 0) == (g & n)) { - break J; - } - break G; - } - if ( - (h | 0) == - F[(a + 8) >> 2] - ) { - break I; - } - } - a = F[a >> 2]; - if (a) { - continue; - } - break; - } - break G; - } - while (1) { - g = F[(a + 4) >> 2]; - K: { - if ((g | 0) != (h | 0)) { - if (g >>> 0 >= n >>> 0) { - g = - ((g >>> 0) % - (n >>> 0)) | - 0; - } - if ((g | 0) == (i | 0)) { - break K; - } - break G; - } - if ( - (h | 0) == - F[(a + 8) >> 2] - ) { - break I; - } - } - a = F[a >> 2]; - if (a) { - continue; - } - break; - } - break G; - } - if ((f | 0) != (k | 0)) { - F[f >> 2] = F[(a + 12) >> 2]; - F[(l + 68) >> 2] = c; - f = c; - break G; - } - b = (k - e) | 0; - c = b >> 2; - d = (c + 1) | 0; - if (d >>> 0 >= 1073741824) { - break b; - } - f = (b >>> 1) | 0; - d = - b >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 < f >>> 0 - ? f - : d; - if (d) { - if (d >>> 0 >= 1073741824) { - break p; - } - f = ka(d << 2); - } else { - f = 0; - } - b = (f + (c << 2)) | 0; - F[b >> 2] = F[(a + 12) >> 2]; - d = (f + (d << 2)) | 0; - f = (b + 4) | 0; - if ((e | 0) != (k | 0)) { - while (1) { - b = (b - 4) | 0; - k = (k - 4) | 0; - F[b >> 2] = F[k >> 2]; - if ((e | 0) != (k | 0)) { - continue; - } - break; - } - } - F[(l + 72) >> 2] = d; - F[(l + 68) >> 2] = f; - F[(l + 64) >> 2] = b; - if (e) { - ja(e); - } - e = b; - k = d; - } - if ((e | 0) == (f | 0)) { - break t; - } - x = (f - 4) | 0; - a = F[x >> 2]; - if ((a | 0) == (m | 0)) { - break t; - } - i = (a | 0) == -1; - g = F[(j + 8) >> 2]; - if ( - !i & - (F[ - (F[(g + 12) >> 2] + (a << 2)) >> 2 - ] != - -1) - ) { - break t; - } - n = F[(g + 12) >> 2]; - if ( - ((m | 0) != -1) & - (F[(n + (m << 2)) >> 2] != -1) - ) { - break t; - } - p = L(h, 3); - t = (p + 2) | 0; - F[(n + (a << 2)) >> 2] = t; - c = t << 2; - F[(c + n) >> 2] = a; - h = (p + 1) | 0; - F[(n + (m << 2)) >> 2] = h; - w = h << 2; - F[(w + n) >> 2] = m; - L: { - M: { - N: { - if (!i) { - if (((a >>> 0) % 3) | 0) { - h = (a - 1) | 0; - break N; - } - h = (a + 2) | 0; - if ((h | 0) != -1) { - break N; - } - i = F[g >> 2]; - h = -1; - break M; - } - h = -1; - i = F[g >> 2]; - F[(i + (p << 2)) >> 2] = -1; - r = -1; - break L; - } - i = F[g >> 2]; - h = F[(i + (h << 2)) >> 2]; - } - F[((p << 2) + i) >> 2] = h; - r = (a + 1) | 0; - a = - ((r >>> 0) % 3) | 0 - ? r - : (a - 2) | 0; - r = -1; - if ((a | 0) == -1) { - break L; - } - r = F[((a << 2) + i) >> 2]; - } - F[(i + w) >> 2] = r; - O: { - if ((m | 0) == -1) { - F[(c + i) >> 2] = -1; - r = -1; - c = -1; - break O; - } - P: { - Q: { - R: { - if (((m >>> 0) % 3) | 0) { - a = (m - 1) | 0; - break R; - } - a = (m + 2) | 0; - if ((a | 0) == -1) { - break Q; - } - } - a = F[((a << 2) + i) >> 2]; - F[(c + i) >> 2] = a; - if ((a | 0) == -1) { - break P; - } - F[ - (F[(g + 24) >> 2] + - (a << 2)) >> - 2 - ] = t; - break P; - } - F[(c + i) >> 2] = -1; - } - r = -1; - a = (m + 1) | 0; - a = - ((a >>> 0) % 3) | 0 - ? a - : (m - 2) | 0; - c = -1; - if ((a | 0) == -1) { - break O; - } - r = F[((a << 2) + i) >> 2]; - c = a; - } - a = F[(j + 388) >> 2]; - t = h << 2; - m = (a + t) | 0; - w = a; - a = r << 2; - F[m >> 2] = - F[m >> 2] + F[(w + a) >> 2]; - w = a; - a = F[(g + 24) >> 2]; - m = (w + a) | 0; - if ((h | 0) != -1) { - F[(a + t) >> 2] = F[m >> 2]; - } - a = c; - while (1) { - if ((a | 0) != -1) { - F[((a << 2) + i) >> 2] = h; - t = (a + 1) | 0; - a = - ((t >>> 0) % 3) | 0 - ? t - : (a - 2) | 0; - g = -1; - S: { - if ((a | 0) == -1) { - break S; - } - a = F[(n + (a << 2)) >> 2]; - g = -1; - if ((a | 0) == -1) { - break S; - } - g = (a + 1) | 0; - g = - ((g >>> 0) % 3) | 0 - ? g - : (a - 2) | 0; - } - a = g; - if ((c | 0) != (a | 0)) { - continue; - } - break t; - } - break; - } - F[m >> 2] = -1; - T: { - U: { - if (M) { - break U; - } - if ((y | 0) != (z | 0)) { - F[z >> 2] = r; - z = (z + 4) | 0; - F[(l + 28) >> 2] = z; - break U; - } - a = (y - o) | 0; - g = a >> 2; - c = (g + 1) | 0; - if (c >>> 0 >= 1073741824) { - break T; - } - h = (a >>> 1) | 0; - h = - a >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 < h >>> 0 - ? h - : c; - if (h) { - if (h >>> 0 >= 1073741824) { - break p; - } - c = ka(h << 2); - } else { - c = 0; - } - a = (c + (g << 2)) | 0; - F[a >> 2] = r; - z = (a + 4) | 0; - if ((o | 0) != (y | 0)) { - while (1) { - a = (a - 4) | 0; - y = (y - 4) | 0; - F[a >> 2] = F[y >> 2]; - if ((o | 0) != (y | 0)) { - continue; - } - break; - } - } - y = (c + (h << 2)) | 0; - F[(l + 32) >> 2] = y; - F[(l + 28) >> 2] = z; - F[(l + 24) >> 2] = a; - if (o) { - ja(o); - } - o = a; - } - F[x >> 2] = p; - c = f; - kc(J, p); - break u; - } - break b; - } - g = F[(j + 8) >> 2]; - Ma((g + 24) | 0, 8324); - a = -1; - k = F[(j + 8) >> 2]; - f = L(h, 3); - i = F[(g + 28) >> 2]; - m = F[(g + 24) >> 2]; - n = (i - m) | 0; - g = n >> 2; - p = (g - 1) | 0; - F[(F[k >> 2] + (f << 2)) >> 2] = p; - Ma((k + 24) | 0, 8324); - r = (f + 1) | 0; - F[(F[k >> 2] + (r << 2)) >> 2] = - ((F[(k + 28) >> 2] - - F[(k + 24) >> 2]) >> - 2) - - 1; - k = F[(j + 8) >> 2]; - Ma((k + 24) | 0, 8324); - t = (f + 2) | 0; - F[(F[k >> 2] + (t << 2)) >> 2] = - ((F[(k + 28) >> 2] - - F[(k + 24) >> 2]) >> - 2) - - 1; - x = F[(j + 8) >> 2]; - k = F[(x + 24) >> 2]; - if ( - (F[(x + 28) >> 2] - k) >> 2 > - (C | 0) - ) { - break r; - } - V: { - W: { - if ((i | 0) != (m | 0)) { - F[(k + (p << 2)) >> 2] = f; - a = 0; - if ((n | 0) == -4) { - break W; - } - } - F[(k + (g << 2)) >> 2] = r; - a = (g + 1) | 0; - if ((a | 0) == -1) { - break V; - } - } - F[(k + (a << 2)) >> 2] = t; - } - if ((d | 0) != (c | 0)) { - F[c >> 2] = f; - f = (c + 4) | 0; - F[(l + 68) >> 2] = f; - k = d; - break v; - } - a = (d - b) | 0; - k = a >> 2; - e = (k + 1) | 0; - if (e >>> 0 >= 1073741824) { - break b; - } - c = (a >>> 1) | 0; - a = - a >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 < c >>> 0 - ? c - : e; - if (a) { - if (a >>> 0 >= 1073741824) { - break p; - } - c = ka(a << 2); - } else { - c = 0; - } - e = (c + (k << 2)) | 0; - F[e >> 2] = f; - k = (c + (a << 2)) | 0; - f = (e + 4) | 0; - if ((b | 0) != (d | 0)) { - while (1) { - e = (e - 4) | 0; - d = (d - 4) | 0; - F[e >> 2] = F[d >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(l + 72) >> 2] = k; - F[(l + 68) >> 2] = f; - F[(l + 64) >> 2] = e; - if (b) { - ja(b); - } - d = k; - b = e; - } - kc(J, F[(f - 4) >> 2]); - a = F[(j + 40) >> 2]; - X: { - if ((a | 0) == F[(j + 36) >> 2]) { - break X; - } - c = (a - 12) | 0; - g = F[(c + 4) >> 2]; - h = (q + (h ^ -1)) | 0; - if (g >>> 0 > h >>> 0) { - break t; - } - if ((g | 0) != (h | 0)) { - break X; - } - i = G[(a - 4) | 0]; - g = F[c >> 2]; - F[(j + 40) >> 2] = c; - if ((g | 0) < 0) { - break t; - } - m = (f - 4) | 0; - a = F[m >> 2]; - F[(l + 20) >> 2] = q + (g ^ -1); - c = (l + 20) | 0; - F[(l + 88) >> 2] = c; - Fb(l, (l + 40) | 0, c, (l + 88) | 0); - g = F[l >> 2]; - Y: { - if (i & 1) { - c = -1; - if ((a | 0) == -1) { - break Y; - } - c = (a + 1) | 0; - c = - ((c >>> 0) % 3) | 0 - ? c - : (a - 2) | 0; - break Y; - } - c = -1; - if ((a | 0) == -1) { - break Y; - } - c = (a - 1) | 0; - if (((a >>> 0) % 3) | 0) { - break Y; - } - c = (a + 2) | 0; - } - F[(g + 12) >> 2] = c; - a = F[(j + 40) >> 2]; - if ((a | 0) == F[(j + 36) >> 2]) { - break X; - } - while (1) { - c = (a - 12) | 0; - g = F[(c + 4) >> 2]; - if (g >>> 0 > h >>> 0) { - break t; - } - if ((g | 0) != (h | 0)) { - break X; - } - i = G[(a - 4) | 0]; - g = F[c >> 2]; - F[(j + 40) >> 2] = c; - if ((g | 0) < 0) { - break t; - } - a = F[m >> 2]; - F[(l + 20) >> 2] = q + (g ^ -1); - c = (l + 20) | 0; - F[(l + 88) >> 2] = c; - Fb(l, (l + 40) | 0, c, (l + 88) | 0); - g = F[l >> 2]; - Z: { - if (i & 1) { - c = -1; - if ((a | 0) == -1) { - break Z; - } - c = (a + 1) | 0; - c = - ((c >>> 0) % 3) | 0 - ? c - : (a - 2) | 0; - break Z; - } - c = -1; - if ((a | 0) == -1) { - break Z; - } - c = (a - 1) | 0; - if (((a >>> 0) % 3) | 0) { - break Z; - } - c = (a + 2) | 0; - } - F[(g + 12) >> 2] = c; - a = F[(j + 40) >> 2]; - if ((a | 0) != F[(j + 36) >> 2]) { - continue; - } - break; - } - } - c = f; - } - B = (q | 0) > (s | 0); - if ((q | 0) != (s | 0)) { - continue; - } - break; - } - s = q; - break s; - } - a = -1; - if (B) { - break r; - } - } - a = -1; - c = F[(j + 8) >> 2]; - if ( - (F[(c + 28) >> 2] - F[(c + 24) >> 2]) >> 2 > - (C | 0) - ) { - break r; - } - if ((b | 0) != (f | 0)) { - m = (j + 72) | 0; - k = (j + 60) | 0; - n = (j + 312) | 0; - while (1) { - f = (f - 4) | 0; - q = F[f >> 2]; - F[(l + 68) >> 2] = f; - _: { - if (wa(n)) { - g = F[(j + 8) >> 2]; - o = F[g >> 2]; - if ( - (((((F[(g + 4) >> 2] - o) >> 2) >>> 0) / - 3) | - 0) <= - (s | 0) - ) { - a = -1; - break r; - } - b = -1; - i = F[(g + 24) >> 2]; - a = -1; - $: { - if ((q | 0) == -1) { - break $; - } - e = (q + 1) | 0; - e = - ((e >>> 0) % 3) | 0 ? e : (q - 2) | 0; - a = -1; - if ((e | 0) == -1) { - break $; - } - a = F[(o + (e << 2)) >> 2]; - } - e = a; - a = F[(i + (e << 2)) >> 2]; - aa: { - if ((a | 0) == -1) { - h = 1; - c = -1; - break aa; - } - h = 1; - c = -1; - d = (a + 1) | 0; - a = - ((d >>> 0) % 3) | 0 ? d : (a - 2) | 0; - if ((a | 0) == -1) { - break aa; - } - h = 0; - b = (a + 1) | 0; - b = - ((b >>> 0) % 3) | 0 ? b : (a - 2) | 0; - if ((b | 0) != -1) { - c = F[(o + (b << 2)) >> 2]; - } - b = a; - } - a = -1; - d = -1; - i = F[(i + (c << 2)) >> 2]; - if ((i | 0) != -1) { - d = (i + 1) | 0; - d = - ((d >>> 0) % 3) | 0 ? d : (i - 2) | 0; - } - if ( - ((b | 0) == (q | 0)) | - ((d | 0) == (q | 0)) | - ((((q | 0) != -1) & - (F[ - (F[(g + 12) >> 2] + (q << 2)) >> 2 - ] != - -1)) | - ((b | 0) == (d | 0))) - ) { - break r; - } - if ( - !h & - (F[ - (F[(g + 12) >> 2] + (b << 2)) >> 2 - ] != - -1) - ) { - break r; - } - h = -1; - g = F[(g + 12) >> 2]; - i = -1; - ba: { - if ((d | 0) == -1) { - break ba; - } - if (F[(g + (d << 2)) >> 2] != -1) { - break r; - } - a = (d + 1) | 0; - a = - ((a >>> 0) % 3) | 0 ? a : (d - 2) | 0; - i = -1; - if ((a | 0) == -1) { - break ba; - } - i = F[(o + (a << 2)) >> 2]; - } - a = L(s, 3); - F[l >> 2] = a; - F[(g + (a << 2)) >> 2] = q; - F[(g + (q << 2)) >> 2] = a; - a = (F[l >> 2] + 1) | 0; - F[(g + (a << 2)) >> 2] = b; - F[(g + (b << 2)) >> 2] = a; - a = (F[l >> 2] + 2) | 0; - F[(g + (a << 2)) >> 2] = d; - F[(g + (d << 2)) >> 2] = a; - a = F[l >> 2]; - F[(o + (a << 2)) >> 2] = c; - b = (a + 1) | 0; - d = (o + (b << 2)) | 0; - F[d >> 2] = i; - q = (a + 2) | 0; - o = (o + (q << 2)) | 0; - F[o >> 2] = e; - a = F[(j + 120) >> 2]; - e = b ? c : -1; - c = (a + ((e >>> 3) & 536870908)) | 0; - g = F[c >> 2]; - (O = c), (P = oi(e) & g), (F[O >> 2] = P); - h = (b | 0) != -1 ? F[d >> 2] : h; - b = (a + ((h >>> 3) & 536870908)) | 0; - d = F[b >> 2]; - (O = b), (P = oi(h) & d), (F[O >> 2] = P); - d = -1; - d = (q | 0) != -1 ? F[o >> 2] : d; - a = (a + ((d >>> 3) & 536870908)) | 0; - b = F[a >> 2]; - (O = a), (P = oi(d) & b), (F[O >> 2] = P); - D[(l + 88) | 0] = 1; - wd(k, (l + 88) | 0); - Ma(m, l); - s = (s + 1) | 0; - b = F[(l + 64) >> 2]; - break _; - } - d = F[(j + 64) >> 2]; - a = F[(j + 68) >> 2]; - if ((d | 0) == a << 5) { - if (((d + 1) | 0) < 0) { - break b; - } - if (d >>> 0 <= 1073741822) { - a = a << 6; - d = ((d & -32) + 32) | 0; - a = a >>> 0 > d >>> 0 ? a : d; - } else { - a = 2147483647; - } - $a(k, a); - d = F[(j + 64) >> 2]; - } - F[(j + 64) >> 2] = d + 1; - a = - (F[(j + 60) >> 2] + - ((d >>> 3) & 536870908)) | - 0; - e = F[a >> 2]; - (O = a), (P = oi(d) & e), (F[O >> 2] = P); - d = F[(j + 76) >> 2]; - if ((d | 0) != F[(j + 80) >> 2]) { - F[d >> 2] = q; - F[(j + 76) >> 2] = d + 4; - break _; - } - c = F[m >> 2]; - a = (d - c) | 0; - o = a >> 2; - e = (o + 1) | 0; - if (e >>> 0 >= 1073741824) { - break b; - } - h = (a >>> 1) | 0; - h = - a >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 < h >>> 0 - ? h - : e; - if (h) { - if (h >>> 0 >= 1073741824) { - break p; - } - a = ka(h << 2); - } else { - a = 0; - } - e = (a + (o << 2)) | 0; - F[e >> 2] = q; - q = (e + 4) | 0; - if ((d | 0) != (c | 0)) { - while (1) { - e = (e - 4) | 0; - d = (d - 4) | 0; - F[e >> 2] = F[d >> 2]; - if ((d | 0) != (c | 0)) { - continue; - } - break; - } - } - F[(j + 80) >> 2] = a + (h << 2); - F[(j + 76) >> 2] = q; - F[(j + 72) >> 2] = e; - if (!c) { - break _; - } - ja(c); - } - if ((b | 0) != (f | 0)) { - continue; - } - break; - } - c = F[(j + 8) >> 2]; - } - a = -1; - if ( - (((((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0) / - 3) | - 0) != - (s | 0) - ) { - break r; - } - a = (F[(c + 28) >> 2] - F[(c + 24) >> 2]) >> 2; - f = F[(l + 24) >> 2]; - h = F[(l + 28) >> 2]; - if ((f | 0) == (h | 0)) { - break q; - } - while (1) { - b = F[f >> 2]; - k = F[(c + 24) >> 2]; - d = (a - 1) | 0; - e = (k + (d << 2)) | 0; - if (F[e >> 2] == -1) { - while (1) { - d = (a - 2) | 0; - a = (a - 1) | 0; - e = (k + (d << 2)) | 0; - if (F[e >> 2] == -1) { - continue; - } - break; - } - } - if (b >>> 0 <= d >>> 0) { - F[l >> 2] = c; - e = F[e >> 2]; - D[(l + 12) | 0] = 1; - F[(l + 8) >> 2] = e; - F[(l + 4) >> 2] = e; - if ((e | 0) != -1) { - while (1) { - e = - (F[F[(j + 8) >> 2] >> 2] + (e << 2)) | - 0; - if (F[e >> 2] != (d | 0)) { - a = -1; - break r; - } - F[e >> 2] = b; - nc(l); - e = F[(l + 8) >> 2]; - if ((e | 0) != -1) { - continue; - } - break; - } - c = F[(j + 8) >> 2]; - } - k = F[(c + 24) >> 2]; - e = (k + (d << 2)) | 0; - if ((b | 0) != -1) { - F[(k + (b << 2)) >> 2] = F[e >> 2]; - } - F[e >> 2] = -1; - e = 1 << b; - k = F[(j + 120) >> 2]; - b = (k + ((b >>> 3) & 536870908)) | 0; - k = (k + ((d >>> 3) & 536870908)) | 0; - d = 1 << d; - if (F[k >> 2] & d) { - e = e | F[b >> 2]; - } else { - e = F[b >> 2] & (e ^ -1); - } - F[b >> 2] = e; - F[k >> 2] = F[k >> 2] & (d ^ -1); - a = (a - 1) | 0; - } - f = (f + 4) | 0; - if ((h | 0) != (f | 0)) { - continue; - } - break; - } - } - f = F[(l + 24) >> 2]; - } - if (f) { - ja(f); - } - b = F[(l + 48) >> 2]; - if (b) { - while (1) { - d = F[b >> 2]; - ja(b); - b = d; - if (b) { - continue; - } - break; - } - } - b = F[(l + 40) >> 2]; - F[(l + 40) >> 2] = 0; - if (b) { - ja(b); - } - b = F[(l + 64) >> 2]; - if (b) { - F[(l + 68) >> 2] = b; - ja(b); - } - Z = (l + 96) | 0; - break o; - } - oa(); - v(); - } - f = a; - if ((a | 0) == -1) { - break n; - } - a = K; - b = F[(a + 16) >> 2]; - d = (b + F[a >> 2]) | 0; - b = (F[(a + 8) >> 2] - b) | 0; - a = F[(F[(j + 4) >> 2] + 32) >> 2]; - E[(a + 38) >> 1] = H[(a + 38) >> 1]; - F[a >> 2] = d; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 8) >> 2] = b; - F[(a + 12) >> 2] = 0; - ca: { - if (F[(j + 216) >> 2] == F[(j + 220) >> 2]) { - break ca; - } - a = F[(j + 8) >> 2]; - if (F[(a + 4) >> 2] == F[a >> 2]) { - break ca; - } - b = 0; - while (1) { - if (Ad(j, b)) { - b = (b + 3) | 0; - a = F[(j + 8) >> 2]; - if ( - b >>> 0 < - ((F[(a + 4) >> 2] - F[a >> 2]) >> 2) >>> 0 - ) { - continue; - } - break ca; - } - break; - } - break n; - } - if (G[(j + 308) | 0]) { - D[(j + 308) | 0] = 0; - d = F[(j + 292) >> 2]; - a = 0; - e = (F[(j + 304) >> 2] + 7) | 0; - a = e >>> 0 < 7 ? 1 : a; - e = (a << 29) | (e >>> 3); - b = (e + F[(j + 288) >> 2]) | 0; - a = (((a >>> 3) | 0) + d) | 0; - F[(j + 288) >> 2] = b; - F[(j + 292) >> 2] = b >>> 0 < e >>> 0 ? (a + 1) | 0 : a; - } - b = F[(j + 216) >> 2]; - if ((b | 0) != F[(j + 220) >> 2]) { - a = 0; - while (1) { - e = L(a, 144); - Zc((((e + b) | 0) + 4) | 0, F[(j + 8) >> 2]); - d = F[A >> 2]; - c = (d + e) | 0; - b = F[(c + 132) >> 2]; - c = F[(c + 136) >> 2]; - if ((b | 0) != (c | 0)) { - while (1) { - Xc((((e + F[A >> 2]) | 0) + 4) | 0, F[b >> 2]); - b = (b + 4) | 0; - if ((c | 0) != (b | 0)) { - continue; - } - break; - } - d = F[A >> 2]; - } - if (!Yc((((d + e) | 0) + 4) | 0)) { - break n; - } - a = (a + 1) | 0; - b = F[(j + 216) >> 2]; - if ( - a >>> 0 < - (((F[(j + 220) >> 2] - b) | 0) / 144) >>> 0 - ) { - continue; - } - break; - } - } - a = F[(j + 8) >> 2]; - Hb( - (j + 184) | 0, - (F[(a + 28) >> 2] - F[(a + 24) >> 2]) >> 2, - ); - d = F[(j + 216) >> 2]; - if ((d | 0) != F[(j + 220) >> 2]) { - b = 0; - while (1) { - a = (L(b, 144) + d) | 0; - d = (F[(a + 60) >> 2] - F[(a + 56) >> 2]) >> 2; - c = (a + 104) | 0; - a = F[(j + 8) >> 2]; - a = (F[(a + 28) >> 2] - F[(a + 24) >> 2]) >> 2; - Hb(c, (a | 0) < (d | 0) ? d : a); - b = (b + 1) | 0; - d = F[(j + 216) >> 2]; - if ( - b >>> 0 < - (((F[(j + 220) >> 2] - d) | 0) / 144) >>> 0 - ) { - continue; - } - break; - } - } - N = zd(j, f); - } - } - Z = (u - -64) | 0; - return N | 0; - } - na(); - v(); - } - function lh(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - J = 0, - K = 0, - M = 0, - N = 0; - t = (Z + -64) | 0; - Z = t; - F[(a + 132) >> 2] = 0; - if (F[(a + 148) >> 2]) { - c = F[(a + 144) >> 2]; - if (c) { - while (1) { - b = F[c >> 2]; - ja(c); - c = b; - if (b) { - continue; - } - break; - } - } - c = 0; - F[(a + 144) >> 2] = 0; - b = F[(a + 140) >> 2]; - a: { - if (!b) { - break a; - } - if (b >>> 0 >= 4) { - h = b & -4; - while (1) { - e = c << 2; - F[(e + F[(a + 136) >> 2]) >> 2] = 0; - F[(F[(a + 136) >> 2] + (e | 4)) >> 2] = 0; - F[(F[(a + 136) >> 2] + (e | 8)) >> 2] = 0; - F[(F[(a + 136) >> 2] + (e | 12)) >> 2] = 0; - c = (c + 4) | 0; - g = (g + 4) | 0; - if ((h | 0) != (g | 0)) { - continue; - } - break; - } - } - b = b & 3; - if (!b) { - break a; - } - g = 0; - while (1) { - F[(F[(a + 136) >> 2] + (c << 2)) >> 2] = 0; - c = (c + 1) | 0; - g = (g + 1) | 0; - if ((b | 0) != (g | 0)) { - continue; - } - break; - } - } - F[(a + 148) >> 2] = 0; - } - b: { - if (!Da(1, (t + 60) | 0, F[(F[(a + 4) >> 2] + 32) >> 2])) { - break b; - } - F[(a + 156) >> 2] = F[(t + 60) >> 2]; - if (!Da(1, (t + 56) | 0, F[(F[(a + 4) >> 2] + 32) >> 2])) { - break b; - } - e = F[(t + 56) >> 2]; - if ( - (e >>> 0 > 1431655765) | - (I[(a + 156) >> 2] > L(e, 3) >>> 0) - ) { - break b; - } - c = F[(F[(a + 4) >> 2] + 32) >> 2]; - h = F[(c + 8) >> 2]; - m = F[(c + 12) >> 2]; - b = F[(c + 20) >> 2]; - g = F[(c + 16) >> 2]; - if ( - (((m | 0) <= (b | 0)) & (g >>> 0 >= h >>> 0)) | - ((b | 0) > (m | 0)) - ) { - break b; - } - h = G[(g + F[c >> 2]) | 0]; - g = (g + 1) | 0; - b = g ? b : (b + 1) | 0; - F[(c + 16) >> 2] = g; - F[(c + 20) >> 2] = b; - if (!Da(1, (t + 52) | 0, c)) { - break b; - } - n = F[(t + 52) >> 2]; - if ( - (n >>> 0 > e >>> 0) | - (e >>> 0 > (n + (((n >>> 0) / 3) | 0)) >>> 0) - ) { - break b; - } - if (!Da(1, (t + 48) | 0, F[(F[(a + 4) >> 2] + 32) >> 2])) { - break b; - } - c = F[(t + 48) >> 2]; - if (c >>> 0 > n >>> 0) { - break b; - } - F[(a + 28) >> 2] = F[(a + 24) >> 2]; - g = Zb(ka(88)); - b = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = g; - if (b) { - Za(b); - if (!F[(a + 8) >> 2]) { - break b; - } - } - F[(a + 164) >> 2] = F[(a + 160) >> 2]; - Ib((a + 160) | 0, e); - F[(a + 176) >> 2] = F[(a + 172) >> 2]; - Ib((a + 172) | 0, e); - F[(a - -64) >> 2] = 0; - F[(a + 92) >> 2] = -1; - F[(a + 84) >> 2] = -1; - F[(a + 88) >> 2] = -1; - F[(a + 40) >> 2] = F[(a + 36) >> 2]; - F[(a + 52) >> 2] = F[(a + 48) >> 2]; - F[(a + 76) >> 2] = F[(a + 72) >> 2]; - y = (a + 216) | 0; - Dd(y); - Cd(y, h); - if (!_c(F[(a + 8) >> 2], e, (c + F[(a + 156) >> 2]) | 0)) { - break b; - } - b = F[(a + 156) >> 2]; - D[(t + 8) | 0] = 1; - Ea((a + 120) | 0, (b + c) | 0, (t + 8) | 0); - if ((Bd(a, F[(F[(a + 4) >> 2] + 32) >> 2]) | 0) == -1) { - break b; - } - c = (a + 232) | 0; - F[(c + 144) >> 2] = a; - b = F[(($[F[(F[a >> 2] + 32) >> 2]](a) | 0) + 32) >> 2]; - b = (F[b >> 2] + F[(b + 16) >> 2]) | 0; - g = F[(($[F[(F[a >> 2] + 32) >> 2]](a) | 0) + 32) >> 2]; - g = (F[(g + 8) >> 2] - F[(g + 16) >> 2]) | 0; - (M = c), - (N = - H[ - (F[(($[F[(F[a >> 2] + 32) >> 2]](a) | 0) + 32) >> 2] + - 38) >> - 1 - ]), - (E[(M + 38) >> 1] = N); - F[c >> 2] = b; - F[(c + 16) >> 2] = 0; - F[(c + 20) >> 2] = 0; - F[(c + 8) >> 2] = g; - F[(c + 12) >> 2] = 0; - F[(a + 372) >> 2] = h; - C = Ja((t + 8) | 0); - h = C; - m = 0; - d = (Z - 16) | 0; - Z = d; - b = F[(c + 4) >> 2]; - F[(c + 40) >> 2] = F[c >> 2]; - F[(c + 44) >> 2] = b; - b = F[(c + 36) >> 2]; - F[(c + 72) >> 2] = F[(c + 32) >> 2]; - F[(c + 76) >> 2] = b; - g = F[(c + 28) >> 2]; - b = (c - -64) | 0; - F[b >> 2] = F[(c + 24) >> 2]; - F[(b + 4) >> 2] = g; - b = F[(c + 20) >> 2]; - F[(c + 56) >> 2] = F[(c + 16) >> 2]; - F[(c + 60) >> 2] = b; - b = F[(c + 12) >> 2]; - F[(c + 48) >> 2] = F[(c + 8) >> 2]; - F[(c + 52) >> 2] = b; - c: { - d: { - if (hc((c + 40) | 0, 1, (d + 8) | 0)) { - b = F[(c + 44) >> 2]; - F[c >> 2] = F[(c + 40) >> 2]; - F[(c + 4) >> 2] = b; - b = F[(c + 76) >> 2]; - F[(c + 32) >> 2] = F[(c + 72) >> 2]; - F[(c + 36) >> 2] = b; - b = F[(c + 68) >> 2]; - F[(c + 24) >> 2] = F[(c + 64) >> 2]; - F[(c + 28) >> 2] = b; - g = F[(c + 60) >> 2]; - f = g; - b = F[(c + 56) >> 2]; - F[(c + 16) >> 2] = b; - F[(c + 20) >> 2] = g; - e = F[(c + 52) >> 2]; - g = F[(c + 48) >> 2]; - F[(c + 8) >> 2] = g; - F[(c + 12) >> 2] = e; - k = F[(d + 12) >> 2]; - i = (e - (((b >>> 0 > g >>> 0) + f) | 0)) | 0; - e = (g - b) | 0; - g = F[(d + 8) >> 2]; - if ( - (((k | 0) == (i | 0)) & (e >>> 0 >= g >>> 0)) | - (i >>> 0 > k >>> 0) - ) { - break d; - } - } - break c; - } - e = (f + k) | 0; - b = (b + g) | 0; - e = b >>> 0 < g >>> 0 ? (e + 1) | 0 : e; - F[(c + 16) >> 2] = b; - F[(c + 20) >> 2] = e; - if (!Aa((c + 80) | 0, c)) { - break c; - } - if (!yd(c)) { - break c; - } - b = F[(c + 4) >> 2]; - F[h >> 2] = F[c >> 2]; - F[(h + 4) >> 2] = b; - b = F[(c + 36) >> 2]; - F[(h + 32) >> 2] = F[(c + 32) >> 2]; - F[(h + 36) >> 2] = b; - b = F[(c + 28) >> 2]; - F[(h + 24) >> 2] = F[(c + 24) >> 2]; - F[(h + 28) >> 2] = b; - b = F[(c + 20) >> 2]; - F[(h + 16) >> 2] = F[(c + 16) >> 2]; - F[(h + 20) >> 2] = b; - b = F[(c + 12) >> 2]; - F[(h + 8) >> 2] = F[(c + 8) >> 2]; - F[(h + 12) >> 2] = b; - m = 1; - } - Z = (d + 16) | 0; - e: { - if (!m) { - break e; - } - b = 0; - c = 0; - g = 0; - m = 0; - j = (Z - 96) | 0; - Z = j; - F[(j + 72) >> 2] = 0; - F[(j + 64) >> 2] = 0; - F[(j + 68) >> 2] = 0; - F[(j + 48) >> 2] = 0; - F[(j + 52) >> 2] = 0; - F[(j + 40) >> 2] = 0; - F[(j + 44) >> 2] = 0; - F[(j + 56) >> 2] = 1065353216; - F[(j + 32) >> 2] = 0; - F[(j + 24) >> 2] = 0; - F[(j + 28) >> 2] = 0; - h = a; - B = F[(a + 124) >> 2]; - f: { - g: { - h: { - i: { - j: { - k: { - l: { - m: { - if ((n | 0) <= 0) { - break m; - } - J = F[(h + 216) >> 2] != F[(h + 220) >> 2]; - z = 1; - while (1) { - e = m; - m = (e + 1) | 0; - n: { - o: { - p: { - q: { - r: { - s: { - t: { - u: { - v: { - w: { - x: { - y: { - z: { - A: { - B: { - if ( - !G[ - (h + - 308) | - 0 - ] - ) { - break B; - } - k = - F[ - (h + - 296) >> - 2 - ]; - d = - F[ - (h + - 304) >> - 2 - ]; - a = - (k + - ((d >>> - 3) | - 0)) | - 0; - l = - F[ - (h + - 300) >> - 2 - ]; - if ( - a >>> 0 >= - l >>> 0 - ) { - break B; - } - f = - G[a | 0]; - a = - (d + 1) | - 0; - F[ - (h + - 304) >> - 2 - ] = a; - p = - (f >>> - (d & - 7)) & - 1; - if (!p) { - break B; - } - i = 0; - f = - (a >>> - 3) | - 0; - r = - (k + f) | - 0; - C: { - if ( - r >>> - 0 >= - l >>> 0 - ) { - d = a; - a = 0; - break C; - } - r = - G[ - r | 0 - ]; - d = - (d + - 2) | - 0; - F[ - (h + - 304) >> - 2 - ] = d; - f = - (d >>> - 3) | - 0; - a = - (r >>> - (a & - 7)) & - 1; - } - f = - (f + k) | - 0; - if ( - f >>> 0 < - l >>> 0 - ) { - f = - G[ - f | 0 - ]; - F[ - (h + - 304) >> - 2 - ] = d + 1; - i = - ((f >>> - (d & - 7)) << - 1) & - 2; - } - f = -1; - i = - p | - ((a | - i) << - 1); - switch ( - (i - 1) | - 0 - ) { - case 6: - break y; - case 0: - break z; - case 2: - case 4: - break A; - default: - break l; - } - } - if ( - (c | 0) == - (g | 0) - ) { - f = -1; - break l; - } - d = -1; - i = - F[ - (h + 8) >> - 2 - ]; - z = - F[ - (i + - 24) >> - 2 - ]; - r = - (c - 4) | 0; - b = F[r >> 2]; - a = -1; - D: { - if ( - (b | 0) == - -1 - ) { - break D; - } - k = - (b + 1) | - 0; - k = - ((k >>> - 0) % - 3) | - 0 - ? k - : (b - - 2) | - 0; - a = -1; - if ( - (k | 0) == - -1 - ) { - break D; - } - a = - F[ - (F[ - i >> 2 - ] + - (k << - 2)) >> - 2 - ]; - } - f = - F[ - (z + - (a << - 2)) >> - 2 - ]; - if ( - (f | 0) != - -1 - ) { - d = - (f + 1) | - 0; - d = - ((d >>> - 0) % - 3) | - 0 - ? d - : (f - - 2) | - 0; - } - if ( - (b | 0) == - (d | 0) - ) { - f = -1; - break l; - } - if ( - (b | 0) != - -1 - ) { - f = -1; - if ( - F[ - (F[ - (i + - 12) >> - 2 - ] + - (b << - 2)) >> - 2 - ] != -1 - ) { - break l; - } - } - k = - F[ - (i + - 12) >> - 2 - ]; - if ( - (d | 0) != - -1 - ) { - f = -1; - if ( - F[ - (k + - (d << - 2)) >> - 2 - ] != -1 - ) { - break l; - } - } - l = L(e, 3); - e = - (l + 1) | 0; - F[ - (k + - (b << - 2)) >> - 2 - ] = e; - s = e << 2; - F[ - (s + k) >> 2 - ] = b; - p = - (l + 2) | 0; - F[ - (k + - (d << - 2)) >> - 2 - ] = p; - u = p << 2; - F[ - (u + k) >> 2 - ] = d; - k = -1; - e = -1; - E: { - if ( - (b | 0) == - -1 - ) { - break E; - } - F: { - if ( - ((b >>> - 0) % - 3) | - 0 - ) { - b = - (b - - 1) | - 0; - break F; - } - b = - (b + - 2) | - 0; - e = -1; - if ( - (b | - 0) == - -1 - ) { - break E; - } - } - e = - F[ - (F[ - i >> 2 - ] + - (b << - 2)) >> - 2 - ]; - } - b = e; - G: { - if ( - (d | 0) == - -1 - ) { - break G; - } - e = - (d + 1) | - 0; - e = - ((e >>> - 0) % - 3) | - 0 - ? e - : (d - - 2) | - 0; - if ( - (e | 0) == - -1 - ) { - break G; - } - k = - F[ - (F[ - i >> 2 - ] + - (e << - 2)) >> - 2 - ]; - } - f = -1; - if ( - ((a | 0) == - (b | 0)) | - ((a | 0) == - (k | 0)) - ) { - break l; - } - e = F[i >> 2]; - F[ - (e + - (l << - 2)) >> - 2 - ] = a; - F[ - (e + s) >> 2 - ] = k; - F[ - (e + u) >> 2 - ] = b; - if ( - (b | 0) != - -1 - ) { - F[ - (z + - (b << - 2)) >> - 2 - ] = p; - } - b = - (F[ - (h + - 120) >> - 2 - ] + - ((a >>> - 3) & - 536870908)) | - 0; - e = F[b >> 2]; - (M = b), - (N = - oi(a) & - e), - (F[M >> 2] = - N); - F[r >> 2] = l; - b = g; - break n; - } - if ( - (c | 0) == - (g | 0) - ) { - break l; - } - r = (c - 4) | 0; - b = F[r >> 2]; - a = - F[ - (h + 8) >> 2 - ]; - d = - F[ - (a + 12) >> - 2 - ]; - if ( - ((b | 0) != - -1) & - (F[ - (d + - (b << - 2)) >> - 2 - ] != - -1) - ) { - break l; - } - l = - (i | 0) == 5; - i = L(e, 3); - p = - ((l ? 2 : 1) + - i) | - 0; - s = p << 2; - F[ - (s + d) >> 2 - ] = b; - F[ - (d + - (b << 2)) >> - 2 - ] = p; - Ma( - (a + 24) | 0, - 8324, - ); - d = - F[ - (h + 8) >> 2 - ]; - k = - F[ - (d + 24) >> - 2 - ]; - if ( - (F[ - (d + 28) >> - 2 - ] - - k) >> - 2 > - (B | 0) - ) { - break l; - } - d = F[d >> 2]; - u = (d + s) | 0; - f = - F[ - (a + 28) >> - 2 - ]; - a = - F[ - (a + 24) >> - 2 - ]; - s = - (((f - a) >> - 2) - - 1) | - 0; - F[u >> 2] = s; - if ( - (a | 0) != - (f | 0) - ) { - F[ - (k + - (s << - 2)) >> - 2 - ] = p; - } - f = l - ? i - : (i + 2) | 0; - l = - (d + - ((i + l) << - 2)) | - 0; - H: { - if ( - (b | 0) == - -1 - ) { - F[ - (d + - (f << - 2)) >> - 2 - ] = -1; - a = -1; - break H; - } - I: { - J: { - K: { - if ( - ((b >>> - 0) % - 3) | - 0 - ) { - a = - (b - - 1) | - 0; - break K; - } - a = - (b + - 2) | - 0; - if ( - (a | - 0) == - -1 - ) { - break J; - } - } - a = - F[ - (d + - (a << - 2)) >> - 2 - ]; - F[ - (d + - (f << - 2)) >> - 2 - ] = a; - if ( - (a | - 0) == - -1 - ) { - break I; - } - F[ - (k + - (a << - 2)) >> - 2 - ] = f; - break I; - } - F[ - (d + - (f << - 2)) >> - 2 - ] = -1; - } - f = - (b + 1) | 0; - b = - ((f >>> 0) % - 3) | - 0 - ? f - : (b - - 2) | - 0; - a = -1; - if ( - (b | 0) == - -1 - ) { - break H; - } - a = - F[ - (d + - (b << - 2)) >> - 2 - ]; - } - F[l >> 2] = a; - F[r >> 2] = i; - b = g; - break t; - } - if ( - (b | 0) == - (c | 0) - ) { - break l; - } - a = (c - 4) | 0; - k = F[a >> 2]; - F[(j + 68) >> 2] = - a; - l = - F[ - (j + 44) >> 2 - ]; - L: { - if (!l) { - c = a; - break L; - } - f = - F[ - (j + 40) >> - 2 - ]; - p = - ni(l) >>> 0 > - 1; - d = - e & - (l + - 2147483647); - M: { - if (!p) { - break M; - } - d = e; - if ( - d >>> 0 < - l >>> 0 - ) { - break M; - } - d = - ((e >>> 0) % - (l >>> - 0)) | - 0; - } - i = d; - d = - F[ - (f + - (i << - 2)) >> - 2 - ]; - if (!d) { - c = a; - break L; - } - d = F[d >> 2]; - if (!d) { - c = a; - break L; - } - N: { - if (!p) { - f = - (l - 1) | - 0; - while (1) { - l = - F[ - (d + - 4) >> - 2 - ]; - O: { - if ( - (l | - 0) != - (e | - 0) - ) { - if ( - (i | - 0) == - (f & - l) - ) { - break O; - } - c = a; - break L; - } - if ( - (e | - 0) == - F[ - (d + - 8) >> - 2 - ] - ) { - break N; - } - } - d = - F[ - d >> 2 - ]; - if (d) { - continue; - } - break; - } - c = a; - break L; - } - while (1) { - f = - F[ - (d + - 4) >> - 2 - ]; - P: { - if ( - (f | - 0) != - (e | 0) - ) { - if ( - f >>> - 0 >= - l >>> - 0 - ) { - f = - ((f >>> - 0) % - (l >>> - 0)) | - 0; - } - if ( - (f | - 0) == - (i | - 0) - ) { - break P; - } - c = a; - break L; - } - if ( - (e | - 0) == - F[ - (d + - 8) >> - 2 - ] - ) { - break N; - } - } - d = - F[d >> 2]; - if (d) { - continue; - } - break; - } - c = a; - break L; - } - if ( - (a | 0) != - (q | 0) - ) { - F[a >> 2] = - F[ - (d + - 12) >> - 2 - ]; - F[ - (j + 68) >> - 2 - ] = c; - break L; - } - a = (q - b) | 0; - g = a >> 2; - c = (g + 1) | 0; - if ( - c >>> 0 >= - 1073741824 - ) { - break x; - } - f = - (a >>> 1) | 0; - f = - a >>> 0 >= - 2147483644 - ? 1073741823 - : c >>> 0 < - f >>> 0 - ? f - : c; - if (f) { - if ( - f >>> 0 >= - 1073741824 - ) { - break j; - } - a = ka( - f << 2, - ); - } else { - a = 0; - } - g = - (a + - (g << 2)) | - 0; - F[g >> 2] = - F[ - (d + 12) >> - 2 - ]; - c = (g + 4) | 0; - if ( - (b | 0) != - (q | 0) - ) { - while (1) { - g = - (g - 4) | - 0; - q = - (q - 4) | - 0; - F[g >> 2] = - F[q >> 2]; - if ( - (b | 0) != - (q | 0) - ) { - continue; - } - break; - } - } - q = - (a + - (f << 2)) | - 0; - F[ - (j + 72) >> 2 - ] = q; - F[ - (j + 68) >> 2 - ] = c; - F[ - (j + 64) >> 2 - ] = g; - if (b) { - ja(b); - } - } - if ( - (c | 0) == - (g | 0) - ) { - break p; - } - s = (c - 4) | 0; - b = F[s >> 2]; - if ( - (b | 0) == - (k | 0) - ) { - break p; - } - a = (b | 0) == -1; - f = - F[(h + 8) >> 2]; - if ( - !a & - (F[ - (F[ - (f + 12) >> - 2 - ] + - (b << 2)) >> - 2 - ] != - -1) - ) { - break p; - } - l = - F[ - (f + 12) >> 2 - ]; - if ( - ((k | 0) != - -1) & - (F[ - (l + - (k << 2)) >> - 2 - ] != - -1) - ) { - break p; - } - p = L(e, 3); - r = (p + 2) | 0; - F[ - (l + - (b << 2)) >> - 2 - ] = r; - e = r << 2; - F[(e + l) >> 2] = - b; - d = (p + 1) | 0; - F[ - (l + - (k << 2)) >> - 2 - ] = d; - u = d << 2; - F[(u + l) >> 2] = - k; - if (a) { - break w; - } - if ( - ((b >>> 0) % - 3) | - 0 - ) { - d = (b - 1) | 0; - break s; - } - d = (b + 2) | 0; - if ( - (d | 0) != - -1 - ) { - break s; - } - a = F[f >> 2]; - d = -1; - break r; - } - i = F[(h + 8) >> 2]; - Ma( - (i + 24) | 0, - 8324, - ); - d = F[(h + 8) >> 2]; - a = L(e, 3); - k = - F[(i + 28) >> 2]; - l = - F[(i + 24) >> 2]; - p = (k - l) | 0; - i = p >> 2; - r = (i - 1) | 0; - F[ - (F[d >> 2] + - (a << 2)) >> - 2 - ] = r; - Ma( - (d + 24) | 0, - 8324, - ); - s = (a + 1) | 0; - F[ - (F[d >> 2] + - (s << 2)) >> - 2 - ] = - ((F[ - (d + 28) >> 2 - ] - - F[ - (d + 24) >> 2 - ]) >> - 2) - - 1; - d = F[(h + 8) >> 2]; - Ma( - (d + 24) | 0, - 8324, - ); - u = (a + 2) | 0; - F[ - (F[d >> 2] + - (u << 2)) >> - 2 - ] = - ((F[ - (d + 28) >> 2 - ] - - F[ - (d + 24) >> 2 - ]) >> - 2) - - 1; - A = F[(h + 8) >> 2]; - d = - F[(A + 24) >> 2]; - if ( - (F[ - (A + 28) >> 2 - ] - - d) >> - 2 > - (B | 0) - ) { - break l; - } - Q: { - R: { - if ( - (k | 0) != - (l | 0) - ) { - F[ - (d + - (r << - 2)) >> - 2 - ] = a; - f = 0; - if ( - (p | 0) == - -4 - ) { - break R; - } - } - F[ - (d + - (i << 2)) >> - 2 - ] = s; - f = (i + 1) | 0; - if ( - (f | 0) == - -1 - ) { - break Q; - } - } - F[ - (d + - (f << 2)) >> - 2 - ] = u; - } - if ( - (c | 0) != - (q | 0) - ) { - F[c >> 2] = a; - c = (c + 4) | 0; - F[(j + 68) >> 2] = - c; - break t; - } - g = (c - b) | 0; - i = g >> 2; - d = (i + 1) | 0; - if ( - d >>> 0 >= - 1073741824 - ) { - break v; - } - f = (g >>> 1) | 0; - d = - g >>> 0 >= - 2147483644 - ? 1073741823 - : d >>> 0 < - f >>> 0 - ? f - : d; - if (d) { - if ( - d >>> 0 >= - 1073741824 - ) { - break j; - } - f = ka(d << 2); - } else { - f = 0; - } - g = - (f + (i << 2)) | - 0; - F[g >> 2] = a; - q = - (f + (d << 2)) | - 0; - a = (g + 4) | 0; - if ( - (b | 0) != - (c | 0) - ) { - while (1) { - g = (g - 4) | 0; - c = (c - 4) | 0; - F[g >> 2] = - F[c >> 2]; - if ( - (b | 0) != - (c | 0) - ) { - continue; - } - break; - } - } - F[(j + 72) >> 2] = - q; - F[(j + 68) >> 2] = - a; - F[(j + 64) >> 2] = - g; - if (!b) { - break u; - } - ja(b); - break u; - } - na(); - v(); - } - d = -1; - a = F[f >> 2]; - F[(a + (p << 2)) >> 2] = - -1; - i = -1; - break q; - } - na(); - v(); - } - c = a; - b = g; - } - a = F[(h + 40) >> 2]; - if ( - (a | 0) == - F[(h + 36) >> 2] - ) { - break n; - } - d = (a - 12) | 0; - i = F[(d + 4) >> 2]; - f = (n + (e ^ -1)) | 0; - if (i >>> 0 > f >>> 0) { - break p; - } - if ((f | 0) != (i | 0)) { - break n; - } - i = G[(a - 4) | 0]; - e = F[d >> 2]; - F[(h + 40) >> 2] = d; - if ((e | 0) < 0) { - break p; - } - k = (c - 4) | 0; - a = F[k >> 2]; - F[(j + 20) >> 2] = - n + (e ^ -1); - e = (j + 20) | 0; - F[(j + 88) >> 2] = e; - Fb( - j, - (j + 40) | 0, - e, - (j + 88) | 0, - ); - d = F[j >> 2]; - S: { - if (i & 1) { - e = -1; - if ((a | 0) == -1) { - break S; - } - e = (a + 1) | 0; - e = - ((e >>> 0) % 3) | 0 - ? e - : (a - 2) | 0; - break S; - } - e = -1; - if ((a | 0) == -1) { - break S; - } - e = (a - 1) | 0; - if (((a >>> 0) % 3) | 0) { - break S; - } - e = (a + 2) | 0; - } - F[(d + 12) >> 2] = e; - d = F[(h + 40) >> 2]; - if ( - (d | 0) == - F[(h + 36) >> 2] - ) { - break n; - } - while (1) { - a = (d - 12) | 0; - e = F[(a + 4) >> 2]; - if (e >>> 0 > f >>> 0) { - break p; - } - if ((f | 0) != (e | 0)) { - break n; - } - d = G[(d - 4) | 0]; - e = F[a >> 2]; - F[(h + 40) >> 2] = a; - if ((e | 0) < 0) { - break p; - } - a = F[k >> 2]; - F[(j + 20) >> 2] = - n + (e ^ -1); - e = (j + 20) | 0; - F[(j + 88) >> 2] = e; - Fb( - j, - (j + 40) | 0, - e, - (j + 88) | 0, - ); - i = F[j >> 2]; - T: { - if (d & 1) { - e = -1; - if ((a | 0) == -1) { - break T; - } - e = (a + 1) | 0; - e = - ((e >>> 0) % 3) | 0 - ? e - : (a - 2) | 0; - break T; - } - e = -1; - if ((a | 0) == -1) { - break T; - } - e = (a - 1) | 0; - if (((a >>> 0) % 3) | 0) { - break T; - } - e = (a + 2) | 0; - } - F[(i + 12) >> 2] = e; - d = F[(h + 40) >> 2]; - if ( - (d | 0) != - F[(h + 36) >> 2] - ) { - continue; - } - break; - } - break n; - } - a = F[f >> 2]; - d = F[(a + (d << 2)) >> 2]; - } - F[((p << 2) + a) >> 2] = d; - A = (b + 1) | 0; - b = - ((A >>> 0) % 3) | 0 - ? A - : (b - 2) | 0; - i = -1; - if ((b | 0) == -1) { - break q; - } - i = F[((b << 2) + a) >> 2]; - } - F[(a + u) >> 2] = i; - U: { - if ((k | 0) == -1) { - F[(a + e) >> 2] = -1; - i = -1; - e = -1; - break U; - } - V: { - W: { - X: { - if (((k >>> 0) % 3) | 0) { - b = (k - 1) | 0; - break X; - } - b = (k + 2) | 0; - if ((b | 0) == -1) { - break W; - } - } - b = F[((b << 2) + a) >> 2]; - F[(a + e) >> 2] = b; - if ((b | 0) == -1) { - break V; - } - F[ - (F[(f + 24) >> 2] + - (b << 2)) >> - 2 - ] = r; - break V; - } - F[(a + e) >> 2] = -1; - } - i = -1; - b = (k + 1) | 0; - b = - ((b >>> 0) % 3) | 0 - ? b - : (k - 2) | 0; - e = -1; - if ((b | 0) == -1) { - break U; - } - i = F[((b << 2) + a) >> 2]; - e = b; - } - b = F[(f + 24) >> 2]; - k = (b + (i << 2)) | 0; - if ((d | 0) != -1) { - F[(b + (d << 2)) >> 2] = - F[k >> 2]; - } - b = e; - while (1) { - if ((b | 0) == -1) { - break o; - } - F[((b << 2) + a) >> 2] = d; - r = (b + 1) | 0; - b = - ((r >>> 0) % 3) | 0 - ? r - : (b - 2) | 0; - f = -1; - Y: { - if ((b | 0) == -1) { - break Y; - } - b = F[(l + (b << 2)) >> 2]; - f = -1; - if ((b | 0) == -1) { - break Y; - } - f = (b + 1) | 0; - f = - ((f >>> 0) % 3) | 0 - ? f - : (b - 2) | 0; - } - b = f; - if ((e | 0) != (b | 0)) { - continue; - } - break; - } - } - f = -1; - if (!z) { - break m; - } - break l; - } - F[k >> 2] = -1; - Z: { - if (J) { - break Z; - } - if ((w | 0) != (x | 0)) { - F[x >> 2] = i; - x = (x + 4) | 0; - F[(j + 28) >> 2] = x; - break Z; - } - a = (w - o) | 0; - d = a >> 2; - b = (d + 1) | 0; - if (b >>> 0 >= 1073741824) { - break i; - } - e = (a >>> 1) | 0; - e = - a >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 < e >>> 0 - ? e - : b; - if (e) { - if (e >>> 0 >= 1073741824) { - break j; - } - a = ka(e << 2); - } else { - a = 0; - } - b = (a + (d << 2)) | 0; - F[b >> 2] = i; - x = (b + 4) | 0; - if ((o | 0) != (w | 0)) { - while (1) { - b = (b - 4) | 0; - w = (w - 4) | 0; - F[b >> 2] = F[w >> 2]; - if ((o | 0) != (w | 0)) { - continue; - } - break; - } - } - w = (a + (e << 2)) | 0; - F[(j + 32) >> 2] = w; - F[(j + 28) >> 2] = x; - F[(j + 24) >> 2] = b; - if (o) { - ja(o); - } - o = b; - } - F[s >> 2] = p; - b = g; - } - z = (m | 0) < (n | 0); - if ((m | 0) != (n | 0)) { - continue; - } - break; - } - m = n; - } - f = -1; - a = F[(h + 8) >> 2]; - if ( - (F[(a + 28) >> 2] - F[(a + 24) >> 2]) >> 2 > - (B | 0) - ) { - break l; - } - if ((c | 0) != (g | 0)) { - l = (h + 72) | 0; - e = (h + 60) | 0; - w = (h + 312) | 0; - while (1) { - c = (c - 4) | 0; - i = F[c >> 2]; - F[(j + 68) >> 2] = c; - _: { - if (wa(w)) { - q = F[(h + 8) >> 2]; - k = F[q >> 2]; - if ( - (((((F[(q + 4) >> 2] - k) >> 2) >>> - 0) / - 3) | - 0) <= - (m | 0) - ) { - f = -1; - break l; - } - a = -1; - f = -1; - b = -1; - x = F[(q + 24) >> 2]; - g = -1; - $: { - if ((i | 0) == -1) { - break $; - } - n = (i + 1) | 0; - n = - ((n >>> 0) % 3) | 0 - ? n - : (i - 2) | 0; - g = -1; - if ((n | 0) == -1) { - break $; - } - g = F[(k + (n << 2)) >> 2]; - } - n = g; - o = F[(x + (n << 2)) >> 2]; - aa: { - if ((o | 0) == -1) { - d = 1; - g = -1; - break aa; - } - d = 1; - p = (o + 1) | 0; - o = - ((p >>> 0) % 3) | 0 - ? p - : (o - 2) | 0; - g = -1; - if ((o | 0) == -1) { - break aa; - } - d = 0; - a = o; - g = (a + 1) | 0; - g = - ((g >>> 0) % 3) | 0 - ? g - : (a - 2) | 0; - if ((g | 0) != -1) { - g = F[(k + (g << 2)) >> 2]; - } else { - g = -1; - } - } - o = F[((g << 2) + x) >> 2]; - if ((o | 0) != -1) { - b = (o + 1) | 0; - b = - ((b >>> 0) % 3) | 0 - ? b - : (o - 2) | 0; - } - if ( - ((a | 0) == (i | 0)) | - ((b | 0) == (i | 0)) | - ((((i | 0) != -1) & - (F[ - (F[(q + 12) >> 2] + (i << 2)) >> - 2 - ] != - -1)) | - ((a | 0) == (b | 0))) - ) { - break l; - } - if ( - !d & - (F[ - (F[(q + 12) >> 2] + (a << 2)) >> 2 - ] != - -1) - ) { - break l; - } - d = -1; - o = F[(q + 12) >> 2]; - q = -1; - ba: { - if ((b | 0) == -1) { - break ba; - } - if (F[(o + (b << 2)) >> 2] != -1) { - break l; - } - f = (b + 1) | 0; - f = - ((f >>> 0) % 3) | 0 - ? f - : (b - 2) | 0; - q = -1; - if ((f | 0) == -1) { - break ba; - } - q = F[(k + (f << 2)) >> 2]; - } - f = L(m, 3); - F[j >> 2] = f; - F[(o + (f << 2)) >> 2] = i; - F[(o + (i << 2)) >> 2] = f; - f = (F[j >> 2] + 1) | 0; - F[(o + (f << 2)) >> 2] = a; - F[(o + (a << 2)) >> 2] = f; - a = (F[j >> 2] + 2) | 0; - F[(o + (a << 2)) >> 2] = b; - F[(o + (b << 2)) >> 2] = a; - a = F[j >> 2]; - F[(k + (a << 2)) >> 2] = g; - b = (a + 1) | 0; - f = (k + (b << 2)) | 0; - F[f >> 2] = q; - o = (a + 2) | 0; - i = (k + (o << 2)) | 0; - F[i >> 2] = n; - a = F[(h + 120) >> 2]; - g = b ? g : -1; - n = (a + ((g >>> 3) & 536870908)) | 0; - k = F[n >> 2]; - (M = n), - (N = oi(g) & k), - (F[M >> 2] = N); - d = (b | 0) != -1 ? F[f >> 2] : d; - b = (a + ((d >>> 3) & 536870908)) | 0; - g = F[b >> 2]; - (M = b), - (N = oi(d) & g), - (F[M >> 2] = N); - b = -1; - b = (o | 0) != -1 ? F[i >> 2] : b; - a = (a + ((b >>> 3) & 536870908)) | 0; - g = F[a >> 2]; - (M = a), - (N = oi(b) & g), - (F[M >> 2] = N); - D[(j + 88) | 0] = 1; - wd(e, (j + 88) | 0); - Ma(l, j); - m = (m + 1) | 0; - g = F[(j + 64) >> 2]; - break _; - } - b = F[(h + 64) >> 2]; - a = F[(h + 68) >> 2]; - if ((b | 0) == a << 5) { - if (((b + 1) | 0) < 0) { - break h; - } - if (b >>> 0 <= 1073741822) { - a = a << 6; - b = ((b & -32) + 32) | 0; - a = a >>> 0 > b >>> 0 ? a : b; - } else { - a = 2147483647; - } - $a(e, a); - b = F[(h + 64) >> 2]; - } - F[(h + 64) >> 2] = b + 1; - a = - (F[(h + 60) >> 2] + - ((b >>> 3) & 536870908)) | - 0; - d = F[a >> 2]; - (M = a), - (N = oi(b) & d), - (F[M >> 2] = N); - b = F[(h + 76) >> 2]; - if ((b | 0) != F[(h + 80) >> 2]) { - F[b >> 2] = i; - F[(h + 76) >> 2] = b + 4; - break _; - } - f = F[l >> 2]; - a = (b - f) | 0; - o = a >> 2; - d = (o + 1) | 0; - if (d >>> 0 >= 1073741824) { - break g; - } - n = (a >>> 1) | 0; - n = - a >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 < n >>> 0 - ? n - : d; - if (n) { - if (n >>> 0 >= 1073741824) { - break j; - } - a = ka(n << 2); - } else { - a = 0; - } - d = (a + (o << 2)) | 0; - F[d >> 2] = i; - o = (d + 4) | 0; - if ((b | 0) != (f | 0)) { - while (1) { - d = (d - 4) | 0; - b = (b - 4) | 0; - F[d >> 2] = F[b >> 2]; - if ((b | 0) != (f | 0)) { - continue; - } - break; - } - } - F[(h + 80) >> 2] = a + (n << 2); - F[(h + 76) >> 2] = o; - F[(h + 72) >> 2] = d; - if (!f) { - break _; - } - ja(f); - } - if ((c | 0) != (g | 0)) { - continue; - } - break; - } - a = F[(h + 8) >> 2]; - } - f = -1; - if ( - (((((F[(a + 4) >> 2] - F[a >> 2]) >> 2) >>> - 0) / - 3) | - 0) != - (m | 0) - ) { - break l; - } - f = - (F[(a + 28) >> 2] - F[(a + 24) >> 2]) >> 2; - c = F[(j + 24) >> 2]; - n = F[(j + 28) >> 2]; - if ((c | 0) == (n | 0)) { - break k; - } - while (1) { - g = F[c >> 2]; - e = F[(a + 24) >> 2]; - b = (f - 1) | 0; - d = (e + (b << 2)) | 0; - if (F[d >> 2] == -1) { - while (1) { - b = (f - 2) | 0; - f = (f - 1) | 0; - d = (e + (b << 2)) | 0; - if (F[d >> 2] == -1) { - continue; - } - break; - } - } - if (b >>> 0 >= g >>> 0) { - F[j >> 2] = a; - d = F[d >> 2]; - D[(j + 12) | 0] = 1; - F[(j + 8) >> 2] = d; - F[(j + 4) >> 2] = d; - if ((d | 0) != -1) { - while (1) { - a = - (F[F[(h + 8) >> 2] >> 2] + - (d << 2)) | - 0; - if (F[a >> 2] != (b | 0)) { - f = -1; - break l; - } - F[a >> 2] = g; - nc(j); - d = F[(j + 8) >> 2]; - if ((d | 0) != -1) { - continue; - } - break; - } - a = F[(h + 8) >> 2]; - } - m = F[(a + 24) >> 2]; - e = (m + (b << 2)) | 0; - if ((g | 0) != -1) { - F[(m + (g << 2)) >> 2] = F[e >> 2]; - } - F[e >> 2] = -1; - e = 1 << g; - m = F[(h + 120) >> 2]; - g = (m + ((g >>> 3) & 536870908)) | 0; - d = 1 << b; - m = (m + ((b >>> 3) & 536870908)) | 0; - if (d & F[m >> 2]) { - b = e | F[g >> 2]; - } else { - b = F[g >> 2] & (e ^ -1); - } - F[g >> 2] = b; - F[m >> 2] = F[m >> 2] & (d ^ -1); - f = (f - 1) | 0; - } - c = (c + 4) | 0; - if ((n | 0) != (c | 0)) { - continue; - } - break; - } - } - c = F[(j + 24) >> 2]; - } - if (c) { - ja(c); - } - a = F[(j + 48) >> 2]; - if (a) { - while (1) { - c = F[a >> 2]; - ja(a); - a = c; - if (a) { - continue; - } - break; - } - } - a = F[(j + 40) >> 2]; - F[(j + 40) >> 2] = 0; - if (a) { - ja(a); - } - a = F[(j + 64) >> 2]; - if (a) { - F[(j + 68) >> 2] = a; - ja(a); - } - Z = (j + 96) | 0; - a = f; - break f; - } - oa(); - v(); - } - na(); - v(); - } - na(); - v(); - } - na(); - v(); - } - b = a; - if ((a | 0) == -1) { - break e; - } - a = C; - c = F[(a + 16) >> 2]; - g = (c + F[a >> 2]) | 0; - c = (F[(a + 8) >> 2] - c) | 0; - a = F[(F[(h + 4) >> 2] + 32) >> 2]; - E[(a + 38) >> 1] = H[(a + 38) >> 1]; - F[a >> 2] = g; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 8) >> 2] = c; - F[(a + 12) >> 2] = 0; - ca: { - if (F[(h + 216) >> 2] == F[(h + 220) >> 2]) { - break ca; - } - a = F[(h + 8) >> 2]; - if (F[(a + 4) >> 2] == F[a >> 2]) { - break ca; - } - c = 0; - while (1) { - if (Ad(h, c)) { - c = (c + 3) | 0; - a = F[(h + 8) >> 2]; - if ( - c >>> 0 < - ((F[(a + 4) >> 2] - F[a >> 2]) >> 2) >>> 0 - ) { - continue; - } - break ca; - } - break; - } - break e; - } - if (G[(h + 308) | 0]) { - D[(h + 308) | 0] = 0; - g = F[(h + 292) >> 2]; - a = 0; - e = (F[(h + 304) >> 2] + 7) | 0; - a = e >>> 0 < 7 ? 1 : a; - c = (a >>> 3) | 0; - m = (a << 29) | (e >>> 3); - a = (m + F[(h + 288) >> 2]) | 0; - e = (c + g) | 0; - F[(h + 288) >> 2] = a; - F[(h + 292) >> 2] = a >>> 0 < m >>> 0 ? (e + 1) | 0 : e; - } - c = F[(h + 216) >> 2]; - if ((c | 0) != F[(h + 220) >> 2]) { - a = 0; - while (1) { - e = L(a, 144); - Zc((((e + c) | 0) + 4) | 0, F[(h + 8) >> 2]); - g = F[y >> 2]; - m = (g + e) | 0; - c = F[(m + 132) >> 2]; - m = F[(m + 136) >> 2]; - if ((c | 0) != (m | 0)) { - while (1) { - Xc((((e + F[y >> 2]) | 0) + 4) | 0, F[c >> 2]); - c = (c + 4) | 0; - if ((m | 0) != (c | 0)) { - continue; - } - break; - } - g = F[y >> 2]; - } - if (!Yc((((g + e) | 0) + 4) | 0)) { - break e; - } - a = (a + 1) | 0; - c = F[(h + 216) >> 2]; - if ( - a >>> 0 < - (((F[(h + 220) >> 2] - c) | 0) / 144) >>> 0 - ) { - continue; - } - break; - } - } - a = F[(h + 8) >> 2]; - Hb( - (h + 184) | 0, - (F[(a + 28) >> 2] - F[(a + 24) >> 2]) >> 2, - ); - g = F[(h + 216) >> 2]; - if ((g | 0) != F[(h + 220) >> 2]) { - c = 0; - while (1) { - a = (L(c, 144) + g) | 0; - g = (F[(a + 60) >> 2] - F[(a + 56) >> 2]) >> 2; - e = (a + 104) | 0; - a = F[(h + 8) >> 2]; - a = (F[(a + 28) >> 2] - F[(a + 24) >> 2]) >> 2; - Hb(e, (a | 0) < (g | 0) ? g : a); - c = (c + 1) | 0; - g = F[(h + 216) >> 2]; - if ( - c >>> 0 < - (((F[(h + 220) >> 2] - g) | 0) / 144) >>> 0 - ) { - continue; - } - break; - } - } - K = zd(h, b); - } - } - Z = (t - -64) | 0; - return K | 0; - } - function Cf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - E = 0, - H = 0, - I = 0, - J = 0, - K = 0, - M = 0, - N = 0, - O = 0; - B = c; - c = 0; - m = (Z - 96) | 0; - Z = m; - l = (m + 16) | 0; - ma(l, 0, 76); - F[(m + 92) >> 2] = -1; - F[(m + 8) >> 2] = 0; - F[m >> 2] = 0; - F[(m + 4) >> 2] = 0; - r = (Z - 16) | 0; - Z = r; - F[(l + 68) >> 2] = 0; - F[(l + 72) >> 2] = 0; - F[l >> 2] = b; - s = (Z - 16) | 0; - Z = s; - u = b; - a = F[(b + 20) >> 2]; - a: { - if (((F[(b + 24) >> 2] - a) | 0) <= 0) { - break a; - } - a = F[a >> 2]; - if ((a | 0) == -1) { - break a; - } - c = F[(F[(u + 8) >> 2] + (a << 2)) >> 2]; - } - b: { - c: { - d: { - if (!c) { - a = 0; - break d; - } - a = F[(u + 100) >> 2]; - e = F[(u + 96) >> 2]; - F[(s + 8) >> 2] = 0; - F[s >> 2] = 0; - F[(s + 4) >> 2] = 0; - f = (a - e) | 0; - b = ((f | 0) / 12) | 0; - e: { - if ((a | 0) == (e | 0)) { - break e; - } - if (b >>> 0 >= 357913942) { - break c; - } - d = ka(f); - F[s >> 2] = d; - F[(s + 8) >> 2] = d + L(b, 12); - a = 0; - n = d; - f = (f - 12) | 0; - d = (((f - (((f >>> 0) % 12) | 0)) | 0) + 12) | 0; - f = ma(n, 0, d); - F[(s + 4) >> 2] = d + f; - if (G[(c + 84) | 0]) { - c = b >>> 0 <= 1 ? 1 : b; - h = c & 1; - if (b >>> 0 >= 2) { - g = c & -2; - c = 0; - while (1) { - d = L(a, 12); - b = (d + e) | 0; - i = F[(b + 4) >> 2]; - j = F[b >> 2]; - d = (d + f) | 0; - F[(d + 8) >> 2] = F[(b + 8) >> 2]; - F[d >> 2] = j; - F[(d + 4) >> 2] = i; - d = L(a | 1, 12); - b = (d + e) | 0; - i = F[(b + 4) >> 2]; - j = F[b >> 2]; - d = (d + f) | 0; - F[(d + 8) >> 2] = F[(b + 8) >> 2]; - F[d >> 2] = j; - F[(d + 4) >> 2] = i; - a = (a + 2) | 0; - c = (c + 2) | 0; - if ((g | 0) != (c | 0)) { - continue; - } - break; - } - } - if (!h) { - break e; - } - b = L(a, 12); - a = (b + e) | 0; - c = F[(a + 4) >> 2]; - e = F[a >> 2]; - b = (b + f) | 0; - F[(b + 8) >> 2] = F[(a + 8) >> 2]; - F[b >> 2] = e; - F[(b + 4) >> 2] = c; - break e; - } - h = b >>> 0 <= 1 ? 1 : b; - a = F[(c + 68) >> 2]; - c = 0; - while (1) { - d = L(c, 12); - b = (d + e) | 0; - g = F[(a + (F[b >> 2] << 2)) >> 2]; - i = F[(a + (F[(b + 4) >> 2] << 2)) >> 2]; - d = (d + f) | 0; - F[(d + 8) >> 2] = - F[(a + (F[(b + 8) >> 2] << 2)) >> 2]; - F[(d + 4) >> 2] = i; - F[d >> 2] = g; - c = (c + 1) | 0; - if ((h | 0) != (c | 0)) { - continue; - } - break; - } - } - d = 0; - H = (Z - 16) | 0; - Z = H; - h = ka(88); - Zb(h); - C = (Z - 16) | 0; - Z = C; - F[(h + 80) >> 2] = 0; - F[(h + 84) >> 2] = 0; - a = F[(h + 76) >> 2]; - F[(h + 76) >> 2] = 0; - if (a) { - ja(a); - } - F[(h + 68) >> 2] = 0; - F[(h + 72) >> 2] = 0; - b = (h - -64) | 0; - a = F[b >> 2]; - F[b >> 2] = 0; - if (a) { - ja(a); - } - g = F[(s + 4) >> 2]; - b = F[s >> 2]; - c = (((g - b) | 0) / 12) | 0; - a = L(c, 3); - f = F[h >> 2]; - e = (F[(h + 4) >> 2] - f) >> 2; - f: { - if (a >>> 0 > e >>> 0) { - nd(h, (a - e) | 0); - g = F[(s + 4) >> 2]; - b = F[s >> 2]; - c = (((g - b) | 0) / 12) | 0; - break f; - } - if (a >>> 0 >= e >>> 0) { - break f; - } - F[(h + 4) >> 2] = f + (a << 2); - } - g: { - if ((b | 0) == (g | 0)) { - break g; - } - e = c >>> 0 <= 1 ? 1 : c; - g = e & 1; - a = F[h >> 2]; - if (c >>> 0 >= 2) { - i = e & -2; - c = 0; - while (1) { - e = L(d, 12); - j = (e + a) | 0; - f = (b + e) | 0; - F[j >> 2] = F[f >> 2]; - F[(a + (e | 4)) >> 2] = F[(f + 4) >> 2]; - F[(j + 8) >> 2] = F[(f + 8) >> 2]; - f = L(d | 1, 12); - e = (f + a) | 0; - f = (b + f) | 0; - F[e >> 2] = F[f >> 2]; - F[(e + 4) >> 2] = F[(f + 4) >> 2]; - F[(e + 8) >> 2] = F[(f + 8) >> 2]; - d = (d + 2) | 0; - c = (c + 2) | 0; - if ((i | 0) != (c | 0)) { - continue; - } - break; - } - } - if (!g) { - break g; - } - c = L(d, 12); - a = (c + a) | 0; - b = (b + c) | 0; - F[a >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = F[(b + 4) >> 2]; - F[(a + 8) >> 2] = F[(b + 8) >> 2]; - } - F[(C + 12) >> 2] = -1; - a = 0; - e = 0; - g = 0; - f = (Z - 32) | 0; - Z = f; - h: { - i: { - w = (C + 12) | 0; - j: { - if (!w) { - break j; - } - c = F[(h + 4) >> 2]; - j = F[h >> 2]; - d = (c - j) | 0; - i = d >> 2; - n = F[(h + 12) >> 2]; - b = (F[(h + 16) >> 2] - n) >> 2; - k: { - if (i >>> 0 > b >>> 0) { - ab((h + 12) | 0, (i - b) | 0, 10228); - c = F[(h + 4) >> 2]; - j = F[h >> 2]; - d = (c - j) | 0; - i = d >> 2; - break k; - } - if (b >>> 0 <= i >>> 0) { - break k; - } - F[(h + 16) >> 2] = n + (i << 2); - } - F[(f + 24) >> 2] = 0; - F[(f + 16) >> 2] = 0; - F[(f + 20) >> 2] = 0; - b = (c | 0) == (j | 0); - if (!b) { - if ((d | 0) < 0) { - break i; - } - e = ka(d); - F[(f + 20) >> 2] = e; - F[(f + 16) >> 2] = e; - F[(f + 24) >> 2] = (i << 2) + e; - } - l: { - m: { - n: { - o: { - p: { - if (d) { - while (1) { - i = F[((a << 2) + j) >> 2]; - b = (F[(f + 20) >> 2] - e) >> 2; - q: { - if (i >>> 0 < b >>> 0) { - break q; - } - F[f >> 2] = 0; - d = (i + 1) | 0; - if (d >>> 0 > b >>> 0) { - Fa((f + 16) | 0, (d - b) | 0, f); - j = F[h >> 2]; - c = F[(h + 4) >> 2]; - e = F[(f + 16) >> 2]; - break q; - } - if (b >>> 0 <= d >>> 0) { - break q; - } - F[(f + 20) >> 2] = (d << 2) + e; - } - b = ((i << 2) + e) | 0; - F[b >> 2] = F[b >> 2] + 1; - a = (a + 1) | 0; - d = (c - j) | 0; - i = d >> 2; - if (a >>> 0 < i >>> 0) { - continue; - } - break; - } - break p; - } - d = 0; - if (!b) { - break o; - } - break n; - } - if ((c | 0) == (j | 0)) { - d = 0; - break n; - } - if (d >>> 0 >= 2147483645) { - break m; - } - } - d = ka(d << 1); - ma(d, 255, i << 3); - } - F[(f + 8) >> 2] = 0; - F[f >> 2] = 0; - F[(f + 4) >> 2] = 0; - b = F[(f + 20) >> 2]; - a = (b - e) | 0; - t = a >> 2; - r: { - s: { - if ((b | 0) == (e | 0)) { - break s; - } - if ((a | 0) < 0) { - break r; - } - q = ka(a); - F[f >> 2] = q; - F[(f + 8) >> 2] = (t << 2) + q; - b = ma(q, 0, a); - F[(f + 4) >> 2] = b + a; - c = t >>> 0 <= 1 ? 1 : t; - n = c & 3; - a = 0; - if ((c - 1) >>> 0 >= 3) { - o = c & -4; - while (1) { - c = g << 2; - F[(c + b) >> 2] = a; - x = c | 4; - a = (F[(c + e) >> 2] + a) | 0; - F[(x + b) >> 2] = a; - y = c | 8; - a = (a + F[(e + x) >> 2]) | 0; - F[(y + b) >> 2] = a; - c = c | 12; - a = (a + F[(e + y) >> 2]) | 0; - F[(c + b) >> 2] = a; - a = (a + F[(c + e) >> 2]) | 0; - g = (g + 4) | 0; - p = (p + 4) | 0; - if ((o | 0) != (p | 0)) { - continue; - } - break; - } - } - if (!n) { - break s; - } - while (1) { - c = g << 2; - F[(c + b) >> 2] = a; - g = (g + 1) | 0; - a = (F[(c + e) >> 2] + a) | 0; - k = (k + 1) | 0; - if ((n | 0) != (k | 0)) { - continue; - } - break; - } - } - if (!i) { - break l; - } - x = F[(h + 40) >> 2]; - y = F[(h + 12) >> 2]; - n = 0; - while (1) { - I = n << 2; - a = (I + j) | 0; - k = -1; - c = (n + 1) | 0; - b = ((c >>> 0) % 3) | 0 ? c : (n - 2) | 0; - if ((b | 0) != -1) { - k = F[((b << 2) + j) >> 2]; - } - b = F[a >> 2]; - t: { - u: { - if (!(((n >>> 0) % 3) | 0)) { - p = -1; - a = (n + 2) | 0; - if ((a | 0) != -1) { - p = F[((a << 2) + j) >> 2]; - } - if ( - !( - ((b | 0) == (k | 0)) | - ((b | 0) == (p | 0)) - ) & - ((k | 0) != (p | 0)) - ) { - break u; - } - x = (x + 1) | 0; - F[(h + 40) >> 2] = x; - c = (n + 3) | 0; - break t; - } - p = F[(a - 4) >> 2]; - } - a = p << 2; - A = F[(a + e) >> 2]; - v: { - w: { - if ((A | 0) <= 0) { - break w; - } - a = F[(a + q) >> 2]; - g = 0; - while (1) { - o = ((a << 3) + d) | 0; - z = F[o >> 2]; - if ((z | 0) == -1) { - break w; - } - x: { - if ((k | 0) != (z | 0)) { - break x; - } - o = F[(o + 4) >> 2]; - if ((o | 0) != -1) { - z = F[((o << 2) + j) >> 2]; - } else { - z = -1; - } - if ((z | 0) == (b | 0)) { - break x; - } - while (1) { - y: { - b = a; - g = (g + 1) | 0; - if ((A | 0) <= (g | 0)) { - break y; - } - a = (b + 1) | 0; - J = ((a << 3) + d) | 0; - z = F[J >> 2]; - K = ((b << 3) + d) | 0; - F[(K + 4) >> 2] = - F[(J + 4) >> 2]; - F[K >> 2] = z; - if ((z | 0) != -1) { - continue; - } - } - break; - } - F[((b << 3) + d) >> 2] = -1; - if ((o | 0) == -1) { - break w; - } - F[(y + I) >> 2] = o; - F[(y + (o << 2)) >> 2] = n; - break v; - } - a = (a + 1) | 0; - g = (g + 1) | 0; - if ((A | 0) != (g | 0)) { - continue; - } - break; - } - } - a = k << 2; - k = F[(a + e) >> 2]; - if ((k | 0) <= 0) { - break v; - } - a = F[(a + q) >> 2]; - g = 0; - while (1) { - b = ((a << 3) + d) | 0; - if (F[b >> 2] == -1) { - F[b >> 2] = p; - F[(b + 4) >> 2] = n; - break v; - } - a = (a + 1) | 0; - g = (g + 1) | 0; - if ((k | 0) != (g | 0)) { - continue; - } - break; - } - } - } - n = c; - if (n >>> 0 < i >>> 0) { - continue; - } - break; - } - break l; - } - break i; - } - na(); - v(); - } - F[w >> 2] = t; - if (q) { - ja(q); - } - if (d) { - ja(d); - } - a = F[(f + 16) >> 2]; - if (!a) { - break j; - } - F[(f + 20) >> 2] = a; - ja(a); - } - Z = (f + 32) | 0; - x = (w | 0) != 0; - if (x) { - k = (Z - 32) | 0; - Z = k; - a = F[h >> 2]; - g = F[(h + 4) >> 2]; - F[(k + 24) >> 2] = 0; - F[(k + 16) >> 2] = 0; - F[(k + 20) >> 2] = 0; - if ((a | 0) == (g | 0)) { - c = g; - } else { - a = (g - a) | 0; - if ((a | 0) < 0) { - break i; - } - a = a >> 2; - b = ((((a - 1) >>> 5) | 0) + 1) | 0; - c = ka(b << 2); - F[(k + 24) >> 2] = b; - F[(k + 20) >> 2] = 0; - F[(k + 16) >> 2] = c; - Yb((k + 16) | 0, a); - g = F[h >> 2]; - c = F[(h + 4) >> 2]; - } - F[(k + 8) >> 2] = 0; - F[k >> 2] = 0; - while (1) { - z: { - o = 0; - i = 0; - if ((c | 0) == (g | 0)) { - break z; - } - while (1) { - b = F[(k + 16) >> 2]; - A: { - if ( - (F[(b + ((i >>> 3) & 536870908)) >> 2] >>> - i) & - 1 - ) { - break A; - } - c = F[k >> 2]; - F[(k + 4) >> 2] = c; - e = F[(h + 12) >> 2]; - a = i; - while (1) { - B: { - f = (a + 1) | 0; - d = a; - a = - ((f >>> 0) % 3) | 0 ? f : (a - 2) | 0; - if ((a | 0) == -1) { - break B; - } - a = F[(e + (a << 2)) >> 2]; - if ((a | 0) == -1) { - break B; - } - f = (a + 1) | 0; - a = - ((f >>> 0) % 3) | 0 ? f : (a - 2) | 0; - if ( - ((i | 0) == (a | 0)) | - ((a | 0) == -1) - ) { - break B; - } - if ( - !( - (F[ - (b + ((a >>> 3) & 536870908)) >> 2 - ] >>> - a) & - 1 - ) - ) { - continue; - } - } - break; - } - j = d; - C: { - D: { - E: { - while (1) { - a = - (F[(k + 16) >> 2] + - ((j >>> 3) & 536870908)) | - 0; - F[a >> 2] = F[a >> 2] | (1 << j); - a = (j + 1) | 0; - f = - ((a >>> 0) % 3) | 0 - ? a - : (j - 2) | 0; - g = F[h >> 2]; - y = ((j >>> 0) % 3) | 0; - b = ((y ? -1 : 2) + j) | 0; - n = F[k >> 2]; - A = (n | 0) == (c | 0); - F: { - if (A) { - break F; - } - w = F[((f << 2) + g) >> 2]; - q = F[(h + 12) >> 2]; - a = n; - if ((b | 0) != -1) { - e = (q + (b << 2)) | 0; - while (1) { - G: { - if ((w | 0) != F[a >> 2]) { - break G; - } - p = F[(a + 4) >> 2]; - t = F[e >> 2]; - if ((p | 0) == (t | 0)) { - break G; - } - e = b; - c = -1; - a = -1; - if ((p | 0) == -1) { - break C; - } - break D; - } - a = (a + 8) | 0; - if ((c | 0) != (a | 0)) { - continue; - } - break; - } - break F; - } - while (1) { - if ((w | 0) == F[a >> 2]) { - t = -1; - e = -1; - p = F[(a + 4) >> 2]; - if ((p | 0) != -1) { - break D; - } - } - a = (a + 8) | 0; - if ((c | 0) != (a | 0)) { - continue; - } - break; - } - } - b = F[((b << 2) + g) >> 2]; - H: { - if (F[(k + 8) >> 2] != (c | 0)) { - F[c >> 2] = b; - F[(c + 4) >> 2] = f; - c = (c + 8) | 0; - F[(k + 4) >> 2] = c; - break H; - } - a = (c - n) | 0; - p = a >> 3; - e = (p + 1) | 0; - if (e >>> 0 >= 536870912) { - break i; - } - g = (a >>> 2) | 0; - g = - a >>> 0 >= 2147483640 - ? 536870911 - : e >>> 0 < g >>> 0 - ? g - : e; - if (g) { - if (g >>> 0 >= 536870912) { - break E; - } - e = ka(g << 3); - } else { - e = 0; - } - a = (e + (p << 3)) | 0; - F[a >> 2] = b; - F[(a + 4) >> 2] = f; - b = (a + 8) | 0; - if (!A) { - while (1) { - c = (c - 8) | 0; - f = F[(c + 4) >> 2]; - a = (a - 8) | 0; - F[a >> 2] = F[c >> 2]; - F[(a + 4) >> 2] = f; - if ((c | 0) != (n | 0)) { - continue; - } - break; - } - c = F[k >> 2]; - } - F[(k + 8) >> 2] = e + (g << 3); - F[(k + 4) >> 2] = b; - F[k >> 2] = a; - if (c) { - ja(c); - } - c = b; - } - I: { - J: { - if (y) { - a = (j - 1) | 0; - break J; - } - a = (j + 2) | 0; - if ((a | 0) == -1) { - break I; - } - } - a = - F[ - (F[(h + 12) >> 2] + - (a << 2)) >> - 2 - ]; - if ((a | 0) == -1) { - break I; - } - j = - (a + - (((a >>> 0) % 3) | 0 - ? -1 - : 2)) | - 0; - if ((d | 0) == (j | 0)) { - break I; - } - if ((j | 0) != -1) { - continue; - } - } - break; - } - g = F[h >> 2]; - break A; - } - oa(); - v(); - } - c = F[(q + (p << 2)) >> 2]; - b = e; - a = p; - } - if ((t | 0) != -1) { - F[(q + (t << 2)) >> 2] = -1; - } - if ((c | 0) != -1) { - F[(q + (c << 2)) >> 2] = -1; - } - F[(q + (b << 2)) >> 2] = -1; - F[(q + (a << 2)) >> 2] = -1; - o = 1; - } - i = (i + 1) | 0; - c = F[(h + 4) >> 2]; - if (i >>> 0 < ((c - g) >> 2) >>> 0) { - continue; - } - break; - } - if (o) { - continue; - } - } - break; - } - a = F[k >> 2]; - if (a) { - ja(a); - } - a = F[(k + 16) >> 2]; - if (a) { - ja(a); - } - Z = (k + 32) | 0; - n = 0; - g = (Z - 32) | 0; - Z = g; - e = F[(C + 12) >> 2]; - F[(h + 36) >> 2] = e; - p = (h + 24) | 0; - b = F[(h + 24) >> 2]; - a = (F[(h + 28) >> 2] - b) >> 2; - K: { - L: { - if (a >>> 0 < e >>> 0) { - ab(p, (e - a) | 0, 10228); - F[(g + 24) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - break L; - } - if (a >>> 0 > e >>> 0) { - F[(h + 28) >> 2] = b + (e << 2); - } - F[(g + 24) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - if (!e) { - break K; - } - } - if ((e | 0) < 0) { - break i; - } - a = ((((e - 1) >>> 5) | 0) + 1) | 0; - b = ka(a << 2); - F[(g + 24) >> 2] = a; - F[(g + 20) >> 2] = 0; - F[(g + 16) >> 2] = b; - Yb((g + 16) | 0, e); - } - a = F[h >> 2]; - b = F[(h + 4) >> 2]; - F[(g + 8) >> 2] = 0; - F[g >> 2] = 0; - F[(g + 4) >> 2] = 0; - M: { - if ((a | 0) == (b | 0)) { - a = b; - } else { - a = (b - a) | 0; - if ((a | 0) < 0) { - break i; - } - a = a >> 2; - b = ((((a - 1) >>> 5) | 0) + 1) | 0; - c = ka(b << 2); - F[(g + 8) >> 2] = b; - F[(g + 4) >> 2] = 0; - F[g >> 2] = c; - Yb(g, a); - b = F[h >> 2]; - a = F[(h + 4) >> 2]; - } - if ((a - b) >>> 0 < 12) { - break M; - } - N: { - while (1) { - q = L(n, 3); - d = ((q << 2) + b) | 0; - f = F[d >> 2]; - c = -1; - i = (q + 1) | 0; - if ((i | 0) != -1) { - c = F[((i << 2) + b) >> 2]; - } - O: { - if ((c | 0) == (f | 0)) { - break O; - } - i = f; - f = F[(d + 8) >> 2]; - if ( - ((i | 0) == (f | 0)) | - ((c | 0) == (f | 0)) - ) { - break O; - } - k = 0; - i = F[g >> 2]; - while (1) { - f = (k + q) | 0; - if ( - !( - (F[ - (((f >>> 3) & 536870908) + i) >> 2 - ] >>> - f) & - 1 - ) - ) { - a = F[((f << 2) + b) >> 2]; - c = 1 << a; - d = F[(g + 16) >> 2]; - b = (a >>> 5) | 0; - i = F[(d + (b << 2)) >> 2]; - t = c & i; - if (t) { - c = F[(h + 28) >> 2]; - P: { - if ((c | 0) != F[(h + 32) >> 2]) { - F[c >> 2] = -1; - F[(h + 28) >> 2] = c + 4; - break P; - } - i = F[p >> 2]; - b = (c - i) | 0; - o = b >> 2; - d = (o + 1) | 0; - if (d >>> 0 >= 1073741824) { - break i; - } - j = (b >>> 1) | 0; - j = - b >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 < j >>> 0 - ? j - : d; - if (j) { - if (j >>> 0 >= 1073741824) { - break N; - } - b = ka(j << 2); - } else { - b = 0; - } - d = (b + (o << 2)) | 0; - F[d >> 2] = -1; - o = (d + 4) | 0; - if ((c | 0) != (i | 0)) { - while (1) { - d = (d - 4) | 0; - c = (c - 4) | 0; - F[d >> 2] = F[c >> 2]; - if ((c | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(h + 32) >> 2] = b + (j << 2); - F[(h + 28) >> 2] = o; - F[(h + 24) >> 2] = d; - if (!i) { - break P; - } - ja(i); - } - c = F[(h + 52) >> 2]; - Q: { - if ((c | 0) != F[(h + 56) >> 2]) { - F[c >> 2] = a; - F[(h + 52) >> 2] = c + 4; - break Q; - } - i = F[(h + 48) >> 2]; - b = (c - i) | 0; - o = b >> 2; - d = (o + 1) | 0; - if (d >>> 0 >= 1073741824) { - break i; - } - j = (b >>> 1) | 0; - j = - b >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 < j >>> 0 - ? j - : d; - if (j) { - if (j >>> 0 >= 1073741824) { - break N; - } - b = ka(j << 2); - } else { - b = 0; - } - d = (b + (o << 2)) | 0; - F[d >> 2] = a; - a = (d + 4) | 0; - if ((c | 0) != (i | 0)) { - while (1) { - d = (d - 4) | 0; - c = (c - 4) | 0; - F[d >> 2] = F[c >> 2]; - if ((c | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(h + 56) >> 2] = b + (j << 2); - F[(h + 52) >> 2] = a; - F[(h + 48) >> 2] = d; - if (!i) { - break Q; - } - ja(i); - } - c = F[(g + 20) >> 2]; - a = F[(g + 24) >> 2]; - if ((c | 0) == a << 5) { - if (((c + 1) | 0) < 0) { - break i; - } - b = (g + 16) | 0; - if (c >>> 0 <= 1073741822) { - a = a << 6; - c = ((c & -32) + 32) | 0; - a = a >>> 0 > c >>> 0 ? a : c; - } else { - a = 2147483647; - } - $a(b, a); - c = F[(g + 20) >> 2]; - } - F[(g + 20) >> 2] = c + 1; - d = F[(g + 16) >> 2]; - a = (d + ((c >>> 3) & 536870908)) | 0; - b = F[a >> 2]; - (N = a), - (O = oi(c) & b), - (F[N >> 2] = O); - c = 1 << e; - b = (e >>> 5) | 0; - i = F[((b << 2) + d) >> 2]; - a = e; - e = (a + 1) | 0; - } - F[((b << 2) + d) >> 2] = c | i; - o = (F[(h + 24) >> 2] + (a << 2)) | 0; - j = F[(h + 12) >> 2]; - b = F[h >> 2]; - i = F[g >> 2]; - c = f; - R: { - S: { - T: { - while (1) { - if ((c | 0) == -1) { - break T; - } - d = - (((c >>> 3) & 536870908) + - i) | - 0; - F[d >> 2] = - F[d >> 2] | (1 << c); - F[o >> 2] = c; - if (t) { - F[((c << 2) + b) >> 2] = a; - } - w = (c + 1) | 0; - c = - ((w >>> 0) % 3) | 0 - ? w - : (c - 2) | 0; - d = -1; - U: { - if ((c | 0) == -1) { - break U; - } - c = F[(j + (c << 2)) >> 2]; - d = -1; - if ((c | 0) == -1) { - break U; - } - d = (c + 1) | 0; - d = - ((d >>> 0) % 3) | 0 - ? d - : (c - 2) | 0; - } - c = d; - if ((f | 0) != (c | 0)) { - continue; - } - break; - } - if ((f | 0) != -1) { - break R; - } - c = 1; - break S; - } - if (((f >>> 0) % 3) | 0) { - c = (f - 1) | 0; - break S; - } - c = (f + 2) | 0; - if ((c | 0) == -1) { - break R; - } - } - c = F[(j + (c << 2)) >> 2]; - if ((c | 0) == -1) { - break R; - } - V: { - if (((c >>> 0) % 3) | 0) { - c = (c - 1) | 0; - break V; - } - c = (c + 2) | 0; - if ((c | 0) == -1) { - break R; - } - } - f = F[(h + 12) >> 2]; - b = F[h >> 2]; - while (1) { - d = - (((c >>> 3) & 536870908) + i) | 0; - F[d >> 2] = F[d >> 2] | (1 << c); - if (t) { - F[((c << 2) + b) >> 2] = a; - } - W: { - if (((c >>> 0) % 3) | 0) { - c = (c - 1) | 0; - break W; - } - c = (c + 2) | 0; - if ((c | 0) == -1) { - break R; - } - } - c = F[(f + (c << 2)) >> 2]; - if ((c | 0) == -1) { - break R; - } - c = - (c + - (((c >>> 0) % 3) | 0 - ? -1 - : 2)) | - 0; - if ((c | 0) != -1) { - continue; - } - break; - } - } - } - k = (k + 1) | 0; - if ((k | 0) != 3) { - continue; - } - break; - } - b = F[h >> 2]; - a = F[(h + 4) >> 2]; - } - n = (n + 1) | 0; - if ( - n >>> 0 < - ((((a - b) >> 2) >>> 0) / 3) >>> 0 - ) { - continue; - } - break; - } - break M; - } - oa(); - v(); - } - c = 0; - F[(h + 44) >> 2] = 0; - a = F[(g + 16) >> 2]; - b = F[(g + 20) >> 2]; - if (b) { - e = b & 31; - b = (((b >>> 3) & 536870908) + a) | 0; - d = a; - i = 0; - while (1) { - if (!((F[d >> 2] >>> c) & 1)) { - i = (i + 1) | 0; - F[(h + 44) >> 2] = i; - } - f = (c | 0) == 31; - c = f ? 0 : (c + 1) | 0; - d = ((f << 2) + d) | 0; - if ( - ((b | 0) != (d | 0)) | - ((c | 0) != (e | 0)) - ) { - continue; - } - break; - } - } - b = F[g >> 2]; - if (b) { - ja(b); - a = F[(g + 16) >> 2]; - } - if (a) { - ja(a); - } - Z = (g + 32) | 0; - } - Z = (C + 16) | 0; - if (!x) { - F[(H + 8) >> 2] = 0; - Za(h); - h = 0; - } - Z = (H + 16) | 0; - a = h; - break h; - } - na(); - v(); - } - b = F[s >> 2]; - if (!b) { - break d; - } - F[(s + 4) >> 2] = b; - ja(b); - } - Z = (s + 16) | 0; - break b; - } - na(); - v(); - } - c = F[(l + 4) >> 2]; - b = a; - F[(l + 4) >> 2] = a; - if (c) { - Za(c); - b = F[(l + 4) >> 2]; - } - X: { - if (!b) { - break X; - } - a = F[(u + 100) >> 2]; - c = F[(u + 96) >> 2]; - D[(r + 12) | 0] = 0; - Ea((l + 56) | 0, (((a - c) | 0) / 12) | 0, (r + 12) | 0); - a = F[(u + 100) >> 2]; - c = F[(u + 96) >> 2]; - if ((a | 0) == (c | 0)) { - break X; - } - while (1) { - if ( - !( - (F[ - (F[(l + 56) >> 2] + ((E >>> 3) & 536870908)) >> 2 - ] >>> - E) & - 1 - ) - ) { - a = L(E, 3); - Vb(l, 0, a); - c = F[(l + 8) >> 2]; - e = F[(l + 12) >> 2]; - Vb(l, 1, (a + 1) | 0); - f = F[(l + 20) >> 2]; - d = F[(l + 24) >> 2]; - Vb(l, 2, (a + 2) | 0); - n = (c | 0) == (e | 0) ? -1 : 0; - a = (d - f) >> 2; - c = (e - c) >> 2; - e = a >>> 0 > c >>> 0; - c = - ((F[(l + 36) >> 2] - F[(l + 32) >> 2]) >> 2) >>> 0 > - (e ? a : c) >>> 0 - ? 2 - : e - ? 1 - : n; - Y: { - if (F[(l + 68) >> 2] <= 0) { - break Y; - } - F[(r + 12) >> 2] = F[(l + 76) >> 2]; - F[(r + 8) >> 2] = m; - Qa((r + 8) | 0, (r + 12) | 0); - a = F[((((c << 2) + l) | 0) + 44) >> 2]; - if ((a | 0) < 0) { - a = -1; - } else { - e = ((a >>> 0) / 3) | 0; - a = - F[ - (((F[(F[l >> 2] + 96) >> 2] + L(e, 12)) | 0) + - ((a - L(e, 3)) << 2)) >> - 2 - ]; - } - F[(r + 12) >> 2] = a; - F[(r + 8) >> 2] = m; - Qa((r + 8) | 0, (r + 12) | 0); - e = F[(l + 72) >> 2]; - F[(l + 72) >> 2] = e + 2; - if (!(e & 1)) { - break Y; - } - F[(r + 12) >> 2] = a; - F[(r + 8) >> 2] = m; - Qa((r + 8) | 0, (r + 12) | 0); - F[(l + 72) >> 2] = F[(l + 72) >> 2] + 1; - } - d = 0; - e = (Z - 16) | 0; - Z = e; - F[(l + 68) >> 2] = F[(l + 68) >> 2] + 1; - a = (L(c, 12) + l) | 0; - a = (F[(a + 12) >> 2] - F[(a + 8) >> 2]) | 0; - if ((a | 0) > 0) { - a = (a >>> 2) | 0; - h = a >>> 0 <= 1 ? 1 : a; - c = F[((((c << 2) + l) | 0) + 44) >> 2]; - while (1) { - a = c; - f = ((a >>> 0) / 3) | 0; - c = (a | 0) == -1; - g = c ? -1 : f; - i = (F[(l + 56) >> 2] + ((g >>> 3) & 536870908)) | 0; - F[i >> 2] = F[i >> 2] | (1 << g); - F[(l + 72) >> 2] = F[(l + 72) >> 2] + 1; - Z: { - _: { - $: { - aa: { - ba: { - if (!d) { - ca: { - if ((a | 0) >= 0) { - F[(e + 12) >> 2] = - F[ - (((F[(F[l >> 2] + 96) >> 2] + - L(f, 12)) | - 0) + - (((a >>> 0) % 3) << 2)) >> - 2 - ]; - F[(e + 8) >> 2] = m; - Qa((e + 8) | 0, (e + 12) | 0); - break ca; - } - F[(e + 12) >> 2] = -1; - F[(e + 8) >> 2] = m; - Qa((e + 8) | 0, (e + 12) | 0); - if (c) { - break ba; - } - } - c = -1; - f = (a + 1) | 0; - f = ((f >>> 0) % 3) | 0 ? f : (a - 2) | 0; - if ((f | 0) >= 0) { - g = ((f >>> 0) / 3) | 0; - f = - F[ - (((F[(F[l >> 2] + 96) >> 2] + - L(g, 12)) | - 0) + - ((f - L(g, 3)) << 2)) >> - 2 - ]; - } else { - f = -1; - } - F[(e + 12) >> 2] = f; - F[(e + 8) >> 2] = m; - Qa((e + 8) | 0, (e + 12) | 0); - f = - ((((a >>> 0) % 3) | 0 ? -1 : 2) + a) | - 0; - if ((f | 0) < 0) { - break aa; - } - c = ((f >>> 0) / 3) | 0; - c = - F[ - (((F[(F[l >> 2] + 96) >> 2] + - L(c, 12)) | - 0) + - ((f - L(c, 3)) << 2)) >> - 2 - ]; - break aa; - } - c = - (a | 0) < 0 - ? -1 - : F[ - (((F[(F[l >> 2] + 96) >> 2] + - L(f, 12)) | - 0) + - (((a >>> 0) % 3) << 2)) >> - 2 - ]; - F[(l + 76) >> 2] = c; - F[(e + 12) >> 2] = c; - F[(e + 8) >> 2] = m; - Qa((e + 8) | 0, (e + 12) | 0); - if (d & 1) { - c = -1; - if ((a | 0) == -1) { - break Z; - } - if ((L(f, 3) | 0) != (a | 0)) { - a = (a - 1) | 0; - break _; - } - a = (a + 2) | 0; - break $; - } - c = -1; - if ((a | 0) == -1) { - break Z; - } - c = (a + 1) | 0; - a = ((c >>> 0) % 3) | 0 ? c : (a - 2) | 0; - break $; - } - c = -1; - F[(e + 12) >> 2] = -1; - F[(e + 8) >> 2] = m; - Qa((e + 8) | 0, (e + 12) | 0); - } - F[(l + 76) >> 2] = c; - F[(e + 12) >> 2] = c; - F[(e + 8) >> 2] = m; - Qa((e + 8) | 0, (e + 12) | 0); - } - c = -1; - if ((a | 0) == -1) { - break Z; - } - } - c = - F[ - (F[(F[(l + 4) >> 2] + 12) >> 2] + (a << 2)) >> 2 - ]; - } - d = (d + 1) | 0; - if ((h | 0) != (d | 0)) { - continue; - } - break; - } - } - Z = (e + 16) | 0; - c = F[(u + 96) >> 2]; - a = F[(u + 100) >> 2]; - } - E = (E + 1) | 0; - if (E >>> 0 < (((a - c) | 0) / 12) >>> 0) { - continue; - } - break; - } - } - Z = (r + 16) | 0; - da: { - if (b) { - a = F[B >> 2]; - if (a) { - F[(B + 4) >> 2] = a; - ja(a); - } - F[B >> 2] = F[m >> 2]; - F[(B + 4) >> 2] = F[(m + 4) >> 2]; - F[(B + 8) >> 2] = F[(m + 8) >> 2]; - M = F[(m + 84) >> 2]; - break da; - } - a = F[m >> 2]; - if (!a) { - break da; - } - F[(m + 4) >> 2] = a; - ja(a); - } - a = F[(m + 72) >> 2]; - if (a) { - ja(a); - } - a = F[(m + 48) >> 2]; - if (a) { - F[(m + 52) >> 2] = a; - ja(a); - } - a = F[(m + 36) >> 2]; - if (a) { - F[(m + 40) >> 2] = a; - ja(a); - } - a = F[(m + 24) >> 2]; - if (a) { - F[(m + 28) >> 2] = a; - ja(a); - } - a = F[(m + 20) >> 2]; - F[(m + 20) >> 2] = 0; - if (a) { - Za(a); - } - Z = (m + 96) | 0; - return M | 0; - } - function sf(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0; - i = b; - a = 0; - b = 0; - a: { - b: { - switch ((d - 1) | 0) { - case 0: - j = F[(i + 80) >> 2]; - h = G[(c + 24) | 0]; - c: { - if ((L(j, h) | 0) != (e | 0)) { - break c; - } - d = F[(c + 28) >> 2] != 1; - b = G[(c + 84) | 0]; - if (!(d | !b)) { - la( - f, - (F[F[c >> 2] >> 2] + F[(c + 48) >> 2]) | 0, - e, - ); - b = 1; - break c; - } - if (h) { - a = ka(h); - ma(a, 0, h); - } - d: { - if (!j) { - b = 1; - break d; - } - if (!d) { - if (h) { - d = 0; - e = 0; - while (1) { - i = (d + f) | 0; - k = F[F[c >> 2] >> 2]; - m = F[(c + 48) >> 2]; - g = F[(c + 40) >> 2]; - b = ki( - g, - F[(c + 44) >> 2], - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - 0, - ); - n = b; - b = (b + m) | 0; - la(i, la(a, (b + k) | 0, g), h); - d = (d + h) | 0; - b = 1; - e = (e + 1) | 0; - if ((j | 0) != (e | 0)) { - continue; - } - break; - } - break d; - } - if (b) { - b = 1; - h = F[c >> 2]; - e = F[(c + 48) >> 2]; - f = F[(c + 40) >> 2]; - i = F[(c + 44) >> 2]; - if ((j | 0) != 1) { - g = j & -2; - c = 0; - d = 0; - while (1) { - k = F[h >> 2]; - m = (ki(f, i, c, 0) + e) | 0; - k = la(a, (k + m) | 0, f); - m = F[h >> 2]; - n = (ki(f, i, c | 1, 0) + e) | 0; - la(k, (m + n) | 0, f); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - g = c; - } - if (!(j & 1)) { - break d; - } - c = F[h >> 2]; - d = (ki(g, 0, f, i) + e) | 0; - la(a, (c + d) | 0, f); - break d; - } - b = 1; - h = F[c >> 2]; - e = F[(c + 48) >> 2]; - g = F[(c + 68) >> 2]; - f = F[(c + 40) >> 2]; - i = F[(c + 44) >> 2]; - c = 0; - if ((j | 0) != 1) { - k = j & -2; - d = 0; - while (1) { - m = F[h >> 2]; - n = c << 2; - l = (ki(f, i, F[(n + g) >> 2], 0) + e) | 0; - m = la(a, (m + l) | 0, f); - l = F[h >> 2]; - n = - (ki(f, i, F[(g + (n | 4)) >> 2], 0) + e) | - 0; - la(m, (l + n) | 0, f); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((k | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(j & 1)) { - break d; - } - d = F[h >> 2]; - c = (ki(f, i, F[(g + (c << 2)) >> 2], 0) + e) | 0; - la(a, (c + d) | 0, f); - break d; - } - b = 0; - if (!h) { - d = 0; - while (1) { - if ( - !Cb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break d; - } - d = (d + 1) | 0; - b = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - break d; - } - d = 0; - e = 0; - while (1) { - if ( - !Cb( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break d; - } - la((d + f) | 0, a, h); - d = (d + h) | 0; - e = (e + 1) | 0; - b = j >>> 0 <= e >>> 0; - if ((e | 0) != (j | 0)) { - continue; - } - break; - } - } - if (!a) { - break c; - } - ja(a); - } - break a; - case 2: - n = G[(c + 24) | 0]; - l = n << 1; - j = F[(i + 80) >> 2]; - e: { - if ((L(l, j) | 0) != (e | 0)) { - break e; - } - i = F[(c + 28) >> 2] != 3; - d = G[(c + 84) | 0]; - if (!(i | !d)) { - la( - f, - (F[F[c >> 2] >> 2] + F[(c + 48) >> 2]) | 0, - e, - ); - a = 1; - break e; - } - f: { - if (!n) { - e = 0; - break f; - } - e = ka(l); - ma(e, 0, l); - } - g: { - if (!j) { - a = 1; - break g; - } - if (!i) { - o = F[(c + 68) >> 2]; - k = F[c >> 2]; - b = F[(c + 48) >> 2]; - i = F[(c + 40) >> 2]; - m = F[(c + 44) >> 2]; - if (n) { - if (!d) { - c = 0; - d = 0; - while (1) { - a = 1; - g = F[k >> 2]; - p = - (ki(i, m, F[(o + (d << 2)) >> 2], 0) + - b) | - 0; - la( - ((c << 1) + f) | 0, - la(e, (g + p) | 0, i), - l, - ); - c = (c + n) | 0; - d = (d + 1) | 0; - if ((j | 0) != (d | 0)) { - continue; - } - break; - } - break g; - } - c = 0; - while (1) { - a = 1; - o = F[k >> 2]; - p = (ki(g, h, i, m) + b) | 0; - la( - ((c << 1) + f) | 0, - la(e, (o + p) | 0, i), - l, - ); - c = (c + n) | 0; - d = h; - g = (g + 1) | 0; - d = g ? d : (d + 1) | 0; - h = d; - if (((j | 0) != (g | 0)) | d) { - continue; - } - break; - } - break g; - } - if (!d) { - a = 1; - c = 0; - if ((j | 0) != 1) { - f = j & -2; - d = 0; - while (1) { - h = F[k >> 2]; - g = c << 2; - n = (ki(i, m, F[(g + o) >> 2], 0) + b) | 0; - h = la(e, (h + n) | 0, i); - n = F[k >> 2]; - g = - (ki(i, m, F[(o + (g | 4)) >> 2], 0) + b) | - 0; - la(h, (g + n) | 0, i); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(j & 1)) { - break g; - } - d = F[k >> 2]; - b = - (ki(i, m, F[(o + (c << 2)) >> 2], 0) + b) | 0; - la(e, (b + d) | 0, i); - break g; - } - n = j & 1; - a = 1; - if ((j | 0) != 1) { - j = j & -2; - f = 0; - c = 0; - while (1) { - d = F[k >> 2]; - l = (ki(g, h, i, m) + b) | 0; - d = la(e, (d + l) | 0, i); - l = F[k >> 2]; - o = (ki(i, m, g | 1, h) + b) | 0; - la(d, (l + o) | 0, i); - g = (g + 2) | 0; - h = g >>> 0 < 2 ? (h + 1) | 0 : h; - f = (f + 2) | 0; - d = f >>> 0 < 2 ? (c + 1) | 0 : c; - c = d; - if (((f | 0) != (j | 0)) | c) { - continue; - } - break; - } - } - if (!n) { - break g; - } - c = F[k >> 2]; - b = (ki(g, h, i, m) + b) | 0; - la(e, (b + c) | 0, i); - break g; - } - if (!n) { - d = 0; - while (1) { - if ( - !Ab( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break g; - } - d = (d + 1) | 0; - a = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - break g; - } - d = 0; - while (1) { - if ( - !Ab( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break g; - } - la(((b << 1) + f) | 0, e, l); - b = (b + n) | 0; - d = (d + 1) | 0; - a = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - } - if (!e) { - break e; - } - ja(e); - } - b = a; - break a; - case 4: - l = G[(c + 24) | 0]; - o = l << 2; - j = F[(i + 80) >> 2]; - h: { - if ((L(o, j) | 0) != (e | 0)) { - break h; - } - i = F[(c + 28) >> 2] != 5; - d = G[(c + 84) | 0]; - if (!(i | !d)) { - la( - f, - (F[F[c >> 2] >> 2] + F[(c + 48) >> 2]) | 0, - e, - ); - b = 1; - break h; - } - i: { - if (!l) { - e = 0; - break i; - } - e = ka(o); - ma(e, 0, o); - } - b = 1; - j: { - if (!j) { - break j; - } - if (!i) { - a = F[(c + 68) >> 2]; - m = F[c >> 2]; - i = F[(c + 48) >> 2]; - k = F[(c + 40) >> 2]; - n = F[(c + 44) >> 2]; - if (l) { - if (!d) { - c = 0; - d = 0; - while (1) { - g = F[m >> 2]; - p = - (ki(k, n, F[(a + (d << 2)) >> 2], 0) + - i) | - 0; - la( - ((c << 2) + f) | 0, - la(e, (g + p) | 0, k), - o, - ); - c = (c + l) | 0; - d = (d + 1) | 0; - if ((j | 0) != (d | 0)) { - continue; - } - break; - } - break j; - } - c = 0; - while (1) { - d = F[m >> 2]; - p = (ki(g, h, k, n) + i) | 0; - la( - ((c << 2) + f) | 0, - la(e, (d + p) | 0, k), - o, - ); - c = (c + l) | 0; - g = (g + 1) | 0; - a = g ? h : (h + 1) | 0; - h = a; - if (((j | 0) != (g | 0)) | h) { - continue; - } - break; - } - break j; - } - if (!d) { - c = 0; - if ((j | 0) != 1) { - f = j & -2; - d = 0; - while (1) { - h = F[m >> 2]; - g = c << 2; - l = (ki(k, n, F[(g + a) >> 2], 0) + i) | 0; - h = la(e, (h + l) | 0, k); - l = F[m >> 2]; - g = - (ki(k, n, F[(a + (g | 4)) >> 2], 0) + i) | - 0; - la(h, (g + l) | 0, k); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(j & 1)) { - break j; - } - d = F[m >> 2]; - a = - (ki(k, n, F[(a + (c << 2)) >> 2], 0) + i) | 0; - la(e, (a + d) | 0, k); - break j; - } - l = j & 1; - if ((j | 0) != 1) { - j = j & -2; - f = 0; - c = 0; - while (1) { - a = F[m >> 2]; - d = (ki(g, h, k, n) + i) | 0; - a = la(e, (a + d) | 0, k); - d = F[m >> 2]; - o = (ki(k, n, g | 1, h) + i) | 0; - la(a, (d + o) | 0, k); - d = h; - g = (g + 2) | 0; - h = g >>> 0 < 2 ? (d + 1) | 0 : d; - f = (f + 2) | 0; - a = f >>> 0 < 2 ? (c + 1) | 0 : c; - c = a; - if (((f | 0) != (j | 0)) | c) { - continue; - } - break; - } - } - if (!l) { - break j; - } - a = F[m >> 2]; - c = (ki(g, h, k, n) + i) | 0; - la(e, (a + c) | 0, k); - break j; - } - b = 0; - if (!l) { - d = 0; - while (1) { - if ( - !yb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break j; - } - d = (d + 1) | 0; - b = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - break j; - } - d = 0; - while (1) { - if ( - !yb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break j; - } - la(((a << 2) + f) | 0, e, o); - a = (a + l) | 0; - d = (d + 1) | 0; - b = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - } - if (!e) { - break h; - } - ja(e); - } - break a; - case 1: - j = F[(i + 80) >> 2]; - h = G[(c + 24) | 0]; - k: { - if ((L(j, h) | 0) != (e | 0)) { - break k; - } - d = F[(c + 28) >> 2] != 2; - b = G[(c + 84) | 0]; - if (!(d | !b)) { - la( - f, - (F[F[c >> 2] >> 2] + F[(c + 48) >> 2]) | 0, - e, - ); - b = 1; - break k; - } - if (h) { - a = ka(h); - ma(a, 0, h); - } - l: { - if (!j) { - b = 1; - break l; - } - if (!d) { - if (h) { - d = 0; - e = 0; - while (1) { - i = (d + f) | 0; - k = F[F[c >> 2] >> 2]; - m = F[(c + 48) >> 2]; - g = F[(c + 40) >> 2]; - b = ki( - g, - F[(c + 44) >> 2], - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - 0, - ); - n = b; - b = (b + m) | 0; - la(i, la(a, (b + k) | 0, g), h); - d = (d + h) | 0; - b = 1; - e = (e + 1) | 0; - if ((j | 0) != (e | 0)) { - continue; - } - break; - } - break l; - } - if (b) { - b = 1; - h = F[c >> 2]; - e = F[(c + 48) >> 2]; - f = F[(c + 40) >> 2]; - i = F[(c + 44) >> 2]; - if ((j | 0) != 1) { - g = j & -2; - c = 0; - d = 0; - while (1) { - k = F[h >> 2]; - m = (ki(f, i, c, 0) + e) | 0; - k = la(a, (k + m) | 0, f); - m = F[h >> 2]; - n = (ki(f, i, c | 1, 0) + e) | 0; - la(k, (m + n) | 0, f); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - g = c; - } - if (!(j & 1)) { - break l; - } - c = F[h >> 2]; - d = (ki(g, 0, f, i) + e) | 0; - la(a, (c + d) | 0, f); - break l; - } - b = 1; - h = F[c >> 2]; - e = F[(c + 48) >> 2]; - g = F[(c + 68) >> 2]; - f = F[(c + 40) >> 2]; - i = F[(c + 44) >> 2]; - c = 0; - if ((j | 0) != 1) { - k = j & -2; - d = 0; - while (1) { - m = F[h >> 2]; - n = c << 2; - l = (ki(f, i, F[(n + g) >> 2], 0) + e) | 0; - m = la(a, (m + l) | 0, f); - l = F[h >> 2]; - n = - (ki(f, i, F[(g + (n | 4)) >> 2], 0) + e) | - 0; - la(m, (l + n) | 0, f); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((k | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(j & 1)) { - break l; - } - d = F[h >> 2]; - c = (ki(f, i, F[(g + (c << 2)) >> 2], 0) + e) | 0; - la(a, (c + d) | 0, f); - break l; - } - b = 0; - if (!h) { - d = 0; - while (1) { - if ( - !Bb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break l; - } - d = (d + 1) | 0; - b = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - break l; - } - d = 0; - e = 0; - while (1) { - if ( - !Bb( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break l; - } - la((d + f) | 0, a, h); - d = (d + h) | 0; - e = (e + 1) | 0; - b = j >>> 0 <= e >>> 0; - if ((e | 0) != (j | 0)) { - continue; - } - break; - } - } - if (!a) { - break k; - } - ja(a); - } - break a; - case 3: - n = G[(c + 24) | 0]; - l = n << 1; - j = F[(i + 80) >> 2]; - m: { - if ((L(l, j) | 0) != (e | 0)) { - break m; - } - i = F[(c + 28) >> 2] != 4; - d = G[(c + 84) | 0]; - if (!(i | !d)) { - la( - f, - (F[F[c >> 2] >> 2] + F[(c + 48) >> 2]) | 0, - e, - ); - a = 1; - break m; - } - n: { - if (!n) { - e = 0; - break n; - } - e = ka(l); - ma(e, 0, l); - } - o: { - if (!j) { - a = 1; - break o; - } - if (!i) { - o = F[(c + 68) >> 2]; - k = F[c >> 2]; - b = F[(c + 48) >> 2]; - i = F[(c + 40) >> 2]; - m = F[(c + 44) >> 2]; - if (n) { - if (!d) { - c = 0; - d = 0; - while (1) { - a = 1; - g = F[k >> 2]; - p = - (ki(i, m, F[(o + (d << 2)) >> 2], 0) + - b) | - 0; - la( - ((c << 1) + f) | 0, - la(e, (g + p) | 0, i), - l, - ); - c = (c + n) | 0; - d = (d + 1) | 0; - if ((j | 0) != (d | 0)) { - continue; - } - break; - } - break o; - } - c = 0; - while (1) { - a = 1; - o = F[k >> 2]; - p = (ki(g, h, i, m) + b) | 0; - la( - ((c << 1) + f) | 0, - la(e, (o + p) | 0, i), - l, - ); - c = (c + n) | 0; - d = h; - g = (g + 1) | 0; - d = g ? d : (d + 1) | 0; - h = d; - if (((j | 0) != (g | 0)) | d) { - continue; - } - break; - } - break o; - } - if (!d) { - a = 1; - c = 0; - if ((j | 0) != 1) { - f = j & -2; - d = 0; - while (1) { - h = F[k >> 2]; - g = c << 2; - n = (ki(i, m, F[(g + o) >> 2], 0) + b) | 0; - h = la(e, (h + n) | 0, i); - n = F[k >> 2]; - g = - (ki(i, m, F[(o + (g | 4)) >> 2], 0) + b) | - 0; - la(h, (g + n) | 0, i); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(j & 1)) { - break o; - } - d = F[k >> 2]; - b = - (ki(i, m, F[(o + (c << 2)) >> 2], 0) + b) | 0; - la(e, (b + d) | 0, i); - break o; - } - n = j & 1; - a = 1; - if ((j | 0) != 1) { - j = j & -2; - f = 0; - c = 0; - while (1) { - d = F[k >> 2]; - l = (ki(g, h, i, m) + b) | 0; - d = la(e, (d + l) | 0, i); - l = F[k >> 2]; - o = (ki(i, m, g | 1, h) + b) | 0; - la(d, (l + o) | 0, i); - g = (g + 2) | 0; - h = g >>> 0 < 2 ? (h + 1) | 0 : h; - f = (f + 2) | 0; - d = f >>> 0 < 2 ? (c + 1) | 0 : c; - c = d; - if (((f | 0) != (j | 0)) | c) { - continue; - } - break; - } - } - if (!n) { - break o; - } - c = F[k >> 2]; - b = (ki(g, h, i, m) + b) | 0; - la(e, (b + c) | 0, i); - break o; - } - if (!n) { - d = 0; - while (1) { - if ( - !zb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break o; - } - d = (d + 1) | 0; - a = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - break o; - } - d = 0; - while (1) { - if ( - !zb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break o; - } - la(((b << 1) + f) | 0, e, l); - b = (b + n) | 0; - d = (d + 1) | 0; - a = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - } - if (!e) { - break m; - } - ja(e); - } - b = a; - break a; - case 5: - l = G[(c + 24) | 0]; - o = l << 2; - j = F[(i + 80) >> 2]; - p: { - if ((L(o, j) | 0) != (e | 0)) { - break p; - } - i = F[(c + 28) >> 2] != 6; - d = G[(c + 84) | 0]; - if (!(i | !d)) { - la( - f, - (F[F[c >> 2] >> 2] + F[(c + 48) >> 2]) | 0, - e, - ); - b = 1; - break p; - } - q: { - if (!l) { - e = 0; - break q; - } - e = ka(o); - ma(e, 0, o); - } - b = 1; - r: { - if (!j) { - break r; - } - if (!i) { - a = F[(c + 68) >> 2]; - m = F[c >> 2]; - i = F[(c + 48) >> 2]; - k = F[(c + 40) >> 2]; - n = F[(c + 44) >> 2]; - if (l) { - if (!d) { - c = 0; - d = 0; - while (1) { - g = F[m >> 2]; - p = - (ki(k, n, F[(a + (d << 2)) >> 2], 0) + - i) | - 0; - la( - ((c << 2) + f) | 0, - la(e, (g + p) | 0, k), - o, - ); - c = (c + l) | 0; - d = (d + 1) | 0; - if ((j | 0) != (d | 0)) { - continue; - } - break; - } - break r; - } - c = 0; - while (1) { - d = F[m >> 2]; - p = (ki(g, h, k, n) + i) | 0; - la( - ((c << 2) + f) | 0, - la(e, (d + p) | 0, k), - o, - ); - c = (c + l) | 0; - g = (g + 1) | 0; - a = g ? h : (h + 1) | 0; - h = a; - if (((j | 0) != (g | 0)) | h) { - continue; - } - break; - } - break r; - } - if (!d) { - c = 0; - if ((j | 0) != 1) { - f = j & -2; - d = 0; - while (1) { - h = F[m >> 2]; - g = c << 2; - l = (ki(k, n, F[(g + a) >> 2], 0) + i) | 0; - h = la(e, (h + l) | 0, k); - l = F[m >> 2]; - g = - (ki(k, n, F[(a + (g | 4)) >> 2], 0) + i) | - 0; - la(h, (g + l) | 0, k); - c = (c + 2) | 0; - d = (d + 2) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(j & 1)) { - break r; - } - d = F[m >> 2]; - a = - (ki(k, n, F[(a + (c << 2)) >> 2], 0) + i) | 0; - la(e, (a + d) | 0, k); - break r; - } - l = j & 1; - if ((j | 0) != 1) { - j = j & -2; - f = 0; - c = 0; - while (1) { - a = F[m >> 2]; - d = (ki(g, h, k, n) + i) | 0; - a = la(e, (a + d) | 0, k); - d = F[m >> 2]; - o = (ki(k, n, g | 1, h) + i) | 0; - la(a, (d + o) | 0, k); - d = h; - g = (g + 2) | 0; - h = g >>> 0 < 2 ? (d + 1) | 0 : d; - f = (f + 2) | 0; - a = f >>> 0 < 2 ? (c + 1) | 0 : c; - c = a; - if (((f | 0) != (j | 0)) | c) { - continue; - } - break; - } - } - if (!l) { - break r; - } - a = F[m >> 2]; - c = (ki(g, h, k, n) + i) | 0; - la(e, (a + c) | 0, k); - break r; - } - b = 0; - if (!l) { - d = 0; - while (1) { - if ( - !xb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break r; - } - d = (d + 1) | 0; - b = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - break r; - } - d = 0; - while (1) { - if ( - !xb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - e, - ) - ) { - break r; - } - la(((a << 2) + f) | 0, e, o); - a = (a + l) | 0; - d = (d + 1) | 0; - b = j >>> 0 <= d >>> 0; - if ((d | 0) != (j | 0)) { - continue; - } - break; - } - } - if (!e) { - break p; - } - ja(e); - } - break a; - case 8: - p = G[(c + 24) | 0]; - q = p << 2; - k = F[(i + 80) >> 2]; - s: { - if ((L(q, k) | 0) != (e | 0)) { - break s; - } - i = F[(c + 28) >> 2]; - t: { - if (!p) { - break t; - } - a = ka(q); - d = a; - m = (q - 4) | 0; - l = (((m >>> 2) | 0) + 1) & 7; - if (l) { - e = 0; - while (1) { - F[d >> 2] = -1073741824; - d = (d + 4) | 0; - e = (e + 1) | 0; - if ((l | 0) != (e | 0)) { - continue; - } - break; - } - } - if (m >>> 0 < 28) { - break t; - } - e = ((p << 2) + a) | 0; - while (1) { - F[(d + 24) >> 2] = -1073741824; - F[(d + 28) >> 2] = -1073741824; - F[(d + 16) >> 2] = -1073741824; - F[(d + 20) >> 2] = -1073741824; - F[(d + 8) >> 2] = -1073741824; - F[(d + 12) >> 2] = -1073741824; - F[d >> 2] = -1073741824; - F[(d + 4) >> 2] = -1073741824; - d = (d + 32) | 0; - if ((e | 0) != (d | 0)) { - continue; - } - break; - } - } - u: { - if (!k) { - b = 1; - break u; - } - if ((i | 0) == 9) { - r = F[(c + 68) >> 2]; - l = F[c >> 2]; - i = F[(c + 48) >> 2]; - s = G[(c + 84) | 0]; - m = F[(c + 44) >> 2]; - c = F[(c + 40) >> 2]; - o = c; - if (p) { - e = 0; - d = 0; - while (1) { - h = ((e << 2) + f) | 0; - g = F[l >> 2]; - b = - (ki( - c, - m, - s ? d : F[(r + (d << 2)) >> 2], - 0, - ) + - i) | - 0; - la(h, la(a, (b + g) | 0, o), q); - e = (e + p) | 0; - b = 1; - d = (d + 1) | 0; - if ((k | 0) != (d | 0)) { - continue; - } - break; - } - break u; - } - if (!s) { - b = 1; - d = 0; - if ((k | 0) != 1) { - f = k & -2; - e = 0; - while (1) { - h = F[l >> 2]; - g = d << 2; - j = (ki(c, m, F[(g + r) >> 2], 0) + i) | 0; - h = la(a, (h + j) | 0, o); - j = F[l >> 2]; - g = - (ki(c, m, F[(r + (g | 4)) >> 2], 0) + i) | - 0; - la(h, (j + g) | 0, o); - d = (d + 2) | 0; - e = (e + 2) | 0; - if ((f | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!(k & 1)) { - break u; - } - e = F[l >> 2]; - c = - (ki(c, m, F[(r + (d << 2)) >> 2], 0) + i) | 0; - la(a, (c + e) | 0, o); - break u; - } - f = k & 1; - b = 1; - if ((k | 0) != 1) { - k = k & -2; - while (1) { - d = F[l >> 2]; - e = (ki(g, h, c, m) + i) | 0; - d = la(a, (d + e) | 0, o); - e = F[l >> 2]; - p = (ki(c, m, g | 1, h) + i) | 0; - la(d, (e + p) | 0, o); - g = (g + 2) | 0; - h = g >>> 0 < 2 ? (h + 1) | 0 : h; - d = j; - e = (n + 2) | 0; - d = e >>> 0 < 2 ? (d + 1) | 0 : d; - n = e; - j = d; - if (((e | 0) != (k | 0)) | d) { - continue; - } - break; - } - } - if (!f) { - break u; - } - d = F[l >> 2]; - c = (ki(g, h, c, m) + i) | 0; - la(a, (c + d) | 0, o); - break u; - } - if (!p) { - d = 0; - while (1) { - if ( - !lb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break u; - } - d = (d + 1) | 0; - b = k >>> 0 <= d >>> 0; - if ((d | 0) != (k | 0)) { - continue; - } - break; - } - break u; - } - e = 0; - d = 0; - while (1) { - if ( - !lb( - c, - G[(c + 84) | 0] - ? d - : F[(F[(c + 68) >> 2] + (d << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break u; - } - la(((e << 2) + f) | 0, a, q); - e = (e + p) | 0; - d = (d + 1) | 0; - b = k >>> 0 <= d >>> 0; - if ((d | 0) != (k | 0)) { - continue; - } - break; - } - } - if (!a) { - break s; - } - ja(a); - } - a = b; - break; - default: - break b; - } - } - b = a; - } - return b | 0; - } - function Pd(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - h = (Z - 80) | 0; - Z = h; - e = F[(c + 36) >> 2]; - F[(h + 72) >> 2] = F[(c + 32) >> 2]; - F[(h + 76) >> 2] = e; - f = F[(c + 28) >> 2]; - e = (h - -64) | 0; - F[e >> 2] = F[(c + 24) >> 2]; - F[(e + 4) >> 2] = f; - e = F[(c + 20) >> 2]; - F[(h + 56) >> 2] = F[(c + 16) >> 2]; - F[(h + 60) >> 2] = e; - e = F[(c + 12) >> 2]; - F[(h + 48) >> 2] = F[(c + 8) >> 2]; - F[(h + 52) >> 2] = e; - e = F[(c + 4) >> 2]; - F[(h + 40) >> 2] = F[c >> 2]; - F[(h + 44) >> 2] = e; - jc(a, (h + 40) | 0, (h + 24) | 0); - a: { - if (F[a >> 2]) { - break a; - } - if (D[(a + 15) | 0] < 0) { - ja(F[(a + 4) >> 2]); - } - if (G[(h + 31) | 0] != 1) { - b = ka(32); - D[(b + 20) | 0] = 0; - c = - G[1446] | - (G[1447] << 8) | - ((G[1448] << 16) | (G[1449] << 24)); - D[(b + 16) | 0] = c; - D[(b + 17) | 0] = c >>> 8; - D[(b + 18) | 0] = c >>> 16; - D[(b + 19) | 0] = c >>> 24; - c = - G[1442] | - (G[1443] << 8) | - ((G[1444] << 16) | (G[1445] << 24)); - d = - G[1438] | - (G[1439] << 8) | - ((G[1440] << 16) | (G[1441] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1434] | - (G[1435] << 8) | - ((G[1436] << 16) | (G[1437] << 24)); - d = - G[1430] | - (G[1431] << 8) | - ((G[1432] << 16) | (G[1433] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - F[a >> 2] = -1; - ra((a + 4) | 0, b, 20); - ja(b); - break a; - } - j = (Z - 16) | 0; - Z = j; - b: { - c: { - switch (G[(h + 32) | 0]) { - case 0: - e = Kd(ka(48)); - F[e >> 2] = 9864; - F[(h + 8) >> 2] = 0; - F[(h + 12) >> 2] = 0; - F[h >> 2] = 0; - F[(h + 4) >> 2] = 0; - F[(h + 16) >> 2] = e; - break b; - case 1: - e = Kd(ka(52)); - F[(e + 48) >> 2] = 0; - F[e >> 2] = 8176; - F[(h + 8) >> 2] = 0; - F[(h + 12) >> 2] = 0; - F[h >> 2] = 0; - F[(h + 4) >> 2] = 0; - F[(h + 16) >> 2] = e; - break b; - default: - break c; - } - } - f = ka(32); - D[(f + 28) | 0] = 0; - e = - G[1520] | - (G[1521] << 8) | - ((G[1522] << 16) | (G[1523] << 24)); - D[(f + 24) | 0] = e; - D[(f + 25) | 0] = e >>> 8; - D[(f + 26) | 0] = e >>> 16; - D[(f + 27) | 0] = e >>> 24; - e = - G[1516] | - (G[1517] << 8) | - ((G[1518] << 16) | (G[1519] << 24)); - g = - G[1512] | - (G[1513] << 8) | - ((G[1514] << 16) | (G[1515] << 24)); - D[(f + 16) | 0] = g; - D[(f + 17) | 0] = g >>> 8; - D[(f + 18) | 0] = g >>> 16; - D[(f + 19) | 0] = g >>> 24; - D[(f + 20) | 0] = e; - D[(f + 21) | 0] = e >>> 8; - D[(f + 22) | 0] = e >>> 16; - D[(f + 23) | 0] = e >>> 24; - e = - G[1508] | - (G[1509] << 8) | - ((G[1510] << 16) | (G[1511] << 24)); - g = - G[1504] | - (G[1505] << 8) | - ((G[1506] << 16) | (G[1507] << 24)); - D[(f + 8) | 0] = g; - D[(f + 9) | 0] = g >>> 8; - D[(f + 10) | 0] = g >>> 16; - D[(f + 11) | 0] = g >>> 24; - D[(f + 12) | 0] = e; - D[(f + 13) | 0] = e >>> 8; - D[(f + 14) | 0] = e >>> 16; - D[(f + 15) | 0] = e >>> 24; - e = - G[1500] | - (G[1501] << 8) | - ((G[1502] << 16) | (G[1503] << 24)); - g = - G[1496] | - (G[1497] << 8) | - ((G[1498] << 16) | (G[1499] << 24)); - D[f | 0] = g; - D[(f + 1) | 0] = g >>> 8; - D[(f + 2) | 0] = g >>> 16; - D[(f + 3) | 0] = g >>> 24; - D[(f + 4) | 0] = e; - D[(f + 5) | 0] = e >>> 8; - D[(f + 6) | 0] = e >>> 16; - D[(f + 7) | 0] = e >>> 24; - F[j >> 2] = -1; - e = j | 4; - ra(e, f, 28); - k = D[(j + 15) | 0]; - F[h >> 2] = F[j >> 2]; - g = (h + 4) | 0; - d: { - if ((k | 0) >= 0) { - k = F[(e + 4) >> 2]; - F[g >> 2] = F[e >> 2]; - F[(g + 4) >> 2] = k; - F[(g + 8) >> 2] = F[(e + 8) >> 2]; - F[(h + 16) >> 2] = 0; - break d; - } - ra(g, F[(j + 4) >> 2], F[(j + 8) >> 2]); - e = D[(j + 15) | 0]; - F[(h + 16) >> 2] = 0; - if ((e | 0) >= 0) { - break d; - } - ja(F[(j + 4) >> 2]); - } - ja(f); - } - Z = (j + 16) | 0; - e = F[h >> 2]; - e: { - if (e) { - F[a >> 2] = e; - a = (a + 4) | 0; - if (D[(h + 15) | 0] >= 0) { - b = h | 4; - c = F[(b + 4) >> 2]; - F[a >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = c; - F[(a + 8) >> 2] = F[(b + 8) >> 2]; - break e; - } - ra(a, F[(h + 4) >> 2], F[(h + 8) >> 2]); - break e; - } - e = F[(h + 16) >> 2]; - F[(h + 16) >> 2] = 0; - F[(e + 44) >> 2] = d; - f = (Z - 32) | 0; - Z = f; - F[(e + 32) >> 2] = c; - F[(e + 40) >> 2] = b; - F[(e + 4) >> 2] = d; - jc(a, c, (f + 16) | 0); - f: { - if (F[a >> 2]) { - break f; - } - if (D[(a + 15) | 0] < 0) { - ja(F[(a + 4) >> 2]); - } - b = G[(f + 23) | 0]; - if (($[F[(F[e >> 2] + 8) >> 2]](e) | 0) != (b | 0)) { - b = ka(64); - D[(b + 50) | 0] = 0; - c = G[1304] | (G[1305] << 8); - D[(b + 48) | 0] = c; - D[(b + 49) | 0] = c >>> 8; - c = - G[1300] | - (G[1301] << 8) | - ((G[1302] << 16) | (G[1303] << 24)); - d = - G[1296] | - (G[1297] << 8) | - ((G[1298] << 16) | (G[1299] << 24)); - D[(b + 40) | 0] = d; - D[(b + 41) | 0] = d >>> 8; - D[(b + 42) | 0] = d >>> 16; - D[(b + 43) | 0] = d >>> 24; - D[(b + 44) | 0] = c; - D[(b + 45) | 0] = c >>> 8; - D[(b + 46) | 0] = c >>> 16; - D[(b + 47) | 0] = c >>> 24; - c = - G[1292] | - (G[1293] << 8) | - ((G[1294] << 16) | (G[1295] << 24)); - d = - G[1288] | - (G[1289] << 8) | - ((G[1290] << 16) | (G[1291] << 24)); - D[(b + 32) | 0] = d; - D[(b + 33) | 0] = d >>> 8; - D[(b + 34) | 0] = d >>> 16; - D[(b + 35) | 0] = d >>> 24; - D[(b + 36) | 0] = c; - D[(b + 37) | 0] = c >>> 8; - D[(b + 38) | 0] = c >>> 16; - D[(b + 39) | 0] = c >>> 24; - c = - G[1284] | - (G[1285] << 8) | - ((G[1286] << 16) | (G[1287] << 24)); - d = - G[1280] | - (G[1281] << 8) | - ((G[1282] << 16) | (G[1283] << 24)); - D[(b + 24) | 0] = d; - D[(b + 25) | 0] = d >>> 8; - D[(b + 26) | 0] = d >>> 16; - D[(b + 27) | 0] = d >>> 24; - D[(b + 28) | 0] = c; - D[(b + 29) | 0] = c >>> 8; - D[(b + 30) | 0] = c >>> 16; - D[(b + 31) | 0] = c >>> 24; - c = - G[1276] | - (G[1277] << 8) | - ((G[1278] << 16) | (G[1279] << 24)); - d = - G[1272] | - (G[1273] << 8) | - ((G[1274] << 16) | (G[1275] << 24)); - D[(b + 16) | 0] = d; - D[(b + 17) | 0] = d >>> 8; - D[(b + 18) | 0] = d >>> 16; - D[(b + 19) | 0] = d >>> 24; - D[(b + 20) | 0] = c; - D[(b + 21) | 0] = c >>> 8; - D[(b + 22) | 0] = c >>> 16; - D[(b + 23) | 0] = c >>> 24; - c = - G[1268] | - (G[1269] << 8) | - ((G[1270] << 16) | (G[1271] << 24)); - d = - G[1264] | - (G[1265] << 8) | - ((G[1266] << 16) | (G[1267] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1260] | - (G[1261] << 8) | - ((G[1262] << 16) | (G[1263] << 24)); - d = - G[1256] | - (G[1257] << 8) | - ((G[1258] << 16) | (G[1259] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - F[a >> 2] = -1; - ra((a + 4) | 0, b, 50); - ja(b); - break f; - } - c = G[(f + 21) | 0]; - D[(e + 36) | 0] = c; - d = G[(f + 22) | 0]; - D[(e + 37) | 0] = d; - if ((c | 0) != 2) { - b = ka(32); - D[(b + 26) | 0] = 0; - c = G[1427] | (G[1428] << 8); - D[(b + 24) | 0] = c; - D[(b + 25) | 0] = c >>> 8; - c = - G[1423] | - (G[1424] << 8) | - ((G[1425] << 16) | (G[1426] << 24)); - d = - G[1419] | - (G[1420] << 8) | - ((G[1421] << 16) | (G[1422] << 24)); - D[(b + 16) | 0] = d; - D[(b + 17) | 0] = d >>> 8; - D[(b + 18) | 0] = d >>> 16; - D[(b + 19) | 0] = d >>> 24; - D[(b + 20) | 0] = c; - D[(b + 21) | 0] = c >>> 8; - D[(b + 22) | 0] = c >>> 16; - D[(b + 23) | 0] = c >>> 24; - c = - G[1415] | - (G[1416] << 8) | - ((G[1417] << 16) | (G[1418] << 24)); - d = - G[1411] | - (G[1412] << 8) | - ((G[1413] << 16) | (G[1414] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1407] | - (G[1408] << 8) | - ((G[1409] << 16) | (G[1410] << 24)); - d = - G[1403] | - (G[1404] << 8) | - ((G[1405] << 16) | (G[1406] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - F[a >> 2] = -5; - ra((a + 4) | 0, b, 26); - ja(b); - break f; - } - b = b ? 2 : 3; - if ((b | 0) != (d | 0)) { - b = ka(32); - D[(b + 26) | 0] = 0; - c = G[1400] | (G[1401] << 8); - D[(b + 24) | 0] = c; - D[(b + 25) | 0] = c >>> 8; - c = - G[1396] | - (G[1397] << 8) | - ((G[1398] << 16) | (G[1399] << 24)); - d = - G[1392] | - (G[1393] << 8) | - ((G[1394] << 16) | (G[1395] << 24)); - D[(b + 16) | 0] = d; - D[(b + 17) | 0] = d >>> 8; - D[(b + 18) | 0] = d >>> 16; - D[(b + 19) | 0] = d >>> 24; - D[(b + 20) | 0] = c; - D[(b + 21) | 0] = c >>> 8; - D[(b + 22) | 0] = c >>> 16; - D[(b + 23) | 0] = c >>> 24; - c = - G[1388] | - (G[1389] << 8) | - ((G[1390] << 16) | (G[1391] << 24)); - d = - G[1384] | - (G[1385] << 8) | - ((G[1386] << 16) | (G[1387] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1380] | - (G[1381] << 8) | - ((G[1382] << 16) | (G[1383] << 24)); - d = - G[1376] | - (G[1377] << 8) | - ((G[1378] << 16) | (G[1379] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - F[a >> 2] = -5; - ra((a + 4) | 0, b, 26); - ja(b); - break f; - } - E[(F[(e + 32) >> 2] + 38) >> 1] = b | 512; - g: { - if (E[(f + 26) >> 1] >= 0) { - break g; - } - j = (Z - 16) | 0; - Z = j; - d = ka(36); - b = d; - F[(b + 4) >> 2] = 0; - F[(b + 8) >> 2] = 0; - F[(b + 24) >> 2] = 0; - F[(b + 28) >> 2] = 0; - b = (b + 16) | 0; - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - F[d >> 2] = d + 4; - F[(d + 32) >> 2] = 0; - F[(d + 12) >> 2] = b; - F[j >> 2] = 0; - c = F[(e + 32) >> 2]; - k = (Z - 16) | 0; - Z = k; - b = 0; - h: { - if (!d) { - break h; - } - F[j >> 2] = c; - F[(k + 12) >> 2] = 0; - b = 0; - if (!fb(1, (k + 12) | 0, c)) { - break h; - } - n = F[(k + 12) >> 2]; - if (n) { - while (1) { - i: { - if (fb(1, (k + 8) | 0, F[j >> 2])) { - b = ka(28); - F[(b + 4) >> 2] = 0; - F[(b + 8) >> 2] = 0; - c = (b + 16) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - F[b >> 2] = b + 4; - F[(b + 12) >> 2] = c; - F[(b + 24) >> 2] = F[(k + 8) >> 2]; - if (Vc(j, b)) { - break i; - } - Ca((b + 12) | 0, F[(b + 16) >> 2]); - Ba(b, F[(b + 4) >> 2]); - ja(b); - } - b = 0; - break h; - } - g = (Z - 16) | 0; - Z = g; - F[(g + 8) >> 2] = b; - j: { - if (!b) { - break j; - } - c = F[(d + 28) >> 2]; - k: { - if (c >>> 0 < I[(d + 32) >> 2]) { - F[(g + 8) >> 2] = 0; - F[c >> 2] = b; - F[(d + 28) >> 2] = c + 4; - break k; - } - c = 0; - l: { - m: { - n: { - i = F[(d + 24) >> 2]; - m = (F[(d + 28) >> 2] - i) >> 2; - b = (m + 1) | 0; - if (b >>> 0 < 1073741824) { - i = (F[(d + 32) >> 2] - i) | 0; - l = (i >>> 1) | 0; - i = - i >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 < l >>> 0 - ? l - : b; - if (i) { - if (i >>> 0 >= 1073741824) { - break n; - } - c = ka(i << 2); - } - l = F[(g + 8) >> 2]; - F[(g + 8) >> 2] = 0; - b = ((m << 2) + c) | 0; - F[b >> 2] = l; - i = ((i << 2) + c) | 0; - m = (b + 4) | 0; - c = F[(d + 28) >> 2]; - l = F[(d + 24) >> 2]; - if ((c | 0) == (l | 0)) { - break m; - } - while (1) { - c = (c - 4) | 0; - p = F[c >> 2]; - F[c >> 2] = 0; - b = (b - 4) | 0; - F[b >> 2] = p; - if ((c | 0) != (l | 0)) { - continue; - } - break; - } - F[(d + 32) >> 2] = i; - i = F[(d + 28) >> 2]; - F[(d + 28) >> 2] = m; - c = F[(d + 24) >> 2]; - F[(d + 24) >> 2] = b; - if ((c | 0) == (i | 0)) { - break l; - } - while (1) { - i = (i - 4) | 0; - b = F[i >> 2]; - F[i >> 2] = 0; - if (b) { - Ca( - (b + 12) | 0, - F[(b + 16) >> 2], - ); - Ba(b, F[(b + 4) >> 2]); - ja(b); - } - if ((c | 0) != (i | 0)) { - continue; - } - break; - } - break l; - } - na(); - v(); - } - oa(); - v(); - } - F[(d + 32) >> 2] = i; - F[(d + 28) >> 2] = m; - F[(d + 24) >> 2] = b; - } - if (c) { - ja(c); - } - } - b = F[(g + 8) >> 2]; - F[(g + 8) >> 2] = 0; - if (!b) { - break j; - } - Ca((b + 12) | 0, F[(b + 16) >> 2]); - Ba(b, F[(b + 4) >> 2]); - ja(b); - } - Z = (g + 16) | 0; - o = (o + 1) | 0; - if ((n | 0) != (o | 0)) { - continue; - } - break; - } - } - b = Vc(j, d); - } - Z = (k + 16) | 0; - o: { - if (b) { - c = F[(e + 4) >> 2]; - b = F[(c + 4) >> 2]; - F[(c + 4) >> 2] = d; - if (b) { - ic(b); - } - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - break o; - } - b = ka(32); - D[(b + 26) | 0] = 0; - c = G[1549] | (G[1550] << 8); - D[(b + 24) | 0] = c; - D[(b + 25) | 0] = c >>> 8; - c = - G[1545] | - (G[1546] << 8) | - ((G[1547] << 16) | (G[1548] << 24)); - g = - G[1541] | - (G[1542] << 8) | - ((G[1543] << 16) | (G[1544] << 24)); - D[(b + 16) | 0] = g; - D[(b + 17) | 0] = g >>> 8; - D[(b + 18) | 0] = g >>> 16; - D[(b + 19) | 0] = g >>> 24; - D[(b + 20) | 0] = c; - D[(b + 21) | 0] = c >>> 8; - D[(b + 22) | 0] = c >>> 16; - D[(b + 23) | 0] = c >>> 24; - c = - G[1537] | - (G[1538] << 8) | - ((G[1539] << 16) | (G[1540] << 24)); - g = - G[1533] | - (G[1534] << 8) | - ((G[1535] << 16) | (G[1536] << 24)); - D[(b + 8) | 0] = g; - D[(b + 9) | 0] = g >>> 8; - D[(b + 10) | 0] = g >>> 16; - D[(b + 11) | 0] = g >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1529] | - (G[1530] << 8) | - ((G[1531] << 16) | (G[1532] << 24)); - g = - G[1525] | - (G[1526] << 8) | - ((G[1527] << 16) | (G[1528] << 24)); - D[b | 0] = g; - D[(b + 1) | 0] = g >>> 8; - D[(b + 2) | 0] = g >>> 16; - D[(b + 3) | 0] = g >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - F[a >> 2] = -1; - ra((a + 4) | 0, b, 26); - ja(b); - F[(j + 8) >> 2] = 0; - ic(d); - } - Z = (j + 16) | 0; - if (F[a >> 2]) { - break f; - } - if (D[(a + 15) | 0] >= 0) { - break g; - } - ja(F[(a + 4) >> 2]); - } - if (!($[F[(F[e >> 2] + 12) >> 2]](e) | 0)) { - b = ka(48); - D[(b + 33) | 0] = 0; - D[(b + 32) | 0] = G[1374]; - c = - G[1370] | - (G[1371] << 8) | - ((G[1372] << 16) | (G[1373] << 24)); - d = - G[1366] | - (G[1367] << 8) | - ((G[1368] << 16) | (G[1369] << 24)); - D[(b + 24) | 0] = d; - D[(b + 25) | 0] = d >>> 8; - D[(b + 26) | 0] = d >>> 16; - D[(b + 27) | 0] = d >>> 24; - D[(b + 28) | 0] = c; - D[(b + 29) | 0] = c >>> 8; - D[(b + 30) | 0] = c >>> 16; - D[(b + 31) | 0] = c >>> 24; - c = - G[1362] | - (G[1363] << 8) | - ((G[1364] << 16) | (G[1365] << 24)); - d = - G[1358] | - (G[1359] << 8) | - ((G[1360] << 16) | (G[1361] << 24)); - D[(b + 16) | 0] = d; - D[(b + 17) | 0] = d >>> 8; - D[(b + 18) | 0] = d >>> 16; - D[(b + 19) | 0] = d >>> 24; - D[(b + 20) | 0] = c; - D[(b + 21) | 0] = c >>> 8; - D[(b + 22) | 0] = c >>> 16; - D[(b + 23) | 0] = c >>> 24; - c = - G[1354] | - (G[1355] << 8) | - ((G[1356] << 16) | (G[1357] << 24)); - d = - G[1350] | - (G[1351] << 8) | - ((G[1352] << 16) | (G[1353] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1346] | - (G[1347] << 8) | - ((G[1348] << 16) | (G[1349] << 24)); - d = - G[1342] | - (G[1343] << 8) | - ((G[1344] << 16) | (G[1345] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - F[a >> 2] = -1; - ra((a + 4) | 0, b, 33); - ja(b); - break f; - } - if (!($[F[(F[e >> 2] + 20) >> 2]](e) | 0)) { - b = Eb(f, 1552); - F[a >> 2] = -1; - c = (a + 4) | 0; - if (D[(b + 11) | 0] >= 0) { - d = F[(b + 4) >> 2]; - F[c >> 2] = F[b >> 2]; - F[(c + 4) >> 2] = d; - F[(c + 8) >> 2] = F[(b + 8) >> 2]; - break f; - } - ra(c, F[b >> 2], F[(b + 4) >> 2]); - if (D[(b + 11) | 0] >= 0) { - break f; - } - ja(F[b >> 2]); - break f; - } - if (!($[F[(F[e >> 2] + 24) >> 2]](e) | 0)) { - b = Eb(f, 1307); - F[a >> 2] = -1; - c = (a + 4) | 0; - if (D[(b + 11) | 0] >= 0) { - d = F[(b + 4) >> 2]; - F[c >> 2] = F[b >> 2]; - F[(c + 4) >> 2] = d; - F[(c + 8) >> 2] = F[(b + 8) >> 2]; - break f; - } - ra(c, F[b >> 2], F[(b + 4) >> 2]); - if (D[(b + 11) | 0] >= 0) { - break f; - } - ja(F[b >> 2]); - break f; - } - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - } - Z = (f + 32) | 0; - if (!F[a >> 2]) { - if (D[(a + 15) | 0] < 0) { - ja(F[(a + 4) >> 2]); - } - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - } - $[F[(F[e >> 2] + 4) >> 2]](e); - } - a = F[(h + 16) >> 2]; - F[(h + 16) >> 2] = 0; - if (a) { - $[F[(F[a >> 2] + 4) >> 2]](a); - } - if (D[(h + 15) | 0] >= 0) { - break a; - } - ja(F[(h + 4) >> 2]); - } - Z = (h + 80) | 0; - } - function Ub(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0; - l = (Z - 16) | 0; - Z = l; - a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - i: { - if (a >>> 0 <= 244) { - g = F[2941]; - h = a >>> 0 < 11 ? 16 : (a + 11) & -8; - c = (h >>> 3) | 0; - b = (g >>> c) | 0; - if (b & 3) { - c = (c + ((b ^ -1) & 1)) | 0; - a = c << 3; - b = (a + 11804) | 0; - d = F[(a + 11812) >> 2]; - a = F[(d + 8) >> 2]; - j: { - if ((b | 0) == (a | 0)) { - (m = 11764), - (n = oi(c) & g), - (F[m >> 2] = n); - break j; - } - F[(a + 12) >> 2] = b; - F[(b + 8) >> 2] = a; - } - a = (d + 8) | 0; - b = c << 3; - F[(d + 4) >> 2] = b | 3; - b = (b + d) | 0; - F[(b + 4) >> 2] = F[(b + 4) >> 2] | 1; - break a; - } - k = F[2943]; - if (k >>> 0 >= h >>> 0) { - break i; - } - if (b) { - a = 2 << c; - a = ((0 - a) | a) & (b << c); - d = ji((0 - a) & a); - a = d << 3; - b = (a + 11804) | 0; - e = F[(a + 11812) >> 2]; - a = F[(e + 8) >> 2]; - k: { - if ((b | 0) == (a | 0)) { - g = oi(d) & g; - F[2941] = g; - break k; - } - F[(a + 12) >> 2] = b; - F[(b + 8) >> 2] = a; - } - F[(e + 4) >> 2] = h | 3; - c = (e + h) | 0; - a = d << 3; - d = (a - h) | 0; - F[(c + 4) >> 2] = d | 1; - F[(a + e) >> 2] = d; - if (k) { - b = ((k & -8) + 11804) | 0; - f = F[2946]; - a = 1 << (k >>> 3); - l: { - if (!(a & g)) { - F[2941] = a | g; - a = b; - break l; - } - a = F[(b + 8) >> 2]; - } - F[(b + 8) >> 2] = f; - F[(a + 12) >> 2] = f; - F[(f + 12) >> 2] = b; - F[(f + 8) >> 2] = a; - } - a = (e + 8) | 0; - F[2946] = c; - F[2943] = d; - break a; - } - j = F[2942]; - if (!j) { - break i; - } - c = - F[((ji((0 - j) & j) << 2) + 12068) >> 2]; - f = ((F[(c + 4) >> 2] & -8) - h) | 0; - b = c; - while (1) { - m: { - a = F[(b + 16) >> 2]; - if (!a) { - a = F[(b + 20) >> 2]; - if (!a) { - break m; - } - } - b = ((F[(a + 4) >> 2] & -8) - h) | 0; - d = b >>> 0 < f >>> 0; - f = d ? b : f; - c = d ? a : c; - b = a; - continue; - } - break; - } - i = F[(c + 24) >> 2]; - d = F[(c + 12) >> 2]; - if ((d | 0) != (c | 0)) { - a = F[(c + 8) >> 2]; - F[(a + 12) >> 2] = d; - F[(d + 8) >> 2] = a; - break b; - } - b = (c + 20) | 0; - a = F[b >> 2]; - if (!a) { - a = F[(c + 16) >> 2]; - if (!a) { - break h; - } - b = (c + 16) | 0; - } - while (1) { - e = b; - d = a; - b = (a + 20) | 0; - a = F[b >> 2]; - if (a) { - continue; - } - b = (d + 16) | 0; - a = F[(d + 16) >> 2]; - if (a) { - continue; - } - break; - } - F[e >> 2] = 0; - break b; - } - h = -1; - if (a >>> 0 > 4294967231) { - break i; - } - a = (a + 11) | 0; - h = a & -8; - j = F[2942]; - if (!j) { - break i; - } - f = (0 - h) | 0; - g = 0; - n: { - if (h >>> 0 < 256) { - break n; - } - g = 31; - if (h >>> 0 > 16777215) { - break n; - } - a = O((a >>> 8) | 0); - g = - (((((h >>> (38 - a)) & 1) - (a << 1)) | - 0) + - 62) | - 0; - } - b = F[((g << 2) + 12068) >> 2]; - o: { - p: { - q: { - if (!b) { - a = 0; - break q; - } - a = 0; - c = - h << - ((g | 0) != 31 - ? (25 - ((g >>> 1) | 0)) | 0 - : 0); - while (1) { - r: { - e = - ((F[(b + 4) >> 2] & -8) - h) | 0; - if (e >>> 0 >= f >>> 0) { - break r; - } - d = b; - f = e; - if (e) { - break r; - } - f = 0; - a = b; - break p; - } - e = F[(b + 20) >> 2]; - b = - F[ - (((((c >>> 29) & 4) + b) | 0) + - 16) >> - 2 - ]; - a = e - ? (e | 0) == (b | 0) - ? a - : e - : a; - c = c << 1; - if (b) { - continue; - } - break; - } - } - if (!(a | d)) { - d = 0; - a = 2 << g; - a = ((0 - a) | a) & j; - if (!a) { - break i; - } - a = - F[ - ((ji(a & (0 - a)) << 2) + 12068) >> - 2 - ]; - } - if (!a) { - break o; - } - } - while (1) { - b = ((F[(a + 4) >> 2] & -8) - h) | 0; - c = b >>> 0 < f >>> 0; - f = c ? b : f; - d = c ? a : d; - b = F[(a + 16) >> 2]; - if (b) { - a = b; - } else { - a = F[(a + 20) >> 2]; - } - if (a) { - continue; - } - break; - } - } - if (!d | ((F[2943] - h) >>> 0 <= f >>> 0)) { - break i; - } - g = F[(d + 24) >> 2]; - c = F[(d + 12) >> 2]; - if ((d | 0) != (c | 0)) { - a = F[(d + 8) >> 2]; - F[(a + 12) >> 2] = c; - F[(c + 8) >> 2] = a; - break c; - } - b = (d + 20) | 0; - a = F[b >> 2]; - if (!a) { - a = F[(d + 16) >> 2]; - if (!a) { - break g; - } - b = (d + 16) | 0; - } - while (1) { - e = b; - c = a; - b = (a + 20) | 0; - a = F[b >> 2]; - if (a) { - continue; - } - b = (c + 16) | 0; - a = F[(c + 16) >> 2]; - if (a) { - continue; - } - break; - } - F[e >> 2] = 0; - break c; - } - a = F[2943]; - if (a >>> 0 >= h >>> 0) { - d = F[2946]; - b = (a - h) | 0; - s: { - if (b >>> 0 >= 16) { - c = (d + h) | 0; - F[(c + 4) >> 2] = b | 1; - F[(a + d) >> 2] = b; - F[(d + 4) >> 2] = h | 3; - break s; - } - F[(d + 4) >> 2] = a | 3; - a = (a + d) | 0; - F[(a + 4) >> 2] = F[(a + 4) >> 2] | 1; - c = 0; - b = 0; - } - F[2943] = b; - F[2946] = c; - a = (d + 8) | 0; - break a; - } - i = F[2944]; - if (i >>> 0 > h >>> 0) { - b = (i - h) | 0; - F[2944] = b; - c = F[2947]; - a = (c + h) | 0; - F[2947] = a; - F[(a + 4) >> 2] = b | 1; - F[(c + 4) >> 2] = h | 3; - a = (c + 8) | 0; - break a; - } - a = 0; - j = (h + 47) | 0; - if (F[3059]) { - c = F[3061]; - } else { - F[3062] = -1; - F[3063] = -1; - F[3060] = 4096; - F[3061] = 4096; - F[3059] = ((l + 12) & -16) ^ 1431655768; - F[3064] = 0; - F[3052] = 0; - c = 4096; - } - e = (j + c) | 0; - f = (0 - c) | 0; - b = e & f; - if (b >>> 0 <= h >>> 0) { - break a; - } - d = F[3051]; - if (d) { - c = F[3049]; - g = (c + b) | 0; - if ( - (d >>> 0 < g >>> 0) | - (c >>> 0 >= g >>> 0) - ) { - break a; - } - } - t: { - if (!(G[12208] & 4)) { - u: { - v: { - w: { - x: { - d = F[2947]; - if (d) { - a = 12212; - while (1) { - c = F[a >> 2]; - if ( - (c >>> 0 <= d >>> 0) & - (d >>> 0 < - (c + F[(a + 4) >> 2]) >>> 0) - ) { - break x; - } - a = F[(a + 8) >> 2]; - if (a) { - continue; - } - break; - } - } - c = eb(0); - if ((c | 0) == -1) { - break u; - } - g = b; - d = F[3060]; - a = (d - 1) | 0; - if (a & c) { - g = - (((b - c) | 0) + - ((a + c) & (0 - d))) | - 0; - } - if (g >>> 0 <= h >>> 0) { - break u; - } - d = F[3051]; - if (d) { - a = F[3049]; - f = (a + g) | 0; - if ( - (d >>> 0 < f >>> 0) | - (a >>> 0 >= f >>> 0) - ) { - break u; - } - } - a = eb(g); - if ((c | 0) != (a | 0)) { - break w; - } - break t; - } - g = f & (e - i); - c = eb(g); - if ( - (c | 0) == - ((F[a >> 2] + F[(a + 4) >> 2]) | 0) - ) { - break v; - } - a = c; - } - if ((a | 0) == -1) { - break u; - } - if ((h + 48) >>> 0 <= g >>> 0) { - c = a; - break t; - } - c = F[3061]; - c = (c + ((j - g) | 0)) & (0 - c); - if ((eb(c) | 0) == -1) { - break u; - } - g = (c + g) | 0; - c = a; - break t; - } - if ((c | 0) != -1) { - break t; - } - } - F[3052] = F[3052] | 4; - } - c = eb(b); - a = eb(0); - if ( - ((c | 0) == -1) | - ((a | 0) == -1) | - (a >>> 0 <= c >>> 0) - ) { - break d; - } - g = (a - c) | 0; - if (g >>> 0 <= (h + 40) >>> 0) { - break d; - } - } - a = (F[3049] + g) | 0; - F[3049] = a; - if (a >>> 0 > I[3050]) { - F[3050] = a; - } - y: { - e = F[2947]; - if (e) { - a = 12212; - while (1) { - d = F[a >> 2]; - b = F[(a + 4) >> 2]; - if (((d + b) | 0) == (c | 0)) { - break y; - } - a = F[(a + 8) >> 2]; - if (a) { - continue; - } - break; - } - break f; - } - a = F[2945]; - if (!(a >>> 0 <= c >>> 0 ? a : 0)) { - F[2945] = c; - } - a = 0; - F[3054] = g; - F[3053] = c; - F[2949] = -1; - F[2950] = F[3059]; - F[3056] = 0; - while (1) { - d = a << 3; - b = (d + 11804) | 0; - F[(d + 11812) >> 2] = b; - F[(d + 11816) >> 2] = b; - a = (a + 1) | 0; - if ((a | 0) != 32) { - continue; - } - break; - } - d = (g - 40) | 0; - a = (c + 8) & 7 ? (-8 - c) & 7 : 0; - b = (d - a) | 0; - F[2944] = b; - a = (a + c) | 0; - F[2947] = a; - F[(a + 4) >> 2] = b | 1; - F[(((c + d) | 0) + 4) >> 2] = 40; - F[2948] = F[3063]; - break e; - } - if ( - (G[(a + 12) | 0] & 8) | - (d >>> 0 > e >>> 0) | - (c >>> 0 <= e >>> 0) - ) { - break f; - } - F[(a + 4) >> 2] = b + g; - a = (e + 8) & 7 ? (-8 - e) & 7 : 0; - c = (a + e) | 0; - F[2947] = c; - b = (F[2944] + g) | 0; - a = (b - a) | 0; - F[2944] = a; - F[(c + 4) >> 2] = a | 1; - F[(((b + e) | 0) + 4) >> 2] = 40; - F[2948] = F[3063]; - break e; - } - d = 0; - break b; - } - c = 0; - break c; - } - if (I[2945] > c >>> 0) { - F[2945] = c; - } - b = (c + g) | 0; - a = 12212; - z: { - A: { - B: { - C: { - D: { - E: { - while (1) { - if ((b | 0) != F[a >> 2]) { - a = F[(a + 8) >> 2]; - if (a) { - continue; - } - break E; - } - break; - } - if (!(G[(a + 12) | 0] & 8)) { - break D; - } - } - a = 12212; - while (1) { - b = F[a >> 2]; - if (b >>> 0 <= e >>> 0) { - f = (b + F[(a + 4) >> 2]) | 0; - if (f >>> 0 > e >>> 0) { - break C; - } - } - a = F[(a + 8) >> 2]; - } - } - F[a >> 2] = c; - F[(a + 4) >> 2] = F[(a + 4) >> 2] + g; - j = - (((c + 8) & 7 ? (-8 - c) & 7 : 0) + c) | 0; - F[(j + 4) >> 2] = h | 3; - g = - (b + ((b + 8) & 7 ? (-8 - b) & 7 : 0)) | 0; - i = (h + j) | 0; - a = (g - i) | 0; - if ((e | 0) == (g | 0)) { - F[2947] = i; - a = (F[2944] + a) | 0; - F[2944] = a; - F[(i + 4) >> 2] = a | 1; - break A; - } - if (F[2946] == (g | 0)) { - F[2946] = i; - a = (F[2943] + a) | 0; - F[2943] = a; - F[(i + 4) >> 2] = a | 1; - F[(a + i) >> 2] = a; - break A; - } - f = F[(g + 4) >> 2]; - if ((f & 3) == 1) { - e = f & -8; - F: { - if (f >>> 0 <= 255) { - d = F[(g + 8) >> 2]; - b = (f >>> 3) | 0; - c = F[(g + 12) >> 2]; - if ((c | 0) == (d | 0)) { - (m = 11764), - (n = F[2941] & oi(b)), - (F[m >> 2] = n); - break F; - } - F[(d + 12) >> 2] = c; - F[(c + 8) >> 2] = d; - break F; - } - h = F[(g + 24) >> 2]; - c = F[(g + 12) >> 2]; - G: { - if ((g | 0) != (c | 0)) { - b = F[(g + 8) >> 2]; - F[(b + 12) >> 2] = c; - F[(c + 8) >> 2] = b; - break G; - } - H: { - f = (g + 20) | 0; - b = F[f >> 2]; - if (b) { - break H; - } - f = (g + 16) | 0; - b = F[f >> 2]; - if (b) { - break H; - } - c = 0; - break G; - } - while (1) { - d = f; - c = b; - f = (c + 20) | 0; - b = F[f >> 2]; - if (b) { - continue; - } - f = (c + 16) | 0; - b = F[(c + 16) >> 2]; - if (b) { - continue; - } - break; - } - F[d >> 2] = 0; - } - if (!h) { - break F; - } - d = F[(g + 28) >> 2]; - b = ((d << 2) + 12068) | 0; - I: { - if (F[b >> 2] == (g | 0)) { - F[b >> 2] = c; - if (c) { - break I; - } - (m = 11768), - (n = F[2942] & oi(d)), - (F[m >> 2] = n); - break F; - } - F[ - (h + - (F[(h + 16) >> 2] == (g | 0) - ? 16 - : 20)) >> - 2 - ] = c; - if (!c) { - break F; - } - } - F[(c + 24) >> 2] = h; - b = F[(g + 16) >> 2]; - if (b) { - F[(c + 16) >> 2] = b; - F[(b + 24) >> 2] = c; - } - b = F[(g + 20) >> 2]; - if (!b) { - break F; - } - F[(c + 20) >> 2] = b; - F[(b + 24) >> 2] = c; - } - g = (e + g) | 0; - f = F[(g + 4) >> 2]; - a = (a + e) | 0; - } - F[(g + 4) >> 2] = f & -2; - F[(i + 4) >> 2] = a | 1; - F[(a + i) >> 2] = a; - if (a >>> 0 <= 255) { - b = ((a & -8) + 11804) | 0; - c = F[2941]; - a = 1 << (a >>> 3); - J: { - if (!(c & a)) { - F[2941] = a | c; - a = b; - break J; - } - a = F[(b + 8) >> 2]; - } - F[(b + 8) >> 2] = i; - F[(a + 12) >> 2] = i; - F[(i + 12) >> 2] = b; - F[(i + 8) >> 2] = a; - break A; - } - f = 31; - if (a >>> 0 <= 16777215) { - b = O((a >>> 8) | 0); - f = - (((((a >>> (38 - b)) & 1) - (b << 1)) | - 0) + - 62) | - 0; - } - F[(i + 28) >> 2] = f; - F[(i + 16) >> 2] = 0; - F[(i + 20) >> 2] = 0; - b = ((f << 2) + 12068) | 0; - d = F[2942]; - c = 1 << f; - K: { - if (!(d & c)) { - F[2942] = c | d; - F[b >> 2] = i; - break K; - } - f = - a << - ((f | 0) != 31 - ? (25 - ((f >>> 1) | 0)) | 0 - : 0); - c = F[b >> 2]; - while (1) { - b = c; - if ((F[(c + 4) >> 2] & -8) == (a | 0)) { - break B; - } - c = (f >>> 29) | 0; - f = f << 1; - d = ((c & 4) + b) | 0; - c = F[(d + 16) >> 2]; - if (c) { - continue; - } - break; - } - F[(d + 16) >> 2] = i; - } - F[(i + 24) >> 2] = b; - F[(i + 12) >> 2] = i; - F[(i + 8) >> 2] = i; - break A; - } - d = (g - 40) | 0; - a = (c + 8) & 7 ? (-8 - c) & 7 : 0; - b = (d - a) | 0; - F[2944] = b; - a = (a + c) | 0; - F[2947] = a; - F[(a + 4) >> 2] = b | 1; - F[(((c + d) | 0) + 4) >> 2] = 40; - F[2948] = F[3063]; - a = - (((f + ((f - 39) & 7 ? (39 - f) & 7 : 0)) | - 0) - - 47) | - 0; - d = a >>> 0 < (e + 16) >>> 0 ? e : a; - F[(d + 4) >> 2] = 27; - a = F[3056]; - F[(d + 16) >> 2] = F[3055]; - F[(d + 20) >> 2] = a; - a = F[3054]; - F[(d + 8) >> 2] = F[3053]; - F[(d + 12) >> 2] = a; - F[3055] = d + 8; - F[3054] = g; - F[3053] = c; - F[3056] = 0; - a = (d + 24) | 0; - while (1) { - F[(a + 4) >> 2] = 7; - b = (a + 8) | 0; - a = (a + 4) | 0; - if (b >>> 0 < f >>> 0) { - continue; - } - break; - } - if ((d | 0) == (e | 0)) { - break e; - } - F[(d + 4) >> 2] = F[(d + 4) >> 2] & -2; - f = (d - e) | 0; - F[(e + 4) >> 2] = f | 1; - F[d >> 2] = f; - if (f >>> 0 <= 255) { - b = ((f & -8) + 11804) | 0; - c = F[2941]; - a = 1 << (f >>> 3); - L: { - if (!(c & a)) { - F[2941] = a | c; - a = b; - break L; - } - a = F[(b + 8) >> 2]; - } - F[(b + 8) >> 2] = e; - F[(a + 12) >> 2] = e; - F[(e + 12) >> 2] = b; - F[(e + 8) >> 2] = a; - break e; - } - a = 31; - if (f >>> 0 <= 16777215) { - a = O((f >>> 8) | 0); - a = - (((((f >>> (38 - a)) & 1) - (a << 1)) | 0) + - 62) | - 0; - } - F[(e + 28) >> 2] = a; - F[(e + 16) >> 2] = 0; - F[(e + 20) >> 2] = 0; - b = ((a << 2) + 12068) | 0; - d = F[2942]; - c = 1 << a; - M: { - if (!(d & c)) { - F[2942] = c | d; - F[b >> 2] = e; - break M; - } - a = - f << - ((a | 0) != 31 - ? (25 - ((a >>> 1) | 0)) | 0 - : 0); - d = F[b >> 2]; - while (1) { - b = d; - if ((f | 0) == (F[(b + 4) >> 2] & -8)) { - break z; - } - c = (a >>> 29) | 0; - a = a << 1; - c = ((c & 4) + b) | 0; - d = F[(c + 16) >> 2]; - if (d) { - continue; - } - break; - } - F[(c + 16) >> 2] = e; - } - F[(e + 24) >> 2] = b; - F[(e + 12) >> 2] = e; - F[(e + 8) >> 2] = e; - break e; - } - a = F[(b + 8) >> 2]; - F[(a + 12) >> 2] = i; - F[(b + 8) >> 2] = i; - F[(i + 24) >> 2] = 0; - F[(i + 12) >> 2] = b; - F[(i + 8) >> 2] = a; - } - a = (j + 8) | 0; - break a; - } - a = F[(b + 8) >> 2]; - F[(a + 12) >> 2] = e; - F[(b + 8) >> 2] = e; - F[(e + 24) >> 2] = 0; - F[(e + 12) >> 2] = b; - F[(e + 8) >> 2] = a; - } - a = F[2944]; - if (a >>> 0 <= h >>> 0) { - break d; - } - b = (a - h) | 0; - F[2944] = b; - c = F[2947]; - a = (c + h) | 0; - F[2947] = a; - F[(a + 4) >> 2] = b | 1; - F[(c + 4) >> 2] = h | 3; - a = (c + 8) | 0; - break a; - } - F[2940] = 48; - a = 0; - break a; - } - N: { - if (!g) { - break N; - } - b = F[(d + 28) >> 2]; - a = ((b << 2) + 12068) | 0; - O: { - if (F[a >> 2] == (d | 0)) { - F[a >> 2] = c; - if (c) { - break O; - } - j = oi(b) & j; - F[2942] = j; - break N; - } - F[(g + (F[(g + 16) >> 2] == (d | 0) ? 16 : 20)) >> 2] = - c; - if (!c) { - break N; - } - } - F[(c + 24) >> 2] = g; - a = F[(d + 16) >> 2]; - if (a) { - F[(c + 16) >> 2] = a; - F[(a + 24) >> 2] = c; - } - a = F[(d + 20) >> 2]; - if (!a) { - break N; - } - F[(c + 20) >> 2] = a; - F[(a + 24) >> 2] = c; - } - P: { - if (f >>> 0 <= 15) { - a = (f + h) | 0; - F[(d + 4) >> 2] = a | 3; - a = (a + d) | 0; - F[(a + 4) >> 2] = F[(a + 4) >> 2] | 1; - break P; - } - F[(d + 4) >> 2] = h | 3; - e = (d + h) | 0; - F[(e + 4) >> 2] = f | 1; - F[(e + f) >> 2] = f; - if (f >>> 0 <= 255) { - b = ((f & -8) + 11804) | 0; - c = F[2941]; - a = 1 << (f >>> 3); - Q: { - if (!(c & a)) { - F[2941] = a | c; - a = b; - break Q; - } - a = F[(b + 8) >> 2]; - } - F[(b + 8) >> 2] = e; - F[(a + 12) >> 2] = e; - F[(e + 12) >> 2] = b; - F[(e + 8) >> 2] = a; - break P; - } - a = 31; - if (f >>> 0 <= 16777215) { - a = O((f >>> 8) | 0); - a = - (((((f >>> (38 - a)) & 1) - (a << 1)) | 0) + 62) | 0; - } - F[(e + 28) >> 2] = a; - F[(e + 16) >> 2] = 0; - F[(e + 20) >> 2] = 0; - b = ((a << 2) + 12068) | 0; - R: { - c = 1 << a; - S: { - if (!(c & j)) { - F[2942] = c | j; - F[b >> 2] = e; - break S; - } - a = - f << - ((a | 0) != 31 ? (25 - ((a >>> 1) | 0)) | 0 : 0); - h = F[b >> 2]; - while (1) { - b = h; - if ((F[(b + 4) >> 2] & -8) == (f | 0)) { - break R; - } - c = (a >>> 29) | 0; - a = a << 1; - c = ((c & 4) + b) | 0; - h = F[(c + 16) >> 2]; - if (h) { - continue; - } - break; - } - F[(c + 16) >> 2] = e; - } - F[(e + 24) >> 2] = b; - F[(e + 12) >> 2] = e; - F[(e + 8) >> 2] = e; - break P; - } - a = F[(b + 8) >> 2]; - F[(a + 12) >> 2] = e; - F[(b + 8) >> 2] = e; - F[(e + 24) >> 2] = 0; - F[(e + 12) >> 2] = b; - F[(e + 8) >> 2] = a; - } - a = (d + 8) | 0; - break a; - } - T: { - if (!i) { - break T; - } - b = F[(c + 28) >> 2]; - a = ((b << 2) + 12068) | 0; - U: { - if (F[a >> 2] == (c | 0)) { - F[a >> 2] = d; - if (d) { - break U; - } - (m = 11768), (n = oi(b) & j), (F[m >> 2] = n); - break T; - } - F[(i + (F[(i + 16) >> 2] == (c | 0) ? 16 : 20)) >> 2] = d; - if (!d) { - break T; - } - } - F[(d + 24) >> 2] = i; - a = F[(c + 16) >> 2]; - if (a) { - F[(d + 16) >> 2] = a; - F[(a + 24) >> 2] = d; - } - a = F[(c + 20) >> 2]; - if (!a) { - break T; - } - F[(d + 20) >> 2] = a; - F[(a + 24) >> 2] = d; - } - V: { - if (f >>> 0 <= 15) { - a = (f + h) | 0; - F[(c + 4) >> 2] = a | 3; - a = (a + c) | 0; - F[(a + 4) >> 2] = F[(a + 4) >> 2] | 1; - break V; - } - F[(c + 4) >> 2] = h | 3; - d = (c + h) | 0; - F[(d + 4) >> 2] = f | 1; - F[(d + f) >> 2] = f; - if (k) { - b = ((k & -8) + 11804) | 0; - e = F[2946]; - a = 1 << (k >>> 3); - W: { - if (!(a & g)) { - F[2941] = a | g; - a = b; - break W; - } - a = F[(b + 8) >> 2]; - } - F[(b + 8) >> 2] = e; - F[(a + 12) >> 2] = e; - F[(e + 12) >> 2] = b; - F[(e + 8) >> 2] = a; - } - F[2946] = d; - F[2943] = f; - } - a = (c + 8) | 0; - } - Z = (l + 16) | 0; - return a | 0; - } - function Vc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0; - m = (Z - 32) | 0; - Z = m; - o = ka(12); - F[(o + 8) >> 2] = 0; - F[(o + 4) >> 2] = b; - F[o >> 2] = 0; - s = (o + 12) | 0; - b = s; - a: { - b: { - c: { - while (1) { - b = (b - 12) | 0; - w = F[(b + 8) >> 2]; - j = F[(b + 4) >> 2]; - t = F[b >> 2]; - if (t) { - if ((w | 0) > 1e3) { - break a; - } - F[(m + 24) >> 2] = 0; - F[(m + 16) >> 2] = 0; - F[(m + 20) >> 2] = 0; - d = 1; - c = F[a >> 2]; - e = F[(c + 8) >> 2]; - h = F[(c + 12) >> 2]; - g = F[(c + 20) >> 2]; - f = F[(c + 16) >> 2]; - d: { - if ( - (((h | 0) <= (g | 0)) & (f >>> 0 >= e >>> 0)) | - ((g | 0) > (h | 0)) - ) { - break d; - } - e = G[(f + F[c >> 2]) | 0]; - h = c; - c = g; - f = (f + 1) | 0; - c = f ? c : (c + 1) | 0; - F[(h + 16) >> 2] = f; - F[(h + 20) >> 2] = c; - Sb((m + 16) | 0, e); - if (e) { - c = F[a >> 2]; - n = Tb((m + 16) | 0); - p = F[(c + 8) >> 2]; - g = F[(c + 12) >> 2]; - h = F[(c + 20) >> 2]; - f = F[(c + 16) >> 2]; - k = (f + e) | 0; - h = k >>> 0 < e >>> 0 ? (h + 1) | 0 : h; - if ( - (((g | 0) <= (h | 0)) & (k >>> 0 > p >>> 0)) | - ((g | 0) < (h | 0)) - ) { - break d; - } - la(n, (f + F[c >> 2]) | 0, e); - d = F[(c + 20) >> 2]; - f = e; - e = (e + F[(c + 16) >> 2]) | 0; - d = f >>> 0 > e >>> 0 ? (d + 1) | 0 : d; - F[(c + 16) >> 2] = e; - F[(c + 20) >> 2] = d; - } - j = ka(24); - c = j; - F[(c + 4) >> 2] = 0; - F[(c + 8) >> 2] = 0; - c = (c + 16) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - F[j >> 2] = j + 4; - F[(j + 12) >> 2] = c; - e = (Z - 32) | 0; - Z = e; - h = (t + 12) | 0; - c = (m + 16) | 0; - u = Ya(h, c); - i = (t + 16) | 0; - e: { - if ((u | 0) == (i | 0)) { - F[(e + 16) >> 2] = c; - f: { - g: { - d = F[(h + 4) >> 2]; - h: { - if (!d) { - f = (h + 4) | 0; - c = f; - break h; - } - f = G[(c + 11) | 0]; - g = (f << 24) >> 24 < 0; - n = g ? F[c >> 2] : c; - g = g ? F[(c + 4) >> 2] : f; - while (1) { - c = d; - d = G[(c + 27) | 0]; - f = (d << 24) >> 24 < 0; - d = f ? F[(c + 20) >> 2] : d; - p = d >>> 0 < g >>> 0; - i: { - j: { - k: { - l: { - k = p ? d : g; - m: { - if (k) { - f = f - ? F[(c + 16) >> 2] - : (c + 16) | 0; - q = sa(n, f, k); - if (!q) { - if (d >>> 0 > g >>> 0) { - break m; - } - break l; - } - if ((q | 0) >= 0) { - break l; - } - break m; - } - if (d >>> 0 <= g >>> 0) { - break k; - } - } - f = c; - d = F[c >> 2]; - if (d) { - continue; - } - break h; - } - d = sa(f, n, k); - if (d) { - break j; - } - } - if (p) { - break i; - } - break g; - } - if ((d | 0) >= 0) { - break g; - } - } - d = F[(c + 4) >> 2]; - if (d) { - continue; - } - break; - } - f = (c + 4) | 0; - } - d = ka(32); - n = (d + 16) | 0; - g = F[(e + 16) >> 2]; - n: { - if (D[(g + 11) | 0] >= 0) { - p = F[(g + 4) >> 2]; - F[n >> 2] = F[g >> 2]; - F[(n + 4) >> 2] = p; - F[(n + 8) >> 2] = F[(g + 8) >> 2]; - break n; - } - ra(n, F[g >> 2], F[(g + 4) >> 2]); - } - F[(d + 8) >> 2] = c; - F[d >> 2] = 0; - F[(d + 4) >> 2] = 0; - F[(d + 28) >> 2] = 0; - F[f >> 2] = d; - c = d; - g = F[F[h >> 2] >> 2]; - if (g) { - F[h >> 2] = g; - c = F[f >> 2]; - } - nb(F[(h + 4) >> 2], c); - F[(h + 8) >> 2] = F[(h + 8) >> 2] + 1; - c = 1; - break f; - } - d = c; - c = 0; - } - D[(e + 28) | 0] = c; - F[(e + 24) >> 2] = d; - d = F[(e + 24) >> 2]; - c = F[(d + 28) >> 2]; - F[(d + 28) >> 2] = j; - if (!c) { - break e; - } - Ca((c + 12) | 0, F[(c + 16) >> 2]); - Ba(c, F[(c + 4) >> 2]); - ja(c); - break e; - } - if (!j) { - break e; - } - Ca((j + 12) | 0, F[(j + 16) >> 2]); - Ba(j, F[(j + 4) >> 2]); - ja(j); - } - Z = (e + 32) | 0; - d = (i | 0) != (u | 0); - } - if (D[(m + 27) | 0] < 0) { - ja(F[(m + 16) >> 2]); - } - if (d) { - break a; - } - } - if (!j) { - break a; - } - F[(m + 16) >> 2] = 0; - if (!fb(1, (m + 16) | 0, F[a >> 2])) { - break a; - } - q = 0; - x = F[(m + 16) >> 2]; - if (x) { - while (1) { - d = 0; - i = (Z - 32) | 0; - Z = i; - F[(i + 24) >> 2] = 0; - F[(i + 16) >> 2] = 0; - F[(i + 20) >> 2] = 0; - c = F[a >> 2]; - f = F[(c + 8) >> 2]; - o: { - p: { - h = F[(c + 12) >> 2]; - g = F[(c + 20) >> 2]; - e = F[(c + 16) >> 2]; - q: { - if ( - (((h | 0) <= (g | 0)) & - (e >>> 0 >= f >>> 0)) | - ((g | 0) > (h | 0)) - ) { - break q; - } - f = G[(e + F[c >> 2]) | 0]; - h = c; - c = g; - e = (e + 1) | 0; - c = e ? c : (c + 1) | 0; - F[(h + 16) >> 2] = e; - F[(h + 20) >> 2] = c; - Sb((i + 16) | 0, f); - if (f) { - e = F[a >> 2]; - n = Tb((i + 16) | 0); - p = F[(e + 8) >> 2]; - g = F[(e + 12) >> 2]; - c = F[(e + 20) >> 2]; - h = F[(e + 16) >> 2]; - k = (h + f) | 0; - c = k >>> 0 < f >>> 0 ? (c + 1) | 0 : c; - if ( - ((k >>> 0 > p >>> 0) & - ((c | 0) >= (g | 0))) | - ((c | 0) > (g | 0)) - ) { - break q; - } - la(n, (h + F[e >> 2]) | 0, f); - c = F[(e + 20) >> 2]; - g = f; - f = (f + F[(e + 16) >> 2]) | 0; - c = g >>> 0 > f >>> 0 ? (c + 1) | 0 : c; - F[(e + 16) >> 2] = f; - F[(e + 20) >> 2] = c; - } - F[(i + 12) >> 2] = 0; - if (!fb(1, (i + 12) | 0, F[a >> 2])) { - break q; - } - f = F[(i + 12) >> 2]; - if (!f) { - break q; - } - e = F[a >> 2]; - c = F[(e + 8) >> 2]; - h = F[(e + 16) >> 2]; - g = (c - h) | 0; - c = - (F[(e + 12) >> 2] - - ((F[(e + 20) >> 2] + - (c >>> 0 < h >>> 0)) | - 0)) | - 0; - if ( - (((c | 0) <= 0) & (f >>> 0 > g >>> 0)) | - ((c | 0) < 0) - ) { - break q; - } - F[(i + 8) >> 2] = 0; - F[i >> 2] = 0; - F[(i + 4) >> 2] = 0; - if ((f | 0) < 0) { - break p; - } - d = ka(f); - F[i >> 2] = d; - c = (d + f) | 0; - F[(i + 8) >> 2] = c; - l = ma(d, 0, f); - F[(i + 4) >> 2] = c; - h = F[(e + 12) >> 2]; - y = h; - p = F[(e + 8) >> 2]; - c = F[(e + 20) >> 2]; - k = F[(e + 16) >> 2]; - g = (f + k) | 0; - c = g >>> 0 < f >>> 0 ? (c + 1) | 0 : c; - u = g; - n = c; - r: { - if ( - (((c | 0) <= (h | 0)) & - (g >>> 0 <= p >>> 0)) | - ((c | 0) < (h | 0)) - ) { - la(l, (F[e >> 2] + k) | 0, f); - d = F[(e + 20) >> 2]; - c = (f + F[(e + 16) >> 2]) | 0; - d = c >>> 0 < f >>> 0 ? (d + 1) | 0 : d; - F[(e + 16) >> 2] = c; - F[(e + 20) >> 2] = d; - h = (Z - 48) | 0; - Z = h; - e = Ya(j, (i + 16) | 0); - if ((e | 0) != ((j + 4) | 0)) { - c = F[(e + 4) >> 2]; - s: { - if (!c) { - c = e; - while (1) { - d = F[(c + 8) >> 2]; - f = F[d >> 2] != (c | 0); - c = d; - if (f) { - continue; - } - break; - } - break s; - } - while (1) { - d = c; - c = F[c >> 2]; - if (c) { - continue; - } - break; - } - } - if ((e | 0) == F[j >> 2]) { - F[j >> 2] = d; - } - F[(j + 8) >> 2] = F[(j + 8) >> 2] - 1; - f = F[(j + 4) >> 2]; - t: { - u: { - g = e; - d = e; - e = F[d >> 2]; - if (e) { - c = F[(g + 4) >> 2]; - if (!c) { - break u; - } - while (1) { - d = c; - c = F[c >> 2]; - if (c) { - continue; - } - break; - } - } - e = F[(d + 4) >> 2]; - if (e) { - break u; - } - e = 0; - k = 1; - break t; - } - F[(e + 8) >> 2] = F[(d + 8) >> 2]; - k = 0; - } - l = F[(d + 8) >> 2]; - c = F[l >> 2]; - v: { - if ((d | 0) == (c | 0)) { - F[l >> 2] = e; - if ((d | 0) == (f | 0)) { - c = 0; - f = e; - break v; - } - c = F[(l + 4) >> 2]; - break v; - } - F[(l + 4) >> 2] = e; - } - r = !G[(d + 12) | 0]; - if ((d | 0) != (g | 0)) { - l = F[(g + 8) >> 2]; - F[(d + 8) >> 2] = l; - F[ - (l + - (((g | 0) != - F[F[(g + 8) >> 2] >> 2]) << - 2)) >> - 2 - ] = d; - l = F[g >> 2]; - F[d >> 2] = l; - F[(l + 8) >> 2] = d; - l = F[(g + 4) >> 2]; - F[(d + 4) >> 2] = l; - if (l) { - F[(l + 8) >> 2] = d; - } - D[(d + 12) | 0] = G[(g + 12) | 0]; - f = (f | 0) == (g | 0) ? d : f; - } - w: { - if (r | !f) { - break w; - } - if (k) { - while (1) { - e = G[(c + 12) | 0]; - x: { - d = F[(c + 8) >> 2]; - if (F[d >> 2] != (c | 0)) { - if (!e) { - D[(c + 12) | 0] = 1; - D[(d + 12) | 0] = 0; - e = F[(d + 4) >> 2]; - k = F[e >> 2]; - F[(d + 4) >> 2] = k; - if (k) { - F[(k + 8) >> 2] = d; - } - F[(e + 8) >> 2] = - F[(d + 8) >> 2]; - k = F[(d + 8) >> 2]; - F[ - ((((d | 0) != - F[k >> 2]) << - 2) + - k) >> - 2 - ] = e; - F[e >> 2] = d; - F[(d + 8) >> 2] = e; - d = c; - c = F[c >> 2]; - f = - (c | 0) == (f | 0) - ? d - : f; - c = F[(c + 4) >> 2]; - } - y: { - z: { - d = F[c >> 2]; - A: { - if ( - !(G[(d + 12) | 0] - ? 0 - : d) - ) { - e = F[(c + 4) >> 2]; - if ( - G[(e + 12) | 0] - ? 0 - : e - ) { - break A; - } - D[(c + 12) | 0] = 0; - c = F[(c + 8) >> 2]; - B: { - if ( - (f | 0) == - (c | 0) - ) { - c = f; - break B; - } - if ( - G[(c + 12) | 0] - ) { - break x; - } - } - D[(c + 12) | 0] = 1; - break w; - } - e = F[(c + 4) >> 2]; - if (!e) { - break z; - } - } - if (G[(e + 12) | 0]) { - break z; - } - d = c; - break y; - } - D[(d + 12) | 0] = 1; - D[(c + 12) | 0] = 0; - e = F[(d + 4) >> 2]; - F[c >> 2] = e; - if (e) { - F[(e + 8) >> 2] = c; - } - F[(d + 8) >> 2] = - F[(c + 8) >> 2]; - e = F[(c + 8) >> 2]; - F[ - (((F[e >> 2] != - (c | 0)) << - 2) + - e) >> - 2 - ] = d; - F[(d + 4) >> 2] = c; - F[(c + 8) >> 2] = d; - e = c; - } - c = F[(d + 8) >> 2]; - D[(d + 12) | 0] = - G[(c + 12) | 0]; - D[(c + 12) | 0] = 1; - D[(e + 12) | 0] = 1; - d = F[(c + 4) >> 2]; - e = F[d >> 2]; - F[(c + 4) >> 2] = e; - if (e) { - F[(e + 8) >> 2] = c; - } - F[(d + 8) >> 2] = - F[(c + 8) >> 2]; - e = F[(c + 8) >> 2]; - F[ - ((((c | 0) != F[e >> 2]) << - 2) + - e) >> - 2 - ] = d; - F[d >> 2] = c; - F[(c + 8) >> 2] = d; - break w; - } - if (!e) { - D[(c + 12) | 0] = 1; - D[(d + 12) | 0] = 0; - e = F[(c + 4) >> 2]; - F[d >> 2] = e; - if (e) { - F[(e + 8) >> 2] = d; - } - F[(c + 8) >> 2] = - F[(d + 8) >> 2]; - e = F[(d + 8) >> 2]; - F[ - ((((d | 0) != F[e >> 2]) << - 2) + - e) >> - 2 - ] = c; - F[(c + 4) >> 2] = d; - F[(d + 8) >> 2] = c; - f = - (d | 0) == (f | 0) ? c : f; - c = F[d >> 2]; - } - e = F[c >> 2]; - C: { - if (!(!e | G[(e + 12) | 0])) { - d = c; - break C; - } - d = F[(c + 4) >> 2]; - if ( - !(G[(d + 12) | 0] ? 0 : d) - ) { - D[(c + 12) | 0] = 0; - c = F[(c + 8) >> 2]; - if ( - (c | 0) != (f | 0) - ? G[(c + 12) | 0] - : 0 - ) { - break x; - } - D[(c + 12) | 0] = 1; - break w; - } - if (e) { - if (!G[(e + 12) | 0]) { - d = c; - break C; - } - d = F[(c + 4) >> 2]; - } - D[(d + 12) | 0] = 1; - D[(c + 12) | 0] = 0; - e = F[d >> 2]; - F[(c + 4) >> 2] = e; - if (e) { - F[(e + 8) >> 2] = c; - } - F[(d + 8) >> 2] = - F[(c + 8) >> 2]; - e = F[(c + 8) >> 2]; - F[ - (((F[e >> 2] != (c | 0)) << - 2) + - e) >> - 2 - ] = d; - F[d >> 2] = c; - F[(c + 8) >> 2] = d; - e = c; - } - c = F[(d + 8) >> 2]; - D[(d + 12) | 0] = - G[(c + 12) | 0]; - D[(c + 12) | 0] = 1; - D[(e + 12) | 0] = 1; - d = F[c >> 2]; - e = F[(d + 4) >> 2]; - F[c >> 2] = e; - if (e) { - F[(e + 8) >> 2] = c; - } - F[(d + 8) >> 2] = - F[(c + 8) >> 2]; - e = F[(c + 8) >> 2]; - F[ - ((((c | 0) != F[e >> 2]) << - 2) + - e) >> - 2 - ] = d; - F[(d + 4) >> 2] = c; - F[(c + 8) >> 2] = d; - break w; - } - d = c; - c = F[(c + 8) >> 2]; - c = - F[ - ((((d | 0) == F[c >> 2]) << - 2) + - c) >> - 2 - ]; - } - } - D[(e + 12) | 0] = 1; - } - c = F[(g + 28) >> 2]; - if (c) { - F[(g + 32) >> 2] = c; - ja(c); - } - if (D[(g + 27) | 0] < 0) { - ja(F[(g + 16) >> 2]); - } - ja(g); - } - F[(h + 8) >> 2] = 0; - F[h >> 2] = 0; - F[(h + 4) >> 2] = 0; - c = F[(i + 4) >> 2]; - d = F[i >> 2]; - f = (c - d) | 0; - e = 0; - D: { - E: { - if ((c | 0) != (d | 0)) { - if ((f | 0) < 0) { - break E; - } - e = ka(f); - c = ma(e, 0, f); - g = (c + f) | 0; - F[(h + 8) >> 2] = g; - F[(h + 4) >> 2] = g; - F[h >> 2] = c; - c = d; - } - la(e, c, f); - F: { - if (D[(i + 27) | 0] >= 0) { - F[(h + 24) >> 2] = - F[(i + 24) >> 2]; - c = F[(i + 20) >> 2]; - F[(h + 16) >> 2] = - F[(i + 16) >> 2]; - F[(h + 20) >> 2] = c; - break F; - } - ra( - (h + 16) | 0, - F[(i + 16) >> 2], - F[(i + 20) >> 2], - ); - } - Tc((h + 28) | 0, h); - f = (h + 16) | 0; - c = f; - G: { - H: { - d = F[(j + 4) >> 2]; - I: { - if (!d) { - e = (j + 4) | 0; - c = e; - break I; - } - e = G[(c + 11) | 0]; - g = (e << 24) >> 24 < 0; - k = g ? F[c >> 2] : c; - g = g ? F[(c + 4) >> 2] : e; - while (1) { - c = d; - d = G[(c + 27) | 0]; - e = (d << 24) >> 24 < 0; - d = e ? F[(c + 20) >> 2] : d; - l = d >>> 0 < g >>> 0; - J: { - K: { - L: { - M: { - r = l ? d : g; - N: { - if (r) { - e = e - ? F[ - (c + 16) >> - 2 - ] - : (c + 16) | 0; - z = sa(k, e, r); - if (!z) { - if ( - d >>> 0 > - g >>> 0 - ) { - break N; - } - break M; - } - if ( - (z | 0) >= - 0 - ) { - break M; - } - break N; - } - if ( - d >>> 0 <= - g >>> 0 - ) { - break L; - } - } - e = c; - d = F[c >> 2]; - if (d) { - continue; - } - break I; - } - d = sa(e, k, r); - if (d) { - break K; - } - } - if (l) { - break J; - } - break H; - } - if ((d | 0) >= 0) { - break H; - } - } - d = F[(c + 4) >> 2]; - if (d) { - continue; - } - break; - } - e = (c + 4) | 0; - } - d = ka(40); - F[(d + 24) >> 2] = - F[(f + 8) >> 2]; - g = F[(f + 4) >> 2]; - F[(d + 16) >> 2] = F[f >> 2]; - F[(d + 20) >> 2] = g; - F[f >> 2] = 0; - F[(f + 4) >> 2] = 0; - F[(f + 8) >> 2] = 0; - Tc((d + 28) | 0, (f + 12) | 0); - F[(d + 8) >> 2] = c; - F[d >> 2] = 0; - F[(d + 4) >> 2] = 0; - F[e >> 2] = d; - c = d; - f = F[F[j >> 2] >> 2]; - if (f) { - F[j >> 2] = f; - c = F[e >> 2]; - } - nb(F[(j + 4) >> 2], c); - F[(j + 8) >> 2] = - F[(j + 8) >> 2] + 1; - c = 1; - break G; - } - d = c; - c = 0; - } - D[(h + 44) | 0] = c; - F[(h + 40) >> 2] = d; - c = F[(h + 28) >> 2]; - if (c) { - F[(h + 32) >> 2] = c; - ja(c); - } - if (D[(h + 27) | 0] < 0) { - ja(F[(h + 16) >> 2]); - } - c = F[h >> 2]; - if (c) { - F[(h + 4) >> 2] = c; - ja(c); - } - Z = (h + 48) | 0; - break D; - } - na(); - v(); - } - d = F[i >> 2]; - if (!d) { - break r; - } - } - F[(i + 4) >> 2] = d; - ja(d); - } - d = - (((n | 0) <= (y | 0)) & - (p >>> 0 >= u >>> 0)) | - ((n | 0) < (y | 0)); - } - if (D[(i + 27) | 0] < 0) { - ja(F[(i + 16) >> 2]); - } - Z = (i + 32) | 0; - break o; - } - na(); - v(); - } - if (!d) { - break a; - } - q = (q + 1) | 0; - if ((x | 0) != (q | 0)) { - continue; - } - break; - } - } - F[(m + 12) >> 2] = 0; - if (!fb(1, (m + 12) | 0, F[a >> 2])) { - break a; - } - c = F[a >> 2]; - e = F[(c + 8) >> 2]; - f = F[(c + 16) >> 2]; - h = (e - f) | 0; - d = F[(m + 12) >> 2]; - c = - (F[(c + 12) >> 2] - - ((F[(c + 20) >> 2] + (e >>> 0 < f >>> 0)) | 0)) | - 0; - if ( - ((h >>> 0 < d >>> 0) & ((c | 0) <= 0)) | - ((c | 0) < 0) - ) { - break a; - } - if (d) { - q = 0; - h = (((t | 0) != 0) + w) | 0; - while (1) { - O: { - if (b >>> 0 < s >>> 0) { - F[(b + 8) >> 2] = h; - F[(b + 4) >> 2] = 0; - F[b >> 2] = j; - b = (b + 12) | 0; - d = F[(m + 12) >> 2]; - break O; - } - c = (b - o) | 0; - g = ((c | 0) / 12) | 0; - b = (g + 1) | 0; - if (b >>> 0 >= 357913942) { - break c; - } - e = (((s - o) | 0) / 12) | 0; - f = e << 1; - e = - e >>> 0 >= 178956970 - ? 357913941 - : b >>> 0 < f >>> 0 - ? f - : b; - if (e) { - if (e >>> 0 >= 357913942) { - break b; - } - f = ka(L(e, 12)); - } else { - f = 0; - } - b = (f + L(g, 12)) | 0; - F[(b + 8) >> 2] = h; - F[(b + 4) >> 2] = 0; - F[b >> 2] = j; - c = pa( - (b + L(((c | 0) / -12) | 0, 12)) | 0, - o, - c, - ); - s = (f + L(e, 12)) | 0; - b = (b + 12) | 0; - if (o) { - ja(o); - } - o = c; - } - q = (q + 1) | 0; - if (q >>> 0 < d >>> 0) { - continue; - } - break; - } - } - if ((b | 0) != (o | 0)) { - continue; - } - break; - } - A = 1; - break a; - } - na(); - v(); - } - oa(); - v(); - } - if (o) { - ja(o); - } - Z = (m + 32) | 0; - return A; - } - function me(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0; - h = (Z - 48) | 0; - Z = h; - a: { - if ((c | 0) != 1) { - break a; - } - i = F[(a + 4) >> 2]; - c = F[(a + 12) >> 2]; - F[(h + 40) >> 2] = 0; - F[(h + 32) >> 2] = 0; - F[(h + 36) >> 2] = 0; - F[(h + 24) >> 2] = 0; - F[(h + 28) >> 2] = 0; - F[(h + 16) >> 2] = 0; - F[(h + 20) >> 2] = 0; - F[(h + 8) >> 2] = 0; - F[(h + 12) >> 2] = 0; - d = (h + 8) | 0; - b: { - if ((b | 0) == -2) { - break b; - } - k = F[(F[(F[(i + 4) >> 2] + 8) >> 2] + (c << 2)) >> 2]; - if (($[F[(F[i >> 2] + 8) >> 2]](i) | 0) == 1) { - j = (Z - 32) | 0; - Z = j; - l = F[(F[(F[(i + 4) >> 2] + 8) >> 2] + (c << 2)) >> 2]; - c: { - d: { - e: { - if ( - (($[F[(F[i >> 2] + 8) >> 2]](i) | 0) != 1) | - ((b - 1) >>> 0 > 5) - ) { - break e; - } - g = $[F[(F[i >> 2] + 36) >> 2]](i) | 0; - f = $[F[(F[i >> 2] + 44) >> 2]](i, c) | 0; - if (!g | !f) { - break e; - } - c = $[F[(F[i >> 2] + 40) >> 2]](i, c) | 0; - if (c) { - a = F[(i + 44) >> 2]; - F[(j + 12) >> 2] = c; - F[(j + 8) >> 2] = a; - F[(j + 20) >> 2] = f; - F[(j + 16) >> 2] = f + 12; - f = (j + 8) | 0; - a = 0; - f: { - g: { - switch ((b - 1) | 0) { - case 0: - b = ka(60); - F[(b + 4) >> 2] = l; - F[b >> 2] = 2960; - a = F[(d + 4) >> 2]; - F[(b + 8) >> 2] = F[d >> 2]; - F[(b + 12) >> 2] = a; - a = F[(d + 12) >> 2]; - F[(b + 16) >> 2] = F[(d + 8) >> 2]; - F[(b + 20) >> 2] = a; - a = F[(d + 20) >> 2]; - F[(b + 24) >> 2] = F[(d + 16) >> 2]; - F[(b + 28) >> 2] = a; - F[(b + 40) >> 2] = 0; - F[(b + 32) >> 2] = 0; - F[(b + 36) >> 2] = 0; - a = F[(d + 24) >> 2]; - g = F[(d + 28) >> 2]; - if ((a | 0) != (g | 0)) { - c = (g - a) | 0; - if ((c | 0) < 0) { - break d; - } - e = ka(c); - F[(b + 32) >> 2] = e; - F[(b + 40) >> 2] = (c & -4) + e; - while (1) { - F[e >> 2] = F[a >> 2]; - e = (e + 4) | 0; - a = (a + 4) | 0; - if ((g | 0) != (a | 0)) { - continue; - } - break; - } - F[(b + 36) >> 2] = e; - } - a = F[(f + 4) >> 2]; - F[(b + 44) >> 2] = F[f >> 2]; - F[(b + 48) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 52) >> 2] = F[(f + 8) >> 2]; - F[(b + 56) >> 2] = a; - F[b >> 2] = 2252; - a = b; - break f; - case 3: - b = ka(112); - F[(b + 4) >> 2] = l; - F[b >> 2] = 2960; - a = F[(d + 4) >> 2]; - F[(b + 8) >> 2] = F[d >> 2]; - F[(b + 12) >> 2] = a; - a = F[(d + 12) >> 2]; - F[(b + 16) >> 2] = F[(d + 8) >> 2]; - F[(b + 20) >> 2] = a; - a = F[(d + 20) >> 2]; - F[(b + 24) >> 2] = F[(d + 16) >> 2]; - F[(b + 28) >> 2] = a; - F[(b + 40) >> 2] = 0; - F[(b + 32) >> 2] = 0; - F[(b + 36) >> 2] = 0; - a = F[(d + 24) >> 2]; - g = F[(d + 28) >> 2]; - if ((a | 0) != (g | 0)) { - c = (g - a) | 0; - if ((c | 0) < 0) { - break d; - } - e = ka(c); - F[(b + 32) >> 2] = e; - F[(b + 40) >> 2] = (c & -4) + e; - while (1) { - F[e >> 2] = F[a >> 2]; - e = (e + 4) | 0; - a = (a + 4) | 0; - if ((g | 0) != (a | 0)) { - continue; - } - break; - } - F[(b + 36) >> 2] = e; - } - a = F[(f + 4) >> 2]; - F[(b + 44) >> 2] = F[f >> 2]; - F[(b + 48) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 52) >> 2] = F[(f + 8) >> 2]; - F[(b + 56) >> 2] = a; - F[(b + 60) >> 2] = 0; - F[(b + 64) >> 2] = 0; - F[b >> 2] = 3016; - F[(b + 68) >> 2] = 0; - F[(b + 72) >> 2] = 0; - F[(b + 76) >> 2] = 0; - F[(b + 80) >> 2] = 0; - F[(b + 84) >> 2] = 0; - F[(b + 88) >> 2] = 0; - F[(b + 92) >> 2] = 0; - F[(b + 96) >> 2] = 0; - F[(b + 100) >> 2] = 0; - F[(b + 104) >> 2] = 0; - F[(b + 108) >> 2] = 0; - a = b; - break f; - case 4: - b = ka(104); - F[(b + 4) >> 2] = l; - F[b >> 2] = 2960; - a = F[(d + 4) >> 2]; - F[(b + 8) >> 2] = F[d >> 2]; - F[(b + 12) >> 2] = a; - a = F[(d + 12) >> 2]; - F[(b + 16) >> 2] = F[(d + 8) >> 2]; - F[(b + 20) >> 2] = a; - a = F[(d + 20) >> 2]; - F[(b + 24) >> 2] = F[(d + 16) >> 2]; - F[(b + 28) >> 2] = a; - F[(b + 40) >> 2] = 0; - F[(b + 32) >> 2] = 0; - F[(b + 36) >> 2] = 0; - a = F[(d + 24) >> 2]; - g = F[(d + 28) >> 2]; - if ((a | 0) != (g | 0)) { - c = (g - a) | 0; - if ((c | 0) < 0) { - break d; - } - e = ka(c); - F[(b + 32) >> 2] = e; - F[(b + 40) >> 2] = (c & -4) + e; - while (1) { - F[e >> 2] = F[a >> 2]; - e = (e + 4) | 0; - a = (a + 4) | 0; - if ((g | 0) != (a | 0)) { - continue; - } - break; - } - F[(b + 36) >> 2] = e; - } - a = F[(f + 4) >> 2]; - F[(b + 44) >> 2] = F[f >> 2]; - F[(b + 48) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 52) >> 2] = F[(f + 8) >> 2]; - F[(b + 56) >> 2] = a; - F[(b + 84) >> 2] = 0; - F[(b + 76) >> 2] = 0; - F[(b + 80) >> 2] = 0; - F[(b + 60) >> 2] = 0; - F[(b + 64) >> 2] = 0; - F[b >> 2] = 3264; - a = F[(f + 4) >> 2]; - F[(b + 88) >> 2] = F[f >> 2]; - F[(b + 92) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 96) >> 2] = F[(f + 8) >> 2]; - F[(b + 100) >> 2] = a; - a = b; - break f; - case 5: - break g; - default: - break f; - } - } - a = ka(128); - F[(a + 4) >> 2] = l; - F[a >> 2] = 2960; - b = F[(d + 4) >> 2]; - F[(a + 8) >> 2] = F[d >> 2]; - F[(a + 12) >> 2] = b; - b = F[(d + 12) >> 2]; - F[(a + 16) >> 2] = F[(d + 8) >> 2]; - F[(a + 20) >> 2] = b; - b = F[(d + 20) >> 2]; - F[(a + 24) >> 2] = F[(d + 16) >> 2]; - F[(a + 28) >> 2] = b; - F[(a + 40) >> 2] = 0; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - h: { - i: { - c = F[(d + 28) >> 2]; - b = F[(d + 24) >> 2]; - if ((c | 0) != (b | 0)) { - c = (c - b) | 0; - if ((c | 0) < 0) { - break i; - } - b = ka(c); - F[(a + 36) >> 2] = b; - F[(a + 32) >> 2] = b; - F[(a + 40) >> 2] = (c & -4) + b; - e = F[(d + 24) >> 2]; - c = F[(d + 28) >> 2]; - if ((e | 0) != (c | 0)) { - while (1) { - F[b >> 2] = F[e >> 2]; - b = (b + 4) | 0; - e = (e + 4) | 0; - if ((c | 0) != (e | 0)) { - continue; - } - break; - } - } - F[(a + 36) >> 2] = b; - } - F[a >> 2] = 2904; - b = F[(f + 4) >> 2]; - F[(a + 44) >> 2] = F[f >> 2]; - F[(a + 48) >> 2] = b; - b = F[(f + 12) >> 2]; - F[(a + 52) >> 2] = F[(f + 8) >> 2]; - F[(a + 56) >> 2] = b; - b = (a - -64) | 0; - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - F[(a + 60) >> 2] = 4128; - F[a >> 2] = 3500; - b = F[(f + 4) >> 2]; - F[(a + 72) >> 2] = F[f >> 2]; - F[(a + 76) >> 2] = b; - b = F[(f + 12) >> 2]; - F[(a + 80) >> 2] = F[(f + 8) >> 2]; - F[(a + 84) >> 2] = b; - F[(a + 104) >> 2] = 1065353216; - F[(a + 108) >> 2] = -1; - F[(a + 96) >> 2] = -1; - F[(a + 100) >> 2] = -1; - F[(a + 88) >> 2] = 1; - F[(a + 92) >> 2] = -1; - F[(a + 60) >> 2] = 3736; - F[(a + 112) >> 2] = 0; - F[(a + 116) >> 2] = 0; - D[(a + 117) | 0] = 0; - D[(a + 118) | 0] = 0; - D[(a + 119) | 0] = 0; - D[(a + 120) | 0] = 0; - D[(a + 121) | 0] = 0; - D[(a + 122) | 0] = 0; - D[(a + 123) | 0] = 0; - D[(a + 124) | 0] = 0; - break h; - } - na(); - v(); - } - break f; - } - e = a; - break e; - } - a = F[(i + 44) >> 2]; - F[(j + 12) >> 2] = g; - F[(j + 8) >> 2] = a; - F[(j + 20) >> 2] = f; - F[(j + 16) >> 2] = f + 12; - f = (j + 8) | 0; - a = 0; - j: { - k: { - switch ((b - 1) | 0) { - case 0: - b = ka(60); - F[(b + 4) >> 2] = l; - F[b >> 2] = 2960; - a = F[(d + 4) >> 2]; - F[(b + 8) >> 2] = F[d >> 2]; - F[(b + 12) >> 2] = a; - a = F[(d + 12) >> 2]; - F[(b + 16) >> 2] = F[(d + 8) >> 2]; - F[(b + 20) >> 2] = a; - a = F[(d + 20) >> 2]; - F[(b + 24) >> 2] = F[(d + 16) >> 2]; - F[(b + 28) >> 2] = a; - F[(b + 40) >> 2] = 0; - F[(b + 32) >> 2] = 0; - F[(b + 36) >> 2] = 0; - a = F[(d + 24) >> 2]; - g = F[(d + 28) >> 2]; - if ((a | 0) != (g | 0)) { - c = (g - a) | 0; - if ((c | 0) < 0) { - break d; - } - e = ka(c); - F[(b + 32) >> 2] = e; - F[(b + 40) >> 2] = (c & -4) + e; - while (1) { - F[e >> 2] = F[a >> 2]; - e = (e + 4) | 0; - a = (a + 4) | 0; - if ((g | 0) != (a | 0)) { - continue; - } - break; - } - F[(b + 36) >> 2] = e; - } - a = F[(f + 4) >> 2]; - F[(b + 44) >> 2] = F[f >> 2]; - F[(b + 48) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 52) >> 2] = F[(f + 8) >> 2]; - F[(b + 56) >> 2] = a; - F[b >> 2] = 4156; - a = b; - break j; - case 3: - b = ka(112); - F[(b + 4) >> 2] = l; - F[b >> 2] = 2960; - a = F[(d + 4) >> 2]; - F[(b + 8) >> 2] = F[d >> 2]; - F[(b + 12) >> 2] = a; - a = F[(d + 12) >> 2]; - F[(b + 16) >> 2] = F[(d + 8) >> 2]; - F[(b + 20) >> 2] = a; - a = F[(d + 20) >> 2]; - F[(b + 24) >> 2] = F[(d + 16) >> 2]; - F[(b + 28) >> 2] = a; - F[(b + 40) >> 2] = 0; - F[(b + 32) >> 2] = 0; - F[(b + 36) >> 2] = 0; - a = F[(d + 24) >> 2]; - g = F[(d + 28) >> 2]; - if ((a | 0) != (g | 0)) { - c = (g - a) | 0; - if ((c | 0) < 0) { - break d; - } - e = ka(c); - F[(b + 32) >> 2] = e; - F[(b + 40) >> 2] = (c & -4) + e; - while (1) { - F[e >> 2] = F[a >> 2]; - e = (e + 4) | 0; - a = (a + 4) | 0; - if ((g | 0) != (a | 0)) { - continue; - } - break; - } - F[(b + 36) >> 2] = e; - } - a = F[(f + 4) >> 2]; - F[(b + 44) >> 2] = F[f >> 2]; - F[(b + 48) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 52) >> 2] = F[(f + 8) >> 2]; - F[(b + 56) >> 2] = a; - F[(b + 60) >> 2] = 0; - F[(b + 64) >> 2] = 0; - F[b >> 2] = 4580; - F[(b + 68) >> 2] = 0; - F[(b + 72) >> 2] = 0; - F[(b + 76) >> 2] = 0; - F[(b + 80) >> 2] = 0; - F[(b + 84) >> 2] = 0; - F[(b + 88) >> 2] = 0; - F[(b + 92) >> 2] = 0; - F[(b + 96) >> 2] = 0; - F[(b + 100) >> 2] = 0; - F[(b + 104) >> 2] = 0; - F[(b + 108) >> 2] = 0; - a = b; - break j; - case 4: - b = ka(104); - F[(b + 4) >> 2] = l; - F[b >> 2] = 2960; - a = F[(d + 4) >> 2]; - F[(b + 8) >> 2] = F[d >> 2]; - F[(b + 12) >> 2] = a; - a = F[(d + 12) >> 2]; - F[(b + 16) >> 2] = F[(d + 8) >> 2]; - F[(b + 20) >> 2] = a; - a = F[(d + 20) >> 2]; - F[(b + 24) >> 2] = F[(d + 16) >> 2]; - F[(b + 28) >> 2] = a; - F[(b + 40) >> 2] = 0; - F[(b + 32) >> 2] = 0; - F[(b + 36) >> 2] = 0; - a = F[(d + 24) >> 2]; - g = F[(d + 28) >> 2]; - if ((a | 0) != (g | 0)) { - c = (g - a) | 0; - if ((c | 0) < 0) { - break d; - } - e = ka(c); - F[(b + 32) >> 2] = e; - F[(b + 40) >> 2] = (c & -4) + e; - while (1) { - F[e >> 2] = F[a >> 2]; - e = (e + 4) | 0; - a = (a + 4) | 0; - if ((g | 0) != (a | 0)) { - continue; - } - break; - } - F[(b + 36) >> 2] = e; - } - a = F[(f + 4) >> 2]; - F[(b + 44) >> 2] = F[f >> 2]; - F[(b + 48) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 52) >> 2] = F[(f + 8) >> 2]; - F[(b + 56) >> 2] = a; - F[(b + 84) >> 2] = 0; - F[(b + 76) >> 2] = 0; - F[(b + 80) >> 2] = 0; - F[(b + 60) >> 2] = 0; - F[(b + 64) >> 2] = 0; - F[b >> 2] = 4816; - a = F[(f + 4) >> 2]; - F[(b + 88) >> 2] = F[f >> 2]; - F[(b + 92) >> 2] = a; - a = F[(f + 12) >> 2]; - F[(b + 96) >> 2] = F[(f + 8) >> 2]; - F[(b + 100) >> 2] = a; - a = b; - break j; - case 5: - break k; - default: - break j; - } - } - a = ka(128); - F[(a + 4) >> 2] = l; - F[a >> 2] = 2960; - b = F[(d + 4) >> 2]; - F[(a + 8) >> 2] = F[d >> 2]; - F[(a + 12) >> 2] = b; - b = F[(d + 12) >> 2]; - F[(a + 16) >> 2] = F[(d + 8) >> 2]; - F[(a + 20) >> 2] = b; - b = F[(d + 20) >> 2]; - F[(a + 24) >> 2] = F[(d + 16) >> 2]; - F[(a + 28) >> 2] = b; - F[(a + 40) >> 2] = 0; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - l: { - m: { - c = F[(d + 28) >> 2]; - b = F[(d + 24) >> 2]; - if ((c | 0) != (b | 0)) { - c = (c - b) | 0; - if ((c | 0) < 0) { - break m; - } - b = ka(c); - F[(a + 36) >> 2] = b; - F[(a + 32) >> 2] = b; - F[(a + 40) >> 2] = (c & -4) + b; - e = F[(d + 24) >> 2]; - c = F[(d + 28) >> 2]; - if ((e | 0) != (c | 0)) { - while (1) { - F[b >> 2] = F[e >> 2]; - b = (b + 4) | 0; - e = (e + 4) | 0; - if ((c | 0) != (e | 0)) { - continue; - } - break; - } - } - F[(a + 36) >> 2] = b; - } - F[a >> 2] = 4524; - b = F[(f + 4) >> 2]; - F[(a + 44) >> 2] = F[f >> 2]; - F[(a + 48) >> 2] = b; - b = F[(f + 12) >> 2]; - F[(a + 52) >> 2] = F[(f + 8) >> 2]; - F[(a + 56) >> 2] = b; - b = (a - -64) | 0; - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - F[(a + 60) >> 2] = 5624; - F[a >> 2] = 5040; - b = F[(f + 4) >> 2]; - F[(a + 72) >> 2] = F[f >> 2]; - F[(a + 76) >> 2] = b; - b = F[(f + 12) >> 2]; - F[(a + 80) >> 2] = F[(f + 8) >> 2]; - F[(a + 84) >> 2] = b; - F[(a + 104) >> 2] = 1065353216; - F[(a + 108) >> 2] = -1; - F[(a + 96) >> 2] = -1; - F[(a + 100) >> 2] = -1; - F[(a + 88) >> 2] = 1; - F[(a + 92) >> 2] = -1; - F[(a + 60) >> 2] = 5260; - F[(a + 112) >> 2] = 0; - F[(a + 116) >> 2] = 0; - D[(a + 117) | 0] = 0; - D[(a + 118) | 0] = 0; - D[(a + 119) | 0] = 0; - D[(a + 120) | 0] = 0; - D[(a + 121) | 0] = 0; - D[(a + 122) | 0] = 0; - D[(a + 123) | 0] = 0; - D[(a + 124) | 0] = 0; - break l; - } - na(); - v(); - } - break j; - } - e = a; - } - Z = (j + 32) | 0; - break c; - } - na(); - v(); - } - if (e) { - break b; - } - } - e = ka(44); - F[(e + 4) >> 2] = k; - F[e >> 2] = 2960; - a = F[(d + 4) >> 2]; - F[(e + 8) >> 2] = F[d >> 2]; - F[(e + 12) >> 2] = a; - a = F[(d + 12) >> 2]; - F[(e + 16) >> 2] = F[(d + 8) >> 2]; - F[(e + 20) >> 2] = a; - a = F[(d + 20) >> 2]; - F[(e + 24) >> 2] = F[(d + 16) >> 2]; - F[(e + 28) >> 2] = a; - F[(e + 40) >> 2] = 0; - F[(e + 32) >> 2] = 0; - F[(e + 36) >> 2] = 0; - n: { - c = F[(d + 24) >> 2]; - b = F[(d + 28) >> 2]; - if ((c | 0) != (b | 0)) { - a = (b - c) | 0; - if ((a | 0) < 0) { - break n; - } - k = ka(a); - F[(e + 32) >> 2] = k; - F[(e + 40) >> 2] = (a & -4) + k; - while (1) { - F[k >> 2] = F[c >> 2]; - k = (k + 4) | 0; - c = (c + 4) | 0; - if ((b | 0) != (c | 0)) { - continue; - } - break; - } - F[(e + 36) >> 2] = k; - } - F[e >> 2] = 5652; - break b; - } - na(); - v(); - } - k = e; - a = F[(h + 32) >> 2]; - if (!a) { - break a; - } - F[(h + 36) >> 2] = a; - ja(a); - } - Z = (h + 48) | 0; - return k | 0; - } - function rf(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0; - m = (Z - 16) | 0; - Z = m; - F[(m + 12) >> 2] = b; - b = ka(32); - F[m >> 2] = b; - F[(m + 4) >> 2] = 24; - F[(m + 8) >> 2] = -2147483616; - c = - G[1196] | - (G[1197] << 8) | - ((G[1198] << 16) | (G[1199] << 24)); - d = - G[1192] | - (G[1193] << 8) | - ((G[1194] << 16) | (G[1195] << 24)); - D[(b + 16) | 0] = d; - D[(b + 17) | 0] = d >>> 8; - D[(b + 18) | 0] = d >>> 16; - D[(b + 19) | 0] = d >>> 24; - D[(b + 20) | 0] = c; - D[(b + 21) | 0] = c >>> 8; - D[(b + 22) | 0] = c >>> 16; - D[(b + 23) | 0] = c >>> 24; - c = - G[1188] | - (G[1189] << 8) | - ((G[1190] << 16) | (G[1191] << 24)); - d = - G[1184] | - (G[1185] << 8) | - ((G[1186] << 16) | (G[1187] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1180] | - (G[1181] << 8) | - ((G[1182] << 16) | (G[1183] << 24)); - d = - G[1176] | - (G[1177] << 8) | - ((G[1178] << 16) | (G[1179] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - D[(b + 24) | 0] = 0; - l = (Z - 48) | 0; - Z = l; - f = F[(m + 12) >> 2]; - d = a; - a = (a + 16) | 0; - b = F[a >> 2]; - a: { - b: { - if (!b) { - break b; - } - c = a; - while (1) { - e = (f | 0) > F[(b + 16) >> 2]; - c = e ? c : b; - b = F[(e ? (b + 4) | 0 : b) >> 2]; - if (b) { - continue; - } - break; - } - if ((a | 0) == (c | 0)) { - break b; - } - if ((f | 0) >= F[(c + 16) >> 2]) { - break a; - } - } - F[(l + 28) >> 2] = 0; - F[(l + 32) >> 2] = 0; - y = (l + 24) | 0; - F[(l + 24) >> 2] = y | 4; - a = (l + 16) | 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(l + 8) >> 2] = f; - F[(l + 12) >> 2] = a; - t = (l + 8) | 0; - a = t; - x = (Z - 16) | 0; - Z = x; - u = (d + 12) | 0; - c = F[(u + 4) >> 2]; - c: { - d: { - if (!c) { - o = (u + 4) | 0; - d = o; - break d; - } - a = F[a >> 2]; - while (1) { - d = c; - b = F[(c + 16) >> 2]; - if ((b | 0) > (a | 0)) { - o = d; - c = F[d >> 2]; - if (c) { - continue; - } - break d; - } - if ((a | 0) <= (b | 0)) { - g = d; - a = 0; - break c; - } - c = F[(d + 4) >> 2]; - if (c) { - continue; - } - break; - } - o = (d + 4) | 0; - } - g = ka(32); - b = F[t >> 2]; - q = (g + 24) | 0; - a = q; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(g + 16) >> 2] = b; - r = (g + 20) | 0; - F[r >> 2] = a; - c = F[(t + 4) >> 2]; - z = (t + 8) | 0; - if ((c | 0) != (z | 0)) { - while (1) { - p = (Z - 16) | 0; - Z = p; - a = (p + 8) | 0; - k = (c + 16) | 0; - e: { - f: { - g: { - h: { - i: { - j: { - k: { - f = q; - e = (r + 4) | 0; - l: { - if ((f | 0) == (e | 0)) { - break l; - } - b = G[(f + 27) | 0]; - h = (b << 24) >> 24 < 0; - i = G[(k + 11) | 0]; - n = (i << 24) >> 24; - j = (n | 0) < 0; - i = j ? F[(k + 4) >> 2] : i; - b = h ? F[(f + 20) >> 2] : b; - s = i >>> 0 > b >>> 0; - w = s ? b : i; - if (w) { - j = j ? F[k >> 2] : k; - h = h - ? F[(f + 16) >> 2] - : (f + 16) | 0; - A = sa(j, h, w); - if (!A) { - if (b >>> 0 > i >>> 0) { - break l; - } - break k; - } - if ((A | 0) >= 0) { - break k; - } - break l; - } - if (b >>> 0 <= i >>> 0) { - break j; - } - } - h = F[f >> 2]; - m: { - a = f; - n: { - if ((a | 0) == F[r >> 2]) { - break n; - } - o: { - if (!h) { - b = f; - while (1) { - a = F[(b + 8) >> 2]; - i = F[a >> 2] == (b | 0); - b = a; - if (i) { - continue; - } - break; - } - break o; - } - b = h; - while (1) { - a = b; - b = F[(b + 4) >> 2]; - if (b) { - continue; - } - break; - } - } - i = G[(k + 11) | 0]; - s = (i << 24) >> 24; - b = (s | 0) < 0; - j = G[(a + 27) | 0]; - n = (j << 24) >> 24 < 0; - p: { - i = b ? F[(k + 4) >> 2] : i; - j = n ? F[(a + 20) >> 2] : j; - w = i >>> 0 < j >>> 0 ? i : j; - if (w) { - b = sa( - n - ? F[(a + 16) >> 2] - : (a + 16) | 0, - b ? F[k >> 2] : k, - w, - ); - if (b) { - break p; - } - } - if (i >>> 0 > j >>> 0) { - break n; - } - break m; - } - if ((b | 0) >= 0) { - break m; - } - } - if (!h) { - F[(p + 12) >> 2] = f; - a = f; - break e; - } - F[(p + 12) >> 2] = a; - a = (a + 4) | 0; - break e; - } - b = F[e >> 2]; - if (!b) { - F[(p + 12) >> 2] = e; - a = e; - break e; - } - h = (s | 0) < 0 ? F[k >> 2] : k; - f = e; - while (1) { - a = b; - b = G[(b + 27) | 0]; - e = (b << 24) >> 24 < 0; - b = e ? F[(a + 20) >> 2] : b; - k = b >>> 0 < i >>> 0; - q: { - r: { - s: { - t: { - n = k ? b : i; - u: { - if (n) { - e = e - ? F[(a + 16) >> 2] - : (a + 16) | 0; - j = sa(h, e, n); - if (!j) { - if (b >>> 0 > i >>> 0) { - break u; - } - break t; - } - if ((j | 0) >= 0) { - break t; - } - break u; - } - if (b >>> 0 <= i >>> 0) { - break s; - } - } - f = a; - b = F[a >> 2]; - if (b) { - continue; - } - break g; - } - b = sa(e, h, n); - if (b) { - break r; - } - } - if (k) { - break q; - } - break g; - } - if ((b | 0) >= 0) { - break g; - } - } - f = (a + 4) | 0; - b = F[(a + 4) >> 2]; - if (b) { - continue; - } - break; - } - break g; - } - b = sa(h, j, w); - if (b) { - break i; - } - } - if (s) { - break h; - } - break f; - } - if ((b | 0) >= 0) { - break f; - } - } - h = F[(f + 4) >> 2]; - v: { - if (!h) { - b = f; - while (1) { - a = F[(b + 8) >> 2]; - j = F[a >> 2] != (b | 0); - b = a; - if (j) { - continue; - } - break; - } - break v; - } - b = h; - while (1) { - a = b; - b = F[b >> 2]; - if (b) { - continue; - } - break; - } - } - w: { - x: { - if ((a | 0) == (e | 0)) { - break x; - } - j = G[(a + 27) | 0]; - b = (j << 24) >> 24 < 0; - y: { - j = b ? F[(a + 20) >> 2] : j; - s = i >>> 0 > j >>> 0 ? j : i; - if (s) { - b = sa( - (n | 0) < 0 ? F[k >> 2] : k, - b ? F[(a + 16) >> 2] : (a + 16) | 0, - s, - ); - if (b) { - break y; - } - } - if (i >>> 0 < j >>> 0) { - break x; - } - break w; - } - if ((b | 0) >= 0) { - break w; - } - } - if (!h) { - F[(p + 12) >> 2] = f; - a = (f + 4) | 0; - break e; - } - F[(p + 12) >> 2] = a; - break e; - } - b = F[e >> 2]; - if (!b) { - F[(p + 12) >> 2] = e; - a = e; - break e; - } - h = (n | 0) < 0 ? F[k >> 2] : k; - f = e; - while (1) { - a = b; - b = G[(b + 27) | 0]; - e = (b << 24) >> 24 < 0; - b = e ? F[(a + 20) >> 2] : b; - k = b >>> 0 < i >>> 0; - z: { - A: { - B: { - C: { - n = k ? b : i; - D: { - if (n) { - e = e - ? F[(a + 16) >> 2] - : (a + 16) | 0; - j = sa(h, e, n); - if (!j) { - if (b >>> 0 > i >>> 0) { - break D; - } - break C; - } - if ((j | 0) >= 0) { - break C; - } - break D; - } - if (b >>> 0 <= i >>> 0) { - break B; - } - } - f = a; - b = F[a >> 2]; - if (b) { - continue; - } - break g; - } - b = sa(e, h, n); - if (b) { - break A; - } - } - if (k) { - break z; - } - break g; - } - if ((b | 0) >= 0) { - break g; - } - } - f = (a + 4) | 0; - b = F[(a + 4) >> 2]; - if (b) { - continue; - } - break; - } - } - F[(p + 12) >> 2] = a; - a = f; - break e; - } - F[(p + 12) >> 2] = f; - F[a >> 2] = f; - } - f = a; - a = F[a >> 2]; - if (a) { - b = 0; - } else { - a = ka(40); - b = (a + 16) | 0; - E: { - if (D[(c + 27) | 0] >= 0) { - e = F[(c + 20) >> 2]; - F[b >> 2] = F[(c + 16) >> 2]; - F[(b + 4) >> 2] = e; - F[(b + 8) >> 2] = F[(c + 24) >> 2]; - break E; - } - ra(b, F[(c + 16) >> 2], F[(c + 20) >> 2]); - } - b = (a + 28) | 0; - F: { - if (D[(c + 39) | 0] >= 0) { - e = F[(c + 32) >> 2]; - F[b >> 2] = F[(c + 28) >> 2]; - F[(b + 4) >> 2] = e; - F[(b + 8) >> 2] = F[(c + 36) >> 2]; - break F; - } - ra(b, F[(c + 28) >> 2], F[(c + 32) >> 2]); - } - F[(a + 8) >> 2] = F[(p + 12) >> 2]; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[f >> 2] = a; - b = a; - e = F[F[r >> 2] >> 2]; - if (e) { - F[r >> 2] = e; - b = F[f >> 2]; - } - nb(F[(r + 4) >> 2], b); - F[(r + 8) >> 2] = F[(r + 8) >> 2] + 1; - b = 1; - } - D[(x + 12) | 0] = b; - F[(x + 8) >> 2] = a; - Z = (p + 16) | 0; - b = F[(c + 4) >> 2]; - G: { - if (b) { - while (1) { - c = b; - b = F[b >> 2]; - if (b) { - continue; - } - break G; - } - } - while (1) { - a = c; - c = F[(c + 8) >> 2]; - if ((a | 0) != F[c >> 2]) { - continue; - } - break; - } - } - if ((c | 0) != (z | 0)) { - continue; - } - break; - } - } - F[(g + 8) >> 2] = d; - F[g >> 2] = 0; - F[(g + 4) >> 2] = 0; - F[o >> 2] = g; - c = g; - a = F[F[u >> 2] >> 2]; - if (a) { - F[u >> 2] = a; - c = F[o >> 2]; - } - nb(F[(u + 4) >> 2], c); - F[(u + 8) >> 2] = F[(u + 8) >> 2] + 1; - a = 1; - } - D[(l + 44) | 0] = a; - F[(l + 40) >> 2] = g; - Z = (x + 16) | 0; - c = F[(l + 40) >> 2]; - ib(t | 4, F[(l + 16) >> 2]); - ib(y, F[(l + 28) >> 2]); - } - f = (Z - 48) | 0; - Z = f; - d = (f + 8) | 0; - g = (Z - 32) | 0; - Z = g; - o = (g + 32) | 0; - b = o; - a = (g + 21) | 0; - H: { - if ((b | 0) == (a | 0)) { - break H; - } - } - e = (b - a) | 0; - I: { - if ((e | 0) <= 9) { - h = 61; - if ((e | 0) < ((I[2684] <= 1) | 0)) { - break I; - } - } - D[a | 0] = 49; - b = (a + 1) | 0; - h = 0; - } - F[(g + 12) >> 2] = h; - F[(g + 8) >> 2] = b; - h = (Z - 16) | 0; - Z = h; - e = (Z - 16) | 0; - Z = e; - J: { - q = F[(g + 8) >> 2]; - g = (q - a) | 0; - if (g >>> 0 <= 2147483631) { - K: { - if (g >>> 0 < 11) { - D[(d + 11) | 0] = g | (G[(d + 11) | 0] & 128); - D[(d + 11) | 0] = G[(d + 11) | 0] & 127; - b = d; - break K; - } - t = (e + 8) | 0; - if (g >>> 0 >= 11) { - k = (g + 16) & -16; - b = (k - 1) | 0; - b = (b | 0) == 11 ? k : b; - } else { - b = 10; - } - sb(t, (b + 1) | 0); - b = F[(e + 8) >> 2]; - F[d >> 2] = b; - F[(d + 8) >> 2] = - (F[(d + 8) >> 2] & -2147483648) | - (F[(e + 12) >> 2] & 2147483647); - F[(d + 8) >> 2] = F[(d + 8) >> 2] | -2147483648; - F[(d + 4) >> 2] = g; - } - while (1) { - if ((a | 0) != (q | 0)) { - D[b | 0] = G[a | 0]; - b = (b + 1) | 0; - a = (a + 1) | 0; - continue; - } - break; - } - D[(e + 7) | 0] = 0; - D[b | 0] = G[(e + 7) | 0]; - Z = (e + 16) | 0; - break J; - } - za(); - v(); - } - Z = (h + 16) | 0; - Z = o; - F[(f + 32) >> 2] = m; - L: { - M: { - a = (c + 20) | 0; - d = F[(a + 4) >> 2]; - N: { - if (!d) { - g = (a + 4) | 0; - c = g; - break N; - } - b = G[(m + 11) | 0]; - c = (b << 24) >> 24 < 0; - e = c ? F[m >> 2] : m; - b = c ? F[(m + 4) >> 2] : b; - while (1) { - c = d; - d = G[(c + 27) | 0]; - g = (d << 24) >> 24 < 0; - d = g ? F[(c + 20) >> 2] : d; - o = d >>> 0 < b >>> 0; - O: { - P: { - Q: { - R: { - h = o ? d : b; - S: { - if (h) { - g = g ? F[(c + 16) >> 2] : (c + 16) | 0; - q = sa(e, g, h); - if (!q) { - if (b >>> 0 < d >>> 0) { - break S; - } - break R; - } - if ((q | 0) >= 0) { - break R; - } - break S; - } - if (b >>> 0 >= d >>> 0) { - break Q; - } - } - g = c; - d = F[c >> 2]; - if (d) { - continue; - } - break N; - } - d = sa(g, e, h); - if (d) { - break P; - } - } - if (o) { - break O; - } - break M; - } - if ((d | 0) >= 0) { - break M; - } - } - d = F[(c + 4) >> 2]; - if (d) { - continue; - } - break; - } - g = (c + 4) | 0; - } - d = ka(40); - e = (d + 16) | 0; - b = F[(f + 32) >> 2]; - T: { - if (D[(b + 11) | 0] >= 0) { - o = F[(b + 4) >> 2]; - F[e >> 2] = F[b >> 2]; - F[(e + 4) >> 2] = o; - F[(e + 8) >> 2] = F[(b + 8) >> 2]; - break T; - } - ra(e, F[b >> 2], F[(b + 4) >> 2]); - } - F[(d + 8) >> 2] = c; - F[d >> 2] = 0; - F[(d + 4) >> 2] = 0; - F[(d + 36) >> 2] = 0; - F[(d + 28) >> 2] = 0; - F[(d + 32) >> 2] = 0; - F[g >> 2] = d; - c = d; - b = F[F[a >> 2] >> 2]; - if (b) { - F[a >> 2] = b; - c = F[g >> 2]; - } - nb(F[(a + 4) >> 2], c); - F[(a + 8) >> 2] = F[(a + 8) >> 2] + 1; - a = 1; - break L; - } - d = c; - a = 0; - } - D[(f + 44) | 0] = a; - F[(f + 40) >> 2] = d; - a = F[(f + 40) >> 2]; - if (D[(a + 39) | 0] < 0) { - ja(F[(a + 28) >> 2]); - } - b = F[(f + 12) >> 2]; - F[(a + 28) >> 2] = F[(f + 8) >> 2]; - F[(a + 32) >> 2] = b; - F[(a + 36) >> 2] = F[(f + 16) >> 2]; - Z = (f + 48) | 0; - Z = (l + 48) | 0; - if (D[(m + 11) | 0] < 0) { - ja(F[m >> 2]); - } - Z = (m + 16) | 0; - } - function zd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0; - h = (Z - 32) | 0; - Z = h; - g = F[(F[(a + 4) >> 2] + 44) >> 2]; - c = F[(a + 8) >> 2]; - d = F[c >> 2]; - c = F[(c + 4) >> 2]; - F[(h + 24) >> 2] = 0; - F[(h + 16) >> 2] = 0; - F[(h + 20) >> 2] = 0; - d = ((((c - d) >> 2) >>> 0) / 3) | 0; - c = F[(g + 96) >> 2]; - f = (((F[(g + 100) >> 2] - c) | 0) / 12) | 0; - a: { - if (d >>> 0 > f >>> 0) { - e = (d - f) | 0; - i = F[(g + 104) >> 2]; - c = F[(g + 100) >> 2]; - if (e >>> 0 <= (((i - c) | 0) / 12) >>> 0) { - b: { - if (!e) { - break b; - } - d = c; - f = (L(e, 12) - 12) | 0; - i = ((((f >>> 0) / 12) | 0) + 1) & 3; - if (i) { - while (1) { - l = F[(h + 20) >> 2]; - F[d >> 2] = F[(h + 16) >> 2]; - F[(d + 4) >> 2] = l; - F[(d + 8) >> 2] = F[(h + 24) >> 2]; - d = (d + 12) | 0; - j = (j + 1) | 0; - if ((i | 0) != (j | 0)) { - continue; - } - break; - } - } - c = (L(e, 12) + c) | 0; - if (f >>> 0 < 36) { - break b; - } - while (1) { - f = F[(h + 20) >> 2]; - F[d >> 2] = F[(h + 16) >> 2]; - F[(d + 4) >> 2] = f; - F[(d + 8) >> 2] = F[(h + 24) >> 2]; - F[(d + 20) >> 2] = F[(h + 24) >> 2]; - f = F[(h + 20) >> 2]; - F[(d + 12) >> 2] = F[(h + 16) >> 2]; - F[(d + 16) >> 2] = f; - F[(d + 32) >> 2] = F[(h + 24) >> 2]; - f = F[(h + 20) >> 2]; - F[(d + 24) >> 2] = F[(h + 16) >> 2]; - F[(d + 28) >> 2] = f; - f = F[(h + 20) >> 2]; - F[(d + 36) >> 2] = F[(h + 16) >> 2]; - F[(d + 40) >> 2] = f; - F[(d + 44) >> 2] = F[(h + 24) >> 2]; - d = (d + 48) | 0; - if ((d | 0) != (c | 0)) { - continue; - } - break; - } - } - F[(g + 100) >> 2] = c; - break a; - } - c: { - f = F[(g + 96) >> 2]; - n = (((c - f) | 0) / 12) | 0; - d = (n + e) | 0; - if (d >>> 0 < 357913942) { - f = (((i - f) | 0) / 12) | 0; - i = f << 1; - i = - f >>> 0 >= 178956970 - ? 357913941 - : d >>> 0 < i >>> 0 - ? i - : d; - if (i) { - if (i >>> 0 >= 357913942) { - break c; - } - l = ka(L(i, 12)); - } - f = (L(n, 12) + l) | 0; - d = f; - e = L(e, 12); - n = (e - 12) | 0; - q = ((((n >>> 0) / 12) | 0) + 1) & 3; - if (q) { - while (1) { - r = F[(h + 20) >> 2]; - F[d >> 2] = F[(h + 16) >> 2]; - F[(d + 4) >> 2] = r; - F[(d + 8) >> 2] = F[(h + 24) >> 2]; - d = (d + 12) | 0; - j = (j + 1) | 0; - if ((q | 0) != (j | 0)) { - continue; - } - break; - } - } - e = (e + f) | 0; - if (n >>> 0 >= 36) { - while (1) { - j = F[(h + 20) >> 2]; - F[d >> 2] = F[(h + 16) >> 2]; - F[(d + 4) >> 2] = j; - F[(d + 8) >> 2] = F[(h + 24) >> 2]; - F[(d + 20) >> 2] = F[(h + 24) >> 2]; - j = F[(h + 20) >> 2]; - F[(d + 12) >> 2] = F[(h + 16) >> 2]; - F[(d + 16) >> 2] = j; - F[(d + 32) >> 2] = F[(h + 24) >> 2]; - j = F[(h + 20) >> 2]; - F[(d + 24) >> 2] = F[(h + 16) >> 2]; - F[(d + 28) >> 2] = j; - j = F[(h + 20) >> 2]; - F[(d + 36) >> 2] = F[(h + 16) >> 2]; - F[(d + 40) >> 2] = j; - F[(d + 44) >> 2] = F[(h + 24) >> 2]; - d = (d + 48) | 0; - if ((e | 0) != (d | 0)) { - continue; - } - break; - } - } - j = F[(g + 96) >> 2]; - if ((j | 0) != (c | 0)) { - while (1) { - c = (c - 12) | 0; - n = F[(c + 4) >> 2]; - f = (f - 12) | 0; - d = f; - F[d >> 2] = F[c >> 2]; - F[(d + 4) >> 2] = n; - F[(d + 8) >> 2] = F[(c + 8) >> 2]; - if ((c | 0) != (j | 0)) { - continue; - } - break; - } - c = F[(g + 96) >> 2]; - } - F[(g + 104) >> 2] = L(i, 12) + l; - F[(g + 100) >> 2] = e; - F[(g + 96) >> 2] = f; - if (c) { - ja(c); - } - break a; - } - na(); - v(); - } - oa(); - v(); - } - if (d >>> 0 >= f >>> 0) { - break a; - } - F[(g + 100) >> 2] = c + L(d, 12); - } - d: { - if (F[(a + 216) >> 2] == F[(a + 220) >> 2]) { - j = F[(a + 4) >> 2]; - c = F[(j + 44) >> 2]; - d = F[(c + 100) >> 2]; - f = F[(c + 96) >> 2]; - if ((d | 0) != (f | 0)) { - c = (((d - f) | 0) / 12) | 0; - o = c >>> 0 <= 1 ? 1 : c; - c = 0; - while (1) { - d = F[(a + 8) >> 2]; - i = (f + L(c, 12)) | 0; - g = L(c, 3); - e: { - f: { - if ((g | 0) == -1) { - e = F[(((F[d >> 2] + (g << 2)) | 0) + 4) >> 2]; - k = -1; - g = 1; - break f; - } - e = -1; - k = F[(F[d >> 2] + (g << 2)) >> 2]; - l = (g + 1) | 0; - if ((l | 0) == -1) { - g = 0; - break f; - } - e = F[(F[d >> 2] + (l << 2)) >> 2]; - g = (g + 2) | 0; - m = -1; - if ((g | 0) == -1) { - break e; - } - } - m = F[(F[d >> 2] + (g << 2)) >> 2]; - } - F[(i + 8) >> 2] = m; - F[(i + 4) >> 2] = e; - F[i >> 2] = k; - c = (c + 1) | 0; - if ((o | 0) != (c | 0)) { - continue; - } - break; - } - } - F[(F[(j + 4) >> 2] + 80) >> 2] = b; - c = 1; - break d; - } - d = 0; - F[(h + 24) >> 2] = 0; - F[(h + 16) >> 2] = 0; - F[(h + 20) >> 2] = 0; - l = F[(a + 8) >> 2]; - c = F[l >> 2]; - g = F[(l + 4) >> 2]; - F[(h + 8) >> 2] = 0; - F[h >> 2] = 0; - F[(h + 4) >> 2] = 0; - b = 0; - g: { - h: { - i: { - j: { - k: { - l: { - if ((c | 0) != (g | 0)) { - c = (g - c) | 0; - if ((c | 0) < 0) { - break l; - } - b = ka(c); - F[h >> 2] = b; - F[(h + 8) >> 2] = (c & -4) + b; - (u = h), - (w = (ma(b, 0, c) + c) | 0), - (F[(u + 4) >> 2] = w); - } - c = F[(l + 24) >> 2]; - if (((F[(l + 28) >> 2] - c) | 0) < 4) { - break h; - } - f = 0; - while (1) { - g = F[((p << 2) + c) >> 2]; - m: { - if ((g | 0) == -1) { - break m; - } - n: { - if ( - (F[ - (F[(a + 120) >> 2] + - ((p >>> 3) & 536870908)) >> - 2 - ] >>> - p) & - 1 - ) { - break n; - } - n = F[(a + 216) >> 2]; - c = F[(a + 220) >> 2]; - if ((n | 0) == (c | 0)) { - break n; - } - e = (g + 2) | 0; - i = ((g >>> 0) % 3) | 0; - q = i ? (g - 1) | 0 : e; - c = (((c - n) | 0) / 144) | 0; - r = c >>> 0 <= 1 ? 1 : c; - j = 0; - t = ((i | 0) != 0) | ((e | 0) != -1); - while (1) { - s = g << 2; - i = (L(j, 144) + n) | 0; - c = - F[(s + F[F[(i + 68) >> 2] >> 2]) >> 2]; - o: { - if ( - !( - (F[ - (F[(i + 16) >> 2] + - ((c >>> 3) & 536870908)) >> - 2 - ] >>> - c) & - 1 - ) - ) { - break o; - } - c = -1; - p: { - if (!t) { - break p; - } - e = - F[ - (F[(l + 12) >> 2] + (q << 2)) >> 2 - ]; - c = -1; - if ((e | 0) == -1) { - break p; - } - c = (e - 1) | 0; - if (((e >>> 0) % 3) | 0) { - break p; - } - c = (e + 2) | 0; - } - if ((g | 0) == (c | 0)) { - break o; - } - e = s; - s = F[(i + 32) >> 2]; - i = F[(e + s) >> 2]; - while (1) { - e = 0; - if ((c | 0) == -1) { - break g; - } - if ( - (i | 0) != - F[(s + (c << 2)) >> 2] - ) { - g = c; - break n; - } - q: { - r: { - if (((c >>> 0) % 3) | 0) { - e = (c - 1) | 0; - break r; - } - e = (c + 2) | 0; - m = -1; - if ((e | 0) == -1) { - break q; - } - } - c = - F[ - (F[(l + 12) >> 2] + (e << 2)) >> - 2 - ]; - m = -1; - if ((c | 0) == -1) { - break q; - } - m = (c - 1) | 0; - if (((c >>> 0) % 3) | 0) { - break q; - } - m = (c + 2) | 0; - } - c = m; - if ((g | 0) != (c | 0)) { - continue; - } - break; - } - } - j = (j + 1) | 0; - if ((r | 0) != (j | 0)) { - continue; - } - break; - } - } - i = (k - f) | 0; - e = i >> 2; - F[((g << 2) + b) >> 2] = e; - s: { - if (k >>> 0 < o >>> 0) { - F[k >> 2] = g; - k = (k + 4) | 0; - F[(h + 20) >> 2] = k; - break s; - } - c = (e + 1) | 0; - if (c >>> 0 >= 1073741824) { - break k; - } - d = (o - f) | 0; - k = (d >>> 1) | 0; - c = - d >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 < k >>> 0 - ? k - : c; - if (c) { - if (c >>> 0 >= 1073741824) { - break j; - } - d = ka(c << 2); - } else { - d = 0; - } - e = (d + (e << 2)) | 0; - F[e >> 2] = g; - m = c << 2; - c = pa(d, f, i); - o = (m + c) | 0; - F[(h + 24) >> 2] = o; - k = (e + 4) | 0; - F[(h + 20) >> 2] = k; - F[(h + 16) >> 2] = c; - if (f) { - ja(f); - l = F[(a + 8) >> 2]; - } - f = c; - } - if ((g | 0) == -1) { - break m; - } - t: { - if (((g >>> 0) % 3) | 0) { - c = (g - 1) | 0; - break t; - } - c = (g + 2) | 0; - if ((c | 0) == -1) { - break m; - } - } - c = F[(F[(l + 12) >> 2] + (c << 2)) >> 2]; - if ((c | 0) == -1) { - break m; - } - c = (c + (((c >>> 0) % 3) | 0 ? -1 : 2)) | 0; - if ((c | 0) == -1) { - break m; - } - e = g; - if ((c | 0) == (g | 0)) { - break m; - } - while (1) { - i = c; - u: { - v: { - c = F[(a + 220) >> 2]; - j = F[(a + 216) >> 2]; - if ((c | 0) == (j | 0)) { - break v; - } - c = (((c - j) | 0) / 144) | 0; - n = c >>> 0 <= 1 ? 1 : c; - c = 0; - while (1) { - q = - F[ - (((j + L(c, 144)) | 0) + 32) >> 2 - ]; - r = i << 2; - if ( - F[(q + r) >> 2] == - F[(q + (e << 2)) >> 2] - ) { - c = (c + 1) | 0; - if ((n | 0) != (c | 0)) { - continue; - } - break v; - } - break; - } - j = (k - d) | 0; - e = j >> 2; - F[(b + r) >> 2] = e; - if (k >>> 0 < o >>> 0) { - F[k >> 2] = i; - k = (k + 4) | 0; - F[(h + 20) >> 2] = k; - f = d; - break u; - } - c = (e + 1) | 0; - if (c >>> 0 >= 1073741824) { - break i; - } - f = (o - d) | 0; - k = (f >>> 1) | 0; - c = - f >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 < k >>> 0 - ? k - : c; - if (c) { - if (c >>> 0 >= 1073741824) { - break j; - } - f = ka(c << 2); - } else { - f = 0; - } - e = (f + (e << 2)) | 0; - F[e >> 2] = i; - m = c << 2; - c = pa(f, d, j); - o = (m + c) | 0; - F[(h + 24) >> 2] = o; - k = (e + 4) | 0; - F[(h + 20) >> 2] = k; - F[(h + 16) >> 2] = c; - if (!d) { - d = c; - break u; - } - ja(d); - l = F[(a + 8) >> 2]; - d = c; - break u; - } - F[((i << 2) + b) >> 2] = - F[((e << 2) + b) >> 2]; - } - if ((i | 0) == -1) { - break m; - } - w: { - if (((i >>> 0) % 3) | 0) { - c = (i - 1) | 0; - break w; - } - c = (i + 2) | 0; - if ((c | 0) == -1) { - break m; - } - } - c = F[(F[(l + 12) >> 2] + (c << 2)) >> 2]; - if ((c | 0) == -1) { - break m; - } - c = - (c + (((c >>> 0) % 3) | 0 ? -1 : 2)) | 0; - if ((c | 0) == -1) { - break m; - } - e = i; - if ((c | 0) != (g | 0)) { - continue; - } - break; - } - } - p = (p + 1) | 0; - c = F[(l + 24) >> 2]; - if ((p | 0) < (F[(l + 28) >> 2] - c) >> 2) { - continue; - } - break; - } - break h; - } - na(); - v(); - } - na(); - v(); - } - oa(); - v(); - } - na(); - v(); - } - i = F[(a + 4) >> 2]; - a = F[(i + 44) >> 2]; - c = F[(a + 100) >> 2]; - a = F[(a + 96) >> 2]; - x: { - if ((c | 0) == (a | 0)) { - break x; - } - g = (((c - a) | 0) / 12) | 0; - f = g >>> 0 <= 1 ? 1 : g; - l = f & 1; - c = 0; - if (g >>> 0 >= 2) { - j = f & -2; - g = 0; - while (1) { - e = L(c, 12); - f = (e + b) | 0; - o = F[f >> 2]; - p = F[(f + 4) >> 2]; - e = (a + e) | 0; - F[(e + 8) >> 2] = F[(f + 8) >> 2]; - F[e >> 2] = o; - F[(e + 4) >> 2] = p; - e = L(c | 1, 12); - f = (e + b) | 0; - o = F[f >> 2]; - p = F[(f + 4) >> 2]; - e = (a + e) | 0; - F[(e + 8) >> 2] = F[(f + 8) >> 2]; - F[e >> 2] = o; - F[(e + 4) >> 2] = p; - c = (c + 2) | 0; - g = (g + 2) | 0; - if ((j | 0) != (g | 0)) { - continue; - } - break; - } - } - if (!l) { - break x; - } - g = L(c, 12); - c = (g + b) | 0; - f = F[c >> 2]; - e = F[(c + 4) >> 2]; - a = (a + g) | 0; - F[(a + 8) >> 2] = F[(c + 8) >> 2]; - F[a >> 2] = f; - F[(a + 4) >> 2] = e; - } - F[(F[(i + 4) >> 2] + 80) >> 2] = (k - d) >> 2; - e = 1; - } - c = e; - if (b) { - ja(b); - } - if (!d) { - break d; - } - F[(h + 20) >> 2] = d; - ja(d); - } - Z = (h + 32) | 0; - return c; - } - function de(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - G = 0, - H = 0, - I = 0, - J = 0, - K = 0, - M = 0, - N = 0, - O = 0, - P = 0; - g = (Z + -64) | 0; - Z = g; - F[(a + 8) >> 2] = e; - y = (a + 32) | 0; - f = F[y >> 2]; - d = (F[(a + 36) >> 2] - f) >> 2; - a: { - b: { - if (d >>> 0 < e >>> 0) { - qa(y, (e - d) | 0); - F[(g + 56) >> 2] = 0; - F[(g + 60) >> 2] = 0; - F[(g + 48) >> 2] = 0; - F[(g + 52) >> 2] = 0; - F[(g + 40) >> 2] = 0; - F[(g + 44) >> 2] = 0; - F[(g + 32) >> 2] = 0; - F[(g + 36) >> 2] = 0; - F[(g + 24) >> 2] = 0; - F[(g + 28) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - F[g >> 2] = 0; - break b; - } - if (d >>> 0 > e >>> 0) { - F[(a + 36) >> 2] = f + (e << 2); - } - F[(g + 56) >> 2] = 0; - F[(g + 60) >> 2] = 0; - F[(g + 48) >> 2] = 0; - F[(g + 52) >> 2] = 0; - F[(g + 40) >> 2] = 0; - F[(g + 44) >> 2] = 0; - F[(g + 32) >> 2] = 0; - F[(g + 36) >> 2] = 0; - F[(g + 24) >> 2] = 0; - F[(g + 28) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - F[g >> 2] = 0; - d = 0; - if (!e) { - break a; - } - } - Fa((g + 16) | 0, e, g); - h = F[(g + 28) >> 2]; - d = F[(g + 32) >> 2]; - } - F[g >> 2] = 0; - d = (d - h) >> 2; - c: { - if (d >>> 0 >= e >>> 0) { - if (d >>> 0 <= e >>> 0) { - break c; - } - F[(g + 32) >> 2] = (e << 2) + h; - break c; - } - Fa((g + 16) | 12, (e - d) | 0, g); - } - F[g >> 2] = 0; - f = F[(g + 40) >> 2]; - d = (F[(g + 44) >> 2] - f) >> 2; - d: { - if (d >>> 0 >= e >>> 0) { - if (d >>> 0 <= e >>> 0) { - break d; - } - F[(g + 44) >> 2] = f + (e << 2); - break d; - } - Fa((g + 40) | 0, (e - d) | 0, g); - } - F[g >> 2] = 0; - f = F[(g + 52) >> 2]; - d = (F[(g + 56) >> 2] - f) >> 2; - e: { - if (d >>> 0 >= e >>> 0) { - if (d >>> 0 <= e >>> 0) { - break e; - } - F[(g + 56) >> 2] = f + (e << 2); - break e; - } - Fa((g + 52) | 0, (e - d) | 0, g); - } - f: { - if (F[(a + 8) >> 2] <= 0) { - break f; - } - i = F[(g + 16) >> 2]; - j = F[(a + 32) >> 2]; - h = 0; - while (1) { - d = h << 2; - f = F[(d + i) >> 2]; - m = F[(a + 16) >> 2]; - g: { - if ((f | 0) > (m | 0)) { - F[(d + j) >> 2] = m; - break g; - } - d = (d + j) | 0; - m = F[(a + 12) >> 2]; - if ((m | 0) > (f | 0)) { - F[d >> 2] = m; - break g; - } - F[d >> 2] = f; - } - h = (h + 1) | 0; - d = F[(a + 8) >> 2]; - if ((h | 0) < (d | 0)) { - continue; - } - break; - } - if ((d | 0) <= 0) { - break f; - } - d = 0; - while (1) { - i = d << 2; - f = (i + c) | 0; - i = (F[(b + i) >> 2] + F[(j + i) >> 2]) | 0; - F[f >> 2] = i; - h: { - if ((i | 0) > F[(a + 16) >> 2]) { - i = (i - F[(a + 20) >> 2]) | 0; - } else { - if ((i | 0) >= F[(a + 12) >> 2]) { - break h; - } - i = (i + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = i; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - H = F[(a + 52) >> 2]; - t = F[(a + 48) >> 2]; - z = ka(16); - d = z; - F[d >> 2] = 0; - F[(d + 4) >> 2] = 0; - F[(d + 8) >> 2] = 0; - F[(d + 12) >> 2] = 0; - F[(g + 8) >> 2] = 0; - F[g >> 2] = 0; - F[(g + 4) >> 2] = 0; - i: { - if (e) { - if (e >>> 0 >= 1073741824) { - break i; - } - d = e << 2; - r = ka(d); - F[g >> 2] = r; - F[(g + 8) >> 2] = d + r; - ma(r, 0, d); - } - A = 1; - d = F[(a + 56) >> 2]; - B = F[d >> 2]; - d = (F[(d + 4) >> 2] - B) | 0; - j: { - if ((d | 0) < 8) { - break j; - } - w = d >> 2; - I = (w | 0) <= 2 ? 2 : w; - J = w >>> 0 <= 1 ? 1 : w; - C = e & -2; - D = e & 1; - K = e & -4; - E = e & 3; - G = (e - 1) | 0; - M = e << 2; - N = e >>> 0 < 4; - A = 0; - m = 1; - while (1) { - k: { - l: { - m: { - n: { - if ((m | 0) != (J | 0)) { - o: { - p: { - f = F[((m << 2) + B) >> 2]; - if ((f | 0) == -1) { - break p; - } - k = 1; - d = (f + 2) | 0; - j = ((f >>> 0) % 3) | 0; - x = j ? (f - 1) | 0 : d; - s = 1 << x; - n = F[t >> 2]; - O = (n + ((x >>> 3) & 536870908)) | 0; - i = 0; - P = ((j | 0) != 0) | ((d | 0) != -1); - d = f; - q: { - while (1) { - r: { - if ( - (F[ - (n + ((d >>> 3) & 536870908)) >> 2 - ] >>> - d) & - 1 - ) { - break r; - } - j = - F[ - (F[(F[(t + 64) >> 2] + 12) >> 2] + - (d << 2)) >> - 2 - ]; - if ((j | 0) == -1) { - break r; - } - l = F[H >> 2]; - h = F[(t + 28) >> 2]; - p = - F[ - (l + - (F[(h + (j << 2)) >> 2] << - 2)) >> - 2 - ]; - if ((p | 0) >= (m | 0)) { - break r; - } - q = (j + 1) | 0; - q = - F[ - (l + - (F[ - (h + - ((((q >>> 0) % 3) | 0 - ? q - : (j - 2) | 0) << - 2)) >> - 2 - ] << - 2)) >> - 2 - ]; - if ((q | 0) >= (m | 0)) { - break r; - } - h = - F[ - (l + - (F[ - (h + - ((j + - (((j >>> 0) % 3) | 0 - ? -1 - : 2)) << - 2)) >> - 2 - ] << - 2)) >> - 2 - ]; - if ((h | 0) >= (m | 0)) { - break r; - } - s: { - if (!e) { - break s; - } - j = - F[ - (((g + 16) | 0) + L(i, 12)) >> 2 - ]; - l = L(e, h); - q = L(e, q); - p = L(e, p); - h = 0; - o = 0; - if (G) { - while (1) { - F[(j + (h << 2)) >> 2] = - ((F[ - (((h + l) << 2) + c) >> 2 - ] + - F[ - (((h + q) << 2) + c) >> 2 - ]) | - 0) - - F[(((h + p) << 2) + c) >> 2]; - u = h | 1; - F[(j + (u << 2)) >> 2] = - ((F[ - (((l + u) << 2) + c) >> 2 - ] + - F[ - (((q + u) << 2) + c) >> 2 - ]) | - 0) - - F[(((p + u) << 2) + c) >> 2]; - h = (h + 2) | 0; - o = (o + 2) | 0; - if ((C | 0) != (o | 0)) { - continue; - } - break; - } - } - if (!D) { - break s; - } - F[(j + (h << 2)) >> 2] = - ((F[(((h + l) << 2) + c) >> 2] + - F[(((h + q) << 2) + c) >> 2]) | - 0) - - F[(((h + p) << 2) + c) >> 2]; - } - j = 4; - i = (i + 1) | 0; - if ((i | 0) == 4) { - break q; - } - } - t: { - if (k & 1) { - h = (d - 2) | 0; - j = (d + 1) | 0; - d = -1; - j = ((j >>> 0) % 3) | 0 ? j : h; - if ( - ((j | 0) == -1) | - ((F[ - (n + ((j >>> 3) & 536870908)) >> - 2 - ] >>> - j) & - 1) - ) { - break t; - } - j = - F[ - (F[ - (F[(t + 64) >> 2] + 12) >> 2 - ] + - (j << 2)) >> - 2 - ]; - if ((j | 0) == -1) { - break t; - } - d = (j + 1) | 0; - d = - ((d >>> 0) % 3) | 0 - ? d - : (j - 2) | 0; - break t; - } - u: { - if (((d >>> 0) % 3) | 0) { - h = (d - 1) | 0; - break u; - } - h = (d + 2) | 0; - d = -1; - if ((h | 0) == -1) { - break t; - } - } - d = -1; - if ( - (F[ - (n + ((h >>> 3) & 536870908)) >> 2 - ] >>> - h) & - 1 - ) { - break t; - } - j = - F[ - (F[(F[(t + 64) >> 2] + 12) >> 2] + - (h << 2)) >> - 2 - ]; - if ((j | 0) == -1) { - break t; - } - if (((j >>> 0) % 3) | 0) { - d = (j - 1) | 0; - break t; - } - d = (j + 2) | 0; - } - v: { - if ((d | 0) == (f | 0)) { - break v; - } - if (((d | 0) == -1) & k) { - if (!P | (s & F[O >> 2])) { - break v; - } - d = - F[ - (F[ - (F[(t + 64) >> 2] + 12) >> 2 - ] + - (x << 2)) >> - 2 - ]; - if ((d | 0) == -1) { - break v; - } - k = 0; - d = - ((d >>> 0) % 3) | 0 - ? (d - 1) | 0 - : (d + 2) | 0; - } - if ((d | 0) != -1) { - continue; - } - } - break; - } - j = i; - if ((j | 0) <= 0) { - break p; - } - } - if (e) { - ma(r, 0, M); - } - d = (j - 1) | 0; - q = ((d << 2) + z) | 0; - d = (L(d, 12) + a) | 0; - u = d; - x = F[(d - -64) >> 2]; - k = 0; - d = F[g >> 2]; - f = 0; - while (1) { - i = F[q >> 2]; - F[q >> 2] = i + 1; - if (i >>> 0 >= x >>> 0) { - break j; - } - w: { - if ( - (F[ - (F[(u + 60) >> 2] + - ((i >>> 3) & 536870908)) >> - 2 - ] >>> - i) & - 1 - ) { - break w; - } - f = (f + 1) | 0; - if (!e) { - break w; - } - n = F[(((g + 16) | 0) + L(k, 12)) >> 2]; - i = 0; - h = 0; - p = 0; - if (!N) { - while (1) { - l = h << 2; - o = (l + d) | 0; - F[o >> 2] = - F[(l + n) >> 2] + F[o >> 2]; - o = l | 4; - s = (o + d) | 0; - F[s >> 2] = - F[(n + o) >> 2] + F[s >> 2]; - o = l | 8; - s = (o + d) | 0; - F[s >> 2] = - F[(n + o) >> 2] + F[s >> 2]; - l = l | 12; - o = (l + d) | 0; - F[o >> 2] = - F[(l + n) >> 2] + F[o >> 2]; - h = (h + 4) | 0; - p = (p + 4) | 0; - if ((K | 0) != (p | 0)) { - continue; - } - break; - } - } - if (!E) { - break w; - } - while (1) { - l = h << 2; - p = (l + d) | 0; - F[p >> 2] = - F[(l + n) >> 2] + F[p >> 2]; - h = (h + 1) | 0; - i = (i + 1) | 0; - if ((E | 0) != (i | 0)) { - continue; - } - break; - } - } - k = (k + 1) | 0; - if ((k | 0) != (j | 0)) { - continue; - } - break; - } - i = L(e, m); - if (!f) { - break o; - } - if (!e) { - break l; - } - h = 0; - d = 0; - if (G) { - break n; - } - break m; - } - i = L(e, m); - } - if (F[(a + 8) >> 2] <= 0) { - break k; - } - k = ((L((m - 1) | 0, e) << 2) + c) | 0; - j = F[y >> 2]; - h = 0; - while (1) { - d = h << 2; - f = F[(d + k) >> 2]; - n = F[(a + 16) >> 2]; - x: { - if ((f | 0) > (n | 0)) { - F[(d + j) >> 2] = n; - break x; - } - d = (d + j) | 0; - n = F[(a + 12) >> 2]; - if ((n | 0) > (f | 0)) { - F[d >> 2] = n; - break x; - } - F[d >> 2] = f; - } - h = (h + 1) | 0; - f = F[(a + 8) >> 2]; - if ((h | 0) < (f | 0)) { - continue; - } - break; - } - d = 0; - if ((f | 0) <= 0) { - break k; - } - f = i << 2; - h = (f + c) | 0; - k = (b + f) | 0; - while (1) { - i = d << 2; - f = (i + h) | 0; - i = (F[(i + k) >> 2] + F[(j + i) >> 2]) | 0; - F[f >> 2] = i; - y: { - if ((i | 0) > F[(a + 16) >> 2]) { - i = (i - F[(a + 20) >> 2]) | 0; - } else { - if ((i | 0) >= F[(a + 12) >> 2]) { - break y; - } - i = (i + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = i; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - break k; - } - ta(); - v(); - } - while (1) { - j = h << 2; - k = (j + r) | 0; - F[k >> 2] = F[k >> 2] / (f | 0); - j = ((j | 4) + r) | 0; - F[j >> 2] = F[j >> 2] / (f | 0); - h = (h + 2) | 0; - d = (d + 2) | 0; - if ((C | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!D) { - break l; - } - d = ((h << 2) + r) | 0; - F[d >> 2] = F[d >> 2] / (f | 0); - } - if (F[(a + 8) >> 2] <= 0) { - break k; - } - j = F[y >> 2]; - h = 0; - while (1) { - d = h << 2; - f = F[(d + r) >> 2]; - k = F[(a + 16) >> 2]; - z: { - if ((f | 0) > (k | 0)) { - F[(d + j) >> 2] = k; - break z; - } - d = (d + j) | 0; - k = F[(a + 12) >> 2]; - if ((k | 0) > (f | 0)) { - F[d >> 2] = k; - break z; - } - F[d >> 2] = f; - } - h = (h + 1) | 0; - f = F[(a + 8) >> 2]; - if ((h | 0) < (f | 0)) { - continue; - } - break; - } - d = 0; - if ((f | 0) <= 0) { - break k; - } - f = i << 2; - h = (f + c) | 0; - k = (b + f) | 0; - while (1) { - i = d << 2; - f = (i + h) | 0; - i = (F[(i + k) >> 2] + F[(j + i) >> 2]) | 0; - F[f >> 2] = i; - A: { - if ((i | 0) > F[(a + 16) >> 2]) { - i = (i - F[(a + 20) >> 2]) | 0; - } else { - if ((i | 0) >= F[(a + 12) >> 2]) { - break A; - } - i = (i + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = i; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - m = (m + 1) | 0; - A = (w | 0) <= (m | 0); - if ((m | 0) != (I | 0)) { - continue; - } - break; - } - } - a = F[g >> 2]; - if (a) { - ja(a); - } - ja(z); - a = F[(g + 52) >> 2]; - if (a) { - F[(g + 56) >> 2] = a; - ja(a); - } - a = F[(g + 40) >> 2]; - if (a) { - F[(g + 44) >> 2] = a; - ja(a); - } - a = F[(g + 28) >> 2]; - if (a) { - F[(g + 32) >> 2] = a; - ja(a); - } - a = F[(g + 16) >> 2]; - if (a) { - F[(g + 20) >> 2] = a; - ja(a); - } - Z = (g - -64) | 0; - return A | 0; - } - na(); - v(); - } - function $h(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - D = 0, - E = 0, - G = 0, - H = 0, - I = 0, - J = 0, - K = 0, - M = 0, - N = 0; - h = (Z + -64) | 0; - Z = h; - F[(a + 8) >> 2] = e; - x = (a + 32) | 0; - f = F[x >> 2]; - d = (F[(a + 36) >> 2] - f) >> 2; - a: { - b: { - if (d >>> 0 < e >>> 0) { - qa(x, (e - d) | 0); - F[(h + 56) >> 2] = 0; - F[(h + 60) >> 2] = 0; - F[(h + 48) >> 2] = 0; - F[(h + 52) >> 2] = 0; - F[(h + 40) >> 2] = 0; - F[(h + 44) >> 2] = 0; - F[(h + 32) >> 2] = 0; - F[(h + 36) >> 2] = 0; - F[(h + 24) >> 2] = 0; - F[(h + 28) >> 2] = 0; - F[(h + 16) >> 2] = 0; - F[(h + 20) >> 2] = 0; - F[h >> 2] = 0; - break b; - } - if (d >>> 0 > e >>> 0) { - F[(a + 36) >> 2] = f + (e << 2); - } - F[(h + 56) >> 2] = 0; - F[(h + 60) >> 2] = 0; - F[(h + 48) >> 2] = 0; - F[(h + 52) >> 2] = 0; - F[(h + 40) >> 2] = 0; - F[(h + 44) >> 2] = 0; - F[(h + 32) >> 2] = 0; - F[(h + 36) >> 2] = 0; - F[(h + 24) >> 2] = 0; - F[(h + 28) >> 2] = 0; - F[(h + 16) >> 2] = 0; - F[(h + 20) >> 2] = 0; - F[h >> 2] = 0; - d = 0; - if (!e) { - break a; - } - } - Fa((h + 16) | 0, e, h); - i = F[(h + 28) >> 2]; - d = F[(h + 32) >> 2]; - } - F[h >> 2] = 0; - d = (d - i) >> 2; - c: { - if (d >>> 0 >= e >>> 0) { - if (d >>> 0 <= e >>> 0) { - break c; - } - F[(h + 32) >> 2] = (e << 2) + i; - break c; - } - Fa((h + 16) | 12, (e - d) | 0, h); - } - F[h >> 2] = 0; - f = F[(h + 40) >> 2]; - d = (F[(h + 44) >> 2] - f) >> 2; - d: { - if (d >>> 0 >= e >>> 0) { - if (d >>> 0 <= e >>> 0) { - break d; - } - F[(h + 44) >> 2] = f + (e << 2); - break d; - } - Fa((h + 40) | 0, (e - d) | 0, h); - } - F[h >> 2] = 0; - f = F[(h + 52) >> 2]; - d = (F[(h + 56) >> 2] - f) >> 2; - e: { - if (d >>> 0 >= e >>> 0) { - if (d >>> 0 <= e >>> 0) { - break e; - } - F[(h + 56) >> 2] = f + (e << 2); - break e; - } - Fa((h + 52) | 0, (e - d) | 0, h); - } - f: { - if (F[(a + 8) >> 2] <= 0) { - break f; - } - g = F[(h + 16) >> 2]; - j = F[(a + 32) >> 2]; - i = 0; - while (1) { - d = i << 2; - f = F[(d + g) >> 2]; - m = F[(a + 16) >> 2]; - g: { - if ((f | 0) > (m | 0)) { - F[(d + j) >> 2] = m; - break g; - } - d = (d + j) | 0; - m = F[(a + 12) >> 2]; - if ((m | 0) > (f | 0)) { - F[d >> 2] = m; - break g; - } - F[d >> 2] = f; - } - i = (i + 1) | 0; - d = F[(a + 8) >> 2]; - if ((i | 0) < (d | 0)) { - continue; - } - break; - } - if ((d | 0) <= 0) { - break f; - } - d = 0; - while (1) { - g = d << 2; - f = (g + c) | 0; - g = (F[(b + g) >> 2] + F[(g + j) >> 2]) | 0; - F[f >> 2] = g; - h: { - if ((g | 0) > F[(a + 16) >> 2]) { - g = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break h; - } - g = (g + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = g; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - H = F[(a + 52) >> 2]; - A = F[(a + 48) >> 2]; - y = ka(16); - d = y; - F[d >> 2] = 0; - F[(d + 4) >> 2] = 0; - F[(d + 8) >> 2] = 0; - F[(d + 12) >> 2] = 0; - F[(h + 8) >> 2] = 0; - F[h >> 2] = 0; - F[(h + 4) >> 2] = 0; - i: { - if (e) { - if (e >>> 0 >= 1073741824) { - break i; - } - d = e << 2; - t = ka(d); - F[h >> 2] = t; - F[(h + 8) >> 2] = d + t; - ma(t, 0, d); - } - z = 1; - d = F[(a + 56) >> 2]; - B = F[d >> 2]; - d = (F[(d + 4) >> 2] - B) | 0; - j: { - if ((d | 0) < 8) { - break j; - } - w = d >> 2; - I = (w | 0) <= 2 ? 2 : w; - J = w >>> 0 <= 1 ? 1 : w; - C = e & -2; - D = e & 1; - K = e & -4; - E = e & 3; - G = (e - 1) | 0; - M = e << 2; - N = e >>> 0 < 4; - z = 0; - m = 1; - while (1) { - k: { - l: { - m: { - n: { - if ((m | 0) != (J | 0)) { - o: { - p: { - f = F[((m << 2) + B) >> 2]; - if ((f | 0) == -1) { - break p; - } - n = F[(A + 12) >> 2]; - d = (f + 2) | 0; - g = ((f >>> 0) % 3) | 0; - q = (n + ((g ? (f - 1) | 0 : d) << 2)) | 0; - j = 0; - u = ((g | 0) != 0) | ((d | 0) != -1); - k = 1; - d = f; - q: { - while (1) { - g = F[(n + (d << 2)) >> 2]; - r: { - if ((g | 0) == -1) { - break r; - } - l = -1; - p = F[H >> 2]; - r = F[A >> 2]; - i = - (p + - (F[(r + (g << 2)) >> 2] << 2)) | - 0; - o = (g + 1) | 0; - o = - ((o >>> 0) % 3) | 0 - ? o - : (g - 2) | 0; - if ((o | 0) != -1) { - l = F[(r + (o << 2)) >> 2]; - } - o = F[i >> 2]; - s: { - t: { - if (((g >>> 0) % 3) | 0) { - i = (g - 1) | 0; - break t; - } - i = (g + 2) | 0; - s = -1; - if ((i | 0) == -1) { - break s; - } - } - s = F[(r + (i << 2)) >> 2]; - } - if ((m | 0) <= (o | 0)) { - break r; - } - i = F[(p + (l << 2)) >> 2]; - if ((i | 0) >= (m | 0)) { - break r; - } - l = F[(p + (s << 2)) >> 2]; - if ((l | 0) >= (m | 0)) { - break r; - } - g = - F[(((h + 16) | 0) + L(j, 12)) >> 2]; - u: { - if (!e) { - break u; - } - l = L(e, l); - r = L(e, i); - p = L(e, o); - i = 0; - s = 0; - if (G) { - while (1) { - F[(g + (i << 2)) >> 2] = - ((F[ - (((i + l) << 2) + c) >> 2 - ] + - F[ - (((i + r) << 2) + c) >> 2 - ]) | - 0) - - F[(((i + p) << 2) + c) >> 2]; - o = i | 1; - F[(g + (o << 2)) >> 2] = - ((F[ - (((l + o) << 2) + c) >> 2 - ] + - F[ - (((o + r) << 2) + c) >> 2 - ]) | - 0) - - F[(((o + p) << 2) + c) >> 2]; - i = (i + 2) | 0; - s = (s + 2) | 0; - if ((C | 0) != (s | 0)) { - continue; - } - break; - } - } - if (!D) { - break u; - } - F[(g + (i << 2)) >> 2] = - ((F[(((i + l) << 2) + c) >> 2] + - F[(((i + r) << 2) + c) >> 2]) | - 0) - - F[(((i + p) << 2) + c) >> 2]; - } - g = 4; - j = (j + 1) | 0; - if ((j | 0) == 4) { - break q; - } - } - v: { - if (k & 1) { - i = (d + 1) | 0; - d = - ((i >>> 0) % 3) | 0 - ? i - : (d - 2) | 0; - g = -1; - if ((d | 0) == -1) { - break v; - } - d = F[(n + (d << 2)) >> 2]; - g = -1; - if ((d | 0) == -1) { - break v; - } - g = (d + 1) | 0; - g = - ((g >>> 0) % 3) | 0 - ? g - : (d - 2) | 0; - break v; - } - w: { - if (((d >>> 0) % 3) | 0) { - i = (d - 1) | 0; - break w; - } - i = (d + 2) | 0; - g = -1; - if ((i | 0) == -1) { - break v; - } - } - d = F[(n + (i << 2)) >> 2]; - g = -1; - if ((d | 0) == -1) { - break v; - } - g = (d - 1) | 0; - if (((d >>> 0) % 3) | 0) { - break v; - } - g = (d + 2) | 0; - } - d = g; - x: { - if ((f | 0) == (d | 0)) { - break x; - } - if (((d | 0) == -1) & k) { - if (!u) { - break x; - } - d = F[q >> 2]; - if ((d | 0) == -1) { - break x; - } - k = 0; - d = - ((d >>> 0) % 3) | 0 - ? (d - 1) | 0 - : (d + 2) | 0; - } - if ((d | 0) != -1) { - continue; - } - } - break; - } - g = j; - if ((g | 0) <= 0) { - break p; - } - } - if (e) { - ma(t, 0, M); - } - d = (g - 1) | 0; - r = ((d << 2) + y) | 0; - d = (L(d, 12) + a) | 0; - o = d; - s = F[(d - -64) >> 2]; - k = 0; - d = F[h >> 2]; - f = 0; - while (1) { - j = F[r >> 2]; - F[r >> 2] = j + 1; - if (j >>> 0 >= s >>> 0) { - break j; - } - y: { - if ( - (F[ - (F[(o + 60) >> 2] + - ((j >>> 3) & 536870908)) >> - 2 - ] >>> - j) & - 1 - ) { - break y; - } - f = (f + 1) | 0; - if (!e) { - break y; - } - j = F[(((h + 16) | 0) + L(k, 12)) >> 2]; - l = 0; - i = 0; - p = 0; - if (!N) { - while (1) { - n = i << 2; - q = (n + d) | 0; - F[q >> 2] = - F[(j + n) >> 2] + F[q >> 2]; - q = n | 4; - u = (q + d) | 0; - F[u >> 2] = - F[(j + q) >> 2] + F[u >> 2]; - q = n | 8; - u = (q + d) | 0; - F[u >> 2] = - F[(j + q) >> 2] + F[u >> 2]; - n = n | 12; - q = (n + d) | 0; - F[q >> 2] = - F[(j + n) >> 2] + F[q >> 2]; - i = (i + 4) | 0; - p = (p + 4) | 0; - if ((K | 0) != (p | 0)) { - continue; - } - break; - } - } - if (!E) { - break y; - } - while (1) { - n = i << 2; - p = (n + d) | 0; - F[p >> 2] = - F[(j + n) >> 2] + F[p >> 2]; - i = (i + 1) | 0; - l = (l + 1) | 0; - if ((E | 0) != (l | 0)) { - continue; - } - break; - } - } - k = (k + 1) | 0; - if ((k | 0) != (g | 0)) { - continue; - } - break; - } - g = L(e, m); - if (!f) { - break o; - } - if (!e) { - break l; - } - i = 0; - d = 0; - if (G) { - break n; - } - break m; - } - g = L(e, m); - } - if (F[(a + 8) >> 2] <= 0) { - break k; - } - k = ((L((m - 1) | 0, e) << 2) + c) | 0; - j = F[x >> 2]; - i = 0; - while (1) { - d = i << 2; - f = F[(d + k) >> 2]; - l = F[(a + 16) >> 2]; - z: { - if ((f | 0) > (l | 0)) { - F[(d + j) >> 2] = l; - break z; - } - d = (d + j) | 0; - l = F[(a + 12) >> 2]; - if ((l | 0) > (f | 0)) { - F[d >> 2] = l; - break z; - } - F[d >> 2] = f; - } - i = (i + 1) | 0; - f = F[(a + 8) >> 2]; - if ((i | 0) < (f | 0)) { - continue; - } - break; - } - d = 0; - if ((f | 0) <= 0) { - break k; - } - f = g << 2; - i = (f + c) | 0; - k = (b + f) | 0; - while (1) { - g = d << 2; - f = (g + i) | 0; - g = (F[(g + k) >> 2] + F[(g + j) >> 2]) | 0; - F[f >> 2] = g; - A: { - if ((g | 0) > F[(a + 16) >> 2]) { - g = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break A; - } - g = (g + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = g; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - break k; - } - ta(); - v(); - } - while (1) { - j = i << 2; - k = (j + t) | 0; - F[k >> 2] = F[k >> 2] / (f | 0); - j = ((j | 4) + t) | 0; - F[j >> 2] = F[j >> 2] / (f | 0); - i = (i + 2) | 0; - d = (d + 2) | 0; - if ((C | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!D) { - break l; - } - d = ((i << 2) + t) | 0; - F[d >> 2] = F[d >> 2] / (f | 0); - } - if (F[(a + 8) >> 2] <= 0) { - break k; - } - j = F[x >> 2]; - i = 0; - while (1) { - d = i << 2; - f = F[(d + t) >> 2]; - k = F[(a + 16) >> 2]; - B: { - if ((f | 0) > (k | 0)) { - F[(d + j) >> 2] = k; - break B; - } - d = (d + j) | 0; - k = F[(a + 12) >> 2]; - if ((k | 0) > (f | 0)) { - F[d >> 2] = k; - break B; - } - F[d >> 2] = f; - } - i = (i + 1) | 0; - f = F[(a + 8) >> 2]; - if ((i | 0) < (f | 0)) { - continue; - } - break; - } - d = 0; - if ((f | 0) <= 0) { - break k; - } - f = g << 2; - i = (f + c) | 0; - k = (b + f) | 0; - while (1) { - g = d << 2; - f = (g + i) | 0; - g = (F[(g + k) >> 2] + F[(g + j) >> 2]) | 0; - F[f >> 2] = g; - C: { - if ((g | 0) > F[(a + 16) >> 2]) { - g = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break C; - } - g = (g + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = g; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - m = (m + 1) | 0; - z = (w | 0) <= (m | 0); - if ((m | 0) != (I | 0)) { - continue; - } - break; - } - } - a = F[h >> 2]; - if (a) { - ja(a); - } - ja(y); - a = F[(h + 52) >> 2]; - if (a) { - F[(h + 56) >> 2] = a; - ja(a); - } - a = F[(h + 40) >> 2]; - if (a) { - F[(h + 44) >> 2] = a; - ja(a); - } - a = F[(h + 28) >> 2]; - if (a) { - F[(h + 32) >> 2] = a; - ja(a); - } - a = F[(h + 16) >> 2]; - if (a) { - F[(h + 20) >> 2] = a; - ja(a); - } - Z = (h - -64) | 0; - return z | 0; - } - na(); - v(); - } - function Yh(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - E = 0, - H = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - U = 0, - V = 0, - W = 0, - X = 0, - Y = 0, - $ = 0, - aa = 0; - a: { - b: { - if ((e | 0) != 2) { - break b; - } - F[(a + 8) >> 2] = 2; - F[(a - -64) >> 2] = f; - M = (a + 32) | 0; - e = F[M >> 2]; - d = (F[(a + 36) >> 2] - e) | 0; - c: { - if (d >>> 0 <= 7) { - qa(M, (2 - ((d >>> 2) | 0)) | 0); - break c; - } - if ((d | 0) == 8) { - break c; - } - F[(a + 36) >> 2] = e + 8; - } - i = 1; - d = F[(a + 56) >> 2]; - d = (F[(d + 4) >> 2] - F[d >> 2]) | 0; - if ((d | 0) <= 0) { - break b; - } - o = (a + 60) | 0; - d = (d >>> 2) | 0; - X = d >>> 0 <= 1 ? 1 : d; - Y = (a + 68) | 0; - d = 0; - while (1) { - f = F[(a + 56) >> 2]; - e = F[f >> 2]; - if (((F[(f + 4) >> 2] - e) >> 2) >>> 0 <= d >>> 0) { - break a; - } - k = (Z - 80) | 0; - Z = k; - f = -1; - d: { - e: { - e = F[(e + (d << 2)) >> 2]; - if ((e | 0) == -1) { - break e; - } - i = F[(o + 32) >> 2]; - g = (e + 1) | 0; - g = ((g >>> 0) % 3) | 0 ? g : (e - 2) | 0; - if ((g | 0) != -1) { - f = F[(F[i >> 2] + (g << 2)) >> 2]; - } - p = -1; - e = (e + (((e >>> 0) % 3) | 0 ? -1 : 2)) | 0; - if ((e | 0) != -1) { - p = F[(F[i >> 2] + (e << 2)) >> 2]; - } - i = F[(o + 36) >> 2]; - e = F[i >> 2]; - i = (F[(i + 4) >> 2] - e) >> 2; - if ((i >>> 0 <= f >>> 0) | (i >>> 0 <= p >>> 0)) { - break e; - } - f: { - g: { - h: { - i: { - j: { - k: { - j = F[(e + (p << 2)) >> 2]; - f = F[(e + (f << 2)) >> 2]; - if ( - ((j | 0) >= (d | 0)) | - ((f | 0) >= (d | 0)) - ) { - break k; - } - i = ((j << 3) + c) | 0; - w = F[(i + 4) >> 2]; - g = ((f << 3) + c) | 0; - e = F[(g + 4) >> 2]; - l = F[i >> 2]; - i = F[g >> 2]; - if ( - !( - ((l | 0) != (i | 0)) | - ((e | 0) != (w | 0)) - ) - ) { - F[(o + 8) >> 2] = i; - F[(o + 12) >> 2] = e; - break j; - } - p = F[(F[(o + 4) >> 2] + (d << 2)) >> 2]; - F[(k + 72) >> 2] = 0; - F[(k + 76) >> 2] = 0; - g = (k - -64) | 0; - F[g >> 2] = 0; - F[(g + 4) >> 2] = 0; - F[(k + 56) >> 2] = 0; - F[(k + 60) >> 2] = 0; - g = F[o >> 2]; - if (!G[(g + 84) | 0]) { - p = - F[(F[(g + 68) >> 2] + (p << 2)) >> 2]; - } - Ga(g, p, D[(g + 24) | 0], (k + 56) | 0); - p = F[(F[(o + 4) >> 2] + (f << 2)) >> 2]; - F[(k + 48) >> 2] = 0; - F[(k + 52) >> 2] = 0; - F[(k + 40) >> 2] = 0; - F[(k + 44) >> 2] = 0; - F[(k + 32) >> 2] = 0; - F[(k + 36) >> 2] = 0; - g = F[o >> 2]; - if (!G[(g + 84) | 0]) { - p = - F[(F[(g + 68) >> 2] + (p << 2)) >> 2]; - } - Ga(g, p, D[(g + 24) | 0], (k + 32) | 0); - p = F[(F[(o + 4) >> 2] + (j << 2)) >> 2]; - F[(k + 24) >> 2] = 0; - F[(k + 28) >> 2] = 0; - F[(k + 16) >> 2] = 0; - F[(k + 20) >> 2] = 0; - F[(k + 8) >> 2] = 0; - F[(k + 12) >> 2] = 0; - g = F[o >> 2]; - if (!G[(g + 84) | 0]) { - p = - F[(F[(g + 68) >> 2] + (p << 2)) >> 2]; - } - Ga(g, p, D[(g + 24) | 0], (k + 8) | 0); - g = F[(k + 16) >> 2]; - n = F[(k + 40) >> 2]; - x = (g - n) | 0; - N = F[(k + 44) >> 2]; - g = - (F[(k + 20) >> 2] - - ((N + (g >>> 0 < n >>> 0)) | 0)) | - 0; - H = g; - j = ki(x, g, x, g); - q = _; - g = F[(k + 8) >> 2]; - z = F[(k + 32) >> 2]; - A = (g - z) | 0; - O = F[(k + 36) >> 2]; - g = - (F[(k + 12) >> 2] - - ((O + (g >>> 0 < z >>> 0)) | 0)) | - 0; - I = g; - h = j; - j = ki(A, g, A, g); - g = (h + j) | 0; - h = (_ + q) | 0; - h = g >>> 0 < j >>> 0 ? (h + 1) | 0 : h; - j = F[(k + 24) >> 2]; - B = F[(k + 48) >> 2]; - C = (j - B) | 0; - P = F[(k + 52) >> 2]; - j = - (F[(k + 28) >> 2] - - ((P + (j >>> 0 < B >>> 0)) | 0)) | - 0; - J = j; - m = g; - g = ki(C, j, C, j); - r = (m + g) | 0; - h = (_ + h) | 0; - s = g >>> 0 > r >>> 0 ? (h + 1) | 0 : h; - if (!(s | r)) { - break k; - } - p = 0; - E = mi(-1, 2147483647, r, s); - f = i >> 31; - R = f; - h = f >> 31; - Q = i; - g = h; - q = i ^ g; - i = (q - g) | 0; - f = - ((f ^ g) - - (((g >>> 0 > q >>> 0) + g) | 0)) | - 0; - g = f; - f = e >> 31; - S = f; - K = e; - e = f >> 31; - q = K ^ e; - m = (q - e) | 0; - h = f >> 31; - e = - ((h ^ f) - - (((e >>> 0 > q >>> 0) + h) | 0)) | - 0; - f = - (((g | 0) == (e | 0)) & - (i >>> 0 > m >>> 0)) | - (e >>> 0 < g >>> 0); - i = f ? i : m; - j = _; - e = f ? g : e; - if ( - (((j | 0) == (e | 0)) & - (i >>> 0 > E >>> 0)) | - (e >>> 0 > j >>> 0) - ) { - break f; - } - i = F[(k + 64) >> 2]; - T = F[(k + 68) >> 2]; - e = ki( - (i - n) | 0, - (T - (((i >>> 0 < n >>> 0) + N) | 0)) | - 0, - x, - H, - ); - f = _; - g = F[(k + 56) >> 2]; - U = F[(k + 60) >> 2]; - j = ki( - (g - z) | 0, - (U - (((g >>> 0 < z >>> 0) + O) | 0)) | - 0, - A, - I, - ); - e = (j + e) | 0; - h = (_ + f) | 0; - h = e >>> 0 < j >>> 0 ? (h + 1) | 0 : h; - f = e; - m = F[(k + 72) >> 2]; - V = F[(k + 76) >> 2]; - e = ki( - (m - B) | 0, - (V - (((m >>> 0 < B >>> 0) + P) | 0)) | - 0, - C, - J, - ); - j = (f + e) | 0; - f = (_ + h) | 0; - q = e >>> 0 > j >>> 0 ? (f + 1) | 0 : f; - e = l; - E = (e - Q) | 0; - e = - ((e >> 31) - - (((e >>> 0 < Q >>> 0) + R) | 0)) | - 0; - W = e; - l = e >> 31; - y = l ^ E; - f = (y - l) | 0; - h = e >> 31; - e = - ((h ^ e) - - (((l >>> 0 > y >>> 0) + h) | 0)) | - 0; - h = e; - y = (w - K) | 0; - e = - ((w >> 31) - - (((w >>> 0 < K >>> 0) + S) | 0)) | - 0; - w = e; - l = f; - t = e >> 31; - u = t ^ y; - L = (u - t) | 0; - f = e >> 31; - e = - ((f ^ e) - - (((t >>> 0 > u >>> 0) + f) | 0)) | - 0; - f = - (((h | 0) == (e | 0)) & - (l >>> 0 > L >>> 0)) | - (e >>> 0 < h >>> 0); - f = - mi( - -1, - 2147483647, - f ? l : L, - f ? h : e, - ) >>> - 0 < - j >>> 0; - e = _; - if ( - (f & ((e | 0) <= (q | 0))) | - ((e | 0) < (q | 0)) - ) { - break f; - } - e = I >> 31; - f = e; - l = e ^ A; - e = (l - e) | 0; - f = - ((f ^ I) - - (((f >>> 0 > l >>> 0) + f) | 0)) | - 0; - h = H >> 31; - t = h ^ x; - u = (t - h) | 0; - l = - ((h ^ H) - - (((h >>> 0 > t >>> 0) + h) | 0)) | - 0; - h = - (((f | 0) == (l | 0)) & - (e >>> 0 > u >>> 0)) | - (f >>> 0 > l >>> 0); - e = h ? e : u; - f = h ? f : l; - h = J >> 31; - L = e; - t = h ^ C; - u = (t - h) | 0; - l = - ((h ^ J) - - (((h >>> 0 > t >>> 0) + h) | 0)) | - 0; - e = - (((f | 0) == (l | 0)) & - (e >>> 0 > u >>> 0)) | - (f >>> 0 > l >>> 0); - f = - mi( - -1, - 2147483647, - e ? L : u, - e ? f : l, - ) >>> - 0 < - j >>> 0; - e = _; - if ( - (f & ((e | 0) <= (q | 0))) | - ((e | 0) < (q | 0)) - ) { - break f; - } - l = 1; - e = 0; - f = n; - n = li(ki(j, q, x, H), _, r, s); - f = (f + n) | 0; - h = (_ + N) | 0; - h = f >>> 0 < n >>> 0 ? (h + 1) | 0 : h; - n = (i - f) | 0; - f = - (T - (((f >>> 0 > i >>> 0) + h) | 0)) | - 0; - n = ki(n, f, n, f); - x = _; - f = g; - h = li(ki(j, q, A, I), _, r, s); - i = (h + z) | 0; - g = (_ + O) | 0; - g = h >>> 0 > i >>> 0 ? (g + 1) | 0 : g; - h = (f - i) | 0; - f = - (U - (((f >>> 0 < i >>> 0) + g) | 0)) | - 0; - g = ki(h, f, h, f); - i = (g + n) | 0; - f = (_ + x) | 0; - f = g >>> 0 > i >>> 0 ? (f + 1) | 0 : f; - n = i; - g = li(ki(j, q, C, J), _, r, s); - i = (g + B) | 0; - h = (_ + P) | 0; - h = g >>> 0 > i >>> 0 ? (h + 1) | 0 : h; - g = (m - i) | 0; - i = - (V - (((i >>> 0 > m >>> 0) + h) | 0)) | - 0; - m = ki(g, i, g, i); - i = (m + n) | 0; - g = (_ + f) | 0; - f = ki( - i, - i >>> 0 < m >>> 0 ? (g + 1) | 0 : g, - r, - s, - ); - i = _; - m = i; - if (!i & (f >>> 0 <= 1)) { - break i; - } - h = f; - while (1) { - g = (e << 1) | (l >>> 31); - l = l << 1; - e = g; - n = - (!i & (h >>> 0 > 7)) | ((i | 0) != 0); - h = ((i & 3) << 30) | (h >>> 2); - i = (i >>> 2) | 0; - if (n) { - continue; - } - break; - } - break h; - } - if ((d | 0) > (f | 0)) { - e = f << 1; - } else { - if ((d | 0) <= 0) { - F[(o + 8) >> 2] = 0; - F[(o + 12) >> 2] = 0; - break j; - } - e = ((d << 1) - 2) | 0; - } - e = ((e << 2) + c) | 0; - F[(o + 8) >> 2] = F[e >> 2]; - F[(o + 12) >> 2] = F[(e + 4) >> 2]; - } - p = 1; - break f; - } - e = m; - l = f; - if ((f - 1) | 0) { - break g; - } - } - while (1) { - i = mi(f, m, l, e); - h = (e + _) | 0; - e = (i + l) | 0; - h = e >>> 0 < l >>> 0 ? (h + 1) | 0 : h; - l = ((h & 1) << 31) | (e >>> 1); - e = (h >>> 1) | 0; - i = ki(l, e, l, e); - g = _; - if ( - (((m | 0) == (g | 0)) & (f >>> 0 < i >>> 0)) | - (g >>> 0 > m >>> 0) - ) { - continue; - } - break; - } - } - f = F[(o + 20) >> 2]; - if (!f) { - break f; - } - g = (f - 1) | 0; - h = - F[ - (F[(o + 16) >> 2] + ((g >>> 3) & 536870908)) >> - 2 - ]; - F[(o + 20) >> 2] = g; - p = 1; - f = ki(j, q, y, w); - i = _; - n = ki(r, s, K, S); - m = (n + f) | 0; - f = (_ + i) | 0; - f = m >>> 0 < n >>> 0 ? (f + 1) | 0 : f; - i = ki(l, e, E, W); - g = (h >>> g) & 1; - h = g ? (0 - i) | 0 : i; - m = (h + m) | 0; - n = f; - f = _; - i = - (n + - (g - ? (0 - ((f + ((i | 0) != 0)) | 0)) | 0 - : f)) | - 0; - ($ = o), - (aa = li( - m, - h >>> 0 > m >>> 0 ? (i + 1) | 0 : i, - r, - s, - )), - (F[($ + 12) >> 2] = aa); - f = ki(j, q, E, W); - i = _; - j = ki(r, s, Q, R); - f = (j + f) | 0; - h = (_ + i) | 0; - e = ki(l, e, y, w); - i = (0 - e) | 0; - l = _; - h = - ((f >>> 0 < j >>> 0 ? (h + 1) | 0 : h) + - (g - ? l - : (0 - ((((e | 0) != 0) + l) | 0)) | 0)) | - 0; - i = g ? e : i; - f = (i + f) | 0; - ($ = o), - (aa = li( - f, - f >>> 0 < i >>> 0 ? (h + 1) | 0 : h, - r, - s, - )), - (F[($ + 8) >> 2] = aa); - } - Z = (k + 80) | 0; - e = p; - break d; - } - ta(); - v(); - } - i = e; - if (!e) { - return 0; - } - l: { - if (F[(a + 8) >> 2] <= 0) { - break l; - } - l = F[M >> 2]; - e = 0; - while (1) { - f = e << 2; - g = F[(f + Y) >> 2]; - j = F[(a + 16) >> 2]; - m: { - if ((g | 0) > (j | 0)) { - F[(f + l) >> 2] = j; - break m; - } - f = (f + l) | 0; - j = F[(a + 12) >> 2]; - if ((j | 0) > (g | 0)) { - F[f >> 2] = j; - break m; - } - F[f >> 2] = g; - } - e = (e + 1) | 0; - g = F[(a + 8) >> 2]; - if ((e | 0) < (g | 0)) { - continue; - } - break; - } - f = 0; - if ((g | 0) <= 0) { - break l; - } - e = d << 3; - j = (e + c) | 0; - q = (b + e) | 0; - while (1) { - g = f << 2; - e = (g + j) | 0; - g = (F[(g + q) >> 2] + F[(g + l) >> 2]) | 0; - F[e >> 2] = g; - n: { - if ((g | 0) > F[(a + 16) >> 2]) { - g = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break n; - } - g = (g + F[(a + 20) >> 2]) | 0; - } - F[e >> 2] = g; - } - f = (f + 1) | 0; - if ((f | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - d = (d + 1) | 0; - if ((X | 0) != (d | 0)) { - continue; - } - break; - } - } - return i | 0; - } - ta(); - v(); - } - function hi(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0, - z = 0, - A = 0, - B = 0, - C = 0, - E = 0, - H = 0, - I = 0, - J = 0, - K = 0, - L = 0, - M = 0, - N = 0, - O = 0, - P = 0, - Q = 0, - R = 0, - S = 0, - T = 0, - U = 0, - V = 0, - W = 0, - X = 0, - Y = 0, - $ = 0, - aa = 0; - a: { - b: { - if ((e | 0) != 2) { - break b; - } - F[(a + 8) >> 2] = 2; - F[(a - -64) >> 2] = f; - M = (a + 32) | 0; - e = F[M >> 2]; - d = (F[(a + 36) >> 2] - e) | 0; - c: { - if (d >>> 0 <= 7) { - qa(M, (2 - ((d >>> 2) | 0)) | 0); - break c; - } - if ((d | 0) == 8) { - break c; - } - F[(a + 36) >> 2] = e + 8; - } - p = 1; - d = F[(a + 56) >> 2]; - d = (F[(d + 4) >> 2] - F[d >> 2]) | 0; - if ((d | 0) <= 0) { - break b; - } - o = (a + 60) | 0; - d = (d >>> 2) | 0; - X = d >>> 0 <= 1 ? 1 : d; - Y = (a + 68) | 0; - d = 0; - while (1) { - e = F[(a + 56) >> 2]; - h = F[e >> 2]; - if (((F[(e + 4) >> 2] - h) >> 2) >>> 0 <= d >>> 0) { - break a; - } - k = (Z - 80) | 0; - Z = k; - f = -1; - h = F[(h + (d << 2)) >> 2]; - e = -1; - d: { - if ((h | 0) == -1) { - break d; - } - e = (h + 1) | 0; - f = ((e >>> 0) % 3) | 0 ? e : (h - 2) | 0; - e = (h - 1) | 0; - if (((h >>> 0) % 3) | 0) { - break d; - } - e = (h + 2) | 0; - } - g = F[(o + 36) >> 2]; - h = F[g >> 2]; - e: { - f: { - g: { - h: { - i: { - g = (F[(g + 4) >> 2] - h) >> 2; - i = f << 2; - f = F[(F[(o + 32) >> 2] + 28) >> 2]; - j = F[(i + f) >> 2]; - if (g >>> 0 <= j >>> 0) { - break i; - } - e = F[(f + (e << 2)) >> 2]; - if (e >>> 0 >= g >>> 0) { - break i; - } - j: { - k: { - l = F[(h + (e << 2)) >> 2]; - f = F[(h + (j << 2)) >> 2]; - if ( - ((l | 0) >= (d | 0)) | - ((f | 0) >= (d | 0)) - ) { - break k; - } - h = ((l << 3) + c) | 0; - w = F[(h + 4) >> 2]; - g = ((f << 3) + c) | 0; - e = F[(g + 4) >> 2]; - j = F[h >> 2]; - h = F[g >> 2]; - if ( - !( - ((j | 0) != (h | 0)) | - ((e | 0) != (w | 0)) - ) - ) { - F[(o + 8) >> 2] = h; - F[(o + 12) >> 2] = e; - break j; - } - p = F[(F[(o + 4) >> 2] + (d << 2)) >> 2]; - F[(k + 72) >> 2] = 0; - F[(k + 76) >> 2] = 0; - g = (k - -64) | 0; - F[g >> 2] = 0; - F[(g + 4) >> 2] = 0; - F[(k + 56) >> 2] = 0; - F[(k + 60) >> 2] = 0; - g = F[o >> 2]; - if (!G[(g + 84) | 0]) { - p = F[(F[(g + 68) >> 2] + (p << 2)) >> 2]; - } - Ga(g, p, D[(g + 24) | 0], (k + 56) | 0); - p = F[(F[(o + 4) >> 2] + (f << 2)) >> 2]; - F[(k + 48) >> 2] = 0; - F[(k + 52) >> 2] = 0; - F[(k + 40) >> 2] = 0; - F[(k + 44) >> 2] = 0; - F[(k + 32) >> 2] = 0; - F[(k + 36) >> 2] = 0; - g = F[o >> 2]; - if (!G[(g + 84) | 0]) { - p = F[(F[(g + 68) >> 2] + (p << 2)) >> 2]; - } - Ga(g, p, D[(g + 24) | 0], (k + 32) | 0); - p = F[(F[(o + 4) >> 2] + (l << 2)) >> 2]; - F[(k + 24) >> 2] = 0; - F[(k + 28) >> 2] = 0; - F[(k + 16) >> 2] = 0; - F[(k + 20) >> 2] = 0; - F[(k + 8) >> 2] = 0; - F[(k + 12) >> 2] = 0; - g = F[o >> 2]; - if (!G[(g + 84) | 0]) { - p = F[(F[(g + 68) >> 2] + (p << 2)) >> 2]; - } - Ga(g, p, D[(g + 24) | 0], (k + 8) | 0); - g = F[(k + 16) >> 2]; - n = F[(k + 40) >> 2]; - x = (g - n) | 0; - N = F[(k + 44) >> 2]; - g = - (F[(k + 20) >> 2] - - ((N + (g >>> 0 < n >>> 0)) | 0)) | - 0; - H = g; - l = ki(x, g, x, g); - q = _; - g = F[(k + 8) >> 2]; - z = F[(k + 32) >> 2]; - A = (g - z) | 0; - O = F[(k + 36) >> 2]; - g = - (F[(k + 12) >> 2] - - ((O + (g >>> 0 < z >>> 0)) | 0)) | - 0; - I = g; - i = l; - l = ki(A, g, A, g); - g = (i + l) | 0; - i = (_ + q) | 0; - i = g >>> 0 < l >>> 0 ? (i + 1) | 0 : i; - l = F[(k + 24) >> 2]; - B = F[(k + 48) >> 2]; - C = (l - B) | 0; - P = F[(k + 52) >> 2]; - l = - (F[(k + 28) >> 2] - - ((P + (l >>> 0 < B >>> 0)) | 0)) | - 0; - J = l; - m = g; - g = ki(C, l, C, l); - r = (m + g) | 0; - i = (_ + i) | 0; - s = g >>> 0 > r >>> 0 ? (i + 1) | 0 : i; - if (!(s | r)) { - break k; - } - p = 0; - E = mi(-1, 2147483647, r, s); - f = h >> 31; - R = f; - i = f >> 31; - Q = h; - g = i; - q = h ^ g; - h = (q - g) | 0; - f = - ((f ^ g) - - (((g >>> 0 > q >>> 0) + g) | 0)) | - 0; - g = f; - f = e >> 31; - S = f; - K = e; - e = f >> 31; - q = K ^ e; - m = (q - e) | 0; - i = f >> 31; - e = - ((i ^ f) - - (((e >>> 0 > q >>> 0) + i) | 0)) | - 0; - f = - (((g | 0) == (e | 0)) & - (h >>> 0 > m >>> 0)) | - (e >>> 0 < g >>> 0); - h = f ? h : m; - l = _; - e = f ? g : e; - if ( - (((l | 0) == (e | 0)) & - (h >>> 0 > E >>> 0)) | - (e >>> 0 > l >>> 0) - ) { - break e; - } - h = F[(k + 64) >> 2]; - T = F[(k + 68) >> 2]; - e = ki( - (h - n) | 0, - (T - (((h >>> 0 < n >>> 0) + N) | 0)) | 0, - x, - H, - ); - f = _; - g = F[(k + 56) >> 2]; - U = F[(k + 60) >> 2]; - l = ki( - (g - z) | 0, - (U - (((g >>> 0 < z >>> 0) + O) | 0)) | 0, - A, - I, - ); - e = (l + e) | 0; - i = (_ + f) | 0; - i = e >>> 0 < l >>> 0 ? (i + 1) | 0 : i; - f = e; - m = F[(k + 72) >> 2]; - V = F[(k + 76) >> 2]; - e = ki( - (m - B) | 0, - (V - (((m >>> 0 < B >>> 0) + P) | 0)) | 0, - C, - J, - ); - l = (f + e) | 0; - f = (_ + i) | 0; - q = e >>> 0 > l >>> 0 ? (f + 1) | 0 : f; - e = j; - E = (e - Q) | 0; - e = - ((e >> 31) - - (((e >>> 0 < Q >>> 0) + R) | 0)) | - 0; - W = e; - j = e >> 31; - y = j ^ E; - f = (y - j) | 0; - i = e >> 31; - e = - ((i ^ e) - - (((j >>> 0 > y >>> 0) + i) | 0)) | - 0; - i = e; - y = (w - K) | 0; - e = - ((w >> 31) - - (((w >>> 0 < K >>> 0) + S) | 0)) | - 0; - w = e; - j = f; - t = e >> 31; - u = t ^ y; - L = (u - t) | 0; - f = e >> 31; - e = - ((f ^ e) - - (((t >>> 0 > u >>> 0) + f) | 0)) | - 0; - f = - (((i | 0) == (e | 0)) & - (j >>> 0 > L >>> 0)) | - (e >>> 0 < i >>> 0); - f = - mi( - -1, - 2147483647, - f ? j : L, - f ? i : e, - ) >>> - 0 < - l >>> 0; - e = _; - if ( - (f & ((e | 0) <= (q | 0))) | - ((e | 0) < (q | 0)) - ) { - break e; - } - e = I >> 31; - f = e; - j = e ^ A; - e = (j - e) | 0; - f = - ((f ^ I) - - (((f >>> 0 > j >>> 0) + f) | 0)) | - 0; - i = H >> 31; - t = i ^ x; - u = (t - i) | 0; - j = - ((i ^ H) - - (((i >>> 0 > t >>> 0) + i) | 0)) | - 0; - i = - (((f | 0) == (j | 0)) & - (e >>> 0 > u >>> 0)) | - (f >>> 0 > j >>> 0); - e = i ? e : u; - f = i ? f : j; - i = J >> 31; - L = e; - t = i ^ C; - u = (t - i) | 0; - j = - ((i ^ J) - - (((i >>> 0 > t >>> 0) + i) | 0)) | - 0; - e = - (((f | 0) == (j | 0)) & - (e >>> 0 > u >>> 0)) | - (f >>> 0 > j >>> 0); - f = - mi( - -1, - 2147483647, - e ? L : u, - e ? f : j, - ) >>> - 0 < - l >>> 0; - e = _; - if ( - (f & ((e | 0) <= (q | 0))) | - ((e | 0) < (q | 0)) - ) { - break e; - } - j = 1; - e = 0; - f = n; - n = li(ki(l, q, x, H), _, r, s); - f = (f + n) | 0; - i = (_ + N) | 0; - i = f >>> 0 < n >>> 0 ? (i + 1) | 0 : i; - n = (h - f) | 0; - f = - (T - (((f >>> 0 > h >>> 0) + i) | 0)) | 0; - n = ki(n, f, n, f); - x = _; - f = g; - i = li(ki(l, q, A, I), _, r, s); - h = (i + z) | 0; - g = (_ + O) | 0; - g = h >>> 0 < i >>> 0 ? (g + 1) | 0 : g; - i = (f - h) | 0; - f = - (U - (((f >>> 0 < h >>> 0) + g) | 0)) | 0; - g = ki(i, f, i, f); - h = (g + n) | 0; - f = (_ + x) | 0; - f = h >>> 0 < g >>> 0 ? (f + 1) | 0 : f; - n = h; - g = li(ki(l, q, C, J), _, r, s); - h = (g + B) | 0; - i = (_ + P) | 0; - i = h >>> 0 < g >>> 0 ? (i + 1) | 0 : i; - g = (m - h) | 0; - h = - (V - (((h >>> 0 > m >>> 0) + i) | 0)) | 0; - m = ki(g, h, g, h); - h = (m + n) | 0; - g = (_ + f) | 0; - f = ki( - h, - h >>> 0 < m >>> 0 ? (g + 1) | 0 : g, - r, - s, - ); - h = _; - m = h; - if (!h & (f >>> 0 <= 1)) { - break h; - } - i = f; - while (1) { - g = (e << 1) | (j >>> 31); - j = j << 1; - e = g; - n = (!h & (i >>> 0 > 7)) | ((h | 0) != 0); - i = ((h & 3) << 30) | (i >>> 2); - h = (h >>> 2) | 0; - if (n) { - continue; - } - break; - } - break g; - } - if ((d | 0) > (f | 0)) { - e = f << 1; - } else { - if ((d | 0) <= 0) { - F[(o + 8) >> 2] = 0; - F[(o + 12) >> 2] = 0; - break j; - } - e = ((d << 1) - 2) | 0; - } - e = ((e << 2) + c) | 0; - F[(o + 8) >> 2] = F[e >> 2]; - F[(o + 12) >> 2] = F[(e + 4) >> 2]; - } - p = 1; - break e; - } - ta(); - v(); - } - e = m; - j = f; - if ((f - 1) | 0) { - break f; - } - } - while (1) { - h = mi(f, m, j, e); - i = (e + _) | 0; - e = (h + j) | 0; - i = e >>> 0 < j >>> 0 ? (i + 1) | 0 : i; - j = ((i & 1) << 31) | (e >>> 1); - e = (i >>> 1) | 0; - h = ki(j, e, j, e); - g = _; - if ( - (((m | 0) == (g | 0)) & (f >>> 0 < h >>> 0)) | - (g >>> 0 > m >>> 0) - ) { - continue; - } - break; - } - } - f = F[(o + 20) >> 2]; - if (!f) { - break e; - } - g = (f - 1) | 0; - i = - F[(F[(o + 16) >> 2] + ((g >>> 3) & 536870908)) >> 2]; - F[(o + 20) >> 2] = g; - p = 1; - f = ki(l, q, y, w); - h = _; - n = ki(r, s, K, S); - m = (n + f) | 0; - f = (_ + h) | 0; - f = m >>> 0 < n >>> 0 ? (f + 1) | 0 : f; - h = ki(j, e, E, W); - g = (i >>> g) & 1; - i = g ? (0 - h) | 0 : h; - m = (i + m) | 0; - n = f; - f = _; - h = - (n + (g ? (0 - ((f + ((h | 0) != 0)) | 0)) | 0 : f)) | - 0; - ($ = o), - (aa = li( - m, - i >>> 0 > m >>> 0 ? (h + 1) | 0 : h, - r, - s, - )), - (F[($ + 12) >> 2] = aa); - f = ki(l, q, E, W); - h = _; - l = ki(r, s, Q, R); - f = (l + f) | 0; - i = (_ + h) | 0; - e = ki(j, e, y, w); - h = (0 - e) | 0; - j = _; - i = - ((f >>> 0 < l >>> 0 ? (i + 1) | 0 : i) + - (g ? j : (0 - ((((e | 0) != 0) + j) | 0)) | 0)) | - 0; - h = g ? e : h; - f = (h + f) | 0; - ($ = o), - (aa = li( - f, - f >>> 0 < h >>> 0 ? (i + 1) | 0 : i, - r, - s, - )), - (F[($ + 8) >> 2] = aa); - } - Z = (k + 80) | 0; - if (!p) { - return 0; - } - l: { - if (F[(a + 8) >> 2] <= 0) { - break l; - } - g = F[M >> 2]; - e = 0; - while (1) { - f = e << 2; - h = F[(f + Y) >> 2]; - j = F[(a + 16) >> 2]; - m: { - if ((h | 0) > (j | 0)) { - F[(f + g) >> 2] = j; - break m; - } - f = (f + g) | 0; - j = F[(a + 12) >> 2]; - if ((j | 0) > (h | 0)) { - F[f >> 2] = j; - break m; - } - F[f >> 2] = h; - } - e = (e + 1) | 0; - h = F[(a + 8) >> 2]; - if ((e | 0) < (h | 0)) { - continue; - } - break; - } - f = 0; - if ((h | 0) <= 0) { - break l; - } - e = d << 3; - j = (e + c) | 0; - l = (b + e) | 0; - while (1) { - h = f << 2; - e = (h + j) | 0; - h = (F[(h + l) >> 2] + F[(h + g) >> 2]) | 0; - F[e >> 2] = h; - n: { - if ((h | 0) > F[(a + 16) >> 2]) { - i = (h - F[(a + 20) >> 2]) | 0; - } else { - if ((h | 0) >= F[(a + 12) >> 2]) { - break n; - } - i = (h + F[(a + 20) >> 2]) | 0; - } - F[e >> 2] = i; - } - f = (f + 1) | 0; - if ((f | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - d = (d + 1) | 0; - if ((X | 0) != (d | 0)) { - continue; - } - break; - } - } - return p | 0; - } - ta(); - v(); - } - function Gd(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0; - n = (Z - 96) | 0; - Z = n; - m = F[(a + 4) >> 2]; - d = F[(m + 32) >> 2]; - j = F[(d + 8) >> 2]; - i = F[(d + 12) >> 2]; - e = i; - c = F[(d + 20) >> 2]; - f = F[(d + 16) >> 2]; - a: { - if ( - (((e | 0) <= (c | 0)) & (f >>> 0 >= j >>> 0)) | - ((c | 0) > (e | 0)) - ) { - break a; - } - o = F[d >> 2]; - h = G[(o + f) | 0]; - g = (f + 1) | 0; - e = g ? c : (c + 1) | 0; - F[(d + 16) >> 2] = g; - F[(d + 20) >> 2] = e; - if ( - (((e | 0) >= (i | 0)) & (g >>> 0 >= j >>> 0)) | - ((e | 0) > (i | 0)) - ) { - break a; - } - p = G[(g + o) | 0]; - g = (f + 2) | 0; - e = g >>> 0 < 2 ? (c + 1) | 0 : c; - F[(d + 16) >> 2] = g; - F[(d + 20) >> 2] = e; - l = (h << 24) >> 24; - b: { - if ((l | 0) >= 0) { - k = F[(a + 216) >> 2]; - if ( - h >>> 0 >= - (((F[(a + 220) >> 2] - k) | 0) / 144) >>> 0 - ) { - break a; - } - k = (k + L(h, 144)) | 0; - if (F[k >> 2] < 0) { - break b; - } - break a; - } - if (F[(a + 212) >> 2] >= 0) { - break a; - } - k = (a + 212) | 0; - } - F[k >> 2] = b; - c: { - d: { - e: { - f: { - g: { - h: { - k = H[(m + 36) >> 1]; - i: { - if ( - (((k << 8) | (k >>> 8)) & 65535) >>> 0 >= - 258 - ) { - if ( - (((e | 0) >= (i | 0)) & - (g >>> 0 >= j >>> 0)) | - ((e | 0) > (i | 0)) - ) { - break a; - } - e = G[(g + o) | 0]; - f = (f + 3) | 0; - c = f >>> 0 < 3 ? (c + 1) | 0 : c; - F[(d + 16) >> 2] = f; - F[(d + 20) >> 2] = c; - if (e >>> 0 > 1) { - break a; - } - d = e >>> 0 < 2 ? e : 0; - if (!p) { - break i; - } - if (!d) { - break h; - } - break a; - } - if (p) { - break g; - } - d = 0; - } - if ((l | 0) < 0) { - e = (a + 184) | 0; - } else { - c = (F[(a + 216) >> 2] + L(h, 144)) | 0; - D[(c + 100) | 0] = 0; - e = (c + 104) | 0; - } - if ((d | 0) != 1) { - break e; - } - c = (Z - 112) | 0; - Z = c; - g = F[(F[(a + 4) >> 2] + 44) >> 2]; - d = ka(120); - F[d >> 2] = 8924; - F[(d + 4) >> 2] = 0; - F[(d + 116) >> 2] = 0; - F[(d + 112) >> 2] = e; - F[(d + 108) >> 2] = g; - F[(d + 12) >> 2] = 0; - F[(d + 16) >> 2] = 0; - F[(d + 20) >> 2] = 0; - F[(d + 24) >> 2] = 0; - F[(d + 28) >> 2] = 0; - F[(d + 32) >> 2] = 0; - F[(d + 36) >> 2] = 0; - F[(d + 40) >> 2] = 0; - F[(d + 44) >> 2] = 0; - F[(d + 48) >> 2] = 0; - F[(d + 52) >> 2] = 0; - F[(d + 56) >> 2] = 0; - F[(d + 60) >> 2] = 0; - F[(d + 8) >> 2] = 9136; - f = (d - -64) | 0; - F[f >> 2] = 0; - F[(f + 4) >> 2] = 0; - F[(d + 72) >> 2] = 0; - F[(d + 76) >> 2] = 0; - F[(d + 80) >> 2] = 0; - F[(d + 84) >> 2] = 0; - F[(d + 88) >> 2] = 0; - F[(d + 104) >> 2] = 0; - F[(d + 96) >> 2] = 0; - F[(d + 100) >> 2] = 0; - f = F[(a + 8) >> 2]; - F[(c + 48) >> 2] = 0; - F[(c + 52) >> 2] = 0; - F[(c + 40) >> 2] = 0; - F[(c + 44) >> 2] = 0; - j = (c + 32) | 0; - F[j >> 2] = 0; - F[(j + 4) >> 2] = 0; - F[(c + 24) >> 2] = 0; - F[(c + 28) >> 2] = 0; - h = (c - -64) | 0; - F[h >> 2] = 0; - F[(h + 4) >> 2] = 0; - F[(c + 72) >> 2] = 0; - F[(c + 76) >> 2] = 0; - F[(c + 80) >> 2] = 0; - F[(c + 84) >> 2] = 0; - F[(c + 88) >> 2] = 0; - F[(c + 104) >> 2] = 0; - F[(c + 16) >> 2] = 0; - F[(c + 20) >> 2] = 0; - F[(c + 56) >> 2] = 0; - F[(c + 60) >> 2] = 0; - F[(c + 8) >> 2] = 9136; - F[(c + 96) >> 2] = 0; - F[(c + 100) >> 2] = 0; - F[(c + 12) >> 2] = f; - h = F[f >> 2]; - i = F[(f + 4) >> 2]; - D[(c + 111) | 0] = 0; - k = j; - j = (c + 111) | 0; - Ea(k, ((((i - h) >> 2) >>> 0) / 3) | 0, j); - h = F[(c + 12) >> 2]; - i = F[(h + 28) >> 2]; - h = F[(h + 24) >> 2]; - D[(c + 111) | 0] = 0; - Ea((c + 44) | 0, (i - h) >> 2, j); - F[(c + 28) >> 2] = d; - F[(c + 24) >> 2] = g; - F[(c + 20) >> 2] = e; - F[(c + 16) >> 2] = f; - f = (d + 8) | 0; - e = (c + 8) | 0; - lc(f, e); - j: { - if ((e | 0) == (f | 0)) { - F[(d + 92) >> 2] = F[(e + 84) >> 2]; - break j; - } - gb( - (d + 56) | 0, - F[(e + 48) >> 2], - F[(e + 52) >> 2], - ); - gb( - (d + 68) | 0, - F[(e + 60) >> 2], - F[(e - -64) >> 2], - ); - gb( - (d + 80) | 0, - F[(e + 72) >> 2], - F[(e + 76) >> 2], - ); - F[(d + 92) >> 2] = F[(e + 84) >> 2]; - k: { - h = F[(e + 92) >> 2]; - j = F[(e + 88) >> 2]; - i = (h - j) | 0; - e = i >> 2; - f = F[(d + 104) >> 2]; - g = F[(d + 96) >> 2]; - if (e >>> 0 <= ((f - g) >> 2) >>> 0) { - i = (F[(d + 100) >> 2] - g) | 0; - f = (i + j) | 0; - m = i >> 2; - i = e >>> 0 > m >>> 0 ? f : h; - l = (i - j) | 0; - if ((i | 0) != (j | 0)) { - pa(g, j, l); - } - if (e >>> 0 > m >>> 0) { - e = F[(d + 100) >> 2]; - if ((h | 0) != (i | 0)) { - while (1) { - F[e >> 2] = F[f >> 2]; - e = (e + 4) | 0; - f = (f + 4) | 0; - if ((h | 0) != (f | 0)) { - continue; - } - break; - } - } - F[(d + 100) >> 2] = e; - break k; - } - F[(d + 100) >> 2] = g + l; - break k; - } - if (g) { - F[(d + 100) >> 2] = g; - ja(g); - F[(d + 104) >> 2] = 0; - F[(d + 96) >> 2] = 0; - F[(d + 100) >> 2] = 0; - f = 0; - } - l: { - if ((i | 0) < 0) { - break l; - } - g = (f >>> 1) | 0; - e = - f >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 < g >>> 0 - ? g - : e; - if (e >>> 0 >= 1073741824) { - break l; - } - f = e << 2; - e = ka(f); - F[(d + 96) >> 2] = e; - F[(d + 104) >> 2] = e + f; - if ((h | 0) != (j | 0)) { - f = e; - e = (((i - 4) & -4) + 4) | 0; - e = (la(f, j, e) + e) | 0; - } - F[(d + 100) >> 2] = e; - break k; - } - na(); - v(); - } - } - F[(c + 8) >> 2] = 9136; - e = F[(c + 96) >> 2]; - if (e) { - F[(c + 100) >> 2] = e; - ja(e); - } - e = F[(c + 80) >> 2]; - if (e) { - F[(c + 84) >> 2] = e; - ja(e); - } - e = F[(c + 68) >> 2]; - if (e) { - F[(c + 72) >> 2] = e; - ja(e); - } - e = F[(c + 56) >> 2]; - if (e) { - F[(c + 60) >> 2] = e; - ja(e); - } - F[(c + 8) >> 2] = 9372; - e = F[(c + 44) >> 2]; - if (e) { - ja(e); - } - e = F[(c + 32) >> 2]; - if (e) { - ja(e); - } - Z = (c + 112) | 0; - break d; - } - if ((l | 0) >= 0) { - break f; - } - break a; - } - if ((l | 0) < 0) { - break a; - } - } - e = F[(a + 216) >> 2]; - c = F[(m + 44) >> 2]; - d = ka(80); - F[d >> 2] = 9684; - F[(d + 4) >> 2] = 0; - F[(d + 76) >> 2] = 0; - F[(d + 68) >> 2] = c; - F[(d + 8) >> 2] = 8624; - F[(d + 12) >> 2] = 0; - F[(d + 16) >> 2] = 0; - F[(d + 20) >> 2] = 0; - F[(d + 24) >> 2] = 0; - F[(d + 28) >> 2] = 0; - F[(d + 32) >> 2] = 0; - F[(d + 36) >> 2] = 0; - F[(d + 40) >> 2] = 0; - F[(d + 44) >> 2] = 0; - F[(d + 48) >> 2] = 0; - F[(d + 52) >> 2] = 0; - e = (e + L(h, 144)) | 0; - f = (e + 104) | 0; - F[(d + 72) >> 2] = f; - F[(d - -64) >> 2] = 0; - F[(d + 56) >> 2] = 0; - F[(d + 60) >> 2] = 0; - F[(n + 24) >> 2] = c; - c = n; - F[(c + 68) >> 2] = 0; - F[(c + 72) >> 2] = 0; - F[(c + 60) >> 2] = 0; - F[(c + 64) >> 2] = 0; - F[(c + 52) >> 2] = 0; - F[(c + 56) >> 2] = 0; - F[(c + 44) >> 2] = 0; - F[(c + 48) >> 2] = 0; - F[(c + 84) >> 2] = 0; - F[(c + 88) >> 2] = 0; - F[(c + 76) >> 2] = 0; - F[(c + 80) >> 2] = 0; - F[(c + 28) >> 2] = d; - g = F[(c + 28) >> 2]; - F[(c + 8) >> 2] = F[(c + 24) >> 2]; - F[(c + 12) >> 2] = g; - F[(c + 20) >> 2] = f; - f = (e + 4) | 0; - F[(c + 16) >> 2] = f; - F[(c + 36) >> 2] = 0; - F[(c + 40) >> 2] = 0; - F[(c + 32) >> 2] = 8624; - e = F[(c + 20) >> 2]; - F[c >> 2] = F[(c + 16) >> 2]; - F[(c + 4) >> 2] = e; - e = (c + 32) | 0; - Fd(e, f, c); - c = (d + 8) | 0; - lc(c, e); - if ((c | 0) != (e | 0)) { - gb((d + 56) | 0, F[(e + 48) >> 2], F[(e + 52) >> 2]); - } - Ed(e); - break c; - } - c = (Z + -64) | 0; - Z = c; - g = F[(F[(a + 4) >> 2] + 44) >> 2]; - d = ka(80); - F[d >> 2] = 9392; - F[(d + 4) >> 2] = 0; - F[(d + 76) >> 2] = 0; - F[(d + 72) >> 2] = e; - F[(d + 68) >> 2] = g; - F[(d + 8) >> 2] = 9556; - F[(d + 12) >> 2] = 0; - F[(d + 16) >> 2] = 0; - F[(d + 20) >> 2] = 0; - F[(d + 24) >> 2] = 0; - F[(d + 28) >> 2] = 0; - F[(d + 32) >> 2] = 0; - F[(d + 36) >> 2] = 0; - F[(d + 40) >> 2] = 0; - F[(d + 44) >> 2] = 0; - F[(d + 48) >> 2] = 0; - F[(d + 52) >> 2] = 0; - F[(d - -64) >> 2] = 0; - j = (d + 56) | 0; - f = j; - F[f >> 2] = 0; - F[(f + 4) >> 2] = 0; - f = F[(a + 8) >> 2]; - F[(c + 40) >> 2] = 0; - F[(c + 44) >> 2] = 0; - F[(c + 32) >> 2] = 0; - F[(c + 36) >> 2] = 0; - h = (c + 24) | 0; - F[h >> 2] = 0; - F[(h + 4) >> 2] = 0; - F[(c + 16) >> 2] = 0; - F[(c + 20) >> 2] = 0; - F[(c + 56) >> 2] = 0; - F[(c + 8) >> 2] = 0; - F[(c + 12) >> 2] = 0; - F[(c + 48) >> 2] = 0; - F[(c + 52) >> 2] = 0; - F[c >> 2] = 9556; - F[(c + 4) >> 2] = f; - i = F[f >> 2]; - l = F[(f + 4) >> 2]; - D[(c + 63) | 0] = 0; - k = h; - h = (c + 63) | 0; - Ea(k, ((((l - i) >> 2) >>> 0) / 3) | 0, h); - i = F[(c + 4) >> 2]; - l = F[(i + 28) >> 2]; - i = F[(i + 24) >> 2]; - D[(c + 63) | 0] = 0; - Ea((c + 36) | 0, (l - i) >> 2, h); - F[(c + 20) >> 2] = d; - F[(c + 16) >> 2] = g; - F[(c + 12) >> 2] = e; - F[(c + 8) >> 2] = f; - lc((d + 8) | 0, c); - gb(j, F[(c + 48) >> 2], F[(c + 52) >> 2]); - F[c >> 2] = 9556; - e = F[(c + 48) >> 2]; - if (e) { - F[(c + 52) >> 2] = e; - ja(e); - } - F[c >> 2] = 9372; - e = F[(c + 36) >> 2]; - if (e) { - ja(e); - } - e = F[(c + 24) >> 2]; - if (e) { - ja(e); - } - Z = (c - -64) | 0; - } - if (!d) { - break a; - } - } - d = yc(ka(64), d); - c = F[(a + 4) >> 2]; - a = d; - d = b; - m: { - n: { - if ((d | 0) >= 0) { - g = (c + 8) | 0; - b = F[(c + 12) >> 2]; - j = F[(c + 8) >> 2]; - e = (b - j) >> 2; - o: { - if ((e | 0) > (d | 0)) { - break o; - } - f = (d + 1) | 0; - if (d >>> 0 >= e >>> 0) { - Pb(g, (f - e) | 0); - break o; - } - if (e >>> 0 <= f >>> 0) { - break o; - } - f = (j + (f << 2)) | 0; - if ((f | 0) != (b | 0)) { - while (1) { - b = (b - 4) | 0; - e = F[b >> 2]; - F[b >> 2] = 0; - if (e) { - $[F[(F[e >> 2] + 4) >> 2]](e); - } - if ((b | 0) != (f | 0)) { - continue; - } - break; - } - } - F[(c + 12) >> 2] = f; - } - c = (F[g >> 2] + (d << 2)) | 0; - b = F[c >> 2]; - F[c >> 2] = a; - if (b) { - break n; - } - break m; - } - b = a; - if (!a) { - break m; - } - } - $[F[(F[b >> 2] + 4) >> 2]](b); - } - q = ((d ^ -1) >>> 31) | 0; - } - Z = (n + 96) | 0; - return q | 0; - } - function Ab(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = M(0), - n = M(0), - o = 0; - a: { - b: { - if (!d) { - break b; - } - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - E[((g << 1) + d) >> 1] = D[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - E[((g << 1) + d) >> 1] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - E[((g << 1) + d) >> 1] = H[b >> 1]; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - return 0; - } - e = E[b >> 1]; - if ((e | 0) < 0) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - e = F[b >> 2]; - if ((e + 32768) >>> 0 > 65535) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - e = F[b >> 2]; - if (e >>> 0 > 32767) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - k = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= k >>> 0) { - break b; - } - h = F[(b + 4) >> 2]; - e = F[b >> 2]; - i = (e + 32768) | 0; - h = i >>> 0 < 32768 ? (h + 1) | 0 : h; - if ((!h & (i >>> 0 > 65535)) | h) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - k = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ((!k & (e >>> 0 > 32767)) | k) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 8: - d: { - e: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break e; - } - e = F[a >> 2]; - j = F[e >> 2]; - g = j; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - j) | 0; - if (!G[(a + 32) | 0]) { - j = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(32767)) | - (m < M(-32768)) | - (m != m) - ) { - break d; - } - n = M(N(m)); - if (n == M(Infinity)) { - break d; - } - e = ((b << 1) + d) | 0; - if (n < M(2147483648)) { - i = ~~m; - } else { - i = -2147483648; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - j = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(32767)) | - (m < M(-32768)) | - ((M(N(m)) == M(Infinity)) | (m != m)) - ) { - break d; - } - if ((m < M(0)) | (m > M(1))) { - break d; - } - e = ((b << 1) + d) | 0; - l = R(+m * 32767 + 0.5); - f: { - if (N(l) < 2147483648) { - i = ~~l; - break f; - } - i = -2147483648; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - j = 1; - if (c >>> 0 <= e >>> 0) { - break d; - } - ma(((e << 1) + d) | 0, 0, (c - e) << 1); - } - return j; - case 9: - g: { - h: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break h; - } - e = F[a >> 2]; - j = F[e >> 2]; - g = j; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - j) | 0; - if (!G[(a + 32) | 0]) { - j = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - l = K[g >> 3]; - if ((l >= 32767) | (l < -32768) | (l != l)) { - break g; - } - o = N(l); - if (o == Infinity) { - break g; - } - e = ((b << 1) + d) | 0; - if (o < 2147483648) { - i = ~~l; - } else { - i = -2147483648; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - j = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - l = K[g >> 3]; - if ( - (l >= 32767) | - (l < -32768) | - ((N(l) == Infinity) | (l != l)) - ) { - break g; - } - if ((l < 0) | (l > 1)) { - break g; - } - e = ((b << 1) + d) | 0; - l = R(l * 32767 + 0.5); - i: { - if (N(l) < 2147483648) { - i = ~~l; - break i; - } - i = -2147483648; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - j = 1; - if (c >>> 0 <= e >>> 0) { - break g; - } - ma(((e << 1) + d) | 0, 0, (c - e) << 1); - } - return j; - case 10: - break c; - default: - break b; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - E[((g << 1) + d) >> 1] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - ma(((e << 1) + d) | 0, 0, ((c & 255) - e) << 1); - } - return j; - } - ma(((e << 1) + d) | 0, 0, ((c & 255) - e) << 1); - return 1; - } - function yb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = M(0), - n = M(0), - o = 0; - a: { - b: { - if (!d) { - break b; - } - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = D[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = E[b >> 1]; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = H[b >> 1]; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = F[b >> 2]; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - return 0; - } - e = F[b >> 2]; - if ((e | 0) < 0) { - break b; - } - F[((g << 2) + d) >> 2] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - k = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= k >>> 0) { - break b; - } - h = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ( - (e - -2147483648) >>> 0 < 2147483648 - ? (h + 1) | 0 - : h - ) { - break b; - } - F[((g << 2) + d) >> 2] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - k = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ((!k & (e >>> 0 > 2147483647)) | k) { - break b; - } - F[((g << 2) + d) >> 2] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 8: - d: { - e: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break e; - } - e = F[a >> 2]; - j = F[e >> 2]; - g = j; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - j) | 0; - if (!G[(a + 32) | 0]) { - j = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(2147483648)) | - (m < M(-2147483648)) | - (m != m) - ) { - break d; - } - n = M(N(m)); - if (n == M(Infinity)) { - break d; - } - e = ((b << 2) + d) | 0; - if (n < M(2147483648)) { - i = ~~m; - } else { - i = -2147483648; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - j = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(2147483648)) | - (m < M(-2147483648)) | - ((M(N(m)) == M(Infinity)) | (m != m)) - ) { - break d; - } - if ((m < M(0)) | (m > M(1))) { - break d; - } - e = ((b << 2) + d) | 0; - l = R(+m * 2147483647 + 0.5); - f: { - if (N(l) < 2147483648) { - i = ~~l; - break f; - } - i = -2147483648; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - j = 1; - if (c >>> 0 <= e >>> 0) { - break d; - } - ma(((e << 2) + d) | 0, 0, (c - e) << 2); - } - return j; - case 9: - g: { - h: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break h; - } - e = F[a >> 2]; - j = F[e >> 2]; - g = j; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - j) | 0; - if (!G[(a + 32) | 0]) { - j = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - l = K[g >> 3]; - if ( - (l >= 2147483647) | - (l < -2147483648) | - (l != l) - ) { - break g; - } - o = N(l); - if (o == Infinity) { - break g; - } - e = ((b << 2) + d) | 0; - if (o < 2147483648) { - i = ~~l; - } else { - i = -2147483648; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - j = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - l = K[g >> 3]; - if ( - (l >= 2147483647) | - (l < -2147483648) | - ((N(l) == Infinity) | (l != l)) - ) { - break g; - } - if ((l < 0) | (l > 1)) { - break g; - } - e = ((b << 2) + d) | 0; - l = R(l * 2147483647 + 0.5); - i: { - if (N(l) < 2147483648) { - i = ~~l; - break i; - } - i = -2147483648; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - j = 1; - if (c >>> 0 <= e >>> 0) { - break g; - } - ma(((e << 2) + d) | 0, 0, (c - e) << 2); - } - return j; - case 10: - break c; - default: - break b; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - j = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - ma(((e << 2) + d) | 0, 0, ((c & 255) - e) << 2); - } - return j; - } - ma(((e << 2) + d) | 0, 0, ((c & 255) - e) << 2); - return 1; - } - function zb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = M(0); - a: { - b: { - if (!d) { - break b; - } - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - return 0; - } - e = D[b | 0]; - if ((e | 0) < 0) { - break b; - } - E[((g << 1) + d) >> 1] = e & 255; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - E[((g << 1) + d) >> 1] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - return 0; - } - e = E[b >> 1]; - if ((e | 0) < 0) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - E[((g << 1) + d) >> 1] = H[b >> 1]; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - e = F[b >> 2]; - if (e >>> 0 > 65535) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - e = F[b >> 2]; - if (e >>> 0 > 65535) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - k = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ((!k & (e >>> 0 > 65535)) | k) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - k = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ((!k & (e >>> 0 > 65535)) | k) { - break b; - } - E[((g << 1) + d) >> 1] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 8: - d: { - e: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break e; - } - e = F[a >> 2]; - l = F[e >> 2]; - g = l; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - l) | 0; - if (!G[(a + 32) | 0]) { - l = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(65535)) | - (m < M(0)) | - ((M(N(m)) == M(Infinity)) | (m != m)) - ) { - break d; - } - e = ((b << 1) + d) | 0; - if ((m < M(4294967296)) & (m >= M(0))) { - i = ~~m >>> 0; - } else { - i = 0; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - l = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(65535)) | - (m < M(0)) | - ((M(N(m)) == M(Infinity)) | (m != m)) - ) { - break d; - } - if (m > M(1)) { - break d; - } - e = ((b << 1) + d) | 0; - j = R(+m * 65535 + 0.5); - f: { - if ((j < 4294967296) & (j >= 0)) { - i = ~~j >>> 0; - break f; - } - i = 0; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - l = 1; - if (c >>> 0 <= e >>> 0) { - break d; - } - ma(((e << 1) + d) | 0, 0, (c - e) << 1); - } - return l; - case 9: - g: { - h: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break h; - } - e = F[a >> 2]; - l = F[e >> 2]; - g = l; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - l) | 0; - if (!G[(a + 32) | 0]) { - l = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - j = K[g >> 3]; - if ( - (j >= 65535) | - (j < 0) | - ((N(j) == Infinity) | (j != j)) - ) { - break g; - } - e = ((b << 1) + d) | 0; - if ((j < 4294967296) & (j >= 0)) { - i = ~~j >>> 0; - } else { - i = 0; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - l = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - j = K[g >> 3]; - if ( - (j >= 65535) | - (j < 0) | - ((N(j) == Infinity) | (j != j)) - ) { - break g; - } - if (j > 1) { - break g; - } - e = ((b << 1) + d) | 0; - j = R(j * 65535 + 0.5); - i: { - if ((j < 4294967296) & (j >= 0)) { - i = ~~j >>> 0; - break i; - } - i = 0; - } - E[e >> 1] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - l = 1; - if (c >>> 0 <= e >>> 0) { - break g; - } - ma(((e << 1) + d) | 0, 0, (c - e) << 1); - } - return l; - case 10: - break c; - default: - break b; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - k = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + k) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - E[((g << 1) + d) >> 1] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - ma(((e << 1) + d) | 0, 0, ((c & 255) - e) << 1); - } - return l; - } - ma(((e << 1) + d) | 0, 0, ((c & 255) - e) << 1); - return 1; - } - function Ga(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = M(0), - l = 0, - m = 0, - n = M(0), - o = 0; - a: { - if (!d) { - break a; - } - b: { - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = ((g << 3) + d) | 0; - i = D[b | 0]; - F[e >> 2] = i; - F[(e + 4) >> 2] = i >> 31; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = ((g << 3) + d) | 0; - F[e >> 2] = G[b | 0]; - F[(e + 4) >> 2] = 0; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = ((g << 3) + d) | 0; - i = E[b >> 1]; - F[e >> 2] = i; - F[(e + 4) >> 2] = i >> 31; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = ((g << 3) + d) | 0; - F[e >> 2] = H[b >> 1]; - F[(e + 4) >> 2] = 0; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = ((g << 3) + d) | 0; - i = F[b >> 2]; - F[e >> 2] = i; - F[(e + 4) >> 2] = i >> 31; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = ((g << 3) + d) | 0; - F[e >> 2] = F[b >> 2]; - F[(e + 4) >> 2] = 0; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - i = F[(b + 4) >> 2]; - e = ((g << 3) + d) | 0; - F[e >> 2] = F[b >> 2]; - F[(e + 4) >> 2] = i; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = F[b >> 2]; - i = F[(b + 4) >> 2]; - if ((i | 0) < 0) { - break a; - } - j = ((g << 3) + d) | 0; - F[j >> 2] = e; - F[(j + 4) >> 2] = i; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 8: - d: { - e = G[(a + 24) | 0]; - f = c & 255; - if (!(e >>> 0 < f >>> 0 ? e : f)) { - break d; - } - if (G[(a + 32) | 0]) { - break a; - } - e = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + e) | 0; - e = F[a >> 2]; - i = F[(e + 4) >> 2]; - e = F[e >> 2]; - if ((b | 0) >= ((i - e) | 0)) { - break a; - } - g = (b + e) | 0; - h = c & 255; - b = 0; - while (1) { - k = J[g >> 2]; - if ( - (k >= M(0x8000000000000000)) | - (k < M(-0x8000000000000000)) | - (k != k) - ) { - break a; - } - n = M(N(k)); - if (n == M(Infinity)) { - break a; - } - e = ((b << 3) + d) | 0; - e: { - if (n < M(0x8000000000000000)) { - j = - M(N(k)) >= M(1) - ? ~~(k > M(0) - ? M( - P( - M( - R( - M( - k * - M( - 2.3283064365386963e-10, - ), - ), - ), - ), - M(4294967296), - ), - ) - : M( - S( - M( - M(k - M((~~k >>> 0) >>> 0)) * - M(2.3283064365386963e-10), - ), - ), - )) >>> 0 - : 0; - m = ~~k >>> 0; - break e; - } - j = -2147483648; - m = 0; - } - F[e >> 2] = m; - F[(e + 4) >> 2] = j; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (e >>> 0 < h >>> 0 ? e : h) >>> 0 - ) { - break d; - } - g = (g + 4) | 0; - if (i >>> 0 > g >>> 0) { - continue; - } - break; - } - break a; - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 9: - f: { - e = G[(a + 24) | 0]; - f = c & 255; - if (!(e >>> 0 < f >>> 0 ? e : f)) { - break f; - } - if (G[(a + 32) | 0]) { - break a; - } - e = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + e) | 0; - e = F[a >> 2]; - i = F[(e + 4) >> 2]; - e = F[e >> 2]; - if ((b | 0) >= ((i - e) | 0)) { - break a; - } - g = (b + e) | 0; - h = c & 255; - b = 0; - while (1) { - l = K[g >> 3]; - if ( - (l >= 0x8000000000000000) | - (l < -0x8000000000000000) | - (l != l) - ) { - break a; - } - o = N(l); - if (o == Infinity) { - break a; - } - e = ((b << 3) + d) | 0; - g: { - if (o < 0x8000000000000000) { - j = - N(l) >= 1 - ? ~~(l > 0 - ? P( - R(l * 2.3283064365386963e-10), - 4294967295, - ) - : S( - (l - +((~~l >>> 0) >>> 0)) * - 2.3283064365386963e-10, - )) >>> 0 - : 0; - m = ~~l >>> 0; - break g; - } - j = -2147483648; - m = 0; - } - F[e >> 2] = m; - F[(e + 4) >> 2] = j; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (e >>> 0 < h >>> 0 ? e : h) >>> 0 - ) { - break f; - } - g = (g + 8) | 0; - if (i >>> 0 > g >>> 0) { - continue; - } - break; - } - break a; - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 10: - break c; - default: - break a; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - j = b; - b = (b + i) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break a; - } - e = ((g << 3) + d) | 0; - F[e >> 2] = G[b | 0]; - F[(e + 4) >> 2] = 0; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 3) + d) | 0; - a = ((c & 255) - e) | 0; - } - ma(d, 0, a << 3); - } - } - function le(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - j = a; - a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - a = F[(a + 8) >> 2]; - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 4: - break c; - case 5: - break d; - case 2: - break e; - case 3: - break f; - case 0: - break g; - case 1: - break h; - default: - break a; - } - } - f = G[(a + 24) | 0]; - c = ka(f); - a = F[(j + 16) >> 2]; - if (F[(a + 80) >> 2]) { - g = (F[F[a >> 2] >> 2] + F[(a + 48) >> 2]) | 0; - } else { - g = 0; - } - if (!b) { - break b; - } - if (f) { - o = f & 252; - l = f & 3; - h = f >>> 0 < 4; - while (1) { - a = 0; - e = 0; - if (!h) { - while (1) { - k = (g + (d << 2)) | 0; - D[(a + c) | 0] = F[k >> 2]; - D[((a | 1) + c) | 0] = F[(k + 4) >> 2]; - D[((a | 2) + c) | 0] = F[(k + 8) >> 2]; - D[((a | 3) + c) | 0] = F[(k + 12) >> 2]; - a = (a + 4) | 0; - d = (d + 4) | 0; - e = (e + 4) | 0; - if ((o | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - if (l) { - while (1) { - D[(a + c) | 0] = F[(g + (d << 2)) >> 2]; - a = (a + 1) | 0; - d = (d + 1) | 0; - e = (e + 1) | 0; - if ((l | 0) != (e | 0)) { - continue; - } - break; - } - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + - m) | - 0, - c, - f, - ); - m = (f + m) | 0; - n = (n + 1) | 0; - if ((n | 0) != (b | 0)) { - continue; - } - break; - } - break b; - } - a = 0; - if ((b | 0) != 1) { - g = b & -2; - while (1) { - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + - a) | - 0, - c, - f, - ); - a = (a + f) | 0; - la( - (a + - F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2]) | - 0, - c, - f, - ); - a = (a + f) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(b & 1)) { - break b; - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | - 0, - c, - f, - ); - break b; - } - f = G[(a + 24) | 0]; - c = ka(f); - a = F[(j + 16) >> 2]; - if (F[(a + 80) >> 2]) { - g = (F[F[a >> 2] >> 2] + F[(a + 48) >> 2]) | 0; - } else { - g = 0; - } - if (!b) { - break b; - } - if (f) { - o = f & 252; - l = f & 3; - h = f >>> 0 < 4; - while (1) { - a = 0; - e = 0; - if (!h) { - while (1) { - k = (g + (d << 2)) | 0; - D[(a + c) | 0] = F[k >> 2]; - D[((a | 1) + c) | 0] = F[(k + 4) >> 2]; - D[((a | 2) + c) | 0] = F[(k + 8) >> 2]; - D[((a | 3) + c) | 0] = F[(k + 12) >> 2]; - a = (a + 4) | 0; - d = (d + 4) | 0; - e = (e + 4) | 0; - if ((o | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - if (l) { - while (1) { - D[(a + c) | 0] = F[(g + (d << 2)) >> 2]; - a = (a + 1) | 0; - d = (d + 1) | 0; - e = (e + 1) | 0; - if ((l | 0) != (e | 0)) { - continue; - } - break; - } - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + m) | - 0, - c, - f, - ); - m = (f + m) | 0; - n = (n + 1) | 0; - if ((n | 0) != (b | 0)) { - continue; - } - break; - } - break b; - } - a = 0; - if ((b | 0) != 1) { - g = b & -2; - while (1) { - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | - 0, - c, - f, - ); - a = (a + f) | 0; - la( - (a + F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2]) | - 0, - c, - f, - ); - a = (a + f) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(b & 1)) { - break b; - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, - c, - f, - ); - break b; - } - h = G[(a + 24) | 0]; - i = h << 1; - c = ka(i); - a = F[(j + 16) >> 2]; - if (F[(a + 80) >> 2]) { - g = (F[F[a >> 2] >> 2] + F[(a + 48) >> 2]) | 0; - } else { - g = 0; - } - if (!b) { - break b; - } - if (h) { - o = h & 252; - l = h & 3; - h = h >>> 0 < 4; - while (1) { - a = 0; - e = 0; - if (!h) { - while (1) { - f = a << 1; - k = (g + (d << 2)) | 0; - E[(f + c) >> 1] = F[k >> 2]; - E[((f | 2) + c) >> 1] = F[(k + 4) >> 2]; - E[((f | 4) + c) >> 1] = F[(k + 8) >> 2]; - E[((f | 6) + c) >> 1] = F[(k + 12) >> 2]; - a = (a + 4) | 0; - d = (d + 4) | 0; - e = (e + 4) | 0; - if ((o | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - if (l) { - while (1) { - E[((a << 1) + c) >> 1] = - F[(g + (d << 2)) >> 2]; - a = (a + 1) | 0; - d = (d + 1) | 0; - e = (e + 1) | 0; - if ((l | 0) != (e | 0)) { - continue; - } - break; - } - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + n) | - 0, - c, - i, - ); - n = (i + n) | 0; - m = (m + 1) | 0; - if ((m | 0) != (b | 0)) { - continue; - } - break; - } - break b; - } - a = 0; - if ((b | 0) != 1) { - g = b & -2; - while (1) { - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | - 0, - c, - i, - ); - a = (a + i) | 0; - la( - (a + F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2]) | - 0, - c, - i, - ); - a = (a + i) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(b & 1)) { - break b; - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, - c, - i, - ); - break b; - } - h = G[(a + 24) | 0]; - i = h << 1; - c = ka(i); - a = F[(j + 16) >> 2]; - if (F[(a + 80) >> 2]) { - g = (F[F[a >> 2] >> 2] + F[(a + 48) >> 2]) | 0; - } else { - g = 0; - } - if (!b) { - break b; - } - if (h) { - o = h & 252; - l = h & 3; - h = h >>> 0 < 4; - while (1) { - a = 0; - e = 0; - if (!h) { - while (1) { - f = a << 1; - k = (g + (d << 2)) | 0; - E[(f + c) >> 1] = F[k >> 2]; - E[((f | 2) + c) >> 1] = F[(k + 4) >> 2]; - E[((f | 4) + c) >> 1] = F[(k + 8) >> 2]; - E[((f | 6) + c) >> 1] = F[(k + 12) >> 2]; - a = (a + 4) | 0; - d = (d + 4) | 0; - e = (e + 4) | 0; - if ((o | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - if (l) { - while (1) { - E[((a << 1) + c) >> 1] = F[(g + (d << 2)) >> 2]; - a = (a + 1) | 0; - d = (d + 1) | 0; - e = (e + 1) | 0; - if ((l | 0) != (e | 0)) { - continue; - } - break; - } - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + n) | 0, - c, - i, - ); - n = (i + n) | 0; - m = (m + 1) | 0; - if ((m | 0) != (b | 0)) { - continue; - } - break; - } - break b; - } - a = 0; - if ((b | 0) != 1) { - g = b & -2; - while (1) { - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, - c, - i, - ); - a = (a + i) | 0; - la( - (a + F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2]) | 0, - c, - i, - ); - a = (a + i) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(b & 1)) { - break b; - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, - c, - i, - ); - break b; - } - h = G[(a + 24) | 0]; - i = h << 2; - c = ka(i); - a = F[(j + 16) >> 2]; - if (F[(a + 80) >> 2]) { - g = (F[F[a >> 2] >> 2] + F[(a + 48) >> 2]) | 0; - } else { - g = 0; - } - if (!b) { - break b; - } - if (h) { - o = h & 252; - l = h & 3; - h = h >>> 0 < 4; - while (1) { - a = 0; - e = 0; - if (!h) { - while (1) { - f = a << 2; - k = (g + (d << 2)) | 0; - F[(f + c) >> 2] = F[k >> 2]; - F[((f | 4) + c) >> 2] = F[(k + 4) >> 2]; - F[((f | 8) + c) >> 2] = F[(k + 8) >> 2]; - F[((f | 12) + c) >> 2] = F[(k + 12) >> 2]; - a = (a + 4) | 0; - d = (d + 4) | 0; - e = (e + 4) | 0; - if ((o | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - if (l) { - while (1) { - F[((a << 2) + c) >> 2] = F[(g + (d << 2)) >> 2]; - a = (a + 1) | 0; - d = (d + 1) | 0; - e = (e + 1) | 0; - if ((l | 0) != (e | 0)) { - continue; - } - break; - } - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + n) | 0, - c, - i, - ); - n = (i + n) | 0; - m = (m + 1) | 0; - if ((m | 0) != (b | 0)) { - continue; - } - break; - } - break b; - } - a = 0; - if ((b | 0) != 1) { - g = b & -2; - while (1) { - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, - c, - i, - ); - a = (a + i) | 0; - la( - (a + F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2]) | 0, - c, - i, - ); - a = (a + i) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(b & 1)) { - break b; - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, - c, - i, - ); - break b; - } - h = G[(a + 24) | 0]; - i = h << 2; - c = ka(i); - a = F[(j + 16) >> 2]; - if (F[(a + 80) >> 2]) { - g = (F[F[a >> 2] >> 2] + F[(a + 48) >> 2]) | 0; - } else { - g = 0; - } - if (!b) { - break b; - } - if (h) { - o = h & 252; - l = h & 3; - h = h >>> 0 < 4; - while (1) { - a = 0; - e = 0; - if (!h) { - while (1) { - f = a << 2; - k = (g + (d << 2)) | 0; - F[(f + c) >> 2] = F[k >> 2]; - F[((f | 4) + c) >> 2] = F[(k + 4) >> 2]; - F[((f | 8) + c) >> 2] = F[(k + 8) >> 2]; - F[((f | 12) + c) >> 2] = F[(k + 12) >> 2]; - a = (a + 4) | 0; - d = (d + 4) | 0; - e = (e + 4) | 0; - if ((o | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - if (l) { - while (1) { - F[((a << 2) + c) >> 2] = F[(g + (d << 2)) >> 2]; - a = (a + 1) | 0; - d = (d + 1) | 0; - e = (e + 1) | 0; - if ((l | 0) != (e | 0)) { - continue; - } - break; - } - } - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + n) | 0, - c, - i, - ); - n = (i + n) | 0; - m = (m + 1) | 0; - if ((m | 0) != (b | 0)) { - continue; - } - break; - } - break b; - } - a = 0; - if ((b | 0) != 1) { - g = b & -2; - while (1) { - la( - (F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, - c, - i, - ); - a = (a + i) | 0; - la( - (a + F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2]) | 0, - c, - i, - ); - a = (a + i) | 0; - d = (d + 2) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(b & 1)) { - break b; - } - la((F[F[(F[(j + 8) >> 2] + 64) >> 2] >> 2] + a) | 0, c, i); - } - ja(c); - c = 1; - } - return c | 0; - } - function xb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = M(0); - a: { - b: { - if (!d) { - break b; - } - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = D[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = E[b >> 1]; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = H[b >> 1]; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = F[b >> 2]; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = F[b >> 2]; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - e = F[b >> 2]; - if (F[(b + 4) >> 2]) { - break b; - } - F[((g << 2) + d) >> 2] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - e = F[b >> 2]; - if (F[(b + 4) >> 2]) { - break b; - } - F[((g << 2) + d) >> 2] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 8: - d: { - e: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break e; - } - e = F[a >> 2]; - k = F[e >> 2]; - g = k; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - k) | 0; - if (!G[(a + 32) | 0]) { - k = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(4294967296)) | - (m < M(0)) | - ((M(N(m)) == M(Infinity)) | (m != m)) - ) { - break d; - } - e = ((b << 2) + d) | 0; - if ((m < M(4294967296)) & (m >= M(0))) { - i = ~~m >>> 0; - } else { - i = 0; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - k = 0; - if ((b | 0) >= (e | 0)) { - break d; - } - b = 0; - while (1) { - m = J[g >> 2]; - if ( - (m >= M(4294967296)) | - (m < M(0)) | - ((M(N(m)) == M(Infinity)) | (m != m)) - ) { - break d; - } - if (m > M(1)) { - break d; - } - e = ((b << 2) + d) | 0; - j = R(+m * 4294967295 + 0.5); - f: { - if ((j < 4294967296) & (j >= 0)) { - i = ~~j >>> 0; - break f; - } - i = 0; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break e; - } - g = (g + 4) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break d; - } - k = 1; - if (c >>> 0 <= e >>> 0) { - break d; - } - ma(((e << 2) + d) | 0, 0, (c - e) << 2); - } - return k; - case 9: - g: { - h: { - e = G[(a + 24) | 0]; - c = c & 255; - if (!(c >>> 0 > e >>> 0 ? e : c)) { - break h; - } - e = F[a >> 2]; - k = F[e >> 2]; - g = k; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + f) | 0; - g = (b + g) | 0; - f = F[(e + 4) >> 2]; - e = (f - k) | 0; - if (!G[(a + 32) | 0]) { - k = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - j = K[g >> 3]; - if ( - (j >= 4294967295) | - (j < 0) | - ((N(j) == Infinity) | (j != j)) - ) { - break g; - } - e = ((b << 2) + d) | 0; - if ((j < 4294967296) & (j >= 0)) { - i = ~~j >>> 0; - } else { - i = 0; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - k = 0; - if ((b | 0) >= (e | 0)) { - break g; - } - b = 0; - while (1) { - j = K[g >> 3]; - if ( - (j >= 4294967295) | - (j < 0) | - ((N(j) == Infinity) | (j != j)) - ) { - break g; - } - if (j > 1) { - break g; - } - e = ((b << 2) + d) | 0; - j = R(j * 4294967295 + 0.5); - i: { - if ((j < 4294967296) & (j >= 0)) { - i = ~~j >>> 0; - break i; - } - i = 0; - } - F[e >> 2] = i; - b = (b + 1) | 0; - e = G[(a + 24) | 0]; - if ( - b >>> 0 >= - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - break h; - } - g = (g + 8) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - break g; - } - k = 1; - if (c >>> 0 <= e >>> 0) { - break g; - } - ma(((e << 2) + d) | 0, 0, (c - e) << 2); - } - return k; - case 10: - break c; - default: - break b; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - h = F[e >> 2]; - l = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - i = b; - b = (b + l) | 0; - b = (b + h) | 0; - h = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= h >>> 0) { - break b; - } - F[((g << 2) + d) >> 2] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - ma(((e << 2) + d) | 0, 0, ((c & 255) - e) << 2); - } - return k; - } - ma(((e << 2) + d) | 0, 0, ((c & 255) - e) << 2); - return 1; - } - function rd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0; - a: { - b: { - c: { - d: { - e: { - if (F[(a + 92) >> 2] == F[(a + 88) >> 2]) { - break e; - } - c = F[(a + 52) >> 2]; - f: { - if ((c | 0) != F[(a + 56) >> 2]) { - F[c >> 2] = b; - F[(a + 52) >> 2] = c + 4; - break f; - } - h = F[(a + 48) >> 2]; - g = (c - h) | 0; - d = g >> 2; - f = (d + 1) | 0; - if (f >>> 0 >= 1073741824) { - break a; - } - e = (g >>> 1) | 0; - g = - g >>> 0 >= 2147483644 - ? 1073741823 - : f >>> 0 < e >>> 0 - ? e - : f; - if (g) { - if (g >>> 0 >= 1073741824) { - break d; - } - e = ka(g << 2); - } else { - e = 0; - } - f = (e + (d << 2)) | 0; - F[f >> 2] = b; - d = (f + 4) | 0; - if ((c | 0) != (h | 0)) { - while (1) { - f = (f - 4) | 0; - c = (c - 4) | 0; - F[f >> 2] = F[c >> 2]; - if ((c | 0) != (h | 0)) { - continue; - } - break; - } - } - F[(a + 56) >> 2] = e + (g << 2); - F[(a + 52) >> 2] = d; - F[(a + 48) >> 2] = f; - if (!h) { - break f; - } - ja(h); - } - F[(a + 84) >> 2] = 0; - c = -1; - e = -1; - g: { - if ((b | 0) == -1) { - break g; - } - d = F[(a + 4) >> 2]; - e = (b + 1) | 0; - e = ((e >>> 0) % 3) | 0 ? e : (b - 2) | 0; - if ((e | 0) != -1) { - c = F[(F[d >> 2] + (e << 2)) >> 2]; - } - h: { - if (((b >>> 0) % 3) | 0) { - l = (b - 1) | 0; - break h; - } - l = (b + 2) | 0; - e = -1; - if ((l | 0) == -1) { - break g; - } - } - e = F[(F[d >> 2] + (l << 2)) >> 2]; - } - i = (e >>> 3) & 536870908; - d = F[(a + 36) >> 2]; - h = (d + ((c >>> 3) & 536870908)) | 0; - g = F[h >> 2]; - f = 1 << c; - if (!(g & f)) { - F[h >> 2] = f | g; - f = (a + 8) | 0; - if ((b | 0) != -1) { - d = (b + 1) | 0; - d = ((d >>> 0) % 3) | 0 ? d : (b - 2) | 0; - } else { - d = -1; - } - Ka(f, c, d); - d = F[(a + 36) >> 2]; - } - f = (d + i) | 0; - d = F[f >> 2]; - c = 1 << e; - if (!(d & c)) { - F[f >> 2] = c | d; - d = (a + 8) | 0; - c = -1; - i: { - if ((b | 0) == -1) { - break i; - } - c = (b - 1) | 0; - if (((b >>> 0) % 3) | 0) { - break i; - } - c = (b + 2) | 0; - } - Ka(d, e, c); - } - c = -1; - c = - (b | 0) != -1 - ? F[(F[F[(a + 4) >> 2] >> 2] + (b << 2)) >> 2] - : c; - f = (F[(a + 36) >> 2] + ((c >>> 3) & 536870908)) | 0; - d = F[f >> 2]; - e = 1 << c; - if (!(d & e)) { - F[f >> 2] = d | e; - Ka((a + 8) | 0, c, b); - } - d = F[(a + 84) >> 2]; - if ((d | 0) > 2) { - break e; - } - while (1) { - e = (L(d, 12) + a) | 0; - b = F[(e + 52) >> 2]; - if ((b | 0) == F[(e + 48) >> 2]) { - d = (d + 1) | 0; - if ((d | 0) != 3) { - continue; - } - break e; - } - b = (b - 4) | 0; - c = F[b >> 2]; - F[(e + 52) >> 2] = b; - F[(a + 84) >> 2] = d; - if ((c | 0) == -1) { - break e; - } - f = F[(a + 24) >> 2]; - b = ((c >>> 0) / 3) | 0; - j: { - if ( - (F[(f + ((b >>> 3) & 268435452)) >> 2] >>> b) & - 1 - ) { - break j; - } - k: { - while (1) { - k = ((c >>> 0) / 3) | 0; - b = (((k >>> 3) & 268435452) + f) | 0; - F[b >> 2] = F[b >> 2] | (1 << k); - d = -1; - l: { - m: { - n: { - o: { - p: { - q: { - r: { - s: { - d = - (c | 0) != -1 - ? F[ - (F[ - F[(a + 4) >> 2] >> 2 - ] + - (c << 2)) >> - 2 - ] - : d; - f = - (F[(a + 36) >> 2] + - ((d >>> 3) & 536870908)) | - 0; - e = F[f >> 2]; - b = 1 << d; - if (!(e & b)) { - F[f >> 2] = b | e; - i = - F[ - (((F[ - (F[(a + 16) >> 2] + - 96) >> - 2 - ] + - L(k, 12)) | - 0) + - (((c >>> 0) % 3) << - 2)) >> - 2 - ]; - l = - F[ - (F[(a + 20) >> 2] + - 4) >> - 2 - ]; - f = F[(l + 4) >> 2]; - t: { - if ( - (f | 0) != - F[(l + 8) >> 2] - ) { - F[f >> 2] = i; - F[(l + 4) >> 2] = f + 4; - break t; - } - j = F[l >> 2]; - h = (f - j) | 0; - g = h >> 2; - e = (g + 1) | 0; - if ( - e >>> 0 >= - 1073741824 - ) { - break s; - } - b = (h >>> 1) | 0; - h = - h >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 > e >>> 0 - ? b - : e; - if (h) { - if ( - h >>> 0 >= - 1073741824 - ) { - break d; - } - e = ka(h << 2); - } else { - e = 0; - } - b = (e + (g << 2)) | 0; - F[b >> 2] = i; - g = (b + 4) | 0; - if ((f | 0) != (j | 0)) { - while (1) { - b = (b - 4) | 0; - f = (f - 4) | 0; - F[b >> 2] = F[f >> 2]; - if ( - (f | 0) != - (j | 0) - ) { - continue; - } - break; - } - } - F[(l + 8) >> 2] = - e + (h << 2); - F[(l + 4) >> 2] = g; - F[l >> 2] = b; - if (!j) { - break t; - } - ja(j); - } - j = F[(a + 12) >> 2]; - f = F[(j + 4) >> 2]; - u: { - if ( - (f | 0) != - F[(j + 8) >> 2] - ) { - F[f >> 2] = c; - F[(j + 4) >> 2] = f + 4; - break u; - } - i = F[j >> 2]; - h = (f - i) | 0; - g = h >> 2; - e = (g + 1) | 0; - if ( - e >>> 0 >= - 1073741824 - ) { - break r; - } - b = (h >>> 1) | 0; - h = - h >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 > e >>> 0 - ? b - : e; - if (h) { - if ( - h >>> 0 >= - 1073741824 - ) { - break d; - } - e = ka(h << 2); - } else { - e = 0; - } - b = (e + (g << 2)) | 0; - F[b >> 2] = c; - g = (b + 4) | 0; - if ((f | 0) != (i | 0)) { - while (1) { - b = (b - 4) | 0; - f = (f - 4) | 0; - F[b >> 2] = F[f >> 2]; - if ( - (f | 0) != - (i | 0) - ) { - continue; - } - break; - } - } - F[(j + 8) >> 2] = - e + (h << 2); - F[(j + 4) >> 2] = g; - F[j >> 2] = b; - if (!i) { - break u; - } - ja(i); - } - b = F[(a + 12) >> 2]; - F[ - (F[(b + 12) >> 2] + - (d << 2)) >> - 2 - ] = F[(b + 24) >> 2]; - F[(b + 24) >> 2] = - F[(b + 24) >> 2] + 1; - } - if ((c | 0) == -1) { - break k; - } - g = F[(a + 4) >> 2]; - f = -1; - b = (c + 1) | 0; - b = - ((b >>> 0) % 3) | 0 - ? b - : (c - 2) | 0; - if ((b | 0) != -1) { - f = - F[ - (F[(g + 12) >> 2] + - (b << 2)) >> - 2 - ]; - } - v: { - w: { - if ( - (L(k, 3) | 0) != - (c | 0) - ) { - d = (c - 1) | 0; - break w; - } - d = (c + 2) | 0; - c = -1; - if ((d | 0) == -1) { - break v; - } - } - c = - F[ - (F[(g + 12) >> 2] + - (d << 2)) >> - 2 - ]; - } - d = (c | 0) == -1; - e = ((c >>> 0) / 3) | 0; - if ((f | 0) != -1) { - b = ((f >>> 0) / 3) | 0; - b = - F[ - (F[(a + 24) >> 2] + - ((b >>> 3) & - 268435452)) >> - 2 - ] & - (1 << b); - if (d) { - break q; - } - l = (b | 0) != 0; - break p; - } - l = 1; - if (!d) { - break p; - } - break k; - } - na(); - v(); - } - na(); - v(); - } - if (!b) { - break o; - } - break k; - } - b = d ? -1 : e; - x: { - if ( - (F[ - (F[(a + 24) >> 2] + - ((b >>> 3) & 536870908)) >> - 2 - ] >>> - b) & - 1 - ) { - break x; - } - k = 0; - b = F[(F[g >> 2] + (c << 2)) >> 2]; - if ( - !( - (F[ - (F[(a + 36) >> 2] + - ((b >>> 3) & 536870908)) >> - 2 - ] >>> - b) & - 1 - ) - ) { - b = - (F[(a + 88) >> 2] + (b << 2)) | - 0; - e = F[b >> 2]; - F[b >> 2] = e + 1; - k = (e | 0) <= 0 ? 2 : 1; - } - if ( - (F[(a + 84) >> 2] >= (k | 0)) & - l - ) { - break m; - } - j = (L(k, 12) + a) | 0; - b = F[(j + 52) >> 2]; - y: { - if ((b | 0) != F[(j + 56) >> 2]) { - F[b >> 2] = c; - F[(j + 52) >> 2] = b + 4; - break y; - } - i = F[(j + 48) >> 2]; - h = (b - i) | 0; - d = h >> 2; - g = (d + 1) | 0; - if (g >>> 0 >= 1073741824) { - break c; - } - e = (h >>> 1) | 0; - g = - h >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 > g >>> 0 - ? e - : g; - if (g) { - if (g >>> 0 >= 1073741824) { - break d; - } - e = ka(g << 2); - } else { - e = 0; - } - d = (e + (d << 2)) | 0; - F[d >> 2] = c; - c = (d + 4) | 0; - if ((b | 0) != (i | 0)) { - while (1) { - d = (d - 4) | 0; - b = (b - 4) | 0; - F[d >> 2] = F[b >> 2]; - if ((b | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(j + 48) >> 2] = d; - F[(j + 52) >> 2] = c; - F[(j + 56) >> 2] = e + (g << 2); - if (!i) { - break y; - } - ja(i); - } - if (F[(a + 84) >> 2] <= (k | 0)) { - break x; - } - F[(a + 84) >> 2] = k; - } - if (l) { - break k; - } - c = -1; - if ((f | 0) == -1) { - break n; - } - } - c = - F[ - (F[F[(a + 4) >> 2] >> 2] + - (f << 2)) >> - 2 - ]; - } - b = 0; - if ( - !( - (F[ - (F[(a + 36) >> 2] + - ((c >>> 3) & 536870908)) >> - 2 - ] >>> - c) & - 1 - ) - ) { - b = (F[(a + 88) >> 2] + (c << 2)) | 0; - c = F[b >> 2]; - F[b >> 2] = c + 1; - b = (c | 0) <= 0 ? 2 : 1; - } - if (F[(a + 84) >> 2] < (b | 0)) { - break l; - } - c = f; - } - f = F[(a + 24) >> 2]; - continue; - } - break; - } - k = (L(b, 12) + a) | 0; - c = F[(k + 52) >> 2]; - z: { - if ((c | 0) != F[(k + 56) >> 2]) { - F[c >> 2] = f; - F[(k + 52) >> 2] = c + 4; - break z; - } - i = F[(k + 48) >> 2]; - h = (c - i) | 0; - d = h >> 2; - g = (d + 1) | 0; - if (g >>> 0 >= 1073741824) { - break b; - } - e = (h >>> 1) | 0; - g = - h >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 > g >>> 0 - ? e - : g; - if (g) { - if (g >>> 0 >= 1073741824) { - break d; - } - e = ka(g << 2); - } else { - e = 0; - } - d = (e + (d << 2)) | 0; - F[d >> 2] = f; - f = (d + 4) | 0; - if ((c | 0) != (i | 0)) { - while (1) { - d = (d - 4) | 0; - c = (c - 4) | 0; - F[d >> 2] = F[c >> 2]; - if ((c | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(k + 48) >> 2] = d; - F[(k + 52) >> 2] = f; - F[(k + 56) >> 2] = e + (g << 2); - if (!i) { - break z; - } - ja(i); - } - d = F[(a + 84) >> 2]; - if ((d | 0) <= (b | 0)) { - break j; - } - F[(a + 84) >> 2] = b; - d = b; - break j; - } - d = F[(a + 84) >> 2]; - } - if ((d | 0) < 3) { - continue; - } - break; - } - } - return 1; - } - oa(); - v(); - } - na(); - v(); - } - na(); - v(); - } - na(); - v(); - } - function Mc(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - e = (Z - 16) | 0; - Z = e; - F[(e + 12) >> 2] = a; - a: { - if (a >>> 0 <= 211) { - d = F[Lc(10352, 10544, (e + 12) | 0) >> 2]; - break a; - } - if (a >>> 0 >= 4294967292) { - V(); - v(); - } - f = ((a >>> 0) / 210) | 0; - d = L(f, 210); - F[(e + 8) >> 2] = a - d; - g = (Lc(10544, 10736, (e + 8) | 0) - 10544) >> 2; - while (1) { - d = (F[((g << 2) + 10544) >> 2] + d) | 0; - a = 5; - while (1) { - b: { - if ((a | 0) == 47) { - a = 211; - while (1) { - b = ((d >>> 0) / (a >>> 0)) | 0; - if (b >>> 0 < a >>> 0) { - break a; - } - if ((L(a, b) | 0) == (d | 0)) { - break b; - } - b = (a + 10) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 12) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 16) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 18) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 22) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 28) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 30) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 36) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 40) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 42) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 46) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 52) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 58) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 60) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 66) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 70) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 72) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 78) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 82) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 88) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 96) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 100) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 102) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 106) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 108) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 112) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 120) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 126) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 130) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 136) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 138) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 142) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 148) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 150) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 156) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 162) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 166) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 168) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 172) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 178) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 180) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 186) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 190) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 192) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 196) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 198) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - if ((L(b, c) | 0) == (d | 0)) { - break b; - } - b = (a + 208) | 0; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - a = (a + 210) | 0; - if ((L(b, c) | 0) != (d | 0)) { - continue; - } - break; - } - break b; - } - b = F[((a << 2) + 10352) >> 2]; - c = ((d >>> 0) / (b >>> 0)) | 0; - if (b >>> 0 > c >>> 0) { - break a; - } - a = (a + 1) | 0; - if ((L(b, c) | 0) != (d | 0)) { - continue; - } - } - break; - } - d = (g + 1) | 0; - a = (d | 0) == 48; - g = a ? 0 : d; - f = (a + f) | 0; - d = L(f, 210); - } - } - Z = (e + 16) | 0; - return d; - } - function lb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = M(0), - k = 0, - l = 0; - a: { - if (!d) { - break a; - } - b: { - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(D[b | 0]); - J[((h << 2) + d) >> 2] = i ? M(j / M(127)) : j; - b = (b + 1) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(G[b | 0]); - J[((h << 2) + d) >> 2] = i ? M(j / M(255)) : j; - b = (b + 1) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(E[b >> 1]); - J[((h << 2) + d) >> 2] = i ? M(j / M(32767)) : j; - b = (b + 2) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(H[b >> 1]); - J[((h << 2) + d) >> 2] = i ? M(j / M(65535)) : j; - b = (b + 2) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(F[b >> 2]); - J[((h << 2) + d) >> 2] = i - ? M(j * M(4.656612873077393e-10)) - : j; - b = (b + 4) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(I[b >> 2]); - J[((h << 2) + d) >> 2] = i - ? M(j * M(2.3283064365386963e-10)) - : j; - b = (b + 4) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(+I[b >> 2] + +F[(b + 4) >> 2] * 4294967296); - J[((h << 2) + d) >> 2] = i - ? M(j * M(10842021724855044e-35)) - : j; - b = (b + 8) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - i = G[(a + 32) | 0]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - j = M(+I[b >> 2] + +I[(b + 4) >> 2] * 4294967296); - J[((h << 2) + d) >> 2] = i - ? M(j * M(5.421010862427522e-20)) - : j; - b = (b + 8) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 8: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - J[((h << 2) + d) >> 2] = J[b >> 2]; - b = (b + 4) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 9: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - J[((h << 2) + d) >> 2] = K[b >> 3]; - b = (b + 8) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - break b; - case 10: - break c; - default: - break a; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[a >> 2]; - g = F[e >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - k = b; - b = (b + i) | 0; - b = (b + g) | 0; - g = F[(e + 4) >> 2]; - while (1) { - if (b >>> 0 >= g >>> 0) { - break a; - } - J[((h << 2) + d) >> 2] = G[b | 0] ? M(1) : M(0); - b = (b + 1) | 0; - h = (h + 1) | 0; - e = G[(a + 24) | 0]; - if (h >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - l = 1; - if (e >>> 0 >= f >>> 0) { - break a; - } - d = ((e << 2) + d) | 0; - a = ((c & 255) - e) | 0; - } - ma(d, 0, a << 2); - } - return l; - } - function Cb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = M(0), - m = M(0); - a: { - b: { - if (!d) { - break b; - } - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - D[(d + g) | 0] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - return 0; - } - e = D[b | 0]; - if ((e | 0) < 0) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = H[b >> 1]; - if (((e + 128) & 65535) >>> 0 > 255) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = H[b >> 1]; - if (e >>> 0 > 127) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = F[b >> 2]; - if ((e + 128) >>> 0 > 255) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = F[b >> 2]; - if (e >>> 0 > 127) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - i = F[(b + 4) >> 2]; - e = F[b >> 2]; - h = (e + 128) | 0; - i = h >>> 0 < 128 ? (i + 1) | 0 : i; - if ((!i & (h >>> 0 > 255)) | i) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - i = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ((!i & (e >>> 0 > 127)) | i) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 8: - e = G[(a + 24) | 0]; - c = c & 255; - d: { - if (c >>> 0 > e >>> 0 ? e : c) { - e = F[F[a >> 2] >> 2]; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + f) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break d; - } - l = J[b >> 2]; - if ((l >= M(127)) | (l < M(-128)) | (l != l)) { - break d; - } - m = M(N(l)); - if (m == M(Infinity)) { - break d; - } - e = (d + g) | 0; - e: { - f: { - if (G[(a + 32) | 0]) { - if ((l < M(0)) | (l > M(1))) { - break d; - } - j = R(+l * 127 + 0.5); - if (!(N(j) < 2147483648)) { - break f; - } - h = ~~j; - break e; - } - if (!(m < M(2147483648))) { - break f; - } - h = ~~l; - break e; - } - h = -2147483648; - } - D[e | 0] = h; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if ( - g >>> 0 < - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - continue; - } - break; - } - } - k = 1; - if (c >>> 0 <= e >>> 0) { - break d; - } - ma((d + e) | 0, 0, (c - e) | 0); - } - return k; - case 9: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - j = K[b >> 3]; - if ( - (j >= 127) | - (j < -128) | - ((N(j) == Infinity) | (j != j)) - ) { - break b; - } - e = (d + g) | 0; - if (G[(a + 32) | 0]) { - if ((j < 0) | (j > 1)) { - break b; - } - j = R(j * 127 + 0.5); - } - g: { - if (N(j) < 2147483648) { - h = ~~j; - break g; - } - h = -2147483648; - } - D[e | 0] = h; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 10: - break c; - default: - break b; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - D[(d + g) | 0] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - ma((d + e) | 0, 0, ((c & 255) - e) | 0); - } - return k; - } - ma((d + e) | 0, 0, ((c & 255) - e) | 0); - return 1; - } - function Bb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = M(0); - a: { - b: { - if (!d) { - break b; - } - c: { - switch ((F[(a + 28) >> 2] - 1) | 0) { - case 0: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - return 0; - } - e = D[b | 0]; - if ((e | 0) < 0) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 1: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - D[(d + g) | 0] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 2: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = H[b >> 1]; - if (e >>> 0 > 255) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 3: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = H[b >> 1]; - if (e >>> 0 > 255) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 2) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 4: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = F[b >> 2]; - if (e >>> 0 > 255) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 5: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - e = F[b >> 2]; - if (e >>> 0 > 255) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 6: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - i = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ((!i & (e >>> 0 > 255)) | i) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 7: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - i = F[(b + 4) >> 2]; - e = F[b >> 2]; - if ((!i & (e >>> 0 > 255)) | i) { - break b; - } - D[(d + g) | 0] = e; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 8: - e = G[(a + 24) | 0]; - c = c & 255; - d: { - if (c >>> 0 > e >>> 0 ? e : c) { - e = F[F[a >> 2] >> 2]; - f = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + f) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break d; - } - l = J[b >> 2]; - if ( - (l >= M(255)) | - (l < M(0)) | - ((M(N(l)) == M(Infinity)) | (l != l)) - ) { - break d; - } - e = (d + g) | 0; - e: { - f: { - if (G[(a + 32) | 0]) { - if (l > M(1)) { - break d; - } - j = R(+l * 255 + 0.5); - if (!((j < 4294967296) & (j >= 0))) { - break f; - } - h = ~~j >>> 0; - break e; - } - if (!((l < M(4294967296)) & (l >= M(0)))) { - break f; - } - h = ~~l >>> 0; - break e; - } - h = 0; - } - D[e | 0] = h; - b = (b + 4) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if ( - g >>> 0 < - (c >>> 0 > e >>> 0 ? e : c) >>> 0 - ) { - continue; - } - break; - } - } - k = 1; - if (c >>> 0 <= e >>> 0) { - break d; - } - ma((d + e) | 0, 0, (c - e) | 0); - } - return k; - case 9: - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - j = K[b >> 3]; - if ( - (j >= 255) | - (j < 0) | - ((N(j) == Infinity) | (j != j)) - ) { - break b; - } - e = (d + g) | 0; - if (G[(a + 32) | 0]) { - if (j > 1) { - break b; - } - j = R(j * 255 + 0.5); - } - g: { - if ((j < 4294967296) & (j >= 0)) { - h = ~~j >>> 0; - break g; - } - h = 0; - } - D[e | 0] = h; - b = (b + 8) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - break a; - case 10: - break c; - default: - break b; - } - } - e = G[(a + 24) | 0]; - f = c & 255; - if (e >>> 0 < f >>> 0 ? e : f) { - e = F[F[a >> 2] >> 2]; - i = F[(a + 48) >> 2]; - b = ki(F[(a + 40) >> 2], F[(a + 44) >> 2], b, 0); - h = b; - b = (b + i) | 0; - b = (b + e) | 0; - while (1) { - if (I[(F[a >> 2] + 4) >> 2] <= b >>> 0) { - break b; - } - D[(d + g) | 0] = G[b | 0]; - b = (b + 1) | 0; - g = (g + 1) | 0; - e = G[(a + 24) | 0]; - if (g >>> 0 < (e >>> 0 < f >>> 0 ? e : f) >>> 0) { - continue; - } - break; - } - } - k = 1; - if (e >>> 0 >= f >>> 0) { - break b; - } - ma((d + e) | 0, 0, ((c & 255) - e) | 0); - } - return k; - } - ma((d + e) | 0, 0, ((c & 255) - e) | 0); - return 1; - } - function jc(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - e = (Z - 48) | 0; - Z = e; - f = H[5053] | (H[5054] << 16); - d = H[5051] | (H[5052] << 16); - E[(e + 38) >> 1] = d; - E[(e + 40) >> 1] = d >>> 16; - E[(e + 42) >> 1] = f; - E[(e + 44) >> 1] = f >>> 16; - d = F[2525]; - F[(e + 32) >> 2] = F[2524]; - F[(e + 36) >> 2] = d; - d = F[2523]; - F[(e + 24) >> 2] = F[2522]; - F[(e + 28) >> 2] = d; - d = F[2521]; - F[(e + 16) >> 2] = F[2520]; - F[(e + 20) >> 2] = d; - g = F[(b + 8) >> 2]; - i = F[(b + 12) >> 2]; - h = F[(b + 20) >> 2]; - d = F[(b + 16) >> 2]; - f = (d + 5) | 0; - h = f >>> 0 < 5 ? (h + 1) | 0 : h; - a: { - b: { - if ( - ((g >>> 0 < f >>> 0) & ((h | 0) >= (i | 0))) | - ((h | 0) > (i | 0)) - ) { - d = ya((e + 16) | 0); - if (d >>> 0 >= 2147483632) { - break a; - } - c: { - d: { - if (d >>> 0 >= 11) { - b = ((d | 15) + 1) | 0; - c = ka(b); - F[(e + 8) >> 2] = b | -2147483648; - F[e >> 2] = c; - F[(e + 4) >> 2] = d; - b = (c + d) | 0; - break d; - } - D[(e + 11) | 0] = d; - b = (d + e) | 0; - c = e; - if (!d) { - break c; - } - } - la(c, (e + 16) | 0, d); - } - D[b | 0] = 0; - F[a >> 2] = -2; - b = (a + 4) | 0; - if (D[(e + 11) | 0] >= 0) { - a = F[(e + 4) >> 2]; - F[b >> 2] = F[e >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(e + 8) >> 2]; - break b; - } - ra(b, F[e >> 2], F[(e + 4) >> 2]); - if (D[(e + 11) | 0] >= 0) { - break b; - } - ja(F[e >> 2]); - break b; - } - f = (d + F[b >> 2]) | 0; - d = - G[f | 0] | - (G[(f + 1) | 0] << 8) | - ((G[(f + 2) | 0] << 16) | (G[(f + 3) | 0] << 24)); - D[c | 0] = d; - D[(c + 1) | 0] = d >>> 8; - D[(c + 2) | 0] = d >>> 16; - D[(c + 3) | 0] = d >>> 24; - D[(c + 4) | 0] = G[(f + 4) | 0]; - d = F[(b + 20) >> 2]; - f = (F[(b + 16) >> 2] + 5) | 0; - d = f >>> 0 < 5 ? (d + 1) | 0 : d; - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = d; - if (sa(c, 1250, 5)) { - d = ka(32); - D[(d + 17) | 0] = 0; - D[(d + 16) | 0] = G[1494]; - c = - G[1490] | - (G[1491] << 8) | - ((G[1492] << 16) | (G[1493] << 24)); - b = - G[1486] | - (G[1487] << 8) | - ((G[1488] << 16) | (G[1489] << 24)); - D[(d + 8) | 0] = b; - D[(d + 9) | 0] = b >>> 8; - D[(d + 10) | 0] = b >>> 16; - D[(d + 11) | 0] = b >>> 24; - D[(d + 12) | 0] = c; - D[(d + 13) | 0] = c >>> 8; - D[(d + 14) | 0] = c >>> 16; - D[(d + 15) | 0] = c >>> 24; - c = - G[1482] | - (G[1483] << 8) | - ((G[1484] << 16) | (G[1485] << 24)); - b = - G[1478] | - (G[1479] << 8) | - ((G[1480] << 16) | (G[1481] << 24)); - D[d | 0] = b; - D[(d + 1) | 0] = b >>> 8; - D[(d + 2) | 0] = b >>> 16; - D[(d + 3) | 0] = b >>> 24; - D[(d + 4) | 0] = c; - D[(d + 5) | 0] = c >>> 8; - D[(d + 6) | 0] = c >>> 16; - D[(d + 7) | 0] = c >>> 24; - F[a >> 2] = -1; - ra((a + 4) | 0, d, 17); - ja(d); - break b; - } - g = F[(b + 12) >> 2]; - if ( - (((g | 0) <= (d | 0)) & (I[(b + 8) >> 2] <= f >>> 0)) | - ((d | 0) > (g | 0)) - ) { - d = ya((e + 16) | 0); - if (d >>> 0 >= 2147483632) { - break a; - } - e: { - f: { - if (d >>> 0 >= 11) { - b = ((d | 15) + 1) | 0; - c = ka(b); - F[(e + 8) >> 2] = b | -2147483648; - F[e >> 2] = c; - F[(e + 4) >> 2] = d; - b = (c + d) | 0; - break f; - } - D[(e + 11) | 0] = d; - b = (d + e) | 0; - c = e; - if (!d) { - break e; - } - } - la(c, (e + 16) | 0, d); - } - D[b | 0] = 0; - F[a >> 2] = -2; - b = (a + 4) | 0; - if (D[(e + 11) | 0] >= 0) { - a = F[(e + 4) >> 2]; - F[b >> 2] = F[e >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(e + 8) >> 2]; - break b; - } - ra(b, F[e >> 2], F[(e + 4) >> 2]); - if (D[(e + 11) | 0] >= 0) { - break b; - } - ja(F[e >> 2]); - break b; - } - D[(c + 5) | 0] = G[(f + F[b >> 2]) | 0]; - g = F[(b + 20) >> 2]; - d = (F[(b + 16) >> 2] + 1) | 0; - g = d ? g : (g + 1) | 0; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = g; - f = F[(b + 12) >> 2]; - if ( - (((f | 0) <= (g | 0)) & (I[(b + 8) >> 2] <= d >>> 0)) | - ((g | 0) > (f | 0)) - ) { - d = ya((e + 16) | 0); - if (d >>> 0 >= 2147483632) { - break a; - } - g: { - h: { - if (d >>> 0 >= 11) { - b = ((d | 15) + 1) | 0; - c = ka(b); - F[(e + 8) >> 2] = b | -2147483648; - F[e >> 2] = c; - F[(e + 4) >> 2] = d; - b = (c + d) | 0; - break h; - } - D[(e + 11) | 0] = d; - b = (d + e) | 0; - c = e; - if (!d) { - break g; - } - } - la(c, (e + 16) | 0, d); - } - D[b | 0] = 0; - F[a >> 2] = -2; - b = (a + 4) | 0; - if (D[(e + 11) | 0] >= 0) { - a = F[(e + 4) >> 2]; - F[b >> 2] = F[e >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(e + 8) >> 2]; - break b; - } - ra(b, F[e >> 2], F[(e + 4) >> 2]); - if (D[(e + 11) | 0] >= 0) { - break b; - } - ja(F[e >> 2]); - break b; - } - D[(c + 6) | 0] = G[(d + F[b >> 2]) | 0]; - h = F[(b + 20) >> 2]; - d = (F[(b + 16) >> 2] + 1) | 0; - h = d ? h : (h + 1) | 0; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = h; - f = F[(b + 12) >> 2]; - if ( - (((f | 0) <= (h | 0)) & (I[(b + 8) >> 2] <= d >>> 0)) | - ((f | 0) < (h | 0)) - ) { - d = ya((e + 16) | 0); - if (d >>> 0 >= 2147483632) { - break a; - } - i: { - j: { - if (d >>> 0 >= 11) { - b = ((d | 15) + 1) | 0; - c = ka(b); - F[(e + 8) >> 2] = b | -2147483648; - F[e >> 2] = c; - F[(e + 4) >> 2] = d; - b = (c + d) | 0; - break j; - } - D[(e + 11) | 0] = d; - b = (d + e) | 0; - c = e; - if (!d) { - break i; - } - } - la(c, (e + 16) | 0, d); - } - D[b | 0] = 0; - F[a >> 2] = -2; - b = (a + 4) | 0; - if (D[(e + 11) | 0] >= 0) { - a = F[(e + 4) >> 2]; - F[b >> 2] = F[e >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(e + 8) >> 2]; - break b; - } - ra(b, F[e >> 2], F[(e + 4) >> 2]); - if (D[(e + 11) | 0] >= 0) { - break b; - } - ja(F[e >> 2]); - break b; - } - D[(c + 7) | 0] = G[(d + F[b >> 2]) | 0]; - g = F[(b + 20) >> 2]; - d = (F[(b + 16) >> 2] + 1) | 0; - g = d ? g : (g + 1) | 0; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = g; - f = F[(b + 12) >> 2]; - if ( - (((f | 0) <= (g | 0)) & (I[(b + 8) >> 2] <= d >>> 0)) | - ((g | 0) > (f | 0)) - ) { - c = Eb(e, (e + 16) | 0); - F[a >> 2] = -2; - b = (a + 4) | 0; - if (D[(c + 11) | 0] >= 0) { - a = F[(c + 4) >> 2]; - F[b >> 2] = F[c >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(c + 8) >> 2]; - break b; - } - ra(b, F[c >> 2], F[(c + 4) >> 2]); - if (D[(c + 11) | 0] >= 0) { - break b; - } - ja(F[c >> 2]); - break b; - } - D[(c + 8) | 0] = G[(d + F[b >> 2]) | 0]; - d = F[(b + 20) >> 2]; - g = F[(b + 16) >> 2]; - f = (g + 1) | 0; - i = f ? d : (d + 1) | 0; - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = i; - i = F[(b + 8) >> 2]; - h = F[(b + 12) >> 2]; - g = (g + 3) | 0; - d = g >>> 0 < 3 ? (d + 1) | 0 : d; - if ( - ((g >>> 0 > i >>> 0) & ((d | 0) >= (h | 0))) | - ((d | 0) > (h | 0)) - ) { - c = Eb(e, (e + 16) | 0); - F[a >> 2] = -2; - b = (a + 4) | 0; - if (D[(c + 11) | 0] >= 0) { - a = F[(c + 4) >> 2]; - F[b >> 2] = F[c >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(c + 8) >> 2]; - break b; - } - ra(b, F[c >> 2], F[(c + 4) >> 2]); - if (D[(c + 11) | 0] >= 0) { - break b; - } - ja(F[c >> 2]); - break b; - } - d = c; - c = (F[b >> 2] + f) | 0; - E[(d + 10) >> 1] = G[c | 0] | (G[(c + 1) | 0] << 8); - g = F[(b + 20) >> 2]; - c = (F[(b + 16) >> 2] + 2) | 0; - g = c >>> 0 < 2 ? (g + 1) | 0 : g; - F[(b + 16) >> 2] = c; - F[(b + 20) >> 2] = g; - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - } - Z = (e + 48) | 0; - return; - } - za(); - v(); - } - function Mb(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0; - e = (Z - 96) | 0; - Z = e; - f = F[(a + 16) >> 2]; - D[(e + 92) | 0] = 1; - F[(e + 88) >> 2] = b; - F[(e + 84) >> 2] = b; - F[(e + 80) >> 2] = f; - j = F[(a + 20) >> 2]; - d = F[j >> 2]; - a: { - b: { - f = F[(F[(f + 28) >> 2] + (b << 2)) >> 2]; - if (f >>> 0 < ((F[(j + 4) >> 2] - d) >> 2) >>> 0) { - d = - F[ - (F[(a + 8) >> 2] + (F[(d + (f << 2)) >> 2] << 2)) >> 2 - ]; - f = F[(a + 4) >> 2]; - if (!G[(f + 84) | 0]) { - d = F[(F[(f + 68) >> 2] + (d << 2)) >> 2]; - } - F[(e + 72) >> 2] = 0; - F[(e + 76) >> 2] = 0; - j = (e - -64) | 0; - F[j >> 2] = 0; - F[(j + 4) >> 2] = 0; - F[(e + 56) >> 2] = 0; - F[(e + 60) >> 2] = 0; - Ga(f, d, D[(f + 24) | 0], (e + 56) | 0); - if ((b | 0) != -1) { - f = (b + 1) | 0; - j = ((f >>> 0) % 3) | 0 ? f : (b - 2) | 0; - m = ((((b >>> 0) % 3) | 0 ? -1 : 2) + b) | 0; - while (1) { - d = j; - f = m; - c: { - if (!F[(a + 28) >> 2]) { - break c; - } - f = (b + 1) | 0; - d = ((f >>> 0) % 3) | 0 ? f : (b - 2) | 0; - f = (b - 1) | 0; - if (((b >>> 0) % 3) | 0) { - break c; - } - f = (b + 2) | 0; - } - n = F[(a + 20) >> 2]; - b = F[n >> 2]; - d = - F[ - (F[(F[(a + 16) >> 2] + 28) >> 2] + (d << 2)) >> 2 - ]; - if (d >>> 0 >= ((F[(n + 4) >> 2] - b) >> 2) >>> 0) { - break b; - } - d = - F[ - (F[(a + 8) >> 2] + - (F[(b + (d << 2)) >> 2] << 2)) >> - 2 - ]; - b = F[(a + 4) >> 2]; - if (!G[(b + 84) | 0]) { - d = F[(F[(b + 68) >> 2] + (d << 2)) >> 2]; - } - F[(e + 48) >> 2] = 0; - F[(e + 52) >> 2] = 0; - F[(e + 40) >> 2] = 0; - F[(e + 44) >> 2] = 0; - F[(e + 32) >> 2] = 0; - F[(e + 36) >> 2] = 0; - Ga(b, d, D[(b + 24) | 0], (e + 32) | 0); - d = F[(a + 20) >> 2]; - b = F[d >> 2]; - f = - F[ - (F[(F[(a + 16) >> 2] + 28) >> 2] + (f << 2)) >> 2 - ]; - if (f >>> 0 >= ((F[(d + 4) >> 2] - b) >> 2) >>> 0) { - break a; - } - d = - F[ - (F[(a + 8) >> 2] + - (F[(b + (f << 2)) >> 2] << 2)) >> - 2 - ]; - b = F[(a + 4) >> 2]; - if (!G[(b + 84) | 0]) { - d = F[(F[(b + 68) >> 2] + (d << 2)) >> 2]; - } - F[(e + 24) >> 2] = 0; - F[(e + 28) >> 2] = 0; - F[(e + 16) >> 2] = 0; - F[(e + 20) >> 2] = 0; - F[(e + 8) >> 2] = 0; - F[(e + 12) >> 2] = 0; - Ga(b, d, D[(b + 24) | 0], (e + 8) | 0); - g = F[(e + 8) >> 2]; - b = F[(e + 56) >> 2]; - d = (g - b) | 0; - p = F[(e + 60) >> 2]; - t = - (F[(e + 12) >> 2] - - ((p + (b >>> 0 > g >>> 0)) | 0)) | - 0; - h = F[(e + 40) >> 2]; - f = F[(e + 64) >> 2]; - n = (h - f) | 0; - u = F[(e + 68) >> 2]; - y = - (F[(e + 44) >> 2] - - ((u + (f >>> 0 > h >>> 0)) | 0)) | - 0; - g = ki(d, t, n, y); - w = (o - g) | 0; - x = (i - ((_ + (g >>> 0 > o >>> 0)) | 0)) | 0; - i = w; - h = F[(e + 16) >> 2]; - g = (h - f) | 0; - u = - (F[(e + 20) >> 2] - - (((f >>> 0 > h >>> 0) + u) | 0)) | - 0; - k = F[(e + 32) >> 2]; - h = (k - b) | 0; - w = - (F[(e + 36) >> 2] - - (((b >>> 0 > k >>> 0) + p) | 0)) | - 0; - b = ki(g, u, h, w); - o = (i + b) | 0; - i = (_ + x) | 0; - i = b >>> 0 > o >>> 0 ? (i + 1) | 0 : i; - b = l; - l = d; - p = t; - k = F[(e + 48) >> 2]; - f = F[(e + 72) >> 2]; - d = (k - f) | 0; - t = F[(e + 76) >> 2]; - x = - (F[(e + 52) >> 2] - - ((t + (f >>> 0 > k >>> 0)) | 0)) | - 0; - l = ki(l, p, d, x); - k = (b + l) | 0; - b = (_ + q) | 0; - b = k >>> 0 < l >>> 0 ? (b + 1) | 0 : b; - l = F[(e + 24) >> 2]; - p = (l - f) | 0; - f = - (F[(e + 28) >> 2] - - (((f >>> 0 > l >>> 0) + t) | 0)) | - 0; - q = ki(p, f, h, w); - l = (k - q) | 0; - q = (b - ((_ + (k >>> 0 < q >>> 0)) | 0)) | 0; - b = ki(g, u, d, x); - d = (r - b) | 0; - b = (s - ((_ + (b >>> 0 > r >>> 0)) | 0)) | 0; - s = ki(p, f, n, y); - r = (s + d) | 0; - b = (_ + b) | 0; - s = r >>> 0 < s >>> 0 ? (b + 1) | 0 : b; - b = F[(e + 88) >> 2]; - f = F[(e + 80) >> 2]; - d: { - if (G[(e + 92) | 0]) { - e: { - f: { - g: { - h: { - if ((b | 0) == -1) { - break h; - } - d = (b + 1) | 0; - b = ((d >>> 0) % 3) | 0 ? d : (b - 2) | 0; - if ( - ((b | 0) == -1) | - ((F[ - (F[f >> 2] + - ((b >>> 3) & 536870908)) >> - 2 - ] >>> - b) & - 1) - ) { - break h; - } - b = - F[ - (F[(F[(f + 64) >> 2] + 12) >> 2] + - (b << 2)) >> - 2 - ]; - if ((b | 0) != -1) { - break g; - } - } - F[(e + 88) >> 2] = -1; - break f; - } - d = (b + 1) | 0; - b = ((d >>> 0) % 3) | 0 ? d : (b - 2) | 0; - F[(e + 88) >> 2] = b; - if ((b | 0) != -1) { - break e; - } - } - b = F[(e + 84) >> 2]; - d = -1; - i: { - if ((b | 0) == -1) { - break i; - } - j: { - if (((b >>> 0) % 3) | 0) { - b = (b - 1) | 0; - break j; - } - b = (b + 2) | 0; - d = -1; - if ((b | 0) == -1) { - break i; - } - } - d = -1; - if ( - (F[ - (F[f >> 2] + ((b >>> 3) & 536870908)) >> 2 - ] >>> - b) & - 1 - ) { - break i; - } - b = - F[ - (F[(F[(f + 64) >> 2] + 12) >> 2] + - (b << 2)) >> - 2 - ]; - d = -1; - if ((b | 0) == -1) { - break i; - } - d = (b - 1) | 0; - if (((b >>> 0) % 3) | 0) { - break i; - } - d = (b + 2) | 0; - } - D[(e + 92) | 0] = 0; - F[(e + 88) >> 2] = d; - break d; - } - if ((b | 0) != F[(e + 84) >> 2]) { - break d; - } - F[(e + 88) >> 2] = -1; - break d; - } - d = -1; - k: { - if ((b | 0) == -1) { - break k; - } - l: { - if (((b >>> 0) % 3) | 0) { - b = (b - 1) | 0; - break l; - } - b = (b + 2) | 0; - d = -1; - if ((b | 0) == -1) { - break k; - } - } - d = -1; - if ( - (F[ - (F[f >> 2] + ((b >>> 3) & 536870908)) >> 2 - ] >>> - b) & - 1 - ) { - break k; - } - b = - F[ - (F[(F[(f + 64) >> 2] + 12) >> 2] + - (b << 2)) >> - 2 - ]; - d = -1; - if ((b | 0) == -1) { - break k; - } - d = (b - 1) | 0; - if (((b >>> 0) % 3) | 0) { - break k; - } - d = (b + 2) | 0; - } - F[(e + 88) >> 2] = d; - } - b = F[(e + 88) >> 2]; - if ((b | 0) != -1) { - continue; - } - break; - } - } - b = s >> 31; - f = b ^ r; - d = (f - b) | 0; - b = ((b ^ s) - (((b >>> 0 > f >>> 0) + b) | 0)) | 0; - m = -1; - f = 2147483647; - g = q >> 31; - h = g ^ l; - j = (h - g) | 0; - n = ((g ^ q) - (((h >>> 0 < g >>> 0) + g) | 0)) | 0; - h = n; - k = j ^ -1; - g = h ^ 2147483647; - n = i; - m: { - n: { - if (!F[(a + 28) >> 2]) { - if ( - (((b | 0) == (g | 0)) & (d >>> 0 > k >>> 0)) | - (b >>> 0 > g >>> 0) - ) { - break m; - } - b = (b + h) | 0; - a = (d + j) | 0; - b = a >>> 0 < j >>> 0 ? (b + 1) | 0 : b; - f = a; - g = i; - a = g >> 31; - d = a; - m = d ^ o; - a = (m - d) | 0; - i = a; - d = ((d ^ g) - (((d >>> 0 > m >>> 0) + d) | 0)) | 0; - a = (a + f) | 0; - d = d ^ 2147483647; - i = - (((d | 0) == (b | 0)) & - ((i ^ -1) >>> 0 < f >>> 0)) | - (b >>> 0 > d >>> 0); - a = i ? -1 : a; - if ( - (!(i & 0) & ((a | 0) <= 536870912)) | - ((a | 0) < 536870912) - ) { - break m; - } - b = 0; - a = (a >>> 29) | 0; - break n; - } - o: { - if ( - (((b | 0) == (g | 0)) & (d >>> 0 > k >>> 0)) | - (b >>> 0 > g >>> 0) - ) { - break o; - } - b = (b + h) | 0; - a = (d + j) | 0; - b = a >>> 0 < j >>> 0 ? (b + 1) | 0 : b; - k = i; - d = i >> 31; - h = d ^ o; - i = (h - d) | 0; - j = ((d ^ k) - (((d >>> 0 > h >>> 0) + d) | 0)) | 0; - g = j ^ 2147483647; - d = a; - a = i; - if ( - (((g | 0) == (b | 0)) & - (d >>> 0 > (a ^ -1) >>> 0)) | - (b >>> 0 > g >>> 0) - ) { - break o; - } - b = (b + j) | 0; - m = (a + d) | 0; - b = m >>> 0 < a >>> 0 ? (b + 1) | 0 : b; - f = b; - if (!b & (m >>> 0 < 536870913)) { - break m; - } - } - b = (f >>> 29) | 0; - a = ((f & 536870911) << 3) | (m >>> 29); - } - o = li(o, n, a, b); - l = li(l, q, a, b); - r = li(r, s, a, b); - } - F[(c + 8) >> 2] = o; - F[(c + 4) >> 2] = l; - F[c >> 2] = r; - Z = (e + 96) | 0; - return; - } - ta(); - v(); - } - ta(); - v(); - } - ta(); - v(); - } - function te(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0; - g = (Z - 16) | 0; - Z = g; - f = 1; - m = $[F[(F[a >> 2] + 24) >> 2]](a) | 0; - a: { - if ((m | 0) <= 0) { - break a; - } - r = (a + 48) | 0; - f = 0; - while (1) { - b: { - c: { - if ( - !F[(($[F[(F[a >> 2] + 28) >> 2]](a) | 0) + 40) >> 2] - ) { - break c; - } - o = l << 2; - d = F[(o + F[(a + 36) >> 2]) >> 2]; - c = F[(d + 8) >> 2]; - e = bb(d); - if (!e) { - break c; - } - h = F[(($[F[(F[a >> 2] + 28) >> 2]](a) | 0) + 40) >> 2]; - F[(g + 12) >> 2] = F[(c + 56) >> 2]; - d = ka(32); - F[g >> 2] = d; - F[(g + 4) >> 2] = 24; - F[(g + 8) >> 2] = -2147483616; - c = - G[1196] | - (G[1197] << 8) | - ((G[1198] << 16) | (G[1199] << 24)); - b = - G[1192] | - (G[1193] << 8) | - ((G[1194] << 16) | (G[1195] << 24)); - D[(d + 16) | 0] = b; - D[(d + 17) | 0] = b >>> 8; - D[(d + 18) | 0] = b >>> 16; - D[(d + 19) | 0] = b >>> 24; - D[(d + 20) | 0] = c; - D[(d + 21) | 0] = c >>> 8; - D[(d + 22) | 0] = c >>> 16; - D[(d + 23) | 0] = c >>> 24; - c = - G[1188] | - (G[1189] << 8) | - ((G[1190] << 16) | (G[1191] << 24)); - b = - G[1184] | - (G[1185] << 8) | - ((G[1186] << 16) | (G[1187] << 24)); - D[(d + 8) | 0] = b; - D[(d + 9) | 0] = b >>> 8; - D[(d + 10) | 0] = b >>> 16; - D[(d + 11) | 0] = b >>> 24; - D[(d + 12) | 0] = c; - D[(d + 13) | 0] = c >>> 8; - D[(d + 14) | 0] = c >>> 16; - D[(d + 15) | 0] = c >>> 24; - c = - G[1180] | - (G[1181] << 8) | - ((G[1182] << 16) | (G[1183] << 24)); - b = - G[1176] | - (G[1177] << 8) | - ((G[1178] << 16) | (G[1179] << 24)); - D[d | 0] = b; - D[(d + 1) | 0] = b >>> 8; - D[(d + 2) | 0] = b >>> 16; - D[(d + 3) | 0] = b >>> 24; - D[(d + 4) | 0] = c; - D[(d + 5) | 0] = c >>> 8; - D[(d + 6) | 0] = c >>> 16; - D[(d + 7) | 0] = c >>> 24; - D[(d + 24) | 0] = 0; - c = (h + 16) | 0; - b = F[c >> 2]; - d: { - e: { - if (!b) { - break e; - } - i = F[(g + 12) >> 2]; - d = c; - while (1) { - k = (i | 0) > F[(b + 16) >> 2]; - d = k ? d : b; - b = F[(k ? (b + 4) | 0 : b) >> 2]; - if (b) { - continue; - } - break; - } - if ( - ((c | 0) == (d | 0)) | - ((i | 0) < F[(d + 16) >> 2]) - ) { - break e; - } - b = F[(d + 24) >> 2]; - if (!b) { - break e; - } - i = (d + 20) | 0; - d = G[(g + 11) | 0]; - c = (d << 24) >> 24 < 0; - k = c ? F[g >> 2] : g; - d = c ? F[(g + 4) >> 2] : d; - while (1) { - c = G[(b + 27) | 0]; - j = (c << 24) >> 24 < 0; - c = j ? F[(b + 20) >> 2] : c; - p = c >>> 0 < d >>> 0; - f: { - g: { - h: { - i: { - j: { - k: { - n = p ? c : d; - if (n) { - j = j - ? F[(b + 16) >> 2] - : (b + 16) | 0; - q = sa(k, j, n); - if (q) { - break k; - } - if (c >>> 0 <= d >>> 0) { - break j; - } - break f; - } - if (c >>> 0 <= d >>> 0) { - break i; - } - break f; - } - if ((q | 0) < 0) { - break f; - } - } - c = sa(j, k, n); - if (c) { - break h; - } - } - if (p) { - break g; - } - d = gc(i, g); - break d; - } - if ((c | 0) < 0) { - break g; - } - d = gc(i, g); - break d; - } - b = (b + 4) | 0; - } - b = F[b >> 2]; - if (b) { - continue; - } - break; - } - } - d = gc(h, g); - } - if (D[(g + 11) | 0] < 0) { - ja(F[g >> 2]); - } - if (!d) { - break c; - } - d = 0; - c = F[(F[(o + F[(a + 36) >> 2]) >> 2] + 8) >> 2]; - if (!F[(c + 64) >> 2]) { - b = ka(32); - F[(b + 16) >> 2] = 0; - F[(b + 20) >> 2] = 0; - F[(b + 8) >> 2] = 0; - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - F[(b + 24) >> 2] = 0; - F[(b + 28) >> 2] = 0; - f = F[(c + 64) >> 2]; - F[(c + 64) >> 2] = b; - if (f) { - b = F[f >> 2]; - if (b) { - F[(f + 4) >> 2] = b; - ja(b); - } - ja(f); - b = F[(c + 64) >> 2]; - } - F[c >> 2] = b; - f = F[(b + 20) >> 2]; - F[(c + 8) >> 2] = F[(b + 16) >> 2]; - F[(c + 12) >> 2] = f; - f = F[(b + 24) >> 2]; - b = F[(b + 28) >> 2]; - F[(c + 48) >> 2] = 0; - F[(c + 52) >> 2] = 0; - F[(c + 40) >> 2] = 0; - F[(c + 44) >> 2] = 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = b; - } - l: { - D[(c + 24) | 0] = G[(e + 24) | 0]; - F[(c + 28) >> 2] = F[(e + 28) >> 2]; - D[(c + 32) | 0] = G[(e + 32) | 0]; - b = F[(e + 44) >> 2]; - F[(c + 40) >> 2] = F[(e + 40) >> 2]; - F[(c + 44) >> 2] = b; - b = F[(e + 52) >> 2]; - F[(c + 48) >> 2] = F[(e + 48) >> 2]; - F[(c + 52) >> 2] = b; - F[(c + 56) >> 2] = F[(e + 56) >> 2]; - b = F[(e + 12) >> 2]; - F[(c + 8) >> 2] = F[(e + 8) >> 2]; - F[(c + 12) >> 2] = b; - b = F[(e + 20) >> 2]; - F[(c + 16) >> 2] = F[(e + 16) >> 2]; - F[(c + 20) >> 2] = b; - F[(c + 60) >> 2] = F[(e + 60) >> 2]; - f = F[e >> 2]; - m: { - if (!f) { - F[c >> 2] = 0; - b = 1; - break m; - } - h = F[c >> 2]; - b = 0; - if (!h) { - break m; - } - b = F[f >> 2]; - f = (F[(f + 4) >> 2] - b) | 0; - md(h, b, f, 0); - b = 1; - } - if (!b) { - break l; - } - D[(c + 84) | 0] = G[(e + 84) | 0]; - F[(c + 80) >> 2] = F[(e + 80) >> 2]; - if ((c | 0) != (e | 0)) { - gb( - (c + 68) | 0, - F[(e + 68) >> 2], - F[(e + 72) >> 2], - ); - } - n: { - h = F[(e + 88) >> 2]; - o: { - if (h) { - f = ka(40); - e = F[h >> 2]; - F[(f + 16) >> 2] = 0; - F[(f + 8) >> 2] = 0; - F[(f + 12) >> 2] = 0; - F[f >> 2] = e; - e = F[(h + 12) >> 2]; - b = F[(h + 8) >> 2]; - if ((e | 0) != (b | 0)) { - b = (e - b) | 0; - if ((b | 0) < 0) { - break n; - } - e = ka(b); - F[(f + 12) >> 2] = e; - F[(f + 8) >> 2] = e; - F[(f + 16) >> 2] = b + e; - b = F[(h + 8) >> 2]; - i = F[(h + 12) >> 2]; - p: { - if ((b | 0) == (i | 0)) { - break p; - } - k = (i + (b ^ -1)) | 0; - j = (i - b) & 7; - if (j) { - while (1) { - D[e | 0] = G[b | 0]; - e = (e + 1) | 0; - b = (b + 1) | 0; - d = (d + 1) | 0; - if ((j | 0) != (d | 0)) { - continue; - } - break; - } - } - if (k >>> 0 < 7) { - break p; - } - while (1) { - D[e | 0] = G[b | 0]; - D[(e + 1) | 0] = G[(b + 1) | 0]; - D[(e + 2) | 0] = G[(b + 2) | 0]; - D[(e + 3) | 0] = G[(b + 3) | 0]; - D[(e + 4) | 0] = G[(b + 4) | 0]; - D[(e + 5) | 0] = G[(b + 5) | 0]; - D[(e + 6) | 0] = G[(b + 6) | 0]; - D[(e + 7) | 0] = G[(b + 7) | 0]; - e = (e + 8) | 0; - b = (b + 8) | 0; - if ((i | 0) != (b | 0)) { - continue; - } - break; - } - } - F[(f + 12) >> 2] = e; - } - d = F[(h + 36) >> 2]; - F[(f + 32) >> 2] = F[(h + 32) >> 2]; - F[(f + 36) >> 2] = d; - d = F[(h + 28) >> 2]; - F[(f + 24) >> 2] = F[(h + 24) >> 2]; - F[(f + 28) >> 2] = d; - e = F[(c + 88) >> 2]; - F[(c + 88) >> 2] = f; - if (e) { - break o; - } - break l; - } - e = F[(c + 88) >> 2]; - F[(c + 88) >> 2] = 0; - if (!e) { - break l; - } - } - d = F[(e + 8) >> 2]; - if (d) { - F[(e + 12) >> 2] = d; - ja(d); - } - ja(e); - break l; - } - na(); - v(); - } - break b; - } - d = F[(F[(a + 36) >> 2] + (l << 2)) >> 2]; - if (!($[F[(F[d >> 2] + 24) >> 2]](d, r) | 0)) { - break a; - } - } - l = (l + 1) | 0; - f = (m | 0) <= (l | 0); - if ((l | 0) != (m | 0)) { - continue; - } - break; - } - } - Z = (g + 16) | 0; - return f | 0; - } - function Jg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0; - f = (Z - 32) | 0; - Z = f; - a: { - if (!hb(1, (f + 28) | 0, F[(a + 32) >> 2])) { - break a; - } - if (!hb(1, (f + 24) | 0, F[(a + 32) >> 2])) { - break a; - } - l = F[(f + 28) >> 2]; - if (l >>> 0 > 1431655765) { - break a; - } - d = F[(a + 32) >> 2]; - c = d; - i = F[(c + 8) >> 2]; - b = F[(c + 16) >> 2]; - h = F[(c + 12) >> 2]; - c = F[(c + 20) >> 2]; - g = li( - (i - b) | 0, - (h - ((c + (b >>> 0 > i >>> 0)) | 0)) | 0, - 3, - 0, - ); - if (!_ & (g >>> 0 < l >>> 0)) { - break a; - } - n = F[(f + 24) >> 2]; - g = ki(l, 0, 3, 0); - if ( - (!_ & (g >>> 0 < n >>> 0)) | - ((((c | 0) >= (h | 0)) & (b >>> 0 >= i >>> 0)) | - ((c | 0) > (h | 0))) - ) { - break a; - } - i = G[(b + F[d >> 2]) | 0]; - b = (b + 1) | 0; - c = b ? c : (c + 1) | 0; - F[(d + 16) >> 2] = b; - F[(d + 20) >> 2] = c; - b: { - c: { - if (!i) { - d = 0; - c = (Z - 32) | 0; - Z = c; - F[(c + 24) >> 2] = 0; - F[(c + 16) >> 2] = 0; - F[(c + 20) >> 2] = 0; - d: { - e: { - b = L(l, 3); - if (b) { - if (b >>> 0 >= 1073741824) { - break e; - } - i = L(l, 12); - d = ka(i); - ma(d, 0, i); - } - b = mc(b, 1, F[(a + 32) >> 2], d); - f: { - g: { - if (!(!l | !b)) { - i = 0; - while (1) { - h: { - g = e; - b = ((i << 2) + d) | 0; - h = F[b >> 2]; - e = (h >>> 1) | 0; - h = (g + (h & 1 ? (0 - e) | 0 : e)) | 0; - if ((h | 0) < 0) { - break h; - } - F[c >> 2] = h; - e = F[(b + 4) >> 2]; - g = (e >>> 1) | 0; - h = (h + (e & 1 ? (0 - g) | 0 : g)) | 0; - if ((h | 0) < 0) { - break h; - } - F[(c + 4) >> 2] = h; - b = F[(b + 8) >> 2]; - e = (b >>> 1) | 0; - e = (h + (b & 1 ? (0 - e) | 0 : e)) | 0; - if ((e | 0) < 0) { - break h; - } - F[(c + 8) >> 2] = e; - mb((F[(a + 44) >> 2] + 96) | 0, c); - i = (i + 3) | 0; - b = 1; - j = (j + 1) | 0; - if ((j | 0) != (l | 0)) { - continue; - } - break g; - } - break; - } - b = 0; - break g; - } - if (!d) { - break f; - } - } - ja(d); - } - Z = (c + 32) | 0; - break d; - } - na(); - v(); - } - if (b) { - break c; - } - break a; - } - if (n >>> 0 <= 255) { - if (!l) { - break c; - } - while (1) { - i: { - F[(f + 16) >> 2] = 0; - F[(f + 8) >> 2] = 0; - F[(f + 12) >> 2] = 0; - d = F[(a + 32) >> 2]; - b = d; - i = F[(b + 16) >> 2]; - e = F[(b + 8) >> 2]; - c = F[(b + 20) >> 2]; - g = F[(b + 12) >> 2]; - b = g; - if ( - ((e >>> 0 <= i >>> 0) & ((c | 0) >= (b | 0))) | - ((b | 0) < (c | 0)) - ) { - break i; - } - j = F[d >> 2]; - m = G[(j + i) | 0]; - b = c; - h = (i + 1) | 0; - b = h ? b : (b + 1) | 0; - F[(d + 16) >> 2] = h; - F[(d + 20) >> 2] = b; - F[(f + 8) >> 2] = m; - m = - ((e >>> 0 < i >>> 0) & ((c | 0) >= (g | 0))) | - ((c | 0) > (g | 0)); - e = m ? i : e; - g = m ? c : g; - if (((e | 0) == (h | 0)) & ((g | 0) == (b | 0))) { - break i; - } - m = G[(h + j) | 0]; - b = c; - h = (i + 2) | 0; - b = h >>> 0 < 2 ? (b + 1) | 0 : b; - F[(d + 16) >> 2] = h; - F[(d + 20) >> 2] = b; - F[(f + 12) >> 2] = m; - if (((e | 0) == (h | 0)) & ((b | 0) == (g | 0))) { - break i; - } - h = G[(h + j) | 0]; - b = c; - c = (i + 3) | 0; - b = c >>> 0 < 3 ? (b + 1) | 0 : b; - F[(d + 16) >> 2] = c; - F[(d + 20) >> 2] = b; - F[(f + 16) >> 2] = h; - mb((F[(a + 44) >> 2] + 96) | 0, (f + 8) | 0); - k = (k + 1) | 0; - if ((l | 0) != (k | 0)) { - continue; - } - break c; - } - break; - } - k = 0; - break a; - } - if (n >>> 0 <= 65535) { - if (!l) { - break c; - } - while (1) { - j: { - F[(f + 16) >> 2] = 0; - F[(f + 8) >> 2] = 0; - F[(f + 12) >> 2] = 0; - j = F[(a + 32) >> 2]; - b = j; - c = F[(b + 8) >> 2]; - d = F[(b + 12) >> 2]; - h = F[(b + 16) >> 2]; - b = F[(b + 20) >> 2]; - i = b; - e = (h + 2) | 0; - b = e >>> 0 < 2 ? (b + 1) | 0 : b; - if ( - ((c >>> 0 < e >>> 0) & ((b | 0) >= (d | 0))) | - ((b | 0) > (d | 0)) - ) { - break j; - } - m = F[j >> 2]; - g = (m + h) | 0; - g = G[g | 0] | (G[(g + 1) | 0] << 8); - F[(j + 16) >> 2] = e; - F[(j + 20) >> 2] = b; - F[(f + 8) >> 2] = g; - b = i; - g = (h + 4) | 0; - b = g >>> 0 < 4 ? (b + 1) | 0 : b; - if ( - ((c >>> 0 < g >>> 0) & ((b | 0) >= (d | 0))) | - ((b | 0) > (d | 0)) - ) { - break j; - } - e = (e + m) | 0; - e = G[e | 0] | (G[(e + 1) | 0] << 8); - F[(j + 16) >> 2] = g; - F[(j + 20) >> 2] = b; - F[(f + 12) >> 2] = e; - e = c; - b = i; - c = (h + 6) | 0; - b = c >>> 0 < 6 ? (b + 1) | 0 : b; - if ( - ((c >>> 0 > e >>> 0) & ((b | 0) >= (d | 0))) | - ((b | 0) > (d | 0)) - ) { - break j; - } - d = (g + m) | 0; - d = G[d | 0] | (G[(d + 1) | 0] << 8); - F[(j + 16) >> 2] = c; - F[(j + 20) >> 2] = b; - F[(f + 16) >> 2] = d; - mb((F[(a + 44) >> 2] + 96) | 0, (f + 8) | 0); - k = (k + 1) | 0; - if ((l | 0) != (k | 0)) { - continue; - } - break c; - } - break; - } - k = 0; - break a; - } - k: { - if (n >>> 0 > 2097151) { - break k; - } - b = H[(a + 36) >> 1]; - if ((((b << 8) | (b >>> 8)) & 65535) >>> 0 < 514) { - break k; - } - if (!l) { - break c; - } - while (1) { - l: { - F[(f + 16) >> 2] = 0; - F[(f + 8) >> 2] = 0; - F[(f + 12) >> 2] = 0; - if (!hb(1, (f + 4) | 0, F[(a + 32) >> 2])) { - break l; - } - F[(f + 8) >> 2] = F[(f + 4) >> 2]; - if (!hb(1, (f + 4) | 0, F[(a + 32) >> 2])) { - break l; - } - F[(f + 12) >> 2] = F[(f + 4) >> 2]; - if (!hb(1, (f + 4) | 0, F[(a + 32) >> 2])) { - break l; - } - F[(f + 16) >> 2] = F[(f + 4) >> 2]; - mb((F[(a + 44) >> 2] + 96) | 0, (f + 8) | 0); - k = (k + 1) | 0; - if ((l | 0) != (k | 0)) { - continue; - } - break c; - } - break; - } - k = 0; - break a; - } - if (!l) { - break c; - } - while (1) { - F[(f + 16) >> 2] = 0; - F[(f + 8) >> 2] = 0; - F[(f + 12) >> 2] = 0; - j = F[(a + 32) >> 2]; - b = j; - c = F[(b + 8) >> 2]; - d = F[(b + 12) >> 2]; - h = F[(b + 16) >> 2]; - b = F[(b + 20) >> 2]; - i = b; - e = (h + 4) | 0; - b = e >>> 0 < 4 ? (b + 1) | 0 : b; - if ( - ((c >>> 0 < e >>> 0) & ((b | 0) >= (d | 0))) | - ((b | 0) > (d | 0)) - ) { - break b; - } - m = F[j >> 2]; - g = (m + h) | 0; - g = - G[g | 0] | - (G[(g + 1) | 0] << 8) | - ((G[(g + 2) | 0] << 16) | (G[(g + 3) | 0] << 24)); - F[(j + 16) >> 2] = e; - F[(j + 20) >> 2] = b; - F[(f + 8) >> 2] = g; - b = i; - g = (h + 8) | 0; - b = g >>> 0 < 8 ? (b + 1) | 0 : b; - if ( - ((c >>> 0 < g >>> 0) & ((b | 0) >= (d | 0))) | - ((b | 0) > (d | 0)) - ) { - break b; - } - e = (e + m) | 0; - e = - G[e | 0] | - (G[(e + 1) | 0] << 8) | - ((G[(e + 2) | 0] << 16) | (G[(e + 3) | 0] << 24)); - F[(j + 16) >> 2] = g; - F[(j + 20) >> 2] = b; - F[(f + 12) >> 2] = e; - e = c; - b = i; - c = (h + 12) | 0; - b = c >>> 0 < 12 ? (b + 1) | 0 : b; - if ( - ((c >>> 0 > e >>> 0) & ((b | 0) >= (d | 0))) | - ((b | 0) > (d | 0)) - ) { - break b; - } - d = (g + m) | 0; - d = - G[d | 0] | - (G[(d + 1) | 0] << 8) | - ((G[(d + 2) | 0] << 16) | (G[(d + 3) | 0] << 24)); - F[(j + 16) >> 2] = c; - F[(j + 20) >> 2] = b; - F[(f + 16) >> 2] = d; - mb((F[(a + 44) >> 2] + 96) | 0, (f + 8) | 0); - k = (k + 1) | 0; - if ((l | 0) != (k | 0)) { - continue; - } - break; - } - } - F[(F[(a + 4) >> 2] + 80) >> 2] = n; - k = 1; - break a; - } - k = 0; - } - Z = (f + 32) | 0; - return k | 0; - } - function Ld(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0; - g = (Z + -64) | 0; - Z = g; - F[(g + 56) >> 2] = 0; - F[(g + 48) >> 2] = 0; - F[(g + 52) >> 2] = 0; - F[(g + 40) >> 2] = 0; - F[(g + 44) >> 2] = 0; - F[(g + 32) >> 2] = 0; - F[(g + 36) >> 2] = 0; - F[(g + 24) >> 2] = 0; - F[(g + 28) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - F[(g + 8) >> 2] = 0; - F[(g + 12) >> 2] = 0; - h = (g + 8) | 0; - a: { - b: { - if (!H[(b + 38) >> 1]) { - break b; - } - if (!Ta(1, (h + 12) | 0, b)) { - break b; - } - e = F[(b + 8) >> 2]; - f = F[(b + 16) >> 2]; - j = (e - f) | 0; - k = F[(h + 12) >> 2]; - e = - (F[(b + 12) >> 2] - - ((F[(b + 20) >> 2] + (e >>> 0 < f >>> 0)) | 0)) | - 0; - if ( - ((j >>> 0 < (k >>> 6) >>> 0) & ((e | 0) <= 0)) | - ((e | 0) < 0) - ) { - break b; - } - e = F[h >> 2]; - d = (F[(h + 4) >> 2] - e) >> 2; - c: { - if (d >>> 0 < k >>> 0) { - qa(h, (k - d) | 0); - k = F[(h + 12) >> 2]; - break c; - } - if (d >>> 0 <= k >>> 0) { - break c; - } - F[(h + 4) >> 2] = e + (k << 2); - } - i = 1; - if (!k) { - break a; - } - e = F[(b + 16) >> 2]; - d = F[(b + 20) >> 2]; - r = F[h >> 2]; - l = F[(b + 8) >> 2]; - o = F[(b + 12) >> 2]; - j = 0; - while (1) { - i = 0; - if ( - (((d | 0) >= (o | 0)) & (e >>> 0 >= l >>> 0)) | - ((d | 0) > (o | 0)) - ) { - break a; - } - i = F[b >> 2]; - p = G[(i + e) | 0]; - e = (e + 1) | 0; - d = e ? d : (d + 1) | 0; - F[(b + 16) >> 2] = e; - F[(b + 20) >> 2] = d; - f = (p >>> 2) | 0; - m = 0; - d: { - e: { - f: { - g: { - s = p & 3; - switch (s | 0) { - case 3: - break g; - case 0: - break e; - default: - break f; - } - } - f = (f + j) | 0; - i = 0; - if (f >>> 0 >= k >>> 0) { - break a; - } - ma((r + (j << 2)) | 0, 0, ((p & 252) + 4) | 0); - j = f; - break d; - } - while (1) { - if (((e | 0) == (l | 0)) & ((d | 0) == (o | 0))) { - break b; - } - k = G[(e + i) | 0]; - e = (e + 1) | 0; - d = e ? d : (d + 1) | 0; - F[(b + 16) >> 2] = e; - F[(b + 20) >> 2] = d; - f = (k << ((m << 3) | 6)) | f; - m = (m + 1) | 0; - if ((s | 0) != (m | 0)) { - continue; - } - break; - } - } - F[(r + (j << 2)) >> 2] = f; - } - j = (j + 1) | 0; - k = F[(h + 12) >> 2]; - if (j >>> 0 < k >>> 0) { - continue; - } - break; - } - d = (h + 16) | 0; - o = F[h >> 2]; - f = F[(h + 16) >> 2]; - e = (F[(h + 20) >> 2] - f) | 0; - h: { - if (e >>> 0 <= 4194303) { - qa(d, (1048576 - ((e >>> 2) | 0)) | 0); - break h; - } - if ((e | 0) == 4194304) { - break h; - } - F[(h + 20) >> 2] = f + 4194304; - } - e = (h + 28) | 0; - j = F[e >> 2]; - f = (F[(h + 32) >> 2] - j) >> 3; - i: { - if (f >>> 0 < k >>> 0) { - _a(e, (k - f) | 0); - j = F[e >> 2]; - break i; - } - if (f >>> 0 > k >>> 0) { - F[(h + 32) >> 2] = (k << 3) + j; - } - if (!k) { - break b; - } - } - l = F[d >> 2]; - d = 0; - i = 0; - while (1) { - e = (o + (d << 2)) | 0; - h = F[e >> 2]; - m = ((d << 3) + j) | 0; - f = i; - F[(m + 4) >> 2] = f; - F[m >> 2] = h; - e = F[e >> 2]; - i = (e + f) | 0; - if (i >>> 0 > 1048576) { - break b; - } - j: { - if (f >>> 0 >= i >>> 0) { - break j; - } - m = 0; - h = e & 7; - if (h) { - while (1) { - F[(l + (f << 2)) >> 2] = d; - f = (f + 1) | 0; - m = (m + 1) | 0; - if ((h | 0) != (m | 0)) { - continue; - } - break; - } - } - if ((e - 1) >>> 0 <= 6) { - break j; - } - while (1) { - e = (l + (f << 2)) | 0; - F[e >> 2] = d; - F[(e + 28) >> 2] = d; - F[(e + 24) >> 2] = d; - F[(e + 20) >> 2] = d; - F[(e + 16) >> 2] = d; - F[(e + 12) >> 2] = d; - F[(e + 8) >> 2] = d; - F[(e + 4) >> 2] = d; - f = (f + 8) | 0; - if ((i | 0) != (f | 0)) { - continue; - } - break; - } - } - d = (d + 1) | 0; - if ((k | 0) != (d | 0)) { - continue; - } - break; - } - n = (i | 0) == 1048576; - } - i = n; - } - k: { - if (!i | (F[(g + 20) >> 2] ? 0 : a)) { - break k; - } - i = 0; - j = (Z - 16) | 0; - Z = j; - l: { - if (!Sa(1, (j + 8) | 0, b)) { - break l; - } - d = F[(b + 8) >> 2]; - f = F[(b + 16) >> 2]; - l = (d - f) | 0; - n = F[(j + 12) >> 2]; - h = F[(b + 20) >> 2]; - d = - (F[(b + 12) >> 2] - ((h + (d >>> 0 < f >>> 0)) | 0)) | 0; - e = F[(j + 8) >> 2]; - if ( - (((n | 0) == (d | 0)) & (e >>> 0 > l >>> 0)) | - (d >>> 0 < n >>> 0) - ) { - break l; - } - d = (h + n) | 0; - l = (e + f) | 0; - d = l >>> 0 < f >>> 0 ? (d + 1) | 0 : d; - F[(b + 16) >> 2] = l; - F[(b + 20) >> 2] = d; - if ((e | 0) <= 0) { - break l; - } - b = (f + F[b >> 2]) | 0; - F[(g + 48) >> 2] = b; - d = (e - 1) | 0; - f = (d + b) | 0; - l = G[f | 0]; - m: { - if (l >>> 0 <= 63) { - F[(g + 52) >> 2] = d; - b = G[f | 0] & 63; - break m; - } - n: { - switch ((((l >>> 6) | 0) - 1) | 0) { - case 0: - if (e >>> 0 < 2) { - break l; - } - d = (e - 2) | 0; - F[(g + 52) >> 2] = d; - b = (b + d) | 0; - b = ((G[(b + 1) | 0] << 8) & 16128) | G[b | 0]; - break m; - case 1: - if (e >>> 0 < 3) { - break l; - } - d = (e - 3) | 0; - F[(g + 52) >> 2] = d; - b = (b + d) | 0; - b = - (G[(b + 1) | 0] << 8) | - ((G[(b + 2) | 0] << 16) & 4128768) | - G[b | 0]; - break m; - default: - break n; - } - } - d = (e - 4) | 0; - F[(g + 52) >> 2] = d; - b = (b + d) | 0; - b = - (G[b | 0] | - (G[(b + 1) | 0] << 8) | - ((G[(b + 2) | 0] << 16) | (G[(b + 3) | 0] << 24))) & - 1073741823; - } - F[(g + 56) >> 2] = b + 4194304; - i = b >>> 0 < 1069547520; - } - Z = (j + 16) | 0; - if (!i) { - break k; - } - if (!a) { - t = 1; - break k; - } - b = F[(g + 52) >> 2]; - f = F[(g + 56) >> 2]; - d = F[(g + 36) >> 2]; - e = F[(g + 48) >> 2]; - j = F[(g + 24) >> 2]; - while (1) { - o: { - if (f >>> 0 > 4194303) { - break o; - } - while (1) { - if ((b | 0) <= 0) { - break o; - } - b = (b - 1) | 0; - F[(g + 52) >> 2] = b; - f = G[(b + e) | 0] | (f << 8); - F[(g + 56) >> 2] = f; - if (f >>> 0 < 4194304) { - continue; - } - break; - } - } - i = f & 1048575; - l = F[(j + (i << 2)) >> 2]; - n = (d + (l << 3)) | 0; - f = - (((L(F[n >> 2], (f >>> 20) | 0) + i) | 0) - - F[(n + 4) >> 2]) | - 0; - F[(g + 56) >> 2] = f; - F[((q << 2) + c) >> 2] = l; - t = 1; - q = (q + 1) | 0; - if ((q | 0) != (a | 0)) { - continue; - } - break; - } - } - a = F[(g + 36) >> 2]; - if (a) { - F[(g + 40) >> 2] = a; - ja(a); - } - a = F[(g + 24) >> 2]; - if (a) { - F[(g + 28) >> 2] = a; - ja(a); - } - a = F[(g + 8) >> 2]; - if (a) { - F[(g + 12) >> 2] = a; - ja(a); - } - Z = (g - -64) | 0; - return t; - } - function kh(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = M(0), - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = M(0), - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - v = 0, - w = 0, - x = 0; - if (F[c >> 2] == F[(c + 4) >> 2]) { - m = F[(d + 80) >> 2]; - u = (Z - 16) | 0; - Z = u; - g = F[(a + 4) >> 2]; - k = G[(b + 24) | 0]; - h = F[(d + 48) >> 2]; - n = F[F[d >> 2] >> 2]; - c = (u + 8) | 0; - F[c >> 2] = 1065353216; - d = c; - J[c >> 2] = M((-1 << g) ^ -1) / J[(a + 20) >> 2]; - c = ka(k << 2); - a: { - if (!m | !k) { - break a; - } - p = (h + n) | 0; - o = J[d >> 2]; - n = F[(a + 8) >> 2]; - v = F[b >> 2]; - d = F[(b + 48) >> 2]; - g = F[(b + 40) >> 2]; - w = F[(b + 44) >> 2]; - if (!G[(b + 84) | 0]) { - f = F[(b + 68) >> 2]; - s = k & 254; - t = k & 1; - a = 0; - while (1) { - b = F[v >> 2]; - l = (ki(g, w, F[(f + (i << 2)) >> 2], 0) + d) | 0; - h = la(c, (b + l) | 0, g); - b = 0; - q = 0; - if ((k | 0) != 1) { - while (1) { - l = (p + (a << 2)) | 0; - j = b << 2; - e = M( - R( - M( - M(o * M(J[(j + h) >> 2] - J[(n + j) >> 2])) + - M(0.5), - ), - ), - ); - b: { - if (M(N(e)) < M(2147483648)) { - r = ~~e; - break b; - } - r = -2147483648; - } - F[l >> 2] = r; - j = j | 4; - e = M( - R( - M( - M(o * M(J[(j + h) >> 2] - J[(n + j) >> 2])) + - M(0.5), - ), - ), - ); - c: { - if (M(N(e)) < M(2147483648)) { - j = ~~e; - break c; - } - j = -2147483648; - } - F[(l + 4) >> 2] = j; - b = (b + 2) | 0; - a = (a + 2) | 0; - q = (q + 2) | 0; - if ((s | 0) != (q | 0)) { - continue; - } - break; - } - } - if (t) { - l = (p + (a << 2)) | 0; - b = b << 2; - e = M( - R( - M( - M(o * M(J[(b + h) >> 2] - J[(b + n) >> 2])) + - M(0.5), - ), - ), - ); - d: { - if (M(N(e)) < M(2147483648)) { - b = ~~e; - break d; - } - b = -2147483648; - } - F[l >> 2] = b; - a = (a + 1) | 0; - } - i = (i + 1) | 0; - if ((m | 0) != (i | 0)) { - continue; - } - break; - } - break a; - } - s = k & 254; - t = k & 1; - a = 0; - while (1) { - b = F[v >> 2]; - h = (ki(g, w, i, l) + d) | 0; - j = la(c, (b + h) | 0, g); - b = 0; - q = 0; - if ((k | 0) != 1) { - while (1) { - h = (p + (a << 2)) | 0; - f = b << 2; - e = M( - R( - M( - M(o * M(J[(f + j) >> 2] - J[(f + n) >> 2])) + - M(0.5), - ), - ), - ); - e: { - if (M(N(e)) < M(2147483648)) { - r = ~~e; - break e; - } - r = -2147483648; - } - F[h >> 2] = r; - f = f | 4; - e = M( - R( - M( - M(o * M(J[(f + j) >> 2] - J[(f + n) >> 2])) + - M(0.5), - ), - ), - ); - f: { - if (M(N(e)) < M(2147483648)) { - f = ~~e; - break f; - } - f = -2147483648; - } - F[(h + 4) >> 2] = f; - b = (b + 2) | 0; - a = (a + 2) | 0; - q = (q + 2) | 0; - if ((s | 0) != (q | 0)) { - continue; - } - break; - } - } - if (t) { - h = (p + (a << 2)) | 0; - b = b << 2; - e = M( - R( - M( - M(o * M(J[(b + j) >> 2] - J[(b + n) >> 2])) + - M(0.5), - ), - ), - ); - g: { - if (M(N(e)) < M(2147483648)) { - b = ~~e; - break g; - } - b = -2147483648; - } - F[h >> 2] = b; - a = (a + 1) | 0; - } - b = l; - i = (i + 1) | 0; - b = i ? b : (b + 1) | 0; - l = b; - if (((i | 0) != (m | 0)) | b) { - continue; - } - break; - } - } - ja(c); - Z = (u + 16) | 0; - return 1; - } - j = (Z - 16) | 0; - Z = j; - m = F[(a + 4) >> 2]; - i = G[(b + 24) | 0]; - g = F[(d + 48) >> 2]; - h = F[F[d >> 2] >> 2]; - d = (j + 8) | 0; - F[d >> 2] = 1065353216; - l = d; - J[d >> 2] = M((-1 << m) ^ -1) / J[(a + 20) >> 2]; - d = ka(i << 2); - m = F[(c + 4) >> 2]; - q = F[c >> 2]; - h: { - if (!i | ((m | 0) == (q | 0))) { - break h; - } - n = (h + g) | 0; - c = (m - q) >> 2; - u = c >>> 0 <= 1 ? 1 : c; - o = J[l >> 2]; - h = F[(a + 8) >> 2]; - v = F[b >> 2]; - l = F[(b + 48) >> 2]; - m = F[(b + 40) >> 2]; - w = F[(b + 44) >> 2]; - if (G[(b + 84) | 0]) { - s = i & 254; - t = i & 1; - a = 0; - c = 0; - while (1) { - b = F[v >> 2]; - g = (ki(m, w, F[(q + (c << 2)) >> 2], 0) + l) | 0; - p = la(d, (b + g) | 0, m); - b = 0; - k = 0; - if ((i | 0) != 1) { - while (1) { - g = (n + (a << 2)) | 0; - f = b << 2; - e = M( - R( - M( - M(o * M(J[(f + p) >> 2] - J[(h + f) >> 2])) + - M(0.5), - ), - ), - ); - i: { - if (M(N(e)) < M(2147483648)) { - r = ~~e; - break i; - } - r = -2147483648; - } - F[g >> 2] = r; - f = f | 4; - e = M( - R( - M( - M(o * M(J[(f + p) >> 2] - J[(h + f) >> 2])) + - M(0.5), - ), - ), - ); - j: { - if (M(N(e)) < M(2147483648)) { - f = ~~e; - break j; - } - f = -2147483648; - } - F[(g + 4) >> 2] = f; - b = (b + 2) | 0; - a = (a + 2) | 0; - k = (k + 2) | 0; - if ((s | 0) != (k | 0)) { - continue; - } - break; - } - } - if (t) { - g = (n + (a << 2)) | 0; - b = b << 2; - e = M( - R( - M( - M(o * M(J[(b + p) >> 2] - J[(b + h) >> 2])) + - M(0.5), - ), - ), - ); - k: { - if (M(N(e)) < M(2147483648)) { - b = ~~e; - break k; - } - b = -2147483648; - } - F[g >> 2] = b; - a = (a + 1) | 0; - } - c = (c + 1) | 0; - if ((u | 0) != (c | 0)) { - continue; - } - break; - } - break h; - } - s = F[(b + 68) >> 2]; - t = i & 254; - x = i & 1; - a = 0; - c = 0; - while (1) { - b = F[v >> 2]; - g = - (ki( - m, - w, - F[(s + (F[(q + (c << 2)) >> 2] << 2)) >> 2], - 0, - ) + - l) | - 0; - p = la(d, (b + g) | 0, m); - b = 0; - k = 0; - if ((i | 0) != 1) { - while (1) { - g = (n + (a << 2)) | 0; - f = b << 2; - e = M( - R( - M( - M(o * M(J[(f + p) >> 2] - J[(h + f) >> 2])) + - M(0.5), - ), - ), - ); - l: { - if (M(N(e)) < M(2147483648)) { - r = ~~e; - break l; - } - r = -2147483648; - } - F[g >> 2] = r; - f = f | 4; - e = M( - R( - M( - M(o * M(J[(f + p) >> 2] - J[(h + f) >> 2])) + - M(0.5), - ), - ), - ); - m: { - if (M(N(e)) < M(2147483648)) { - f = ~~e; - break m; - } - f = -2147483648; - } - F[(g + 4) >> 2] = f; - b = (b + 2) | 0; - a = (a + 2) | 0; - k = (k + 2) | 0; - if ((t | 0) != (k | 0)) { - continue; - } - break; - } - } - if (x) { - g = (n + (a << 2)) | 0; - b = b << 2; - e = M( - R( - M( - M(o * M(J[(b + p) >> 2] - J[(b + h) >> 2])) + - M(0.5), - ), - ), - ); - n: { - if (M(N(e)) < M(2147483648)) { - b = ~~e; - break n; - } - b = -2147483648; - } - F[g >> 2] = b; - a = (a + 1) | 0; - } - c = (c + 1) | 0; - if ((u | 0) != (c | 0)) { - continue; - } - break; - } - } - ja(d); - Z = (j + 16) | 0; - return 1; - } - function Cd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - c = F[(a + 4) >> 2]; - e = F[a >> 2]; - f = (((c - e) | 0) / 144) | 0; - if (f >>> 0 < b >>> 0) { - e = a; - b = (b - f) | 0; - h = F[(a + 8) >> 2]; - c = F[(a + 4) >> 2]; - a: { - if (b >>> 0 <= (((h - c) | 0) / 144) >>> 0) { - b: { - if (!b) { - break b; - } - a = c; - f = b & 7; - if (f) { - while (1) { - va(a); - a = (a + 144) | 0; - d = (d + 1) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break; - } - } - c = (L(b, 144) + c) | 0; - if (((b - 1) & 268435455) >>> 0 < 7) { - break b; - } - while (1) { - va(a); - va((a + 144) | 0); - va((a + 288) | 0); - va((a + 432) | 0); - va((a + 576) | 0); - va((a + 720) | 0); - va((a + 864) | 0); - va((a + 1008) | 0); - a = (a + 1152) | 0; - if ((c | 0) != (a | 0)) { - continue; - } - break; - } - } - F[(e + 4) >> 2] = c; - break a; - } - c: { - d: { - e: { - a = c; - c = F[e >> 2]; - i = (((a - c) | 0) / 144) | 0; - a = (i + b) | 0; - if (a >>> 0 < 29826162) { - c = (((h - c) | 0) / 144) | 0; - f = c << 1; - f = - c >>> 0 >= 14913080 - ? 29826161 - : a >>> 0 < f >>> 0 - ? f - : a; - if (f) { - if (f >>> 0 >= 29826162) { - break e; - } - g = ka(L(f, 144)); - } - c = (L(i, 144) + g) | 0; - a = c; - h = b & 7; - if (h) { - while (1) { - va(a); - a = (a + 144) | 0; - d = (d + 1) | 0; - if ((h | 0) != (d | 0)) { - continue; - } - break; - } - } - h = (L(b, 144) + c) | 0; - if (((b - 1) & 268435455) >>> 0 >= 7) { - while (1) { - va(a); - va((a + 144) | 0); - va((a + 288) | 0); - va((a + 432) | 0); - va((a + 576) | 0); - va((a + 720) | 0); - va((a + 864) | 0); - va((a + 1008) | 0); - a = (a + 1152) | 0; - if ((h | 0) != (a | 0)) { - continue; - } - break; - } - } - b = (L(f, 144) + g) | 0; - d = F[(e + 4) >> 2]; - f = F[e >> 2]; - if ((d | 0) == (f | 0)) { - break d; - } - while (1) { - c = (c - 144) | 0; - d = (d - 144) | 0; - a = d; - F[c >> 2] = F[a >> 2]; - F[(c + 4) >> 2] = F[(a + 4) >> 2]; - F[(c + 8) >> 2] = F[(a + 8) >> 2]; - F[(c + 12) >> 2] = F[(a + 12) >> 2]; - F[(a + 12) >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(c + 16) >> 2] = F[(a + 16) >> 2]; - F[(c + 20) >> 2] = F[(a + 20) >> 2]; - F[(c + 24) >> 2] = F[(a + 24) >> 2]; - F[(a + 24) >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - g = G[(a + 28) | 0]; - F[(c + 40) >> 2] = 0; - F[(c + 32) >> 2] = 0; - F[(c + 36) >> 2] = 0; - D[(c + 28) | 0] = g; - F[(c + 32) >> 2] = F[(a + 32) >> 2]; - F[(c + 36) >> 2] = F[(a + 36) >> 2]; - F[(c + 40) >> 2] = F[(a + 40) >> 2]; - F[(a + 40) >> 2] = 0; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - F[(c + 52) >> 2] = 0; - F[(c + 44) >> 2] = 0; - F[(c + 48) >> 2] = 0; - F[(c + 44) >> 2] = F[(a + 44) >> 2]; - F[(c + 48) >> 2] = F[(a + 48) >> 2]; - F[(c + 52) >> 2] = F[(a + 52) >> 2]; - F[(a + 52) >> 2] = 0; - F[(a + 44) >> 2] = 0; - F[(a + 48) >> 2] = 0; - g = (c - -64) | 0; - F[g >> 2] = 0; - F[(c + 56) >> 2] = 0; - F[(c + 60) >> 2] = 0; - F[(c + 56) >> 2] = F[(a + 56) >> 2]; - F[(c + 60) >> 2] = F[(a + 60) >> 2]; - i = g; - g = (a - -64) | 0; - F[i >> 2] = F[g >> 2]; - F[g >> 2] = 0; - F[(a + 56) >> 2] = 0; - F[(a + 60) >> 2] = 0; - F[(c + 68) >> 2] = F[(a + 68) >> 2]; - g = F[(a + 72) >> 2]; - F[(c + 84) >> 2] = 0; - F[(c + 76) >> 2] = 0; - F[(c + 80) >> 2] = 0; - F[(c + 72) >> 2] = g; - F[(c + 76) >> 2] = F[(a + 76) >> 2]; - F[(c + 80) >> 2] = F[(a + 80) >> 2]; - F[(c + 84) >> 2] = F[(a + 84) >> 2]; - F[(a + 84) >> 2] = 0; - F[(a + 76) >> 2] = 0; - F[(a + 80) >> 2] = 0; - F[(c + 96) >> 2] = 0; - F[(c + 88) >> 2] = 0; - F[(c + 92) >> 2] = 0; - F[(c + 88) >> 2] = F[(a + 88) >> 2]; - F[(c + 92) >> 2] = F[(a + 92) >> 2]; - F[(c + 96) >> 2] = F[(a + 96) >> 2]; - F[(a + 96) >> 2] = 0; - F[(a + 88) >> 2] = 0; - F[(a + 92) >> 2] = 0; - g = G[(a + 100) | 0]; - F[(c + 112) >> 2] = 0; - F[(c + 104) >> 2] = 0; - F[(c + 108) >> 2] = 0; - D[(c + 100) | 0] = g; - F[(c + 104) >> 2] = F[(a + 104) >> 2]; - F[(c + 108) >> 2] = F[(a + 108) >> 2]; - F[(c + 112) >> 2] = F[(a + 112) >> 2]; - F[(a + 112) >> 2] = 0; - F[(a + 104) >> 2] = 0; - F[(a + 108) >> 2] = 0; - F[(c + 124) >> 2] = 0; - F[(c + 116) >> 2] = 0; - F[(c + 120) >> 2] = 0; - F[(c + 116) >> 2] = F[(a + 116) >> 2]; - F[(c + 120) >> 2] = F[(a + 120) >> 2]; - F[(c + 124) >> 2] = F[(a + 124) >> 2]; - F[(a + 124) >> 2] = 0; - F[(a + 116) >> 2] = 0; - F[(a + 120) >> 2] = 0; - g = F[(a + 128) >> 2]; - F[(c + 140) >> 2] = 0; - F[(c + 132) >> 2] = 0; - F[(c + 136) >> 2] = 0; - F[(c + 128) >> 2] = g; - F[(c + 132) >> 2] = F[(a + 132) >> 2]; - F[(c + 136) >> 2] = F[(a + 136) >> 2]; - F[(c + 140) >> 2] = F[(a + 140) >> 2]; - F[(a + 140) >> 2] = 0; - F[(a + 132) >> 2] = 0; - F[(a + 136) >> 2] = 0; - if ((a | 0) != (f | 0)) { - continue; - } - break; - } - F[(e + 8) >> 2] = b; - a = F[(e + 4) >> 2]; - F[(e + 4) >> 2] = h; - d = F[e >> 2]; - F[e >> 2] = c; - if ((a | 0) == (d | 0)) { - break c; - } - while (1) { - b = (a - 144) | 0; - c = F[(b + 132) >> 2]; - if (c) { - F[(a - 8) >> 2] = c; - ja(c); - } - c = F[(a - 28) >> 2]; - if (c) { - F[(a - 24) >> 2] = c; - ja(c); - } - c = F[(a - 40) >> 2]; - if (c) { - F[(a - 36) >> 2] = c; - ja(c); - } - Gb((a - 140) | 0); - a = b; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - break c; - } - na(); - v(); - } - oa(); - v(); - } - F[(e + 8) >> 2] = b; - F[(e + 4) >> 2] = h; - F[e >> 2] = c; - } - if (d) { - ja(d); - } - } - return; - } - if (b >>> 0 < f >>> 0) { - e = (e + L(b, 144)) | 0; - if ((e | 0) != (c | 0)) { - while (1) { - b = (c - 144) | 0; - d = F[(b + 132) >> 2]; - if (d) { - F[(c - 8) >> 2] = d; - ja(d); - } - d = F[(c - 28) >> 2]; - if (d) { - F[(c - 24) >> 2] = d; - ja(d); - } - d = F[(c - 40) >> 2]; - if (d) { - F[(c - 36) >> 2] = d; - ja(d); - } - Gb((c - 140) | 0); - c = b; - if ((e | 0) != (c | 0)) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = e; - } - } - function Yc(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0; - F[(a + 56) >> 2] = F[(a + 52) >> 2]; - F[(a + 44) >> 2] = F[(a + 40) >> 2]; - b = F[(a + 64) >> 2]; - c = F[(b + 24) >> 2]; - if ((c | 0) == F[(b + 28) >> 2]) { - return 1; - } - a: { - b: { - c: { - while (1) { - g = i; - i = F[((k << 2) + c) >> 2]; - d: { - if ((i | 0) == -1) { - i = g; - break d; - } - b = F[(a + 56) >> 2]; - e: { - if ((b | 0) != F[(a + 60) >> 2]) { - F[b >> 2] = g; - F[(a + 56) >> 2] = b + 4; - break e; - } - d = F[(a + 52) >> 2]; - e = (b - d) | 0; - h = e >> 2; - c = (h + 1) | 0; - if (c >>> 0 >= 1073741824) { - break c; - } - f = (e >>> 1) | 0; - f = - e >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 < f >>> 0 - ? f - : c; - if (f) { - if (f >>> 0 >= 1073741824) { - break b; - } - e = ka(f << 2); - } else { - e = 0; - } - c = (e + (h << 2)) | 0; - F[c >> 2] = g; - h = (c + 4) | 0; - if ((b | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 60) >> 2] = e + (f << 2); - F[(a + 56) >> 2] = h; - F[(a + 52) >> 2] = c; - if (!d) { - break e; - } - ja(d); - } - f: { - g: { - if ( - !( - (F[ - (F[(a + 12) >> 2] + - ((k >>> 3) & 536870908)) >> - 2 - ] >>> - k) & - 1 - ) - ) { - break g; - } - e = (i + 1) | 0; - e = ((e >>> 0) % 3) | 0 ? e : (i - 2) | 0; - if ( - ((e | 0) == -1) | - ((F[ - (F[a >> 2] + ((e >>> 3) & 536870908)) >> 2 - ] >>> - e) & - 1) - ) { - break g; - } - e = - F[ - (F[(F[(a + 64) >> 2] + 12) >> 2] + - (e << 2)) >> - 2 - ]; - if ((e | 0) == -1) { - break g; - } - b = (e + 1) | 0; - b = ((b >>> 0) % 3) | 0 ? b : (e - 2) | 0; - if ((b | 0) == -1) { - break g; - } - c = F[(a + 64) >> 2]; - f = F[a >> 2]; - while (1) { - e = b; - b = -1; - d = (e + 1) | 0; - d = ((d >>> 0) % 3) | 0 ? d : (e - 2) | 0; - h: { - if ( - ((d | 0) == -1) | - ((F[(f + ((d >>> 3) & 536870908)) >> 2] >>> - d) & - 1) - ) { - break h; - } - d = F[(F[(c + 12) >> 2] + (d << 2)) >> 2]; - if ((d | 0) == -1) { - break h; - } - b = (d + 1) | 0; - b = ((b >>> 0) % 3) | 0 ? b : (d - 2) | 0; - } - if ((b | 0) != (i | 0)) { - if ((b | 0) == -1) { - break f; - } - continue; - } - break; - } - return 0; - } - e = i; - } - F[(F[(a + 28) >> 2] + (e << 2)) >> 2] = g; - b = F[(a + 44) >> 2]; - i: { - if ((b | 0) != F[(a + 48) >> 2]) { - F[b >> 2] = e; - F[(a + 44) >> 2] = b + 4; - break i; - } - d = F[(a + 40) >> 2]; - i = (b - d) | 0; - h = i >> 2; - c = (h + 1) | 0; - if (c >>> 0 >= 1073741824) { - break a; - } - f = (i >>> 1) | 0; - f = - i >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 < f >>> 0 - ? f - : c; - if (f) { - if (f >>> 0 >= 1073741824) { - break b; - } - i = ka(f << 2); - } else { - i = 0; - } - c = (i + (h << 2)) | 0; - F[c >> 2] = e; - h = (c + 4) | 0; - if ((b | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 48) >> 2] = i + (f << 2); - F[(a + 44) >> 2] = h; - F[(a + 40) >> 2] = c; - if (!d) { - break i; - } - ja(d); - } - i = (g + 1) | 0; - b = F[(a + 64) >> 2]; - if ((e | 0) == -1) { - break d; - } - j: { - if (((e >>> 0) % 3) | 0) { - c = (e - 1) | 0; - break j; - } - c = (e + 2) | 0; - if ((c | 0) == -1) { - break d; - } - } - d = F[(F[(b + 12) >> 2] + (c << 2)) >> 2]; - if ((d | 0) == -1) { - break d; - } - f = (d + (((d >>> 0) % 3) | 0 ? -1 : 2)) | 0; - if (((f | 0) == -1) | ((e | 0) == (f | 0))) { - break d; - } - while (1) { - b = (f + 1) | 0; - b = ((b >>> 0) % 3) | 0 ? b : (f - 2) | 0; - if ( - (F[(F[a >> 2] + ((b >>> 3) & 536870908)) >> 2] >>> - b) & - 1 - ) { - b = F[(a + 56) >> 2]; - k: { - if ((b | 0) != F[(a + 60) >> 2]) { - F[b >> 2] = i; - F[(a + 56) >> 2] = b + 4; - break k; - } - d = F[(a + 52) >> 2]; - g = (b - d) | 0; - j = g >> 2; - c = (j + 1) | 0; - if (c >>> 0 >= 1073741824) { - break c; - } - h = (g >>> 1) | 0; - h = - g >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 < h >>> 0 - ? h - : c; - if (h) { - if (h >>> 0 >= 1073741824) { - break b; - } - g = ka(h << 2); - } else { - g = 0; - } - c = (g + (j << 2)) | 0; - F[c >> 2] = i; - j = (c + 4) | 0; - if ((b | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 60) >> 2] = g + (h << 2); - F[(a + 56) >> 2] = j; - F[(a + 52) >> 2] = c; - if (!d) { - break k; - } - ja(d); - } - d = (i + 1) | 0; - b = F[(a + 44) >> 2]; - l: { - if ((b | 0) != F[(a + 48) >> 2]) { - F[b >> 2] = f; - F[(a + 44) >> 2] = b + 4; - break l; - } - h = F[(a + 40) >> 2]; - g = (b - h) | 0; - l = g >> 2; - c = (l + 1) | 0; - if (c >>> 0 >= 1073741824) { - break a; - } - j = (g >>> 1) | 0; - j = - g >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 < j >>> 0 - ? j - : c; - if (j) { - if (j >>> 0 >= 1073741824) { - break b; - } - g = ka(j << 2); - } else { - g = 0; - } - c = (g + (l << 2)) | 0; - F[c >> 2] = f; - l = (c + 4) | 0; - if ((b | 0) != (h | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (h | 0)) { - continue; - } - break; - } - } - F[(a + 48) >> 2] = g + (j << 2); - F[(a + 44) >> 2] = l; - F[(a + 40) >> 2] = c; - if (!h) { - break l; - } - ja(h); - } - g = i; - i = d; - } - F[(F[(a + 28) >> 2] + (f << 2)) >> 2] = g; - b = F[(a + 64) >> 2]; - m: { - if (((f >>> 0) % 3) | 0) { - c = (f - 1) | 0; - break m; - } - c = (f + 2) | 0; - if ((c | 0) == -1) { - break d; - } - } - d = F[(F[(b + 12) >> 2] + (c << 2)) >> 2]; - if ((d | 0) == -1) { - break d; - } - f = (d + (((d >>> 0) % 3) | 0 ? -1 : 2)) | 0; - if ((f | 0) == -1) { - break d; - } - if ((e | 0) != (f | 0)) { - continue; - } - break; - } - } - k = (k + 1) | 0; - c = F[(b + 24) >> 2]; - if (k >>> 0 < ((F[(b + 28) >> 2] - c) >> 2) >>> 0) { - continue; - } - break; - } - return 1; - } - na(); - v(); - } - oa(); - v(); - } - na(); - v(); - } - function Kb(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0, - x = 0, - y = 0; - f = (Z - 96) | 0; - Z = f; - e = F[(a + 16) >> 2]; - D[(f + 92) | 0] = 1; - F[(f + 88) >> 2] = b; - F[(f + 84) >> 2] = b; - F[(f + 80) >> 2] = e; - a: { - if ((b | 0) == -1) { - break a; - } - j = F[(a + 20) >> 2]; - d = F[j >> 2]; - e = F[(F[e >> 2] + (b << 2)) >> 2]; - if (e >>> 0 >= ((F[(j + 4) >> 2] - d) >> 2) >>> 0) { - break a; - } - e = F[(F[(a + 8) >> 2] + (F[(d + (e << 2)) >> 2] << 2)) >> 2]; - d = F[(a + 4) >> 2]; - if (!G[(d + 84) | 0]) { - e = F[(F[(d + 68) >> 2] + (e << 2)) >> 2]; - } - F[(f + 72) >> 2] = 0; - F[(f + 76) >> 2] = 0; - j = (f - -64) | 0; - F[j >> 2] = 0; - F[(j + 4) >> 2] = 0; - F[(f + 56) >> 2] = 0; - F[(f + 60) >> 2] = 0; - Ga(d, e, D[(d + 24) | 0], (f + 56) | 0); - e = (b + 1) | 0; - j = ((e >>> 0) % 3) | 0 ? e : (b - 2) | 0; - n = ((((b >>> 0) % 3) | 0 ? -1 : 2) + b) | 0; - b: { - c: { - while (1) { - d = j; - e = n; - d: { - if (!F[(a + 28) >> 2]) { - break d; - } - e = (b + 1) | 0; - d = ((e >>> 0) % 3) | 0 ? e : (b - 2) | 0; - e = (b - 1) | 0; - if (((b >>> 0) % 3) | 0) { - break d; - } - e = (b + 2) | 0; - } - if ((d | 0) == -1) { - break b; - } - m = F[(a + 20) >> 2]; - b = F[m >> 2]; - d = F[(F[F[(a + 16) >> 2] >> 2] + (d << 2)) >> 2]; - if (d >>> 0 >= ((F[(m + 4) >> 2] - b) >> 2) >>> 0) { - break b; - } - d = - F[ - (F[(a + 8) >> 2] + (F[((d << 2) + b) >> 2] << 2)) >> - 2 - ]; - b = F[(a + 4) >> 2]; - if (!G[(b + 84) | 0]) { - d = F[(F[(b + 68) >> 2] + (d << 2)) >> 2]; - } - F[(f + 48) >> 2] = 0; - F[(f + 52) >> 2] = 0; - F[(f + 40) >> 2] = 0; - F[(f + 44) >> 2] = 0; - F[(f + 32) >> 2] = 0; - F[(f + 36) >> 2] = 0; - Ga(b, d, D[(b + 24) | 0], (f + 32) | 0); - if ((e | 0) == -1) { - break c; - } - d = F[(a + 20) >> 2]; - b = F[d >> 2]; - e = F[(F[F[(a + 16) >> 2] >> 2] + (e << 2)) >> 2]; - if (e >>> 0 >= ((F[(d + 4) >> 2] - b) >> 2) >>> 0) { - break c; - } - d = - F[ - (F[(a + 8) >> 2] + (F[(b + (e << 2)) >> 2] << 2)) >> - 2 - ]; - b = F[(a + 4) >> 2]; - if (!G[(b + 84) | 0]) { - d = F[(F[(b + 68) >> 2] + (d << 2)) >> 2]; - } - F[(f + 24) >> 2] = 0; - F[(f + 28) >> 2] = 0; - F[(f + 16) >> 2] = 0; - F[(f + 20) >> 2] = 0; - F[(f + 8) >> 2] = 0; - F[(f + 12) >> 2] = 0; - Ga(b, d, D[(b + 24) | 0], (f + 8) | 0); - g = F[(f + 8) >> 2]; - b = F[(f + 56) >> 2]; - d = (g - b) | 0; - p = F[(f + 60) >> 2]; - t = - (F[(f + 12) >> 2] - ((p + (b >>> 0 > g >>> 0)) | 0)) | - 0; - i = F[(f + 40) >> 2]; - e = F[(f + 64) >> 2]; - m = (i - e) | 0; - u = F[(f + 68) >> 2]; - y = - (F[(f + 44) >> 2] - ((u + (e >>> 0 > i >>> 0)) | 0)) | - 0; - g = ki(d, t, m, y); - w = (o - g) | 0; - x = (h - ((_ + (g >>> 0 > o >>> 0)) | 0)) | 0; - h = w; - i = F[(f + 16) >> 2]; - g = (i - e) | 0; - u = - (F[(f + 20) >> 2] - (((e >>> 0 > i >>> 0) + u) | 0)) | - 0; - k = F[(f + 32) >> 2]; - i = (k - b) | 0; - w = - (F[(f + 36) >> 2] - (((b >>> 0 > k >>> 0) + p) | 0)) | - 0; - b = ki(g, u, i, w); - o = (h + b) | 0; - h = (_ + x) | 0; - h = b >>> 0 > o >>> 0 ? (h + 1) | 0 : h; - b = l; - l = d; - p = t; - k = F[(f + 48) >> 2]; - e = F[(f + 72) >> 2]; - d = (k - e) | 0; - t = F[(f + 76) >> 2]; - x = - (F[(f + 52) >> 2] - ((t + (e >>> 0 > k >>> 0)) | 0)) | - 0; - l = ki(l, p, d, x); - k = (b + l) | 0; - b = (_ + q) | 0; - b = k >>> 0 < l >>> 0 ? (b + 1) | 0 : b; - l = F[(f + 24) >> 2]; - p = (l - e) | 0; - e = - (F[(f + 28) >> 2] - (((e >>> 0 > l >>> 0) + t) | 0)) | - 0; - q = ki(p, e, i, w); - l = (k - q) | 0; - q = (b - ((_ + (k >>> 0 < q >>> 0)) | 0)) | 0; - b = ki(g, u, d, x); - d = (r - b) | 0; - b = (s - ((_ + (b >>> 0 > r >>> 0)) | 0)) | 0; - s = ki(p, e, m, y); - r = (s + d) | 0; - b = (_ + b) | 0; - s = r >>> 0 < s >>> 0 ? (b + 1) | 0 : b; - nc((f + 80) | 0); - b = F[(f + 88) >> 2]; - if ((b | 0) != -1) { - continue; - } - break; - } - b = s >> 31; - e = b ^ r; - d = (e - b) | 0; - b = ((b ^ s) - (((b >>> 0 > e >>> 0) + b) | 0)) | 0; - n = -1; - e = 2147483647; - m = q >> 31; - g = m; - i = g ^ l; - j = (i - g) | 0; - m = ((g ^ q) - (((i >>> 0 < g >>> 0) + g) | 0)) | 0; - i = m; - k = j ^ -1; - g = i ^ 2147483647; - m = h; - e: { - f: { - if (!F[(a + 28) >> 2]) { - if ( - (((b | 0) == (g | 0)) & (d >>> 0 > k >>> 0)) | - (b >>> 0 > g >>> 0) - ) { - break e; - } - b = (b + i) | 0; - a = (d + j) | 0; - b = a >>> 0 < j >>> 0 ? (b + 1) | 0 : b; - e = a; - g = h; - a = g >> 31; - d = a; - n = d ^ o; - a = (n - d) | 0; - h = a; - d = ((d ^ g) - (((d >>> 0 > n >>> 0) + d) | 0)) | 0; - a = (a + e) | 0; - d = d ^ 2147483647; - h = - (((d | 0) == (b | 0)) & - ((h ^ -1) >>> 0 < e >>> 0)) | - (b >>> 0 > d >>> 0); - a = h ? -1 : a; - if ( - (!(h & 0) & ((a | 0) <= 536870912)) | - ((a | 0) < 536870912) - ) { - break e; - } - b = 0; - a = (a >>> 29) | 0; - break f; - } - g: { - if ( - (((b | 0) == (g | 0)) & (d >>> 0 > k >>> 0)) | - (b >>> 0 > g >>> 0) - ) { - break g; - } - b = (b + i) | 0; - a = (d + j) | 0; - b = a >>> 0 < j >>> 0 ? (b + 1) | 0 : b; - k = h; - h = h >> 31; - g = h; - i = g ^ o; - h = (i - g) | 0; - j = ((g ^ k) - (((g >>> 0 > i >>> 0) + g) | 0)) | 0; - g = j ^ 2147483647; - d = a; - a = h; - if ( - (((g | 0) == (b | 0)) & - (d >>> 0 > (a ^ -1) >>> 0)) | - (b >>> 0 > g >>> 0) - ) { - break g; - } - b = (b + j) | 0; - n = (a + d) | 0; - b = n >>> 0 < a >>> 0 ? (b + 1) | 0 : b; - e = b; - if (!b & (n >>> 0 < 536870913)) { - break e; - } - } - b = (e >>> 29) | 0; - a = ((e & 536870911) << 3) | (n >>> 29); - } - o = li(o, m, a, b); - l = li(l, q, a, b); - r = li(r, s, a, b); - } - F[(c + 8) >> 2] = o; - F[(c + 4) >> 2] = l; - F[c >> 2] = r; - Z = (f + 96) | 0; - return; - } - ta(); - v(); - } - ta(); - v(); - } - ta(); - v(); - } - function Nc(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - a: { - if ((b | 0) < 0) { - break a; - } - c = F[(a + 12) >> 2]; - d = F[(a + 8) >> 2]; - if (((c - d) >> 2) >>> 0 <= b >>> 0) { - break a; - } - d = (d + (b << 2)) | 0; - e = F[d >> 2]; - i = F[(e + 60) >> 2]; - f = F[(e + 56) >> 2]; - e = (d + 4) | 0; - if ((e | 0) != (c | 0)) { - while (1) { - h = F[e >> 2]; - F[e >> 2] = 0; - g = F[d >> 2]; - F[d >> 2] = h; - if (g) { - xa(g); - } - d = (d + 4) | 0; - e = (e + 4) | 0; - if ((e | 0) != (c | 0)) { - continue; - } - break; - } - c = F[(a + 12) >> 2]; - } - if ((c | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - e = F[c >> 2]; - F[c >> 2] = 0; - if (e) { - xa(e); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 12) >> 2] = d; - g = F[(a + 4) >> 2]; - b: { - if (!g | ((i | 0) < 0)) { - break b; - } - c = F[(g + 24) >> 2]; - d = F[(g + 28) >> 2]; - if ((c | 0) == (d | 0)) { - break b; - } - while (1) { - if ((i | 0) == F[(F[c >> 2] + 24) >> 2]) { - d = (c + 4) | 0; - i = F[(g + 28) >> 2]; - if ((d | 0) != (i | 0)) { - while (1) { - h = F[d >> 2]; - F[d >> 2] = 0; - e = F[c >> 2]; - F[c >> 2] = h; - if (e) { - Ca((e + 12) | 0, F[(e + 16) >> 2]); - Ba(e, F[(e + 4) >> 2]); - ja(e); - } - c = (c + 4) | 0; - d = (d + 4) | 0; - if ((i | 0) != (d | 0)) { - continue; - } - break; - } - d = F[(g + 28) >> 2]; - } - if ((c | 0) != (d | 0)) { - while (1) { - d = (d - 4) | 0; - e = F[d >> 2]; - F[d >> 2] = 0; - if (e) { - Ca((e + 12) | 0, F[(e + 16) >> 2]); - Ba(e, F[(e + 4) >> 2]); - ja(e); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(g + 28) >> 2] = c; - break b; - } - c = (c + 4) | 0; - if ((d | 0) != (c | 0)) { - continue; - } - break; - } - } - c: { - if ((f | 0) > 4) { - break c; - } - d: { - e = (L(f, 12) + a) | 0; - c = F[(e + 20) >> 2]; - d = F[(e + 24) >> 2]; - if ((c | 0) == (d | 0)) { - break d; - } - while (1) { - if (F[c >> 2] == (b | 0)) { - break d; - } - c = (c + 4) | 0; - if ((d | 0) != (c | 0)) { - continue; - } - break; - } - break c; - } - if ((c | 0) == (d | 0)) { - break c; - } - f = c; - c = (c + 4) | 0; - pa(f, c, (d - c) | 0); - F[(e + 24) >> 2] = d - 4; - } - c = F[(a + 24) >> 2]; - d = F[(a + 20) >> 2]; - e: { - if ((c | 0) == (d | 0)) { - break e; - } - e = (c - d) | 0; - c = e >> 2; - g = c >>> 0 <= 1 ? 1 : c; - i = g & 1; - c = 0; - if (e >>> 0 >= 8) { - g = g & -2; - e = 0; - while (1) { - f = c << 2; - h = (f + d) | 0; - j = F[h >> 2]; - if ((j | 0) > (b | 0)) { - F[h >> 2] = j - 1; - } - f = (d + (f | 4)) | 0; - h = F[f >> 2]; - if ((h | 0) > (b | 0)) { - F[f >> 2] = h - 1; - } - c = (c + 2) | 0; - e = (e + 2) | 0; - if ((g | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!i) { - break e; - } - c = (d + (c << 2)) | 0; - d = F[c >> 2]; - if ((d | 0) <= (b | 0)) { - break e; - } - F[c >> 2] = d - 1; - } - c = F[(a + 36) >> 2]; - d = F[(a + 32) >> 2]; - f: { - if ((c | 0) == (d | 0)) { - break f; - } - e = (c - d) | 0; - c = e >> 2; - g = c >>> 0 <= 1 ? 1 : c; - i = g & 1; - c = 0; - if (e >>> 0 >= 8) { - g = g & -2; - e = 0; - while (1) { - f = c << 2; - h = (f + d) | 0; - j = F[h >> 2]; - if ((j | 0) > (b | 0)) { - F[h >> 2] = j - 1; - } - f = (d + (f | 4)) | 0; - h = F[f >> 2]; - if ((h | 0) > (b | 0)) { - F[f >> 2] = h - 1; - } - c = (c + 2) | 0; - e = (e + 2) | 0; - if ((g | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!i) { - break f; - } - c = (d + (c << 2)) | 0; - d = F[c >> 2]; - if ((d | 0) <= (b | 0)) { - break f; - } - F[c >> 2] = d - 1; - } - c = F[(a + 48) >> 2]; - d = F[(a + 44) >> 2]; - g: { - if ((c | 0) == (d | 0)) { - break g; - } - e = (c - d) | 0; - c = e >> 2; - g = c >>> 0 <= 1 ? 1 : c; - i = g & 1; - c = 0; - if (e >>> 0 >= 8) { - g = g & -2; - e = 0; - while (1) { - f = c << 2; - h = (f + d) | 0; - j = F[h >> 2]; - if ((j | 0) > (b | 0)) { - F[h >> 2] = j - 1; - } - f = (d + (f | 4)) | 0; - h = F[f >> 2]; - if ((h | 0) > (b | 0)) { - F[f >> 2] = h - 1; - } - c = (c + 2) | 0; - e = (e + 2) | 0; - if ((g | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!i) { - break g; - } - c = (d + (c << 2)) | 0; - d = F[c >> 2]; - if ((d | 0) <= (b | 0)) { - break g; - } - F[c >> 2] = d - 1; - } - c = F[(a + 60) >> 2]; - d = F[(a + 56) >> 2]; - h: { - if ((c | 0) == (d | 0)) { - break h; - } - e = (c - d) | 0; - c = e >> 2; - g = c >>> 0 <= 1 ? 1 : c; - i = g & 1; - c = 0; - if (e >>> 0 >= 8) { - g = g & -2; - e = 0; - while (1) { - f = c << 2; - h = (f + d) | 0; - j = F[h >> 2]; - if ((j | 0) > (b | 0)) { - F[h >> 2] = j - 1; - } - f = (d + (f | 4)) | 0; - h = F[f >> 2]; - if ((h | 0) > (b | 0)) { - F[f >> 2] = h - 1; - } - c = (c + 2) | 0; - e = (e + 2) | 0; - if ((g | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!i) { - break h; - } - c = (d + (c << 2)) | 0; - d = F[c >> 2]; - if ((d | 0) <= (b | 0)) { - break h; - } - F[c >> 2] = d - 1; - } - c = F[(a + 72) >> 2]; - a = F[(a + 68) >> 2]; - if ((c | 0) == (a | 0)) { - break a; - } - d = (c - a) | 0; - c = d >> 2; - e = c >>> 0 <= 1 ? 1 : c; - g = e & 1; - c = 0; - if (d >>> 0 >= 8) { - d = e & -2; - e = 0; - while (1) { - i = c << 2; - f = (i + a) | 0; - h = F[f >> 2]; - if ((h | 0) > (b | 0)) { - F[f >> 2] = h - 1; - } - i = (a + (i | 4)) | 0; - f = F[i >> 2]; - if ((f | 0) > (b | 0)) { - F[i >> 2] = f - 1; - } - c = (c + 2) | 0; - e = (e + 2) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!g) { - break a; - } - f = b; - a = (a + (c << 2)) | 0; - b = F[a >> 2]; - if ((f | 0) >= (b | 0)) { - break a; - } - F[a >> 2] = b - 1; - } - } - function ja(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - a: { - if (!a) { - break a; - } - d = (a - 8) | 0; - b = F[(a - 4) >> 2]; - a = b & -8; - f = (d + a) | 0; - b: { - if (b & 1) { - break b; - } - if (!(b & 3)) { - break a; - } - b = F[d >> 2]; - d = (d - b) | 0; - if (d >>> 0 < I[2945]) { - break a; - } - a = (a + b) | 0; - if (F[2946] != (d | 0)) { - if (b >>> 0 <= 255) { - e = F[(d + 8) >> 2]; - b = (b >>> 3) | 0; - c = F[(d + 12) >> 2]; - if ((c | 0) == (e | 0)) { - (i = 11764), (j = F[2941] & oi(b)), (F[i >> 2] = j); - break b; - } - F[(e + 12) >> 2] = c; - F[(c + 8) >> 2] = e; - break b; - } - h = F[(d + 24) >> 2]; - b = F[(d + 12) >> 2]; - c: { - if ((d | 0) != (b | 0)) { - c = F[(d + 8) >> 2]; - F[(c + 12) >> 2] = b; - F[(b + 8) >> 2] = c; - break c; - } - d: { - e = (d + 20) | 0; - c = F[e >> 2]; - if (c) { - break d; - } - e = (d + 16) | 0; - c = F[e >> 2]; - if (c) { - break d; - } - b = 0; - break c; - } - while (1) { - g = e; - b = c; - e = (b + 20) | 0; - c = F[e >> 2]; - if (c) { - continue; - } - e = (b + 16) | 0; - c = F[(b + 16) >> 2]; - if (c) { - continue; - } - break; - } - F[g >> 2] = 0; - } - if (!h) { - break b; - } - e = F[(d + 28) >> 2]; - c = ((e << 2) + 12068) | 0; - e: { - if (F[c >> 2] == (d | 0)) { - F[c >> 2] = b; - if (b) { - break e; - } - (i = 11768), (j = F[2942] & oi(e)), (F[i >> 2] = j); - break b; - } - F[(h + (F[(h + 16) >> 2] == (d | 0) ? 16 : 20)) >> 2] = - b; - if (!b) { - break b; - } - } - F[(b + 24) >> 2] = h; - c = F[(d + 16) >> 2]; - if (c) { - F[(b + 16) >> 2] = c; - F[(c + 24) >> 2] = b; - } - c = F[(d + 20) >> 2]; - if (!c) { - break b; - } - F[(b + 20) >> 2] = c; - F[(c + 24) >> 2] = b; - break b; - } - b = F[(f + 4) >> 2]; - if ((b & 3) != 3) { - break b; - } - F[2943] = a; - F[(f + 4) >> 2] = b & -2; - F[(d + 4) >> 2] = a | 1; - F[(a + d) >> 2] = a; - return; - } - if (d >>> 0 >= f >>> 0) { - break a; - } - b = F[(f + 4) >> 2]; - if (!(b & 1)) { - break a; - } - f: { - if (!(b & 2)) { - if (F[2947] == (f | 0)) { - F[2947] = d; - a = (F[2944] + a) | 0; - F[2944] = a; - F[(d + 4) >> 2] = a | 1; - if (F[2946] != (d | 0)) { - break a; - } - F[2943] = 0; - F[2946] = 0; - return; - } - if (F[2946] == (f | 0)) { - F[2946] = d; - a = (F[2943] + a) | 0; - F[2943] = a; - F[(d + 4) >> 2] = a | 1; - F[(a + d) >> 2] = a; - return; - } - a = ((b & -8) + a) | 0; - g: { - if (b >>> 0 <= 255) { - e = F[(f + 8) >> 2]; - b = (b >>> 3) | 0; - c = F[(f + 12) >> 2]; - if ((c | 0) == (e | 0)) { - (i = 11764), (j = F[2941] & oi(b)), (F[i >> 2] = j); - break g; - } - F[(e + 12) >> 2] = c; - F[(c + 8) >> 2] = e; - break g; - } - h = F[(f + 24) >> 2]; - b = F[(f + 12) >> 2]; - h: { - if ((f | 0) != (b | 0)) { - c = F[(f + 8) >> 2]; - F[(c + 12) >> 2] = b; - F[(b + 8) >> 2] = c; - break h; - } - i: { - e = (f + 20) | 0; - c = F[e >> 2]; - if (c) { - break i; - } - e = (f + 16) | 0; - c = F[e >> 2]; - if (c) { - break i; - } - b = 0; - break h; - } - while (1) { - g = e; - b = c; - e = (b + 20) | 0; - c = F[e >> 2]; - if (c) { - continue; - } - e = (b + 16) | 0; - c = F[(b + 16) >> 2]; - if (c) { - continue; - } - break; - } - F[g >> 2] = 0; - } - if (!h) { - break g; - } - e = F[(f + 28) >> 2]; - c = ((e << 2) + 12068) | 0; - j: { - if (F[c >> 2] == (f | 0)) { - F[c >> 2] = b; - if (b) { - break j; - } - (i = 11768), (j = F[2942] & oi(e)), (F[i >> 2] = j); - break g; - } - F[ - (h + (F[(h + 16) >> 2] == (f | 0) ? 16 : 20)) >> 2 - ] = b; - if (!b) { - break g; - } - } - F[(b + 24) >> 2] = h; - c = F[(f + 16) >> 2]; - if (c) { - F[(b + 16) >> 2] = c; - F[(c + 24) >> 2] = b; - } - c = F[(f + 20) >> 2]; - if (!c) { - break g; - } - F[(b + 20) >> 2] = c; - F[(c + 24) >> 2] = b; - } - F[(d + 4) >> 2] = a | 1; - F[(a + d) >> 2] = a; - if (F[2946] != (d | 0)) { - break f; - } - F[2943] = a; - return; - } - F[(f + 4) >> 2] = b & -2; - F[(d + 4) >> 2] = a | 1; - F[(a + d) >> 2] = a; - } - if (a >>> 0 <= 255) { - b = ((a & -8) + 11804) | 0; - c = F[2941]; - a = 1 << (a >>> 3); - k: { - if (!(c & a)) { - F[2941] = a | c; - a = b; - break k; - } - a = F[(b + 8) >> 2]; - } - F[(b + 8) >> 2] = d; - F[(a + 12) >> 2] = d; - F[(d + 12) >> 2] = b; - F[(d + 8) >> 2] = a; - return; - } - e = 31; - if (a >>> 0 <= 16777215) { - b = O((a >>> 8) | 0); - e = (((((a >>> (38 - b)) & 1) - (b << 1)) | 0) + 62) | 0; - } - F[(d + 28) >> 2] = e; - F[(d + 16) >> 2] = 0; - F[(d + 20) >> 2] = 0; - g = ((e << 2) + 12068) | 0; - l: { - m: { - c = F[2942]; - b = 1 << e; - n: { - if (!(c & b)) { - F[2942] = b | c; - F[g >> 2] = d; - F[(d + 24) >> 2] = g; - break n; - } - e = - a << ((e | 0) != 31 ? (25 - ((e >>> 1) | 0)) | 0 : 0); - b = F[g >> 2]; - while (1) { - c = b; - if ((F[(b + 4) >> 2] & -8) == (a | 0)) { - break m; - } - b = (e >>> 29) | 0; - e = e << 1; - g = (c + (b & 4)) | 0; - b = F[(g + 16) >> 2]; - if (b) { - continue; - } - break; - } - F[(g + 16) >> 2] = d; - F[(d + 24) >> 2] = c; - } - F[(d + 12) >> 2] = d; - F[(d + 8) >> 2] = d; - break l; - } - a = F[(c + 8) >> 2]; - F[(a + 12) >> 2] = d; - F[(c + 8) >> 2] = d; - F[(d + 24) >> 2] = 0; - F[(d + 12) >> 2] = c; - F[(d + 8) >> 2] = a; - } - a = (F[2949] - 1) | 0; - F[2949] = a ? a : -1; - } - } - function di(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0; - F[(a + 8) >> 2] = e; - n = (a + 32) | 0; - h = F[n >> 2]; - f = (F[(a + 36) >> 2] - h) >> 2; - a: { - if (f >>> 0 < e >>> 0) { - qa(n, (e - f) | 0); - d = F[(a + 8) >> 2]; - break a; - } - d = e; - if (d >>> 0 >= f >>> 0) { - break a; - } - F[(a + 36) >> 2] = h + (e << 2); - d = e; - } - s = F[(a + 52) >> 2]; - p = F[(a + 48) >> 2]; - f = 0; - h = e >>> 0 > 1073741823 ? -1 : e << 2; - m = ma(ka(h), 0, h); - b: { - if ((d | 0) <= 0) { - break b; - } - g = F[(a + 32) >> 2]; - while (1) { - d = f << 2; - h = F[(d + m) >> 2]; - j = F[(a + 16) >> 2]; - c: { - if ((h | 0) > (j | 0)) { - F[(d + g) >> 2] = j; - break c; - } - d = (d + g) | 0; - j = F[(a + 12) >> 2]; - if ((j | 0) > (h | 0)) { - F[d >> 2] = j; - break c; - } - F[d >> 2] = h; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - if ((d | 0) <= 0) { - break b; - } - f = 0; - while (1) { - h = f << 2; - d = (h + c) | 0; - h = (F[(b + h) >> 2] + F[(g + h) >> 2]) | 0; - F[d >> 2] = h; - d: { - if ((h | 0) > F[(a + 16) >> 2]) { - i = (h - F[(a + 20) >> 2]) | 0; - } else { - if ((h | 0) >= F[(a + 12) >> 2]) { - break d; - } - i = (h + F[(a + 20) >> 2]) | 0; - } - F[d >> 2] = i; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - } - f = F[(a + 56) >> 2]; - q = F[f >> 2]; - f = (F[(f + 4) >> 2] - q) | 0; - if ((f | 0) >= 5) { - o = (f >>> 2) | 0; - t = o >>> 0 <= 2 ? 2 : o; - u = e & -2; - w = e & 1; - h = 1; - while (1) { - e: { - f: { - if ((h | 0) != (o | 0)) { - r = L(e, h); - f = F[((h << 2) + q) >> 2]; - if ((f | 0) == -1) { - break f; - } - f = F[(F[(p + 12) >> 2] + (f << 2)) >> 2]; - if ((f | 0) == -1) { - break f; - } - j = F[s >> 2]; - g = F[p >> 2]; - k = F[(j + (F[(g + (f << 2)) >> 2] << 2)) >> 2]; - i = (f + 1) | 0; - i = ((i >>> 0) % 3) | 0 ? i : (f - 2) | 0; - if ((i | 0) != -1) { - i = F[(g + (i << 2)) >> 2]; - } else { - i = -1; - } - g: { - h: { - if (((f >>> 0) % 3) | 0) { - f = (f - 1) | 0; - break h; - } - f = (f + 2) | 0; - l = -1; - if ((f | 0) == -1) { - break g; - } - } - l = F[(g + (f << 2)) >> 2]; - } - if ((h | 0) <= (k | 0)) { - break f; - } - f = F[((i << 2) + j) >> 2]; - if ((f | 0) >= (h | 0)) { - break f; - } - g = F[(j + (l << 2)) >> 2]; - if ((g | 0) >= (h | 0)) { - break f; - } - i: { - if ((e | 0) <= 0) { - break i; - } - g = L(e, g); - j = L(e, f); - k = L(e, k); - f = 0; - l = 0; - if ((e | 0) != 1) { - while (1) { - F[((f << 2) + m) >> 2] = - ((F[(((f + g) << 2) + c) >> 2] + - F[(((f + j) << 2) + c) >> 2]) | - 0) - - F[(((f + k) << 2) + c) >> 2]; - i = f | 1; - F[((i << 2) + m) >> 2] = - ((F[(((g + i) << 2) + c) >> 2] + - F[(((j + i) << 2) + c) >> 2]) | - 0) - - F[(((i + k) << 2) + c) >> 2]; - f = (f + 2) | 0; - l = (l + 2) | 0; - if ((u | 0) != (l | 0)) { - continue; - } - break; - } - } - if (!w) { - break i; - } - F[((f << 2) + m) >> 2] = - ((F[(((f + g) << 2) + c) >> 2] + - F[(((f + j) << 2) + c) >> 2]) | - 0) - - F[(((f + k) << 2) + c) >> 2]; - } - if ((d | 0) <= 0) { - break e; - } - j = F[n >> 2]; - f = 0; - while (1) { - d = f << 2; - g = F[(d + m) >> 2]; - k = F[(a + 16) >> 2]; - j: { - if ((g | 0) > (k | 0)) { - F[(d + j) >> 2] = k; - break j; - } - d = (d + j) | 0; - k = F[(a + 12) >> 2]; - if ((k | 0) > (g | 0)) { - F[d >> 2] = k; - break j; - } - F[d >> 2] = g; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - f = 0; - if ((d | 0) <= 0) { - break e; - } - d = r << 2; - k = (d + c) | 0; - i = (b + d) | 0; - while (1) { - g = f << 2; - d = (g + k) | 0; - g = (F[(g + i) >> 2] + F[(g + j) >> 2]) | 0; - F[d >> 2] = g; - k: { - if ((g | 0) > F[(a + 16) >> 2]) { - l = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break k; - } - l = (g + F[(a + 20) >> 2]) | 0; - } - F[d >> 2] = l; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - break e; - } - ta(); - v(); - } - if ((d | 0) <= 0) { - break e; - } - k = ((L((h - 1) | 0, e) << 2) + c) | 0; - j = F[n >> 2]; - f = 0; - while (1) { - d = f << 2; - g = F[(d + k) >> 2]; - i = F[(a + 16) >> 2]; - l: { - if ((g | 0) > (i | 0)) { - F[(d + j) >> 2] = i; - break l; - } - d = (d + j) | 0; - i = F[(a + 12) >> 2]; - if ((i | 0) > (g | 0)) { - F[d >> 2] = i; - break l; - } - F[d >> 2] = g; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - f = 0; - if ((d | 0) <= 0) { - break e; - } - d = r << 2; - k = (d + c) | 0; - i = (b + d) | 0; - while (1) { - g = f << 2; - d = (g + k) | 0; - g = (F[(g + i) >> 2] + F[(g + j) >> 2]) | 0; - F[d >> 2] = g; - m: { - if ((g | 0) > F[(a + 16) >> 2]) { - l = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break m; - } - l = (g + F[(a + 20) >> 2]) | 0; - } - F[d >> 2] = l; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - } - h = (h + 1) | 0; - if ((t | 0) != (h | 0)) { - continue; - } - break; - } - } - ja(m); - return 1; - } - function od(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - if ((b | 0) == -1) { - return 1; - } - g = ((b >>> 0) / 3) | 0; - if ( - !( - (F[(F[(a + 24) >> 2] + ((g >>> 3) & 268435452)) >> 2] >>> - g) & - 1 - ) - ) { - e = F[(a + 48) >> 2]; - F[(a + 52) >> 2] = e; - a: { - if ((e | 0) != F[(a + 56) >> 2]) { - F[e >> 2] = b; - F[(a + 52) >> 2] = e + 4; - break a; - } - d = ka(4); - F[d >> 2] = b; - c = (d + 4) | 0; - F[(a + 56) >> 2] = c; - F[(a + 52) >> 2] = c; - F[(a + 48) >> 2] = d; - if (!e) { - break a; - } - ja(e); - } - c = (b + 1) | 0; - i = ((c >>> 0) % 3) | 0 ? c : (b - 2) | 0; - c = F[(F[(a + 4) >> 2] + 28) >> 2]; - k = F[((i << 2) + c) >> 2]; - if ((k | 0) == -1) { - return 0; - } - e = (((b - L(g, 3)) | 0 ? -1 : 2) + b) | 0; - j = F[(c + (e << 2)) >> 2]; - if ((j | 0) == -1) { - return 0; - } - b = F[(a + 36) >> 2]; - g = (b + ((k >>> 3) & 536870908)) | 0; - d = F[g >> 2]; - c = 1 << k; - if (!(d & c)) { - F[g >> 2] = c | d; - Ka((a + 8) | 0, k, i); - b = F[(a + 36) >> 2]; - } - d = (((j >>> 3) & 536870908) + b) | 0; - c = F[d >> 2]; - b = 1 << j; - if (!(c & b)) { - F[d >> 2] = b | c; - Ka((a + 8) | 0, j, e); - } - f = F[(a + 52) >> 2]; - if ((f | 0) == F[(a + 48) >> 2]) { - return 1; - } - k = (a + 8) | 0; - while (1) { - b: { - c: { - f = (f - 4) | 0; - b = F[f >> 2]; - if ((b | 0) == -1) { - break c; - } - c = ((b >>> 0) / 3) | 0; - g = (F[(a + 24) >> 2] + ((c >>> 3) & 268435452)) | 0; - d = F[g >> 2]; - c = 1 << c; - if (d & c) { - break c; - } - F[g >> 2] = c | d; - h = F[(a + 4) >> 2]; - c = F[(F[(h + 28) >> 2] + (b << 2)) >> 2]; - if ((c | 0) == -1) { - return 0; - } - while (1) { - d = b; - d: { - e: { - j = - (F[(a + 36) >> 2] + ((c >>> 3) & 536870908)) | - 0; - i = F[j >> 2]; - e = 1 << c; - if (i & e) { - break e; - } - f: { - g = F[(F[(h + 40) >> 2] + (c << 2)) >> 2]; - g: { - if ((g | 0) == -1) { - break g; - } - b = (g + 1) | 0; - b = ((b >>> 0) % 3) | 0 ? b : (g - 2) | 0; - if ( - ((b | 0) == -1) | - ((F[ - (F[h >> 2] + ((b >>> 3) & 536870908)) >> 2 - ] >>> - b) & - 1) - ) { - break g; - } - g = - F[ - (F[(F[(h + 64) >> 2] + 12) >> 2] + - (b << 2)) >> - 2 - ]; - if ((g | 0) != -1) { - break f; - } - } - F[j >> 2] = e | i; - Ka(k, c, d); - h = F[(a + 4) >> 2]; - break e; - } - F[j >> 2] = e | i; - Ka(k, c, d); - h = F[(a + 4) >> 2]; - b = (g + 1) | 0; - if ( - ((((b >>> 0) % 3) | 0 ? b : (g - 2) | 0) | 0) == - -1 - ) { - break e; - } - b = -1; - h: { - if ((d | 0) == -1) { - break h; - } - c = (d + 1) | 0; - c = ((c >>> 0) % 3) | 0 ? c : (d - 2) | 0; - if ( - ((c | 0) == -1) | - ((F[ - (F[h >> 2] + ((c >>> 3) & 536870908)) >> 2 - ] >>> - c) & - 1) - ) { - break h; - } - b = - F[ - (F[(F[(h + 64) >> 2] + 12) >> 2] + - (c << 2)) >> - 2 - ]; - } - c = ((b >>> 0) / 3) | 0; - d = 1 << c; - f = F[(a + 24) >> 2]; - e = (c >>> 5) | 0; - j = F[(f + (e << 2)) >> 2]; - break d; - } - i: { - j: { - if ((d | 0) == -1) { - break j; - } - c = -1; - b = (d + 1) | 0; - b = ((b >>> 0) % 3) | 0 ? b : (d - 2) | 0; - if ( - !( - ((b | 0) == -1) | - ((F[ - (F[h >> 2] + ((b >>> 3) & 536870908)) >> 2 - ] >>> - b) & - 1) - ) - ) { - c = - F[ - (F[(F[(h + 64) >> 2] + 12) >> 2] + - (b << 2)) >> - 2 - ]; - } - k: { - l: { - if (((d >>> 0) % 3) | 0) { - f = (d - 1) | 0; - break l; - } - f = (d + 2) | 0; - b = -1; - if ((f | 0) == -1) { - break k; - } - } - b = -1; - if ( - (F[ - (F[h >> 2] + ((f >>> 3) & 536870908)) >> 2 - ] >>> - f) & - 1 - ) { - break k; - } - b = - F[ - (F[(F[(h + 64) >> 2] + 12) >> 2] + - (f << 2)) >> - 2 - ]; - } - g = (b | 0) == -1; - i = g ? -1 : ((b >>> 0) / 3) | 0; - if ((c | 0) != -1) { - f = F[(a + 24) >> 2]; - d = ((c >>> 0) / 3) | 0; - e = (d >>> 5) | 0; - j = F[(f + (e << 2)) >> 2]; - d = 1 << d; - if (!(j & d)) { - break i; - } - } - if (g) { - break j; - } - d = 1 << i; - f = F[(a + 24) >> 2]; - e = (i >>> 5) | 0; - j = F[(f + (e << 2)) >> 2]; - if (!(d & j)) { - break d; - } - } - f = (F[(a + 52) >> 2] - 4) | 0; - F[(a + 52) >> 2] = f; - break b; - } - if (g) { - b = c; - break d; - } - if ( - (F[(((i >>> 3) & 536870908) + f) >> 2] >>> i) & - 1 - ) { - b = c; - break d; - } - h = F[(a + 52) >> 2]; - F[(h - 4) >> 2] = b; - if (F[(a + 56) >> 2] != (h | 0)) { - F[h >> 2] = c; - f = (h + 4) | 0; - break c; - } - m: { - i = F[(a + 48) >> 2]; - e = (h - i) | 0; - g = e >> 2; - d = (g + 1) | 0; - if (d >>> 0 < 1073741824) { - b = (e >>> 1) | 0; - e = - e >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 > d >>> 0 - ? b - : d; - if (e) { - if (e >>> 0 >= 1073741824) { - break m; - } - d = ka(e << 2); - } else { - d = 0; - } - b = (d + (g << 2)) | 0; - F[b >> 2] = c; - f = (b + 4) | 0; - if ((h | 0) != (i | 0)) { - while (1) { - b = (b - 4) | 0; - h = (h - 4) | 0; - F[b >> 2] = F[h >> 2]; - if ((h | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(a + 56) >> 2] = d + (e << 2); - F[(a + 52) >> 2] = f; - F[(a + 48) >> 2] = b; - if (!i) { - break b; - } - ja(i); - f = F[(a + 52) >> 2]; - break b; - } - na(); - v(); - } - oa(); - v(); - } - F[((e << 2) + f) >> 2] = d | j; - c = F[(F[(h + 28) >> 2] + (b << 2)) >> 2]; - if ((c | 0) != -1) { - continue; - } - break; - } - return 0; - } - F[(a + 52) >> 2] = f; - } - if (F[(a + 48) >> 2] != (f | 0)) { - continue; - } - break; - } - } - return 1; - } - function he(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0, - w = 0; - F[(a + 8) >> 2] = e; - m = (a + 32) | 0; - h = F[m >> 2]; - f = (F[(a + 36) >> 2] - h) >> 2; - a: { - if (f >>> 0 < e >>> 0) { - qa(m, (e - f) | 0); - d = F[(a + 8) >> 2]; - break a; - } - d = e; - if (d >>> 0 >= f >>> 0) { - break a; - } - F[(a + 36) >> 2] = h + (e << 2); - d = e; - } - s = F[(a + 52) >> 2]; - n = F[(a + 48) >> 2]; - f = 0; - h = e >>> 0 > 1073741823 ? -1 : e << 2; - l = ma(ka(h), 0, h); - b: { - if ((d | 0) <= 0) { - break b; - } - g = F[(a + 32) >> 2]; - while (1) { - d = f << 2; - h = F[(d + l) >> 2]; - i = F[(a + 16) >> 2]; - c: { - if ((h | 0) > (i | 0)) { - F[(d + g) >> 2] = i; - break c; - } - d = (d + g) | 0; - i = F[(a + 12) >> 2]; - if ((i | 0) > (h | 0)) { - F[d >> 2] = i; - break c; - } - F[d >> 2] = h; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - if ((d | 0) <= 0) { - break b; - } - f = 0; - while (1) { - h = f << 2; - d = (h + c) | 0; - h = (F[(b + h) >> 2] + F[(g + h) >> 2]) | 0; - F[d >> 2] = h; - d: { - if ((h | 0) > F[(a + 16) >> 2]) { - h = (h - F[(a + 20) >> 2]) | 0; - } else { - if ((h | 0) >= F[(a + 12) >> 2]) { - break d; - } - h = (h + F[(a + 20) >> 2]) | 0; - } - F[d >> 2] = h; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - } - f = F[(a + 56) >> 2]; - q = F[f >> 2]; - f = (F[(f + 4) >> 2] - q) | 0; - if ((f | 0) >= 5) { - o = (f >>> 2) | 0; - t = o >>> 0 <= 2 ? 2 : o; - u = e & -2; - w = e & 1; - h = 1; - while (1) { - e: { - f: { - if ((h | 0) != (o | 0)) { - r = L(e, h); - f = F[((h << 2) + q) >> 2]; - if ( - ((f | 0) == -1) | - ((F[(F[n >> 2] + ((f >>> 3) & 536870908)) >> 2] >>> - f) & - 1) - ) { - break f; - } - f = - F[ - (F[(F[(n + 64) >> 2] + 12) >> 2] + (f << 2)) >> 2 - ]; - if ((f | 0) == -1) { - break f; - } - i = F[s >> 2]; - g = F[(n + 28) >> 2]; - k = F[(i + (F[(g + (f << 2)) >> 2] << 2)) >> 2]; - if ((k | 0) >= (h | 0)) { - break f; - } - j = (f + 1) | 0; - j = - F[ - (i + - (F[ - (g + - ((((j >>> 0) % 3) | 0 ? j : (f - 2) | 0) << - 2)) >> - 2 - ] << - 2)) >> - 2 - ]; - if ((j | 0) >= (h | 0)) { - break f; - } - f = - F[ - (i + - (F[ - (g + - ((f + (((f >>> 0) % 3) | 0 ? -1 : 2)) << - 2)) >> - 2 - ] << - 2)) >> - 2 - ]; - if ((f | 0) >= (h | 0)) { - break f; - } - g: { - if ((e | 0) <= 0) { - break g; - } - g = L(e, f); - i = L(e, j); - k = L(e, k); - f = 0; - p = 0; - if ((e | 0) != 1) { - while (1) { - F[((f << 2) + l) >> 2] = - ((F[(((f + g) << 2) + c) >> 2] + - F[(((f + i) << 2) + c) >> 2]) | - 0) - - F[(((f + k) << 2) + c) >> 2]; - j = f | 1; - F[((j << 2) + l) >> 2] = - ((F[(((g + j) << 2) + c) >> 2] + - F[(((i + j) << 2) + c) >> 2]) | - 0) - - F[(((k + j) << 2) + c) >> 2]; - f = (f + 2) | 0; - p = (p + 2) | 0; - if ((u | 0) != (p | 0)) { - continue; - } - break; - } - } - if (!w) { - break g; - } - F[((f << 2) + l) >> 2] = - ((F[(((f + g) << 2) + c) >> 2] + - F[(((f + i) << 2) + c) >> 2]) | - 0) - - F[(((f + k) << 2) + c) >> 2]; - } - if ((d | 0) <= 0) { - break e; - } - i = F[m >> 2]; - f = 0; - while (1) { - d = f << 2; - g = F[(d + l) >> 2]; - k = F[(a + 16) >> 2]; - h: { - if ((g | 0) > (k | 0)) { - F[(d + i) >> 2] = k; - break h; - } - d = (d + i) | 0; - k = F[(a + 12) >> 2]; - if ((k | 0) > (g | 0)) { - F[d >> 2] = k; - break h; - } - F[d >> 2] = g; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - f = 0; - if ((d | 0) <= 0) { - break e; - } - d = r << 2; - k = (d + c) | 0; - j = (b + d) | 0; - while (1) { - g = f << 2; - d = (g + k) | 0; - g = (F[(g + j) >> 2] + F[(g + i) >> 2]) | 0; - F[d >> 2] = g; - i: { - if ((g | 0) > F[(a + 16) >> 2]) { - g = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break i; - } - g = (g + F[(a + 20) >> 2]) | 0; - } - F[d >> 2] = g; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - break e; - } - ta(); - v(); - } - if ((d | 0) <= 0) { - break e; - } - k = ((L((h - 1) | 0, e) << 2) + c) | 0; - i = F[m >> 2]; - f = 0; - while (1) { - d = f << 2; - g = F[(d + k) >> 2]; - j = F[(a + 16) >> 2]; - j: { - if ((g | 0) > (j | 0)) { - F[(d + i) >> 2] = j; - break j; - } - d = (d + i) | 0; - j = F[(a + 12) >> 2]; - if ((j | 0) > (g | 0)) { - F[d >> 2] = j; - break j; - } - F[d >> 2] = g; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - f = 0; - if ((d | 0) <= 0) { - break e; - } - d = r << 2; - k = (d + c) | 0; - j = (b + d) | 0; - while (1) { - g = f << 2; - d = (g + k) | 0; - g = (F[(g + j) >> 2] + F[(g + i) >> 2]) | 0; - F[d >> 2] = g; - k: { - if ((g | 0) > F[(a + 16) >> 2]) { - g = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break k; - } - g = (g + F[(a + 20) >> 2]) | 0; - } - F[d >> 2] = g; - } - d = F[(a + 8) >> 2]; - f = (f + 1) | 0; - if ((d | 0) > (f | 0)) { - continue; - } - break; - } - } - h = (h + 1) | 0; - if ((t | 0) != (h | 0)) { - continue; - } - break; - } - } - ja(l); - return 1; - } - function Fb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = M(0), - k = 0, - l = 0, - m = M(0); - i = F[c >> 2]; - a: { - b: { - f = F[(b + 4) >> 2]; - if (!f) { - break b; - } - g = ni(f); - c: { - if (g >>> 0 >= 2) { - e = i; - if (f >>> 0 <= e >>> 0) { - e = ((i >>> 0) % (f >>> 0)) | 0; - } - c = F[(F[b >> 2] + (e << 2)) >> 2]; - if (!c) { - break b; - } - if (g >>> 0 <= 1) { - break c; - } - while (1) { - c = F[c >> 2]; - if (!c) { - break b; - } - g = F[(c + 4) >> 2]; - if ((g | 0) != (i | 0)) { - if (f >>> 0 <= g >>> 0) { - g = ((g >>> 0) % (f >>> 0)) | 0; - } - if ((e | 0) != (g | 0)) { - break b; - } - } - if (F[(c + 8) >> 2] != (i | 0)) { - continue; - } - break; - } - b = 0; - break a; - } - e = (f - 1) & i; - c = F[(F[b >> 2] + (e << 2)) >> 2]; - if (!c) { - break b; - } - } - h = (f - 1) | 0; - while (1) { - c = F[c >> 2]; - if (!c) { - break b; - } - g = F[(c + 4) >> 2]; - if (((g | 0) != (i | 0)) & ((g & h) != (e | 0))) { - break b; - } - if (F[(c + 8) >> 2] != (i | 0)) { - continue; - } - break; - } - b = 0; - break a; - } - c = ka(16); - d = F[F[d >> 2] >> 2]; - F[(c + 12) >> 2] = 0; - F[(c + 8) >> 2] = d; - F[(c + 4) >> 2] = i; - F[c >> 2] = 0; - m = M((F[(b + 12) >> 2] + 1) >>> 0); - j = J[(b + 16) >> 2]; - d: { - if (m > M(j * M(f >>> 0)) ? 0 : f) { - break d; - } - e = 2; - d = (((f - 1) & f) != 0) | (f >>> 0 < 3) | (f << 1); - j = M(S(M(m / j))); - e: { - if ((j < M(4294967296)) & (j >= M(0))) { - g = ~~j >>> 0; - break e; - } - g = 0; - } - d = d >>> 0 > g >>> 0 ? d : g; - f: { - if ((d | 0) == 1) { - break f; - } - if (!(d & (d - 1))) { - e = d; - break f; - } - e = Mc(d); - f = F[(b + 4) >> 2]; - } - g: { - if (e >>> 0 <= f >>> 0) { - if (e >>> 0 >= f >>> 0) { - break g; - } - g = f >>> 0 < 3; - j = M(S(M(M(I[(b + 12) >> 2]) / J[(b + 16) >> 2]))); - h: { - if ((j < M(4294967296)) & (j >= M(0))) { - d = ~~j >>> 0; - break h; - } - d = 0; - } - i: { - j: { - if (g) { - break j; - } - if (ni(f) >>> 0 > 1) { - break j; - } - d = d >>> 0 < 2 ? d : 1 << (32 - O((d - 1) | 0)); - break i; - } - d = Mc(d); - } - e = d >>> 0 < e >>> 0 ? e : d; - if (f >>> 0 <= e >>> 0) { - break g; - } - } - f = 0; - g = 0; - h = e; - k: { - l: { - m: { - n: { - if (e) { - if (h >>> 0 >= 1073741824) { - break n; - } - d = ka(h << 2); - e = F[b >> 2]; - F[b >> 2] = d; - if (e) { - ja(e); - } - F[(b + 4) >> 2] = h; - d = 0; - if (h >>> 0 >= 4) { - e = h & -4; - while (1) { - k = d << 2; - F[(k + F[b >> 2]) >> 2] = 0; - F[(F[b >> 2] + (k | 4)) >> 2] = 0; - F[(F[b >> 2] + (k | 8)) >> 2] = 0; - F[(F[b >> 2] + (k | 12)) >> 2] = 0; - d = (d + 4) | 0; - g = (g + 4) | 0; - if ((e | 0) != (g | 0)) { - continue; - } - break; - } - } - e = h & 3; - if (e) { - while (1) { - F[(F[b >> 2] + (d << 2)) >> 2] = 0; - d = (d + 1) | 0; - f = (f + 1) | 0; - if ((e | 0) != (f | 0)) { - continue; - } - break; - } - } - e = F[(b + 8) >> 2]; - if (!e) { - break k; - } - d = (b + 8) | 0; - f = F[(e + 4) >> 2]; - g = ni(h); - if (g >>> 0 < 2) { - break m; - } - f = - f >>> 0 >= h >>> 0 - ? ((f >>> 0) % (h >>> 0)) | 0 - : f; - F[(F[b >> 2] + (f << 2)) >> 2] = d; - d = F[e >> 2]; - if (!d) { - break k; - } - if (g >>> 0 <= 1) { - break l; - } - while (1) { - g = F[(d + 4) >> 2]; - if (h >>> 0 <= g >>> 0) { - g = ((g >>> 0) % (h >>> 0)) | 0; - } - o: { - if ((f | 0) == (g | 0)) { - e = d; - break o; - } - l = g << 2; - k = (l + F[b >> 2]) | 0; - if (!F[k >> 2]) { - F[k >> 2] = e; - e = d; - f = g; - break o; - } - F[e >> 2] = F[d >> 2]; - F[d >> 2] = F[F[(l + F[b >> 2]) >> 2] >> 2]; - F[F[(l + F[b >> 2]) >> 2] >> 2] = d; - } - d = F[e >> 2]; - if (d) { - continue; - } - break; - } - break k; - } - d = F[b >> 2]; - F[b >> 2] = 0; - if (d) { - ja(d); - } - F[(b + 4) >> 2] = 0; - break k; - } - oa(); - v(); - } - f = (h - 1) & f; - F[(F[b >> 2] + (f << 2)) >> 2] = d; - d = F[e >> 2]; - if (!d) { - break k; - } - } - k = (h - 1) | 0; - while (1) { - g = k & F[(d + 4) >> 2]; - p: { - if ((g | 0) == (f | 0)) { - e = d; - break p; - } - l = g << 2; - h = (l + F[b >> 2]) | 0; - if (F[h >> 2]) { - F[e >> 2] = F[d >> 2]; - F[d >> 2] = F[F[(l + F[b >> 2]) >> 2] >> 2]; - F[F[(l + F[b >> 2]) >> 2] >> 2] = d; - break p; - } - F[h >> 2] = e; - e = d; - f = g; - } - d = F[e >> 2]; - if (d) { - continue; - } - break; - } - } - } - f = F[(b + 4) >> 2]; - d = (f - 1) | 0; - if (!(d & f)) { - e = d & i; - break d; - } - if (f >>> 0 > i >>> 0) { - e = i; - break d; - } - e = ((i >>> 0) % (f >>> 0)) | 0; - } - e = (F[b >> 2] + (e << 2)) | 0; - d = F[e >> 2]; - q: { - r: { - if (!d) { - d = (b + 8) | 0; - F[c >> 2] = F[d >> 2]; - F[(b + 8) >> 2] = c; - F[e >> 2] = d; - d = F[c >> 2]; - if (!d) { - break q; - } - d = F[(d + 4) >> 2]; - e = (f - 1) | 0; - s: { - if (!(e & f)) { - d = d & e; - break s; - } - if (d >>> 0 < f >>> 0) { - break s; - } - d = ((d >>> 0) % (f >>> 0)) | 0; - } - d = (F[b >> 2] + (d << 2)) | 0; - break r; - } - F[c >> 2] = F[d >> 2]; - } - F[d >> 2] = c; - } - F[(b + 12) >> 2] = F[(b + 12) >> 2] + 1; - b = 1; - } - D[(a + 4) | 0] = b; - F[a >> 2] = c; - } - function Vb(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - j = (L(b, 12) + a) | 0; - F[(j + 12) >> 2] = F[(j + 8) >> 2]; - m = (c | 0) == -1 ? -1 : ((c >>> 0) / 3) | 0; - d = 1; - k = c; - a: { - b: { - c: { - while (1) { - d: { - l = d; - if (!d) { - if ((k | 0) == -1) { - break d; - } - if ( - (Wc(a, ((((k >>> 0) % 3) | 0 ? -1 : 2) + k) | 0) | - 0) == - -1 - ) { - break a; - } - c = (k + 1) | 0; - d = ((c >>> 0) % 3) | 0 ? c : (k - 2) | 0; - if ((d | 0) == -1) { - break a; - } - c = (d + 1) | 0; - c = ((c >>> 0) % 3) | 0 ? c : (d - 2) | 0; - if ((c | 0) == -1) { - break a; - } - d = - F[ - (F[(F[(a + 4) >> 2] + 12) >> 2] + (c << 2)) >> 2 - ]; - if ((d | 0) == -1) { - break a; - } - c = (d + 1) | 0; - c = ((c >>> 0) % 3) | 0 ? c : (d - 2) | 0; - if ((c | 0) == -1) { - break a; - } - m = ((c >>> 0) / 3) | 0; - } - e: { - d = - (F[(a + 56) >> 2] + ((m >>> 3) & 536870908)) | 0; - h = F[d >> 2]; - e = 1 << m; - if (h & e) { - break e; - } - f = 0; - while (1) { - F[d >> 2] = e | h; - d = F[(j + 12) >> 2]; - f: { - if ((d | 0) != F[(j + 16) >> 2]) { - F[d >> 2] = m; - F[(j + 12) >> 2] = d + 4; - break f; - } - n = F[(j + 8) >> 2]; - h = (d - n) | 0; - e = h >> 2; - i = (e + 1) | 0; - if (i >>> 0 >= 1073741824) { - break c; - } - g = (h >>> 1) | 0; - i = - h >>> 0 >= 2147483644 - ? 1073741823 - : i >>> 0 < g >>> 0 - ? g - : i; - if (i) { - if (i >>> 0 >= 1073741824) { - break b; - } - g = ka(i << 2); - } else { - g = 0; - } - h = (g + (e << 2)) | 0; - F[h >> 2] = m; - e = (h + 4) | 0; - if ((d | 0) != (n | 0)) { - while (1) { - h = (h - 4) | 0; - d = (d - 4) | 0; - F[h >> 2] = F[d >> 2]; - if ((d | 0) != (n | 0)) { - continue; - } - break; - } - } - F[(j + 8) >> 2] = h; - F[(j + 12) >> 2] = e; - F[(j + 16) >> 2] = g + (i << 2); - if (!n) { - break f; - } - ja(n); - } - g = (f + 1) | 0; - g: { - h: { - i: { - if (!f) { - break i; - } - if (g & 1) { - if ((c | 0) == -1) { - c = -1; - break g; - } - d = (c + 1) | 0; - c = ((d >>> 0) % 3) | 0 ? d : (c - 2) | 0; - break i; - } - k = l ? k : c; - if ((c | 0) == -1) { - c = -1; - break g; - } - if (((c >>> 0) % 3) | 0) { - d = (c - 1) | 0; - break h; - } - c = (c + 2) | 0; - } - d = c; - c = -1; - if ((d | 0) == -1) { - break g; - } - } - c = - F[ - (F[(F[(a + 4) >> 2] + 12) >> 2] + - (d << 2)) >> - 2 - ]; - h = -1; - f = -1; - e = (d + 1) | 0; - e = ((e >>> 0) % 3) | 0 ? e : (d - 2) | 0; - if ((e | 0) >= 0) { - f = ((e >>> 0) / 3) | 0; - f = - F[ - (((F[(F[a >> 2] + 96) >> 2] + L(f, 12)) | - 0) + - ((e - L(f, 3)) << 2)) >> - 2 - ]; - } - j: { - if ((c | 0) == -1) { - break j; - } - i = ((((c >>> 0) % 3) | 0 ? -1 : 2) + c) | 0; - if ((i | 0) < 0) { - break j; - } - e = ((i >>> 0) / 3) | 0; - h = - F[ - (((F[(F[a >> 2] + 96) >> 2] + L(e, 12)) | - 0) + - ((i - L(e, 3)) << 2)) >> - 2 - ]; - } - if ((f | 0) != (h | 0)) { - c = -1; - break g; - } - k: { - l: { - f = - ((((d >>> 0) % 3) | 0 ? -1 : 2) + d) | 0; - if ((f | 0) >= 0) { - d = ((f >>> 0) / 3) | 0; - if ((c | 0) != -1) { - break l; - } - c = -1; - break g; - } - d = -1; - if ((c | 0) != -1) { - break k; - } - c = -1; - break g; - } - d = - F[ - (((F[(F[a >> 2] + 96) >> 2] + L(d, 12)) | - 0) + - ((f - L(d, 3)) << 2)) >> - 2 - ]; - } - f = (c + 1) | 0; - e = ((f >>> 0) % 3) | 0 ? f : (c - 2) | 0; - if ((e | 0) >= 0) { - f = ((e >>> 0) / 3) | 0; - f = - F[ - (((F[(F[a >> 2] + 96) >> 2] + L(f, 12)) | - 0) + - ((e - L(f, 3)) << 2)) >> - 2 - ]; - } else { - f = -1; - } - if ((f | 0) != (d | 0)) { - c = -1; - break g; - } - f = g; - m = ((c >>> 0) / 3) | 0; - d = - (F[(a + 56) >> 2] + ((m >>> 3) & 268435452)) | - 0; - h = F[d >> 2]; - e = 1 << m; - if (!(h & e)) { - continue; - } - } - break; - } - if (l | !(g & 1)) { - break e; - } - l = (F[(j + 12) >> 2] - 4) | 0; - g = F[l >> 2]; - d = - (F[(a + 56) >> 2] + ((g >>> 3) & 536870908)) | 0; - c = F[d >> 2]; - (o = d), (p = oi(g) & c), (F[o >> 2] = p); - F[(j + 12) >> 2] = l; - break a; - } - d = 0; - if (l) { - continue; - } - break a; - } - break; - } - k = -1; - Wc(a, -1); - break a; - } - na(); - v(); - } - oa(); - v(); - } - F[((((b << 2) + a) | 0) + 44) >> 2] = k; - b = F[(j + 12) >> 2]; - i = F[(j + 8) >> 2]; - m: { - if ((b | 0) == (i | 0)) { - break m; - } - c = (b - i) | 0; - b = c >> 2; - b = b >>> 0 <= 1 ? 1 : b; - k = b & 1; - e = F[(a + 56) >> 2]; - d = 0; - if (c >>> 0 >= 8) { - f = b & -2; - c = 0; - while (1) { - l = d << 2; - g = F[(l + i) >> 2]; - b = (e + ((g >>> 3) & 536870908)) | 0; - a = F[b >> 2]; - (o = b), (p = oi(g) & a), (F[o >> 2] = p); - g = F[(i + (l | 4)) >> 2]; - b = (e + ((g >>> 3) & 536870908)) | 0; - a = F[b >> 2]; - (o = b), (p = oi(g) & a), (F[o >> 2] = p); - d = (d + 2) | 0; - c = (c + 2) | 0; - if ((f | 0) != (c | 0)) { - continue; - } - break; - } - } - if (!k) { - break m; - } - c = F[(i + (d << 2)) >> 2]; - b = (e + ((c >>> 3) & 536870908)) | 0; - a = F[b >> 2]; - (o = b), (p = oi(c) & a), (F[o >> 2] = p); - } - } - function pd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - if ((b | 0) == -1) { - return 1; - } - g = ((b >>> 0) / 3) | 0; - if ( - !( - (F[(F[(a + 24) >> 2] + ((g >>> 3) & 268435452)) >> 2] >>> - g) & - 1 - ) - ) { - f = F[(a + 48) >> 2]; - F[(a + 52) >> 2] = f; - a: { - if ((f | 0) != F[(a + 56) >> 2]) { - F[f >> 2] = b; - F[(a + 52) >> 2] = f + 4; - break a; - } - d = ka(4); - F[d >> 2] = b; - c = (d + 4) | 0; - F[(a + 56) >> 2] = c; - F[(a + 52) >> 2] = c; - F[(a + 48) >> 2] = d; - if (!f) { - break a; - } - ja(f); - } - e = -1; - d = F[(a + 4) >> 2]; - c = (b + 1) | 0; - i = ((c >>> 0) % 3) | 0 ? c : (b - 2) | 0; - if ((i | 0) != -1) { - e = F[(F[d >> 2] + (i << 2)) >> 2]; - } - b: { - h = (b - L(g, 3)) | 0; - if (h) { - c = (b - 1) | 0; - break b; - } - c = (b + 2) | 0; - if ((c | 0) != -1) { - break b; - } - return 0; - } - if ((e | 0) == -1) { - return 0; - } - j = F[(F[d >> 2] + (c << 2)) >> 2]; - if ((j | 0) == -1) { - return 0; - } - c = F[(a + 36) >> 2]; - f = (c + ((e >>> 3) & 536870908)) | 0; - g = F[f >> 2]; - d = 1 << e; - if (!(g & d)) { - F[f >> 2] = d | g; - Ka((a + 8) | 0, e, i); - c = F[(a + 36) >> 2]; - } - g = (((j >>> 3) & 536870908) + c) | 0; - d = F[g >> 2]; - c = 1 << j; - if (!(d & c)) { - F[g >> 2] = c | d; - Ka((a + 8) | 0, j, ((h ? -1 : 2) + b) | 0); - } - c = F[(a + 52) >> 2]; - if ((c | 0) == F[(a + 48) >> 2]) { - return 1; - } - j = (a + 8) | 0; - while (1) { - c: { - d: { - c = (c - 4) | 0; - b = F[c >> 2]; - if ((b | 0) == -1) { - break d; - } - d = ((b >>> 0) / 3) | 0; - f = (F[(a + 24) >> 2] + ((d >>> 3) & 268435452)) | 0; - g = F[f >> 2]; - d = 1 << d; - if (g & d) { - break d; - } - F[f >> 2] = d | g; - while (1) { - i = F[(a + 4) >> 2]; - e = F[(F[i >> 2] + (b << 2)) >> 2]; - if ((e | 0) == -1) { - return 0; - } - e: { - f: { - h = - (F[(a + 36) >> 2] + ((e >>> 3) & 536870908)) | - 0; - f = F[h >> 2]; - g = 1 << e; - if (f & g) { - break f; - } - g: { - d = F[(F[(i + 24) >> 2] + (e << 2)) >> 2]; - h: { - if ((d | 0) == -1) { - break h; - } - c = (d + 1) | 0; - c = ((c >>> 0) % 3) | 0 ? c : (d - 2) | 0; - if ((c | 0) == -1) { - break h; - } - d = F[(F[(i + 12) >> 2] + (c << 2)) >> 2]; - if ((d | 0) != -1) { - break g; - } - } - F[h >> 2] = f | g; - Ka(j, e, b); - break f; - } - F[h >> 2] = f | g; - Ka(j, e, b); - c = (d + 1) | 0; - if ( - ((((c >>> 0) % 3) | 0 ? c : (d - 2) | 0) | 0) == - -1 - ) { - break f; - } - c = (b - 2) | 0; - d = (b + 1) | 0; - b = -1; - c = ((d >>> 0) % 3) | 0 ? d : c; - if ((c | 0) != -1) { - b = - F[ - (F[(F[(a + 4) >> 2] + 12) >> 2] + - (c << 2)) >> - 2 - ]; - } - c = ((b >>> 0) / 3) | 0; - d = 1 << c; - e = F[(a + 24) >> 2]; - f = (c >>> 5) | 0; - i = F[(e + (f << 2)) >> 2]; - break e; - } - c = -1; - g = F[(a + 4) >> 2]; - d = (b + 1) | 0; - d = ((d >>> 0) % 3) | 0 ? d : (b - 2) | 0; - if ((d | 0) != -1) { - c = F[(F[(g + 12) >> 2] + (d << 2)) >> 2]; - } - i: { - j: { - if (((b >>> 0) % 3) | 0) { - e = (b - 1) | 0; - break j; - } - e = (b + 2) | 0; - b = -1; - if ((e | 0) == -1) { - break i; - } - } - b = F[(F[(g + 12) >> 2] + (e << 2)) >> 2]; - } - g = (b | 0) == -1; - h = g ? -1 : ((b >>> 0) / 3) | 0; - k: { - if ((c | 0) != -1) { - e = F[(a + 24) >> 2]; - d = ((c >>> 0) / 3) | 0; - f = (d >>> 5) | 0; - i = F[(e + (f << 2)) >> 2]; - d = 1 << d; - if (!(i & d)) { - break k; - } - } - if (!g) { - d = 1 << h; - e = F[(a + 24) >> 2]; - f = (h >>> 5) | 0; - i = F[(e + (f << 2)) >> 2]; - if (!(d & i)) { - break e; - } - } - c = (F[(a + 52) >> 2] - 4) | 0; - F[(a + 52) >> 2] = c; - break c; - } - if (g) { - b = c; - break e; - } - if ( - (F[(((h >>> 3) & 536870908) + e) >> 2] >>> h) & - 1 - ) { - b = c; - break e; - } - e = F[(a + 52) >> 2]; - F[(e - 4) >> 2] = b; - if (F[(a + 56) >> 2] != (e | 0)) { - F[e >> 2] = c; - c = (e + 4) | 0; - break d; - } - l: { - h = F[(a + 48) >> 2]; - f = (e - h) | 0; - g = f >> 2; - d = (g + 1) | 0; - if (d >>> 0 < 1073741824) { - b = (f >>> 1) | 0; - f = - f >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 > d >>> 0 - ? b - : d; - if (f) { - if (f >>> 0 >= 1073741824) { - break l; - } - d = ka(f << 2); - } else { - d = 0; - } - b = (d + (g << 2)) | 0; - F[b >> 2] = c; - c = (b + 4) | 0; - if ((e | 0) != (h | 0)) { - while (1) { - b = (b - 4) | 0; - e = (e - 4) | 0; - F[b >> 2] = F[e >> 2]; - if ((e | 0) != (h | 0)) { - continue; - } - break; - } - } - F[(a + 56) >> 2] = d + (f << 2); - F[(a + 52) >> 2] = c; - F[(a + 48) >> 2] = b; - if (!h) { - break c; - } - ja(h); - c = F[(a + 52) >> 2]; - break c; - } - na(); - v(); - } - oa(); - v(); - } - F[((f << 2) + e) >> 2] = d | i; - if ((b | 0) != -1) { - continue; - } - break; - } - return 0; - } - F[(a + 52) >> 2] = c; - } - if (F[(a + 48) >> 2] != (c | 0)) { - continue; - } - break; - } - } - return 1; - } - function ee(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - h = (Z - 32) | 0; - Z = h; - a: { - b: { - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(F[(a + 48) >> 2] + 64) >> 2]; - if (d >>> 0 > ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0) { - break b; - } - c: { - if (d) { - Na((a + 60) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 60) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(F[(a + 48) >> 2] + 64) >> 2]; - if ( - d >>> 0 > - ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0 - ) { - break b; - } - if (d) { - e = 0; - Na((a + 72) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 72) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(F[(a + 48) >> 2] + 64) >> 2]; - if ( - d >>> 0 > - ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0 - ) { - break b; - } - if (d) { - e = 0; - Na((a + 84) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 84) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(F[(a + 48) >> 2] + 64) >> 2]; - if ( - d >>> 0 > - ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0 - ) { - break b; - } - if (d) { - e = 0; - Na((a + 96) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 96) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - c = F[(b + 8) >> 2]; - f = F[(b + 12) >> 2]; - d = c; - c = F[(b + 20) >> 2]; - i = c; - g = F[(b + 16) >> 2]; - j = (g + 4) | 0; - c = j >>> 0 < 4 ? (c + 1) | 0 : c; - if ( - ((d >>> 0 < j >>> 0) & ((c | 0) >= (f | 0))) | - ((c | 0) > (f | 0)) - ) { - break a; - } - m = F[b >> 2]; - k = (m + g) | 0; - l = - G[k | 0] | - (G[(k + 1) | 0] << 8) | - ((G[(k + 2) | 0] << 16) | (G[(k + 3) | 0] << 24)); - F[(b + 16) >> 2] = j; - F[(b + 20) >> 2] = c; - k = d; - d = f; - c = i; - f = (g + 8) | 0; - c = f >>> 0 < 8 ? (c + 1) | 0 : c; - if ( - ((f >>> 0 > k >>> 0) & ((c | 0) >= (d | 0))) | - ((c | 0) > (d | 0)) - ) { - break a; - } - d = (j + m) | 0; - d = - G[d | 0] | - (G[(d + 1) | 0] << 8) | - ((G[(d + 2) | 0] << 16) | (G[(d + 3) | 0] << 24)); - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = c; - if ((d | 0) < (l | 0)) { - break a; - } - F[(a + 16) >> 2] = d; - F[(a + 12) >> 2] = l; - c = - ((d >> 31) - (((l >> 31) + (d >>> 0 < l >>> 0)) | 0)) | - 0; - b = (d - l) | 0; - if ((!c & (b >>> 0 > 2147483646)) | c) { - break a; - } - e = 1; - b = (b + 1) | 0; - F[(a + 20) >> 2] = b; - c = (b >>> 1) | 0; - F[(a + 24) >> 2] = c; - F[(a + 28) >> 2] = 0 - c; - if (b & 1) { - break a; - } - F[(a + 24) >> 2] = c - 1; - break a; - } - } - e = 0; - } - Z = (h + 32) | 0; - return e | 0; - } - function ai(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - h = (Z - 32) | 0; - Z = h; - a: { - b: { - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(a + 48) >> 2]; - if (d >>> 0 > ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0) { - break b; - } - c: { - if (d) { - Na((a + 60) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 60) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(a + 48) >> 2]; - if ( - d >>> 0 > - ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0 - ) { - break b; - } - if (d) { - e = 0; - Na((a + 72) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 72) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(a + 48) >> 2]; - if ( - d >>> 0 > - ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0 - ) { - break b; - } - if (d) { - e = 0; - Na((a + 84) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 84) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - if (!Oa(1, (h + 28) | 0, b)) { - break b; - } - d = F[(h + 28) >> 2]; - c = F[(a + 48) >> 2]; - if ( - d >>> 0 > - ((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0 - ) { - break b; - } - if (d) { - e = 0; - Na((a + 96) | 0, d); - c = (h + 8) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - if (!Aa(c, b)) { - break c; - } - while (1) { - f = 1 << e; - j = wa(c); - g = (F[(a + 96) >> 2] + ((e >>> 3) & 536870908)) | 0; - if (j) { - i = f | F[g >> 2]; - } else { - i = F[g >> 2] & (f ^ -1); - } - F[g >> 2] = i; - e = (e + 1) | 0; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - e = 0; - c = F[(b + 8) >> 2]; - f = F[(b + 12) >> 2]; - d = c; - c = F[(b + 20) >> 2]; - i = c; - g = F[(b + 16) >> 2]; - j = (g + 4) | 0; - c = j >>> 0 < 4 ? (c + 1) | 0 : c; - if ( - ((d >>> 0 < j >>> 0) & ((c | 0) >= (f | 0))) | - ((c | 0) > (f | 0)) - ) { - break a; - } - m = F[b >> 2]; - k = (m + g) | 0; - l = - G[k | 0] | - (G[(k + 1) | 0] << 8) | - ((G[(k + 2) | 0] << 16) | (G[(k + 3) | 0] << 24)); - F[(b + 16) >> 2] = j; - F[(b + 20) >> 2] = c; - k = d; - d = f; - c = i; - f = (g + 8) | 0; - c = f >>> 0 < 8 ? (c + 1) | 0 : c; - if ( - ((f >>> 0 > k >>> 0) & ((c | 0) >= (d | 0))) | - ((c | 0) > (d | 0)) - ) { - break a; - } - d = (j + m) | 0; - d = - G[d | 0] | - (G[(d + 1) | 0] << 8) | - ((G[(d + 2) | 0] << 16) | (G[(d + 3) | 0] << 24)); - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = c; - if ((d | 0) < (l | 0)) { - break a; - } - F[(a + 16) >> 2] = d; - F[(a + 12) >> 2] = l; - c = - ((d >> 31) - (((l >> 31) + (d >>> 0 < l >>> 0)) | 0)) | - 0; - b = (d - l) | 0; - if ((!c & (b >>> 0 > 2147483646)) | c) { - break a; - } - e = 1; - b = (b + 1) | 0; - F[(a + 20) >> 2] = b; - c = (b >>> 1) | 0; - F[(a + 24) >> 2] = c; - F[(a + 28) >> 2] = 0 - c; - if (b & 1) { - break a; - } - F[(a + 24) >> 2] = c - 1; - break a; - } - } - e = 0; - } - Z = (h + 32) | 0; - return e | 0; - } - function uh(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0; - c = F[(a + 32) >> 2]; - d = F[(c + 16) >> 2]; - e = F[(c + 12) >> 2]; - b = F[(c + 20) >> 2]; - if ( - ((I[(c + 8) >> 2] > d >>> 0) & ((e | 0) >= (b | 0))) | - ((b | 0) < (e | 0)) - ) { - e = G[(F[c >> 2] + d) | 0]; - d = (d + 1) | 0; - b = d ? b : (b + 1) | 0; - F[(c + 16) >> 2] = d; - F[(c + 20) >> 2] = b; - b = F[(a + 48) >> 2]; - F[(a + 48) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - a: { - b: { - c: { - d: { - switch (e | 0) { - case 0: - b = ka(384); - F[b >> 2] = 8284; - ma((b + 4) | 0, 0, 80); - F[(b + 96) >> 2] = 0; - F[(b + 100) >> 2] = 0; - F[(b + 92) >> 2] = -1; - F[(b + 84) >> 2] = -1; - F[(b + 88) >> 2] = -1; - F[(b + 104) >> 2] = 0; - F[(b + 108) >> 2] = 0; - F[(b + 112) >> 2] = 0; - F[(b + 116) >> 2] = 0; - F[(b + 120) >> 2] = 0; - F[(b + 124) >> 2] = 0; - F[(b + 128) >> 2] = 0; - F[(b + 132) >> 2] = 0; - F[(b + 136) >> 2] = 0; - F[(b + 140) >> 2] = 0; - F[(b + 144) >> 2] = 0; - F[(b + 148) >> 2] = 0; - F[(b + 156) >> 2] = 0; - F[(b + 160) >> 2] = 0; - F[(b + 152) >> 2] = 1065353216; - F[(b + 164) >> 2] = 0; - F[(b + 168) >> 2] = 0; - F[(b + 172) >> 2] = 0; - F[(b + 176) >> 2] = 0; - F[(b + 180) >> 2] = 0; - F[(b + 184) >> 2] = 0; - F[(b + 188) >> 2] = 0; - F[(b + 192) >> 2] = 0; - F[(b + 196) >> 2] = 0; - F[(b + 200) >> 2] = 0; - F[(b + 204) >> 2] = 0; - F[(b + 208) >> 2] = 0; - F[(b + 212) >> 2] = -1; - F[(b + 216) >> 2] = 0; - F[(b + 220) >> 2] = 0; - F[(b + 224) >> 2] = 0; - Ja((b + 232) | 0); - Ja((b + 272) | 0); - c = (b + 312) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - Ja((b + 328) | 0); - F[(b + 376) >> 2] = 0; - F[(b + 368) >> 2] = 0; - F[(b + 372) >> 2] = 0; - break c; - case 2: - break d; - default: - break b; - } - } - b = ka(440); - F[b >> 2] = 8336; - ma((b + 4) | 0, 0, 80); - F[(b + 96) >> 2] = 0; - F[(b + 100) >> 2] = 0; - F[(b + 92) >> 2] = -1; - F[(b + 84) >> 2] = -1; - F[(b + 88) >> 2] = -1; - F[(b + 104) >> 2] = 0; - F[(b + 108) >> 2] = 0; - F[(b + 112) >> 2] = 0; - F[(b + 116) >> 2] = 0; - F[(b + 120) >> 2] = 0; - F[(b + 124) >> 2] = 0; - F[(b + 128) >> 2] = 0; - F[(b + 132) >> 2] = 0; - F[(b + 136) >> 2] = 0; - F[(b + 140) >> 2] = 0; - F[(b + 144) >> 2] = 0; - F[(b + 148) >> 2] = 0; - F[(b + 156) >> 2] = 0; - F[(b + 160) >> 2] = 0; - F[(b + 152) >> 2] = 1065353216; - F[(b + 164) >> 2] = 0; - F[(b + 168) >> 2] = 0; - F[(b + 172) >> 2] = 0; - F[(b + 176) >> 2] = 0; - F[(b + 180) >> 2] = 0; - F[(b + 184) >> 2] = 0; - F[(b + 188) >> 2] = 0; - F[(b + 192) >> 2] = 0; - F[(b + 196) >> 2] = 0; - F[(b + 200) >> 2] = 0; - F[(b + 204) >> 2] = 0; - F[(b + 208) >> 2] = 0; - F[(b + 212) >> 2] = -1; - F[(b + 216) >> 2] = 0; - F[(b + 220) >> 2] = 0; - F[(b + 224) >> 2] = 0; - Ja((b + 232) | 0); - Ja((b + 272) | 0); - c = (b + 312) | 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - Ja((b + 328) | 0); - F[(b + 392) >> 2] = 0; - F[(b + 396) >> 2] = 0; - F[(b + 384) >> 2] = 0; - F[(b + 388) >> 2] = 0; - F[(b + 376) >> 2] = 0; - F[(b + 380) >> 2] = 0; - F[(b + 368) >> 2] = 0; - F[(b + 372) >> 2] = 0; - F[(b + 416) >> 2] = 0; - F[(b + 420) >> 2] = 0; - F[(b + 408) >> 2] = 2; - F[(b + 412) >> 2] = 7; - F[(b + 400) >> 2] = -1; - F[(b + 404) >> 2] = -1; - F[(b + 424) >> 2] = 0; - F[(b + 428) >> 2] = 0; - F[(b + 432) >> 2] = 0; - F[(b + 436) >> 2] = 0; - } - c = F[(a + 48) >> 2]; - F[(a + 48) >> 2] = b; - if (!c) { - break a; - } - $[F[(F[c >> 2] + 4) >> 2]](c); - } - b = F[(a + 48) >> 2]; - if (b) { - break a; - } - return 0; - } - a = $[F[(F[b >> 2] + 8) >> 2]](b, a) | 0; - } else { - a = 0; - } - return a | 0; - } - function ei(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - g = (Z - 32) | 0; - Z = g; - F[(a + 68) >> 2] = f; - d = F[(a + 56) >> 2]; - e = F[d >> 2]; - d = F[(d + 4) >> 2]; - F[(g + 24) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - a: { - d = (d - e) | 0; - if ((d | 0) > 0) { - m = (a + 60) | 0; - d = (d >>> 2) | 0; - n = d >>> 0 <= 1 ? 1 : d; - o = (a + 112) | 0; - while (1) { - e = F[(a + 56) >> 2]; - d = F[e >> 2]; - if (((F[(e + 4) >> 2] - d) >> 2) >>> 0 <= j >>> 0) { - break a; - } - Mb(m, F[(d + (j << 2)) >> 2], (g + 16) | 0); - i = F[(g + 20) >> 2]; - d = i >> 31; - h = F[(g + 16) >> 2]; - e = h >> 31; - f = ((d ^ i) - d + ((e ^ h) - e)) | 0; - k = F[(g + 24) >> 2]; - d = k >> 31; - e = ((d ^ k) - d) | 0; - d = 0; - l = e; - e = (e + f) | 0; - d = l >>> 0 > e >>> 0 ? 1 : d; - b: { - if (!(d | e)) { - F[(g + 16) >> 2] = F[(a + 108) >> 2]; - break b; - } - f = F[(a + 108) >> 2]; - l = f >> 31; - h = li(ki(f, l, h, h >> 31), _, e, d); - F[(g + 16) >> 2] = h; - d = li(ki(f, l, i, i >> 31), _, e, d); - F[(g + 20) >> 2] = d; - e = d; - d = d >> 31; - e = ((e ^ d) - d) | 0; - d = h >> 31; - d = (e + (((d ^ h) - d) | 0)) | 0; - if ((k | 0) >= 0) { - F[(g + 24) >> 2] = f - d; - break b; - } - F[(g + 24) >> 2] = d - f; - } - d = wa(o); - f = F[(g + 16) >> 2]; - c: { - if (d) { - F[(g + 24) >> 2] = 0 - F[(g + 24) >> 2]; - e = (0 - F[(g + 20) >> 2]) | 0; - F[(g + 20) >> 2] = e; - f = (0 - f) | 0; - F[(g + 16) >> 2] = f; - break c; - } - e = F[(g + 20) >> 2]; - } - d: { - if ((f | 0) >= 0) { - f = F[(a + 108) >> 2]; - d = (f + F[(g + 24) >> 2]) | 0; - f = (e + f) | 0; - break d; - } - e: { - if ((e | 0) < 0) { - d = F[(g + 24) >> 2]; - f = d >> 31; - f = ((d ^ f) - f) | 0; - break e; - } - d = F[(g + 24) >> 2]; - f = d >> 31; - f = (F[(a + 100) >> 2] + ((f - (d ^ f)) | 0)) | 0; - } - if ((d | 0) < 0) { - d = e >> 31; - d = ((d ^ e) - d) | 0; - break d; - } - d = e >> 31; - d = (F[(a + 100) >> 2] + ((d - (d ^ e)) | 0)) | 0; - } - e = F[(a + 100) >> 2]; - f: { - if (!(d | f)) { - d = e; - f = d; - break f; - } - if (!(((d | 0) != (e | 0)) | f)) { - f = d; - break f; - } - if (!(((e | 0) != (f | 0)) | d)) { - d = f; - break f; - } - g: { - if (f) { - break g; - } - i = F[(a + 108) >> 2]; - if ((i | 0) >= (d | 0)) { - break g; - } - d = ((i << 1) - d) | 0; - f = 0; - break f; - } - h: { - if ((e | 0) != (f | 0)) { - break h; - } - i = F[(a + 108) >> 2]; - if ((i | 0) <= (d | 0)) { - break h; - } - d = ((i << 1) - d) | 0; - break f; - } - i: { - if ((d | 0) != (e | 0)) { - break i; - } - e = F[(a + 108) >> 2]; - if ((e | 0) <= (f | 0)) { - break i; - } - f = ((e << 1) - f) | 0; - break f; - } - if (d) { - break f; - } - d = 0; - e = F[(a + 108) >> 2]; - if ((e | 0) >= (f | 0)) { - break f; - } - f = ((e << 1) - f) | 0; - } - F[(g + 12) >> 2] = d; - F[(g + 8) >> 2] = f; - j: { - if (F[(a + 8) >> 2] <= 0) { - break j; - } - i = F[(a + 32) >> 2]; - f = 0; - while (1) { - d = f << 2; - e = F[(d + ((g + 8) | 0)) >> 2]; - h = F[(a + 16) >> 2]; - k: { - if ((e | 0) > (h | 0)) { - F[(d + i) >> 2] = h; - break k; - } - d = (d + i) | 0; - h = F[(a + 12) >> 2]; - if ((h | 0) > (e | 0)) { - F[d >> 2] = h; - break k; - } - F[d >> 2] = e; - } - f = (f + 1) | 0; - e = F[(a + 8) >> 2]; - if ((f | 0) < (e | 0)) { - continue; - } - break; - } - d = 0; - if ((e | 0) <= 0) { - break j; - } - e = j << 3; - h = (e + c) | 0; - k = (b + e) | 0; - while (1) { - f = d << 2; - e = (f + h) | 0; - f = (F[(f + k) >> 2] + F[(f + i) >> 2]) | 0; - F[e >> 2] = f; - l: { - if ((f | 0) > F[(a + 16) >> 2]) { - f = (f - F[(a + 20) >> 2]) | 0; - } else { - if ((f | 0) >= F[(a + 12) >> 2]) { - break l; - } - f = (f + F[(a + 20) >> 2]) | 0; - } - F[e >> 2] = f; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - j = (j + 1) | 0; - if ((n | 0) != (j | 0)) { - continue; - } - break; - } - } - Z = (g + 32) | 0; - return 1; - } - ta(); - v(); - } - function Vh(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - g = (Z - 32) | 0; - Z = g; - F[(a + 68) >> 2] = f; - d = F[(a + 56) >> 2]; - e = F[d >> 2]; - d = F[(d + 4) >> 2]; - F[(g + 24) >> 2] = 0; - F[(g + 16) >> 2] = 0; - F[(g + 20) >> 2] = 0; - a: { - d = (d - e) | 0; - if ((d | 0) > 0) { - m = (a + 60) | 0; - d = (d >>> 2) | 0; - n = d >>> 0 <= 1 ? 1 : d; - o = (a + 112) | 0; - while (1) { - e = F[(a + 56) >> 2]; - d = F[e >> 2]; - if (((F[(e + 4) >> 2] - d) >> 2) >>> 0 <= j >>> 0) { - break a; - } - Kb(m, F[(d + (j << 2)) >> 2], (g + 16) | 0); - i = F[(g + 20) >> 2]; - d = i >> 31; - h = F[(g + 16) >> 2]; - e = h >> 31; - f = ((d ^ i) - d + ((e ^ h) - e)) | 0; - k = F[(g + 24) >> 2]; - d = k >> 31; - e = ((d ^ k) - d) | 0; - d = 0; - l = e; - e = (e + f) | 0; - d = l >>> 0 > e >>> 0 ? 1 : d; - b: { - if (!(d | e)) { - F[(g + 16) >> 2] = F[(a + 108) >> 2]; - break b; - } - f = F[(a + 108) >> 2]; - l = f >> 31; - h = li(ki(f, l, h, h >> 31), _, e, d); - F[(g + 16) >> 2] = h; - d = li(ki(f, l, i, i >> 31), _, e, d); - F[(g + 20) >> 2] = d; - e = d; - d = d >> 31; - e = ((e ^ d) - d) | 0; - d = h >> 31; - d = (e + (((d ^ h) - d) | 0)) | 0; - if ((k | 0) >= 0) { - F[(g + 24) >> 2] = f - d; - break b; - } - F[(g + 24) >> 2] = d - f; - } - d = wa(o); - f = F[(g + 16) >> 2]; - c: { - if (d) { - F[(g + 24) >> 2] = 0 - F[(g + 24) >> 2]; - e = (0 - F[(g + 20) >> 2]) | 0; - F[(g + 20) >> 2] = e; - f = (0 - f) | 0; - F[(g + 16) >> 2] = f; - break c; - } - e = F[(g + 20) >> 2]; - } - d: { - if ((f | 0) >= 0) { - f = F[(a + 108) >> 2]; - d = (f + F[(g + 24) >> 2]) | 0; - f = (e + f) | 0; - break d; - } - e: { - if ((e | 0) < 0) { - d = F[(g + 24) >> 2]; - f = d >> 31; - f = ((d ^ f) - f) | 0; - break e; - } - d = F[(g + 24) >> 2]; - f = d >> 31; - f = (F[(a + 100) >> 2] + ((f - (d ^ f)) | 0)) | 0; - } - if ((d | 0) < 0) { - d = e >> 31; - d = ((d ^ e) - d) | 0; - break d; - } - d = e >> 31; - d = (F[(a + 100) >> 2] + ((d - (d ^ e)) | 0)) | 0; - } - e = F[(a + 100) >> 2]; - f: { - if (!(d | f)) { - d = e; - f = d; - break f; - } - if (!(((d | 0) != (e | 0)) | f)) { - f = d; - break f; - } - if (!(((e | 0) != (f | 0)) | d)) { - d = f; - break f; - } - g: { - if (f) { - break g; - } - i = F[(a + 108) >> 2]; - if ((i | 0) >= (d | 0)) { - break g; - } - d = ((i << 1) - d) | 0; - f = 0; - break f; - } - h: { - if ((e | 0) != (f | 0)) { - break h; - } - i = F[(a + 108) >> 2]; - if ((i | 0) <= (d | 0)) { - break h; - } - d = ((i << 1) - d) | 0; - break f; - } - i: { - if ((d | 0) != (e | 0)) { - break i; - } - e = F[(a + 108) >> 2]; - if ((e | 0) <= (f | 0)) { - break i; - } - f = ((e << 1) - f) | 0; - break f; - } - if (d) { - break f; - } - d = 0; - e = F[(a + 108) >> 2]; - if ((e | 0) >= (f | 0)) { - break f; - } - f = ((e << 1) - f) | 0; - } - F[(g + 12) >> 2] = d; - F[(g + 8) >> 2] = f; - j: { - if (F[(a + 8) >> 2] <= 0) { - break j; - } - i = F[(a + 32) >> 2]; - f = 0; - while (1) { - d = f << 2; - e = F[(d + ((g + 8) | 0)) >> 2]; - h = F[(a + 16) >> 2]; - k: { - if ((e | 0) > (h | 0)) { - F[(d + i) >> 2] = h; - break k; - } - d = (d + i) | 0; - h = F[(a + 12) >> 2]; - if ((h | 0) > (e | 0)) { - F[d >> 2] = h; - break k; - } - F[d >> 2] = e; - } - f = (f + 1) | 0; - e = F[(a + 8) >> 2]; - if ((f | 0) < (e | 0)) { - continue; - } - break; - } - d = 0; - if ((e | 0) <= 0) { - break j; - } - e = j << 3; - h = (e + c) | 0; - k = (b + e) | 0; - while (1) { - f = d << 2; - e = (f + h) | 0; - f = (F[(f + k) >> 2] + F[(f + i) >> 2]) | 0; - F[e >> 2] = f; - l: { - if ((f | 0) > F[(a + 16) >> 2]) { - f = (f - F[(a + 20) >> 2]) | 0; - } else { - if ((f | 0) >= F[(a + 12) >> 2]) { - break l; - } - f = (f + F[(a + 20) >> 2]) | 0; - } - F[e >> 2] = f; - } - d = (d + 1) | 0; - if ((d | 0) < F[(a + 8) >> 2]) { - continue; - } - break; - } - } - j = (j + 1) | 0; - if ((n | 0) != (j | 0)) { - continue; - } - break; - } - } - Z = (g + 32) | 0; - return 1; - } - ta(); - v(); - } - function $a(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - h = (Z - 32) | 0; - Z = h; - a: { - b: { - if ((F[(a + 8) >> 2] << 5) >>> 0 >= b >>> 0) { - break b; - } - if ((b | 0) < 0) { - break a; - } - b = ((((b - 1) >>> 5) | 0) + 1) | 0; - c = ka(b << 2); - F[(h + 24) >> 2] = b; - F[(h + 20) >> 2] = 0; - F[(h + 16) >> 2] = c; - b = F[a >> 2]; - F[(h + 12) >> 2] = 0; - F[(h + 8) >> 2] = b; - c = F[(a + 4) >> 2]; - F[(h + 4) >> 2] = c & 31; - F[h >> 2] = b + ((c >>> 3) & 536870908); - e = (Z - 32) | 0; - Z = e; - i = F[(h + 4) >> 2]; - g = F[(h + 12) >> 2]; - j = F[h >> 2]; - d = F[(h + 8) >> 2]; - b = (((i - g) | 0) + ((j - d) << 3)) | 0; - f = F[(h + 20) >> 2]; - c = (b + f) | 0; - F[(h + 20) >> 2] = c; - if (!(((c - 1) ^ (f - 1)) >>> 0 < 32 ? f : 0)) { - F[ - (F[(h + 16) >> 2] + - ((c >>> 0 >= 33 ? ((c - 1) >>> 5) | 0 : 0) << 2)) >> - 2 - ] = 0; - } - c = (F[(h + 16) >> 2] + ((f >>> 3) & 536870908)) | 0; - f = f & 31; - c: { - if ((f | 0) == (g | 0)) { - if ((b | 0) <= 0) { - break c; - } - if (g) { - i = (32 - g) | 0; - f = (b | 0) < (i | 0) ? b : i; - i = (-1 << g) & (-1 >>> (i - f)); - F[c >> 2] = (F[c >> 2] & (i ^ -1)) | (i & F[d >> 2]); - d = (d + 4) | 0; - c = ((((g + f) >>> 3) & 536870908) + c) | 0; - b = (b - f) | 0; - } - g = ((b | 0) / 32) | 0; - if ((b + 31) >>> 0 >= 63) { - pa(c, d, g << 2); - } - b = (b - (g << 5)) | 0; - if ((b | 0) <= 0) { - break c; - } - f = c; - c = g << 2; - g = (f + c) | 0; - b = (-1 >>> (32 - b)) | 0; - F[g >> 2] = - (F[g >> 2] & (b ^ -1)) | (b & F[(c + d) >> 2]); - break c; - } - F[(e + 28) >> 2] = g; - F[(e + 24) >> 2] = d; - F[(e + 20) >> 2] = i; - F[(e + 16) >> 2] = j; - F[(e + 12) >> 2] = f; - F[(e + 8) >> 2] = c; - b = F[(e + 28) >> 2]; - c = F[(e + 24) >> 2]; - g = - (((F[(e + 20) >> 2] - b) | 0) + - ((F[(e + 16) >> 2] - c) << 3)) | - 0; - d: { - if ((g | 0) <= 0) { - b = F[(e + 12) >> 2]; - d = F[(e + 8) >> 2]; - break d; - } - e: { - if (!b) { - b = F[(e + 12) >> 2]; - break e; - } - d = F[(e + 12) >> 2]; - j = (32 - d) | 0; - k = (32 - b) | 0; - f = (g | 0) < (k | 0) ? g : k; - i = f >>> 0 > j >>> 0 ? j : f; - l = F[(e + 8) >> 2]; - m = F[l >> 2] & (((-1 << d) & (-1 >>> (j - i))) ^ -1); - j = F[c >> 2] & ((-1 << b) & (-1 >>> (k - f))); - F[l >> 2] = - m | - (b >>> 0 < d >>> 0 - ? j << (d - b) - : (j >>> (b - d)) | 0); - c = (d + i) | 0; - b = c & 31; - F[(e + 12) >> 2] = b; - d = (l + ((c >>> 3) & 536870908)) | 0; - F[(e + 8) >> 2] = d; - c = (f - i) | 0; - if ((c | 0) > 0) { - F[d >> 2] = - (F[d >> 2] & ((-1 >>> (32 - c)) ^ -1)) | - (j >>> (i + F[(e + 28) >> 2])); - F[(e + 12) >> 2] = c; - b = c; - } - g = (g - f) | 0; - c = (F[(e + 24) >> 2] + 4) | 0; - F[(e + 24) >> 2] = c; - } - i = -1 << b; - f = (32 - b) | 0; - if ((g | 0) >= 32) { - j = i ^ -1; - while (1) { - d = F[(e + 8) >> 2]; - c = F[c >> 2]; - F[d >> 2] = (j & F[d >> 2]) | (c << b); - F[(e + 8) >> 2] = d + 4; - F[(d + 4) >> 2] = (i & F[(d + 4) >> 2]) | (c >>> f); - c = (F[(e + 24) >> 2] + 4) | 0; - F[(e + 24) >> 2] = c; - d = g >>> 0 > 63; - g = (g - 32) | 0; - if (d) { - continue; - } - break; - } - } - d = F[(e + 8) >> 2]; - if ((g | 0) <= 0) { - break d; - } - j = f; - f = (g | 0) > (f | 0) ? f : g; - j = F[d >> 2] & ((i & (-1 >>> (j - f))) ^ -1); - i = F[c >> 2] & (-1 >>> (32 - g)); - F[d >> 2] = j | (i << b); - b = (b + f) | 0; - c = b & 31; - F[(e + 12) >> 2] = c; - d = (((b >>> 3) & 536870908) + d) | 0; - F[(e + 8) >> 2] = d; - b = (g - f) | 0; - if ((b | 0) <= 0) { - b = c; - break d; - } - F[d >> 2] = - (F[d >> 2] & ((-1 >>> (32 - b)) ^ -1)) | (i >>> f); - F[(e + 12) >> 2] = b; - } - F[(e + 4) >> 2] = b; - F[e >> 2] = d; - } - Z = (e + 32) | 0; - b = F[a >> 2]; - F[a >> 2] = F[(h + 16) >> 2]; - F[(h + 16) >> 2] = b; - c = F[(a + 4) >> 2]; - F[(a + 4) >> 2] = F[(h + 20) >> 2]; - F[(h + 20) >> 2] = c; - c = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = F[(h + 24) >> 2]; - F[(h + 24) >> 2] = c; - if (!b) { - break b; - } - ja(b); - } - Z = (h + 32) | 0; - return; - } - na(); - v(); - } - function xc(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - n = $[F[(F[a >> 2] + 44) >> 2]](a) | 0; - a: { - if ((n | 0) <= 0) { - break a; - } - i = (F[(b + 4) >> 2] - F[b >> 2]) >> 2; - e = (Z + -64) | 0; - Z = e; - f = kb(e); - d = L(F[2541], n); - cc( - f, - F[(F[(a + 8) >> 2] + 56) >> 2], - n & 255, - 5, - 0, - d, - d >> 31, - ); - f = bc(ka(96), f); - D[(f + 84) | 0] = 1; - F[(f + 72) >> 2] = F[(f + 68) >> 2]; - ac(f, i); - F[(f + 60) >> 2] = F[(F[(a + 8) >> 2] + 60) >> 2]; - d = F[(a + 16) >> 2]; - F[(a + 16) >> 2] = f; - if (d) { - xa(d); - } - Z = (e - -64) | 0; - h = F[(a + 16) >> 2]; - if (!F[(h + 80) >> 2]) { - break a; - } - j = F[F[h >> 2] >> 2]; - if (!j) { - break a; - } - m = F[(c + 12) >> 2]; - e = m; - d = F[(c + 20) >> 2]; - g = F[(c + 8) >> 2]; - k = F[(c + 16) >> 2]; - if ( - (((e | 0) <= (d | 0)) & (g >>> 0 <= k >>> 0)) | - ((d | 0) > (e | 0)) - ) { - break a; - } - l = L(i, n); - i = (j + F[(h + 48) >> 2]) | 0; - h = F[c >> 2]; - j = G[(h + k) | 0]; - e = (k + 1) | 0; - f = e ? d : (d + 1) | 0; - F[(c + 16) >> 2] = e; - F[(c + 20) >> 2] = f; - b: { - c: { - if (j) { - if (mc(l, n, c, i)) { - break c; - } - break a; - } - if ( - (((f | 0) >= (m | 0)) & (e >>> 0 >= g >>> 0)) | - ((f | 0) > (m | 0)) - ) { - break a; - } - g = G[(e + h) | 0]; - f = (k + 2) | 0; - d = f >>> 0 < 2 ? (d + 1) | 0 : d; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = F[(F[(a + 16) >> 2] + 64) >> 2]; - d = (F[(d + 4) >> 2] - F[d >> 2]) | 0; - if ((g | 0) == F[2541]) { - e = l << 2; - if (e >>> 0 > d >>> 0) { - break a; - } - g = F[(c + 8) >> 2]; - k = F[(c + 12) >> 2]; - j = F[(c + 20) >> 2]; - d = F[(c + 16) >> 2]; - f = (e + d) | 0; - j = f >>> 0 < e >>> 0 ? (j + 1) | 0 : j; - if ( - ((f >>> 0 > g >>> 0) & ((j | 0) >= (k | 0))) | - ((j | 0) > (k | 0)) - ) { - break a; - } - la(i, (d + F[c >> 2]) | 0, e); - f = F[(c + 20) >> 2]; - d = (e + F[(c + 16) >> 2]) | 0; - f = d >>> 0 < e >>> 0 ? (f + 1) | 0 : f; - F[(c + 16) >> 2] = d; - F[(c + 20) >> 2] = f; - break c; - } - if (d >>> 0 < L(g, l) >>> 0) { - break a; - } - d = F[(c + 8) >> 2]; - f = F[(c + 16) >> 2]; - e = (d - f) | 0; - m = d >>> 0 < f >>> 0; - d = F[(c + 20) >> 2]; - k = (F[(c + 12) >> 2] - ((m + d) | 0)) | 0; - m = ki(g, 0, l, 0) >>> 0 > e >>> 0; - e = _; - if ((m & ((e | 0) >= (k | 0))) | ((e | 0) > (k | 0))) { - break a; - } - e = 1; - if (!l) { - break b; - } - h = 0; - while (1) { - k = F[(c + 8) >> 2]; - j = F[(c + 12) >> 2]; - e = (f + g) | 0; - d = e >>> 0 < g >>> 0 ? (d + 1) | 0 : d; - if ( - ((e >>> 0 > k >>> 0) & ((d | 0) >= (j | 0))) | - ((d | 0) > (j | 0)) - ) { - return 0; - } - la((i + (h << 2)) | 0, (F[c >> 2] + f) | 0, g); - d = F[(c + 20) >> 2]; - f = (g + F[(c + 16) >> 2]) | 0; - d = f >>> 0 < g >>> 0 ? (d + 1) | 0 : d; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - h = (h + 1) | 0; - if ((l | 0) != (h | 0)) { - continue; - } - break; - } - } - e = 1; - if (!l) { - break b; - } - d = F[(a + 20) >> 2]; - if (d) { - e = 0; - if ($[F[(F[d >> 2] + 32) >> 2]](d) | 0) { - break b; - } - } - g = 0; - h = 0; - d: { - if ((l | 0) <= 0) { - break d; - } - if ((l | 0) != 1) { - f = l & -2; - while (1) { - e = g << 2; - d = F[(e + i) >> 2]; - F[(e + i) >> 2] = (0 - (d & 1)) ^ (d >>> 1); - d = e | 4; - e = F[(d + i) >> 2]; - F[(d + i) >> 2] = (0 - (e & 1)) ^ (e >>> 1); - g = (g + 2) | 0; - h = (h + 2) | 0; - if ((f | 0) != (h | 0)) { - continue; - } - break; - } - } - if (!(l & 1)) { - break d; - } - d = g << 2; - f = F[(d + i) >> 2]; - F[(d + i) >> 2] = (0 - (f & 1)) ^ (f >>> 1); - } - e = 0; - } - d = e; - f = F[(a + 20) >> 2]; - e: { - if (!f) { - break e; - } - if (!($[F[(F[f >> 2] + 40) >> 2]](f, c) | 0)) { - break a; - } - if (d) { - break e; - } - a = F[(a + 20) >> 2]; - if ( - !( - $[F[(F[a >> 2] + 44) >> 2]](a, i, i, l, n, F[b >> 2]) | - 0 - ) - ) { - break a; - } - } - o = 1; - } - return o | 0; - } - function Lh(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - g = (Z - 48) | 0; - Z = g; - d = F[(a + 8) >> 2]; - if ((d - 2) >>> 0 <= 28) { - F[(a + 76) >> 2] = d; - e = -1 << d; - d = (-2 - e) | 0; - F[(a + 84) >> 2] = d; - F[(a + 80) >> 2] = e ^ -1; - F[(a + 92) >> 2] = (d | 0) / 2; - J[(a + 88) >> 2] = M(2) / M(d | 0); - } - F[(a + 52) >> 2] = f; - d = F[(a + 40) >> 2]; - e = F[d >> 2]; - d = F[(d + 4) >> 2]; - F[(g + 16) >> 2] = 0; - F[(g + 8) >> 2] = 0; - F[(g + 12) >> 2] = 0; - a: { - d = (d - e) | 0; - if ((d | 0) > 0) { - m = (a + 8) | 0; - n = (a + 44) | 0; - d = (d >>> 2) | 0; - o = d >>> 0 <= 1 ? 1 : d; - p = (a + 96) | 0; - while (1) { - e = F[(a + 40) >> 2]; - d = F[e >> 2]; - if (((F[(e + 4) >> 2] - d) >> 2) >>> 0 <= j >>> 0) { - break a; - } - Mb(n, F[(d + (j << 2)) >> 2], (g + 8) | 0); - h = F[(g + 12) >> 2]; - d = h >> 31; - i = F[(g + 8) >> 2]; - e = i >> 31; - f = ((d ^ h) - d + ((e ^ i) - e)) | 0; - l = F[(g + 16) >> 2]; - d = l >> 31; - e = ((d ^ l) - d) | 0; - d = 0; - k = e; - e = (e + f) | 0; - d = k >>> 0 > e >>> 0 ? 1 : d; - b: { - if (!(d | e)) { - F[(g + 8) >> 2] = F[(a + 92) >> 2]; - break b; - } - f = F[(a + 92) >> 2]; - k = f >> 31; - i = li(ki(f, k, i, i >> 31), _, e, d); - F[(g + 8) >> 2] = i; - d = li(ki(f, k, h, h >> 31), _, e, d); - F[(g + 12) >> 2] = d; - e = d >> 31; - e = ((d ^ e) - e) | 0; - d = i >> 31; - d = (e + (((d ^ i) - d) | 0)) | 0; - if ((l | 0) >= 0) { - F[(g + 16) >> 2] = f - d; - break b; - } - F[(g + 16) >> 2] = d - f; - } - d = wa(p); - f = F[(g + 8) >> 2]; - c: { - if (d) { - F[(g + 16) >> 2] = 0 - F[(g + 16) >> 2]; - e = (0 - F[(g + 12) >> 2]) | 0; - F[(g + 12) >> 2] = e; - f = (0 - f) | 0; - F[(g + 8) >> 2] = f; - break c; - } - e = F[(g + 12) >> 2]; - } - d: { - if ((f | 0) >= 0) { - f = F[(a + 92) >> 2]; - d = (f + F[(g + 16) >> 2]) | 0; - f = (e + f) | 0; - break d; - } - e: { - if ((e | 0) < 0) { - d = F[(g + 16) >> 2]; - f = d >> 31; - f = ((d ^ f) - f) | 0; - break e; - } - d = F[(g + 16) >> 2]; - f = d >> 31; - f = (F[(a + 84) >> 2] + ((f - (d ^ f)) | 0)) | 0; - } - if ((d | 0) < 0) { - d = e >> 31; - d = ((d ^ e) - d) | 0; - break d; - } - d = e >> 31; - d = (F[(a + 84) >> 2] + ((d - (d ^ e)) | 0)) | 0; - } - e = F[(a + 84) >> 2]; - f: { - if (!(d | f)) { - d = e; - f = d; - break f; - } - if (!(((d | 0) != (e | 0)) | f)) { - f = d; - break f; - } - if (!(((e | 0) != (f | 0)) | d)) { - d = f; - break f; - } - g: { - if (f) { - break g; - } - h = F[(a + 92) >> 2]; - if ((h | 0) >= (d | 0)) { - break g; - } - d = ((h << 1) - d) | 0; - f = 0; - break f; - } - h: { - if ((e | 0) != (f | 0)) { - break h; - } - h = F[(a + 92) >> 2]; - if ((h | 0) <= (d | 0)) { - break h; - } - d = ((h << 1) - d) | 0; - break f; - } - i: { - if ((d | 0) != (e | 0)) { - break i; - } - e = F[(a + 92) >> 2]; - if ((e | 0) <= (f | 0)) { - break i; - } - f = ((e << 1) - f) | 0; - break f; - } - if (d) { - break f; - } - d = 0; - e = F[(a + 92) >> 2]; - if ((e | 0) >= (f | 0)) { - break f; - } - f = ((e << 1) - f) | 0; - } - e = j << 3; - h = (e + b) | 0; - i = F[h >> 2]; - h = F[(h + 4) >> 2]; - F[(g + 36) >> 2] = d; - F[(g + 32) >> 2] = f; - F[(g + 24) >> 2] = i; - F[(g + 28) >> 2] = h; - Jb((g + 40) | 0, m, (g + 32) | 0, (g + 24) | 0); - d = (c + e) | 0; - F[d >> 2] = F[(g + 40) >> 2]; - F[(d + 4) >> 2] = F[(g + 44) >> 2]; - j = (j + 1) | 0; - if ((o | 0) != (j | 0)) { - continue; - } - break; - } - } - Z = (g + 48) | 0; - return 1; - } - ta(); - v(); - } - function Hh(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - g = (Z - 48) | 0; - Z = g; - d = F[(a + 8) >> 2]; - if ((d - 2) >>> 0 <= 28) { - F[(a + 76) >> 2] = d; - e = -1 << d; - d = (-2 - e) | 0; - F[(a + 84) >> 2] = d; - F[(a + 80) >> 2] = e ^ -1; - F[(a + 92) >> 2] = (d | 0) / 2; - J[(a + 88) >> 2] = M(2) / M(d | 0); - } - F[(a + 52) >> 2] = f; - d = F[(a + 40) >> 2]; - e = F[d >> 2]; - d = F[(d + 4) >> 2]; - F[(g + 16) >> 2] = 0; - F[(g + 8) >> 2] = 0; - F[(g + 12) >> 2] = 0; - a: { - d = (d - e) | 0; - if ((d | 0) > 0) { - m = (a + 8) | 0; - n = (a + 44) | 0; - d = (d >>> 2) | 0; - o = d >>> 0 <= 1 ? 1 : d; - p = (a + 96) | 0; - while (1) { - e = F[(a + 40) >> 2]; - d = F[e >> 2]; - if (((F[(e + 4) >> 2] - d) >> 2) >>> 0 <= j >>> 0) { - break a; - } - Kb(n, F[(d + (j << 2)) >> 2], (g + 8) | 0); - h = F[(g + 12) >> 2]; - d = h >> 31; - i = F[(g + 8) >> 2]; - e = i >> 31; - f = ((d ^ h) - d + ((e ^ i) - e)) | 0; - l = F[(g + 16) >> 2]; - d = l >> 31; - e = ((d ^ l) - d) | 0; - d = 0; - k = e; - e = (e + f) | 0; - d = k >>> 0 > e >>> 0 ? 1 : d; - b: { - if (!(d | e)) { - F[(g + 8) >> 2] = F[(a + 92) >> 2]; - break b; - } - f = F[(a + 92) >> 2]; - k = f >> 31; - i = li(ki(f, k, i, i >> 31), _, e, d); - F[(g + 8) >> 2] = i; - d = li(ki(f, k, h, h >> 31), _, e, d); - F[(g + 12) >> 2] = d; - e = d >> 31; - e = ((d ^ e) - e) | 0; - d = i >> 31; - d = (e + (((d ^ i) - d) | 0)) | 0; - if ((l | 0) >= 0) { - F[(g + 16) >> 2] = f - d; - break b; - } - F[(g + 16) >> 2] = d - f; - } - d = wa(p); - f = F[(g + 8) >> 2]; - c: { - if (d) { - F[(g + 16) >> 2] = 0 - F[(g + 16) >> 2]; - e = (0 - F[(g + 12) >> 2]) | 0; - F[(g + 12) >> 2] = e; - f = (0 - f) | 0; - F[(g + 8) >> 2] = f; - break c; - } - e = F[(g + 12) >> 2]; - } - d: { - if ((f | 0) >= 0) { - f = F[(a + 92) >> 2]; - d = (f + F[(g + 16) >> 2]) | 0; - f = (e + f) | 0; - break d; - } - e: { - if ((e | 0) < 0) { - d = F[(g + 16) >> 2]; - f = d >> 31; - f = ((d ^ f) - f) | 0; - break e; - } - d = F[(g + 16) >> 2]; - f = d >> 31; - f = (F[(a + 84) >> 2] + ((f - (d ^ f)) | 0)) | 0; - } - if ((d | 0) < 0) { - d = e >> 31; - d = ((d ^ e) - d) | 0; - break d; - } - d = e >> 31; - d = (F[(a + 84) >> 2] + ((d - (d ^ e)) | 0)) | 0; - } - e = F[(a + 84) >> 2]; - f: { - if (!(d | f)) { - d = e; - f = d; - break f; - } - if (!(((d | 0) != (e | 0)) | f)) { - f = d; - break f; - } - if (!(((e | 0) != (f | 0)) | d)) { - d = f; - break f; - } - g: { - if (f) { - break g; - } - h = F[(a + 92) >> 2]; - if ((h | 0) >= (d | 0)) { - break g; - } - d = ((h << 1) - d) | 0; - f = 0; - break f; - } - h: { - if ((e | 0) != (f | 0)) { - break h; - } - h = F[(a + 92) >> 2]; - if ((h | 0) <= (d | 0)) { - break h; - } - d = ((h << 1) - d) | 0; - break f; - } - i: { - if ((d | 0) != (e | 0)) { - break i; - } - e = F[(a + 92) >> 2]; - if ((e | 0) <= (f | 0)) { - break i; - } - f = ((e << 1) - f) | 0; - break f; - } - if (d) { - break f; - } - d = 0; - e = F[(a + 92) >> 2]; - if ((e | 0) >= (f | 0)) { - break f; - } - f = ((e << 1) - f) | 0; - } - e = j << 3; - h = (e + b) | 0; - i = F[h >> 2]; - h = F[(h + 4) >> 2]; - F[(g + 36) >> 2] = d; - F[(g + 32) >> 2] = f; - F[(g + 24) >> 2] = i; - F[(g + 28) >> 2] = h; - Jb((g + 40) | 0, m, (g + 32) | 0, (g + 24) | 0); - d = (c + e) | 0; - F[d >> 2] = F[(g + 40) >> 2]; - F[(d + 4) >> 2] = F[(g + 44) >> 2]; - j = (j + 1) | 0; - if ((o | 0) != (j | 0)) { - continue; - } - break; - } - } - Z = (g + 48) | 0; - return 1; - } - ta(); - v(); - } - function Nd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - a: { - if (!H[(b + 38) >> 1]) { - break a; - } - if (!Ta(1, (a + 12) | 0, b)) { - break a; - } - d = F[(b + 8) >> 2]; - e = F[(b + 16) >> 2]; - g = (d - e) | 0; - f = F[(a + 12) >> 2]; - d = - (F[(b + 12) >> 2] - - ((F[(b + 20) >> 2] + (d >>> 0 < e >>> 0)) | 0)) | - 0; - if ( - ((g >>> 0 < (f >>> 6) >>> 0) & ((d | 0) <= 0)) | - ((d | 0) < 0) - ) { - break a; - } - d = F[a >> 2]; - c = (F[(a + 4) >> 2] - d) >> 2; - b: { - if (c >>> 0 < f >>> 0) { - qa(a, (f - c) | 0); - f = F[(a + 12) >> 2]; - break b; - } - if (c >>> 0 <= f >>> 0) { - break b; - } - F[(a + 4) >> 2] = d + (f << 2); - } - if (!f) { - return 1; - } - d = F[(b + 16) >> 2]; - c = F[(b + 20) >> 2]; - l = F[a >> 2]; - j = F[(b + 8) >> 2]; - i = F[(b + 12) >> 2]; - g = 0; - while (1) { - if ( - (((c | 0) >= (i | 0)) & (d >>> 0 >= j >>> 0)) | - ((c | 0) > (i | 0)) - ) { - return 0; - } - m = F[b >> 2]; - k = G[(m + d) | 0]; - d = (d + 1) | 0; - c = d ? c : (c + 1) | 0; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = c; - e = (k >>> 2) | 0; - h = 0; - c: { - d: { - e: { - f: { - n = k & 3; - switch (n | 0) { - case 3: - break f; - case 0: - break d; - default: - break e; - } - } - e = (e + g) | 0; - if (e >>> 0 >= f >>> 0) { - return 0; - } - ma((l + (g << 2)) | 0, 0, ((k & 252) + 4) | 0); - g = e; - break c; - } - while (1) { - if (((d | 0) == (j | 0)) & ((c | 0) == (i | 0))) { - break a; - } - f = G[(d + m) | 0]; - d = (d + 1) | 0; - c = d ? c : (c + 1) | 0; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = c; - e = (f << ((h << 3) | 6)) | e; - h = (h + 1) | 0; - if ((n | 0) != (h | 0)) { - continue; - } - break; - } - } - F[(l + (g << 2)) >> 2] = e; - } - f = F[(a + 12) >> 2]; - g = (g + 1) | 0; - if (f >>> 0 > g >>> 0) { - continue; - } - break; - } - b = (a + 16) | 0; - j = F[a >> 2]; - d = F[(a + 16) >> 2]; - c = (F[(a + 20) >> 2] - d) | 0; - g: { - if (c >>> 0 <= 16383) { - qa(b, (4096 - ((c >>> 2) | 0)) | 0); - break g; - } - if ((c | 0) == 16384) { - break g; - } - F[(a + 20) >> 2] = d + 16384; - } - c = (a + 28) | 0; - g = F[c >> 2]; - d = (F[(a + 32) >> 2] - g) >> 3; - h: { - if (d >>> 0 < f >>> 0) { - _a(c, (f - d) | 0); - g = F[c >> 2]; - break h; - } - if (d >>> 0 > f >>> 0) { - F[(a + 32) >> 2] = (f << 3) + g; - } - if (!f) { - break a; - } - } - d = F[b >> 2]; - b = 0; - a = 0; - while (1) { - c = (j + (b << 2)) | 0; - h = F[c >> 2]; - e = a; - i = ((b << 3) + g) | 0; - F[(i + 4) >> 2] = a; - F[i >> 2] = h; - c = F[c >> 2]; - a = (c + a) | 0; - if (a >>> 0 > 4096) { - break a; - } - i: { - if (a >>> 0 <= e >>> 0) { - break i; - } - h = 0; - i = c & 7; - if (i) { - while (1) { - F[(d + (e << 2)) >> 2] = b; - e = (e + 1) | 0; - h = (h + 1) | 0; - if ((i | 0) != (h | 0)) { - continue; - } - break; - } - } - if ((c - 1) >>> 0 <= 6) { - break i; - } - while (1) { - c = (d + (e << 2)) | 0; - F[c >> 2] = b; - F[(c + 28) >> 2] = b; - F[(c + 24) >> 2] = b; - F[(c + 20) >> 2] = b; - F[(c + 16) >> 2] = b; - F[(c + 12) >> 2] = b; - F[(c + 8) >> 2] = b; - F[(c + 4) >> 2] = b; - e = (e + 8) | 0; - if ((e | 0) != (a | 0)) { - continue; - } - break; - } - } - b = (b + 1) | 0; - if ((f | 0) != (b | 0)) { - continue; - } - break; - } - o = (a | 0) == 4096; - } - return o; - } - function qf(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0; - f = (Z - 32) | 0; - Z = f; - e = (f + 8) | 0; - c = (Z - 80) | 0; - Z = c; - a = F[(b + 36) >> 2]; - F[(c + 72) >> 2] = F[(b + 32) >> 2]; - F[(c + 76) >> 2] = a; - d = F[(b + 28) >> 2]; - a = (c - -64) | 0; - F[a >> 2] = F[(b + 24) >> 2]; - F[(a + 4) >> 2] = d; - a = F[(b + 20) >> 2]; - F[(c + 56) >> 2] = F[(b + 16) >> 2]; - F[(c + 60) >> 2] = a; - a = F[(b + 12) >> 2]; - F[(c + 48) >> 2] = F[(b + 8) >> 2]; - F[(c + 52) >> 2] = a; - a = F[(b + 4) >> 2]; - F[(c + 40) >> 2] = F[b >> 2]; - F[(c + 44) >> 2] = a; - jc((c + 8) | 0, (c + 40) | 0, (c + 24) | 0); - a = F[(c + 8) >> 2]; - a: { - if (a) { - F[e >> 2] = a; - a = (e + 4) | 0; - if (D[(c + 23) | 0] >= 0) { - b = (c + 8) | 4; - e = F[(b + 4) >> 2]; - F[a >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = e; - F[(a + 8) >> 2] = F[(b + 8) >> 2]; - break a; - } - ra(a, F[(c + 12) >> 2], F[(c + 16) >> 2]); - if (D[(c + 23) | 0] >= 0) { - break a; - } - ja(F[(c + 12) >> 2]); - break a; - } - if (D[(c + 23) | 0] < 0) { - ja(F[(c + 12) >> 2]); - } - a = G[(c + 31) | 0]; - if (a >>> 0 >= 2) { - b = ka(32); - D[(b + 26) | 0] = 0; - a = G[1475] | (G[1476] << 8); - D[(b + 24) | 0] = a; - D[(b + 25) | 0] = a >>> 8; - a = - G[1471] | - (G[1472] << 8) | - ((G[1473] << 16) | (G[1474] << 24)); - d = - G[1467] | - (G[1468] << 8) | - ((G[1469] << 16) | (G[1470] << 24)); - D[(b + 16) | 0] = d; - D[(b + 17) | 0] = d >>> 8; - D[(b + 18) | 0] = d >>> 16; - D[(b + 19) | 0] = d >>> 24; - D[(b + 20) | 0] = a; - D[(b + 21) | 0] = a >>> 8; - D[(b + 22) | 0] = a >>> 16; - D[(b + 23) | 0] = a >>> 24; - a = - G[1463] | - (G[1464] << 8) | - ((G[1465] << 16) | (G[1466] << 24)); - d = - G[1459] | - (G[1460] << 8) | - ((G[1461] << 16) | (G[1462] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = a; - D[(b + 13) | 0] = a >>> 8; - D[(b + 14) | 0] = a >>> 16; - D[(b + 15) | 0] = a >>> 24; - a = - G[1455] | - (G[1456] << 8) | - ((G[1457] << 16) | (G[1458] << 24)); - d = - G[1451] | - (G[1452] << 8) | - ((G[1453] << 16) | (G[1454] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = a; - D[(b + 5) | 0] = a >>> 8; - D[(b + 6) | 0] = a >>> 16; - D[(b + 7) | 0] = a >>> 24; - F[(c + 8) >> 2] = -1; - a = (c + 8) | 4; - ra(a, b, 26); - d = D[(c + 23) | 0]; - F[e >> 2] = F[(c + 8) >> 2]; - e = (e + 4) | 0; - if ((d | 0) >= 0) { - d = F[(a + 4) >> 2]; - F[e >> 2] = F[a >> 2]; - F[(e + 4) >> 2] = d; - F[(e + 8) >> 2] = F[(a + 8) >> 2]; - ja(b); - break a; - } - ra(e, F[(c + 12) >> 2], F[(c + 16) >> 2]); - if (D[(c + 23) | 0] < 0) { - ja(F[(c + 12) >> 2]); - } - ja(b); - break a; - } - F[e >> 2] = 0; - F[(e + 4) >> 2] = 0; - F[(e + 16) >> 2] = a; - F[(e + 8) >> 2] = 0; - F[(e + 12) >> 2] = 0; - } - Z = (c + 80) | 0; - a = F[(f + 24) >> 2]; - if (D[(f + 23) | 0] < 0) { - ja(F[(f + 12) >> 2]); - } - Z = (f + 32) | 0; - return a | 0; - } - function Ph(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - e = (Z - 32) | 0; - Z = e; - a: { - if ((c | 0) != 3) { - break a; - } - c = F[(a + 4) >> 2]; - f = F[(a + 12) >> 2]; - F[(e + 24) >> 2] = -1; - F[(e + 16) >> 2] = -1; - F[(e + 20) >> 2] = 1065353216; - F[(e + 8) >> 2] = -1; - F[(e + 12) >> 2] = -1; - if ((b | 0) == -2) { - break a; - } - i = F[(F[(F[(c + 4) >> 2] + 8) >> 2] + (f << 2)) >> 2]; - if (($[F[(F[c >> 2] + 8) >> 2]](c) | 0) == 1) { - h = F[(F[(F[(c + 4) >> 2] + 8) >> 2] + (f << 2)) >> 2]; - b: { - if ( - (($[F[(F[c >> 2] + 8) >> 2]](c) | 0) != 1) | - ((b - 1) >>> 0 > 5) - ) { - break b; - } - g = $[F[(F[c >> 2] + 36) >> 2]](c) | 0; - a = $[F[(F[c >> 2] + 44) >> 2]](c, f) | 0; - if (!g | !a) { - break b; - } - f = $[F[(F[c >> 2] + 40) >> 2]](c, f) | 0; - c: { - if (f) { - if ((b | 0) != 6) { - break b; - } - b = F[(c + 44) >> 2]; - d = ka(112); - F[(d + 4) >> 2] = h; - c = F[(e + 12) >> 2]; - F[(d + 8) >> 2] = F[(e + 8) >> 2]; - F[(d + 12) >> 2] = c; - c = F[(e + 20) >> 2]; - F[(d + 16) >> 2] = F[(e + 16) >> 2]; - F[(d + 20) >> 2] = c; - F[(d + 24) >> 2] = F[(e + 24) >> 2]; - F[(d + 40) >> 2] = a; - c = (a + 12) | 0; - F[(d + 36) >> 2] = c; - F[(d + 32) >> 2] = f; - F[(d + 28) >> 2] = b; - F[(d + 68) >> 2] = a; - F[(d - -64) >> 2] = c; - F[(d + 60) >> 2] = f; - F[(d + 56) >> 2] = b; - F[(d + 48) >> 2] = 0; - F[(d + 52) >> 2] = 0; - F[d >> 2] = 5928; - F[(d + 88) >> 2] = 1065353216; - F[(d + 92) >> 2] = -1; - F[(d + 80) >> 2] = -1; - F[(d + 84) >> 2] = -1; - F[(d + 72) >> 2] = 1; - F[(d + 76) >> 2] = -1; - F[(d + 44) >> 2] = 6492; - a = (d + 96) | 0; - break c; - } - if ((b | 0) != 6) { - break b; - } - b = F[(c + 44) >> 2]; - d = ka(112); - F[(d + 4) >> 2] = h; - c = F[(e + 12) >> 2]; - F[(d + 8) >> 2] = F[(e + 8) >> 2]; - F[(d + 12) >> 2] = c; - c = F[(e + 20) >> 2]; - F[(d + 16) >> 2] = F[(e + 16) >> 2]; - F[(d + 20) >> 2] = c; - F[(d + 24) >> 2] = F[(e + 24) >> 2]; - F[(d + 40) >> 2] = a; - c = (a + 12) | 0; - F[(d + 36) >> 2] = c; - F[(d + 32) >> 2] = g; - F[(d + 28) >> 2] = b; - F[(d + 68) >> 2] = a; - F[(d - -64) >> 2] = c; - F[(d + 60) >> 2] = g; - F[(d + 56) >> 2] = b; - F[(d + 48) >> 2] = 0; - F[(d + 52) >> 2] = 0; - F[d >> 2] = 6932; - F[(d + 88) >> 2] = 1065353216; - F[(d + 92) >> 2] = -1; - F[(d + 80) >> 2] = -1; - F[(d + 84) >> 2] = -1; - F[(d + 72) >> 2] = 1; - F[(d + 76) >> 2] = -1; - F[(d + 44) >> 2] = 7352; - a = (d + 96) | 0; - } - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - D[(a + 5) | 0] = 0; - D[(a + 6) | 0] = 0; - D[(a + 7) | 0] = 0; - D[(a + 8) | 0] = 0; - D[(a + 9) | 0] = 0; - D[(a + 10) | 0] = 0; - D[(a + 11) | 0] = 0; - D[(a + 12) | 0] = 0; - } - if (d) { - break a; - } - } - d = ka(28); - F[(d + 4) >> 2] = i; - a = F[(e + 12) >> 2]; - F[(d + 8) >> 2] = F[(e + 8) >> 2]; - F[(d + 12) >> 2] = a; - a = F[(e + 20) >> 2]; - F[(d + 16) >> 2] = F[(e + 16) >> 2]; - F[(d + 20) >> 2] = a; - F[(d + 24) >> 2] = F[(e + 24) >> 2]; - F[d >> 2] = 7764; - } - Z = (e + 32) | 0; - return d | 0; - } - function $c(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0; - f = (Z - 80) | 0; - Z = f; - a: { - if (!Wb(1, (f + 76) | 0, b)) { - break a; - } - k = F[(f + 76) >> 2]; - if (!k) { - break a; - } - c = F[(b + 8) >> 2]; - e = F[(b + 16) >> 2]; - c = ki( - (c - e) | 0, - (F[(b + 12) >> 2] - - ((F[(b + 20) >> 2] + (c >>> 0 < e >>> 0)) | 0)) | - 0, - 5, - 0, - ); - e = _; - if (((c >>> 0 < k >>> 0) & ((e | 0) <= 0)) | ((e | 0) < 0)) { - break a; - } - c = F[(a + 4) >> 2]; - d = (F[(a + 8) >> 2] - c) >> 2; - b: { - if (d >>> 0 < k >>> 0) { - qa((a + 4) | 0, (k - d) | 0); - break b; - } - if (d >>> 0 <= k >>> 0) { - break b; - } - F[(a + 8) >> 2] = c + (k << 2); - } - p = (a + 16) | 0; - l = F[(a + 32) >> 2]; - while (1) { - g = F[(b + 12) >> 2]; - c = g; - d = F[(b + 20) >> 2]; - h = F[(b + 8) >> 2]; - e = F[(b + 16) >> 2]; - if ( - (((c | 0) <= (d | 0)) & (h >>> 0 <= e >>> 0)) | - ((c | 0) < (d | 0)) - ) { - d = 0; - break a; - } - m = F[b >> 2]; - q = G[(m + e) | 0]; - c = d; - i = (e + 1) | 0; - c = i ? c : (c + 1) | 0; - F[(b + 16) >> 2] = i; - F[(b + 20) >> 2] = c; - if ( - ((h >>> 0 <= i >>> 0) & ((c | 0) >= (g | 0))) | - ((c | 0) > (g | 0)) - ) { - d = 0; - break a; - } - i = G[(i + m) | 0]; - c = d; - j = (e + 2) | 0; - c = j >>> 0 < 2 ? (c + 1) | 0 : c; - F[(b + 16) >> 2] = j; - F[(b + 20) >> 2] = c; - if ( - ((h >>> 0 <= j >>> 0) & ((c | 0) >= (g | 0))) | - ((c | 0) > (g | 0)) - ) { - d = 0; - break a; - } - j = G[(j + m) | 0]; - c = d; - n = (e + 3) | 0; - c = n >>> 0 < 3 ? (c + 1) | 0 : c; - F[(b + 16) >> 2] = n; - F[(b + 20) >> 2] = c; - if ( - ((h >>> 0 <= n >>> 0) & ((c | 0) >= (g | 0))) | - ((c | 0) > (g | 0)) - ) { - d = 0; - break a; - } - h = G[(m + n) | 0]; - c = d; - d = (e + 4) | 0; - c = d >>> 0 < 4 ? (c + 1) | 0 : c; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = c; - if (q >>> 0 > 4) { - d = 0; - break a; - } - if (((i - 12) & 255) >>> 0 < 245) { - d = 0; - break a; - } - if (!j) { - d = 0; - break a; - } - c = kb((f + 8) | 0); - g = (h | 0) != 0; - d = (i - 1) | 0; - if (d >>> 0 <= 10) { - d = F[((d << 2) + 10148) >> 2]; - } else { - d = -1; - } - d = L(d, j); - cc(c, q, j, i, g, d, d >> 31); - if (Wb(1, (f + 4) | 0, b)) { - e = F[(f + 4) >> 2]; - F[(f + 68) >> 2] = e; - d = bc(ka(96), c); - $[F[(F[l >> 2] + 8) >> 2]]( - l, - (F[(l + 12) >> 2] - F[(l + 8) >> 2]) >> 2, - d, - ); - d = (((F[(l + 12) >> 2] - F[(l + 8) >> 2]) >> 2) - 1) | 0; - h = d << 2; - F[(F[(h + F[(l + 8) >> 2]) >> 2] + 60) >> 2] = e; - F[(F[(a + 4) >> 2] + (o << 2)) >> 2] = d; - c = F[(a + 16) >> 2]; - e = (F[(a + 20) >> 2] - c) >> 2; - c: { - if ((e | 0) > (d | 0)) { - break c; - } - F[f >> 2] = -1; - d = (d + 1) | 0; - if (d >>> 0 > e >>> 0) { - Fa(p, (d - e) | 0, f); - c = F[p >> 2]; - break c; - } - if (d >>> 0 >= e >>> 0) { - break c; - } - F[(a + 20) >> 2] = (d << 2) + c; - } - F[(c + h) >> 2] = o; - d = 1; - o = (o + 1) | 0; - if ((o | 0) != (k | 0)) { - continue; - } - break a; - } - break; - } - d = 0; - } - Z = (f + 80) | 0; - return d | 0; - } - function Oc(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - k = (Z - 16) | 0; - Z = k; - F[(k + 8) >> 2] = c; - h = F[(a + 12) >> 2]; - d = F[(a + 8) >> 2]; - g = (h - d) >> 2; - a: { - if ((g | 0) > (b | 0)) { - break a; - } - e = (b + 1) | 0; - if (e >>> 0 > g >>> 0) { - l = (e - g) | 0; - f = F[(a + 16) >> 2]; - d = F[(a + 12) >> 2]; - if (l >>> 0 <= ((f - d) >> 2) >>> 0) { - if (l) { - e = d; - d = l << 2; - d = (ma(e, 0, d) + d) | 0; - } - F[(a + 12) >> 2] = d; - break a; - } - b: { - c: { - d: { - m = F[(a + 8) >> 2]; - g = (d - m) >> 2; - i = (g + l) | 0; - if (i >>> 0 < 1073741824) { - e = (f - m) | 0; - f = (e >>> 1) | 0; - e = - e >>> 0 >= 2147483644 - ? 1073741823 - : f >>> 0 > i >>> 0 - ? f - : i; - if (e) { - if (e >>> 0 >= 1073741824) { - break d; - } - j = ka(e << 2); - } - h = ((g << 2) + j) | 0; - f = l << 2; - i = ma(h, 0, f); - g = (f + i) | 0; - e = ((e << 2) + j) | 0; - if ((d | 0) == (m | 0)) { - break c; - } - while (1) { - d = (d - 4) | 0; - f = F[d >> 2]; - F[d >> 2] = 0; - h = (h - 4) | 0; - F[h >> 2] = f; - if ((d | 0) != (m | 0)) { - continue; - } - break; - } - F[(a + 16) >> 2] = e; - e = F[(a + 12) >> 2]; - F[(a + 12) >> 2] = g; - d = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = h; - if ((d | 0) == (e | 0)) { - break b; - } - while (1) { - e = (e - 4) | 0; - f = F[e >> 2]; - F[e >> 2] = 0; - if (f) { - xa(f); - } - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - break b; - } - na(); - v(); - } - oa(); - v(); - } - F[(a + 16) >> 2] = e; - F[(a + 12) >> 2] = g; - F[(a + 8) >> 2] = i; - } - if (d) { - ja(d); - } - break a; - } - if (e >>> 0 >= g >>> 0) { - break a; - } - d = (d + (e << 2)) | 0; - if ((d | 0) != (h | 0)) { - while (1) { - h = (h - 4) | 0; - c = F[h >> 2]; - F[h >> 2] = 0; - if (c) { - xa(c); - } - if ((d | 0) != (h | 0)) { - continue; - } - break; - } - c = F[(k + 8) >> 2]; - } - F[(a + 12) >> 2] = d; - } - e: { - f: { - d = F[(c + 56) >> 2]; - g: { - if ((d | 0) > 4) { - break g; - } - j = (L(d, 12) + a) | 0; - d = F[(j + 24) >> 2]; - if ((d | 0) != F[(j + 28) >> 2]) { - F[d >> 2] = b; - F[(j + 24) >> 2] = d + 4; - break g; - } - i = F[(j + 20) >> 2]; - g = (d - i) | 0; - f = g >> 2; - e = (f + 1) | 0; - if (e >>> 0 >= 1073741824) { - break f; - } - d = (g >>> 1) | 0; - e = - g >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 > e >>> 0 - ? d - : e; - if (e) { - if (e >>> 0 >= 1073741824) { - break e; - } - d = ka(e << 2); - } else { - d = 0; - } - f = (d + (f << 2)) | 0; - F[f >> 2] = b; - d = pa(d, i, g); - F[(j + 20) >> 2] = d; - F[(j + 24) >> 2] = f + 4; - F[(j + 28) >> 2] = d + (e << 2); - if (!i) { - break g; - } - ja(i); - } - F[(c + 60) >> 2] = b; - a = F[(a + 8) >> 2]; - F[(k + 8) >> 2] = 0; - a = (a + (b << 2)) | 0; - b = F[a >> 2]; - F[a >> 2] = c; - if (b) { - xa(b); - } - a = F[(k + 8) >> 2]; - F[(k + 8) >> 2] = 0; - if (a) { - xa(a); - } - Z = (k + 16) | 0; - return; - } - na(); - v(); - } - oa(); - v(); - } - function Pf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - i = c; - d = a; - a: { - if (F[(a + 12) >> 2] == (b | 0)) { - break a; - } - a = b; - b = F[(d + 4) >> 2]; - e = F[d >> 2]; - if ((b | 0) != (e | 0)) { - while (1) { - c = (b - 12) | 0; - if (D[(b - 1) | 0] < 0) { - ja(F[c >> 2]); - } - b = c; - if ((e | 0) != (b | 0)) { - continue; - } - break; - } - } - F[(d + 12) >> 2] = a; - F[(d + 4) >> 2] = e; - c = F[a >> 2]; - j = (a + 4) | 0; - if ((c | 0) == (j | 0)) { - break a; - } - while (1) { - a = F[(d + 4) >> 2]; - b: { - if ((a | 0) != F[(d + 8) >> 2]) { - c: { - if (D[(c + 27) | 0] >= 0) { - b = F[(c + 20) >> 2]; - F[a >> 2] = F[(c + 16) >> 2]; - F[(a + 4) >> 2] = b; - F[(a + 8) >> 2] = F[(c + 24) >> 2]; - break c; - } - ra(a, F[(c + 16) >> 2], F[(c + 20) >> 2]); - } - F[(d + 4) >> 2] = a + 12; - break b; - } - g = 0; - d: { - e: { - f: { - a = F[(d + 4) >> 2]; - e = F[d >> 2]; - f = (((a - e) | 0) / 12) | 0; - b = (f + 1) | 0; - if (b >>> 0 < 357913942) { - h = (((F[(d + 8) >> 2] - e) | 0) / 12) | 0; - k = h << 1; - b = - h >>> 0 >= 178956970 - ? 357913941 - : b >>> 0 < k >>> 0 - ? k - : b; - if (b) { - if (b >>> 0 >= 357913942) { - break f; - } - g = ka(L(b, 12)); - } - h = L(b, 12); - b = (L(f, 12) + g) | 0; - g: { - if (D[(c + 27) | 0] >= 0) { - f = F[(c + 20) >> 2]; - F[b >> 2] = F[(c + 16) >> 2]; - F[(b + 4) >> 2] = f; - F[(b + 8) >> 2] = F[(c + 24) >> 2]; - break g; - } - ra(b, F[(c + 16) >> 2], F[(c + 20) >> 2]); - e = F[d >> 2]; - a = F[(d + 4) >> 2]; - } - g = (g + h) | 0; - f = (b + 12) | 0; - if ((a | 0) == (e | 0)) { - break e; - } - while (1) { - a = (a - 12) | 0; - h = F[(a + 4) >> 2]; - b = (b - 12) | 0; - F[b >> 2] = F[a >> 2]; - F[(b + 4) >> 2] = h; - F[(b + 8) >> 2] = F[(a + 8) >> 2]; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - if ((a | 0) != (e | 0)) { - continue; - } - break; - } - F[(d + 8) >> 2] = g; - a = F[(d + 4) >> 2]; - F[(d + 4) >> 2] = f; - e = F[d >> 2]; - F[d >> 2] = b; - if ((a | 0) == (e | 0)) { - break d; - } - while (1) { - b = (a - 12) | 0; - if (D[(a - 1) | 0] < 0) { - ja(F[b >> 2]); - } - a = b; - if ((e | 0) != (b | 0)) { - continue; - } - break; - } - break d; - } - na(); - v(); - } - oa(); - v(); - } - F[(d + 8) >> 2] = g; - F[(d + 4) >> 2] = f; - F[d >> 2] = b; - } - if (e) { - ja(e); - } - } - b = F[(c + 4) >> 2]; - h: { - if (b) { - while (1) { - a = b; - b = F[b >> 2]; - if (b) { - continue; - } - break h; - } - } - while (1) { - a = F[(c + 8) >> 2]; - b = F[a >> 2] != (c | 0); - c = a; - if (b) { - continue; - } - break; - } - } - c = a; - if ((j | 0) != (a | 0)) { - continue; - } - break; - } - } - a = 0; - i: { - if ((i | 0) < 0) { - break i; - } - b = F[d >> 2]; - if ((((F[(d + 4) >> 2] - b) | 0) / 12) >>> 0 <= i >>> 0) { - break i; - } - a = (b + L(i, 12)) | 0; - a = D[(a + 11) | 0] < 0 ? F[a >> 2] : a; - } - return a | 0; - } - function Ad(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0; - i = (Z - 16) | 0; - Z = i; - F[i >> 2] = b; - f = -1; - a: { - if ((b | 0) == -1) { - F[(i + 4) >> 2] = -1; - break a; - } - f = (b + 1) | 0; - F[(i + 4) >> 2] = ((f >>> 0) % 3) | 0 ? f : (b - 2) | 0; - if (((b >>> 0) % 3) | 0) { - f = (b - 1) | 0; - break a; - } - f = (b + 2) | 0; - } - F[(i + 8) >> 2] = f; - n = ((b >>> 0) / 3) | 0; - b: { - c: { - d: { - while (1) { - e: { - f: { - j = F[((l << 2) + i) >> 2]; - if ((j | 0) != -1) { - f = - F[ - (F[(F[(a + 8) >> 2] + 12) >> 2] + (j << 2)) >> - 2 - ]; - if ((f | 0) != -1) { - break f; - } - } - f = 0; - g = F[(a + 216) >> 2]; - if ((g | 0) == F[(a + 220) >> 2]) { - break e; - } - while (1) { - g = (L(f, 144) + g) | 0; - d = F[(g + 136) >> 2]; - c = F[(g + 140) >> 2]; - g: { - if (d >>> 0 < c >>> 0) { - F[d >> 2] = j; - F[(g + 136) >> 2] = d + 4; - break g; - } - e = d; - d = F[(g + 132) >> 2]; - k = (e - d) | 0; - e = k >> 2; - h = (e + 1) | 0; - if (h >>> 0 >= 1073741824) { - break d; - } - m = e << 2; - c = (c - d) | 0; - e = (c >>> 1) | 0; - h = - c >>> 0 >= 2147483644 - ? 1073741823 - : h >>> 0 < e >>> 0 - ? e - : h; - if (h) { - if (h >>> 0 >= 1073741824) { - break c; - } - c = ka(h << 2); - } else { - c = 0; - } - e = (m + c) | 0; - F[e >> 2] = j; - c = pa(c, d, k); - F[(g + 132) >> 2] = c; - F[(g + 136) >> 2] = e + 4; - F[(g + 140) >> 2] = c + (h << 2); - if (!d) { - break g; - } - ja(d); - } - f = (f + 1) | 0; - g = F[(a + 216) >> 2]; - if ( - f >>> 0 < - (((F[(a + 220) >> 2] - g) | 0) / 144) >>> 0 - ) { - continue; - } - break; - } - break e; - } - if ( - ((b | 0) == -1) | - (((f >>> 0) / 3) >>> 0 < n >>> 0) - ) { - break e; - } - f = 0; - if (F[(a + 220) >> 2] == F[(a + 216) >> 2]) { - break e; - } - while (1) { - h: { - if (!wa((F[(a + 368) >> 2] + (f << 4)) | 0)) { - break h; - } - g = (F[(a + 216) >> 2] + L(f, 144)) | 0; - d = F[(g + 136) >> 2]; - c = F[(g + 140) >> 2]; - if (d >>> 0 < c >>> 0) { - F[d >> 2] = j; - F[(g + 136) >> 2] = d + 4; - break h; - } - e = d; - d = F[(g + 132) >> 2]; - k = (e - d) | 0; - e = k >> 2; - h = (e + 1) | 0; - if (h >>> 0 >= 1073741824) { - break b; - } - m = e << 2; - c = (c - d) | 0; - e = (c >>> 1) | 0; - h = - c >>> 0 >= 2147483644 - ? 1073741823 - : h >>> 0 < e >>> 0 - ? e - : h; - if (h) { - if (h >>> 0 >= 1073741824) { - break c; - } - c = ka(h << 2); - } else { - c = 0; - } - e = (m + c) | 0; - F[e >> 2] = j; - c = pa(c, d, k); - F[(g + 132) >> 2] = c; - F[(g + 136) >> 2] = e + 4; - F[(g + 140) >> 2] = c + (h << 2); - if (!d) { - break h; - } - ja(d); - } - f = (f + 1) | 0; - if ( - f >>> 0 < - (((F[(a + 220) >> 2] - F[(a + 216) >> 2]) | 0) / - 144) >>> - 0 - ) { - continue; - } - break; - } - } - l = (l + 1) | 0; - if ((l | 0) != 3) { - continue; - } - break; - } - Z = (i + 16) | 0; - return 1; - } - na(); - v(); - } - oa(); - v(); - } - na(); - v(); - } - function Bd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - h = (Z - 16) | 0; - Z = h; - m = -1; - a: { - b: { - c: { - if (!Da(1, (h + 12) | 0, b)) { - break c; - } - j = F[(h + 12) >> 2]; - if (j) { - c = F[(a + 8) >> 2]; - if ( - ((((F[(c + 4) >> 2] - F[c >> 2]) >> 2) >>> 0) / 3) >>> - 0 < - j >>> 0 - ) { - break c; - } - while (1) { - if (!Da(1, (h + 8) | 0, b)) { - break c; - } - c = F[(h + 8) >> 2]; - if (!Da(1, (h + 8) | 0, b)) { - break c; - } - g = (c + g) | 0; - c = F[(h + 8) >> 2]; - if (g >>> 0 < c >>> 0) { - break c; - } - e = (g - c) | 0; - c = F[(a + 40) >> 2]; - d: { - if ((c | 0) != F[(a + 44) >> 2]) { - F[(c + 4) >> 2] = g; - F[c >> 2] = e; - F[(a + 40) >> 2] = c + 12; - j = F[(h + 12) >> 2]; - break d; - } - d = c; - c = F[(a + 36) >> 2]; - l = (d - c) | 0; - d = ((l | 0) / 12) | 0; - f = (d + 1) | 0; - if (f >>> 0 >= 357913942) { - break b; - } - i = d << 1; - f = - d >>> 0 >= 178956970 - ? 357913941 - : f >>> 0 < i >>> 0 - ? i - : f; - if (f) { - if (f >>> 0 >= 357913942) { - break a; - } - i = ka(L(f, 12)); - } else { - i = 0; - } - d = (i + L(d, 12)) | 0; - F[(d + 4) >> 2] = g; - F[d >> 2] = e; - e = pa((d + L(((l | 0) / -12) | 0, 12)) | 0, c, l); - F[(a + 44) >> 2] = i + L(f, 12); - F[(a + 40) >> 2] = d + 12; - F[(a + 36) >> 2] = e; - if (!c) { - break d; - } - ja(c); - } - k = (k + 1) | 0; - if (k >>> 0 < j >>> 0) { - continue; - } - break; - } - g = 0; - hc(b, 0, 0); - if (j) { - while (1) { - c = G[(b + 36) | 0]; - d = H[(F[(a + 4) >> 2] + 36) >> 1]; - e: { - f: { - if ( - (((d << 8) | (d >>> 8)) & 65535) >>> 0 <= - 513 - ) { - if (!c) { - break e; - } - e = 0; - d = F[(b + 32) >> 2]; - k = (d >>> 3) | 0; - f = F[(b + 24) >> 2]; - c = (k + f) | 0; - i = F[(b + 28) >> 2]; - g: { - if (c >>> 0 >= i >>> 0) { - c = d; - break g; - } - e = G[c | 0]; - c = (d + 1) | 0; - F[(b + 32) >> 2] = c; - k = (c >>> 3) | 0; - e = (e >>> (d & 7)) & 1; - } - if (i >>> 0 > (f + k) >>> 0) { - break f; - } - break e; - } - if (!c) { - break e; - } - e = 0; - c = F[(b + 32) >> 2]; - d = (F[(b + 24) >> 2] + ((c >>> 3) | 0)) | 0; - if (d >>> 0 >= I[(b + 28) >> 2]) { - break e; - } - e = (G[d | 0] >>> (c & 7)) & 1; - } - F[(b + 32) >> 2] = c + 1; - } - c = (F[(a + 36) >> 2] + L(g, 12)) | 0; - D[(c + 8) | 0] = (G[(c + 8) | 0] & 254) | (e & 1); - g = (g + 1) | 0; - if ((j | 0) != (g | 0)) { - continue; - } - break; - } - } - D[(b + 36) | 0] = 0; - d = F[(b + 20) >> 2]; - a = 0; - e = (F[(b + 32) >> 2] + 7) | 0; - a = e >>> 0 < 7 ? 1 : a; - e = (a << 29) | (e >>> 3); - c = (e + F[(b + 16) >> 2]) | 0; - a = (((a >>> 3) | 0) + d) | 0; - F[(b + 16) >> 2] = c; - F[(b + 20) >> 2] = c >>> 0 < e >>> 0 ? (a + 1) | 0 : a; - } - m = F[(b + 16) >> 2]; - } - Z = (h + 16) | 0; - return m; - } - na(); - v(); - } - oa(); - v(); - } - function xf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - m = (Z - 16) | 0; - Z = m; - l = F[(b + 80) >> 2]; - e = G[(c + 24) | 0]; - a = L(l, e); - a: { - b: { - c: { - d: { - b = F[(c + 28) >> 2]; - if ( - !( - !G[(c + 84) | 0] | - (((b | 0) != 1) & ((b | 0) != 2)) - ) - ) { - b = F[(c + 48) >> 2]; - c = F[F[c >> 2] >> 2]; - F[(m + 8) >> 2] = 0; - F[m >> 2] = 0; - F[(m + 4) >> 2] = 0; - if (a) { - if ((a | 0) < 0) { - break d; - } - f = ka(a); - h = (la(f, (b + c) | 0, a) + a) | 0; - } - a = F[d >> 2]; - if (a) { - F[(d + 4) >> 2] = a; - ja(a); - } - F[(d + 8) >> 2] = h; - F[(d + 4) >> 2] = h; - F[d >> 2] = f; - b = 1; - break a; - } - if (e) { - f = ka(e); - ma(f, 0, e); - } - e: { - i = F[(d + 4) >> 2]; - b = F[d >> 2]; - g = (i - b) | 0; - f: { - if (g >>> 0 < a >>> 0) { - k = (a - g) | 0; - j = F[(d + 8) >> 2]; - if (k >>> 0 <= (j - i) >>> 0) { - (n = d), - (o = (ma(i, 0, k) + k) | 0), - (F[(n + 4) >> 2] = o); - break f; - } - if ((a | 0) < 0) { - break e; - } - i = (j - b) | 0; - j = i << 1; - i = - i >>> 0 >= 1073741823 - ? 2147483647 - : a >>> 0 < j >>> 0 - ? j - : a; - j = ka(i); - ma((j + g) | 0, 0, k); - g = pa(j, b, g); - F[(d + 8) >> 2] = g + i; - F[(d + 4) >> 2] = a + g; - F[d >> 2] = g; - if (!b) { - break f; - } - ja(b); - break f; - } - if (a >>> 0 >= g >>> 0) { - break f; - } - F[(d + 4) >> 2] = a + b; - } - if (!l) { - b = 1; - break c; - } - if (!e) { - b = 0; - a = 0; - while (1) { - if ( - !Cb( - c, - G[(c + 84) | 0] - ? a - : F[(F[(c + 68) >> 2] + (a << 2)) >> 2], - D[(c + 24) | 0], - f, - ) - ) { - break c; - } - a = (a + 1) | 0; - b = l >>> 0 <= a >>> 0; - if ((a | 0) != (l | 0)) { - continue; - } - break; - } - break c; - } - i = e & 252; - g = e & 3; - b = 0; - j = e >>> 0 < 4; - e = 0; - while (1) { - if ( - !Cb( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - f, - ) - ) { - break c; - } - b = 0; - a = 0; - k = 0; - if (!j) { - while (1) { - D[(F[d >> 2] + h) | 0] = G[(a + f) | 0]; - D[(((F[d >> 2] + h) | 0) + 1) | 0] = - G[((a | 1) + f) | 0]; - D[(((F[d >> 2] + h) | 0) + 2) | 0] = - G[((a | 2) + f) | 0]; - D[(((F[d >> 2] + h) | 0) + 3) | 0] = - G[((a | 3) + f) | 0]; - a = (a + 4) | 0; - h = (h + 4) | 0; - k = (k + 4) | 0; - if ((i | 0) != (k | 0)) { - continue; - } - break; - } - } - if (g) { - while (1) { - D[(F[d >> 2] + h) | 0] = G[(a + f) | 0]; - a = (a + 1) | 0; - h = (h + 1) | 0; - b = (b + 1) | 0; - if ((g | 0) != (b | 0)) { - continue; - } - break; - } - } - e = (e + 1) | 0; - b = l >>> 0 <= e >>> 0; - if ((e | 0) != (l | 0)) { - continue; - } - break; - } - break b; - } - na(); - v(); - } - na(); - v(); - } - if (!f) { - break a; - } - } - ja(f); - } - Z = (m + 16) | 0; - return b & 1; - } - function wf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - m = (Z - 16) | 0; - Z = m; - l = F[(b + 80) >> 2]; - e = G[(c + 24) | 0]; - a = L(l, e); - a: { - b: { - c: { - d: { - b = F[(c + 28) >> 2]; - if ( - !( - !G[(c + 84) | 0] | - (((b | 0) != 1) & ((b | 0) != 2)) - ) - ) { - b = F[(c + 48) >> 2]; - c = F[F[c >> 2] >> 2]; - F[(m + 8) >> 2] = 0; - F[m >> 2] = 0; - F[(m + 4) >> 2] = 0; - if (a) { - if ((a | 0) < 0) { - break d; - } - f = ka(a); - h = (la(f, (b + c) | 0, a) + a) | 0; - } - a = F[d >> 2]; - if (a) { - F[(d + 4) >> 2] = a; - ja(a); - } - F[(d + 8) >> 2] = h; - F[(d + 4) >> 2] = h; - F[d >> 2] = f; - b = 1; - break a; - } - if (e) { - f = ka(e); - ma(f, 0, e); - } - e: { - i = F[(d + 4) >> 2]; - b = F[d >> 2]; - g = (i - b) | 0; - f: { - if (g >>> 0 < a >>> 0) { - k = (a - g) | 0; - j = F[(d + 8) >> 2]; - if (k >>> 0 <= (j - i) >>> 0) { - (n = d), - (o = (ma(i, 0, k) + k) | 0), - (F[(n + 4) >> 2] = o); - break f; - } - if ((a | 0) < 0) { - break e; - } - i = (j - b) | 0; - j = i << 1; - i = - i >>> 0 >= 1073741823 - ? 2147483647 - : a >>> 0 < j >>> 0 - ? j - : a; - j = ka(i); - ma((j + g) | 0, 0, k); - g = pa(j, b, g); - F[(d + 8) >> 2] = g + i; - F[(d + 4) >> 2] = a + g; - F[d >> 2] = g; - if (!b) { - break f; - } - ja(b); - break f; - } - if (a >>> 0 >= g >>> 0) { - break f; - } - F[(d + 4) >> 2] = a + b; - } - if (!l) { - b = 1; - break c; - } - if (!e) { - b = 0; - a = 0; - while (1) { - if ( - !Bb( - c, - G[(c + 84) | 0] - ? a - : F[(F[(c + 68) >> 2] + (a << 2)) >> 2], - D[(c + 24) | 0], - f, - ) - ) { - break c; - } - a = (a + 1) | 0; - b = l >>> 0 <= a >>> 0; - if ((a | 0) != (l | 0)) { - continue; - } - break; - } - break c; - } - i = e & 252; - g = e & 3; - b = 0; - j = e >>> 0 < 4; - e = 0; - while (1) { - if ( - !Bb( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - f, - ) - ) { - break c; - } - b = 0; - a = 0; - k = 0; - if (!j) { - while (1) { - D[(F[d >> 2] + h) | 0] = G[(a + f) | 0]; - D[(((F[d >> 2] + h) | 0) + 1) | 0] = - G[((a | 1) + f) | 0]; - D[(((F[d >> 2] + h) | 0) + 2) | 0] = - G[((a | 2) + f) | 0]; - D[(((F[d >> 2] + h) | 0) + 3) | 0] = - G[((a | 3) + f) | 0]; - a = (a + 4) | 0; - h = (h + 4) | 0; - k = (k + 4) | 0; - if ((i | 0) != (k | 0)) { - continue; - } - break; - } - } - if (g) { - while (1) { - D[(F[d >> 2] + h) | 0] = G[(a + f) | 0]; - a = (a + 1) | 0; - h = (h + 1) | 0; - b = (b + 1) | 0; - if ((g | 0) != (b | 0)) { - continue; - } - break; - } - } - e = (e + 1) | 0; - b = l >>> 0 <= e >>> 0; - if ((e | 0) != (l | 0)) { - continue; - } - break; - } - break b; - } - na(); - v(); - } - na(); - v(); - } - if (!f) { - break a; - } - } - ja(f); - } - Z = (m + 16) | 0; - return b & 1; - } - function Jb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0; - k = F[(b + 16) >> 2]; - h = (F[(c + 4) >> 2] - k) | 0; - e = (F[c >> 2] - k) | 0; - F[c >> 2] = e; - f = h; - F[(c + 4) >> 2] = f; - l = F[(b + 16) >> 2]; - f = f >> 31; - g = ((h ^ f) - f) | 0; - f = e >> 31; - m = l >>> 0 >= (g + (((f ^ e) - f) | 0)) >>> 0; - a: { - if (m) { - f = h; - break a; - } - b: { - c: { - if ((e | 0) >= 0) { - g = 1; - j = 1; - if ((h | 0) >= 0) { - break b; - } - i = 1; - g = -1; - j = -1; - if (e) { - break c; - } - break b; - } - i = -1; - g = -1; - j = -1; - if ((h | 0) <= 0) { - break b; - } - } - g = (h | 0) <= 0 ? -1 : 1; - j = i; - } - n = L(j, l); - f = ((e << 1) - n) | 0; - i = (L(g, j) | 0) >= 0; - e = L(g, l); - f = ((((i ? (0 - f) | 0 : f) + e) | 0) / 2) | 0; - F[(c + 4) >> 2] = f; - e = ((h << 1) - e) | 0; - e = ((((i ? (0 - e) | 0 : e) + n) | 0) / 2) | 0; - F[c >> 2] = e; - } - d: { - e: { - f: { - g: { - h: { - i: { - j: { - if (e) { - if ((e | 0) < 0) { - break j; - } - if ((f | 0) >= 0) { - break i; - } - break f; - } - if (f) { - break h; - } - j = 1; - g = 0; - f = 0; - i = 0; - break d; - } - j = 1; - if ((f | 0) > 0) { - break g; - } - i = (f | 0) > 0 ? 3 : 0; - g = f; - f = e; - break d; - } - g = (0 - f) | 0; - f = (0 - e) | 0; - i = 2; - break e; - } - if ((f | 0) <= 0) { - break f; - } - } - f = (0 - f) | 0; - g = e; - i = 3; - break e; - } - g = (0 - e) | 0; - i = 1; - } - F[c >> 2] = f; - F[(c + 4) >> 2] = g; - j = 0; - } - e = (F[d >> 2] + f) | 0; - h = F[(b + 16) >> 2]; - k: { - if ((e | 0) > (h | 0)) { - e = (e - F[(b + 4) >> 2]) | 0; - break k; - } - if (((0 - h) | 0) <= (e | 0)) { - break k; - } - e = (F[(b + 4) >> 2] + e) | 0; - } - c = (F[(d + 4) >> 2] + g) | 0; - l: { - if ((h | 0) < (c | 0)) { - c = (c - F[(b + 4) >> 2]) | 0; - break l; - } - if (((0 - h) | 0) <= (c | 0)) { - break l; - } - c = (F[(b + 4) >> 2] + c) | 0; - } - m: { - if (j) { - b = c; - break m; - } - b = c; - n: { - o: { - p: { - d = (4 - i) | 0; - switch (((d >>> 0 < 4 ? d : (0 - i) | 0) - 1) | 0) { - case 2: - break n; - case 1: - break o; - case 0: - break p; - default: - break m; - } - } - b = (0 - e) | 0; - e = c; - break m; - } - b = (0 - c) | 0; - e = (0 - e) | 0; - break m; - } - b = e; - e = (0 - c) | 0; - } - q: { - if (m) { - c = b; - break q; - } - r: { - s: { - if ((e | 0) >= 0) { - c = 1; - f = 1; - if ((b | 0) >= 0) { - break r; - } - d = 1; - c = -1; - f = -1; - if (e) { - break s; - } - break r; - } - d = -1; - c = -1; - f = -1; - if ((b | 0) <= 0) { - break r; - } - } - c = (b | 0) <= 0 ? -1 : 1; - f = d; - } - d = e << 1; - e = L(f, h); - d = (d - e) | 0; - f = (L(c, f) | 0) >= 0; - g = f ? (0 - d) | 0 : d; - d = L(c, h); - c = (((g + d) | 0) / 2) | 0; - b = ((b << 1) - d) | 0; - e = (((e + (f ? (0 - b) | 0 : b)) | 0) / 2) | 0; - } - b = a; - F[b >> 2] = e + k; - F[(b + 4) >> 2] = c + k; - } - function Uh(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0; - F[(a + 8) >> 2] = e; - m = (a + 32) | 0; - h = F[m >> 2]; - g = (F[(a + 36) >> 2] - h) >> 2; - a: { - if (g >>> 0 < e >>> 0) { - qa(m, (e - g) | 0); - f = F[(a + 8) >> 2]; - break a; - } - f = e; - if (f >>> 0 >= g >>> 0) { - break a; - } - F[(a + 36) >> 2] = h + (e << 2); - f = e; - } - g = e >>> 0 > 1073741823 ? -1 : e << 2; - n = ma(ka(g), 0, g); - b: { - if ((f | 0) <= 0) { - break b; - } - h = F[(a + 32) >> 2]; - while (1) { - f = i << 2; - g = F[(f + n) >> 2]; - j = F[(a + 16) >> 2]; - c: { - if ((g | 0) > (j | 0)) { - F[(f + h) >> 2] = j; - break c; - } - f = (f + h) | 0; - j = F[(a + 12) >> 2]; - if ((j | 0) > (g | 0)) { - F[f >> 2] = j; - break c; - } - F[f >> 2] = g; - } - f = F[(a + 8) >> 2]; - i = (i + 1) | 0; - if ((f | 0) > (i | 0)) { - continue; - } - break; - } - if ((f | 0) <= 0) { - break b; - } - i = 0; - while (1) { - g = i << 2; - f = (g + c) | 0; - g = (F[(b + g) >> 2] + F[(g + h) >> 2]) | 0; - F[f >> 2] = g; - d: { - if ((g | 0) > F[(a + 16) >> 2]) { - g = (g - F[(a + 20) >> 2]) | 0; - } else { - if ((g | 0) >= F[(a + 12) >> 2]) { - break d; - } - g = (g + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = g; - } - f = F[(a + 8) >> 2]; - i = (i + 1) | 0; - if ((f | 0) > (i | 0)) { - continue; - } - break; - } - } - if (!(((d | 0) <= (e | 0)) | ((f | 0) <= 0))) { - p = (0 - e) << 2; - g = e; - while (1) { - e: { - if ((f | 0) <= 0) { - break e; - } - l = g << 2; - o = (l + c) | 0; - q = (o + p) | 0; - j = F[m >> 2]; - i = 0; - while (1) { - f = i << 2; - h = F[(f + q) >> 2]; - k = F[(a + 16) >> 2]; - f: { - if ((h | 0) > (k | 0)) { - F[(f + j) >> 2] = k; - break f; - } - f = (f + j) | 0; - k = F[(a + 12) >> 2]; - if ((k | 0) > (h | 0)) { - F[f >> 2] = k; - break f; - } - F[f >> 2] = h; - } - f = F[(a + 8) >> 2]; - i = (i + 1) | 0; - if ((f | 0) > (i | 0)) { - continue; - } - break; - } - i = 0; - if ((f | 0) <= 0) { - break e; - } - l = (b + l) | 0; - while (1) { - h = i << 2; - f = (h + o) | 0; - h = (F[(h + l) >> 2] + F[(h + j) >> 2]) | 0; - F[f >> 2] = h; - g: { - if ((h | 0) > F[(a + 16) >> 2]) { - h = (h - F[(a + 20) >> 2]) | 0; - } else { - if ((h | 0) >= F[(a + 12) >> 2]) { - break g; - } - h = (h + F[(a + 20) >> 2]) | 0; - } - F[f >> 2] = h; - } - f = F[(a + 8) >> 2]; - i = (i + 1) | 0; - if ((f | 0) > (i | 0)) { - continue; - } - break; - } - } - g = (e + g) | 0; - if ((g | 0) < (d | 0)) { - continue; - } - break; - } - } - ja(n); - return 1; - } - function yf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - j = F[(b + 80) >> 2]; - b = G[(c + 24) | 0]; - g = L(j, b); - a: { - if (!b) { - break a; - } - h = b << 2; - f = ka(h); - a = f; - k = b & 7; - if (k) { - while (1) { - F[a >> 2] = -1073741824; - a = (a + 4) | 0; - e = (e + 1) | 0; - if ((k | 0) != (e | 0)) { - continue; - } - break; - } - } - if (((b - 1) & 1073741823) >>> 0 < 7) { - break a; - } - e = (f + h) | 0; - while (1) { - F[(a + 24) >> 2] = -1073741824; - F[(a + 28) >> 2] = -1073741824; - F[(a + 16) >> 2] = -1073741824; - F[(a + 20) >> 2] = -1073741824; - F[(a + 8) >> 2] = -1073741824; - F[(a + 12) >> 2] = -1073741824; - F[a >> 2] = -1073741824; - F[(a + 4) >> 2] = -1073741824; - a = (a + 32) | 0; - if ((e | 0) != (a | 0)) { - continue; - } - break; - } - } - e = F[d >> 2]; - a = (F[(d + 4) >> 2] - e) >> 2; - b: { - if (a >>> 0 < g >>> 0) { - qa(d, (g - a) | 0); - break b; - } - if (a >>> 0 <= g >>> 0) { - break b; - } - F[(d + 4) >> 2] = e + (g << 2); - } - c: { - d: { - e: { - if (!j) { - i = 1; - break e; - } - if (!b) { - a = 0; - while (1) { - if ( - !lb( - c, - G[(c + 84) | 0] - ? a - : F[(F[(c + 68) >> 2] + (a << 2)) >> 2], - D[(c + 24) | 0], - f, - ) - ) { - break e; - } - a = (a + 1) | 0; - i = j >>> 0 <= a >>> 0; - if ((a | 0) != (j | 0)) { - continue; - } - break; - } - break e; - } - n = b & 252; - k = b & 3; - o = b >>> 0 < 4; - e = 0; - b = 0; - while (1) { - if ( - !lb( - c, - G[(c + 84) | 0] - ? b - : F[(F[(c + 68) >> 2] + (b << 2)) >> 2], - D[(c + 24) | 0], - f, - ) - ) { - break e; - } - m = F[d >> 2]; - i = 0; - a = 0; - l = 0; - if (!o) { - while (1) { - g = ((e << 2) + m) | 0; - h = a << 2; - J[g >> 2] = J[(h + f) >> 2]; - J[(g + 4) >> 2] = J[((h | 4) + f) >> 2]; - J[(g + 8) >> 2] = J[((h | 8) + f) >> 2]; - J[(g + 12) >> 2] = J[((h | 12) + f) >> 2]; - a = (a + 4) | 0; - e = (e + 4) | 0; - l = (l + 4) | 0; - if ((n | 0) != (l | 0)) { - continue; - } - break; - } - } - if (k) { - while (1) { - J[((e << 2) + m) >> 2] = J[((a << 2) + f) >> 2]; - a = (a + 1) | 0; - e = (e + 1) | 0; - i = (i + 1) | 0; - if ((k | 0) != (i | 0)) { - continue; - } - break; - } - } - b = (b + 1) | 0; - i = j >>> 0 <= b >>> 0; - if ((b | 0) != (j | 0)) { - continue; - } - break; - } - break d; - } - if (!f) { - break c; - } - } - ja(f); - } - return i | 0; - } - function $d(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - k = (Z - 16) | 0; - Z = k; - c = F[(b + 20) >> 2]; - d = F[(b + 16) >> 2]; - e = (d + 4) | 0; - c = e >>> 0 < 4 ? (c + 1) | 0 : c; - g = F[(b + 12) >> 2]; - a: { - if ( - ((I[(b + 8) >> 2] < e >>> 0) & ((g | 0) <= (c | 0))) | - ((c | 0) > (g | 0)) - ) { - break a; - } - d = (d + F[b >> 2]) | 0; - h = - G[d | 0] | - (G[(d + 1) | 0] << 8) | - ((G[(d + 2) | 0] << 16) | (G[(d + 3) | 0] << 24)); - F[(b + 16) >> 2] = e; - F[(b + 20) >> 2] = c; - if ((h | 0) < 0) { - break a; - } - Na((a + 76) | 0, h); - c = k; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - D[(c + 5) | 0] = 0; - D[(c + 6) | 0] = 0; - D[(c + 7) | 0] = 0; - D[(c + 8) | 0] = 0; - D[(c + 9) | 0] = 0; - D[(c + 10) | 0] = 0; - D[(c + 11) | 0] = 0; - D[(c + 12) | 0] = 0; - b: { - if (!Aa(c, b)) { - break b; - } - if (h) { - g = 1; - while (1) { - d = 1 << i; - e = wa(c); - f = (F[(a + 76) >> 2] + ((i >>> 3) & 536870908)) | 0; - e = e ^ g; - if (e & 1) { - d = F[f >> 2] & (d ^ -1); - } else { - d = d | F[f >> 2]; - } - g = e ^ 1; - F[f >> 2] = d; - i = (i + 1) | 0; - if ((h | 0) != (i | 0)) { - continue; - } - break; - } - } - i = 0; - c = F[(b + 8) >> 2]; - e = F[(b + 12) >> 2]; - f = e; - e = F[(b + 20) >> 2]; - g = e; - l = F[(b + 16) >> 2]; - d = (l + 4) | 0; - e = d >>> 0 < 4 ? (e + 1) | 0 : e; - h = d; - if ( - ((d >>> 0 > c >>> 0) & ((e | 0) >= (f | 0))) | - ((e | 0) > (f | 0)) - ) { - break b; - } - m = F[b >> 2]; - d = (m + l) | 0; - j = - G[d | 0] | - (G[(d + 1) | 0] << 8) | - ((G[(d + 2) | 0] << 16) | (G[(d + 3) | 0] << 24)); - F[(b + 16) >> 2] = h; - F[(b + 20) >> 2] = e; - d = c; - c = g; - e = (l + 8) | 0; - c = e >>> 0 < 8 ? (c + 1) | 0 : c; - if ( - ((d >>> 0 < e >>> 0) & ((c | 0) >= (f | 0))) | - ((c | 0) > (f | 0)) - ) { - break b; - } - d = (h + m) | 0; - d = - G[d | 0] | - (G[(d + 1) | 0] << 8) | - ((G[(d + 2) | 0] << 16) | (G[(d + 3) | 0] << 24)); - F[(b + 16) >> 2] = e; - F[(b + 20) >> 2] = c; - if ((d | 0) < (j | 0)) { - break b; - } - F[(a + 16) >> 2] = d; - F[(a + 12) >> 2] = j; - c = - ((d >> 31) - (((j >> 31) + (d >>> 0 < j >>> 0)) | 0)) | 0; - b = (d - j) | 0; - if ((!c & (b >>> 0 > 2147483646)) | c) { - break b; - } - i = 1; - c = (b + 1) | 0; - F[(a + 20) >> 2] = c; - b = (c >>> 1) | 0; - F[(a + 24) >> 2] = b; - F[(a + 28) >> 2] = 0 - b; - if (c & 1) { - break b; - } - F[(a + 24) >> 2] = b - 1; - } - } - Z = (k + 16) | 0; - return i | 0; - } - function tf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - a = 0; - k = (Z - 16) | 0; - Z = k; - j = F[(b + 80) >> 2]; - e = G[(c + 24) | 0]; - b = L(j, e); - a: { - b: { - c: { - d: { - f = F[(c + 28) >> 2]; - if ( - !( - !G[(c + 84) | 0] | - (((f | 0) != 5) & ((f | 0) != 6)) - ) - ) { - e = F[(c + 48) >> 2]; - c = F[F[c >> 2] >> 2]; - F[(k + 8) >> 2] = 0; - F[k >> 2] = 0; - F[(k + 4) >> 2] = 0; - if (b) { - if ((b | 0) < 0) { - break d; - } - b = b << 2; - a = ka(b); - g = (la(a, (c + e) | 0, b) + b) | 0; - } - b = F[d >> 2]; - if (b) { - F[(d + 4) >> 2] = b; - ja(b); - } - F[(d + 8) >> 2] = g; - F[(d + 4) >> 2] = g; - F[d >> 2] = a; - h = 1; - break a; - } - if (e) { - f = e << 2; - a = ka(f); - ma(a, 0, f); - } - i = F[d >> 2]; - f = (F[(d + 4) >> 2] - i) >> 2; - e: { - if (f >>> 0 < b >>> 0) { - qa(d, (b - f) | 0); - break e; - } - if (b >>> 0 >= f >>> 0) { - break e; - } - F[(d + 4) >> 2] = i + (b << 2); - } - if (!j) { - h = 1; - break c; - } - if (!e) { - b = 0; - while (1) { - if ( - !xb( - c, - G[(c + 84) | 0] - ? b - : F[(F[(c + 68) >> 2] + (b << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - b = (b + 1) | 0; - h = j >>> 0 <= b >>> 0; - if ((b | 0) != (j | 0)) { - continue; - } - break; - } - break c; - } - o = e & 252; - m = e & 3; - p = e >>> 0 < 4; - e = 0; - while (1) { - if ( - !xb( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - n = F[d >> 2]; - l = 0; - b = 0; - h = 0; - if (!p) { - while (1) { - f = ((g << 2) + n) | 0; - i = b << 2; - F[f >> 2] = F[(i + a) >> 2]; - F[(f + 4) >> 2] = F[((i | 4) + a) >> 2]; - F[(f + 8) >> 2] = F[((i | 8) + a) >> 2]; - F[(f + 12) >> 2] = F[((i | 12) + a) >> 2]; - b = (b + 4) | 0; - g = (g + 4) | 0; - h = (h + 4) | 0; - if ((o | 0) != (h | 0)) { - continue; - } - break; - } - } - if (m) { - while (1) { - F[((g << 2) + n) >> 2] = F[((b << 2) + a) >> 2]; - b = (b + 1) | 0; - g = (g + 1) | 0; - l = (l + 1) | 0; - if ((l | 0) != (m | 0)) { - continue; - } - break; - } - } - e = (e + 1) | 0; - h = j >>> 0 <= e >>> 0; - if ((e | 0) != (j | 0)) { - continue; - } - break; - } - break b; - } - na(); - v(); - } - if (!a) { - break a; - } - } - ja(a); - } - Z = (k + 16) | 0; - return h | 0; - } - function cd(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - a = 0; - k = (Z - 16) | 0; - Z = k; - j = F[(b + 80) >> 2]; - e = G[(c + 24) | 0]; - b = L(j, e); - a: { - b: { - c: { - d: { - f = F[(c + 28) >> 2]; - if ( - !( - !G[(c + 84) | 0] | - (((f | 0) != 5) & ((f | 0) != 6)) - ) - ) { - e = F[(c + 48) >> 2]; - c = F[F[c >> 2] >> 2]; - F[(k + 8) >> 2] = 0; - F[k >> 2] = 0; - F[(k + 4) >> 2] = 0; - if (b) { - if ((b | 0) < 0) { - break d; - } - b = b << 2; - a = ka(b); - g = (la(a, (c + e) | 0, b) + b) | 0; - } - b = F[d >> 2]; - if (b) { - F[(d + 4) >> 2] = b; - ja(b); - } - F[(d + 8) >> 2] = g; - F[(d + 4) >> 2] = g; - F[d >> 2] = a; - h = 1; - break a; - } - if (e) { - f = e << 2; - a = ka(f); - ma(a, 0, f); - } - i = F[d >> 2]; - f = (F[(d + 4) >> 2] - i) >> 2; - e: { - if (f >>> 0 < b >>> 0) { - qa(d, (b - f) | 0); - break e; - } - if (b >>> 0 >= f >>> 0) { - break e; - } - F[(d + 4) >> 2] = i + (b << 2); - } - if (!j) { - h = 1; - break c; - } - if (!e) { - b = 0; - while (1) { - if ( - !yb( - c, - G[(c + 84) | 0] - ? b - : F[(F[(c + 68) >> 2] + (b << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - b = (b + 1) | 0; - h = j >>> 0 <= b >>> 0; - if ((b | 0) != (j | 0)) { - continue; - } - break; - } - break c; - } - o = e & 252; - m = e & 3; - p = e >>> 0 < 4; - e = 0; - while (1) { - if ( - !yb( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - n = F[d >> 2]; - l = 0; - b = 0; - h = 0; - if (!p) { - while (1) { - f = ((g << 2) + n) | 0; - i = b << 2; - F[f >> 2] = F[(i + a) >> 2]; - F[(f + 4) >> 2] = F[((i | 4) + a) >> 2]; - F[(f + 8) >> 2] = F[((i | 8) + a) >> 2]; - F[(f + 12) >> 2] = F[((i | 12) + a) >> 2]; - b = (b + 4) | 0; - g = (g + 4) | 0; - h = (h + 4) | 0; - if ((o | 0) != (h | 0)) { - continue; - } - break; - } - } - if (m) { - while (1) { - F[((g << 2) + n) >> 2] = F[((b << 2) + a) >> 2]; - b = (b + 1) | 0; - g = (g + 1) | 0; - l = (l + 1) | 0; - if ((l | 0) != (m | 0)) { - continue; - } - break; - } - } - e = (e + 1) | 0; - h = j >>> 0 <= e >>> 0; - if ((e | 0) != (j | 0)) { - continue; - } - break; - } - break b; - } - na(); - v(); - } - if (!a) { - break a; - } - } - ja(a); - } - Z = (k + 16) | 0; - return h | 0; - } - function vf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - a = 0; - k = (Z - 16) | 0; - Z = k; - j = F[(b + 80) >> 2]; - e = G[(c + 24) | 0]; - b = L(j, e); - a: { - b: { - c: { - d: { - f = F[(c + 28) >> 2]; - if ( - !( - !G[(c + 84) | 0] | - (((f | 0) != 3) & ((f | 0) != 4)) - ) - ) { - e = F[(c + 48) >> 2]; - c = F[F[c >> 2] >> 2]; - F[(k + 8) >> 2] = 0; - F[k >> 2] = 0; - F[(k + 4) >> 2] = 0; - if (b) { - if ((b | 0) < 0) { - break d; - } - b = b << 1; - a = ka(b); - g = (la(a, (c + e) | 0, b) + b) | 0; - } - b = F[d >> 2]; - if (b) { - F[(d + 4) >> 2] = b; - ja(b); - } - F[(d + 8) >> 2] = g; - F[(d + 4) >> 2] = g; - F[d >> 2] = a; - h = 1; - break a; - } - if (e) { - f = e << 1; - a = ka(f); - ma(a, 0, f); - } - i = F[d >> 2]; - f = (F[(d + 4) >> 2] - i) >> 1; - e: { - if (f >>> 0 < b >>> 0) { - kd(d, (b - f) | 0); - break e; - } - if (b >>> 0 >= f >>> 0) { - break e; - } - F[(d + 4) >> 2] = i + (b << 1); - } - if (!j) { - h = 1; - break c; - } - if (!e) { - b = 0; - while (1) { - if ( - !Ab( - c, - G[(c + 84) | 0] - ? b - : F[(F[(c + 68) >> 2] + (b << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - b = (b + 1) | 0; - h = j >>> 0 <= b >>> 0; - if ((b | 0) != (j | 0)) { - continue; - } - break; - } - break c; - } - o = e & 252; - m = e & 3; - p = e >>> 0 < 4; - e = 0; - while (1) { - if ( - !Ab( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - n = F[d >> 2]; - l = 0; - b = 0; - h = 0; - if (!p) { - while (1) { - f = ((g << 1) + n) | 0; - i = b << 1; - E[f >> 1] = H[(i + a) >> 1]; - E[(f + 2) >> 1] = H[((i | 2) + a) >> 1]; - E[(f + 4) >> 1] = H[((i | 4) + a) >> 1]; - E[(f + 6) >> 1] = H[((i | 6) + a) >> 1]; - b = (b + 4) | 0; - g = (g + 4) | 0; - h = (h + 4) | 0; - if ((o | 0) != (h | 0)) { - continue; - } - break; - } - } - if (m) { - while (1) { - E[((g << 1) + n) >> 1] = H[((b << 1) + a) >> 1]; - b = (b + 1) | 0; - g = (g + 1) | 0; - l = (l + 1) | 0; - if ((l | 0) != (m | 0)) { - continue; - } - break; - } - } - e = (e + 1) | 0; - h = j >>> 0 <= e >>> 0; - if ((e | 0) != (j | 0)) { - continue; - } - break; - } - break b; - } - na(); - v(); - } - if (!a) { - break a; - } - } - ja(a); - } - Z = (k + 16) | 0; - return h | 0; - } - function uf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0; - a = 0; - k = (Z - 16) | 0; - Z = k; - j = F[(b + 80) >> 2]; - e = G[(c + 24) | 0]; - b = L(j, e); - a: { - b: { - c: { - d: { - f = F[(c + 28) >> 2]; - if ( - !( - !G[(c + 84) | 0] | - (((f | 0) != 3) & ((f | 0) != 4)) - ) - ) { - e = F[(c + 48) >> 2]; - c = F[F[c >> 2] >> 2]; - F[(k + 8) >> 2] = 0; - F[k >> 2] = 0; - F[(k + 4) >> 2] = 0; - if (b) { - if ((b | 0) < 0) { - break d; - } - b = b << 1; - a = ka(b); - g = (la(a, (c + e) | 0, b) + b) | 0; - } - b = F[d >> 2]; - if (b) { - F[(d + 4) >> 2] = b; - ja(b); - } - F[(d + 8) >> 2] = g; - F[(d + 4) >> 2] = g; - F[d >> 2] = a; - h = 1; - break a; - } - if (e) { - f = e << 1; - a = ka(f); - ma(a, 0, f); - } - i = F[d >> 2]; - f = (F[(d + 4) >> 2] - i) >> 1; - e: { - if (f >>> 0 < b >>> 0) { - kd(d, (b - f) | 0); - break e; - } - if (b >>> 0 >= f >>> 0) { - break e; - } - F[(d + 4) >> 2] = i + (b << 1); - } - if (!j) { - h = 1; - break c; - } - if (!e) { - b = 0; - while (1) { - if ( - !zb( - c, - G[(c + 84) | 0] - ? b - : F[(F[(c + 68) >> 2] + (b << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - b = (b + 1) | 0; - h = j >>> 0 <= b >>> 0; - if ((b | 0) != (j | 0)) { - continue; - } - break; - } - break c; - } - o = e & 252; - m = e & 3; - p = e >>> 0 < 4; - e = 0; - while (1) { - if ( - !zb( - c, - G[(c + 84) | 0] - ? e - : F[(F[(c + 68) >> 2] + (e << 2)) >> 2], - D[(c + 24) | 0], - a, - ) - ) { - break c; - } - n = F[d >> 2]; - l = 0; - b = 0; - h = 0; - if (!p) { - while (1) { - f = ((g << 1) + n) | 0; - i = b << 1; - E[f >> 1] = H[(i + a) >> 1]; - E[(f + 2) >> 1] = H[((i | 2) + a) >> 1]; - E[(f + 4) >> 1] = H[((i | 4) + a) >> 1]; - E[(f + 6) >> 1] = H[((i | 6) + a) >> 1]; - b = (b + 4) | 0; - g = (g + 4) | 0; - h = (h + 4) | 0; - if ((o | 0) != (h | 0)) { - continue; - } - break; - } - } - if (m) { - while (1) { - E[((g << 1) + n) >> 1] = H[((b << 1) + a) >> 1]; - b = (b + 1) | 0; - g = (g + 1) | 0; - l = (l + 1) | 0; - if ((l | 0) != (m | 0)) { - continue; - } - break; - } - } - e = (e + 1) | 0; - h = j >>> 0 <= e >>> 0; - if ((e | 0) != (j | 0)) { - continue; - } - break; - } - break b; - } - na(); - v(); - } - if (!a) { - break a; - } - } - ja(a); - } - Z = (k + 16) | 0; - return h | 0; - } - function kc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - f = -1; - d = -1; - a: { - if ((b | 0) == -1) { - break a; - } - d = (b + 1) | 0; - f = ((d >>> 0) % 3) | 0 ? d : (b - 2) | 0; - d = (b - 1) | 0; - if (((b >>> 0) % 3) | 0) { - break a; - } - d = (b + 2) | 0; - } - b: { - c: { - d: { - switch (F[(a + 168) >> 2]) { - case 0: - case 1: - e = F[(a + 148) >> 2]; - c = 1; - b = F[(a + 156) >> 2]; - g = - (b + - (((f | 0) == -1 - ? -1 - : F[(F[e >> 2] + (f << 2)) >> 2]) << - 2)) | - 0; - F[g >> 2] = F[g >> 2] + 1; - b = - ((((d | 0) == -1 - ? -1 - : F[(F[e >> 2] + (d << 2)) >> 2]) << - 2) + - b) | - 0; - break c; - case 5: - e = F[(a + 148) >> 2]; - c = -1; - c = - ((b | 0) != -1 - ? F[(F[e >> 2] + (b << 2)) >> 2] - : c) << 2; - b = F[(a + 156) >> 2]; - c = (c + b) | 0; - F[c >> 2] = F[c >> 2] + 1; - c = - ((((f | 0) == -1 - ? -1 - : F[(F[e >> 2] + (f << 2)) >> 2]) << - 2) + - b) | - 0; - F[c >> 2] = F[c >> 2] + 1; - c = 2; - b = - ((((d | 0) == -1 - ? -1 - : F[(F[e >> 2] + (d << 2)) >> 2]) << - 2) + - b) | - 0; - break c; - case 3: - e = F[(a + 148) >> 2]; - c = -1; - c = - ((b | 0) != -1 - ? F[(F[e >> 2] + (b << 2)) >> 2] - : c) << 2; - b = F[(a + 156) >> 2]; - c = (c + b) | 0; - F[c >> 2] = F[c >> 2] + 1; - c = - ((((f | 0) == -1 - ? -1 - : F[(F[e >> 2] + (f << 2)) >> 2]) << - 2) + - b) | - 0; - F[c >> 2] = F[c >> 2] + 2; - c = 1; - b = - ((((d | 0) == -1 - ? -1 - : F[(F[e >> 2] + (d << 2)) >> 2]) << - 2) + - b) | - 0; - break c; - case 7: - break d; - default: - break b; - } - } - e = F[(a + 148) >> 2]; - c = -1; - c = - ((b | 0) != -1 ? F[(F[e >> 2] + (b << 2)) >> 2] : c) << 2; - b = F[(a + 156) >> 2]; - c = (c + b) | 0; - F[c >> 2] = F[c >> 2] + 2; - c = - ((((f | 0) == -1 ? -1 : F[(F[e >> 2] + (f << 2)) >> 2]) << - 2) + - b) | - 0; - F[c >> 2] = F[c >> 2] + 2; - c = 2; - b = - ((((d | 0) == -1 ? -1 : F[(F[e >> 2] + (d << 2)) >> 2]) << - 2) + - b) | - 0; - } - F[b >> 2] = F[b >> 2] + c; - } - c = a; - b = - F[ - (F[(a + 156) >> 2] + - (((f | 0) == -1 - ? -1 - : F[(F[F[(a + 148) >> 2] >> 2] + (f << 2)) >> 2]) << - 2)) >> - 2 - ]; - d = F[(a + 180) >> 2]; - a = F[(a + 176) >> 2]; - F[(c + 172) >> 2] = - (a | 0) <= (b | 0) - ? (((b | 0) < (d | 0) ? b : d) - a) | 0 - : 0; - } - function Dg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - a: { - b = F[(a + 32) >> 2]; - f = F[(b + 8) >> 2]; - h = F[(b + 12) >> 2]; - g = F[(b + 20) >> 2]; - c = F[(b + 16) >> 2]; - e = 0; - b: { - if ( - (((h | 0) <= (g | 0)) & (c >>> 0 >= f >>> 0)) | - ((g | 0) > (h | 0)) - ) { - break b; - } - f = G[(F[b >> 2] + c) | 0]; - e = b; - b = g; - c = (c + 1) | 0; - b = c ? b : (b + 1) | 0; - F[(e + 16) >> 2] = c; - F[(e + 20) >> 2] = b; - c: { - if (!f) { - break c; - } - while (1) { - if ($[F[(F[a >> 2] + 16) >> 2]](a, d) | 0) { - d = (d + 1) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break c; - } - break; - } - return 0; - } - d = F[(a + 8) >> 2]; - b = F[(a + 12) >> 2]; - if ((d | 0) != (b | 0)) { - while (1) { - c = F[d >> 2]; - if ( - !( - $[F[(F[c >> 2] + 8) >> 2]](c, a, F[(a + 4) >> 2]) | - 0 - ) - ) { - break a; - } - d = (d + 4) | 0; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - d: { - if (!f) { - break d; - } - d = 0; - while (1) { - b = F[(F[(a + 8) >> 2] + (d << 2)) >> 2]; - if ( - !( - $[F[(F[b >> 2] + 12) >> 2]](b, F[(a + 32) >> 2]) | 0 - ) - ) { - break a; - } - d = (d + 1) | 0; - if ((f | 0) != (d | 0)) { - continue; - } - break; - } - if (!f) { - break d; - } - i = (a + 20) | 0; - b = 0; - while (1) { - d = 0; - j = b << 2; - c = F[(j + F[(a + 8) >> 2]) >> 2]; - k = $[F[(F[c >> 2] + 24) >> 2]](c) | 0; - if ((k | 0) > 0) { - while (1) { - c = F[(F[(a + 8) >> 2] + j) >> 2]; - c = $[F[(F[c >> 2] + 20) >> 2]](c, d) | 0; - e = F[(a + 20) >> 2]; - g = (F[(a + 24) >> 2] - e) >> 2; - e: { - if (c >>> 0 < g >>> 0) { - break e; - } - h = (c + 1) | 0; - if (h >>> 0 > g >>> 0) { - qa(i, (h - g) | 0); - e = F[i >> 2]; - break e; - } - if (g >>> 0 <= h >>> 0) { - break e; - } - F[(a + 24) >> 2] = (h << 2) + e; - } - F[((c << 2) + e) >> 2] = b; - d = (d + 1) | 0; - if ((k | 0) != (d | 0)) { - continue; - } - break; - } - } - b = (b + 1) | 0; - if ((f | 0) != (b | 0)) { - continue; - } - break; - } - } - e = 0; - if (!($[F[(F[a >> 2] + 28) >> 2]](a) | 0)) { - break b; - } - e = $[F[(F[a >> 2] + 32) >> 2]](a) | 0; - } - return e | 0; - } - return 0; - } - function Ye(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - Oc(a, b, c); - c = F[(a + 84) >> 2]; - d = (F[(a + 88) >> 2] - c) >> 2; - a: { - if ((d | 0) > (b | 0)) { - break a; - } - b = (b + 1) | 0; - if (b >>> 0 > d >>> 0) { - b: { - d = (b - d) | 0; - e = F[(a + 92) >> 2]; - c = F[(a + 88) >> 2]; - if (d >>> 0 <= ((e - c) >> 2) >>> 0) { - c: { - if (!d) { - break c; - } - b = c; - e = d & 7; - if (e) { - while (1) { - F[b >> 2] = 1; - b = (b + 4) | 0; - f = (f + 1) | 0; - if ((e | 0) != (f | 0)) { - continue; - } - break; - } - } - c = ((d << 2) + c) | 0; - if (((d - 1) & 1073741823) >>> 0 < 7) { - break c; - } - while (1) { - F[(b + 24) >> 2] = 1; - F[(b + 28) >> 2] = 1; - F[(b + 16) >> 2] = 1; - F[(b + 20) >> 2] = 1; - F[(b + 8) >> 2] = 1; - F[(b + 12) >> 2] = 1; - F[b >> 2] = 1; - F[(b + 4) >> 2] = 1; - b = (b + 32) | 0; - if ((c | 0) != (b | 0)) { - continue; - } - break; - } - } - F[(a + 88) >> 2] = c; - break b; - } - d: { - b = c; - c = F[(a + 84) >> 2]; - i = (b - c) | 0; - g = i >> 2; - b = (g + d) | 0; - if (b >>> 0 < 1073741824) { - e = (e - c) | 0; - h = (e >>> 1) | 0; - e = - e >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 < h >>> 0 - ? h - : b; - if (e) { - if (e >>> 0 >= 1073741824) { - break d; - } - j = ka(e << 2); - } - g = ((g << 2) + j) | 0; - b = g; - h = d & 7; - if (h) { - while (1) { - F[b >> 2] = 1; - b = (b + 4) | 0; - f = (f + 1) | 0; - if ((h | 0) != (f | 0)) { - continue; - } - break; - } - } - f = (g + (d << 2)) | 0; - if (((d - 1) & 1073741823) >>> 0 >= 7) { - while (1) { - F[(b + 24) >> 2] = 1; - F[(b + 28) >> 2] = 1; - F[(b + 16) >> 2] = 1; - F[(b + 20) >> 2] = 1; - F[(b + 8) >> 2] = 1; - F[(b + 12) >> 2] = 1; - F[b >> 2] = 1; - F[(b + 4) >> 2] = 1; - b = (b + 32) | 0; - if ((f | 0) != (b | 0)) { - continue; - } - break; - } - } - b = pa(j, c, i); - F[(a + 88) >> 2] = f; - F[(a + 84) >> 2] = b; - F[(a + 92) >> 2] = b + (e << 2); - if (c) { - ja(c); - } - break b; - } - na(); - v(); - } - oa(); - v(); - } - return; - } - if (b >>> 0 >= d >>> 0) { - break a; - } - F[(a + 88) >> 2] = c + (b << 2); - } - } - function ab(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - d = F[(a + 8) >> 2]; - e = F[(a + 4) >> 2]; - if (((d - e) >> 2) >>> 0 >= b >>> 0) { - a: { - if (!b) { - break a; - } - d = e; - g = b & 7; - if (g) { - while (1) { - F[d >> 2] = F[c >> 2]; - d = (d + 4) | 0; - f = (f + 1) | 0; - if ((g | 0) != (f | 0)) { - continue; - } - break; - } - } - e = ((b << 2) + e) | 0; - if (((b - 1) & 1073741823) >>> 0 < 7) { - break a; - } - while (1) { - F[d >> 2] = F[c >> 2]; - F[(d + 4) >> 2] = F[c >> 2]; - F[(d + 8) >> 2] = F[c >> 2]; - F[(d + 12) >> 2] = F[c >> 2]; - F[(d + 16) >> 2] = F[c >> 2]; - F[(d + 20) >> 2] = F[c >> 2]; - F[(d + 24) >> 2] = F[c >> 2]; - F[(d + 28) >> 2] = F[c >> 2]; - d = (d + 32) | 0; - if ((e | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = e; - return; - } - b: { - i = F[a >> 2]; - f = (e - i) >> 2; - h = (f + b) | 0; - if (h >>> 0 < 1073741824) { - j = (d - i) | 0; - d = (j >>> 1) | 0; - h = - j >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 > h >>> 0 - ? d - : h; - if (h) { - if (h >>> 0 >= 1073741824) { - break b; - } - k = ka(h << 2); - } - f = ((f << 2) + k) | 0; - d = f; - j = b & 7; - if (j) { - while (1) { - F[d >> 2] = F[c >> 2]; - d = (d + 4) | 0; - g = (g + 1) | 0; - if ((j | 0) != (g | 0)) { - continue; - } - break; - } - } - g = ((b << 2) + f) | 0; - if (((b - 1) & 1073741823) >>> 0 >= 7) { - while (1) { - F[d >> 2] = F[c >> 2]; - F[(d + 4) >> 2] = F[c >> 2]; - F[(d + 8) >> 2] = F[c >> 2]; - F[(d + 12) >> 2] = F[c >> 2]; - F[(d + 16) >> 2] = F[c >> 2]; - F[(d + 20) >> 2] = F[c >> 2]; - F[(d + 24) >> 2] = F[c >> 2]; - F[(d + 28) >> 2] = F[c >> 2]; - d = (d + 32) | 0; - if ((g | 0) != (d | 0)) { - continue; - } - break; - } - } - if ((e | 0) != (i | 0)) { - while (1) { - f = (f - 4) | 0; - e = (e - 4) | 0; - F[f >> 2] = F[e >> 2]; - if ((e | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(a + 8) >> 2] = (h << 2) + k; - F[(a + 4) >> 2] = g; - F[a >> 2] = f; - if (i) { - ja(i); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function Xb(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - d = F[(a + 8) >> 2]; - e = F[a >> 2]; - if (((d - e) >> 2) >>> 0 >= b >>> 0) { - f = F[(a + 4) >> 2]; - h = (f - e) >> 2; - i = b >>> 0 > h >>> 0 ? h : b; - a: { - if (!i) { - break a; - } - d = e; - g = i; - j = g & 7; - if (j) { - while (1) { - F[d >> 2] = F[c >> 2]; - g = (g - 1) | 0; - d = (d + 4) | 0; - k = (k + 1) | 0; - if ((k | 0) != (j | 0)) { - continue; - } - break; - } - } - if (i >>> 0 < 8) { - break a; - } - while (1) { - F[d >> 2] = F[c >> 2]; - F[(d + 4) >> 2] = F[c >> 2]; - F[(d + 8) >> 2] = F[c >> 2]; - F[(d + 12) >> 2] = F[c >> 2]; - F[(d + 16) >> 2] = F[c >> 2]; - F[(d + 20) >> 2] = F[c >> 2]; - F[(d + 24) >> 2] = F[c >> 2]; - F[(d + 28) >> 2] = F[c >> 2]; - d = (d + 32) | 0; - g = (g - 8) | 0; - if (g) { - continue; - } - break; - } - } - if (b >>> 0 > h >>> 0) { - b = (((b - h) << 2) + f) | 0; - while (1) { - F[f >> 2] = F[c >> 2]; - f = (f + 4) | 0; - if ((b | 0) != (f | 0)) { - continue; - } - break; - } - F[(a + 4) >> 2] = b; - return; - } - F[(a + 4) >> 2] = e + (b << 2); - return; - } - if (e) { - F[(a + 4) >> 2] = e; - ja(e); - F[(a + 8) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - d = 0; - } - b: { - if (b >>> 0 >= 1073741824) { - break b; - } - e = (d >>> 1) | 0; - d = - d >>> 0 >= 2147483644 - ? 1073741823 - : b >>> 0 < e >>> 0 - ? e - : b; - if (d >>> 0 >= 1073741824) { - break b; - } - d = d << 2; - e = ka(d); - F[a >> 2] = e; - F[(a + 8) >> 2] = d + e; - c = F[c >> 2]; - d = e; - g = b & 7; - if (g) { - while (1) { - F[d >> 2] = c; - d = (d + 4) | 0; - f = (f + 1) | 0; - if ((g | 0) != (f | 0)) { - continue; - } - break; - } - } - e = (e + (b << 2)) | 0; - if (((b - 1) & 1073741823) >>> 0 >= 7) { - while (1) { - F[(d + 28) >> 2] = c; - F[(d + 24) >> 2] = c; - F[(d + 20) >> 2] = c; - F[(d + 16) >> 2] = c; - F[(d + 12) >> 2] = c; - F[(d + 8) >> 2] = c; - F[(d + 4) >> 2] = c; - F[d >> 2] = c; - d = (d + 32) | 0; - if ((e | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = e; - return; - } - na(); - v(); - } - function Ka(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - f = ((c >>> 0) / 3) | 0; - j = - F[ - (((F[(F[(a + 8) >> 2] + 96) >> 2] + L(f, 12)) | 0) + - ((c - L(f, 3)) << 2)) >> - 2 - ]; - a: { - h = F[(F[(a + 12) >> 2] + 4) >> 2]; - e = F[(h + 4) >> 2]; - if ((e | 0) != F[(h + 8) >> 2]) { - F[e >> 2] = j; - F[(h + 4) >> 2] = e + 4; - break a; - } - b: { - i = F[h >> 2]; - f = (e - i) | 0; - g = f >> 2; - d = (g + 1) | 0; - if (d >>> 0 < 1073741824) { - k = g << 2; - g = (f >>> 1) | 0; - g = - f >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 < g >>> 0 - ? g - : d; - if (g) { - if (g >>> 0 >= 1073741824) { - break b; - } - f = ka(g << 2); - } else { - f = 0; - } - d = (k + f) | 0; - F[d >> 2] = j; - j = (d + 4) | 0; - if ((e | 0) != (i | 0)) { - while (1) { - d = (d - 4) | 0; - e = (e - 4) | 0; - F[d >> 2] = F[e >> 2]; - if ((e | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(h + 8) >> 2] = f + (g << 2); - F[(h + 4) >> 2] = j; - F[h >> 2] = d; - if (i) { - ja(i); - } - break a; - } - na(); - v(); - } - oa(); - v(); - } - c: { - d: { - h = F[(a + 4) >> 2]; - e = F[(h + 4) >> 2]; - e: { - if ((e | 0) != F[(h + 8) >> 2]) { - F[e >> 2] = c; - F[(h + 4) >> 2] = e + 4; - break e; - } - i = F[h >> 2]; - f = (e - i) | 0; - j = f >> 2; - d = (j + 1) | 0; - if (d >>> 0 >= 1073741824) { - break d; - } - g = (f >>> 1) | 0; - g = - f >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 < g >>> 0 - ? g - : d; - if (g) { - if (g >>> 0 >= 1073741824) { - break c; - } - f = ka(g << 2); - } else { - f = 0; - } - d = (f + (j << 2)) | 0; - F[d >> 2] = c; - c = (d + 4) | 0; - if ((e | 0) != (i | 0)) { - while (1) { - d = (d - 4) | 0; - e = (e - 4) | 0; - F[d >> 2] = F[e >> 2]; - if ((e | 0) != (i | 0)) { - continue; - } - break; - } - } - F[(h + 8) >> 2] = f + (g << 2); - F[(h + 4) >> 2] = c; - F[h >> 2] = d; - if (!i) { - break e; - } - ja(i); - } - a = F[(a + 4) >> 2]; - F[(F[(a + 12) >> 2] + (b << 2)) >> 2] = F[(a + 24) >> 2]; - F[(a + 24) >> 2] = F[(a + 24) >> 2] + 1; - return; - } - na(); - v(); - } - oa(); - v(); - } - function pb(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - h = (d - c) | 0; - if ((h | 0) <= 0) { - return; - } - a: { - e = F[(a + 8) >> 2]; - i = F[(a + 4) >> 2]; - if (((e - i) | 0) >= (h | 0)) { - j = (i - b) | 0; - if ((j | 0) >= (h | 0)) { - f = i; - g = d; - break a; - } - f = i; - g = (c + j) | 0; - if ((g | 0) != (d | 0)) { - e = g; - while (1) { - D[f | 0] = G[e | 0]; - f = (f + 1) | 0; - e = (e + 1) | 0; - if ((e | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = f; - if ((j | 0) > 0) { - break a; - } - return; - } - k = F[a >> 2]; - g = (((i - k) | 0) + h) | 0; - if ((g | 0) >= 0) { - j = (b - k) | 0; - f = (e - k) | 0; - e = f << 1; - f = - f >>> 0 >= 1073741823 - ? 2147483647 - : e >>> 0 > g >>> 0 - ? e - : g; - if (f) { - e = ka(f); - } else { - e = 0; - } - g = (j + e) | 0; - if ((c | 0) != (d | 0)) { - g = (la(g, c, h) + h) | 0; - } - d = pa(e, k, j); - c = (i - b) | 0; - b = pa(g, b, c); - F[(a + 8) >> 2] = e + f; - F[(a + 4) >> 2] = b + c; - F[a >> 2] = d; - if (k) { - ja(k); - } - return; - } - na(); - v(); - } - e = f; - d = (e - h) | 0; - if (i >>> 0 > d >>> 0) { - while (1) { - D[e | 0] = G[d | 0]; - e = (e + 1) | 0; - d = (d + 1) | 0; - if (i >>> 0 > d >>> 0) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = e; - a = (b + h) | 0; - if ((a | 0) != (f | 0)) { - a = (f - a) | 0; - pa((f - a) | 0, b, a); - } - if ((c | 0) == (g | 0)) { - return; - } - f = ((c ^ -1) + g) | 0; - a = (g - c) & 7; - b: { - if (!a) { - e = b; - break b; - } - d = 0; - e = b; - while (1) { - D[e | 0] = G[c | 0]; - e = (e + 1) | 0; - c = (c + 1) | 0; - d = (d + 1) | 0; - if ((a | 0) != (d | 0)) { - continue; - } - break; - } - } - if (f >>> 0 < 7) { - return; - } - while (1) { - D[e | 0] = G[c | 0]; - D[(e + 1) | 0] = G[(c + 1) | 0]; - D[(e + 2) | 0] = G[(c + 2) | 0]; - D[(e + 3) | 0] = G[(c + 3) | 0]; - D[(e + 4) | 0] = G[(c + 4) | 0]; - D[(e + 5) | 0] = G[(c + 5) | 0]; - D[(e + 6) | 0] = G[(c + 6) | 0]; - D[(e + 7) | 0] = G[(c + 7) | 0]; - e = (e + 8) | 0; - c = (c + 8) | 0; - if ((g | 0) != (c | 0)) { - continue; - } - break; - } - } - function la(a, b, c) { - var d = 0, - e = 0, - f = 0; - if (c >>> 0 >= 512) { - Y(a | 0, b | 0, c | 0); - return a; - } - e = (a + c) | 0; - a: { - if (!((a ^ b) & 3)) { - b: { - if (!(a & 3)) { - c = a; - break b; - } - if (!c) { - c = a; - break b; - } - c = a; - while (1) { - D[c | 0] = G[b | 0]; - b = (b + 1) | 0; - c = (c + 1) | 0; - if (!(c & 3)) { - break b; - } - if (c >>> 0 < e >>> 0) { - continue; - } - break; - } - } - d = e & -4; - c: { - if (d >>> 0 < 64) { - break c; - } - f = (d + -64) | 0; - if (f >>> 0 < c >>> 0) { - break c; - } - while (1) { - F[c >> 2] = F[b >> 2]; - F[(c + 4) >> 2] = F[(b + 4) >> 2]; - F[(c + 8) >> 2] = F[(b + 8) >> 2]; - F[(c + 12) >> 2] = F[(b + 12) >> 2]; - F[(c + 16) >> 2] = F[(b + 16) >> 2]; - F[(c + 20) >> 2] = F[(b + 20) >> 2]; - F[(c + 24) >> 2] = F[(b + 24) >> 2]; - F[(c + 28) >> 2] = F[(b + 28) >> 2]; - F[(c + 32) >> 2] = F[(b + 32) >> 2]; - F[(c + 36) >> 2] = F[(b + 36) >> 2]; - F[(c + 40) >> 2] = F[(b + 40) >> 2]; - F[(c + 44) >> 2] = F[(b + 44) >> 2]; - F[(c + 48) >> 2] = F[(b + 48) >> 2]; - F[(c + 52) >> 2] = F[(b + 52) >> 2]; - F[(c + 56) >> 2] = F[(b + 56) >> 2]; - F[(c + 60) >> 2] = F[(b + 60) >> 2]; - b = (b - -64) | 0; - c = (c - -64) | 0; - if (f >>> 0 >= c >>> 0) { - continue; - } - break; - } - } - if (c >>> 0 >= d >>> 0) { - break a; - } - while (1) { - F[c >> 2] = F[b >> 2]; - b = (b + 4) | 0; - c = (c + 4) | 0; - if (d >>> 0 > c >>> 0) { - continue; - } - break; - } - break a; - } - if (e >>> 0 < 4) { - c = a; - break a; - } - d = (e - 4) | 0; - if (d >>> 0 < a >>> 0) { - c = a; - break a; - } - c = a; - while (1) { - D[c | 0] = G[b | 0]; - D[(c + 1) | 0] = G[(b + 1) | 0]; - D[(c + 2) | 0] = G[(b + 2) | 0]; - D[(c + 3) | 0] = G[(b + 3) | 0]; - b = (b + 4) | 0; - c = (c + 4) | 0; - if (d >>> 0 >= c >>> 0) { - continue; - } - break; - } - } - if (c >>> 0 < e >>> 0) { - while (1) { - D[c | 0] = G[b | 0]; - b = (b + 1) | 0; - c = (c + 1) | 0; - if ((e | 0) != (c | 0)) { - continue; - } - break; - } - } - return a; - } - function sd(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0; - F[a >> 2] = 8336; - d = (a + 232) | 0; - b = F[(d + 196) >> 2]; - if (b) { - F[(d + 200) >> 2] = b; - ja(b); - } - c = F[(d + 184) >> 2]; - if (c) { - b = c; - e = F[(d + 188) >> 2]; - if ((b | 0) != (e | 0)) { - while (1) { - b = (e - 12) | 0; - f = F[b >> 2]; - if (f) { - F[(e - 8) >> 2] = f; - ja(f); - } - e = b; - if ((b | 0) != (c | 0)) { - continue; - } - break; - } - b = F[(d + 184) >> 2]; - } - F[(d + 188) >> 2] = c; - ja(b); - } - b = F[(d + 156) >> 2]; - if (b) { - F[(d + 160) >> 2] = b; - ja(b); - } - c = F[(d + 136) >> 2]; - F[(d + 136) >> 2] = 0; - if (c) { - e = (c - 4) | 0; - b = F[e >> 2]; - if (b) { - b = (c + (b << 4)) | 0; - while (1) { - b = (b - 16) | 0; - if ((c | 0) != (b | 0)) { - continue; - } - break; - } - } - ja(e); - } - td((a + 216) | 0); - b = F[(a + 196) >> 2]; - if (b) { - F[(a + 200) >> 2] = b; - ja(b); - } - b = F[(a + 184) >> 2]; - if (b) { - F[(a + 188) >> 2] = b; - ja(b); - } - b = F[(a + 172) >> 2]; - if (b) { - F[(a + 176) >> 2] = b; - ja(b); - } - b = F[(a + 160) >> 2]; - if (b) { - F[(a + 164) >> 2] = b; - ja(b); - } - b = F[(a + 144) >> 2]; - if (b) { - while (1) { - c = F[b >> 2]; - ja(b); - b = c; - if (b) { - continue; - } - break; - } - } - b = F[(a + 136) >> 2]; - F[(a + 136) >> 2] = 0; - if (b) { - ja(b); - } - b = F[(a + 120) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 108) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 96) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - F[(a + 76) >> 2] = b; - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - b = F[(a + 36) >> 2]; - if (b) { - F[(a + 40) >> 2] = b; - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - F[(a + 28) >> 2] = b; - ja(b); - } - b = F[(a + 12) >> 2]; - if (b) { - F[(a + 16) >> 2] = b; - ja(b); - } - b = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = 0; - if (b) { - Za(b); - } - return a | 0; - } - function Fa(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - d = F[(a + 8) >> 2]; - e = F[(a + 4) >> 2]; - if (((d - e) >> 2) >>> 0 >= b >>> 0) { - a: { - if (!b) { - break a; - } - d = e; - f = b & 7; - if (f) { - while (1) { - F[d >> 2] = F[c >> 2]; - d = (d + 4) | 0; - h = (h + 1) | 0; - if ((f | 0) != (h | 0)) { - continue; - } - break; - } - } - e = ((b << 2) + e) | 0; - if (((b - 1) & 1073741823) >>> 0 < 7) { - break a; - } - while (1) { - F[d >> 2] = F[c >> 2]; - F[(d + 4) >> 2] = F[c >> 2]; - F[(d + 8) >> 2] = F[c >> 2]; - F[(d + 12) >> 2] = F[c >> 2]; - F[(d + 16) >> 2] = F[c >> 2]; - F[(d + 20) >> 2] = F[c >> 2]; - F[(d + 24) >> 2] = F[c >> 2]; - F[(d + 28) >> 2] = F[c >> 2]; - d = (d + 32) | 0; - if ((e | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = e; - return; - } - b: { - i = F[a >> 2]; - j = (e - i) | 0; - f = j >> 2; - g = (f + b) | 0; - if (g >>> 0 < 1073741824) { - d = (d - i) | 0; - e = (d >>> 1) | 0; - g = - d >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 > g >>> 0 - ? e - : g; - if (g) { - if (g >>> 0 >= 1073741824) { - break b; - } - k = ka(g << 2); - } - f = ((f << 2) + k) | 0; - d = f; - e = b & 7; - if (e) { - while (1) { - F[d >> 2] = F[c >> 2]; - d = (d + 4) | 0; - h = (h + 1) | 0; - if ((e | 0) != (h | 0)) { - continue; - } - break; - } - } - e = (f + (b << 2)) | 0; - if (((b - 1) & 1073741823) >>> 0 >= 7) { - while (1) { - F[d >> 2] = F[c >> 2]; - F[(d + 4) >> 2] = F[c >> 2]; - F[(d + 8) >> 2] = F[c >> 2]; - F[(d + 12) >> 2] = F[c >> 2]; - F[(d + 16) >> 2] = F[c >> 2]; - F[(d + 20) >> 2] = F[c >> 2]; - F[(d + 24) >> 2] = F[c >> 2]; - F[(d + 28) >> 2] = F[c >> 2]; - d = (d + 32) | 0; - if ((e | 0) != (d | 0)) { - continue; - } - break; - } - } - b = pa(k, i, j); - F[(a + 4) >> 2] = e; - F[a >> 2] = b; - F[(a + 8) >> 2] = b + (g << 2); - if (i) { - ja(i); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function Sb(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - if ((G[(a + 11) | 0] >>> 7) | 0) { - d = F[(a + 4) >> 2]; - } else { - d = G[(a + 11) | 0] & 127; - } - if (d >>> 0 < b >>> 0) { - h = (Z - 16) | 0; - Z = h; - b = (b - d) | 0; - if (b) { - g = - (G[(a + 11) | 0] >>> 7) | 0 - ? ((F[(a + 8) >> 2] & 2147483647) - 1) | 0 - : 10; - if ((G[(a + 11) | 0] >>> 7) | 0) { - d = F[(a + 4) >> 2]; - } else { - d = G[(a + 11) | 0] & 127; - } - i = (d + b) | 0; - if ((g - d) >>> 0 < b >>> 0) { - a: { - e = (Z - 16) | 0; - Z = e; - c = (i - g) | 0; - if (c >>> 0 <= (2147483631 - g) >>> 0) { - if ((G[(a + 11) | 0] >>> 7) | 0) { - f = F[a >> 2]; - } else { - f = a; - } - if (g >>> 0 < 1073741799) { - F[(e + 12) >> 2] = g << 1; - F[e >> 2] = c + g; - c = (Z - 16) | 0; - Z = c; - Z = (c + 16) | 0; - c = (e + 12) | 0; - c = F[(I[e >> 2] < I[c >> 2] ? c : e) >> 2]; - if (c >>> 0 >= 11) { - j = (c + 16) & -16; - c = (j - 1) | 0; - c = (c | 0) == 11 ? j : c; - } else { - c = 10; - } - c = (c + 1) | 0; - } else { - c = 2147483631; - } - sb(e, c); - c = F[e >> 2]; - if (d) { - db(c, f, d); - } - if ((g | 0) != 10) { - ja(f); - } - F[a >> 2] = c; - F[(a + 8) >> 2] = - (F[(a + 8) >> 2] & -2147483648) | - (F[(e + 4) >> 2] & 2147483647); - F[(a + 8) >> 2] = F[(a + 8) >> 2] | -2147483648; - Z = (e + 16) | 0; - break a; - } - za(); - v(); - } - } - f = d; - if ((G[(a + 11) | 0] >>> 7) | 0) { - d = F[a >> 2]; - } else { - d = a; - } - f = (f + d) | 0; - e = (Z - 16) | 0; - Z = e; - D[(e + 15) | 0] = 0; - while (1) { - if (b) { - D[f | 0] = G[(e + 15) | 0]; - b = (b - 1) | 0; - f = (f + 1) | 0; - continue; - } - break; - } - Z = (e + 16) | 0; - Ic(a, i); - D[(h + 15) | 0] = 0; - D[(d + i) | 0] = G[(h + 15) | 0]; - } - Z = (h + 16) | 0; - return; - } - if ((G[(a + 11) | 0] >>> 7) | 0) { - d = F[a >> 2]; - } else { - d = a; - } - f = (Z - 16) | 0; - Z = f; - Ic(a, b); - D[(f + 15) | 0] = 0; - D[(b + d) | 0] = G[(f + 15) | 0]; - Z = (f + 16) | 0; - } - function Zc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - g = (Z - 16) | 0; - Z = g; - a: { - b: { - if (b) { - F[(a + 88) >> 2] = 0; - F[(a + 92) >> 2] = 0; - d = F[(a + 84) >> 2]; - F[(a + 84) >> 2] = 0; - if (d) { - ja(d); - } - F[(a + 76) >> 2] = 0; - F[(a + 80) >> 2] = 0; - d = F[(a + 72) >> 2]; - F[(a + 72) >> 2] = 0; - if (d) { - ja(d); - } - d = F[b >> 2]; - c = F[(b + 4) >> 2]; - D[(g + 15) | 0] = 0; - Ea(a, (c - d) >> 2, (g + 15) | 0); - d = F[(b + 28) >> 2]; - c = F[(b + 24) >> 2]; - D[(g + 14) | 0] = 0; - Ea((a + 12) | 0, (d - c) >> 2, (g + 14) | 0); - Xb( - (a + 28) | 0, - (F[(b + 4) >> 2] - F[b >> 2]) >> 2, - 10284, - ); - c = (F[(b + 28) >> 2] - F[(b + 24) >> 2]) | 0; - f = c >> 2; - e = F[(a + 52) >> 2]; - c: { - if (f >>> 0 <= ((F[(a + 60) >> 2] - e) >> 2) >>> 0) { - break c; - } - if ((c | 0) < 0) { - break b; - } - d = F[(a + 56) >> 2]; - c = ka(c); - f = (c + (f << 2)) | 0; - h = (c + ((d - e) & -4)) | 0; - c = h; - if ((d | 0) != (e | 0)) { - while (1) { - c = (c - 4) | 0; - d = (d - 4) | 0; - F[c >> 2] = F[d >> 2]; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - F[(a + 60) >> 2] = f; - F[(a + 56) >> 2] = h; - F[(a + 52) >> 2] = c; - if (!e) { - break c; - } - ja(e); - } - c = (F[(b + 28) >> 2] - F[(b + 24) >> 2]) | 0; - f = c >> 2; - e = F[(a + 40) >> 2]; - d: { - if (f >>> 0 <= ((F[(a + 48) >> 2] - e) >> 2) >>> 0) { - break d; - } - if ((c | 0) < 0) { - break a; - } - d = F[(a + 44) >> 2]; - c = ka(c); - f = (c + (f << 2)) | 0; - h = (c + ((d - e) & -4)) | 0; - c = h; - if ((d | 0) != (e | 0)) { - while (1) { - c = (c - 4) | 0; - d = (d - 4) | 0; - F[c >> 2] = F[d >> 2]; - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - F[(a + 48) >> 2] = f; - F[(a + 44) >> 2] = h; - F[(a + 40) >> 2] = c; - if (!e) { - break d; - } - ja(e); - } - D[(a + 24) | 0] = 1; - F[(a + 64) >> 2] = b; - } - Z = (g + 16) | 0; - return; - } - na(); - v(); - } - na(); - v(); - } - function nb(a, b) { - var c = 0, - d = 0, - e = 0; - c = (a | 0) == (b | 0); - D[(b + 12) | 0] = c; - a: { - if (c) { - break a; - } - while (1) { - d = F[(b + 8) >> 2]; - if (G[(d + 12) | 0]) { - break a; - } - b: { - c = F[(d + 8) >> 2]; - e = F[c >> 2]; - if ((e | 0) == (d | 0)) { - e = F[(c + 4) >> 2]; - if (!(!e | G[(e + 12) | 0])) { - break b; - } - c: { - if (F[d >> 2] == (b | 0)) { - b = d; - break c; - } - b = F[(d + 4) >> 2]; - a = F[b >> 2]; - F[(d + 4) >> 2] = a; - if (a) { - F[(a + 8) >> 2] = d; - c = F[(d + 8) >> 2]; - } - F[(b + 8) >> 2] = c; - a = F[(d + 8) >> 2]; - F[(((F[a >> 2] != (d | 0)) << 2) + a) >> 2] = b; - F[b >> 2] = d; - F[(d + 8) >> 2] = b; - c = F[(b + 8) >> 2]; - d = F[c >> 2]; - } - D[(b + 12) | 0] = 1; - D[(c + 12) | 0] = 0; - a = F[(d + 4) >> 2]; - F[c >> 2] = a; - if (a) { - F[(a + 8) >> 2] = c; - } - F[(d + 8) >> 2] = F[(c + 8) >> 2]; - a = F[(c + 8) >> 2]; - F[(((F[a >> 2] != (c | 0)) << 2) + a) >> 2] = d; - F[(d + 4) >> 2] = c; - F[(c + 8) >> 2] = d; - return; - } - if (!(G[(e + 12) | 0] | !e)) { - break b; - } - d: { - if (F[d >> 2] != (b | 0)) { - b = d; - break d; - } - a = F[(b + 4) >> 2]; - F[d >> 2] = a; - if (a) { - F[(a + 8) >> 2] = d; - c = F[(d + 8) >> 2]; - } - F[(b + 8) >> 2] = c; - a = F[(d + 8) >> 2]; - F[(((F[a >> 2] != (d | 0)) << 2) + a) >> 2] = b; - F[(b + 4) >> 2] = d; - F[(d + 8) >> 2] = b; - c = F[(b + 8) >> 2]; - } - D[(b + 12) | 0] = 1; - D[(c + 12) | 0] = 0; - a = F[(c + 4) >> 2]; - b = F[a >> 2]; - F[(c + 4) >> 2] = b; - if (b) { - F[(b + 8) >> 2] = c; - } - F[(a + 8) >> 2] = F[(c + 8) >> 2]; - b = F[(c + 8) >> 2]; - F[(((F[b >> 2] != (c | 0)) << 2) + b) >> 2] = a; - F[a >> 2] = c; - F[(c + 8) >> 2] = a; - break a; - } - D[(d + 12) | 0] = 1; - D[(c + 12) | 0] = (a | 0) == (c | 0); - D[(e + 12) | 0] = 1; - b = c; - if ((c | 0) != (a | 0)) { - continue; - } - break; - } - } - } - function mi(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - a: { - b: { - c: { - d: { - e: { - f: { - g: { - h: { - i: { - j: { - k: { - if (b) { - if (!c) { - break k; - } - if (!d) { - break j; - } - e = (O(d) - O(b)) | 0; - if (e >>> 0 <= 31) { - break i; - } - break c; - } - if (((d | 0) == 1) | (d >>> 0 > 1)) { - break c; - } - _ = 0; - a = ((a >>> 0) / (c >>> 0)) | 0; - break a; - } - if (!a) { - break h; - } - if (!d | ((d - 1) & d)) { - break g; - } - a = (b >>> ji(d)) | 0; - _ = 0; - break a; - } - if (!((c - 1) & c)) { - break f; - } - h = (((O(c) + 33) | 0) - O(b)) | 0; - g = (0 - h) | 0; - break d; - } - h = (e + 1) | 0; - g = (63 - e) | 0; - break d; - } - _ = 0; - a = ((b >>> 0) / (d >>> 0)) | 0; - break a; - } - e = (O(d) - O(b)) | 0; - if (e >>> 0 < 31) { - break e; - } - break c; - } - if ((c | 0) == 1) { - break b; - } - d = ji(c); - c = d & 31; - if ((d & 63) >>> 0 >= 32) { - a = (b >>> c) | 0; - } else { - e = (b >>> c) | 0; - a = ((((1 << c) - 1) & b) << (32 - c)) | (a >>> c); - } - _ = e; - break a; - } - h = (e + 1) | 0; - g = (63 - e) | 0; - } - e = h & 63; - f = e & 31; - if (e >>> 0 >= 32) { - e = 0; - i = (b >>> f) | 0; - } else { - e = (b >>> f) | 0; - i = ((((1 << f) - 1) & b) << (32 - f)) | (a >>> f); - } - g = g & 63; - f = g & 31; - if (g >>> 0 >= 32) { - b = a << f; - a = 0; - } else { - b = (((1 << f) - 1) & (a >>> (32 - f))) | (b << f); - a = a << f; - } - if (h) { - f = (d - 1) | 0; - g = (c - 1) | 0; - m = (g | 0) != -1 ? (f + 1) | 0 : f; - while (1) { - j = (e << 1) | (i >>> 31); - e = (i << 1) | (b >>> 31); - f = (m - ((j + (e >>> 0 > g >>> 0)) | 0)) >> 31; - k = c & f; - i = (e - k) | 0; - e = (j - (((d & f) + (e >>> 0 < k >>> 0)) | 0)) | 0; - b = (b << 1) | (a >>> 31); - a = l | (a << 1); - l = f & 1; - h = (h - 1) | 0; - if (h) { - continue; - } - break; - } - } - _ = (b << 1) | (a >>> 31); - a = l | (a << 1); - break a; - } - a = 0; - b = 0; - } - _ = b; - } - return a; - } - function yh(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - c = F[(b + 88) >> 2]; - if (!(!c | (F[c >> 2] != 1))) { - e = F[(c + 8) >> 2]; - F[(a + 4) >> 2] = - G[e | 0] | - (G[(e + 1) | 0] << 8) | - ((G[(e + 2) | 0] << 16) | (G[(e + 3) | 0] << 24)); - f = (a + 8) | 0; - d = G[(b + 24) | 0]; - h = F[(a + 8) >> 2]; - g = (F[(a + 12) >> 2] - h) >> 2; - a: { - if (d >>> 0 > g >>> 0) { - qa(f, (d - g) | 0); - d = G[(b + 24) | 0]; - e = F[(c + 8) >> 2]; - break a; - } - if (d >>> 0 >= g >>> 0) { - break a; - } - F[(a + 12) >> 2] = h + (d << 2); - } - b: { - if (!d) { - b = 4; - break b; - } - h = d & 3; - f = F[f >> 2]; - c: { - if ((d - 1) >>> 0 < 3) { - b = 4; - d = 0; - break c; - } - k = d & 252; - d = 0; - b = 4; - while (1) { - g = d << 2; - c = (b + e) | 0; - F[(g + f) >> 2] = - G[c | 0] | - (G[(c + 1) | 0] << 8) | - ((G[(c + 2) | 0] << 16) | (G[(c + 3) | 0] << 24)); - F[(f + (g | 4)) >> 2] = - G[(c + 4) | 0] | - (G[(c + 5) | 0] << 8) | - ((G[(c + 6) | 0] << 16) | (G[(c + 7) | 0] << 24)); - F[(f + (g | 8)) >> 2] = - G[(c + 8) | 0] | - (G[(c + 9) | 0] << 8) | - ((G[(c + 10) | 0] << 16) | (G[(c + 11) | 0] << 24)); - F[(f + (g | 12)) >> 2] = - G[(c + 12) | 0] | - (G[(c + 13) | 0] << 8) | - ((G[(c + 14) | 0] << 16) | (G[(c + 15) | 0] << 24)); - d = (d + 4) | 0; - b = (b + 16) | 0; - i = (i + 4) | 0; - if ((k | 0) != (i | 0)) { - continue; - } - break; - } - } - if (!h) { - break b; - } - while (1) { - c = (b + e) | 0; - F[(f + (d << 2)) >> 2] = - G[c | 0] | - (G[(c + 1) | 0] << 8) | - ((G[(c + 2) | 0] << 16) | (G[(c + 3) | 0] << 24)); - d = (d + 1) | 0; - b = (b + 4) | 0; - j = (j + 1) | 0; - if ((h | 0) != (j | 0)) { - continue; - } - break; - } - } - d = a; - a = (b + e) | 0; - F[(d + 20) >> 2] = - G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | (G[(a + 3) | 0] << 24)); - d = 1; - } - return d | 0; - } - function Yg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - g = (Z - 16) | 0; - Z = g; - e = F[(a + 4) >> 2]; - d = F[e >> 2]; - a: { - b = F[(a + 12) >> 2]; - c = (F[(b + 28) >> 2] - F[(b + 24) >> 2]) | 0; - f = c >> 2; - b: { - if (f >>> 0 <= ((F[(e + 8) >> 2] - d) >> 2) >>> 0) { - break b; - } - if ((c | 0) < 0) { - break a; - } - b = F[(e + 4) >> 2]; - c = ka(c); - f = (c + (f << 2)) | 0; - h = (c + ((b - d) & -4)) | 0; - c = h; - if ((b | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(e + 8) >> 2] = f; - F[(e + 4) >> 2] = h; - F[e >> 2] = c; - if (!d) { - break b; - } - ja(d); - } - b = F[(a + 12) >> 2]; - c = F[(b + 28) >> 2]; - b = F[(b + 24) >> 2]; - F[(g + 12) >> 2] = 0; - b = (c - b) >> 2; - d = (a + 96) | 0; - e = F[d >> 2]; - c = (F[(a + 100) >> 2] - e) >> 2; - c: { - if (b >>> 0 > c >>> 0) { - Fa(d, (b - c) | 0, (g + 12) | 0); - break c; - } - if (b >>> 0 >= c >>> 0) { - break c; - } - F[(a + 100) >> 2] = e + (b << 2); - } - e = (a + 8) | 0; - b = F[(a + 116) >> 2]; - d: { - if (b) { - d = F[b >> 2]; - if ((d | 0) == F[(b + 4) >> 2]) { - c = 1; - break d; - } - b = 0; - while (1) { - c = rd(e, F[((b << 2) + d) >> 2]); - if (!c) { - break d; - } - f = F[(a + 116) >> 2]; - d = F[f >> 2]; - b = (b + 1) | 0; - if (b >>> 0 < ((F[(f + 4) >> 2] - d) >> 2) >>> 0) { - continue; - } - break; - } - break d; - } - c = 1; - a = F[(a + 12) >> 2]; - a = (F[(a + 4) >> 2] - F[a >> 2]) | 0; - if (a >>> 0 < 12) { - break d; - } - a = (((a >> 2) >>> 0) / 3) | 0; - b = 0; - while (1) { - c = rd(e, L(b, 3)); - if (!c) { - break d; - } - b = (b + 1) | 0; - if ((a | 0) != (b | 0)) { - continue; - } - break; - } - } - Z = (g + 16) | 0; - return c | 0; - } - na(); - v(); - } - function md(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - a: { - b: { - c: { - if (!b) { - if ((d | 0) < 0) { - break a; - } - f = F[(a + 4) >> 2]; - b = F[a >> 2]; - d = (f - b) | 0; - if (c >>> 0 > d >>> 0) { - g = (c - d) | 0; - e = F[(a + 8) >> 2]; - if (g >>> 0 <= (e - f) >>> 0) { - (i = a), - (j = (ma(f, 0, g) + g) | 0), - (F[(i + 4) >> 2] = j); - break c; - } - if ((c | 0) < 0) { - break b; - } - f = (e - b) | 0; - e = f << 1; - f = - f >>> 0 >= 1073741823 - ? 2147483647 - : c >>> 0 < e >>> 0 - ? e - : c; - e = ka(f); - ma((e + d) | 0, 0, g); - d = pa(e, b, d); - F[(a + 8) >> 2] = d + f; - F[(a + 4) >> 2] = c + d; - F[a >> 2] = d; - if (!b) { - break c; - } - ja(b); - break c; - } - if (c >>> 0 >= d >>> 0) { - break c; - } - F[(a + 4) >> 2] = b + c; - break c; - } - if ((d | 0) < 0) { - break a; - } - e = F[(a + 4) >> 2]; - f = F[a >> 2]; - g = (e - f) | 0; - d: { - if ( - (((d | 0) <= 0) & (c >>> 0 <= g >>> 0)) | - ((d | 0) < 0) - ) { - break d; - } - if (c >>> 0 > g >>> 0) { - d = (c - g) | 0; - h = F[(a + 8) >> 2]; - if (d >>> 0 <= (h - e) >>> 0) { - (i = a), - (j = (ma(e, 0, d) + d) | 0), - (F[(i + 4) >> 2] = j); - break d; - } - if ((c | 0) < 0) { - break b; - } - e = (h - f) | 0; - h = e << 1; - e = - e >>> 0 >= 1073741823 - ? 2147483647 - : c >>> 0 < h >>> 0 - ? h - : c; - h = ka(e); - ma((h + g) | 0, 0, d); - d = pa(h, f, g); - F[(a + 8) >> 2] = d + e; - F[(a + 4) >> 2] = c + d; - F[a >> 2] = d; - if (!f) { - break d; - } - ja(f); - break d; - } - if (c >>> 0 >= g >>> 0) { - break d; - } - F[(a + 4) >> 2] = c + f; - } - if (!c) { - break c; - } - pa(F[a >> 2], b, c); - } - b = F[(a + 28) >> 2]; - c = (F[(a + 24) >> 2] + 1) | 0; - b = c ? b : (b + 1) | 0; - F[(a + 24) >> 2] = c; - F[(a + 28) >> 2] = b; - g = 1; - break a; - } - na(); - v(); - } - return g; - } - function Lg(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - k = F[(a + 12) >> 2]; - c = F[(a + 68) >> 2]; - d = F[(c + 80) >> 2]; - D[(b + 84) | 0] = 0; - n = (b + 68) | 0; - i = F[(b + 68) >> 2]; - e = (F[(b + 72) >> 2] - i) >> 2; - a: { - if (e >>> 0 < d >>> 0) { - ab(n, (d - e) | 0, 9124); - c = F[(a + 68) >> 2]; - d = F[(c + 80) >> 2]; - break a; - } - if (d >>> 0 >= e >>> 0) { - break a; - } - F[(b + 72) >> 2] = i + (d << 2); - } - b = F[(c + 100) >> 2]; - e = F[(c + 96) >> 2]; - i = (((b - e) | 0) / 12) | 0; - m = 1; - b: { - if ((b | 0) == (e | 0)) { - break b; - } - k = F[(k + 28) >> 2]; - f = F[k >> 2]; - if ((f | 0) == -1) { - return 0; - } - o = i >>> 0 <= 1 ? 1 : i; - c = e; - b = 0; - m = 0; - while (1) { - g = F[c >> 2]; - if (g >>> 0 >= d >>> 0) { - break b; - } - j = F[(F[(a + 72) >> 2] + 12) >> 2]; - h = F[(j + (f << 2)) >> 2]; - if (h >>> 0 >= d >>> 0) { - break b; - } - f = F[n >> 2]; - F[(f + (g << 2)) >> 2] = h; - g = (k + (l << 2)) | 0; - h = F[(g + 4) >> 2]; - if ((h | 0) == -1) { - break b; - } - l = F[(c + 4) >> 2]; - if (l >>> 0 >= d >>> 0) { - break b; - } - h = F[((h << 2) + j) >> 2]; - if (h >>> 0 >= d >>> 0) { - break b; - } - F[(f + (l << 2)) >> 2] = h; - g = F[(g + 8) >> 2]; - if ((g | 0) == -1) { - break b; - } - c = F[(c + 8) >> 2]; - if (c >>> 0 >= d >>> 0) { - break b; - } - j = F[((g << 2) + j) >> 2]; - if (j >>> 0 >= d >>> 0) { - break b; - } - F[(f + (c << 2)) >> 2] = j; - b = (b + 1) | 0; - m = i >>> 0 <= b >>> 0; - if ((b | 0) == (o | 0)) { - break b; - } - c = (e + L(b, 12)) | 0; - l = L(b, 3); - f = F[(k + (l << 2)) >> 2]; - if ((f | 0) != -1) { - continue; - } - break; - } - } - return m | 0; - } - function ag(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - h = F[(d + 80) >> 2]; - e = (Z - 48) | 0; - Z = e; - a = F[(a + 4) >> 2]; - m = (a - 2) | 0; - a: { - if (m >>> 0 > 28) { - break a; - } - j = (F[F[d >> 2] >> 2] + F[(d + 48) >> 2]) | 0; - F[(e + 16) >> 2] = a; - a = -1 << a; - F[(e + 20) >> 2] = a ^ -1; - a = (-2 - a) | 0; - F[(e + 24) >> 2] = a; - F[(e + 32) >> 2] = (a | 0) / 2; - J[(e + 28) >> 2] = M(2) / M(a | 0); - f = F[c >> 2]; - if ((f | 0) != F[(c + 4) >> 2]) { - a = 0; - d = 0; - while (1) { - g = F[((d << 2) + f) >> 2]; - h = (e + 36) | 0; - k = F[F[b >> 2] >> 2]; - l = F[(b + 48) >> 2]; - f = F[(b + 40) >> 2]; - i = F[(b + 44) >> 2]; - if (!G[(b + 84) | 0]) { - g = F[(F[(b + 68) >> 2] + (g << 2)) >> 2]; - } - g = ki(f, i, g, 0); - i = g; - g = (g + l) | 0; - la(h, (g + k) | 0, f); - Kc((e + 16) | 0, h, (e + 12) | 0, (e + 8) | 0); - f = a << 2; - F[(f + j) >> 2] = F[(e + 12) >> 2]; - F[((f | 4) + j) >> 2] = F[(e + 8) >> 2]; - a = (a + 2) | 0; - d = (d + 1) | 0; - f = F[c >> 2]; - if (d >>> 0 < ((F[(c + 4) >> 2] - f) >> 2) >>> 0) { - continue; - } - break; - } - break a; - } - if (!h) { - break a; - } - d = 0; - a = 0; - while (1) { - k = (e + 36) | 0; - l = F[F[b >> 2] >> 2]; - i = F[(b + 48) >> 2]; - c = F[(b + 40) >> 2]; - f = ki( - c, - F[(b + 44) >> 2], - G[(b + 84) | 0] - ? a - : F[(F[(b + 68) >> 2] + (a << 2)) >> 2], - 0, - ); - g = f; - f = (f + i) | 0; - la(k, (f + l) | 0, c); - Kc((e + 16) | 0, k, (e + 12) | 0, (e + 8) | 0); - c = d << 2; - F[(c + j) >> 2] = F[(e + 12) >> 2]; - F[((c | 4) + j) >> 2] = F[(e + 8) >> 2]; - d = (d + 2) | 0; - a = (a + 1) | 0; - if ((h | 0) != (a | 0)) { - continue; - } - break; - } - } - Z = (e + 48) | 0; - return (m >>> 0 < 29) | 0; - } - function Zg(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - c = F[(a + 12) >> 2]; - d = F[(a + 108) >> 2]; - e = F[(d + 80) >> 2]; - D[(b + 84) | 0] = 0; - m = (b + 68) | 0; - h = F[(b + 68) >> 2]; - f = (F[(b + 72) >> 2] - h) >> 2; - a: { - if (f >>> 0 < e >>> 0) { - ab(m, (e - f) | 0, 9124); - d = F[(a + 108) >> 2]; - e = F[(d + 80) >> 2]; - break a; - } - if (e >>> 0 >= f >>> 0) { - break a; - } - F[(b + 72) >> 2] = h + (e << 2); - } - b = F[(d + 100) >> 2]; - f = F[(d + 96) >> 2]; - h = (((b - f) | 0) / 12) | 0; - k = 1; - b: { - if ((b | 0) == (f | 0)) { - break b; - } - n = h >>> 0 <= 1 ? 1 : h; - o = F[c >> 2]; - c = 0; - d = f; - b = 0; - k = 0; - while (1) { - c = ((c << 2) + o) | 0; - i = F[c >> 2]; - if ((i | 0) == -1) { - break b; - } - g = F[d >> 2]; - if (g >>> 0 >= e >>> 0) { - break b; - } - l = F[(F[(a + 112) >> 2] + 12) >> 2]; - j = F[(l + (i << 2)) >> 2]; - if (j >>> 0 >= e >>> 0) { - break b; - } - i = F[m >> 2]; - F[(i + (g << 2)) >> 2] = j; - g = F[(c + 4) >> 2]; - if ((g | 0) == -1) { - break b; - } - j = F[(d + 4) >> 2]; - if (j >>> 0 >= e >>> 0) { - break b; - } - g = F[((g << 2) + l) >> 2]; - if (g >>> 0 >= e >>> 0) { - break b; - } - F[(i + (j << 2)) >> 2] = g; - c = F[(c + 8) >> 2]; - if ((c | 0) == -1) { - break b; - } - d = F[(d + 8) >> 2]; - if (d >>> 0 >= e >>> 0) { - break b; - } - c = F[((c << 2) + l) >> 2]; - if (c >>> 0 >= e >>> 0) { - break b; - } - F[(i + (d << 2)) >> 2] = c; - b = (b + 1) | 0; - k = h >>> 0 <= b >>> 0; - if ((b | 0) == (n | 0)) { - break b; - } - c = L(b, 3); - d = (f + L(b, 12)) | 0; - if ((b | 0) != 1431655765) { - continue; - } - break; - } - } - return k | 0; - } - function xd(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = M(0), - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0, - p = 0, - q = 0, - r = 0, - s = 0, - t = 0, - u = 0; - k = (Z - 16) | 0; - Z = k; - if (F[(c + 28) >> 2] == 9) { - d = F[(a + 4) >> 2]; - h = G[(c + 24) | 0]; - e = h << 2; - f = ka(e); - l = (k + 8) | 0; - F[l >> 2] = 1065353216; - i = J[(a + 20) >> 2]; - d = (-1 << d) ^ -1; - if ((d | 0) > 0) { - J[l >> 2] = i / M(d | 0); - } - o = (d | 0) > 0; - a: { - if (!o) { - break a; - } - j = F[(c + 80) >> 2]; - if (!j) { - break a; - } - if (h) { - p = (F[F[b >> 2] >> 2] + F[(b + 48) >> 2]) | 0; - t = h & 254; - u = h & 1; - b = 0; - while (1) { - m = F[(a + 8) >> 2]; - i = J[l >> 2]; - d = 0; - n = 0; - if ((h | 0) != 1) { - while (1) { - g = d << 2; - q = ((b << 2) + p) | 0; - J[(g + f) >> 2] = - M(i * M(F[q >> 2])) + J[(g + m) >> 2]; - g = g | 4; - J[(g + f) >> 2] = - M(i * M(F[(q + 4) >> 2])) + J[(g + m) >> 2]; - d = (d + 2) | 0; - b = (b + 2) | 0; - n = (n + 2) | 0; - if ((t | 0) != (n | 0)) { - continue; - } - break; - } - } - if (u) { - d = d << 2; - J[(d + f) >> 2] = - M(i * M(F[((b << 2) + p) >> 2])) + J[(d + m) >> 2]; - b = (b + 1) | 0; - } - la((F[F[(c + 64) >> 2] >> 2] + r) | 0, f, e); - r = (e + r) | 0; - s = (s + 1) | 0; - if ((s | 0) != (j | 0)) { - continue; - } - break; - } - break a; - } - b = 0; - if ((j | 0) != 1) { - a = j & -2; - d = 0; - while (1) { - la((F[F[(c + 64) >> 2] >> 2] + b) | 0, f, e); - b = (b + e) | 0; - la((b + F[F[(c + 64) >> 2] >> 2]) | 0, f, e); - b = (b + e) | 0; - d = (d + 2) | 0; - if ((a | 0) != (d | 0)) { - continue; - } - break; - } - } - if (!(j & 1)) { - break a; - } - la((F[F[(c + 64) >> 2] >> 2] + b) | 0, f, e); - } - ja(f); - } - Z = (k + 16) | 0; - return o | 0; - } - function Rg(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0, - o = 0; - c = F[(a + 12) >> 2]; - d = F[(a + 68) >> 2]; - e = F[(d + 80) >> 2]; - D[(b + 84) | 0] = 0; - m = (b + 68) | 0; - h = F[(b + 68) >> 2]; - f = (F[(b + 72) >> 2] - h) >> 2; - a: { - if (f >>> 0 < e >>> 0) { - ab(m, (e - f) | 0, 9124); - d = F[(a + 68) >> 2]; - e = F[(d + 80) >> 2]; - break a; - } - if (e >>> 0 >= f >>> 0) { - break a; - } - F[(b + 72) >> 2] = h + (e << 2); - } - b = F[(d + 100) >> 2]; - f = F[(d + 96) >> 2]; - h = (((b - f) | 0) / 12) | 0; - k = 1; - b: { - if ((b | 0) == (f | 0)) { - break b; - } - n = h >>> 0 <= 1 ? 1 : h; - o = F[c >> 2]; - c = 0; - d = f; - b = 0; - k = 0; - while (1) { - c = ((c << 2) + o) | 0; - i = F[c >> 2]; - if ((i | 0) == -1) { - break b; - } - g = F[d >> 2]; - if (g >>> 0 >= e >>> 0) { - break b; - } - l = F[(F[(a + 72) >> 2] + 12) >> 2]; - j = F[(l + (i << 2)) >> 2]; - if (j >>> 0 >= e >>> 0) { - break b; - } - i = F[m >> 2]; - F[(i + (g << 2)) >> 2] = j; - g = F[(c + 4) >> 2]; - if ((g | 0) == -1) { - break b; - } - j = F[(d + 4) >> 2]; - if (j >>> 0 >= e >>> 0) { - break b; - } - g = F[((g << 2) + l) >> 2]; - if (g >>> 0 >= e >>> 0) { - break b; - } - F[(i + (j << 2)) >> 2] = g; - c = F[(c + 8) >> 2]; - if ((c | 0) == -1) { - break b; - } - d = F[(d + 8) >> 2]; - if (d >>> 0 >= e >>> 0) { - break b; - } - c = F[((c << 2) + l) >> 2]; - if (c >>> 0 >= e >>> 0) { - break b; - } - F[(i + (d << 2)) >> 2] = c; - b = (b + 1) | 0; - k = h >>> 0 <= b >>> 0; - if ((b | 0) == (n | 0)) { - break b; - } - c = L(b, 3); - d = (f + L(b, 12)) | 0; - if ((b | 0) != 1431655765) { - continue; - } - break; - } - } - return k | 0; - } - function Na(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - d = (Z - 16) | 0; - Z = d; - a: { - f = F[(a + 4) >> 2]; - b: { - if (f >>> 0 < b >>> 0) { - e = (b - f) | 0; - c = F[(a + 8) >> 2]; - g = c << 5; - c: { - if ( - !((e >>> 0 > g >>> 0) | (f >>> 0 > (g - e) >>> 0)) - ) { - F[(a + 4) >> 2] = b; - h = f & 31; - b = (F[a >> 2] + ((f >>> 3) & 536870908)) | 0; - break c; - } - F[(d + 8) >> 2] = 0; - F[d >> 2] = 0; - F[(d + 4) >> 2] = 0; - if ((b | 0) < 0) { - break a; - } - if (g >>> 0 <= 1073741822) { - c = c << 6; - b = (b + 31) & -32; - b = b >>> 0 < c >>> 0 ? c : b; - } else { - b = 2147483647; - } - $a(d, b); - f = F[(a + 4) >> 2]; - F[(d + 4) >> 2] = f + e; - i = F[a >> 2]; - b = F[d >> 2]; - d: { - if ((f | 0) <= 0) { - break d; - } - c = (f >>> 5) | 0; - if (f >>> 0 >= 32) { - pa(b, i, c << 2); - } - g = c << 2; - b = (g + b) | 0; - h = f & 31; - if (h) { - c = (-1 >>> (32 - h)) | 0; - F[b >> 2] = - (F[b >> 2] & (c ^ -1)) | (F[(i + g) >> 2] & c); - } - i = F[a >> 2]; - } - F[a >> 2] = F[d >> 2]; - F[d >> 2] = i; - c = F[(a + 4) >> 2]; - F[(a + 4) >> 2] = F[(d + 4) >> 2]; - F[(d + 4) >> 2] = c; - c = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = F[(d + 8) >> 2]; - F[(d + 8) >> 2] = c; - if (!i) { - break c; - } - ja(i); - } - if (!e) { - break b; - } - if (h) { - c = (32 - h) | 0; - a = c >>> 0 < e >>> 0 ? c : e; - F[b >> 2] = - F[b >> 2] & (((-1 << h) & (-1 >>> (c - a))) ^ -1); - e = (e - a) | 0; - b = (b + 4) | 0; - } - a = (e >>> 5) | 0; - if (e >>> 0 >= 32) { - ma(b, 0, a << 2); - } - if ((e & -32) == (e | 0)) { - break b; - } - a = ((a << 2) + b) | 0; - F[a >> 2] = F[a >> 2] & ((-1 >>> (32 - (e & 31))) ^ -1); - break b; - } - F[(a + 4) >> 2] = b; - } - Z = (d + 16) | 0; - return; - } - na(); - v(); - } - function Aa(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - i = (Z - 16) | 0; - Z = i; - f = F[(b + 20) >> 2]; - h = F[(b + 12) >> 2]; - c = F[(b + 16) >> 2]; - a: { - if ( - (((f | 0) >= (h | 0)) & (c >>> 0 >= I[(b + 8) >> 2])) | - ((f | 0) > (h | 0)) - ) { - break a; - } - D[(a + 12) | 0] = G[(c + F[b >> 2]) | 0]; - c = F[(b + 20) >> 2]; - f = (F[(b + 16) >> 2] + 1) | 0; - c = f ? c : (c + 1) | 0; - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = c; - if (!Qd(1, (i + 12) | 0, b)) { - break a; - } - h = F[(b + 8) >> 2]; - f = F[(b + 16) >> 2]; - g = (h - f) | 0; - c = F[(i + 12) >> 2]; - d = f >>> 0 > h >>> 0; - h = F[(b + 20) >> 2]; - e = (F[(b + 12) >> 2] - ((d + h) | 0)) | 0; - if ( - ((g >>> 0 < c >>> 0) & ((e | 0) <= 0)) | - ((e | 0) < 0) | - ((c | 0) <= 0) - ) { - break a; - } - g = (f + F[b >> 2]) | 0; - F[a >> 2] = g; - b: { - c: { - e = (c - 1) | 0; - j = (e + g) | 0; - d = G[j | 0]; - d: { - if (d >>> 0 <= 63) { - F[(a + 4) >> 2] = e; - d = G[j | 0] & 63; - break d; - } - e: { - switch ((((d >>> 6) | 0) - 1) | 0) { - case 1: - break c; - case 0: - break e; - default: - break a; - } - } - if (c >>> 0 < 2) { - break a; - } - e = (c - 2) | 0; - F[(a + 4) >> 2] = e; - g = (g + e) | 0; - d = ((G[(g + 1) | 0] << 8) & 16128) | G[g | 0]; - } - F[(a + 8) >> 2] = d + 4096; - break b; - } - if (c >>> 0 < 3) { - break a; - } - e = (c - 3) | 0; - F[(a + 4) >> 2] = e; - d = a; - a = (g + e) | 0; - a = - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) & 4128768) | - G[a | 0]; - F[(d + 8) >> 2] = a + 4096; - if (a >>> 0 > 1044479) { - break a; - } - } - a = h; - d = c; - c = (c + f) | 0; - a = d >>> 0 > c >>> 0 ? (a + 1) | 0 : a; - F[(b + 16) >> 2] = c; - F[(b + 20) >> 2] = a; - k = 1; - } - Z = (i + 16) | 0; - return k; - } - function qd(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - e = F[(a + 12) >> 2]; - i = F[(a + 8) >> 2]; - d = (e - i) >> 2; - b = G[(b + 24) | 0]; - a: { - if (d >>> 0 < b >>> 0) { - qa((a + 8) | 0, (b - d) | 0); - i = F[(a + 8) >> 2]; - e = F[(a + 12) >> 2]; - break a; - } - if (b >>> 0 >= d >>> 0) { - break a; - } - e = ((b << 2) + i) | 0; - F[(a + 12) >> 2] = e; - } - b = 0; - f = F[(c + 8) >> 2]; - h = F[(c + 12) >> 2]; - j = F[(c + 20) >> 2]; - e = (e - i) | 0; - d = F[(c + 16) >> 2]; - g = (e + d) | 0; - j = e >>> 0 > g >>> 0 ? (j + 1) | 0 : j; - b: { - if ( - ((f >>> 0 < g >>> 0) & ((h | 0) <= (j | 0))) | - ((h | 0) < (j | 0)) - ) { - break b; - } - la(i, (d + F[c >> 2]) | 0, e); - d = F[(c + 20) >> 2]; - g = e; - e = (e + F[(c + 16) >> 2]) | 0; - d = g >>> 0 > e >>> 0 ? (d + 1) | 0 : d; - F[(c + 16) >> 2] = e; - F[(c + 20) >> 2] = d; - f = F[(c + 8) >> 2]; - h = F[(c + 12) >> 2]; - g = (e + 4) | 0; - d = g >>> 0 < 4 ? (d + 1) | 0 : d; - if ( - ((f >>> 0 < g >>> 0) & ((d | 0) >= (h | 0))) | - ((d | 0) > (h | 0)) - ) { - break b; - } - d = (e + F[c >> 2]) | 0; - F[(a + 20) >> 2] = - G[d | 0] | - (G[(d + 1) | 0] << 8) | - ((G[(d + 2) | 0] << 16) | (G[(d + 3) | 0] << 24)); - d = F[(c + 20) >> 2]; - g = d; - f = d; - e = F[(c + 16) >> 2]; - d = (e + 4) | 0; - f = d >>> 0 < 4 ? (f + 1) | 0 : f; - F[(c + 16) >> 2] = d; - F[(c + 20) >> 2] = f; - h = F[(c + 12) >> 2]; - if ( - (((f | 0) >= (h | 0)) & (d >>> 0 >= I[(c + 8) >> 2])) | - ((f | 0) > (h | 0)) - ) { - break b; - } - f = G[(d + F[c >> 2]) | 0]; - d = g; - e = (e + 5) | 0; - d = e >>> 0 < 5 ? (d + 1) | 0 : d; - F[(c + 16) >> 2] = e; - F[(c + 20) >> 2] = d; - if ((f - 1) >>> 0 > 29) { - break b; - } - F[(a + 4) >> 2] = f; - b = 1; - } - return b | 0; - } - function Kc(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - j = +J[b >> 2]; - k = +J[(b + 4) >> 2]; - l = +J[(b + 8) >> 2]; - g = N(j) + N(k) + N(l); - a: { - if (!(g > 1e-6)) { - j = 1; - k = 0; - e = 0; - break a; - } - g = 1 / g; - k = g * k; - j = g * j; - e = g * l < 0; - } - h = F[(a + 16) >> 2]; - l = +(h | 0); - g = R(j * l + 0.5); - b: { - if (N(g) < 2147483648) { - m = ~~g; - break b; - } - m = -2147483648; - } - f = m >> 31; - i = ((f ^ m) - f) | 0; - g = R(k * l + 0.5); - c: { - if (N(g) < 2147483648) { - f = ~~g; - break c; - } - f = -2147483648; - } - b = f >> 31; - b = (h - ((i + (((f ^ b) - b) | 0)) | 0)) | 0; - i = (b | 0) > 0 ? b : 0; - e = e ? (0 - i) | 0 : i; - f = (f + ((b >> 31) & ((f | 0) > 0 ? b : (0 - b) | 0))) | 0; - d: { - if ((m | 0) >= 0) { - b = (e + h) | 0; - a = F[(a + 8) >> 2]; - e = (h + f) | 0; - break d; - } - b = f >> 31; - b = ((b ^ f) - b) | 0; - a = F[(a + 8) >> 2]; - b = (e | 0) < 0 ? b : (a - b) | 0; - e = (f | 0) < 0 ? i : (a - i) | 0; - } - e: { - if (!(b | e)) { - b = a; - break e; - } - if (!(((a | 0) != (b | 0)) | e)) { - b = a; - break e; - } - if (!(((a | 0) != (e | 0)) | b)) { - b = a; - break e; - } - if (!(((b | 0) <= (h | 0)) | e)) { - b = ((h << 1) - b) | 0; - a = 0; - break e; - } - if (!(((a | 0) != (e | 0)) | ((b | 0) >= (h | 0)))) { - b = ((h << 1) - b) | 0; - break e; - } - if (!(((a | 0) != (b | 0)) | ((e | 0) >= (h | 0)))) { - b = a; - a = ((h << 1) - e) | 0; - break e; - } - if (b) { - a = e; - break e; - } - b = 0; - if ((e | 0) <= (h | 0)) { - a = e; - break e; - } - a = ((h << 1) - e) | 0; - } - F[c >> 2] = a; - F[d >> 2] = b; - } - function ye(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0; - a: { - if (!$c(a, b)) { - break a; - } - h = (a + 36) | 0; - g = $[F[(F[a >> 2] + 24) >> 2]](a) | 0; - e = F[(a + 40) >> 2]; - d = F[(a + 36) >> 2]; - c = (e - d) >> 2; - b: { - if (g >>> 0 > c >>> 0) { - Pb(h, (g - c) | 0); - break b; - } - if (c >>> 0 <= g >>> 0) { - break b; - } - d = (d + (g << 2)) | 0; - if ((d | 0) != (e | 0)) { - while (1) { - e = (e - 4) | 0; - c = F[e >> 2]; - F[e >> 2] = 0; - if (c) { - $[F[(F[c >> 2] + 4) >> 2]](c); - } - if ((d | 0) != (e | 0)) { - continue; - } - break; - } - } - F[(a + 40) >> 2] = d; - } - c = 1; - if ((g | 0) <= 0) { - break a; - } - e = 0; - while (1) { - c: { - c = F[(b + 20) >> 2]; - f = F[(b + 12) >> 2]; - d = F[(b + 16) >> 2]; - if ( - (((c | 0) >= (f | 0)) & (d >>> 0 >= I[(b + 8) >> 2])) | - ((c | 0) > (f | 0)) - ) { - break c; - } - f = G[(F[b >> 2] + d) | 0]; - d = (d + 1) | 0; - c = d ? c : (c + 1) | 0; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = c; - d = $[F[(F[a >> 2] + 48) >> 2]](a, f) | 0; - f = e << 2; - i = (f + F[(a + 36) >> 2]) | 0; - c = F[i >> 2]; - F[i >> 2] = d; - if (c) { - $[F[(F[c >> 2] + 4) >> 2]](c); - } - c = F[(F[h >> 2] + f) >> 2]; - if (!c) { - break c; - } - if ( - !((k = c), - (l = $[F[(F[a >> 2] + 28) >> 2]](a) | 0), - (m = $[F[(F[a >> 2] + 20) >> 2]](a, e) | 0), - (j = F[(F[c >> 2] + 8) >> 2]), - $[j](k | 0, l | 0, m | 0) | 0) - ) { - break c; - } - c = 1; - e = (e + 1) | 0; - if ((g | 0) != (e | 0)) { - continue; - } - break a; - } - break; - } - c = 0; - } - return c | 0; - } - function Xc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - g = F[a >> 2]; - c = (g + ((b >>> 3) & 536870908)) | 0; - F[c >> 2] = F[c >> 2] | (1 << b); - f = F[(a + 64) >> 2]; - e = (b | 0) == -1; - d = -1; - a: { - if (e) { - break a; - } - c = (b + 1) | 0; - c = ((c >>> 0) % 3) | 0 ? c : (b - 2) | 0; - d = -1; - if ((c | 0) == -1) { - break a; - } - d = F[(F[f >> 2] + (c << 2)) >> 2]; - } - c = F[(a + 12) >> 2]; - h = (((d >>> 3) & 536870908) + c) | 0; - F[h >> 2] = F[h >> 2] | (1 << d); - b: { - c: { - if (!e) { - d: { - e: { - if (((b >>> 0) % 3) | 0) { - e = (b - 1) | 0; - break e; - } - e = (b + 2) | 0; - d = -1; - if ((e | 0) == -1) { - break d; - } - } - d = F[(F[f >> 2] + (e << 2)) >> 2]; - } - e = (((d >>> 3) & 536870908) + c) | 0; - F[e >> 2] = F[e >> 2] | (1 << d); - d = -1; - b = F[(F[(f + 12) >> 2] + (b << 2)) >> 2]; - if ((b | 0) == -1) { - break b; - } - D[(a + 24) | 0] = 0; - a = (((b >>> 3) & 536870908) + g) | 0; - F[a >> 2] = F[a >> 2] | (1 << b); - a = (b + 1) | 0; - a = ((a >>> 0) % 3) | 0 ? a : (b - 2) | 0; - if ((a | 0) != -1) { - d = F[(F[f >> 2] + (a << 2)) >> 2]; - } - a = (c + ((d >>> 3) & 536870908)) | 0; - F[a >> 2] = F[a >> 2] | (1 << d); - f: { - g: { - if (((b >>> 0) % 3) | 0) { - b = (b - 1) | 0; - break g; - } - b = (b + 2) | 0; - a = -1; - if ((b | 0) == -1) { - break f; - } - } - a = F[(F[f >> 2] + (b << 2)) >> 2]; - } - b = 1 << a; - a = (c + ((a >>> 3) & 536870908)) | 0; - c = F[a >> 2]; - break c; - } - a = (c + 536870908) | 0; - b = F[(c + 536870908) >> 2]; - c = -2147483648; - } - F[a >> 2] = b | c; - } - } - function zc(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = M(0), - f = M(0), - g = M(0), - h = M(0), - i = M(0), - j = 0, - k = M(0), - l = M(0), - m = M(0), - n = M(0), - o = 0; - a: { - if ((F[(c + 28) >> 2] != 9) | (G[(c + 24) | 0] != 3)) { - break a; - } - a = F[(a + 4) >> 2]; - if ((a - 2) >>> 0 > 28) { - break a; - } - o = 1; - j = F[(c + 80) >> 2]; - if (!j) { - break a; - } - k = M(M(2) / M(((1 << a) - 2) | 0)); - c = (F[F[c >> 2] >> 2] + F[(c + 48) >> 2]) | 0; - a = (F[F[b >> 2] >> 2] + F[(b + 48) >> 2]) | 0; - b = 0; - while (1) { - g = M(0); - l = M(0); - m = M(0); - e = M(M(M(F[a >> 2]) * k) + M(-1)); - f = M(M(M(F[(a + 4) >> 2]) * k) + M(-1)); - i = M(M(M(1) - M(N(e))) - M(N(f))); - h = M(Q(M(-i), M(0))); - n = M(-h); - f = M(f + (f < M(0) ? h : n)); - e = M(e + (e < M(0) ? h : n)); - h = M(M(f * f) + M(M(i * i) + M(e * e))); - if (!(+h < 1e-6)) { - g = M(M(1) / M(U(h))); - m = M(f * g); - l = M(e * g); - g = M(i * g); - } - a = (a + 8) | 0; - d = (w(m), y(2)); - D[(c + 8) | 0] = d; - D[(c + 9) | 0] = d >>> 8; - D[(c + 10) | 0] = d >>> 16; - D[(c + 11) | 0] = d >>> 24; - d = (w(l), y(2)); - D[(c + 4) | 0] = d; - D[(c + 5) | 0] = d >>> 8; - D[(c + 6) | 0] = d >>> 16; - D[(c + 7) | 0] = d >>> 24; - d = (w(g), y(2)); - D[c | 0] = d; - D[(c + 1) | 0] = d >>> 8; - D[(c + 2) | 0] = d >>> 16; - D[(c + 3) | 0] = d >>> 24; - c = (c + 12) | 0; - b = (b + 1) | 0; - if ((j | 0) != (b | 0)) { - continue; - } - break; - } - } - return o | 0; - } - function Md(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - g = (Z - 16) | 0; - Z = g; - a: { - if (!Sa(1, (g + 8) | 0, b)) { - break a; - } - d = F[(b + 8) >> 2]; - e = F[(b + 16) >> 2]; - f = (d - e) | 0; - h = F[(g + 12) >> 2]; - c = d >>> 0 < e >>> 0; - d = F[(b + 20) >> 2]; - i = (F[(b + 12) >> 2] - ((c + d) | 0)) | 0; - c = F[(g + 8) >> 2]; - if ( - (((h | 0) == (i | 0)) & (c >>> 0 > f >>> 0)) | - (h >>> 0 > i >>> 0) - ) { - break a; - } - d = (d + h) | 0; - f = (c + e) | 0; - d = f >>> 0 < e >>> 0 ? (d + 1) | 0 : d; - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = d; - if ((c | 0) <= 0) { - break a; - } - b = (F[b >> 2] + e) | 0; - F[(a + 40) >> 2] = b; - e = (c - 1) | 0; - d = (b + e) | 0; - f = G[d | 0]; - b: { - if (f >>> 0 <= 63) { - F[(a + 44) >> 2] = e; - b = G[d | 0] & 63; - break b; - } - c: { - switch ((((f >>> 6) | 0) - 1) | 0) { - case 0: - if (c >>> 0 < 2) { - break a; - } - c = (c - 2) | 0; - F[(a + 44) >> 2] = c; - b = (b + c) | 0; - b = ((G[(b + 1) | 0] << 8) & 16128) | G[b | 0]; - break b; - case 1: - if (c >>> 0 < 3) { - break a; - } - c = (c - 3) | 0; - F[(a + 44) >> 2] = c; - b = (b + c) | 0; - b = - (G[(b + 1) | 0] << 8) | - ((G[(b + 2) | 0] << 16) & 4128768) | - G[b | 0]; - break b; - default: - break c; - } - } - c = (c - 4) | 0; - F[(a + 44) >> 2] = c; - b = (b + c) | 0; - b = - (G[b | 0] | - (G[(b + 1) | 0] << 8) | - ((G[(b + 2) | 0] << 16) | (G[(b + 3) | 0] << 24))) & - 1073741823; - } - F[(a + 48) >> 2] = b + 16384; - j = b >>> 0 < 4177920; - } - Z = (g + 16) | 0; - return j; - } - function Tf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0; - a: { - a = (Z - 32) | 0; - Z = a; - e = ya(c); - if (e >>> 0 < 2147483632) { - b: { - c: { - if (e >>> 0 >= 11) { - g = ((e | 15) + 1) | 0; - f = ka(g); - F[(a + 24) >> 2] = g | -2147483648; - F[(a + 16) >> 2] = f; - F[(a + 20) >> 2] = e; - g = (e + f) | 0; - break c; - } - D[(a + 27) | 0] = e; - f = (a + 16) | 0; - g = (e + f) | 0; - if (!e) { - break b; - } - } - la(f, c, e); - } - D[g | 0] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - d: { - c = Ya(b, (a + 16) | 0); - if ((c | 0) == ((b + 4) | 0)) { - break d; - } - b = F[(c + 28) >> 2]; - e = F[(c + 32) >> 2]; - if ((b | 0) == (e | 0)) { - break d; - } - b = (e - b) | 0; - if (b & 3) { - break d; - } - e = (b >>> 2) | 0; - f = F[(a + 4) >> 2]; - b = F[a >> 2]; - g = (f - b) >> 2; - e: { - if (e >>> 0 > g >>> 0) { - qa(a, (e - g) | 0); - b = F[a >> 2]; - f = F[(a + 4) >> 2]; - break e; - } - if (e >>> 0 >= g >>> 0) { - break e; - } - f = ((e << 2) + b) | 0; - F[(a + 4) >> 2] = f; - } - if ((b | 0) != (f | 0)) { - e = b; - b = F[(c + 28) >> 2]; - la(e, b, (F[(c + 32) >> 2] - b) | 0); - break d; - } - ta(); - v(); - } - b = F[d >> 2]; - if (b) { - F[(d + 4) >> 2] = b; - ja(b); - } - F[d >> 2] = F[a >> 2]; - F[(d + 4) >> 2] = F[(a + 4) >> 2]; - F[(d + 8) >> 2] = F[(a + 8) >> 2]; - if (D[(a + 27) | 0] < 0) { - ja(F[(a + 16) >> 2]); - } - Z = (a + 32) | 0; - break a; - } - za(); - v(); - } - } - function ud(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0; - F[a >> 2] = 8284; - d = F[(a + 368) >> 2]; - F[(a + 368) >> 2] = 0; - if (d) { - e = (d - 4) | 0; - b = F[e >> 2]; - if (b) { - c = ((b << 4) + d) | 0; - while (1) { - c = (c - 16) | 0; - if ((d | 0) != (c | 0)) { - continue; - } - break; - } - } - ja(e); - } - td((a + 216) | 0); - b = F[(a + 196) >> 2]; - if (b) { - F[(a + 200) >> 2] = b; - ja(b); - } - b = F[(a + 184) >> 2]; - if (b) { - F[(a + 188) >> 2] = b; - ja(b); - } - b = F[(a + 172) >> 2]; - if (b) { - F[(a + 176) >> 2] = b; - ja(b); - } - b = F[(a + 160) >> 2]; - if (b) { - F[(a + 164) >> 2] = b; - ja(b); - } - c = F[(a + 144) >> 2]; - if (c) { - while (1) { - b = F[c >> 2]; - ja(c); - c = b; - if (b) { - continue; - } - break; - } - } - b = F[(a + 136) >> 2]; - F[(a + 136) >> 2] = 0; - if (b) { - ja(b); - } - b = F[(a + 120) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 108) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 96) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - F[(a + 76) >> 2] = b; - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - b = F[(a + 36) >> 2]; - if (b) { - F[(a + 40) >> 2] = b; - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - F[(a + 28) >> 2] = b; - ja(b); - } - b = F[(a + 12) >> 2]; - if (b) { - F[(a + 16) >> 2] = b; - ja(b); - } - b = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = 0; - if (b) { - Za(b); - } - return a | 0; - } - function Vf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - d = (Z - 16) | 0; - Z = d; - a: { - e = ya(c); - if (e >>> 0 < 2147483632) { - b: { - c: { - if (e >>> 0 >= 11) { - f = ((e | 15) + 1) | 0; - a = ka(f); - F[(d + 8) >> 2] = f | -2147483648; - F[d >> 2] = a; - F[(d + 4) >> 2] = e; - f = (a + e) | 0; - break c; - } - D[(d + 11) | 0] = e; - f = (d + e) | 0; - a = d; - if (!e) { - break b; - } - } - la(a, c, e); - } - D[f | 0] = 0; - c = G[(d + 11) | 0]; - e = (c << 24) >> 24; - b = F[(b + 4) >> 2]; - a = 0; - d: { - if (!b) { - break d; - } - a = c; - c = (e | 0) < 0; - a = c ? F[(d + 4) >> 2] : a; - f = c ? F[d >> 2] : d; - while (1) { - c = G[(b + 27) | 0]; - g = (c << 24) >> 24 < 0; - c = g ? F[(b + 20) >> 2] : c; - i = c >>> 0 < a >>> 0; - e: { - f: { - g: { - h: { - i: { - j: { - h = i ? c : a; - if (h) { - g = g ? F[(b + 16) >> 2] : (b + 16) | 0; - j = sa(f, g, h); - if (j) { - break j; - } - if (a >>> 0 >= c >>> 0) { - break i; - } - break e; - } - if (a >>> 0 >= c >>> 0) { - break h; - } - break e; - } - if ((j | 0) < 0) { - break e; - } - } - c = sa(g, f, h); - if (c) { - break g; - } - } - if (i) { - break f; - } - a = 1; - break d; - } - if ((c | 0) < 0) { - break f; - } - a = 1; - break d; - } - b = (b + 4) | 0; - } - b = F[b >> 2]; - if (b) { - continue; - } - break; - } - a = 0; - } - if ((e | 0) < 0) { - ja(F[d >> 2]); - } - Z = (d + 16) | 0; - break a; - } - za(); - v(); - } - return a | 0; - } - function lc(a, b) { - var c = 0, - d = 0; - c = F[(b + 8) >> 2]; - F[(a + 4) >> 2] = F[(b + 4) >> 2]; - F[(a + 8) >> 2] = c; - F[(a + 20) >> 2] = F[(b + 20) >> 2]; - c = F[(b + 16) >> 2]; - F[(a + 12) >> 2] = F[(b + 12) >> 2]; - F[(a + 16) >> 2] = c; - a: { - b: { - if ((a | 0) != (b | 0)) { - c = F[(b + 28) >> 2]; - if (c) { - d = F[(a + 24) >> 2]; - if ((F[(a + 32) >> 2] << 5) >>> 0 < c >>> 0) { - if (d) { - ja(d); - F[(a + 32) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - c = F[(b + 28) >> 2]; - } - if ((c | 0) < 0) { - break b; - } - c = ((((c - 1) >>> 5) | 0) + 1) | 0; - d = ka(c << 2); - F[(a + 32) >> 2] = c; - F[(a + 28) >> 2] = 0; - F[(a + 24) >> 2] = d; - c = F[(b + 28) >> 2]; - } - pa( - d, - F[(b + 24) >> 2], - ((((c - 1) >>> 3) & 536870908) + 4) | 0, - ); - c = F[(b + 28) >> 2]; - } else { - c = 0; - } - F[(a + 28) >> 2] = c; - c = F[(b + 40) >> 2]; - if (c) { - d = F[(a + 36) >> 2]; - if ((F[(a + 44) >> 2] << 5) >>> 0 < c >>> 0) { - if (d) { - ja(d); - F[(a + 44) >> 2] = 0; - F[(a + 36) >> 2] = 0; - F[(a + 40) >> 2] = 0; - c = F[(b + 40) >> 2]; - } - if ((c | 0) < 0) { - break a; - } - c = ((((c - 1) >>> 5) | 0) + 1) | 0; - d = ka(c << 2); - F[(a + 44) >> 2] = c; - F[(a + 40) >> 2] = 0; - F[(a + 36) >> 2] = d; - c = F[(b + 40) >> 2]; - } - pa( - d, - F[(b + 36) >> 2], - ((((c - 1) >>> 3) & 536870908) + 4) | 0, - ); - b = F[(b + 40) >> 2]; - } else { - b = 0; - } - F[(a + 40) >> 2] = b; - } - return; - } - na(); - v(); - } - na(); - v(); - } - function nc(a) { - var b = 0, - c = 0, - d = 0; - b = F[(a + 8) >> 2]; - d = F[a >> 2]; - a: { - if (G[(a + 12) | 0]) { - b: { - c: { - d: { - e: { - if ((b | 0) == -1) { - break e; - } - c = (b + 1) | 0; - b = ((c >>> 0) % 3) | 0 ? c : (b - 2) | 0; - if ((b | 0) == -1) { - break e; - } - b = F[(F[(d + 12) >> 2] + (b << 2)) >> 2]; - if ((b | 0) != -1) { - break d; - } - } - F[(a + 8) >> 2] = -1; - break c; - } - c = (b + 1) | 0; - b = ((c >>> 0) % 3) | 0 ? c : (b - 2) | 0; - F[(a + 8) >> 2] = b; - if ((b | 0) != -1) { - break b; - } - } - c = F[(a + 4) >> 2]; - b = -1; - f: { - if ((c | 0) == -1) { - break f; - } - g: { - if (((c >>> 0) % 3) | 0) { - c = (c - 1) | 0; - break g; - } - c = (c + 2) | 0; - b = -1; - if ((c | 0) == -1) { - break f; - } - } - c = F[(F[(d + 12) >> 2] + (c << 2)) >> 2]; - b = -1; - if ((c | 0) == -1) { - break f; - } - b = (c - 1) | 0; - if (((c >>> 0) % 3) | 0) { - break f; - } - b = (c + 2) | 0; - } - D[(a + 12) | 0] = 0; - F[(a + 8) >> 2] = b; - return; - } - if ((b | 0) != F[(a + 4) >> 2]) { - break a; - } - F[(a + 8) >> 2] = -1; - return; - } - c = -1; - h: { - if ((b | 0) == -1) { - break h; - } - i: { - if (((b >>> 0) % 3) | 0) { - b = (b - 1) | 0; - break i; - } - b = (b + 2) | 0; - c = -1; - if ((b | 0) == -1) { - break h; - } - } - b = F[(F[(d + 12) >> 2] + (b << 2)) >> 2]; - c = -1; - if ((b | 0) == -1) { - break h; - } - c = (b - 1) | 0; - if (((b >>> 0) % 3) | 0) { - break h; - } - c = (b + 2) | 0; - } - F[(a + 8) >> 2] = c; - } - } - function Od(a) { - var b = 0, - c = 0, - d = 0; - b = ka(32); - D[(b + 26) | 0] = 0; - c = G[1475] | (G[1476] << 8); - D[(b + 24) | 0] = c; - D[(b + 25) | 0] = c >>> 8; - c = - G[1471] | - (G[1472] << 8) | - ((G[1473] << 16) | (G[1474] << 24)); - d = - G[1467] | - (G[1468] << 8) | - ((G[1469] << 16) | (G[1470] << 24)); - D[(b + 16) | 0] = d; - D[(b + 17) | 0] = d >>> 8; - D[(b + 18) | 0] = d >>> 16; - D[(b + 19) | 0] = d >>> 24; - D[(b + 20) | 0] = c; - D[(b + 21) | 0] = c >>> 8; - D[(b + 22) | 0] = c >>> 16; - D[(b + 23) | 0] = c >>> 24; - c = - G[1463] | - (G[1464] << 8) | - ((G[1465] << 16) | (G[1466] << 24)); - d = - G[1459] | - (G[1460] << 8) | - ((G[1461] << 16) | (G[1462] << 24)); - D[(b + 8) | 0] = d; - D[(b + 9) | 0] = d >>> 8; - D[(b + 10) | 0] = d >>> 16; - D[(b + 11) | 0] = d >>> 24; - D[(b + 12) | 0] = c; - D[(b + 13) | 0] = c >>> 8; - D[(b + 14) | 0] = c >>> 16; - D[(b + 15) | 0] = c >>> 24; - c = - G[1455] | - (G[1456] << 8) | - ((G[1457] << 16) | (G[1458] << 24)); - d = - G[1451] | - (G[1452] << 8) | - ((G[1453] << 16) | (G[1454] << 24)); - D[b | 0] = d; - D[(b + 1) | 0] = d >>> 8; - D[(b + 2) | 0] = d >>> 16; - D[(b + 3) | 0] = d >>> 24; - D[(b + 4) | 0] = c; - D[(b + 5) | 0] = c >>> 8; - D[(b + 6) | 0] = c >>> 16; - D[(b + 7) | 0] = c >>> 24; - F[a >> 2] = -1; - ra((a + 4) | 0, b, 26); - ja(b); - } - function Kg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - e = F[(a + 4) >> 2]; - d = F[e >> 2]; - a: { - b = F[(a + 12) >> 2]; - c = (F[(b + 56) >> 2] - F[(b + 52) >> 2]) | 0; - f = c >> 2; - b: { - if (f >>> 0 <= ((F[(e + 8) >> 2] - d) >> 2) >>> 0) { - break b; - } - if ((c | 0) < 0) { - break a; - } - b = F[(e + 4) >> 2]; - c = ka(c); - f = (c + (f << 2)) | 0; - g = (c + ((b - d) & -4)) | 0; - c = g; - if ((b | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(e + 8) >> 2] = f; - F[(e + 4) >> 2] = g; - F[e >> 2] = c; - if (!d) { - break b; - } - ja(d); - } - e = (a + 8) | 0; - b = F[(a + 76) >> 2]; - c: { - if (b) { - d = F[b >> 2]; - if ((d | 0) == F[(b + 4) >> 2]) { - return 1; - } - b = 0; - while (1) { - c = od(e, F[((b << 2) + d) >> 2]); - if (!c) { - break c; - } - f = F[(a + 76) >> 2]; - d = F[f >> 2]; - b = (b + 1) | 0; - if (b >>> 0 < ((F[(f + 4) >> 2] - d) >> 2) >>> 0) { - continue; - } - break; - } - break c; - } - c = 1; - a = F[(F[(a + 12) >> 2] + 64) >> 2]; - a = (F[(a + 4) >> 2] - F[a >> 2]) | 0; - if (a >>> 0 < 12) { - break c; - } - a = (((a >> 2) >>> 0) / 3) | 0; - b = 0; - while (1) { - c = od(e, L(b, 3)); - if (!c) { - break c; - } - b = (b + 1) | 0; - if ((a | 0) != (b | 0)) { - continue; - } - break; - } - } - return c | 0; - } - na(); - v(); - } - function Qg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - e = F[(a + 4) >> 2]; - d = F[e >> 2]; - a: { - b = F[(a + 12) >> 2]; - c = (F[(b + 28) >> 2] - F[(b + 24) >> 2]) | 0; - f = c >> 2; - b: { - if (f >>> 0 <= ((F[(e + 8) >> 2] - d) >> 2) >>> 0) { - break b; - } - if ((c | 0) < 0) { - break a; - } - b = F[(e + 4) >> 2]; - c = ka(c); - f = (c + (f << 2)) | 0; - g = (c + ((b - d) & -4)) | 0; - c = g; - if ((b | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(e + 8) >> 2] = f; - F[(e + 4) >> 2] = g; - F[e >> 2] = c; - if (!d) { - break b; - } - ja(d); - } - e = (a + 8) | 0; - b = F[(a + 76) >> 2]; - c: { - if (b) { - d = F[b >> 2]; - if ((d | 0) == F[(b + 4) >> 2]) { - return 1; - } - b = 0; - while (1) { - c = pd(e, F[((b << 2) + d) >> 2]); - if (!c) { - break c; - } - f = F[(a + 76) >> 2]; - d = F[f >> 2]; - b = (b + 1) | 0; - if (b >>> 0 < ((F[(f + 4) >> 2] - d) >> 2) >>> 0) { - continue; - } - break; - } - break c; - } - c = 1; - a = F[(a + 12) >> 2]; - a = (F[(a + 4) >> 2] - F[a >> 2]) | 0; - if (a >>> 0 < 12) { - break c; - } - a = (((a >> 2) >>> 0) / 3) | 0; - b = 0; - while (1) { - c = pd(e, L(b, 3)); - if (!c) { - break c; - } - b = (b + 1) | 0; - if ((a | 0) != (b | 0)) { - continue; - } - break; - } - } - return c | 0; - } - na(); - v(); - } - function pa(a, b, c) { - var d = 0, - e = 0; - a: { - if ((a | 0) == (b | 0)) { - break a; - } - e = (a + c) | 0; - if ((b - e) >>> 0 <= (0 - (c << 1)) >>> 0) { - return la(a, b, c); - } - d = (a ^ b) & 3; - b: { - c: { - if (a >>> 0 < b >>> 0) { - if (d) { - d = a; - break b; - } - if (!(a & 3)) { - d = a; - break c; - } - d = a; - while (1) { - if (!c) { - break a; - } - D[d | 0] = G[b | 0]; - b = (b + 1) | 0; - c = (c - 1) | 0; - d = (d + 1) | 0; - if (d & 3) { - continue; - } - break; - } - break c; - } - d: { - if (d) { - break d; - } - if (e & 3) { - while (1) { - if (!c) { - break a; - } - c = (c - 1) | 0; - d = (c + a) | 0; - D[d | 0] = G[(b + c) | 0]; - if (d & 3) { - continue; - } - break; - } - } - if (c >>> 0 <= 3) { - break d; - } - while (1) { - c = (c - 4) | 0; - F[(c + a) >> 2] = F[(b + c) >> 2]; - if (c >>> 0 > 3) { - continue; - } - break; - } - } - if (!c) { - break a; - } - while (1) { - c = (c - 1) | 0; - D[(c + a) | 0] = G[(b + c) | 0]; - if (c) { - continue; - } - break; - } - break a; - } - if (c >>> 0 <= 3) { - break b; - } - while (1) { - F[d >> 2] = F[b >> 2]; - b = (b + 4) | 0; - d = (d + 4) | 0; - c = (c - 4) | 0; - if (c >>> 0 > 3) { - continue; - } - break; - } - } - if (!c) { - break a; - } - while (1) { - D[d | 0] = G[b | 0]; - d = (d + 1) | 0; - b = (b + 1) | 0; - c = (c - 1) | 0; - if (c) { - continue; - } - break; - } - } - return a; - } - function Pb(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - d = F[(a + 8) >> 2]; - c = F[(a + 4) >> 2]; - if (((d - c) >> 2) >>> 0 >= b >>> 0) { - if (b) { - b = b << 2; - c = (ma(c, 0, b) + b) | 0; - } - F[(a + 4) >> 2] = c; - return; - } - a: { - b: { - c: { - g = F[a >> 2]; - f = (c - g) >> 2; - e = (f + b) | 0; - if (e >>> 0 < 1073741824) { - d = (d - g) | 0; - h = (d >>> 1) | 0; - e = - d >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 < h >>> 0 - ? h - : e; - if (e) { - if (e >>> 0 >= 1073741824) { - break c; - } - i = ka(e << 2); - } - d = ((f << 2) + i) | 0; - f = b << 2; - b = ma(d, 0, f); - f = (b + f) | 0; - e = ((e << 2) + i) | 0; - if ((c | 0) == (g | 0)) { - break b; - } - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - d = (d - 4) | 0; - F[d >> 2] = b; - if ((c | 0) != (g | 0)) { - continue; - } - break; - } - F[(a + 8) >> 2] = e; - b = F[(a + 4) >> 2]; - F[(a + 4) >> 2] = f; - c = F[a >> 2]; - F[a >> 2] = d; - if ((b | 0) == (c | 0)) { - break a; - } - while (1) { - b = (b - 4) | 0; - a = F[b >> 2]; - F[b >> 2] = 0; - if (a) { - $[F[(F[a >> 2] + 4) >> 2]](a); - } - if ((b | 0) != (c | 0)) { - continue; - } - break; - } - break a; - } - na(); - v(); - } - oa(); - v(); - } - F[(a + 8) >> 2] = e; - F[(a + 4) >> 2] = f; - F[a >> 2] = b; - } - if (c) { - ja(c); - } - } - function Yd(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0; - e = F[(b + 8) >> 2]; - d = F[(b + 12) >> 2]; - g = d; - d = F[(b + 20) >> 2]; - k = d; - h = F[(b + 16) >> 2]; - c = (h + 4) | 0; - d = c >>> 0 < 4 ? (d + 1) | 0 : d; - i = c; - a: { - if ( - ((c >>> 0 > e >>> 0) & ((d | 0) >= (g | 0))) | - ((d | 0) > (g | 0)) - ) { - break a; - } - j = F[b >> 2]; - c = (j + h) | 0; - f = - G[c | 0] | - (G[(c + 1) | 0] << 8) | - ((G[(c + 2) | 0] << 16) | (G[(c + 3) | 0] << 24)); - F[(b + 16) >> 2] = i; - F[(b + 20) >> 2] = d; - c = e; - e = k; - d = (h + 8) | 0; - e = d >>> 0 < 8 ? (e + 1) | 0 : e; - if ( - ((c >>> 0 < d >>> 0) & ((e | 0) >= (g | 0))) | - ((e | 0) > (g | 0)) - ) { - break a; - } - c = (i + j) | 0; - c = - G[c | 0] | - (G[(c + 1) | 0] << 8) | - ((G[(c + 2) | 0] << 16) | (G[(c + 3) | 0] << 24)); - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = e; - if ((c | 0) < (f | 0)) { - break a; - } - F[(a + 16) >> 2] = c; - F[(a + 12) >> 2] = f; - d = ((c >> 31) - (((f >> 31) + (c >>> 0 < f >>> 0)) | 0)) | 0; - e = (c - f) | 0; - if ((!d & (e >>> 0 > 2147483646)) | d) { - break a; - } - d = (e + 1) | 0; - F[(a + 20) >> 2] = d; - e = (d >>> 1) | 0; - F[(a + 24) >> 2] = e; - F[(a + 28) >> 2] = 0 - e; - if (!(d & 1)) { - F[(a + 24) >> 2] = e - 1; - } - l = Aa((a + 112) | 0, b); - } - return l | 0; - } - function Wc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0; - d = -1; - e = -1; - f = -1; - a: { - b: { - if ((b | 0) == -1) { - break b; - } - e = F[(F[(F[(a + 4) >> 2] + 12) >> 2] + (b << 2)) >> 2]; - c = (b + 1) | 0; - c = ((c >>> 0) % 3) | 0 ? c : (b - 2) | 0; - if ((c | 0) >= 0) { - f = ((c >>> 0) / 3) | 0; - f = - F[ - (((F[(F[a >> 2] + 96) >> 2] + L(f, 12)) | 0) + - ((c - L(f, 3)) << 2)) >> - 2 - ]; - } - c: { - if ((e | 0) == -1) { - break c; - } - c = ((((e >>> 0) % 3) | 0 ? -1 : 2) + e) | 0; - if ((c | 0) < 0) { - break c; - } - d = ((c >>> 0) / 3) | 0; - d = - F[ - (((F[(F[a >> 2] + 96) >> 2] + L(d, 12)) | 0) + - ((c - L(d, 3)) << 2)) >> - 2 - ]; - } - c = -1; - if ((d | 0) != (f | 0)) { - break a; - } - f = -1; - d: { - b = ((((b >>> 0) % 3) | 0 ? -1 : 2) + b) | 0; - if ((b | 0) >= 0) { - d = ((b >>> 0) / 3) | 0; - d = - F[ - (((F[(F[a >> 2] + 96) >> 2] + L(d, 12)) | 0) + - ((b - L(d, 3)) << 2)) >> - 2 - ]; - if ((e | 0) == -1) { - break b; - } - break d; - } - d = -1; - if ((e | 0) != -1) { - break d; - } - break b; - } - b = (e + 1) | 0; - b = ((b >>> 0) % 3) | 0 ? b : (e - 2) | 0; - if ((b | 0) < 0) { - break b; - } - c = F[(F[a >> 2] + 96) >> 2]; - a = ((b >>> 0) / 3) | 0; - f = F[(((c + L(a, 12)) | 0) + ((b - L(a, 3)) << 2)) >> 2]; - } - c = (d | 0) != (f | 0) ? -1 : e; - } - return c; - } - function Fc(a, b) { - var c = 0, - d = 0, - e = 0; - c = (Z + -64) | 0; - Z = c; - d = F[a >> 2]; - e = F[(d - 4) >> 2]; - d = F[(d - 8) >> 2]; - F[(c + 32) >> 2] = 0; - F[(c + 36) >> 2] = 0; - F[(c + 40) >> 2] = 0; - F[(c + 44) >> 2] = 0; - F[(c + 48) >> 2] = 0; - F[(c + 52) >> 2] = 0; - D[(c + 55) | 0] = 0; - D[(c + 56) | 0] = 0; - D[(c + 57) | 0] = 0; - D[(c + 58) | 0] = 0; - D[(c + 59) | 0] = 0; - D[(c + 60) | 0] = 0; - D[(c + 61) | 0] = 0; - D[(c + 62) | 0] = 0; - F[(c + 24) >> 2] = 0; - F[(c + 28) >> 2] = 0; - F[(c + 20) >> 2] = 0; - F[(c + 16) >> 2] = 11020; - F[(c + 12) >> 2] = a; - F[(c + 8) >> 2] = b; - a = (a + d) | 0; - d = 0; - a: { - if (La(e, b, 0)) { - F[(c + 56) >> 2] = 1; - $[F[(F[e >> 2] + 20) >> 2]](e, (c + 8) | 0, a, a, 1, 0); - d = F[(c + 32) >> 2] == 1 ? a : 0; - break a; - } - $[F[(F[e >> 2] + 24) >> 2]](e, (c + 8) | 0, a, 1, 0); - b: { - switch (F[(c + 44) >> 2]) { - case 0: - d = - F[(c + 48) >> 2] == 1 - ? F[(c + 36) >> 2] == 1 - ? F[(c + 40) >> 2] == 1 - ? F[(c + 28) >> 2] - : 0 - : 0 - : 0; - break a; - case 1: - break b; - default: - break a; - } - } - if (F[(c + 32) >> 2] != 1) { - if ( - F[(c + 48) >> 2] | - (F[(c + 36) >> 2] != 1) | - (F[(c + 40) >> 2] != 1) - ) { - break a; - } - } - d = F[(c + 24) >> 2]; - } - Z = (c - -64) | 0; - return d; - } - function ma(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (!c) { - break a; - } - D[a | 0] = b; - d = (a + c) | 0; - D[(d - 1) | 0] = b; - if (c >>> 0 < 3) { - break a; - } - D[(a + 2) | 0] = b; - D[(a + 1) | 0] = b; - D[(d - 3) | 0] = b; - D[(d - 2) | 0] = b; - if (c >>> 0 < 7) { - break a; - } - D[(a + 3) | 0] = b; - D[(d - 4) | 0] = b; - if (c >>> 0 < 9) { - break a; - } - d = (0 - a) & 3; - e = (d + a) | 0; - b = L(b & 255, 16843009); - F[e >> 2] = b; - d = (c - d) & -4; - c = (d + e) | 0; - F[(c - 4) >> 2] = b; - if (d >>> 0 < 9) { - break a; - } - F[(e + 8) >> 2] = b; - F[(e + 4) >> 2] = b; - F[(c - 8) >> 2] = b; - F[(c - 12) >> 2] = b; - if (d >>> 0 < 25) { - break a; - } - F[(e + 24) >> 2] = b; - F[(e + 20) >> 2] = b; - F[(e + 16) >> 2] = b; - F[(e + 12) >> 2] = b; - F[(c - 16) >> 2] = b; - F[(c - 20) >> 2] = b; - F[(c - 24) >> 2] = b; - F[(c - 28) >> 2] = b; - g = (e & 4) | 24; - c = (d - g) | 0; - if (c >>> 0 < 32) { - break a; - } - d = ki(b, 0, 1, 1); - f = _; - b = (e + g) | 0; - while (1) { - F[(b + 24) >> 2] = d; - F[(b + 28) >> 2] = f; - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = f; - F[(b + 8) >> 2] = d; - F[(b + 12) >> 2] = f; - F[b >> 2] = d; - F[(b + 4) >> 2] = f; - b = (b + 32) | 0; - c = (c - 32) | 0; - if (c >>> 0 > 31) { - continue; - } - break; - } - } - return a; - } - function ie(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0; - d = F[(b + 8) >> 2]; - e = F[(b + 12) >> 2]; - g = e; - e = F[(b + 20) >> 2]; - k = e; - h = F[(b + 16) >> 2]; - c = (h + 4) | 0; - e = c >>> 0 < 4 ? (e + 1) | 0 : e; - i = c; - a: { - if ( - ((c >>> 0 > d >>> 0) & ((e | 0) >= (g | 0))) | - ((e | 0) > (g | 0)) - ) { - break a; - } - j = F[b >> 2]; - c = (j + h) | 0; - f = - G[c | 0] | - (G[(c + 1) | 0] << 8) | - ((G[(c + 2) | 0] << 16) | (G[(c + 3) | 0] << 24)); - F[(b + 16) >> 2] = i; - F[(b + 20) >> 2] = e; - c = d; - d = k; - e = (h + 8) | 0; - d = e >>> 0 < 8 ? (d + 1) | 0 : d; - if ( - ((c >>> 0 < e >>> 0) & ((d | 0) >= (g | 0))) | - ((d | 0) > (g | 0)) - ) { - break a; - } - c = (i + j) | 0; - c = - G[c | 0] | - (G[(c + 1) | 0] << 8) | - ((G[(c + 2) | 0] << 16) | (G[(c + 3) | 0] << 24)); - F[(b + 16) >> 2] = e; - F[(b + 20) >> 2] = d; - if ((c | 0) < (f | 0)) { - break a; - } - F[(a + 16) >> 2] = c; - F[(a + 12) >> 2] = f; - d = ((c >> 31) - (((f >> 31) + (c >>> 0 < f >>> 0)) | 0)) | 0; - b = (c - f) | 0; - if ((!d & (b >>> 0 > 2147483646)) | d) { - break a; - } - l = 1; - d = (b + 1) | 0; - F[(a + 20) >> 2] = d; - b = (d >>> 1) | 0; - F[(a + 24) >> 2] = b; - F[(a + 28) >> 2] = 0 - b; - if (d & 1) { - break a; - } - F[(a + 24) >> 2] = b - 1; - } - return l | 0; - } - function Uc(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0; - d = (Z - 16) | 0; - Z = d; - f = F[(a + 24) >> 2]; - k = F[(a + 28) >> 2]; - a: { - if ((f | 0) != (k | 0)) { - while (1) { - F[(d + 8) >> 2] = 0; - F[d >> 2] = 0; - F[(d + 4) >> 2] = 0; - a = Sc(F[f >> 2], b, d); - g = G[(d + 11) | 0]; - h = (g << 24) >> 24; - i = 3; - b: { - c: { - d: { - if (!a) { - break d; - } - i = 0; - a = G[(c + 11) | 0]; - e = (a << 24) >> 24; - j = (h | 0) < 0 ? F[(d + 4) >> 2] : g; - if ( - (j | 0) != - (((e | 0) < 0 ? F[(c + 4) >> 2] : a) | 0) - ) { - break d; - } - a = (e | 0) < 0 ? F[c >> 2] : c; - e = (h | 0) < 0; - e: { - if (!e) { - e = d; - if (!h) { - break e; - } - while (1) { - if (G[e | 0] != G[a | 0]) { - break d; - } - a = (a + 1) | 0; - e = (e + 1) | 0; - g = (g - 1) | 0; - if (g) { - continue; - } - break; - } - break e; - } - if (!j) { - break e; - } - if (sa(e ? F[d >> 2] : d, a, j)) { - break c; - } - } - l = F[f >> 2]; - i = 1; - } - if ((h | 0) >= 0) { - break b; - } - } - ja(F[d >> 2]); - } - f: { - switch (i | 0) { - case 0: - case 3: - break f; - default: - break a; - } - } - f = (f + 4) | 0; - if ((k | 0) != (f | 0)) { - continue; - } - break; - } - } - l = 0; - } - Z = (d + 16) | 0; - return l; - } - function gb(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - f = (c - b) | 0; - h = f >> 2; - d = F[(a + 8) >> 2]; - e = F[a >> 2]; - if (h >>> 0 <= ((d - e) >> 2) >>> 0) { - d = F[(a + 4) >> 2]; - g = (d - e) | 0; - f = (g + b) | 0; - i = g >> 2; - g = i >>> 0 < h >>> 0 ? f : c; - if ((g | 0) != (b | 0)) { - while (1) { - F[e >> 2] = F[b >> 2]; - e = (e + 4) | 0; - b = (b + 4) | 0; - if ((g | 0) != (b | 0)) { - continue; - } - break; - } - } - if (h >>> 0 > i >>> 0) { - if ((c | 0) != (g | 0)) { - while (1) { - F[d >> 2] = F[f >> 2]; - d = (d + 4) | 0; - f = (f + 4) | 0; - if ((f | 0) != (c | 0)) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = d; - return; - } - F[(a + 4) >> 2] = e; - return; - } - if (e) { - F[(a + 4) >> 2] = e; - ja(e); - F[(a + 8) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - d = 0; - } - a: { - if ((f | 0) < 0) { - break a; - } - e = (d >>> 1) | 0; - d = - d >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 > h >>> 0 - ? e - : h; - if (d >>> 0 >= 1073741824) { - break a; - } - e = d << 2; - d = ka(e); - F[a >> 2] = d; - F[(a + 8) >> 2] = d + e; - if ((b | 0) != (c | 0)) { - c = b; - b = (((f - 4) & -4) + 4) | 0; - d = (la(d, c, b) + b) | 0; - } - F[(a + 4) >> 2] = d; - return; - } - na(); - v(); - } - function Ea(a, b, c) { - var d = 0, - e = 0, - f = 0; - e = (Z - 16) | 0; - Z = e; - F[(a + 4) >> 2] = 0; - a: { - b: { - if (!b) { - break b; - } - f = F[(a + 8) >> 2]; - d = f << 5; - c: { - if (d >>> 0 >= b >>> 0) { - F[(a + 4) >> 2] = b; - break c; - } - F[(e + 8) >> 2] = 0; - F[e >> 2] = 0; - F[(e + 4) >> 2] = 0; - if ((b | 0) < 0) { - break a; - } - if (d >>> 0 <= 1073741822) { - f = f << 6; - d = (b + 31) & -32; - d = d >>> 0 < f >>> 0 ? f : d; - } else { - d = 2147483647; - } - $a(e, d); - f = F[a >> 2]; - F[a >> 2] = F[e >> 2]; - F[e >> 2] = f; - d = F[(a + 4) >> 2]; - F[(a + 4) >> 2] = b; - F[(e + 4) >> 2] = d; - d = F[(a + 8) >> 2]; - F[(a + 8) >> 2] = F[(e + 8) >> 2]; - F[(e + 8) >> 2] = d; - if (!f) { - break c; - } - ja(f); - } - d = (b >>> 5) | 0; - a = F[a >> 2]; - if (G[c | 0]) { - if (b >>> 0 >= 32) { - ma(a, 255, d << 2); - } - if ((b & -32) == (b | 0)) { - break b; - } - a = (a + (d << 2)) | 0; - F[a >> 2] = F[a >> 2] | (-1 >>> (32 - (b & 31))); - break b; - } - if (b >>> 0 >= 32) { - ma(a, 0, d << 2); - } - if ((b & -32) == (b | 0)) { - break b; - } - a = (a + (d << 2)) | 0; - F[a >> 2] = F[a >> 2] & ((-1 >>> (32 - (b & 31))) ^ -1); - } - Z = (e + 16) | 0; - return; - } - na(); - v(); - } - function If(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0; - e = (Z - 32) | 0; - Z = e; - a: { - b: { - f = ya(c); - if (f >>> 0 < 2147483632) { - c: { - d: { - if (f >>> 0 >= 11) { - a = ((f | 15) + 1) | 0; - g = ka(a); - F[(e + 24) >> 2] = a | -2147483648; - F[(e + 16) >> 2] = g; - F[(e + 20) >> 2] = f; - a = (f + g) | 0; - break d; - } - D[(e + 27) | 0] = f; - g = (e + 16) | 0; - a = (f + g) | 0; - if (!f) { - break c; - } - } - la(g, c, f); - } - D[a | 0] = 0; - c = ya(d); - if (c >>> 0 >= 2147483632) { - break b; - } - e: { - f: { - if (c >>> 0 >= 11) { - f = ((c | 15) + 1) | 0; - a = ka(f); - F[(e + 8) >> 2] = f | -2147483648; - F[e >> 2] = a; - F[(e + 4) >> 2] = c; - g = (a + c) | 0; - break f; - } - D[(e + 11) | 0] = c; - g = (c + e) | 0; - a = e; - if (!c) { - break e; - } - } - la(a, d, c); - } - D[g | 0] = 0; - c = F[(b + 4) >> 2]; - a = -1; - g: { - if (!c) { - break g; - } - c = Uc(c, (e + 16) | 0, e); - a = -1; - if (!c) { - break g; - } - a = Pc(b, F[(c + 24) >> 2]); - } - if (D[(e + 11) | 0] < 0) { - ja(F[e >> 2]); - } - if (D[(e + 27) | 0] < 0) { - ja(F[(e + 16) >> 2]); - } - Z = (e + 32) | 0; - break a; - } - za(); - v(); - } - za(); - v(); - } - return a | 0; - } - function se(a, b) { - a = a | 0; - b = b | 0; - a = 0; - a: { - switch (b | 0) { - case 0: - a = ka(20); - F[(a + 12) >> 2] = -1; - F[(a + 16) >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 1920; - return a | 0; - case 1: - a = ka(24); - F[(a + 12) >> 2] = -1; - F[(a + 16) >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 1920; - F[(a + 20) >> 2] = 0; - F[a >> 2] = 2136; - return a | 0; - case 2: - a = ka(48); - F[(a + 12) >> 2] = -1; - F[(a + 16) >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 1920; - F[(a + 20) >> 2] = 0; - F[a >> 2] = 2136; - F[(a + 24) >> 2] = 1624; - F[a >> 2] = 7948; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - F[(a + 28) >> 2] = -1; - F[(a + 40) >> 2] = 0; - F[(a + 44) >> 2] = 0; - return a | 0; - case 3: - a = ka(32); - F[(a + 12) >> 2] = -1; - F[(a + 16) >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 1920; - F[(a + 20) >> 2] = 0; - F[a >> 2] = 2136; - F[(a + 24) >> 2] = 1032; - F[a >> 2] = 5812; - F[(a + 28) >> 2] = -1; - break; - default: - break a; - } - } - return a | 0; - } - function Be(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0; - f = F[b >> 2]; - b = F[(b + 4) >> 2]; - d = F[(F[(a + 8) >> 2] + 40) >> 2]; - j = d; - m = ka((d | 0) < 0 ? -1 : d); - i = (b - f) | 0; - e = 1; - a: { - if ((i | 0) < 4) { - break a; - } - b = 0; - g = F[(c + 16) >> 2]; - k = d; - f = (g + d) | 0; - d = (0 + F[(c + 20) >> 2]) | 0; - d = f >>> 0 < k >>> 0 ? (d + 1) | 0 : d; - h = F[(c + 12) >> 2]; - e = 0; - if ( - ((I[(c + 8) >> 2] < f >>> 0) & ((d | 0) >= (h | 0))) | - ((d | 0) > (h | 0)) - ) { - break a; - } - e = i >> 2; - i = (e | 0) <= 1 ? 1 : e; - while (1) { - b: { - g = la(m, (F[c >> 2] + g) | 0, j); - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - la( - (F[F[(F[(a + 8) >> 2] + 64) >> 2] >> 2] + b) | 0, - g, - j, - ); - l = (l + 1) | 0; - if ((i | 0) == (l | 0)) { - break b; - } - b = (b + j) | 0; - d = (n + F[(c + 20) >> 2]) | 0; - g = F[(c + 16) >> 2]; - f = (k + g) | 0; - d = f >>> 0 < k >>> 0 ? (d + 1) | 0 : d; - h = F[(c + 12) >> 2]; - if ( - (((d | 0) <= (h | 0)) & (I[(c + 8) >> 2] >= f >>> 0)) | - ((d | 0) < (h | 0)) - ) { - continue; - } - } - break; - } - e = (e | 0) <= (l | 0); - } - ja(m); - return e | 0; - } - function mh(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - F[b >> 2] = 1; - f = (b + 8) | 0; - c = F[(b + 8) >> 2]; - d = (F[(b + 12) >> 2] - c) | 0; - if (d >>> 0 <= 4294967291) { - Db(f, (d + 4) | 0); - c = F[f >> 2]; - } - c = (c + d) | 0; - d = F[(a + 4) >> 2]; - D[c | 0] = d; - D[(c + 1) | 0] = d >>> 8; - D[(c + 2) | 0] = d >>> 16; - D[(c + 3) | 0] = d >>> 24; - c = F[(a + 8) >> 2]; - if ((c | 0) != F[(a + 12) >> 2]) { - d = 0; - while (1) { - g = ((d << 2) + c) | 0; - c = F[(b + 8) >> 2]; - e = (F[(b + 12) >> 2] - c) | 0; - if (e >>> 0 <= 4294967291) { - Db(f, (e + 4) | 0); - c = F[f >> 2]; - } - c = (c + e) | 0; - e = F[g >> 2]; - D[c | 0] = e; - D[(c + 1) | 0] = e >>> 8; - D[(c + 2) | 0] = e >>> 16; - D[(c + 3) | 0] = e >>> 24; - d = (d + 1) | 0; - c = F[(a + 8) >> 2]; - if (d >>> 0 < ((F[(a + 12) >> 2] - c) >> 2) >>> 0) { - continue; - } - break; - } - } - c = F[(b + 12) >> 2]; - b = F[(b + 8) >> 2]; - c = (c - b) | 0; - if (c >>> 0 <= 4294967291) { - Db(f, (c + 4) | 0); - b = F[f >> 2]; - } - b = (b + c) | 0; - a = F[(a + 20) >> 2]; - D[b | 0] = a; - D[(b + 1) | 0] = a >>> 8; - D[(b + 2) | 0] = a >>> 16; - D[(b + 3) | 0] = a >>> 24; - } - function mb(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - c = F[(a + 4) >> 2]; - if ((c | 0) != F[(a + 8) >> 2]) { - e = F[(b + 4) >> 2]; - F[c >> 2] = F[b >> 2]; - F[(c + 4) >> 2] = e; - F[(c + 8) >> 2] = F[(b + 8) >> 2]; - F[(a + 4) >> 2] = c + 12; - return; - } - a: { - g = F[a >> 2]; - d = (((c - g) | 0) / 12) | 0; - e = (d + 1) | 0; - if (e >>> 0 < 357913942) { - f = d << 1; - f = - d >>> 0 >= 178956970 - ? 357913941 - : e >>> 0 < f >>> 0 - ? f - : e; - if (f) { - if (f >>> 0 >= 357913942) { - break a; - } - e = ka(L(f, 12)); - } else { - e = 0; - } - d = (e + L(d, 12)) | 0; - h = F[(b + 4) >> 2]; - F[d >> 2] = F[b >> 2]; - F[(d + 4) >> 2] = h; - F[(d + 8) >> 2] = F[(b + 8) >> 2]; - b = (d + 12) | 0; - if ((c | 0) != (g | 0)) { - while (1) { - c = (c - 12) | 0; - h = F[(c + 4) >> 2]; - d = (d - 12) | 0; - F[d >> 2] = F[c >> 2]; - F[(d + 4) >> 2] = h; - F[(d + 8) >> 2] = F[(c + 8) >> 2]; - if ((c | 0) != (g | 0)) { - continue; - } - break; - } - c = F[a >> 2]; - } - F[(a + 8) >> 2] = e + L(f, 12); - F[(a + 4) >> 2] = b; - F[a >> 2] = d; - if (c) { - ja(c); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function ne(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0; - h = F[(c + 12) >> 2]; - f = h; - e = F[(c + 20) >> 2]; - i = F[(c + 8) >> 2]; - g = F[(c + 16) >> 2]; - a: { - if ( - (((f | 0) <= (e | 0)) & (i >>> 0 <= g >>> 0)) | - ((e | 0) > (f | 0)) - ) { - break a; - } - j = F[c >> 2]; - k = D[(j + g) | 0]; - d = e; - f = (g + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - b: { - if ((k | 0) == -2) { - break b; - } - if ( - (((d | 0) >= (h | 0)) & (f >>> 0 >= i >>> 0)) | - ((d | 0) > (h | 0)) - ) { - break a; - } - d = D[(f + j) | 0]; - g = (g + 2) | 0; - e = g >>> 0 < 2 ? (e + 1) | 0 : e; - F[(c + 16) >> 2] = g; - F[(c + 20) >> 2] = e; - if (((d - 4) & 255) >>> 0 < 251) { - break a; - } - e = $[F[(F[a >> 2] + 40) >> 2]](a, k, d) | 0; - d = F[(a + 20) >> 2]; - F[(a + 20) >> 2] = e; - if (!d) { - break b; - } - $[F[(F[d >> 2] + 4) >> 2]](d); - } - d = F[(a + 20) >> 2]; - if (d) { - if (!($[F[(F[a >> 2] + 28) >> 2]](a, d) | 0)) { - break a; - } - } - l = $[F[(F[a >> 2] + 36) >> 2]](a, b, c) | 0; - } - return l | 0; - } - function Bf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - a: { - if (I[(b + 80) >> 2] > 65535) { - break a; - } - a = F[(b + 100) >> 2]; - b = F[(b + 96) >> 2]; - e = (((a - b) | 0) / 12) | 0; - f = L(e, 6); - g = (f | 0) == (c | 0); - if (((a | 0) == (b | 0)) | ((c | 0) != (f | 0))) { - break a; - } - g = 1; - c = e >>> 0 <= 1 ? 1 : e; - i = c & 1; - a = 0; - if (e >>> 0 >= 2) { - j = c & -2; - c = 0; - while (1) { - f = L(a, 6); - h = (f + d) | 0; - e = (b + L(a, 12)) | 0; - E[h >> 1] = F[e >> 2]; - E[((f | 2) + d) >> 1] = F[(e + 4) >> 2]; - E[(h + 4) >> 1] = F[(e + 8) >> 2]; - f = a | 1; - e = (L(f, 6) + d) | 0; - f = (b + L(f, 12)) | 0; - E[e >> 1] = F[f >> 2]; - E[(e + 2) >> 1] = F[(f + 4) >> 2]; - E[(e + 4) >> 1] = F[(f + 8) >> 2]; - a = (a + 2) | 0; - c = (c + 2) | 0; - if ((j | 0) != (c | 0)) { - continue; - } - break; - } - } - if (!i) { - break a; - } - c = (L(a, 6) + d) | 0; - a = (b + L(a, 12)) | 0; - E[c >> 1] = F[a >> 2]; - E[(c + 2) >> 1] = F[(a + 4) >> 2]; - E[(c + 4) >> 1] = F[(a + 8) >> 2]; - } - return g | 0; - } - function Gh(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - var g = 0, - h = 0, - i = 0, - j = 0, - k = 0, - l = 0, - m = 0, - n = 0; - f = (Z - 32) | 0; - Z = f; - h = e >>> 0 > 1073741823 ? -1 : e << 2; - h = ma(ka(h), 0, h); - g = F[b >> 2]; - i = F[(b + 4) >> 2]; - k = F[(h + 4) >> 2]; - F[(f + 16) >> 2] = F[h >> 2]; - F[(f + 20) >> 2] = k; - F[(f + 8) >> 2] = g; - F[(f + 12) >> 2] = i; - i = (a + 8) | 0; - Jb((f + 24) | 0, i, (f + 16) | 0, (f + 8) | 0); - F[c >> 2] = F[(f + 24) >> 2]; - F[(c + 4) >> 2] = F[(f + 28) >> 2]; - if ((d | 0) > (e | 0)) { - k = (0 - e) << 2; - a = e; - while (1) { - g = a << 2; - j = (g + b) | 0; - m = F[j >> 2]; - j = F[(j + 4) >> 2]; - g = (c + g) | 0; - l = (g + k) | 0; - n = F[(l + 4) >> 2]; - F[(f + 16) >> 2] = F[l >> 2]; - F[(f + 20) >> 2] = n; - F[(f + 8) >> 2] = m; - F[(f + 12) >> 2] = j; - Jb((f + 24) | 0, i, (f + 16) | 0, (f + 8) | 0); - F[g >> 2] = F[(f + 24) >> 2]; - F[(g + 4) >> 2] = F[(f + 28) >> 2]; - a = (a + e) | 0; - if ((d | 0) > (a | 0)) { - continue; - } - break; - } - } - ja(h); - Z = (f + 32) | 0; - return 1; - } - function Sf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0; - a = (Z - 32) | 0; - Z = a; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - a: { - d = ya(c); - if (d >>> 0 < 2147483632) { - b: { - c: { - if (d >>> 0 >= 11) { - e = ((d | 15) + 1) | 0; - f = ka(e); - F[(a + 16) >> 2] = e | -2147483648; - F[(a + 8) >> 2] = f; - F[(a + 12) >> 2] = d; - e = (d + f) | 0; - break c; - } - D[(a + 19) | 0] = d; - f = (a + 8) | 0; - e = (f + d) | 0; - if (!d) { - break b; - } - } - la(f, c, d); - } - D[e | 0] = 0; - c = (b + 4) | 0; - b = Ya(b, (a + 8) | 0); - d: { - if ((c | 0) == (b | 0)) { - break d; - } - c = F[(b + 32) >> 2]; - b = F[(b + 28) >> 2]; - if (((c - b) | 0) != 8) { - break d; - } - c = - G[(b + 4) | 0] | - (G[(b + 5) | 0] << 8) | - ((G[(b + 6) | 0] << 16) | (G[(b + 7) | 0] << 24)); - F[(a + 24) >> 2] = - G[b | 0] | - (G[(b + 1) | 0] << 8) | - ((G[(b + 2) | 0] << 16) | (G[(b + 3) | 0] << 24)); - F[(a + 28) >> 2] = c; - } - g = K[(a + 24) >> 3]; - if (D[(a + 19) | 0] < 0) { - ja(F[(a + 8) >> 2]); - } - Z = (a + 32) | 0; - break a; - } - za(); - v(); - } - return +g; - } - function Gc(a, b, c, d, e, f, g) { - var h = 0, - i = 0, - j = 0; - h = (Z - 16) | 0; - Z = h; - if (((b ^ -1) + 2147483631) >>> 0 >= c >>> 0) { - if ((G[(a + 11) | 0] >>> 7) | 0) { - i = F[a >> 2]; - } else { - i = a; - } - if (b >>> 0 < 1073741799) { - F[(h + 12) >> 2] = b << 1; - F[h >> 2] = b + c; - c = (Z - 16) | 0; - Z = c; - Z = (c + 16) | 0; - c = (h + 12) | 0; - c = F[(I[h >> 2] < I[c >> 2] ? c : h) >> 2]; - if (c >>> 0 >= 11) { - j = (c + 16) & -16; - c = (j - 1) | 0; - c = (c | 0) == 11 ? j : c; - } else { - c = 10; - } - c = (c + 1) | 0; - } else { - c = 2147483631; - } - sb(h, c); - c = F[h >> 2]; - if (f) { - db(c, g, f); - } - g = (d - e) | 0; - if ((d | 0) != (e | 0)) { - db((c + f) | 0, (e + i) | 0, g); - } - if ((b | 0) != 10) { - ja(i); - } - F[a >> 2] = c; - F[(a + 8) >> 2] = - (F[(a + 8) >> 2] & -2147483648) | - (F[(h + 4) >> 2] & 2147483647); - F[(a + 8) >> 2] = F[(a + 8) >> 2] | -2147483648; - b = a; - a = (f + g) | 0; - F[(b + 4) >> 2] = a; - D[(h + 12) | 0] = 0; - D[(a + c) | 0] = G[(h + 12) | 0]; - Z = (h + 16) | 0; - return; - } - za(); - v(); - } - function _c(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - f = (b >>> 0 < 1431655766) & ((b | c) >= 0); - b: { - if (!f) { - break b; - } - b = L(b, 3); - Xb(a, b, 10224); - Xb((a + 12) | 0, b, 10228); - d = F[(a + 24) >> 2]; - c: { - if (((F[(a + 32) >> 2] - d) >> 2) >>> 0 >= c >>> 0) { - break c; - } - if (c >>> 0 >= 1073741824) { - break a; - } - b = F[(a + 28) >> 2]; - e = c << 2; - c = ka(e); - e = (c + e) | 0; - g = (c + ((b - d) & -4)) | 0; - c = g; - if ((b | 0) != (d | 0)) { - while (1) { - c = (c - 4) | 0; - b = (b - 4) | 0; - F[c >> 2] = F[b >> 2]; - if ((b | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 32) >> 2] = e; - F[(a + 28) >> 2] = g; - F[(a + 24) >> 2] = c; - if (!d) { - break c; - } - ja(d); - } - F[(a + 80) >> 2] = 0; - F[(a + 84) >> 2] = 0; - b = F[(a + 76) >> 2]; - F[(a + 76) >> 2] = 0; - if (b) { - ja(b); - } - F[(a + 68) >> 2] = 0; - F[(a + 72) >> 2] = 0; - b = (a - -64) | 0; - a = F[b >> 2]; - F[b >> 2] = 0; - if (!a) { - break b; - } - ja(a); - } - return f; - } - na(); - v(); - } - function yd(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0; - f = 1; - c = F[(a + 140) >> 2]; - a: { - if ((c | 0) <= 0) { - break a; - } - b = c << 4; - d = ka(c >>> 0 > 268435455 ? -1 : b | 4); - F[d >> 2] = c; - d = (d + 4) | 0; - c = (d + b) | 0; - b = d; - while (1) { - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - D[(b + 5) | 0] = 0; - D[(b + 6) | 0] = 0; - D[(b + 7) | 0] = 0; - D[(b + 8) | 0] = 0; - D[(b + 9) | 0] = 0; - D[(b + 10) | 0] = 0; - D[(b + 11) | 0] = 0; - D[(b + 12) | 0] = 0; - b = (b + 16) | 0; - if ((c | 0) != (b | 0)) { - continue; - } - break; - } - e = F[(a + 136) >> 2]; - F[(a + 136) >> 2] = d; - if (e) { - c = (e - 4) | 0; - d = F[c >> 2]; - if (d) { - b = ((d << 4) + e) | 0; - while (1) { - b = (b - 16) | 0; - if ((e | 0) != (b | 0)) { - continue; - } - break; - } - } - ja(c); - } - b = 0; - if (F[(a + 140) >> 2] <= 0) { - break a; - } - while (1) { - f = Aa((F[(a + 136) >> 2] + (b << 4)) | 0, a); - if (!f) { - break a; - } - b = (b + 1) | 0; - if ((b | 0) < F[(a + 140) >> 2]) { - continue; - } - break; - } - } - return f; - } - function Sd(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - d = F[(b + 8) >> 2]; - c = F[(b + 12) >> 2]; - g = c; - c = F[(b + 20) >> 2]; - i = c; - h = F[(b + 16) >> 2]; - f = (h + 4) | 0; - c = f >>> 0 < 4 ? (c + 1) | 0 : c; - a: { - if ( - ((d >>> 0 < f >>> 0) & ((c | 0) >= (g | 0))) | - ((c | 0) > (g | 0)) - ) { - break a; - } - e = (h + F[b >> 2]) | 0; - e = - G[e | 0] | - (G[(e + 1) | 0] << 8) | - ((G[(e + 2) | 0] << 16) | (G[(e + 3) | 0] << 24)); - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = c; - f = d; - d = i; - c = (h + 8) | 0; - d = c >>> 0 < 8 ? (d + 1) | 0 : d; - if ( - ((c >>> 0 > f >>> 0) & ((d | 0) >= (g | 0))) | - ((d | 0) > (g | 0)) - ) { - break a; - } - F[(b + 16) >> 2] = c; - F[(b + 20) >> 2] = d; - if (!(e & 1)) { - break a; - } - d = O(e) ^ 31; - if ((d - 1) >>> 0 > 28) { - break a; - } - F[(a + 8) >> 2] = d + 1; - d = -2 << d; - c = d ^ -2; - F[(a + 16) >> 2] = c; - F[(a + 12) >> 2] = d ^ -1; - F[(a + 24) >> 2] = c >> 1; - J[(a + 20) >> 2] = M(2) / M(c | 0); - j = Aa((a + 96) | 0, b); - } - return j | 0; - } - function bc(a, b) { - var c = 0; - c = F[(b + 4) >> 2]; - F[a >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = c; - c = F[(b + 60) >> 2]; - F[(a + 56) >> 2] = F[(b + 56) >> 2]; - F[(a + 60) >> 2] = c; - c = F[(b + 52) >> 2]; - F[(a + 48) >> 2] = F[(b + 48) >> 2]; - F[(a + 52) >> 2] = c; - c = F[(b + 44) >> 2]; - F[(a + 40) >> 2] = F[(b + 40) >> 2]; - F[(a + 44) >> 2] = c; - c = F[(b + 36) >> 2]; - F[(a + 32) >> 2] = F[(b + 32) >> 2]; - F[(a + 36) >> 2] = c; - c = F[(b + 28) >> 2]; - F[(a + 24) >> 2] = F[(b + 24) >> 2]; - F[(a + 28) >> 2] = c; - c = F[(b + 20) >> 2]; - F[(a + 16) >> 2] = F[(b + 16) >> 2]; - F[(a + 20) >> 2] = c; - c = F[(b + 12) >> 2]; - F[(a + 8) >> 2] = F[(b + 8) >> 2]; - F[(a + 12) >> 2] = c; - F[(a + 88) >> 2] = 0; - F[(a + 64) >> 2] = 0; - F[(a + 68) >> 2] = 0; - F[(a + 72) >> 2] = 0; - F[(a + 76) >> 2] = 0; - D[(a + 77) | 0] = 0; - D[(a + 78) | 0] = 0; - D[(a + 79) | 0] = 0; - D[(a + 80) | 0] = 0; - D[(a + 81) | 0] = 0; - D[(a + 82) | 0] = 0; - D[(a + 83) | 0] = 0; - D[(a + 84) | 0] = 0; - return a; - } - function ac(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (F[(a + 64) >> 2]) { - break a; - } - c = ka(32); - F[(c + 16) >> 2] = 0; - F[(c + 20) >> 2] = 0; - F[(c + 8) >> 2] = 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - F[(c + 24) >> 2] = 0; - F[(c + 28) >> 2] = 0; - d = F[(a + 64) >> 2]; - F[(a + 64) >> 2] = c; - if (!d) { - break a; - } - c = F[d >> 2]; - if (c) { - F[(d + 4) >> 2] = c; - ja(c); - } - ja(d); - } - d = F[(a + 64) >> 2]; - c = (F[(a + 28) >> 2] - 1) | 0; - if (c >>> 0 <= 10) { - c = F[((c << 2) + 10148) >> 2]; - } else { - c = -1; - } - c = L(c, G[(a + 24) | 0]); - f = c >> 31; - g = md(d, 0, ki(c, f, b, 0), _); - if (g) { - d = F[(a + 64) >> 2]; - F[a >> 2] = d; - e = F[(d + 20) >> 2]; - F[(a + 8) >> 2] = F[(d + 16) >> 2]; - F[(a + 12) >> 2] = e; - e = F[(d + 24) >> 2]; - d = F[(d + 28) >> 2]; - F[(a + 48) >> 2] = 0; - F[(a + 52) >> 2] = 0; - F[(a + 40) >> 2] = c; - F[(a + 44) >> 2] = f; - F[(a + 16) >> 2] = e; - F[(a + 20) >> 2] = d; - F[(a + 80) >> 2] = b; - } - return g; - } - function Af(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0, - k = 0; - a = F[(b + 100) >> 2]; - b = F[(b + 96) >> 2]; - h = (a - b) | 0; - a: { - if (((h | 0) != (c | 0)) | ((a | 0) == (b | 0))) { - break a; - } - g = ((c | 0) / 12) | 0; - e = g >>> 0 <= 1 ? 1 : g; - j = e & 1; - a = 0; - if (g >>> 0 >= 2) { - k = e & -2; - g = 0; - while (1) { - e = L(a, 12); - i = (e + d) | 0; - f = (b + e) | 0; - F[i >> 2] = F[f >> 2]; - F[((e | 4) + d) >> 2] = F[(f + 4) >> 2]; - F[(i + 8) >> 2] = F[(f + 8) >> 2]; - f = L(a | 1, 12); - e = (f + d) | 0; - f = (b + f) | 0; - F[e >> 2] = F[f >> 2]; - F[(e + 4) >> 2] = F[(f + 4) >> 2]; - F[(e + 8) >> 2] = F[(f + 8) >> 2]; - a = (a + 2) | 0; - g = (g + 2) | 0; - if ((k | 0) != (g | 0)) { - continue; - } - break; - } - } - if (!j) { - break a; - } - e = d; - d = L(a, 12); - a = (e + d) | 0; - b = (b + d) | 0; - F[a >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = F[(b + 4) >> 2]; - F[(a + 8) >> 2] = F[(b + 8) >> 2]; - } - return ((c | 0) == (h | 0)) | 0; - } - function Kh(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - c = F[(b + 8) >> 2]; - d = F[(b + 12) >> 2]; - g = d; - d = F[(b + 20) >> 2]; - i = d; - h = F[(b + 16) >> 2]; - f = (h + 4) | 0; - d = f >>> 0 < 4 ? (d + 1) | 0 : d; - a: { - if ( - ((c >>> 0 < f >>> 0) & ((d | 0) >= (g | 0))) | - ((d | 0) > (g | 0)) - ) { - break a; - } - e = (h + F[b >> 2]) | 0; - e = - G[e | 0] | - (G[(e + 1) | 0] << 8) | - ((G[(e + 2) | 0] << 16) | (G[(e + 3) | 0] << 24)); - F[(b + 16) >> 2] = f; - F[(b + 20) >> 2] = d; - f = c; - c = i; - d = (h + 8) | 0; - c = d >>> 0 < 8 ? (c + 1) | 0 : c; - if ( - ((d >>> 0 > f >>> 0) & ((c | 0) >= (g | 0))) | - ((c | 0) > (g | 0)) - ) { - break a; - } - F[(b + 16) >> 2] = d; - F[(b + 20) >> 2] = c; - if (!(e & 1)) { - break a; - } - b = O(e) ^ 31; - if ((b - 1) >>> 0 > 28) { - break a; - } - j = 1; - F[(a + 8) >> 2] = b + 1; - b = -2 << b; - c = b ^ -2; - F[(a + 16) >> 2] = c; - F[(a + 12) >> 2] = b ^ -1; - F[(a + 24) >> 2] = c >> 1; - J[(a + 20) >> 2] = M(2) / M(c | 0); - } - return j | 0; - } - function Ya(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - f = (a + 4) | 0; - a = F[(a + 4) >> 2]; - a: { - b: { - if (!a) { - break b; - } - d = G[(b + 11) | 0]; - c = (d << 24) >> 24 < 0; - g = c ? F[b >> 2] : b; - d = c ? F[(b + 4) >> 2] : d; - b = f; - while (1) { - e = G[(a + 27) | 0]; - c = (e << 24) >> 24 < 0; - e = c ? F[(a + 20) >> 2] : e; - h = e >>> 0 > d >>> 0; - i = h ? d : e; - c: { - if (i) { - c = sa(c ? F[(a + 16) >> 2] : (a + 16) | 0, g, i); - if (c) { - break c; - } - } - c = d >>> 0 > e >>> 0 ? -1 : h; - } - c = (c | 0) < 0; - b = c ? b : a; - a = F[(c ? (a + 4) | 0 : a) >> 2]; - if (a) { - continue; - } - break; - } - if ((b | 0) == (f | 0)) { - break b; - } - c = G[(b + 27) | 0]; - a = (c << 24) >> 24 < 0; - d: { - c = a ? F[(b + 20) >> 2] : c; - e = c >>> 0 < d >>> 0 ? c : d; - if (e) { - a = sa(g, a ? F[(b + 16) >> 2] : (b + 16) | 0, e); - if (a) { - break d; - } - } - if (c >>> 0 > d >>> 0) { - break b; - } - break a; - } - if ((a | 0) >= 0) { - break a; - } - } - b = f; - } - return b; - } - function Oe(a, b, c, d, e) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - if (La(a, F[(b + 8) >> 2], e)) { - if ( - !((F[(b + 28) >> 2] == 1) | (F[(b + 4) >> 2] != (c | 0))) - ) { - F[(b + 28) >> 2] = d; - } - return; - } - a: { - if (La(a, F[b >> 2], e)) { - if ( - !( - (F[(b + 16) >> 2] != (c | 0)) & - (F[(b + 20) >> 2] != (c | 0)) - ) - ) { - if ((d | 0) != 1) { - break a; - } - F[(b + 32) >> 2] = 1; - return; - } - F[(b + 32) >> 2] = d; - b: { - if (F[(b + 44) >> 2] == 4) { - break b; - } - E[(b + 52) >> 1] = 0; - a = F[(a + 8) >> 2]; - $[F[(F[a >> 2] + 20) >> 2]](a, b, c, c, 1, e); - if (G[(b + 53) | 0]) { - F[(b + 44) >> 2] = 3; - if (!G[(b + 52) | 0]) { - break b; - } - break a; - } - F[(b + 44) >> 2] = 4; - } - F[(b + 20) >> 2] = c; - F[(b + 40) >> 2] = F[(b + 40) >> 2] + 1; - if ((F[(b + 36) >> 2] != 1) | (F[(b + 24) >> 2] != 2)) { - break a; - } - D[(b + 54) | 0] = 1; - return; - } - a = F[(a + 8) >> 2]; - $[F[(F[a >> 2] + 24) >> 2]](a, b, c, d, e); - } - } - function Ig(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - f = ka(64); - c = ka(12); - F[(c + 8) >> 2] = F[(F[(a + 4) >> 2] + 80) >> 2]; - F[c >> 2] = 9968; - F[(c + 4) >> 2] = 0; - f = yc(f, c); - a: { - b: { - if ((b | 0) < 0) { - c = f; - break b; - } - h = (a + 8) | 0; - c = F[(a + 12) >> 2]; - e = F[(a + 8) >> 2]; - g = (c - e) >> 2; - c: { - if ((g | 0) > (b | 0)) { - break c; - } - d = (b + 1) | 0; - if (b >>> 0 >= g >>> 0) { - Pb(h, (d - g) | 0); - break c; - } - if (d >>> 0 >= g >>> 0) { - break c; - } - e = (e + (d << 2)) | 0; - if ((e | 0) != (c | 0)) { - while (1) { - c = (c - 4) | 0; - d = F[c >> 2]; - F[c >> 2] = 0; - if (d) { - $[F[(F[d >> 2] + 4) >> 2]](d); - } - if ((c | 0) != (e | 0)) { - continue; - } - break; - } - } - F[(a + 12) >> 2] = e; - } - a = (F[h >> 2] + (b << 2)) | 0; - c = F[a >> 2]; - F[a >> 2] = f; - if (!c) { - break a; - } - } - $[F[(F[c >> 2] + 4) >> 2]](c); - } - return ((b ^ -1) >>> 31) | 0; - } - function we(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - c = F[(a + 60) >> 2]; - a: { - if (!c) { - break a; - } - F[(c + 4) >> 2] = a + 48; - if (!($[F[(F[c >> 2] + 12) >> 2]](c) | 0)) { - break a; - } - b: { - c = $[F[(F[a >> 2] + 24) >> 2]](a) | 0; - if ((c | 0) <= 0) { - break b; - } - while (1) { - c: { - f = F[(($[F[(F[a >> 2] + 28) >> 2]](a) | 0) + 4) >> 2]; - g = $[F[(F[a >> 2] + 20) >> 2]](a, d) | 0; - e = F[(a + 60) >> 2]; - if ( - !( - $[F[(F[e >> 2] + 8) >> 2]]( - e, - F[(F[(f + 8) >> 2] + (g << 2)) >> 2], - ) | 0 - ) - ) { - break c; - } - d = (d + 1) | 0; - if ((c | 0) != (d | 0)) { - continue; - } - break b; - } - break; - } - return 0; - } - d = 0; - if (!($[F[(F[a >> 2] + 36) >> 2]](a, b) | 0)) { - break a; - } - if (!($[F[(F[a >> 2] + 40) >> 2]](a, b) | 0)) { - break a; - } - d = $[F[(F[a >> 2] + 44) >> 2]](a) | 0; - } - return d | 0; - } - function Id(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0; - c = F[(a + 216) >> 2]; - if ((c | 0) != F[(a + 220) >> 2]) { - while (1) { - a: { - c = F[(L(e, 144) + c) >> 2]; - if ((c | 0) < 0) { - break a; - } - d = F[(a + 4) >> 2]; - f = F[(d + 8) >> 2]; - if ((c | 0) >= (F[(d + 12) >> 2] - f) >> 2) { - break a; - } - d = 0; - c = F[((c << 2) + f) >> 2]; - if (($[F[(F[c >> 2] + 24) >> 2]](c) | 0) <= 0) { - break a; - } - while (1) { - if ( - ($[F[(F[c >> 2] + 20) >> 2]](c, d) | 0) != - (b | 0) - ) { - d = (d + 1) | 0; - if (($[F[(F[c >> 2] + 24) >> 2]](c) | 0) > (d | 0)) { - continue; - } - break a; - } - break; - } - a = (F[(a + 216) >> 2] + L(e, 144)) | 0; - return (G[(a + 100) | 0] ? (a + 4) | 0 : 0) | 0; - } - e = (e + 1) | 0; - c = F[(a + 216) >> 2]; - if (e >>> 0 < (((F[(a + 220) >> 2] - c) | 0) / 144) >>> 0) { - continue; - } - break; - } - } - return 0; - } - function nd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - c = F[(a + 8) >> 2]; - d = F[(a + 4) >> 2]; - if (((c - d) >> 2) >>> 0 >= b >>> 0) { - if (b) { - b = b << 2; - d = (ma(d, 0, b) + b) | 0; - } - F[(a + 4) >> 2] = d; - return; - } - a: { - f = F[a >> 2]; - g = (d - f) >> 2; - e = (g + b) | 0; - if (e >>> 0 < 1073741824) { - c = (c - f) | 0; - h = (c >>> 1) | 0; - e = - c >>> 0 >= 2147483644 - ? 1073741823 - : e >>> 0 < h >>> 0 - ? h - : e; - if (e) { - if (e >>> 0 >= 1073741824) { - break a; - } - i = ka(e << 2); - } - c = ((g << 2) + i) | 0; - b = b << 2; - b = (ma(c, 0, b) + b) | 0; - if ((d | 0) != (f | 0)) { - while (1) { - c = (c - 4) | 0; - d = (d - 4) | 0; - F[c >> 2] = F[d >> 2]; - if ((d | 0) != (f | 0)) { - continue; - } - break; - } - } - F[(a + 8) >> 2] = (e << 2) + i; - F[(a + 4) >> 2] = b; - F[a >> 2] = c; - if (f) { - ja(f); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function bb(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0; - d = F[(a + 8) >> 2]; - a: { - if (G[(d + 84) | 0]) { - break a; - } - b = F[(a + 16) >> 2]; - if (!b | !G[(b + 84) | 0]) { - break a; - } - c = F[(d + 72) >> 2]; - e = F[(d + 68) >> 2]; - D[(b + 84) | 0] = 0; - c = (c - e) >> 2; - f = F[(b + 68) >> 2]; - e = (F[(b + 72) >> 2] - f) >> 2; - b: { - if (c >>> 0 > e >>> 0) { - ab((b + 68) | 0, (c - e) | 0, 2004); - d = F[(a + 8) >> 2]; - break b; - } - if (c >>> 0 >= e >>> 0) { - break b; - } - F[(b + 72) >> 2] = f + (c << 2); - } - if (G[(d + 84) | 0]) { - break a; - } - c = F[(d + 68) >> 2]; - if ((c | 0) == F[(d + 72) >> 2]) { - break a; - } - e = F[(F[(a + 16) >> 2] + 68) >> 2]; - b = 0; - while (1) { - f = b << 2; - F[(f + e) >> 2] = F[(c + f) >> 2]; - b = (b + 1) | 0; - c = F[(d + 68) >> 2]; - if (b >>> 0 < ((F[(d + 72) >> 2] - c) >> 2) >>> 0) { - continue; - } - break; - } - } - return F[(a + 16) >> 2]; - } - function Lf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0; - e = (Z + -64) | 0; - Z = e; - f = Ja((e + 8) | 0); - F[(f + 16) >> 2] = 0; - F[(f + 20) >> 2] = 0; - F[f >> 2] = b; - F[(f + 8) >> 2] = c; - F[(f + 12) >> 2] = 0; - b = (e + 48) | 0; - Pd(b, a, f, d); - F[(a + 24) >> 2] = F[(e + 48) >> 2]; - f = (a + 24) | 0; - a: { - if ((f | 0) == (b | 0)) { - break a; - } - b = (a + 28) | 0; - c = (e + 48) | 4; - g = G[(e + 63) | 0]; - d = (g << 24) >> 24; - if (D[(a + 39) | 0] >= 0) { - if ((d | 0) >= 0) { - a = F[(c + 4) >> 2]; - F[b >> 2] = F[c >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(c + 8) >> 2]; - break a; - } - qb(b, F[(e + 52) >> 2], F[(e + 56) >> 2]); - break a; - } - a = (d | 0) < 0; - rb(b, a ? F[(e + 52) >> 2] : c, a ? F[(e + 56) >> 2] : g); - } - if (D[(e + 63) | 0] < 0) { - ja(F[(e + 52) >> 2]); - } - Z = (e - -64) | 0; - return f | 0; - } - function Jf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0; - a = (Z - 32) | 0; - Z = a; - a: { - d = ya(c); - if (d >>> 0 < 2147483632) { - b: { - c: { - if (d >>> 0 >= 11) { - e = ((d | 15) + 1) | 0; - f = ka(e); - F[(a + 24) >> 2] = e | -2147483648; - F[(a + 16) >> 2] = f; - F[(a + 20) >> 2] = d; - e = (d + f) | 0; - break c; - } - D[(a + 27) | 0] = d; - f = (a + 16) | 0; - e = (f + d) | 0; - if (!d) { - break b; - } - } - la(f, c, d); - } - D[e | 0] = 0; - D[(a + 4) | 0] = 0; - F[a >> 2] = 1701667182; - D[(a + 11) | 0] = 4; - d = F[(b + 4) >> 2]; - c = -1; - d: { - if (!d) { - break d; - } - d = Uc(d, a, (a + 16) | 0); - c = -1; - if (!d) { - break d; - } - c = Pc(b, F[(d + 24) >> 2]); - } - b = c; - if (D[(a + 11) | 0] < 0) { - ja(F[a >> 2]); - } - if (D[(a + 27) | 0] < 0) { - ja(F[(a + 16) >> 2]); - } - Z = (a + 32) | 0; - break a; - } - za(); - v(); - } - return b | 0; - } - function Hd(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0; - c = F[(a + 216) >> 2]; - if ((c | 0) != F[(a + 220) >> 2]) { - while (1) { - a: { - c = F[(L(e, 144) + c) >> 2]; - if ((c | 0) < 0) { - break a; - } - d = F[(a + 4) >> 2]; - f = F[(d + 8) >> 2]; - if ((c | 0) >= (F[(d + 12) >> 2] - f) >> 2) { - break a; - } - d = 0; - c = F[((c << 2) + f) >> 2]; - if (($[F[(F[c >> 2] + 24) >> 2]](c) | 0) <= 0) { - break a; - } - while (1) { - if ( - ($[F[(F[c >> 2] + 20) >> 2]](c, d) | 0) != - (b | 0) - ) { - d = (d + 1) | 0; - if (($[F[(F[c >> 2] + 24) >> 2]](c) | 0) > (d | 0)) { - continue; - } - break a; - } - break; - } - return (((F[(a + 216) >> 2] + L(e, 144)) | 0) + 104) | 0; - } - e = (e + 1) | 0; - c = F[(a + 216) >> 2]; - if (e >>> 0 < (((F[(a + 220) >> 2] - c) | 0) / 144) >>> 0) { - continue; - } - break; - } - } - return (a + 184) | 0; - } - function Uf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0; - d = (Z - 16) | 0; - Z = d; - F[(d + 12) >> 2] = 0; - a: { - e = ya(c); - if (e >>> 0 < 2147483632) { - b: { - c: { - if (e >>> 0 >= 11) { - f = ((e | 15) + 1) | 0; - a = ka(f); - F[(d + 8) >> 2] = f | -2147483648; - F[d >> 2] = a; - F[(d + 4) >> 2] = e; - f = (a + e) | 0; - break c; - } - D[(d + 11) | 0] = e; - f = (d + e) | 0; - a = d; - if (!e) { - break b; - } - } - la(a, c, e); - } - D[f | 0] = 0; - a = Ya(b, d); - d: { - if ((a | 0) == ((b + 4) | 0)) { - break d; - } - b = F[(a + 32) >> 2]; - a = F[(a + 28) >> 2]; - if (((b - a) | 0) != 4) { - break d; - } - F[(d + 12) >> 2] = - G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | (G[(a + 3) | 0] << 24)); - } - a = F[(d + 12) >> 2]; - if (D[(d + 11) | 0] < 0) { - ja(F[d >> 2]); - } - Z = (d + 16) | 0; - break a; - } - za(); - v(); - } - return a | 0; - } - function Mf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0; - d = (Z + -64) | 0; - Z = d; - e = Ja((d + 8) | 0); - F[(e + 16) >> 2] = 0; - F[(e + 20) >> 2] = 0; - F[e >> 2] = b; - F[(e + 8) >> 2] = c; - F[(e + 12) >> 2] = 0; - b = (d + 48) | 0; - Od(b); - F[(a + 24) >> 2] = F[(d + 48) >> 2]; - f = (a + 24) | 0; - a: { - if ((b | 0) == (f | 0)) { - break a; - } - b = (a + 28) | 0; - c = (d + 48) | 4; - g = G[(d + 63) | 0]; - e = (g << 24) >> 24; - if (D[(a + 39) | 0] >= 0) { - if ((e | 0) >= 0) { - a = F[(c + 4) >> 2]; - F[b >> 2] = F[c >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(c + 8) >> 2]; - break a; - } - qb(b, F[(d + 52) >> 2], F[(d + 56) >> 2]); - break a; - } - a = (e | 0) < 0; - rb(b, a ? F[(d + 52) >> 2] : c, a ? F[(d + 56) >> 2] : g); - } - if (D[(d + 63) | 0] < 0) { - ja(F[(d + 52) >> 2]); - } - Z = (d - -64) | 0; - return f | 0; - } - function Ce(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - e = 1; - a: { - if (($[F[(F[b >> 2] + 20) >> 2]](b) | 0) <= 0) { - break a; - } - while (1) { - e = 0; - d = Qc( - F[(F[(a + 4) >> 2] + 4) >> 2], - $[F[(F[b >> 2] + 24) >> 2]](b, f) | 0, - ); - if ((d | 0) == -1) { - break a; - } - g = F[(a + 4) >> 2]; - c = 0; - b: { - if ((d | 0) < 0) { - break b; - } - h = F[(g + 4) >> 2]; - if ( - (d | 0) >= - (F[(h + 12) >> 2] - F[(h + 8) >> 2]) >> 2 - ) { - break b; - } - c = - F[ - (F[(g + 8) >> 2] + - (F[(F[(g + 20) >> 2] + (d << 2)) >> 2] << 2)) >> - 2 - ]; - c = $[F[(F[c >> 2] + 32) >> 2]](c, d) | 0; - } - if (!c) { - break a; - } - if (!($[F[(F[b >> 2] + 28) >> 2]](b, c) | 0)) { - break a; - } - e = 1; - f = (f + 1) | 0; - if (($[F[(F[b >> 2] + 20) >> 2]](b) | 0) > (f | 0)) { - continue; - } - break; - } - } - return e | 0; - } - function Db(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - a: { - c = F[(a + 4) >> 2]; - e = F[a >> 2]; - d = (c - e) | 0; - b: { - if (d >>> 0 < b >>> 0) { - g = (b - d) | 0; - f = F[(a + 8) >> 2]; - if (g >>> 0 <= (f - c) >>> 0) { - (h = a), - (i = (ma(c, 0, g) + g) | 0), - (F[(h + 4) >> 2] = i); - break b; - } - if ((b | 0) < 0) { - break a; - } - c = (f - e) | 0; - f = c << 1; - c = - c >>> 0 >= 1073741823 - ? 2147483647 - : b >>> 0 < f >>> 0 - ? f - : b; - f = ka(c); - ma((f + d) | 0, 0, g); - d = pa(f, e, d); - F[(a + 8) >> 2] = d + c; - F[(a + 4) >> 2] = b + d; - F[a >> 2] = d; - if (!e) { - break b; - } - ja(e); - break b; - } - if (b >>> 0 >= d >>> 0) { - break b; - } - F[(a + 4) >> 2] = b + e; - } - b = F[(a + 28) >> 2]; - c = b; - d = (b + 1) | 0; - b = (F[(a + 24) >> 2] + 1) | 0; - e = b ? c : d; - F[(a + 24) >> 2] = b; - F[(a + 28) >> 2] = e; - return; - } - na(); - v(); - } - function Ma(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - e = F[(a + 4) >> 2]; - if ((e | 0) != F[(a + 8) >> 2]) { - F[e >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = e + 4; - return; - } - a: { - g = F[a >> 2]; - f = (e - g) | 0; - c = f >> 2; - d = (c + 1) | 0; - if (d >>> 0 < 1073741824) { - h = c << 2; - c = (f >>> 1) | 0; - c = - f >>> 0 >= 2147483644 - ? 1073741823 - : c >>> 0 > d >>> 0 - ? c - : d; - if (c) { - if (c >>> 0 >= 1073741824) { - break a; - } - f = ka(c << 2); - } else { - f = 0; - } - d = (h + f) | 0; - F[d >> 2] = F[b >> 2]; - b = (d + 4) | 0; - if ((e | 0) != (g | 0)) { - while (1) { - d = (d - 4) | 0; - e = (e - 4) | 0; - F[d >> 2] = F[e >> 2]; - if ((e | 0) != (g | 0)) { - continue; - } - break; - } - } - F[(a + 8) >> 2] = f + (c << 2); - F[(a + 4) >> 2] = b; - F[a >> 2] = d; - if (g) { - ja(g); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function va(a) { - F[a >> 2] = -1; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - D[(a + 28) | 0] = 1; - F[(a + 20) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 12) >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 40) >> 2] = 0; - F[(a + 44) >> 2] = 0; - F[(a + 48) >> 2] = 0; - F[(a + 52) >> 2] = 0; - F[(a + 56) >> 2] = 0; - F[(a + 60) >> 2] = 0; - F[(a + 64) >> 2] = 0; - F[(a + 68) >> 2] = 0; - F[(a + 76) >> 2] = 0; - F[(a + 80) >> 2] = 0; - F[(a + 84) >> 2] = 0; - F[(a + 88) >> 2] = 0; - F[(a + 92) >> 2] = 0; - F[(a + 96) >> 2] = 0; - F[(a + 72) >> 2] = a + 4; - F[(a + 104) >> 2] = 0; - F[(a + 108) >> 2] = 0; - D[(a + 100) | 0] = 1; - F[(a + 112) >> 2] = 0; - F[(a + 116) >> 2] = 0; - F[(a + 120) >> 2] = 0; - F[(a + 124) >> 2] = 0; - F[(a + 128) >> 2] = 0; - F[(a + 132) >> 2] = 0; - F[(a + 136) >> 2] = 0; - F[(a + 140) >> 2] = 0; - } - function Hb(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0; - d = F[(a + 12) >> 2]; - c = (F[(a + 16) >> 2] - d) >> 2; - a: { - if (c >>> 0 < b >>> 0) { - qa((a + 12) | 0, (b - c) | 0); - break a; - } - if (b >>> 0 >= c >>> 0) { - break a; - } - F[(a + 16) >> 2] = d + (b << 2); - } - b: { - c = F[a >> 2]; - c: { - if (((F[(a + 8) >> 2] - c) >> 2) >>> 0 >= b >>> 0) { - break c; - } - if (b >>> 0 >= 1073741824) { - break b; - } - d = F[(a + 4) >> 2]; - e = b << 2; - b = ka(e); - e = (b + e) | 0; - f = (b + ((d - c) & -4)) | 0; - b = f; - if ((c | 0) != (d | 0)) { - while (1) { - b = (b - 4) | 0; - d = (d - 4) | 0; - F[b >> 2] = F[d >> 2]; - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - } - F[(a + 8) >> 2] = e; - F[(a + 4) >> 2] = f; - F[a >> 2] = b; - if (!c) { - break c; - } - ja(c); - } - return; - } - na(); - v(); - } - function tb(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - F[a >> 2] = 10300; - b = F[(a + 68) >> 2]; - if (b) { - F[(a + 72) >> 2] = b; - ja(b); - } - b = F[(a + 56) >> 2]; - if (b) { - F[(a + 60) >> 2] = b; - ja(b); - } - b = F[(a + 44) >> 2]; - if (b) { - F[(a + 48) >> 2] = b; - ja(b); - } - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - b = F[(a + 20) >> 2]; - if (b) { - F[(a + 24) >> 2] = b; - ja(b); - } - b = F[(a + 8) >> 2]; - if (b) { - d = b; - c = F[(a + 12) >> 2]; - if ((b | 0) != (c | 0)) { - while (1) { - c = (c - 4) | 0; - d = F[c >> 2]; - F[c >> 2] = 0; - if (d) { - xa(d); - } - if ((b | 0) != (c | 0)) { - continue; - } - break; - } - d = F[(a + 8) >> 2]; - } - F[(a + 12) >> 2] = b; - ja(d); - } - b = F[(a + 4) >> 2]; - F[(a + 4) >> 2] = 0; - if (b) { - ic(b); - } - return a | 0; - } - function qa(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - e = F[(a + 8) >> 2]; - c = F[(a + 4) >> 2]; - if (((e - c) >> 2) >>> 0 >= b >>> 0) { - if (b) { - b = b << 2; - c = (ma(c, 0, b) + b) | 0; - } - F[(a + 4) >> 2] = c; - return; - } - a: { - f = c; - c = F[a >> 2]; - g = (f - c) | 0; - h = g >> 2; - d = (h + b) | 0; - if (d >>> 0 < 1073741824) { - e = (e - c) | 0; - f = (e >>> 1) | 0; - d = - e >>> 0 >= 2147483644 - ? 1073741823 - : d >>> 0 < f >>> 0 - ? f - : d; - if (d) { - if (d >>> 0 >= 1073741824) { - break a; - } - i = ka(d << 2); - } - b = b << 2; - e = ma(((h << 2) + i) | 0, 0, b); - f = d << 2; - d = pa(i, c, g); - F[(a + 8) >> 2] = f + d; - F[(a + 4) >> 2] = b + e; - F[a >> 2] = d; - if (c) { - ja(c); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function gc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0; - c = (a + 4) | 0; - a = Ya(a, b); - a: { - if ((c | 0) == (a | 0)) { - break a; - } - b = (a + 28) | 0; - b = D[(a + 39) | 0] < 0 ? F[b >> 2] : b; - while (1) { - a = b; - b = (a + 1) | 0; - c = D[a | 0]; - if (((c | 0) == 32) | ((c - 9) >>> 0 < 5)) { - continue; - } - break; - } - b: { - c: { - d: { - c = D[a | 0]; - switch ((c - 43) | 0) { - case 0: - break c; - case 2: - break d; - default: - break b; - } - } - e = 1; - } - c = D[b | 0]; - a = b; - } - if ((c - 48) >>> 0 < 10) { - while (1) { - d = (((L(d, 10) - D[a | 0]) | 0) + 48) | 0; - b = D[(a + 1) | 0]; - a = (a + 1) | 0; - if ((b - 48) >>> 0 < 10) { - continue; - } - break; - } - } - a = e ? d : (0 - d) | 0; - if ((a | 0) == -1) { - break a; - } - f = (a | 0) != 0; - } - return f; - } - function Qa(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - a = F[a >> 2]; - c = F[(a + 4) >> 2]; - e = F[(a + 8) >> 2]; - if (c >>> 0 < e >>> 0) { - F[c >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = c + 4; - return; - } - a: { - d = c; - c = F[a >> 2]; - g = (d - c) | 0; - d = g >> 2; - f = (d + 1) | 0; - if (f >>> 0 < 1073741824) { - h = d << 2; - e = (e - c) | 0; - d = (e >>> 1) | 0; - f = - e >>> 0 >= 2147483644 - ? 1073741823 - : f >>> 0 < d >>> 0 - ? d - : f; - if (f) { - if (f >>> 0 >= 1073741824) { - break a; - } - e = ka(f << 2); - } else { - e = 0; - } - d = (h + e) | 0; - F[d >> 2] = F[b >> 2]; - b = pa(e, c, g); - F[(a + 8) >> 2] = b + (f << 2); - F[(a + 4) >> 2] = d + 4; - F[a >> 2] = b; - if (c) { - ja(c); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function db(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - f = (Z - 16) | 0; - Z = f; - d = (Z - 32) | 0; - Z = d; - e = (Z - 16) | 0; - Z = e; - F[(e + 12) >> 2] = b; - F[(e + 8) >> 2] = b + c; - F[(d + 24) >> 2] = F[(e + 12) >> 2]; - F[(d + 28) >> 2] = F[(e + 8) >> 2]; - Z = (e + 16) | 0; - c = (Z - 16) | 0; - Z = c; - h = F[(d + 28) >> 2]; - e = F[(d + 24) >> 2]; - g = (h - e) | 0; - if ((e | 0) != (h | 0)) { - pa(a, e, g); - } - F[(c + 12) >> 2] = e + g; - F[(c + 8) >> 2] = a + g; - F[(d + 16) >> 2] = F[(c + 12) >> 2]; - F[(d + 20) >> 2] = F[(c + 8) >> 2]; - Z = (c + 16) | 0; - F[(d + 12) >> 2] = ((F[(d + 16) >> 2] - b) | 0) + b; - F[(d + 8) >> 2] = ((F[(d + 20) >> 2] - a) | 0) + a; - F[(f + 8) >> 2] = F[(d + 12) >> 2]; - F[(f + 12) >> 2] = F[(d + 8) >> 2]; - Z = (d + 32) | 0; - Z = (f + 16) | 0; - } - function _a(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - e = F[(a + 8) >> 2]; - c = F[(a + 4) >> 2]; - if (((e - c) >> 3) >>> 0 >= b >>> 0) { - if (b) { - b = b << 3; - c = (ma(c, 0, b) + b) | 0; - } - F[(a + 4) >> 2] = c; - return; - } - a: { - f = c; - c = F[a >> 2]; - g = (f - c) | 0; - h = g >> 3; - d = (h + b) | 0; - if (d >>> 0 < 536870912) { - e = (e - c) | 0; - f = (e >>> 2) | 0; - d = - e >>> 0 >= 2147483640 - ? 536870911 - : d >>> 0 < f >>> 0 - ? f - : d; - if (d) { - if (d >>> 0 >= 536870912) { - break a; - } - i = ka(d << 3); - } - b = b << 3; - e = ma(((h << 3) + i) | 0, 0, b); - f = d << 3; - d = pa(i, c, g); - F[(a + 8) >> 2] = f + d; - F[(a + 4) >> 2] = b + e; - F[a >> 2] = d; - if (c) { - ja(c); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function re(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - F[a >> 2] = 2016; - b = F[(a + 60) >> 2]; - F[(a + 60) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - d = F[(a + 36) >> 2]; - if (d) { - c = F[(a + 40) >> 2]; - b = d; - if ((c | 0) != (b | 0)) { - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - b = F[(a + 36) >> 2]; - } - F[(a + 40) >> 2] = d; - ja(b); - } - F[a >> 2] = 1776; - b = F[(a + 16) >> 2]; - if (b) { - F[(a + 20) >> 2] = b; - ja(b); - } - b = F[(a + 4) >> 2]; - if (b) { - F[(a + 8) >> 2] = b; - ja(b); - } - return a | 0; - } - function qe(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - F[a >> 2] = 2016; - b = F[(a + 60) >> 2]; - F[(a + 60) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - d = F[(a + 36) >> 2]; - if (d) { - c = F[(a + 40) >> 2]; - b = d; - if ((c | 0) != (b | 0)) { - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - b = F[(a + 36) >> 2]; - } - F[(a + 40) >> 2] = d; - ja(b); - } - F[a >> 2] = 1776; - b = F[(a + 16) >> 2]; - if (b) { - F[(a + 20) >> 2] = b; - ja(b); - } - b = F[(a + 4) >> 2]; - if (b) { - F[(a + 8) >> 2] = b; - ja(b); - } - ja(a); - } - function Eg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0; - a: { - b = F[(a + 8) >> 2]; - b: { - if ((b | 0) < 0) { - break b; - } - c = F[(a + 4) >> 2]; - e = F[c >> 2]; - d = (F[(c + 4) >> 2] - e) >> 2; - c: { - if (d >>> 0 < b >>> 0) { - nd(c, (b - d) | 0); - f = F[(a + 8) >> 2]; - break c; - } - f = b; - if (b >>> 0 >= d >>> 0) { - break c; - } - F[(c + 4) >> 2] = e + (b << 2); - f = b; - } - d = f; - if ((d | 0) <= 0) { - break b; - } - a = F[(a + 4) >> 2]; - c = F[a >> 2]; - e = (F[(a + 4) >> 2] - c) >> 2; - a = 0; - while (1) { - if ((a | 0) == (e | 0)) { - break a; - } - F[(c + (a << 2)) >> 2] = a; - a = (a + 1) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - } - return ((b ^ -1) >>> 31) | 0; - } - ta(); - v(); - } - function fh(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0; - d = (Z - 16) | 0; - Z = d; - e = F[(a + 4) >> 2]; - a: { - if ((e | 0) == -1) { - break a; - } - c = F[(b + 20) >> 2]; - if ((!!F[(b + 16) >> 2] & ((c | 0) >= 0)) | ((c | 0) > 0)) { - break a; - } - pb(b, F[(b + 4) >> 2], F[(a + 8) >> 2], F[(a + 12) >> 2]); - c = F[(b + 20) >> 2]; - if ((!!F[(b + 16) >> 2] & ((c | 0) >= 0)) | ((c | 0) > 0)) { - break a; - } - pb(b, F[(b + 4) >> 2], (a + 20) | 0, (a + 24) | 0); - c = F[(b + 20) >> 2]; - f = F[(b + 16) >> 2]; - D[(d + 15) | 0] = F[(a + 4) >> 2]; - if ((!!f & ((c | 0) >= 0)) | ((c | 0) > 0)) { - break a; - } - pb(b, F[(b + 4) >> 2], (d + 15) | 0, (d + 16) | 0); - } - Z = (d + 16) | 0; - return ((e | 0) != -1) | 0; - } - function kd(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0, - h = 0; - e = F[(a + 8) >> 2]; - c = F[(a + 4) >> 2]; - if (((e - c) >> 1) >>> 0 >= b >>> 0) { - if (b) { - b = b << 1; - c = (ma(c, 0, b) + b) | 0; - } - F[(a + 4) >> 2] = c; - return; - } - a: { - f = c; - c = F[a >> 2]; - g = (f - c) | 0; - f = g >> 1; - d = (f + b) | 0; - if ((d | 0) >= 0) { - e = (e - c) | 0; - d = - e >>> 0 >= 2147483646 - ? 2147483647 - : d >>> 0 < e >>> 0 - ? e - : d; - if (d) { - if ((d | 0) < 0) { - break a; - } - h = ka(d << 1); - } - b = b << 1; - e = ma(((f << 1) + h) | 0, 0, b); - f = d << 1; - d = pa(h, c, g); - F[(a + 8) >> 2] = f + d; - F[(a + 4) >> 2] = b + e; - F[a >> 2] = d; - if (c) { - ja(c); - } - return; - } - na(); - v(); - } - oa(); - v(); - } - function of(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0; - d = (Z - 16) | 0; - Z = d; - Pd(d, a, b, c); - F[(a + 24) >> 2] = F[d >> 2]; - e = (a + 24) | 0; - a: { - if ((e | 0) == (d | 0)) { - break a; - } - b = (a + 28) | 0; - c = d | 4; - f = G[(d + 15) | 0]; - g = (f << 24) >> 24; - if (D[(a + 39) | 0] >= 0) { - if ((g | 0) >= 0) { - a = F[(c + 4) >> 2]; - F[b >> 2] = F[c >> 2]; - F[(b + 4) >> 2] = a; - F[(b + 8) >> 2] = F[(c + 8) >> 2]; - break a; - } - qb(b, F[(d + 4) >> 2], F[(d + 8) >> 2]); - break a; - } - a = (g | 0) < 0; - rb(b, a ? F[(d + 4) >> 2] : c, a ? F[(d + 8) >> 2] : f); - } - if (D[(d + 15) | 0] < 0) { - ja(F[(d + 4) >> 2]); - } - Z = (d + 16) | 0; - return e | 0; - } - function ra(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - e = (Z - 16) | 0; - Z = e; - a: { - b: { - if (c >>> 0 < 11) { - d = a; - D[(a + 11) | 0] = (G[(a + 11) | 0] & 128) | c; - D[(a + 11) | 0] = G[(a + 11) | 0] & 127; - break b; - } - if (c >>> 0 > 2147483631) { - break a; - } - g = (e + 8) | 0; - if (c >>> 0 >= 11) { - f = (c + 16) & -16; - d = (f - 1) | 0; - d = (d | 0) == 11 ? f : d; - } else { - d = 10; - } - sb(g, (d + 1) | 0); - d = F[(e + 8) >> 2]; - F[a >> 2] = d; - F[(a + 8) >> 2] = - (F[(a + 8) >> 2] & -2147483648) | - (F[(e + 12) >> 2] & 2147483647); - F[(a + 8) >> 2] = F[(a + 8) >> 2] | -2147483648; - F[(a + 4) >> 2] = c; - } - db(d, b, (c + 1) | 0); - Z = (e + 16) | 0; - return; - } - za(); - v(); - } - function pf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0; - b = (Z - 16) | 0; - Z = b; - Od(b); - F[(a + 24) >> 2] = F[b >> 2]; - e = (a + 24) | 0; - a: { - if ((e | 0) == (b | 0)) { - break a; - } - c = (a + 28) | 0; - d = b | 4; - f = G[(b + 15) | 0]; - g = (f << 24) >> 24; - if (D[(a + 39) | 0] >= 0) { - if ((g | 0) >= 0) { - a = F[(d + 4) >> 2]; - F[c >> 2] = F[d >> 2]; - F[(c + 4) >> 2] = a; - F[(c + 8) >> 2] = F[(d + 8) >> 2]; - break a; - } - qb(c, F[(b + 4) >> 2], F[(b + 8) >> 2]); - break a; - } - a = (g | 0) < 0; - rb(c, a ? F[(b + 4) >> 2] : d, a ? F[(b + 8) >> 2] : f); - } - if (D[(b + 15) | 0] < 0) { - ja(F[(b + 4) >> 2]); - } - Z = (b + 16) | 0; - return e | 0; - } - function Rf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0; - d = (Z - 16) | 0; - Z = d; - a: { - e = ya(c); - if (e >>> 0 < 2147483632) { - b: { - c: { - if (e >>> 0 >= 11) { - g = ((e | 15) + 1) | 0; - f = ka(g); - F[(d + 8) >> 2] = g | -2147483648; - F[d >> 2] = f; - F[(d + 4) >> 2] = e; - g = (e + f) | 0; - break c; - } - D[(d + 11) | 0] = e; - g = (d + e) | 0; - f = d; - if (!e) { - break b; - } - } - la(f, c, e); - } - D[g | 0] = 0; - f = (a + 16) | 0; - c = Sc(b, d, f); - b = F[(a + 16) >> 2]; - a = D[(a + 27) | 0]; - if (D[(d + 11) | 0] < 0) { - ja(F[d >> 2]); - } - Z = (d + 16) | 0; - a = c ? ((a | 0) < 0 ? b : f) : 0; - break a; - } - za(); - v(); - } - return a | 0; - } - function Yb(a, b) { - var c = 0, - d = 0, - e = 0; - c = F[(a + 4) >> 2]; - d = (c + b) | 0; - F[(a + 4) >> 2] = d; - if (!(((d - 1) ^ (c - 1)) >>> 0 < 32 ? c : 0)) { - F[ - (F[a >> 2] + - ((d >>> 0 >= 33 ? ((d - 1) >>> 5) | 0 : 0) << 2)) >> - 2 - ] = 0; - } - a: { - if (!b) { - break a; - } - a = (F[a >> 2] + ((c >>> 3) & 536870908)) | 0; - c = c & 31; - if (c) { - d = (32 - c) | 0; - e = b >>> 0 > d >>> 0 ? d : b; - F[a >> 2] = - F[a >> 2] & (((-1 << c) & (-1 >>> (d - e))) ^ -1); - b = (b - e) | 0; - a = (a + 4) | 0; - } - c = (b >>> 5) | 0; - if (b >>> 0 >= 32) { - ma(a, 0, c << 2); - } - if ((b & -32) == (b | 0)) { - break a; - } - a = ((c << 2) + a) | 0; - F[a >> 2] = F[a >> 2] & ((-1 >>> (32 - (b & 31))) ^ -1); - } - } - function ld(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 10) { - break a; - } - d = F[(c + 20) >> 2]; - f = F[(c + 12) >> 2]; - e = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (f | 0)) & (e >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (f | 0)) - ) { - break a; - } - f = D[(e + F[c >> 2]) | 0]; - e = (e + 1) | 0; - d = e ? d : (d + 1) | 0; - F[(c + 16) >> 2] = e; - F[(c + 20) >> 2] = d; - d = f; - b: { - if ((d | 0) < 0) { - if (!ld((a + 1) | 0, b, c)) { - break a; - } - a = F[b >> 2]; - d = (d & 127) | (a << 7); - a = (F[(b + 4) >> 2] << 7) | (a >>> 25); - break b; - } - d = d & 255; - a = 0; - } - F[b >> 2] = d; - F[(b + 4) >> 2] = a; - g = 1; - } - return g; - } - function Sa(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 10) { - break a; - } - d = F[(c + 20) >> 2]; - f = F[(c + 12) >> 2]; - e = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (f | 0)) & (e >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (f | 0)) - ) { - break a; - } - f = D[(e + F[c >> 2]) | 0]; - e = (e + 1) | 0; - d = e ? d : (d + 1) | 0; - F[(c + 16) >> 2] = e; - F[(c + 20) >> 2] = d; - d = f; - b: { - if ((d | 0) < 0) { - if (!Sa((a + 1) | 0, b, c)) { - break a; - } - a = F[b >> 2]; - d = (d & 127) | (a << 7); - a = (F[(b + 4) >> 2] << 7) | (a >>> 25); - break b; - } - d = d & 255; - a = 0; - } - F[b >> 2] = d; - F[(b + 4) >> 2] = a; - g = 1; - } - return g; - } - function Ne(a, b, c, d, e) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - if (La(a, F[(b + 8) >> 2], e)) { - if ( - !((F[(b + 28) >> 2] == 1) | (F[(b + 4) >> 2] != (c | 0))) - ) { - F[(b + 28) >> 2] = d; - } - return; - } - a: { - if (!La(a, F[b >> 2], e)) { - break a; - } - if ( - !( - (F[(b + 16) >> 2] != (c | 0)) & - (F[(b + 20) >> 2] != (c | 0)) - ) - ) { - if ((d | 0) != 1) { - break a; - } - F[(b + 32) >> 2] = 1; - return; - } - F[(b + 20) >> 2] = c; - F[(b + 32) >> 2] = d; - F[(b + 40) >> 2] = F[(b + 40) >> 2] + 1; - if (!((F[(b + 36) >> 2] != 1) | (F[(b + 24) >> 2] != 2))) { - D[(b + 54) | 0] = 1; - } - F[(b + 44) >> 2] = 4; - } - } - function jg(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - e = (Z + -64) | 0; - Z = e; - d = $[F[(F[a >> 2] + 44) >> 2]](a, b) | 0; - a = $[F[(F[a >> 2] + 40) >> 2]](a, b) | 0; - f = kb(e); - g = F[(b + 56) >> 2]; - h = d & 255; - i = a; - a = (a - 1) | 0; - if (a >>> 0 <= 10) { - a = F[((a << 2) + 10148) >> 2]; - } else { - a = -1; - } - d = L(a, d); - cc(f, g, h, i, 0, d, d >> 31); - a = bc(ka(96), f); - ac(a, c); - D[(a + 84) | 0] = 1; - F[(a + 72) >> 2] = F[(a + 68) >> 2]; - F[(a + 60) >> 2] = F[(b + 60) >> 2]; - Z = (e - -64) | 0; - return a | 0; - } - function rh(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - F[a >> 2] = 8176; - b = F[(a + 48) >> 2]; - F[(a + 48) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - F[a >> 2] = 10032; - b = F[(a + 20) >> 2]; - if (b) { - F[(a + 24) >> 2] = b; - ja(b); - } - d = F[(a + 8) >> 2]; - if (d) { - c = F[(a + 12) >> 2]; - b = d; - if ((c | 0) != (b | 0)) { - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - b = F[(a + 8) >> 2]; - } - F[(a + 12) >> 2] = d; - ja(b); - } - return a | 0; - } - function Dc(a, b, c, d) { - D[(a + 53) | 0] = 1; - a: { - if (F[(a + 4) >> 2] != (c | 0)) { - break a; - } - D[(a + 52) | 0] = 1; - c = F[(a + 16) >> 2]; - b: { - if (!c) { - F[(a + 36) >> 2] = 1; - F[(a + 24) >> 2] = d; - F[(a + 16) >> 2] = b; - if ((d | 0) != 1) { - break a; - } - if (F[(a + 48) >> 2] == 1) { - break b; - } - break a; - } - if ((b | 0) == (c | 0)) { - c = F[(a + 24) >> 2]; - if ((c | 0) == 2) { - F[(a + 24) >> 2] = d; - c = d; - } - if (F[(a + 48) >> 2] != 1) { - break a; - } - if ((c | 0) == 1) { - break b; - } - break a; - } - F[(a + 36) >> 2] = F[(a + 36) >> 2] + 1; - } - D[(a + 54) | 0] = 1; - } - } - function qh(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - F[a >> 2] = 8176; - b = F[(a + 48) >> 2]; - F[(a + 48) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - F[a >> 2] = 10032; - b = F[(a + 20) >> 2]; - if (b) { - F[(a + 24) >> 2] = b; - ja(b); - } - d = F[(a + 8) >> 2]; - if (d) { - c = F[(a + 12) >> 2]; - b = d; - if ((c | 0) != (b | 0)) { - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - b = F[(a + 8) >> 2]; - } - F[(a + 12) >> 2] = d; - ja(b); - } - ja(a); - } - function Se(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0; - e = (Z + -64) | 0; - Z = e; - d = 1; - a: { - if (La(a, b, 0)) { - break a; - } - d = 0; - if (!b) { - break a; - } - b = Fc(b, 11068); - d = 0; - if (!b) { - break a; - } - d = (e + 8) | 0; - ma(d | 4, 0, 52); - F[(e + 56) >> 2] = 1; - F[(e + 20) >> 2] = -1; - F[(e + 16) >> 2] = a; - F[(e + 8) >> 2] = b; - $[F[(F[b >> 2] + 28) >> 2]](b, d, F[c >> 2], 1); - a = F[(e + 32) >> 2]; - if ((a | 0) == 1) { - F[c >> 2] = F[(e + 24) >> 2]; - } - d = (a | 0) == 1; - } - Z = (e - -64) | 0; - return d | 0; - } - function Fd(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0; - d = (Z - 16) | 0; - Z = d; - F[(a + 4) >> 2] = b; - b = F[(b + 64) >> 2]; - e = F[b >> 2]; - b = F[(b + 4) >> 2]; - D[(d + 15) | 0] = 0; - Ea( - (a + 24) | 0, - ((((b - e) >> 2) >>> 0) / 3) | 0, - (d + 15) | 0, - ); - b = F[(a + 4) >> 2]; - e = F[(b + 56) >> 2]; - b = F[(b + 52) >> 2]; - D[(d + 14) | 0] = 0; - Ea((a + 36) | 0, (e - b) >> 2, (d + 14) | 0); - b = F[(c + 12) >> 2]; - F[(a + 16) >> 2] = F[(c + 8) >> 2]; - F[(a + 20) >> 2] = b; - b = F[(c + 4) >> 2]; - F[(a + 8) >> 2] = F[c >> 2]; - F[(a + 12) >> 2] = b; - Z = (d + 16) | 0; - } - function zf(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - var e = 0, - f = 0, - g = 0; - a = (Z - 16) | 0; - Z = a; - f = D[(b + 24) | 0]; - e = F[2555]; - F[(a + 8) >> 2] = F[2554]; - F[(a + 12) >> 2] = e; - e = F[2553]; - F[a >> 2] = F[2552]; - F[(a + 4) >> 2] = e; - e = lb(b, c, f, a); - if (e) { - b = 0; - if (f) { - c = (f & 255) << 2; - b = ka(c); - g = (la(b, a, c) + c) | 0; - } - c = F[d >> 2]; - if (c) { - F[(d + 4) >> 2] = c; - ja(c); - } - F[(d + 8) >> 2] = g; - F[(d + 4) >> 2] = g; - F[d >> 2] = b; - } - Z = (a + 16) | 0; - return e | 0; - } - function wd(a, b) { - var c = 0, - d = 0; - a: { - c = F[(a + 4) >> 2]; - d = F[(a + 8) >> 2]; - if ((c | 0) == d << 5) { - if (((c + 1) | 0) < 0) { - break a; - } - if (c >>> 0 <= 1073741822) { - d = d << 6; - c = ((c & -32) + 32) | 0; - c = c >>> 0 < d >>> 0 ? d : c; - } else { - c = 2147483647; - } - $a(a, c); - c = F[(a + 4) >> 2]; - } - F[(a + 4) >> 2] = c + 1; - d = 1 << c; - a = (F[a >> 2] + ((c >>> 3) & 536870908)) | 0; - if (G[b | 0]) { - F[a >> 2] = d | F[a >> 2]; - return; - } - F[a >> 2] = F[a >> 2] & (d ^ -1); - return; - } - na(); - v(); - } - function Zb(a) { - var b = 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 56) >> 2] = 0; - F[(a + 48) >> 2] = 0; - F[(a + 52) >> 2] = 0; - F[(a + 40) >> 2] = 0; - F[(a + 44) >> 2] = 0; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - b = (a - -64) | 0; - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - F[(a + 72) >> 2] = 0; - F[(a + 76) >> 2] = 0; - F[(a + 80) >> 2] = 0; - F[(a + 84) >> 2] = 0; - F[(a + 60) >> 2] = a; - return a; - } - function ve(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - f = $[F[(F[a >> 2] + 24) >> 2]](a) | 0; - c = 1; - a: { - if ((f | 0) <= 0) { - break a; - } - d = F[F[(a + 36) >> 2] >> 2]; - g = (a + 48) | 0; - c = 0; - if (!($[F[(F[d >> 2] + 16) >> 2]](d, g, b) | 0)) { - break a; - } - while (1) { - e = (e + 1) | 0; - if ((f | 0) != (e | 0)) { - d = F[(F[(a + 36) >> 2] + (e << 2)) >> 2]; - if ($[F[(F[d >> 2] + 16) >> 2]](d, g, b) | 0) { - continue; - } - } - break; - } - c = (e | 0) >= (f | 0); - } - return c | 0; - } - function ue(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0, - e = 0, - f = 0, - g = 0; - f = $[F[(F[a >> 2] + 24) >> 2]](a) | 0; - c = 1; - a: { - if ((f | 0) <= 0) { - break a; - } - d = F[F[(a + 36) >> 2] >> 2]; - g = (a + 48) | 0; - c = 0; - if (!($[F[(F[d >> 2] + 20) >> 2]](d, g, b) | 0)) { - break a; - } - while (1) { - e = (e + 1) | 0; - if ((f | 0) != (e | 0)) { - d = F[(F[(a + 36) >> 2] + (e << 2)) >> 2]; - if ($[F[(F[d >> 2] + 20) >> 2]](d, g, b) | 0) { - continue; - } - } - break; - } - c = (e | 0) >= (f | 0); - } - return c | 0; - } - function bh(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0; - d = (Z - 16) | 0; - Z = d; - F[(a + 4) >> 2] = b; - e = F[b >> 2]; - b = F[(b + 4) >> 2]; - D[(d + 15) | 0] = 0; - Ea( - (a + 24) | 0, - ((((b - e) >> 2) >>> 0) / 3) | 0, - (d + 15) | 0, - ); - b = F[(a + 4) >> 2]; - e = F[(b + 28) >> 2]; - b = F[(b + 24) >> 2]; - D[(d + 14) | 0] = 0; - Ea((a + 36) | 0, (e - b) >> 2, (d + 14) | 0); - b = F[(c + 12) >> 2]; - F[(a + 16) >> 2] = F[(c + 8) >> 2]; - F[(a + 20) >> 2] = b; - b = F[(c + 4) >> 2]; - F[(a + 8) >> 2] = F[c >> 2]; - F[(a + 12) >> 2] = b; - Z = (d + 16) | 0; - } - function hb(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 5) { - break a; - } - d = F[(c + 20) >> 2]; - e = F[(c + 12) >> 2]; - f = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (e | 0)) & (f >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (e | 0)) - ) { - break a; - } - e = G[(F[c >> 2] + f) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = (e << 24) >> 24; - if ((d | 0) < 0) { - if (!hb((a + 1) | 0, b, c)) { - break a; - } - e = (d & 127) | (F[b >> 2] << 7); - } - F[b >> 2] = e; - g = 1; - } - return g; - } - function fb(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 5) { - break a; - } - d = F[(c + 20) >> 2]; - e = F[(c + 12) >> 2]; - f = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (e | 0)) & (f >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (e | 0)) - ) { - break a; - } - e = G[(F[c >> 2] + f) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = (e << 24) >> 24; - if ((d | 0) < 0) { - if (!fb((a + 1) | 0, b, c)) { - break a; - } - e = (d & 127) | (F[b >> 2] << 7); - } - F[b >> 2] = e; - g = 1; - } - return g; - } - function Wb(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 5) { - break a; - } - d = F[(c + 20) >> 2]; - e = F[(c + 12) >> 2]; - f = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (e | 0)) & (f >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (e | 0)) - ) { - break a; - } - e = G[(F[c >> 2] + f) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = (e << 24) >> 24; - if ((d | 0) < 0) { - if (!Wb((a + 1) | 0, b, c)) { - break a; - } - e = (d & 127) | (F[b >> 2] << 7); - } - F[b >> 2] = e; - g = 1; - } - return g; - } - function Ta(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 5) { - break a; - } - d = F[(c + 20) >> 2]; - e = F[(c + 12) >> 2]; - f = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (e | 0)) & (f >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (e | 0)) - ) { - break a; - } - e = G[(F[c >> 2] + f) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = (e << 24) >> 24; - if ((d | 0) < 0) { - if (!Ta((a + 1) | 0, b, c)) { - break a; - } - e = (d & 127) | (F[b >> 2] << 7); - } - F[b >> 2] = e; - g = 1; - } - return g; - } - function Qd(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 5) { - break a; - } - d = F[(c + 20) >> 2]; - e = F[(c + 12) >> 2]; - f = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (e | 0)) & (f >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (e | 0)) - ) { - break a; - } - e = G[(F[c >> 2] + f) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = (e << 24) >> 24; - if ((d | 0) < 0) { - if (!Qd((a + 1) | 0, b, c)) { - break a; - } - e = (d & 127) | (F[b >> 2] << 7); - } - F[b >> 2] = e; - g = 1; - } - return g; - } - function Oa(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 5) { - break a; - } - d = F[(c + 20) >> 2]; - e = F[(c + 12) >> 2]; - f = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (e | 0)) & (f >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (e | 0)) - ) { - break a; - } - e = G[(F[c >> 2] + f) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = (e << 24) >> 24; - if ((d | 0) < 0) { - if (!Oa((a + 1) | 0, b, c)) { - break a; - } - e = (d & 127) | (F[b >> 2] << 7); - } - F[b >> 2] = e; - g = 1; - } - return g; - } - function Da(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - a: { - if (a >>> 0 > 5) { - break a; - } - d = F[(c + 20) >> 2]; - e = F[(c + 12) >> 2]; - f = F[(c + 16) >> 2]; - if ( - (((d | 0) >= (e | 0)) & (f >>> 0 >= I[(c + 8) >> 2])) | - ((d | 0) > (e | 0)) - ) { - break a; - } - e = G[(F[c >> 2] + f) | 0]; - f = (f + 1) | 0; - d = f ? d : (d + 1) | 0; - F[(c + 16) >> 2] = f; - F[(c + 20) >> 2] = d; - d = (e << 24) >> 24; - if ((d | 0) < 0) { - if (!Da((a + 1) | 0, b, c)) { - break a; - } - e = (d & 127) | (F[b >> 2] << 7); - } - F[b >> 2] = e; - g = 1; - } - return g; - } - function sa(a, b, c) { - var d = 0, - e = 0; - a: { - b: { - if (c >>> 0 >= 4) { - if ((a | b) & 3) { - break b; - } - while (1) { - if (F[a >> 2] != F[b >> 2]) { - break b; - } - b = (b + 4) | 0; - a = (a + 4) | 0; - c = (c - 4) | 0; - if (c >>> 0 > 3) { - continue; - } - break; - } - } - if (!c) { - break a; - } - } - while (1) { - d = G[a | 0]; - e = G[b | 0]; - if ((d | 0) == (e | 0)) { - b = (b + 1) | 0; - a = (a + 1) | 0; - c = (c - 1) | 0; - if (c) { - continue; - } - break a; - } - break; - } - return (d - e) | 0; - } - return 0; - } - function td(a) { - var b = 0, - c = 0, - d = 0, - e = 0; - d = F[a >> 2]; - if (d) { - e = d; - c = F[(a + 4) >> 2]; - if ((d | 0) != (c | 0)) { - while (1) { - e = (c - 144) | 0; - b = F[(e + 132) >> 2]; - if (b) { - F[(c - 8) >> 2] = b; - ja(b); - } - b = F[(c - 28) >> 2]; - if (b) { - F[(c - 24) >> 2] = b; - ja(b); - } - b = F[(c - 40) >> 2]; - if (b) { - F[(c - 36) >> 2] = b; - ja(b); - } - Gb((c - 140) | 0); - c = e; - if ((d | 0) != (c | 0)) { - continue; - } - break; - } - e = F[a >> 2]; - } - F[(a + 4) >> 2] = d; - ja(e); - } - } - function Ef(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0; - d = F[(b + 4) >> 2]; - a: { - if (!d) { - break a; - } - b = F[(F[(F[(b + 8) >> 2] + (c << 2)) >> 2] + 60) >> 2]; - if ((b | 0) < 0) { - break a; - } - a = F[(d + 24) >> 2]; - c = F[(d + 28) >> 2]; - if ((a | 0) == (c | 0)) { - break a; - } - b: { - while (1) { - e = F[a >> 2]; - if ((b | 0) == F[(e + 24) >> 2]) { - break b; - } - a = (a + 4) | 0; - if ((c | 0) != (a | 0)) { - continue; - } - break; - } - e = 0; - } - } - return e | 0; - } - function ic(a) { - var b = 0, - c = 0, - d = 0; - if (a) { - d = F[(a + 24) >> 2]; - if (d) { - b = d; - c = F[(a + 28) >> 2]; - if ((b | 0) != (c | 0)) { - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - if (b) { - Ca((b + 12) | 0, F[(b + 16) >> 2]); - Ba(b, F[(b + 4) >> 2]); - ja(b); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - b = F[(a + 24) >> 2]; - } - F[(a + 28) >> 2] = d; - ja(b); - } - Ca((a + 12) | 0, F[(a + 16) >> 2]); - Ba(a, F[(a + 4) >> 2]); - ja(a); - } - } - function $g(a) { - a = a | 0; - var b = 0; - F[(a + 8) >> 2] = 9136; - F[a >> 2] = 8924; - b = F[(a + 96) >> 2]; - if (b) { - F[(a + 100) >> 2] = b; - ja(b); - } - b = F[(a + 80) >> 2]; - if (b) { - F[(a + 84) >> 2] = b; - ja(b); - } - b = F[(a + 68) >> 2]; - if (b) { - F[(a + 72) >> 2] = b; - ja(b); - } - b = F[(a + 56) >> 2]; - if (b) { - F[(a + 60) >> 2] = b; - ja(b); - } - F[(a + 8) >> 2] = 9372; - b = F[(a + 44) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 32) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function _g(a) { - a = a | 0; - var b = 0; - F[(a + 8) >> 2] = 9136; - F[a >> 2] = 8924; - b = F[(a + 96) >> 2]; - if (b) { - F[(a + 100) >> 2] = b; - ja(b); - } - b = F[(a + 80) >> 2]; - if (b) { - F[(a + 84) >> 2] = b; - ja(b); - } - b = F[(a + 68) >> 2]; - if (b) { - F[(a + 72) >> 2] = b; - ja(b); - } - b = F[(a + 56) >> 2]; - if (b) { - F[(a + 60) >> 2] = b; - ja(b); - } - F[(a + 8) >> 2] = 9372; - b = F[(a + 44) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 32) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function wh(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - F[a >> 2] = 10032; - b = F[(a + 20) >> 2]; - if (b) { - F[(a + 24) >> 2] = b; - ja(b); - } - d = F[(a + 8) >> 2]; - if (d) { - c = F[(a + 12) >> 2]; - b = d; - if ((c | 0) != (b | 0)) { - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - b = F[(a + 8) >> 2]; - } - F[(a + 12) >> 2] = d; - ja(b); - } - return a | 0; - } - function uc(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0, - f = 0, - g = 0, - h = 0, - i = 0; - h = F[(c + 8) >> 2]; - e = F[(c + 16) >> 2]; - g = F[(c + 12) >> 2]; - f = g; - d = F[(c + 20) >> 2]; - if ( - ((h >>> 0 > e >>> 0) & ((f | 0) >= (d | 0))) | - ((d | 0) < (f | 0)) - ) { - b = G[(F[c >> 2] + e) | 0]; - i = (e + 1) | 0; - f = i ? d : (d + 1) | 0; - F[(c + 16) >> 2] = i; - F[(c + 20) >> 2] = f; - F[(a + 4) >> 2] = b; - } - return ( - ((e >>> 0 < h >>> 0) & ((d | 0) <= (g | 0))) | - ((d | 0) < (g | 0)) - ); - } - function La(a, b, c) { - var d = 0; - if (!c) { - return F[(a + 4) >> 2] == F[(b + 4) >> 2]; - } - if ((a | 0) == (b | 0)) { - return 1; - } - d = F[(a + 4) >> 2]; - a = G[d | 0]; - c = F[(b + 4) >> 2]; - b = G[c | 0]; - a: { - if (!a | ((b | 0) != (a | 0))) { - break a; - } - while (1) { - b = G[(c + 1) | 0]; - a = G[(d + 1) | 0]; - if (!a) { - break a; - } - c = (c + 1) | 0; - d = (d + 1) | 0; - if ((a | 0) == (b | 0)) { - continue; - } - break; - } - } - return (a | 0) == (b | 0); - } - function Gg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - F[a >> 2] = 10032; - b = F[(a + 20) >> 2]; - if (b) { - F[(a + 24) >> 2] = b; - ja(b); - } - d = F[(a + 8) >> 2]; - if (d) { - c = F[(a + 12) >> 2]; - b = d; - if ((c | 0) != (b | 0)) { - while (1) { - c = (c - 4) | 0; - b = F[c >> 2]; - F[c >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - if ((c | 0) != (d | 0)) { - continue; - } - break; - } - b = F[(a + 8) >> 2]; - } - F[(a + 12) >> 2] = d; - ja(b); - } - ja(a); - } - function Gf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0; - d = F[(b + 12) >> 2]; - b = F[(b + 8) >> 2]; - a = 0; - a: { - if ((d | 0) == (b | 0)) { - break a; - } - a = (d - b) >> 2; - d = a >>> 0 <= 1 ? 1 : a; - a = 0; - b: { - while (1) { - e = F[(b + (a << 2)) >> 2]; - if (F[(e + 60) >> 2] == (c | 0)) { - break b; - } - a = (a + 1) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - a = 0; - break a; - } - a = (a | 0) != -1 ? e : 0; - } - return a | 0; - } - function ah(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 9136; - b = F[(a + 88) >> 2]; - if (b) { - F[(a + 92) >> 2] = b; - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - F[(a + 76) >> 2] = b; - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - F[(a - -64) >> 2] = b; - ja(b); - } - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - F[a >> 2] = 9372; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function Tc(a, b) { - var c = 0, - d = 0, - e = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - a: { - c = F[(b + 4) >> 2]; - d = F[b >> 2]; - b: { - if ((c | 0) == (d | 0)) { - a = c; - break b; - } - c = (c - d) | 0; - if ((c | 0) < 0) { - break a; - } - d = c; - e = ka(c); - c = ma(e, 0, c); - d = (d + c) | 0; - F[(a + 8) >> 2] = d; - F[(a + 4) >> 2] = d; - F[a >> 2] = c; - c = F[b >> 2]; - a = F[(b + 4) >> 2]; - } - la(e, c, (a - c) | 0); - return; - } - na(); - v(); - } - function Dd(a) { - var b = 0, - c = 0, - d = 0, - e = 0; - c = F[(a + 4) >> 2]; - d = F[a >> 2]; - if ((c | 0) != (d | 0)) { - while (1) { - e = (c - 144) | 0; - b = F[(e + 132) >> 2]; - if (b) { - F[(c - 8) >> 2] = b; - ja(b); - } - b = F[(c - 28) >> 2]; - if (b) { - F[(c - 24) >> 2] = b; - ja(b); - } - b = F[(c - 40) >> 2]; - if (b) { - F[(c - 36) >> 2] = b; - ja(b); - } - Gb((c - 140) | 0); - c = e; - if ((d | 0) != (c | 0)) { - continue; - } - break; - } - } - F[(a + 4) >> 2] = d; - } - function Xg(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 9136; - b = F[(a + 88) >> 2]; - if (b) { - F[(a + 92) >> 2] = b; - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - F[(a + 76) >> 2] = b; - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - F[(a - -64) >> 2] = b; - ja(b); - } - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - F[a >> 2] = 9372; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function Za(a) { - var b = 0; - if (a) { - b = F[(a + 76) >> 2]; - if (b) { - F[(a + 80) >> 2] = b; - ja(b); - } - b = F[(a - -64) >> 2]; - if (b) { - F[(a + 68) >> 2] = b; - ja(b); - } - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - F[(a + 28) >> 2] = b; - ja(b); - } - b = F[(a + 12) >> 2]; - if (b) { - F[(a + 16) >> 2] = b; - ja(b); - } - b = F[a >> 2]; - if (b) { - F[(a + 4) >> 2] = b; - ja(b); - } - ja(a); - } - } - function Gb(a) { - var b = 0; - b = F[(a + 84) >> 2]; - if (b) { - F[(a + 88) >> 2] = b; - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - F[(a + 76) >> 2] = b; - ja(b); - } - b = F[(a + 52) >> 2]; - if (b) { - F[(a + 56) >> 2] = b; - ja(b); - } - b = F[(a + 40) >> 2]; - if (b) { - F[(a + 44) >> 2] = b; - ja(b); - } - b = F[(a + 28) >> 2]; - if (b) { - F[(a + 32) >> 2] = b; - ja(b); - } - b = F[(a + 12) >> 2]; - if (b) { - ja(b); - } - a = F[a >> 2]; - if (a) { - ja(a); - } - } - function Lc(a, b, c) { - var d = 0, - e = 0, - f = 0, - g = 0; - f = (Z - 16) | 0; - Z = f; - d = (Z - 16) | 0; - Z = d; - b = (b - a) >> 2; - while (1) { - if (b) { - F[(d + 12) >> 2] = a; - e = (b >>> 1) | 0; - F[(d + 12) >> 2] = F[(d + 12) >> 2] + (e << 2); - g = ((e ^ -1) + b) | 0; - b = e; - e = I[F[(d + 12) >> 2] >> 2] < I[c >> 2]; - b = e ? g : b; - a = e ? (F[(d + 12) >> 2] + 4) | 0 : a; - continue; - } - break; - } - Z = (d + 16) | 0; - Z = (f + 16) | 0; - return a; - } - function id(a, b) { - var c = 0, - d = 0; - d = ka(40); - F[d >> 2] = -1; - c = (d + 8) | 0; - F[(c + 16) >> 2] = 0; - F[(c + 20) >> 2] = 0; - F[(c + 8) >> 2] = 0; - F[c >> 2] = 0; - F[(c + 4) >> 2] = 0; - F[(c + 24) >> 2] = 0; - F[(c + 28) >> 2] = 0; - $[F[(F[a >> 2] + 16) >> 2]](a, d); - a = F[(b + 88) >> 2]; - F[(b + 88) >> 2] = d; - if (a) { - b = F[(a + 8) >> 2]; - if (b) { - F[(a + 12) >> 2] = b; - ja(b); - } - ja(a); - } - return 1; - } - function ya(a) { - var b = 0, - c = 0, - d = 0; - b = a; - a: { - if (b & 3) { - while (1) { - if (!G[b | 0]) { - break a; - } - b = (b + 1) | 0; - if (b & 3) { - continue; - } - break; - } - } - while (1) { - c = b; - b = (b + 4) | 0; - d = F[c >> 2]; - if (!((d ^ -1) & (d - 16843009) & -2139062144)) { - continue; - } - break; - } - while (1) { - b = c; - c = (b + 1) | 0; - if (G[b | 0]) { - continue; - } - break; - } - } - return (b - a) | 0; - } - function wa(a) { - var b = 0, - c = 0, - d = 0, - e = 0, - f = 0; - d = G[(a + 12) | 0]; - c = F[(a + 8) >> 2]; - a: { - if (c >>> 0 > 4095) { - break a; - } - b = F[(a + 4) >> 2]; - if ((b | 0) <= 0) { - break a; - } - b = (b - 1) | 0; - F[(a + 4) >> 2] = b; - c = G[(b + F[a >> 2]) | 0] | (c << 8); - } - d = (0 - d) & 255; - b = L(d, (c >>> 8) | 0); - e = c & 255; - f = e >>> 0 < d >>> 0; - F[(a + 8) >> 2] = f ? (b + e) | 0 : (c - ((b + d) | 0)) | 0; - return f; - } - function yc(a, b) { - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 1776; - F[(a + 12) >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - F[(a + 40) >> 2] = 0; - F[a >> 2] = 2016; - F[(a + 60) >> 2] = b; - F[(a + 44) >> 2] = 0; - F[(a + 48) >> 2] = 0; - F[(a + 52) >> 2] = 0; - F[(a + 56) >> 2] = 0; - return a; - } - function Eb(a, b) { - var c = 0, - d = 0, - e = 0; - c = ya(b); - if (c >>> 0 < 2147483632) { - a: { - b: { - if (c >>> 0 >= 11) { - d = ((c | 15) + 1) | 0; - e = ka(d); - F[(a + 8) >> 2] = d | -2147483648; - F[a >> 2] = e; - F[(a + 4) >> 2] = c; - d = (c + e) | 0; - break b; - } - D[(a + 11) | 0] = c; - d = (a + c) | 0; - e = a; - if (!c) { - break a; - } - } - pa(e, b, c); - } - D[d | 0] = 0; - return a; - } - za(); - v(); - } - function Of(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - if (a) { - if (D[(a + 27) | 0] < 0) { - ja(F[(a + 16) >> 2]); - } - b = F[a >> 2]; - if (b) { - c = b; - d = F[(a + 4) >> 2]; - if ((b | 0) != (d | 0)) { - while (1) { - c = (d - 12) | 0; - if (D[(d - 1) | 0] < 0) { - ja(F[c >> 2]); - } - d = c; - if ((d | 0) != (b | 0)) { - continue; - } - break; - } - c = F[a >> 2]; - } - F[(a + 4) >> 2] = b; - ja(c); - } - ja(a); - } - } - function xa(a) { - a = a | 0; - var b = 0, - c = 0; - if (a) { - b = F[(a + 88) >> 2]; - F[(a + 88) >> 2] = 0; - if (b) { - c = F[(b + 8) >> 2]; - if (c) { - F[(b + 12) >> 2] = c; - ja(c); - } - ja(b); - } - b = F[(a + 68) >> 2]; - if (b) { - F[(a + 72) >> 2] = b; - ja(b); - } - b = F[(a + 64) >> 2]; - F[(a + 64) >> 2] = 0; - if (b) { - c = F[b >> 2]; - if (c) { - F[(b + 4) >> 2] = c; - ja(c); - } - ja(b); - } - ja(a); - } - } - function Ib(a, b) { - var c = 0, - d = 0, - e = 0; - a: { - c = F[a >> 2]; - b: { - if (((F[(a + 8) >> 2] - c) >> 2) >>> 0 >= b >>> 0) { - break b; - } - if (b >>> 0 >= 1073741824) { - break a; - } - d = (F[(a + 4) >> 2] - c) | 0; - e = b << 2; - b = pa(ka(e), c, d); - F[(a + 8) >> 2] = b + e; - F[(a + 4) >> 2] = b + d; - F[a >> 2] = b; - if (!c) { - break b; - } - ja(c); - } - return; - } - na(); - v(); - } - function Df(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - b = F[(b + 96) >> 2]; - a = ka(12); - b = (b + L(c, 12)) | 0; - c = F[(b + 4) >> 2]; - F[a >> 2] = F[b >> 2]; - F[(a + 4) >> 2] = c; - F[(a + 8) >> 2] = F[(b + 8) >> 2]; - b = F[d >> 2]; - if (b) { - F[(d + 4) >> 2] = b; - ja(b); - } - F[d >> 2] = a; - a = (a + 12) | 0; - F[(d + 8) >> 2] = a; - F[(d + 4) >> 2] = a; - return 1; - } - function Ah(a) { - a = a | 0; - var b = 0; - F[(a + 24) >> 2] = 1624; - F[a >> 2] = 7948; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - F[a >> 2] = 2136; - b = F[(a + 20) >> 2]; - F[(a + 20) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - F[a >> 2] = 1920; - b = F[(a + 16) >> 2]; - F[(a + 16) >> 2] = 0; - if (b) { - xa(b); - } - return a | 0; - } - function li(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0; - f = b ^ d; - g = f >> 31; - e = b >> 31; - a = a ^ e; - h = (a - e) | 0; - e = ((b ^ e) - (((a >>> 0 < e >>> 0) + e) | 0)) | 0; - a = d >> 31; - b = c ^ a; - f = f >> 31; - a = - mi( - h, - e, - (b - a) | 0, - ((a ^ d) - (((a >>> 0 > b >>> 0) + a) | 0)) | 0, - ) ^ f; - b = (a - f) | 0; - _ = ((g ^ _) - (((a >>> 0 < f >>> 0) + g) | 0)) | 0; - return b; - } - function zh(a) { - a = a | 0; - var b = 0; - F[(a + 24) >> 2] = 1624; - F[a >> 2] = 7948; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - F[a >> 2] = 2136; - b = F[(a + 20) >> 2]; - F[(a + 20) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - F[a >> 2] = 1920; - b = F[(a + 16) >> 2]; - F[(a + 16) >> 2] = 0; - if (b) { - xa(b); - } - ja(a); - } - function rb(a, b, c) { - var d = 0, - e = 0, - f = 0; - e = (Z - 16) | 0; - Z = e; - d = F[(a + 8) >> 2] & 2147483647; - a: { - if (d >>> 0 > c >>> 0) { - d = F[a >> 2]; - F[(a + 4) >> 2] = c; - db(d, b, c); - D[(e + 15) | 0] = 0; - D[(c + d) | 0] = G[(e + 15) | 0]; - break a; - } - f = a; - a = F[(a + 4) >> 2]; - Gc(f, (d - 1) | 0, (((c - d) | 0) + 1) | 0, a, a, c, b); - } - Z = (e + 16) | 0; - } - function xe(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0; - c = (Z - 16) | 0; - Z = c; - a = F[(a + 4) >> 2]; - a: { - if ((a | 0) == -1) { - break a; - } - D[(c + 15) | 0] = a; - d = F[(b + 20) >> 2]; - if ((!!F[(b + 16) >> 2] & ((d | 0) >= 0)) | ((d | 0) > 0)) { - break a; - } - pb(b, F[(b + 4) >> 2], (c + 15) | 0, (c + 16) | 0); - } - Z = (c + 16) | 0; - return ((a | 0) != -1) | 0; - } - function ki(a, b, c, d) { - var e = 0, - f = 0, - g = 0, - h = 0, - i = 0, - j = 0; - e = (c >>> 16) | 0; - f = (a >>> 16) | 0; - j = L(e, f); - g = c & 65535; - h = a & 65535; - i = L(g, h); - f = (((i >>> 16) | 0) + L(f, g)) | 0; - e = ((f & 65535) + L(e, h)) | 0; - _ = - (((L(b, c) + j) | 0) + L(a, d) + (f >>> 16) + (e >>> 16)) | 0; - return (i & 65535) | (e << 16); - } - function qb(a, b, c) { - var d = 0, - e = 0; - d = (Z - 16) | 0; - Z = d; - a: { - if (c >>> 0 <= 10) { - D[(a + 11) | 0] = (G[(a + 11) | 0] & 128) | c; - D[(a + 11) | 0] = G[(a + 11) | 0] & 127; - db(a, b, c); - D[(d + 15) | 0] = 0; - D[(a + c) | 0] = G[(d + 15) | 0]; - break a; - } - e = a; - a = G[(a + 11) | 0] & 127; - Gc(e, 10, (c - 10) | 0, a, a, c, b); - } - Z = (d + 16) | 0; - } - function Ec(a, b, c) { - var d = 0; - d = F[(a + 16) >> 2]; - if (!d) { - F[(a + 36) >> 2] = 1; - F[(a + 24) >> 2] = c; - F[(a + 16) >> 2] = b; - return; - } - a: { - if ((b | 0) == (d | 0)) { - if (F[(a + 24) >> 2] != 2) { - break a; - } - F[(a + 24) >> 2] = c; - return; - } - D[(a + 54) | 0] = 1; - F[(a + 24) >> 2] = 2; - F[(a + 36) >> 2] = F[(a + 36) >> 2] + 1; - } - } - function vg() { - var a = 0; - a = kb(ka(96)); - F[(a + 64) >> 2] = 0; - F[(a + 68) >> 2] = 0; - F[(a + 88) >> 2] = 0; - F[(a + 72) >> 2] = 0; - F[(a + 76) >> 2] = 0; - D[(a + 77) | 0] = 0; - D[(a + 78) | 0] = 0; - D[(a + 79) | 0] = 0; - D[(a + 80) | 0] = 0; - D[(a + 81) | 0] = 0; - D[(a + 82) | 0] = 0; - D[(a + 83) | 0] = 0; - D[(a + 84) | 0] = 0; - return a | 0; - } - function jh(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0; - F[b >> 2] = 2; - c = F[(b + 8) >> 2]; - d = (F[(b + 12) >> 2] - c) | 0; - if (d >>> 0 <= 4294967291) { - Db((b + 8) | 0, (d + 4) | 0); - c = F[(b + 8) >> 2]; - } - b = (c + d) | 0; - a = F[(a + 4) >> 2]; - D[b | 0] = a; - D[(b + 1) | 0] = a >>> 8; - D[(b + 2) | 0] = a >>> 16; - D[(b + 3) | 0] = a >>> 24; - } - function ge(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 3016; - b = F[(a + 96) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 84) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - return a | 0; - } - function ci(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 4580; - b = F[(a + 96) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 84) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - return a | 0; - } - function Cg(a) { - a = a | 0; - var b = 0, - c = 0, - d = 0; - b = F[(a + 8) >> 2]; - d = F[(a + 12) >> 2]; - if ((b | 0) == (d | 0)) { - return 1; - } - while (1) { - c = F[b >> 2]; - c = $[F[(F[c >> 2] + 16) >> 2]](c, F[(a + 32) >> 2]) | 0; - if (c) { - b = (b + 4) | 0; - if ((d | 0) != (b | 0)) { - continue; - } - } - break; - } - return c | 0; - } - function Pc(a, b) { - var c = 0, - d = 0; - c = F[(a + 8) >> 2]; - a = F[(a + 12) >> 2]; - if ((c | 0) != (a | 0)) { - a = (a - c) >> 2; - d = a >>> 0 <= 1 ? 1 : a; - a = 0; - while (1) { - if (F[(F[((a << 2) + c) >> 2] + 60) >> 2] == (b | 0)) { - return a; - } - a = (a + 1) | 0; - if ((d | 0) != (a | 0)) { - continue; - } - break; - } - } - return -1; - } - function fe(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 3016; - b = F[(a + 96) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 84) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - ja(a); - } - function bi(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 4580; - b = F[(a + 96) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 84) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 72) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 60) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - ja(a); - } - function Sc(a, b, c) { - var d = 0, - e = 0; - d = (a + 4) | 0; - a = Ya(a, b); - a: { - if ((d | 0) == (a | 0)) { - break a; - } - b = F[(a + 32) >> 2]; - d = F[(a + 28) >> 2]; - if ((b | 0) == (d | 0)) { - break a; - } - Sb(c, (b - d) | 0); - c = Tb(c); - b = F[(a + 28) >> 2]; - la(c, b, (F[(a + 32) >> 2] - b) | 0); - e = 1; - } - return e; - } - function Kd(a) { - F[(a + 40) >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 10032; - F[(a + 12) >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - F[(a + 32) >> 2] = 0; - E[(a + 36) >> 1] = 0; - F[(a + 44) >> 2] = 0; - F[a >> 2] = 8080; - return a; - } - function kb(a) { - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 40) >> 2] = 0; - F[(a + 44) >> 2] = 0; - F[(a + 28) >> 2] = 9; - D[(a + 24) | 0] = 1; - F[(a + 56) >> 2] = -1; - F[(a + 60) >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 48) >> 2] = 0; - F[(a + 52) >> 2] = 0; - return a; - } - function pe(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0; - d = F[(a + 16) >> 2]; - c = 0; - a: { - if ((F[(a + 20) >> 2] - d) >> 2 <= (b | 0)) { - break a; - } - b = F[((b << 2) + d) >> 2]; - c = 0; - if ((b | 0) < 0) { - break a; - } - c = bb(F[(F[(a + 36) >> 2] + (b << 2)) >> 2]); - } - return c | 0; - } - function Nf() { - var a = 0, - b = 0; - a = ka(40); - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - b = (a + 16) | 0; - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - F[a >> 2] = a + 4; - F[(a + 12) >> 2] = b; - F[(a + 32) >> 2] = 0; - F[(a + 36) >> 2] = 0; - return a | 0; - } - function Xe(a, b) { - a = a | 0; - b = b | 0; - var c = 0, - d = 0; - Nc(a, b); - a: { - if ((b | 0) < 0) { - break a; - } - d = F[(a + 88) >> 2]; - c = F[(a + 84) >> 2]; - if ((d - c) >> 2 <= (b | 0)) { - break a; - } - c = ((b << 2) + c) | 0; - b = (c + 4) | 0; - pa(c, b, (d - b) | 0); - F[(a + 88) >> 2] = d - 4; - } - } - function eb(a) { - var b = 0, - c = 0; - b = F[2909]; - c = (a + 7) & -8; - a = (b + c) | 0; - a: { - if (a >>> 0 <= b >>> 0 ? c : 0) { - break a; - } - if (a >>> 0 > (aa() << 16) >>> 0) { - if (!(X(a | 0) | 0)) { - break a; - } - } - F[2909] = a; - return b; - } - F[2940] = 48; - return -1; - } - function Th(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0; - F[(a + 4) >> 2] = b; - b = F[(F[(F[(b + 4) >> 2] + 8) >> 2] + (c << 2)) >> 2]; - F[(a + 12) >> 2] = c; - F[(a + 8) >> 2] = b; - a = F[(a + 8) >> 2]; - if (G[(a + 24) | 0] == 3) { - d = F[(a + 28) >> 2] == 9; - } - return d | 0; - } - function Tg(a) { - a = a | 0; - var b = 0; - F[(a + 8) >> 2] = 9556; - F[a >> 2] = 9392; - b = F[(a + 56) >> 2]; - if (b) { - F[(a + 60) >> 2] = b; - ja(b); - } - F[(a + 8) >> 2] = 9372; - b = F[(a + 44) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 32) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function Ng(a) { - a = a | 0; - var b = 0; - F[(a + 8) >> 2] = 8624; - F[a >> 2] = 9684; - b = F[(a + 56) >> 2]; - if (b) { - F[(a + 60) >> 2] = b; - ja(b); - } - F[(a + 8) >> 2] = 8876; - b = F[(a + 44) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 32) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function Ee(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0, - e = 0; - d = F[(a + 8) >> 2]; - a: { - if (!G[(d + 24) | 0]) { - break a; - } - if (!ac(d, (F[(b + 4) >> 2] - F[b >> 2]) >> 2)) { - break a; - } - e = $[F[(F[a >> 2] + 32) >> 2]](a, b, c) | 0; - } - return e | 0; - } - function Fh(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - var d = 0; - F[(a + 4) >> 2] = b; - d = F[(F[(F[(b + 4) >> 2] + 8) >> 2] + (c << 2)) >> 2]; - F[(a + 12) >> 2] = c; - F[(a + 8) >> 2] = d; - return ( - (F[ - (F[(F[(F[(b + 4) >> 2] + 8) >> 2] + (c << 2)) >> 2] + 28) >> - 2 - ] == - 9) | - 0 - ); - } - function Ca(a, b) { - if (b) { - Ca(a, F[b >> 2]); - Ca(a, F[(b + 4) >> 2]); - a = F[(b + 28) >> 2]; - F[(b + 28) >> 2] = 0; - if (a) { - Ca((a + 12) | 0, F[(a + 16) >> 2]); - Ba(a, F[(a + 4) >> 2]); - ja(a); - } - if (D[(b + 27) | 0] < 0) { - ja(F[(b + 16) >> 2]); - } - ja(b); - } - } - function Sg(a) { - a = a | 0; - var b = 0; - F[(a + 8) >> 2] = 9556; - F[a >> 2] = 9392; - b = F[(a + 56) >> 2]; - if (b) { - F[(a + 60) >> 2] = b; - ja(b); - } - F[(a + 8) >> 2] = 9372; - b = F[(a + 44) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 32) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function Mg(a) { - a = a | 0; - var b = 0; - F[(a + 8) >> 2] = 8624; - F[a >> 2] = 9684; - b = F[(a + 56) >> 2]; - if (b) { - F[(a + 60) >> 2] = b; - ja(b); - } - F[(a + 8) >> 2] = 8876; - b = F[(a + 44) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 32) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function Hc(a, b) { - var c = 0, - d = 0, - e = 0, - f = 0; - F[a >> 2] = 11356; - F[a >> 2] = 11468; - c = ya(b); - d = ka((c + 13) | 0); - F[(d + 8) >> 2] = 0; - F[(d + 4) >> 2] = c; - F[d >> 2] = c; - (e = a), - (f = la((d + 12) | 0, b, (c + 1) | 0)), - (F[(e + 4) >> 2] = f); - return a; - } - function hc(a, b, c) { - a: { - if (b) { - b = 0; - if (!ld(1, c, a)) { - break a; - } - } - D[(a + 36) | 0] = 1; - F[(a + 32) >> 2] = 0; - b = F[(a + 16) >> 2]; - c = (b + F[a >> 2]) | 0; - F[(a + 24) >> 2] = c; - F[(a + 28) >> 2] = c + ((F[(a + 8) >> 2] - b) | 0); - b = 1; - } - return b; - } - function Ue(a, b) { - a = a | 0; - b = b | 0; - var c = 0; - a: { - if (!($[F[(F[a >> 2] + 36) >> 2]](a, b) | 0)) { - break a; - } - if (!($[F[(F[a >> 2] + 40) >> 2]](a, b) | 0)) { - break a; - } - c = $[F[(F[a >> 2] + 44) >> 2]](a) | 0; - } - return c | 0; - } - function _d(a) { - a = a | 0; - var b = 0; - a: { - if ( - !F[(a - -64) >> 2] | - !F[(a + 68) >> 2] | - (!F[(a + 44) >> 2] | !F[(a + 48) >> 2]) - ) { - break a; - } - if (!F[(a + 52) >> 2] | !F[(a + 56) >> 2]) { - break a; - } - b = F[(a + 92) >> 2] != -1; - } - return b | 0; - } - function ii(a, b) { - a = a | 0; - b = b | 0; - var c = 0; - b = F[(b + 88) >> 2]; - if (!(!b | (F[b >> 2] != 2))) { - c = a; - a = F[(b + 8) >> 2]; - F[(c + 4) >> 2] = - G[a | 0] | - (G[(a + 1) | 0] << 8) | - ((G[(a + 2) | 0] << 16) | (G[(a + 3) | 0] << 24)); - c = 1; - } - return c | 0; - } - function wc(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 2136; - b = F[(a + 20) >> 2]; - F[(a + 20) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - F[a >> 2] = 1920; - b = F[(a + 16) >> 2]; - F[(a + 16) >> 2] = 0; - if (b) { - xa(b); - } - return a | 0; - } - function Ud(a) { - a = a | 0; - var b = 0; - a: { - if ( - !F[(a + 48) >> 2] | - !F[(a + 52) >> 2] | - (!F[(a + 28) >> 2] | !F[(a + 32) >> 2]) - ) { - break a; - } - if (!F[(a + 36) >> 2] | !F[(a + 40) >> 2]) { - break a; - } - b = F[(a + 76) >> 2] != -1; - } - return b | 0; - } - function Ug(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 9556; - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - F[a >> 2] = 9372; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function Ed(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 8624; - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - F[a >> 2] = 8876; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function vc(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 2136; - b = F[(a + 20) >> 2]; - F[(a + 20) >> 2] = 0; - if (b) { - $[F[(F[b >> 2] + 4) >> 2]](b); - } - F[a >> 2] = 1920; - b = F[(a + 16) >> 2]; - F[(a + 16) >> 2] = 0; - if (b) { - xa(b); - } - ja(a); - } - function yg() { - var a = 0, - b = 0; - b = ka(40); - F[b >> 2] = -1; - a = (b + 8) | 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - return b | 0; - } - function eh(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 8624; - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - F[a >> 2] = 8876; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function Og(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 9556; - b = F[(a + 48) >> 2]; - if (b) { - F[(a + 52) >> 2] = b; - ja(b); - } - F[a >> 2] = 9372; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function Ja(a) { - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - F[a >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 32) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 28) >> 2] = 0; - E[(a + 38) >> 1] = 0; - D[(a + 36) | 0] = 0; - return a; - } - function Me(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - if (La(a, F[(b + 8) >> 2], f)) { - Dc(b, c, d, e); - return; - } - a = F[(a + 8) >> 2]; - $[F[(F[a >> 2] + 20) >> 2]](a, b, c, d, e, f); - } - function Eh(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - a: { - if (G[(F[(a + 4) >> 2] + 36) | 0] >= 2) { - b = 0; - if (!($[F[(F[a >> 2] + 52) >> 2]](a) | 0)) { - break a; - } - } - b = id((a + 24) | 0, F[(a + 16) >> 2]); - } - return b | 0; - } - function hg() { - var a = 0; - a = Rc(ka(108)); - F[(a + 84) >> 2] = 0; - F[(a + 88) >> 2] = 0; - F[a >> 2] = 10240; - F[(a + 92) >> 2] = 0; - F[(a + 96) >> 2] = 0; - F[(a + 100) >> 2] = 0; - F[(a + 104) >> 2] = 0; - return a | 0; - } - function Qc(a, b) { - var c = 0; - c = -1; - a: { - if (((b | 0) == -1) | ((b | 0) > 4)) { - break a; - } - b = (L(b, 12) + a) | 0; - a = F[(b + 20) >> 2]; - if (((F[(b + 24) >> 2] - a) | 0) <= 0) { - break a; - } - c = F[a >> 2]; - } - return c; - } - function cc(a, b, c, d, e, f, g) { - F[a >> 2] = 0; - F[(a + 56) >> 2] = b; - F[(a + 48) >> 2] = 0; - F[(a + 52) >> 2] = 0; - F[(a + 40) >> 2] = f; - F[(a + 44) >> 2] = g; - D[(a + 32) | 0] = e; - F[(a + 28) >> 2] = d; - D[(a + 24) | 0] = c; - } - function Sh(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - a: { - if (G[(F[(a + 4) >> 2] + 36) | 0] >= 2) { - b = 0; - if (!uc((a + 24) | 0, bb(a), c)) { - break a; - } - } - b = id((a + 24) | 0, F[(a + 16) >> 2]); - } - return b | 0; - } - function _e(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 10240; - b = F[(a + 96) >> 2]; - if (b) { - F[(a + 100) >> 2] = b; - ja(b); - } - b = F[(a + 84) >> 2]; - if (b) { - F[(a + 88) >> 2] = b; - ja(b); - } - return tb(a) | 0; - } - function Tb(a) { - var b = 0; - if ((G[(a + 11) | 0] >>> 7) | 0) { - b = F[(a + 4) >> 2]; - } else { - b = G[(a + 11) | 0] & 127; - } - if (!b) { - sc(1222); - v(); - } - if ((G[(a + 11) | 0] >>> 7) | 0) { - a = F[a >> 2]; - } - return a; - } - function Ze(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 10240; - b = F[(a + 96) >> 2]; - if (b) { - F[(a + 100) >> 2] = b; - ja(b); - } - b = F[(a + 84) >> 2]; - if (b) { - F[(a + 88) >> 2] = b; - ja(b); - } - ja(tb(a)); - } - function ce(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 3264; - b = F[(a + 76) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - return a | 0; - } - function _h(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 4816; - b = F[(a + 76) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - return a | 0; - } - function Ba(a, b) { - if (b) { - Ba(a, F[b >> 2]); - Ba(a, F[(b + 4) >> 2]); - a = F[(b + 28) >> 2]; - if (a) { - F[(b + 32) >> 2] = a; - ja(a); - } - if (D[(b + 27) | 0] < 0) { - ja(F[(b + 16) >> 2]); - } - ja(b); - } - } - function Wf() { - var a = 0; - a = ka(28); - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 24) >> 2] = 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - return a | 0; - } - function We(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 1776; - b = F[(a + 16) >> 2]; - if (b) { - F[(a + 20) >> 2] = b; - ja(b); - } - b = F[(a + 4) >> 2]; - if (b) { - F[(a + 8) >> 2] = b; - ja(b); - } - return a | 0; - } - function fg() { - var a = 0, - b = 0; - a = ka(24); - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - b = (a + 16) | 0; - F[b >> 2] = 0; - F[(b + 4) >> 2] = 0; - F[a >> 2] = a + 4; - F[(a + 12) >> 2] = b; - return a | 0; - } - function Pe(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - if (La(a, F[(b + 8) >> 2], 0)) { - Ec(b, c, d); - return; - } - a = F[(a + 8) >> 2]; - $[F[(F[a >> 2] + 28) >> 2]](a, b, c, d); - } - function be(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 3264; - b = F[(a + 76) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - ja(a); - } - function Zh(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 4816; - b = F[(a + 76) >> 2]; - if (b) { - ja(b); - } - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - ja(a); - } - function ka(a) { - var b = 0; - a = a ? a : 1; - a: { - while (1) { - b = Ub(a); - if (b) { - break a; - } - b = F[3065]; - if (b) { - $[b | 0](); - continue; - } - break; - } - V(); - v(); - } - return b; - } - function ib(a, b) { - if (b) { - ib(a, F[b >> 2]); - ib(a, F[(b + 4) >> 2]); - if (D[(b + 39) | 0] < 0) { - ja(F[(b + 28) >> 2]); - } - if (D[(b + 27) | 0] < 0) { - ja(F[(b + 16) >> 2]); - } - ja(b); - } - } - function Cc(a) { - a = a | 0; - var b = 0, - c = 0; - F[a >> 2] = 11468; - b = (F[(a + 4) >> 2] - 12) | 0; - c = (F[(b + 8) >> 2] - 1) | 0; - F[(b + 8) >> 2] = c; - if ((c | 0) < 0) { - ja(b); - } - return a | 0; - } - function ng() { - var a = 0; - a = ka(24); - F[(a + 8) >> 2] = 0; - F[(a + 12) >> 2] = 0; - F[(a + 4) >> 2] = -1; - F[a >> 2] = 1624; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - return a | 0; - } - function Ac(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - F[(a + 4) >> 2] = b; - b = F[(F[(F[(b + 4) >> 2] + 8) >> 2] + (c << 2)) >> 2]; - F[(a + 12) >> 2] = c; - F[(a + 8) >> 2] = b; - return 1; - } - function pc(a) { - a = a | 0; - var b = 0; - if ( - !( - !F[(a + 60) >> 2] | - !F[(a + 44) >> 2] | - (!F[(a + 48) >> 2] | !F[(a + 52) >> 2]) - ) - ) { - b = F[(a + 56) >> 2] != 0; - } - return b | 0; - } - function Ic(a, b) { - if ((G[(a + 11) | 0] >>> 7) | 0) { - F[(a + 4) >> 2] = b; - return; - } - D[(a + 11) | 0] = (G[(a + 11) | 0] & 128) | b; - D[(a + 11) | 0] = G[(a + 11) | 0] & 127; - } - function gi(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 3500; - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - return a | 0; - } - function Xh(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 5040; - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - return a | 0; - } - function nf(a) { - a = a | 0; - if (a) { - if (D[(a + 39) | 0] < 0) { - ja(F[(a + 28) >> 2]); - } - $b((a + 12) | 0, F[(a + 16) >> 2]); - ib(a, F[(a + 4) >> 2]); - ja(a); - } - } - function dh(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 8876; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function Wg(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 9372; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - return a | 0; - } - function ob(a) { - a = a | 0; - var b = 0; - if ( - !(!F[(a + 52) >> 2] | (!F[(a + 44) >> 2] | !F[(a + 48) >> 2])) - ) { - b = F[(a + 56) >> 2] != 0; - } - return b | 0; - } - function oc(a, b) { - a = a | 0; - b = b | 0; - var c = 0; - if (!(F[(b + 56) >> 2] | !b | (G[(b + 24) | 0] != 3))) { - F[(a + 60) >> 2] = b; - c = 1; - } - return c | 0; - } - function fi(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 3500; - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - ja(a); - } - function Wh(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 5040; - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - ja(a); - } - function zg(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - F[(a + 16) >> 2] = 0; - F[(a + 20) >> 2] = 0; - F[a >> 2] = b; - F[(a + 8) >> 2] = c; - F[(a + 12) >> 2] = 0; - } - function ch(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 8876; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function Zd(a, b) { - a = a | 0; - b = b | 0; - var c = 0; - if (!(F[(b + 56) >> 2] | (G[(b + 24) | 0] != 3))) { - F[(a - -64) >> 2] = b; - c = 1; - } - return c | 0; - } - function Vg(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 9372; - b = F[(a + 36) >> 2]; - if (b) { - ja(b); - } - b = F[(a + 24) >> 2]; - if (b) { - ja(b); - } - ja(a); - } - function Td(a, b) { - a = a | 0; - b = b | 0; - var c = 0; - if (!(F[(b + 56) >> 2] | (G[(b + 24) | 0] != 3))) { - F[(a + 48) >> 2] = b; - c = 1; - } - return c | 0; - } - function Le(a, b, c, d, e, f) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - e = e | 0; - f = f | 0; - if (La(a, F[(b + 8) >> 2], f)) { - Dc(b, c, d, e); - } - } - function oa() { - var a = 0; - a = Rb(4); - F[a >> 2] = 11356; - F[a >> 2] = 11316; - F[a >> 2] = 11336; - W(a | 0, 11448, 14); - v(); - } - function je(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - return a | 0; - } - function Ae(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 1920; - b = F[(a + 16) >> 2]; - F[(a + 16) >> 2] = 0; - if (b) { - xa(b); - } - return a | 0; - } - function Pg(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 1624; - b = F[(a + 8) >> 2]; - if (b) { - F[(a + 12) >> 2] = b; - ja(b); - } - return a | 0; - } - function Ch(a) { - a = a | 0; - var b = 0; - b = bb(a); - return ( - qd( - (a + 24) | 0, - b ? b : F[(a + 8) >> 2], - F[(F[(a + 4) >> 2] + 32) >> 2], - ) | 0 - ); - } - function ze(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 1920; - b = F[(a + 16) >> 2]; - F[(a + 16) >> 2] = 0; - if (b) { - xa(b); - } - ja(a); - } - function Ob(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 2960; - b = F[(a + 32) >> 2]; - if (b) { - F[(a + 36) >> 2] = b; - ja(b); - } - ja(a); - } - function Hg(a) { - a = a | 0; - var b = 0; - F[a >> 2] = 1624; - b = F[(a + 8) >> 2]; - if (b) { - F[(a + 12) >> 2] = b; - ja(b); - } - ja(a); - } - function oe(a, b) { - a = a | 0; - b = b | 0; - return ( - $[F[(F[a >> 2] + 48) >> 2]]( - a, - (F[(b + 4) >> 2] - F[b >> 2]) >> 2, - ) | 0 - ); - } - function $b(a, b) { - if (b) { - $b(a, F[b >> 2]); - $b(a, F[(b + 4) >> 2]); - ib((b + 20) | 0, F[(b + 24) >> 2]); - ja(b); - } - } - function xg(a) { - a = a | 0; - var b = 0; - if (a) { - b = F[(a + 8) >> 2]; - if (b) { - F[(a + 12) >> 2] = b; - ja(b); - } - ja(a); - } - } - function xh(a) { - a = a | 0; - if (!F[(a + 44) >> 2]) { - return 0; - } - return $[F[(F[a >> 2] + 48) >> 2]](a) | 0; - } - function ni(a) { - var b = 0; - while (1) { - if (a) { - a = (a - 1) & a; - b = (b + 1) | 0; - continue; - } - break; - } - return b; - } - function Qe(a, b, c, d) { - a = a | 0; - b = b | 0; - c = c | 0; - d = d | 0; - if (La(a, F[(b + 8) >> 2], 0)) { - Ec(b, c, d); - } - } - function vh(a, b) { - a = a | 0; - b = b | 0; - a = F[(a + 48) >> 2]; - return $[F[(F[a >> 2] + 20) >> 2]](a, b) | 0; - } - function oi(a) { - var b = 0; - b = a & 31; - a = (0 - a) & 31; - return (((-1 >>> b) & -2) << b) | (((-1 << a) & -2) >>> a); - } - function oh(a, b) { - a = a | 0; - b = b | 0; - a = F[(a + 48) >> 2]; - return $[F[(F[a >> 2] + 12) >> 2]](a, b) | 0; - } - function nh(a, b) { - a = a | 0; - b = b | 0; - a = F[(a + 48) >> 2]; - return $[F[(F[a >> 2] + 16) >> 2]](a, b) | 0; - } - function Xa() { - var a = 0; - a = ka(12); - F[a >> 2] = 0; - F[(a + 4) >> 2] = 0; - F[(a + 8) >> 2] = 0; - return a | 0; - } - function Wa(a) { - a = a | 0; - var b = 0; - if (a) { - b = F[a >> 2]; - if (b) { - F[(a + 4) >> 2] = b; - ja(b); - } - ja(a); - } - } - function mf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - F[(a + 32) >> 2] = c; - F[(a + 28) >> 2] = b; - return 1; - } - function eg(a) { - a = a | 0; - if (a) { - Ca((a + 12) | 0, F[(a + 16) >> 2]); - Ba(a, F[(a + 4) >> 2]); - ja(a); - } - } - function Lb(a, b) { - a = a | 0; - b = b | 0; - if (b >>> 0 <= 1) { - F[(a + 28) >> 2] = b; - } - return (b >>> 0 < 2) | 0; - } - function Fg(a, b) { - a = a | 0; - b = b | 0; - D[(b + 84) | 0] = 1; - F[(b + 72) >> 2] = F[(b + 68) >> 2]; - return 1; - } - function kg() { - var a = 0; - a = ka(8); - F[(a + 4) >> 2] = -1; - F[a >> 2] = 1032; - return a | 0; - } - function Hf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - return F[(F[(b + 8) >> 2] + (c << 2)) >> 2]; - } - function th(a) { - a = a | 0; - a = F[(a + 48) >> 2]; - return $[F[(F[a >> 2] + 24) >> 2]](a) | 0; - } - function sh(a) { - a = a | 0; - a = F[(a + 48) >> 2]; - return $[F[(F[a >> 2] + 28) >> 2]](a) | 0; - } - function ph(a) { - a = a | 0; - a = F[(a + 48) >> 2]; - return $[F[(F[a >> 2] + 36) >> 2]](a) | 0; - } - function Rh(a, b) { - a = a | 0; - b = b | 0; - return zc((a + 24) | 0, bb(a), F[(a + 8) >> 2]) | 0; - } - function Bh(a, b) { - a = a | 0; - b = b | 0; - return xd((a + 24) | 0, bb(a), F[(a + 8) >> 2]) | 0; - } - function bg(a) { - a = a | 0; - if (a) { - if (D[(a + 15) | 0] < 0) { - ja(F[(a + 4) >> 2]); - } - ja(a); - } - } - function Ke(a) { - a = a | 0; - if (!a) { - return 0; - } - return ((Fc(a, 11164) | 0) != 0) | 0; - } - function Fe(a, b) { - a = a | 0; - b = b | 0; - F[(a + 12) >> 2] = -1; - F[(a + 8) >> 2] = b; - return 1; - } - function hd(a, b) { - a = a | 0; - b = b | 0; - return $[F[(F[a >> 2] + 12) >> 2]](a, b) | 0; - } - function Dh(a, b) { - a = a | 0; - b = b | 0; - return $[F[(F[a >> 2] + 56) >> 2]](a, b) | 0; - } - function sc(a) { - a = Hc(Rb(8), a); - F[a >> 2] = 11568; - W(a | 0, 11600, 1); - v(); - } - function mg(a, b) { - a = a | 0; - b = b | 0; - return M(J[(F[(a + 8) >> 2] + (b << 2)) >> 2]); - } - function Rd(a) { - a = Hc(Rb(8), a); - F[a >> 2] = 11516; - W(a | 0, 11548, 1); - v(); - } - function $f(a, b) { - a = a | 0; - b = b | 0; - return M(J[(F[a >> 2] + (b << 2)) >> 2]); - } - function gg(a) { - a = a | 0; - return (((F[(a + 100) >> 2] - F[(a + 96) >> 2]) | 0) / 12) | 0; - } - function cg(a) { - a = a | 0; - return ( - (D[(a + 15) | 0] < 0 ? F[(a + 4) >> 2] : (a + 4) | 0) | 0 - ); - } - function Re(a, b) { - a = a | 0; - b = b | 0; - return F[(F[(a + 4) >> 2] + (b << 2)) >> 2]; - } - function dd(a, b) { - a = a | 0; - b = b | 0; - return F[(F[a >> 2] + (b << 2)) >> 2]; - } - function Yf(a, b) { - a = a | 0; - b = b | 0; - return E[(F[a >> 2] + (b << 1)) >> 1]; - } - function Xf(a, b) { - a = a | 0; - b = b | 0; - return H[(F[a >> 2] + (b << 1)) >> 1]; - } - function Vd(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - return xc(a, b, c) | 0; - } - function sb(a, b) { - var c = 0; - c = ka(b); - F[(a + 4) >> 2] = b; - F[a >> 2] = c; - } - function Kf(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - return Qc(b, c) | 0; - } - function Rc(a) { - F[a >> 2] = 10300; - ma((a + 4) | 0, 0, 80); - return a; - } - function ji(a) { - if (a) { - return (31 - O((a - 1) ^ a)) | 0; - } - return 32; - } - function gd(a) { - a = a | 0; - return (F[(a + 12) >> 2] - F[(a + 8) >> 2]) >> 2; - } - function _f(a, b) { - a = a | 0; - b = b | 0; - return D[(F[a >> 2] + b) | 0]; - } - function Zf(a, b) { - a = a | 0; - b = b | 0; - return G[(F[a >> 2] + b) | 0]; - } - function Ie(a) { - a = a | 0; - return (F[(a + 8) >> 2] - F[(a + 4) >> 2]) >> 2; - } - function wb(a) { - a = a | 0; - if (a) { - $[F[(F[a >> 2] + 4) >> 2]](a); - } - } - function Jd(a, b) { - a = a | 0; - b = b | 0; - F[(a + 4) >> 2] = b; - return 1; - } - function ed(a) { - a = a | 0; - return (F[(a + 4) >> 2] - F[a >> 2]) >> 1; - } - function dc(a) { - a = a | 0; - return (F[(a + 4) >> 2] - F[a >> 2]) >> 2; - } - function fd(a) { - a = a | 0; - return (F[(a + 4) >> 2] - F[a >> 2]) | 0; - } - function ke(a) { - a = a | 0; - return G[(F[(a + 8) >> 2] + 24) | 0]; - } - function Qf(a, b) { - a = a | 0; - b = b | 0; - return F[(b + 8) >> 2]; - } - function Ff(a, b) { - a = a | 0; - b = b | 0; - return F[(b + 4) >> 2]; - } - function De(a, b, c) { - a = a | 0; - b = b | 0; - c = c | 0; - return 1; - } - function Bg(a, b) { - a = a | 0; - b = b | 0; - return G[(b + 24) | 0]; - } - function Oh(a) { - a = a | 0; - F[a >> 2] = 5928; - return a | 0; - } - function Jh(a) { - a = a | 0; - F[a >> 2] = 6932; - return a | 0; - } - function lg(a) { - a = a | 0; - return M(J[(a + 20) >> 2]); - } - function Nh(a) { - a = a | 0; - F[a >> 2] = 5928; - ja(a); - } - function Ih(a) { - a = a | 0; - F[a >> 2] = 6932; - ja(a); - } - function ug(a) { - a = a | 0; - return F[(a + 88) >> 2]; - } - function tg(a) { - a = a | 0; - return F[(a + 56) >> 2]; - } - function qg(a) { - a = a | 0; - return F[(a + 40) >> 2]; - } - function pg(a) { - a = a | 0; - return F[(a + 48) >> 2]; - } - function og(a) { - a = a | 0; - return F[(a + 60) >> 2]; - } - function ec(a) { - a = a | 0; - return F[(a + 80) >> 2]; - } - function cb(a) { - a = a | 0; - return F[(a + 28) >> 2]; - } - function vd(a) { - a = a | 0; - return F[(a + 8) >> 2]; - } - function tc(a, b) { - a = a | 0; - b = b | 0; - return -1; - } - function sg(a) { - a = a | 0; - return D[(a + 24) | 0]; - } - function rg(a) { - a = a | 0; - return G[(a + 32) | 0]; - } - function dg(a) { - a = a | 0; - return !F[a >> 2] | 0; - } - function Wd(a, b) { - a = a | 0; - b = b | 0; - return 6; - } - function Va(a) { - a = a | 0; - return F[(a + 4) >> 2]; - } - function Rb(a) { - return (Ub((a + 80) | 0) + 80) | 0; - } - function Qh(a, b) { - a = a | 0; - b = b | 0; - return 2; - } - function Ia(a, b) { - a = a | 0; - b = b | 0; - return 0; - } - function Bc(a, b) { - a = a | 0; - b = b | 0; - return 1; - } - function jd(a) { - a = a | 0; - return F[a >> 2]; - } - function wg() { - return kb(ka(64)) | 0; - } - function ig() { - return Rc(ka(84)) | 0; - } - function fc(a) { - a = a | 0; - if (a) { - ja(a); - } - } - function Ag() { - return Ja(ka(40)) | 0; - } - function Qb(a) { - a = a | 0; - Cc(a); - ja(a); - } - function Je(a) { - a = a | 0; - return 1161; - } - function He(a) { - a = a | 0; - return 1235; - } - function Ge(a) { - a = a | 0; - return 1201; - } - function Pa(a) { - a = a | 0; - return a | 0; - } - function hh(a) { - a = a | 0; - ja(ud(a)); - } - function gh(a) { - a = a | 0; - ja(sd(a)); - } - function Ve(a) { - a = a | 0; - ja(tb(a)); - } - function ua(a) { - a = a | 0; - return 1; - } - function rc(a) { - a = a | 0; - return 4; - } - function qc(a) { - a = a | 0; - return 5; - } - function Xd(a) { - a = a | 0; - return 2; - } - function Ua(a) { - a = a | 0; - return 0; - } - function Nb(a) { - a = a | 0; - return 6; - } - function Mh(a) { - a = a | 0; - return 3; - } - function za() { - Rd(1222); - v(); - } - function ta() { - sc(1154); - v(); - } - function na() { - Rd(1154); - v(); - } - function Ha(a) { - a = a | 0; - ja(a); - } - function Ra(a) { - a = a | 0; - v(); - } - function ff() { - return 10; - } - function ef() { - return 11; - } - function df() { - return 12; - } - function vb() { - return -1; - } - function ub() { - return 1; - } - function lf() { - return 5; - } - function kf() { - return 6; - } - function jf() { - return 7; - } - function jb() { - return 0; - } - function hf() { - return 8; - } - function gf() { - return 9; - } - function cf() { - return -2; - } - function bf() { - return -3; - } - function bd() { - return 3; - } - function af() { - return -4; - } - function ad() { - return 4; - } - function _b() { - return 2; - } - function $e() { - return -5; - } - function Te() { - V(); - v(); - } - function Jc(a) { - a = a | 0; - } - function ae() {} - // EMSCRIPTEN_END_FUNCS - e = G; - p(q); - var $ = c([ - null, - Cc, - Pa, - Ha, - Xd, - ii, - jh, - ag, - zc, - xe, - uc, - jg, - Wd, - Qh, - Pa, - Pg, - Hg, - ua, - yh, - mh, - kh, - xd, - fh, - qd, - Wd, - Bg, - We, - Ra, - mf, - $c, - Ue, - Re, - Ie, - cb, - Ia, - Te, - Bc, - ua, - Ae, - ze, - Ac, - Fe, - Ee, - De, - Bc, - Ce, - Be, - re, - qe, - ye, - we, - pe, - ve, - ue, - te, - se, - wc, - vc, - Ac, - oe, - ne, - xc, - me, - ke, - le, - je, - Ob, - ua, - Va, - ob, - Ua, - tc, - Ia, - Ua, - ua, - ie, - he, - Ra, - Ra, - ge, - fe, - rc, - ob, - ee, - de, - ce, - be, - qc, - pc, - ua, - Ia, - oc, - $d, - hi, - gi, - fi, - Nb, - _d, - ua, - Ia, - Zd, - Yd, - ei, - Pa, - Ha, - Lb, - cb, - Mb, - Ra, - Ob, - ua, - ob, - di, - Ra, - ci, - bi, - rc, - ob, - ai, - $h, - _h, - Zh, - qc, - pc, - ua, - Ia, - oc, - $d, - Yh, - Xh, - Wh, - Nb, - _d, - ua, - Ia, - Zd, - Yd, - Vh, - Pa, - Ha, - Lb, - cb, - Kb, - Ra, - Ob, - Ua, - ua, - Uh, - wc, - vc, - Th, - Sh, - Vd, - Ph, - Xd, - Rh, - Oh, - Nh, - Nb, - Va, - Ud, - ua, - Ia, - Td, - ua, - Mh, - Sd, - Lh, - Pa, - Ha, - Lb, - cb, - Mb, - Jh, - Ih, - Nb, - Ud, - ua, - Ia, - Td, - Sd, - Hh, - Pa, - Ha, - Lb, - cb, - Kb, - Pa, - Ha, - Ua, - ua, - Ua, - tc, - Ia, - Kh, - Gh, - Ah, - zh, - Fh, - Eh, - Vd, - Dh, - Ch, - Bh, - wh, - Ra, - ua, - ua, - xh, - Dg, - Cg, - ua, - Ua, - Ia, - Ia, - rh, - qh, - uh, - vh, - sh, - ph, - oh, - nh, - th, - ud, - hh, - Jd, - Id, - Hd, - Gd, - lh, - ua, - Va, - vd, - sd, - gh, - Jd, - Id, - Hd, - Gd, - ih, - ua, - Va, - vd, - Ed, - eh, - Fd, - dh, - ch, - $g, - _g, - Zg, - Yg, - ah, - Xg, - bh, - Wg, - Vg, - Tg, - Sg, - Rg, - Qg, - Ug, - Og, - Ng, - Mg, - Lg, - Kg, - Gg, - Ig, - Jg, - Pa, - Ha, - Fg, - Eg, - Ra, - Ua, - ua, - _e, - Ze, - Ye, - Xe, - tb, - Ve, - Oc, - Nc, - Pa, - Ha, - Jc, - Jc, - Se, - Le, - Ne, - Qe, - Ha, - Me, - Oe, - Pe, - Ha, - He, - Ha, - Ge, - Ha, - Je, - Qb, - Va, - Qb, - Qb, - ]); - function aa() { - return (C.byteLength / 65536) | 0; - } - function fa(ga) { - ga = ga | 0; - var ba = aa() | 0; - var ca = (ba + ga) | 0; - if (ba < ca && ca < 65536) { - var da = new ArrayBuffer(L(ca, 65536)); - var ea = new Int8Array(da); - ea.set(D); - D = new Int8Array(da); - E = new Int16Array(da); - F = new Int32Array(da); - G = new Uint8Array(da); - H = new Uint16Array(da); - I = new Uint32Array(da); - J = new Float32Array(da); - K = new Float64Array(da); - C = da; - B.buffer = C; - e = G; - } - return ba; - } - return { - f: ae, - g: $, - h: fc, - i: Ag, - j: zg, - k: fc, - l: yg, - m: jd, - n: xg, - o: wg, - p: fc, - q: vg, - r: ec, - s: ug, - t: tg, - u: cb, - v: sg, - w: rg, - x: qg, - y: pg, - z: og, - A: xa, - B: ng, - C: hd, - D: Va, - E: mg, - F: lg, - G: wb, - H: kg, - I: hd, - J: Va, - K: wb, - L: ig, - M: gd, - N: ec, - O: wb, - P: hg, - Q: gg, - R: gd, - S: ec, - T: wb, - U: fg, - V: eg, - W: jd, - X: dg, - Y: cg, - Z: bg, - _: Xa, - $: $f, - aa: dc, - ba: Wa, - ca: Xa, - da: _f, - ea: fd, - fa: Wa, - ga: Xa, - ha: Zf, - ia: fd, - ja: Wa, - ka: Xa, - la: Yf, - ma: ed, - na: Wa, - oa: Xa, - pa: Xf, - qa: ed, - ra: Wa, - sa: Xa, - ta: dd, - ua: dc, - va: Wa, - wa: Xa, - xa: dd, - ya: dc, - za: Wa, - Aa: Wf, - Ba: Vf, - Ca: Uf, - Da: Tf, - Ea: Sf, - Fa: Rf, - Ga: Qf, - Ha: Pf, - Ia: Of, - Ja: Nf, - Ka: Mf, - La: Lf, - Ma: Kf, - Na: Jf, - Oa: If, - Pa: Hf, - Qa: Gf, - Ra: Ff, - Sa: Ef, - Ta: Df, - Ua: Cf, - Va: Bf, - Wa: Af, - Xa: zf, - Ya: yf, - Za: cd, - _a: xf, - $a: wf, - ab: vf, - bb: uf, - cb: cd, - db: tf, - eb: sf, - fb: rf, - gb: qf, - hb: pf, - ib: of, - jb: nf, - kb: vb, - lb: jb, - mb: ub, - nb: _b, - ob: vb, - pb: jb, - qb: ub, - rb: _b, - sb: bd, - tb: ad, - ub: vb, - vb: jb, - wb: ub, - xb: jb, - yb: ub, - zb: _b, - Ab: bd, - Bb: ad, - Cb: lf, - Db: kf, - Eb: jf, - Fb: hf, - Gb: gf, - Hb: ff, - Ib: ef, - Jb: df, - Kb: jb, - Lb: vb, - Mb: cf, - Nb: bf, - Ob: af, - Pb: $e, - Qb: Ub, - Rb: ja, - Sb: Ke, - }; - } - return ha(ia); - })(info); - // EMSCRIPTEN_END_ASM - }, - instantiate: (binary, info) => ({ - then: (ok) => { - var module = new WebAssembly.Module(binary); - ok({ instance: new WebAssembly.Instance(module, info) }); - }, - }), - RuntimeError: Error, - }; - wasmBinary = []; - if (typeof WebAssembly != "object") { - abort("no native wasm support detected"); - } - var wasmMemory; - var ABORT = false; - var EXITSTATUS; - function assert(condition, text) { - if (!condition) { - abort(text); - } - } - var UTF8Decoder = - typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; - function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) { - var endIdx = idx + maxBytesToRead; - var endPtr = idx; - while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; - if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { - return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); - } - var str = ""; - while (idx < endPtr) { - var u0 = heapOrArray[idx++]; - if (!(u0 & 128)) { - str += String.fromCharCode(u0); - continue; - } - var u1 = heapOrArray[idx++] & 63; - if ((u0 & 224) == 192) { - str += String.fromCharCode(((u0 & 31) << 6) | u1); - continue; - } - var u2 = heapOrArray[idx++] & 63; - if ((u0 & 240) == 224) { - u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; - } else { - u0 = - ((u0 & 7) << 18) | - (u1 << 12) | - (u2 << 6) | - (heapOrArray[idx++] & 63); - } - if (u0 < 65536) { - str += String.fromCharCode(u0); - } else { - var ch = u0 - 65536; - str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023)); - } - } - return str; - } - function UTF8ToString(ptr, maxBytesToRead) { - return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; - } - function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { - if (!(maxBytesToWrite > 0)) return 0; - var startIdx = outIdx; - var endIdx = outIdx + maxBytesToWrite - 1; - for (var i = 0; i < str.length; ++i) { - var u = str.charCodeAt(i); - if (u >= 55296 && u <= 57343) { - var u1 = str.charCodeAt(++i); - u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); - } - if (u <= 127) { - if (outIdx >= endIdx) break; - heap[outIdx++] = u; - } else if (u <= 2047) { - if (outIdx + 1 >= endIdx) break; - heap[outIdx++] = 192 | (u >> 6); - heap[outIdx++] = 128 | (u & 63); - } else if (u <= 65535) { - if (outIdx + 2 >= endIdx) break; - heap[outIdx++] = 224 | (u >> 12); - heap[outIdx++] = 128 | ((u >> 6) & 63); - heap[outIdx++] = 128 | (u & 63); - } else { - if (outIdx + 3 >= endIdx) break; - heap[outIdx++] = 240 | (u >> 18); - heap[outIdx++] = 128 | ((u >> 12) & 63); - heap[outIdx++] = 128 | ((u >> 6) & 63); - heap[outIdx++] = 128 | (u & 63); - } - } - heap[outIdx] = 0; - return outIdx - startIdx; - } - function lengthBytesUTF8(str) { - var len = 0; - for (var i = 0; i < str.length; ++i) { - var c = str.charCodeAt(i); - if (c <= 127) { - len++; - } else if (c <= 2047) { - len += 2; - } else if (c >= 55296 && c <= 57343) { - len += 4; - ++i; - } else { - len += 3; - } - } - return len; - } - var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; - function updateMemoryViews() { - var b = wasmMemory.buffer; - Module["HEAP8"] = HEAP8 = new Int8Array(b); - Module["HEAP16"] = HEAP16 = new Int16Array(b); - Module["HEAP32"] = HEAP32 = new Int32Array(b); - Module["HEAPU8"] = HEAPU8 = new Uint8Array(b); - Module["HEAPU16"] = HEAPU16 = new Uint16Array(b); - Module["HEAPU32"] = HEAPU32 = new Uint32Array(b); - Module["HEAPF32"] = HEAPF32 = new Float32Array(b); - Module["HEAPF64"] = HEAPF64 = new Float64Array(b); - } - var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; - assert( - INITIAL_MEMORY >= 65536, - "INITIAL_MEMORY should be larger than STACK_SIZE, was " + - INITIAL_MEMORY + - "! (STACK_SIZE=" + - 65536 + - ")", - ); - if (Module["wasmMemory"]) { - wasmMemory = Module["wasmMemory"]; - } else { - wasmMemory = new WebAssembly.Memory({ - initial: INITIAL_MEMORY / 65536, - maximum: 2147483648 / 65536, - }); - } - updateMemoryViews(); - INITIAL_MEMORY = wasmMemory.buffer.byteLength; - var wasmTable; - var __ATPRERUN__ = []; - var __ATINIT__ = []; - var __ATPOSTRUN__ = []; - var runtimeInitialized = false; - function keepRuntimeAlive() { - return noExitRuntime; - } - function preRun() { - if (Module["preRun"]) { - if (typeof Module["preRun"] == "function") - Module["preRun"] = [Module["preRun"]]; - while (Module["preRun"].length) { - addOnPreRun(Module["preRun"].shift()); - } - } - callRuntimeCallbacks(__ATPRERUN__); - } - function initRuntime() { - runtimeInitialized = true; - callRuntimeCallbacks(__ATINIT__); - } - function postRun() { - if (Module["postRun"]) { - if (typeof Module["postRun"] == "function") - Module["postRun"] = [Module["postRun"]]; - while (Module["postRun"].length) { - addOnPostRun(Module["postRun"].shift()); - } - } - callRuntimeCallbacks(__ATPOSTRUN__); - } - function addOnPreRun(cb) { - __ATPRERUN__.unshift(cb); - } - function addOnInit(cb) { - __ATINIT__.unshift(cb); - } - function addOnPostRun(cb) { - __ATPOSTRUN__.unshift(cb); - } - var runDependencies = 0; - var runDependencyWatcher = null; - var dependenciesFulfilled = null; - function addRunDependency(id) { - runDependencies++; - if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - } - } - function removeRunDependency(id) { - runDependencies--; - if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - } - if (runDependencies == 0) { - if (runDependencyWatcher !== null) { - clearInterval(runDependencyWatcher); - runDependencyWatcher = null; - } - if (dependenciesFulfilled) { - var callback = dependenciesFulfilled; - dependenciesFulfilled = null; - callback(); - } - } - } - function abort(what) { - if (Module["onAbort"]) { - Module["onAbort"](what); - } - what = "Aborted(" + what + ")"; - err(what); - ABORT = true; - EXITSTATUS = 1; - what += ". Build with -sASSERTIONS for more info."; - var e = new WebAssembly.RuntimeError(what); - readyPromiseReject(e); - throw e; - } - var dataURIPrefix = "data:application/octet-stream;base64,"; - function isDataURI(filename) { - return filename.startsWith(dataURIPrefix); - } - function isFileURI(filename) { - return filename.startsWith("file://"); - } - var wasmBinaryFile; - wasmBinaryFile = "draco_decoder_gltf.wasm"; - if (!isDataURI(wasmBinaryFile)) { - wasmBinaryFile = locateFile(wasmBinaryFile); - } - function getBinary(file) { - try { - if (file == wasmBinaryFile && wasmBinary) { - return new Uint8Array(wasmBinary); - } - var binary = tryParseAsDataURI(file); - if (binary) { - return binary; - } - if (readBinary) { - return readBinary(file); - } - throw "both async and sync fetching of the wasm failed"; - } catch (err) { - abort(err); - } - } - function getBinaryPromise() { - if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { - if (typeof fetch == "function" && !isFileURI(wasmBinaryFile)) { - return fetch(wasmBinaryFile, { credentials: "same-origin" }) - .then((response) => { - if (!response["ok"]) { - throw ( - "failed to load wasm binary file at '" + wasmBinaryFile + "'" - ); - } - return response["arrayBuffer"](); - }) - .catch(() => getBinary(wasmBinaryFile)); - } else { - if (readAsync) { - return new Promise((resolve, reject) => { - readAsync( - wasmBinaryFile, - (response) => { - resolve(new Uint8Array(response)); - }, - reject, - ); - }); - } - } - } - return Promise.resolve().then(() => getBinary(wasmBinaryFile)); - } - function createWasm() { - var info = { a: wasmImports }; - function receiveInstance(instance, module) { - var exports = instance.exports; - Module["asm"] = exports; - wasmTable = Module["asm"]["g"]; - addOnInit(Module["asm"]["f"]); - removeRunDependency("wasm-instantiate"); - } - addRunDependency("wasm-instantiate"); - function receiveInstantiationResult(result) { - receiveInstance(result["instance"]); - } - function instantiateArrayBuffer(receiver) { - return getBinaryPromise() - .then((binary) => WebAssembly.instantiate(binary, info)) - .then((instance) => instance) - .then(receiver, (reason) => { - err("failed to asynchronously prepare wasm: " + reason); - abort(reason); - }); - } - function instantiateAsync() { - if ( - !wasmBinary && - typeof WebAssembly.instantiateStreaming == "function" && - !isDataURI(wasmBinaryFile) && - !isFileURI(wasmBinaryFile) && - !ENVIRONMENT_IS_NODE && - typeof fetch == "function" - ) { - return fetch(wasmBinaryFile, { credentials: "same-origin" }).then( - (response) => { - var result = WebAssembly.instantiateStreaming(response, info); - return result.then(receiveInstantiationResult, (reason) => { - err("wasm streaming compile failed: " + reason); - err("falling back to ArrayBuffer instantiation"); - return instantiateArrayBuffer(receiveInstantiationResult); - }); - }, - ); - } else { - return instantiateArrayBuffer(receiveInstantiationResult); - } - } - if (Module["instantiateWasm"]) { - try { - var exports = Module["instantiateWasm"](info, receiveInstance); - return exports; - } catch (e) { - err("Module.instantiateWasm callback failed with error: " + e); - readyPromiseReject(e); - } - } - instantiateAsync().catch(readyPromiseReject); - return {}; - } - function ExitStatus(status) { - this.name = "ExitStatus"; - this.message = "Program terminated with exit(" + status + ")"; - this.status = status; - } - function callRuntimeCallbacks(callbacks) { - while (callbacks.length > 0) { - callbacks.shift()(Module); - } - } - function intArrayToString(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - var chr = array[i]; - if (chr > 255) { - chr &= 255; - } - ret.push(String.fromCharCode(chr)); - } - return ret.join(""); - } - function ExceptionInfo(excPtr) { - this.excPtr = excPtr; - this.ptr = excPtr - 24; - this.set_type = function (type) { - HEAPU32[(this.ptr + 4) >> 2] = type; - }; - this.get_type = function () { - return HEAPU32[(this.ptr + 4) >> 2]; - }; - this.set_destructor = function (destructor) { - HEAPU32[(this.ptr + 8) >> 2] = destructor; - }; - this.get_destructor = function () { - return HEAPU32[(this.ptr + 8) >> 2]; - }; - this.set_refcount = function (refcount) { - HEAP32[this.ptr >> 2] = refcount; - }; - this.set_caught = function (caught) { - caught = caught ? 1 : 0; - HEAP8[(this.ptr + 12) >> 0] = caught; - }; - this.get_caught = function () { - return HEAP8[(this.ptr + 12) >> 0] != 0; - }; - this.set_rethrown = function (rethrown) { - rethrown = rethrown ? 1 : 0; - HEAP8[(this.ptr + 13) >> 0] = rethrown; - }; - this.get_rethrown = function () { - return HEAP8[(this.ptr + 13) >> 0] != 0; - }; - this.init = function (type, destructor) { - this.set_adjusted_ptr(0); - this.set_type(type); - this.set_destructor(destructor); - this.set_refcount(0); - this.set_caught(false); - this.set_rethrown(false); - }; - this.add_ref = function () { - var value = HEAP32[this.ptr >> 2]; - HEAP32[this.ptr >> 2] = value + 1; - }; - this.release_ref = function () { - var prev = HEAP32[this.ptr >> 2]; - HEAP32[this.ptr >> 2] = prev - 1; - return prev === 1; - }; - this.set_adjusted_ptr = function (adjustedPtr) { - HEAPU32[(this.ptr + 16) >> 2] = adjustedPtr; - }; - this.get_adjusted_ptr = function () { - return HEAPU32[(this.ptr + 16) >> 2]; - }; - this.get_exception_ptr = function () { - var isPointer = ___cxa_is_pointer_type(this.get_type()); - if (isPointer) { - return HEAPU32[this.excPtr >> 2]; - } - var adjusted = this.get_adjusted_ptr(); - if (adjusted !== 0) return adjusted; - return this.excPtr; - }; - } - var exceptionLast = 0; - var uncaughtExceptionCount = 0; - function ___cxa_throw(ptr, type, destructor) { - var info = new ExceptionInfo(ptr); - info.init(type, destructor); - exceptionLast = ptr; - uncaughtExceptionCount++; - throw ptr; - } - function _abort() { - abort(""); - } - function _emscripten_memcpy_big(dest, src, num) { - HEAPU8.copyWithin(dest, src, src + num); - } - function getHeapMax() { - return 2147483648; - } - function emscripten_realloc_buffer(size) { - var b = wasmMemory.buffer; - try { - wasmMemory.grow((size - b.byteLength + 65535) >>> 16); - updateMemoryViews(); - return 1; - } catch (e) {} - } - function _emscripten_resize_heap(requestedSize) { - var oldSize = HEAPU8.length; - requestedSize = requestedSize >>> 0; - var maxHeapSize = getHeapMax(); - if (requestedSize > maxHeapSize) { - return false; - } - const alignUp = (x, multiple) => - x + ((multiple - (x % multiple)) % multiple); - for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { - var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); - overGrownHeapSize = Math.min( - overGrownHeapSize, - requestedSize + 100663296, - ); - var newSize = Math.min( - maxHeapSize, - alignUp(Math.max(requestedSize, overGrownHeapSize), 65536), - ); - var replacement = emscripten_realloc_buffer(newSize); - if (replacement) { - return true; - } - } - return false; - } - function intArrayFromString(stringy, dontAddNull, length) { - var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; - var u8array = new Array(len); - var numBytesWritten = stringToUTF8Array( - stringy, - u8array, - 0, - u8array.length, - ); - if (dontAddNull) u8array.length = numBytesWritten; - return u8array; - } - var decodeBase64 = - typeof atob == "function" - ? atob - : (input) => { - var keyStr = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - input = input.replace(/[^A-Za-z0-9+/=]/g, ""); - do { - enc1 = keyStr.indexOf(input.charAt(i++)); - enc2 = keyStr.indexOf(input.charAt(i++)); - enc3 = keyStr.indexOf(input.charAt(i++)); - enc4 = keyStr.indexOf(input.charAt(i++)); - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - output = output + String.fromCharCode(chr1); - if (enc3 !== 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 !== 64) { - output = output + String.fromCharCode(chr3); - } - } while (i < input.length); - return output; - }; - function intArrayFromBase64(s) { - if (typeof ENVIRONMENT_IS_NODE == "boolean" && ENVIRONMENT_IS_NODE) { - var buf = Buffer.from(s, "base64"); - return new Uint8Array( - buf["buffer"], - buf["byteOffset"], - buf["byteLength"], - ); - } - try { - var decoded = decodeBase64(s); - var bytes = new Uint8Array(decoded.length); - for (var i = 0; i < decoded.length; ++i) { - bytes[i] = decoded.charCodeAt(i); - } - return bytes; - } catch (_) { - throw new Error("Converting base64 string to bytes failed."); - } - } - function tryParseAsDataURI(filename) { - if (!isDataURI(filename)) { - return; - } - return intArrayFromBase64(filename.slice(dataURIPrefix.length)); - } - var wasmImports = { - c: ___cxa_throw, - b: _abort, - e: _emscripten_memcpy_big, - d: _emscripten_resize_heap, - a: wasmMemory, - }; - var asm = createWasm(); - var ___wasm_call_ctors = function () { - return (___wasm_call_ctors = Module["asm"]["f"]).apply(null, arguments); - }; - var _emscripten_bind_VoidPtr___destroy___0 = (Module[ - "_emscripten_bind_VoidPtr___destroy___0" - ] = function () { - return (_emscripten_bind_VoidPtr___destroy___0 = Module[ - "_emscripten_bind_VoidPtr___destroy___0" - ] = - Module["asm"]["h"]).apply(null, arguments); - }); - var _emscripten_bind_DecoderBuffer_DecoderBuffer_0 = (Module[ - "_emscripten_bind_DecoderBuffer_DecoderBuffer_0" - ] = function () { - return (_emscripten_bind_DecoderBuffer_DecoderBuffer_0 = Module[ - "_emscripten_bind_DecoderBuffer_DecoderBuffer_0" - ] = - Module["asm"]["i"]).apply(null, arguments); - }); - var _emscripten_bind_DecoderBuffer_Init_2 = (Module[ - "_emscripten_bind_DecoderBuffer_Init_2" - ] = function () { - return (_emscripten_bind_DecoderBuffer_Init_2 = Module[ - "_emscripten_bind_DecoderBuffer_Init_2" - ] = - Module["asm"]["j"]).apply(null, arguments); - }); - var _emscripten_bind_DecoderBuffer___destroy___0 = (Module[ - "_emscripten_bind_DecoderBuffer___destroy___0" - ] = function () { - return (_emscripten_bind_DecoderBuffer___destroy___0 = Module[ - "_emscripten_bind_DecoderBuffer___destroy___0" - ] = - Module["asm"]["k"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeTransformData_AttributeTransformData_0 = - (Module[ - "_emscripten_bind_AttributeTransformData_AttributeTransformData_0" - ] = function () { - return (_emscripten_bind_AttributeTransformData_AttributeTransformData_0 = - Module[ - "_emscripten_bind_AttributeTransformData_AttributeTransformData_0" - ] = - Module["asm"]["l"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeTransformData_transform_type_0 = (Module[ - "_emscripten_bind_AttributeTransformData_transform_type_0" - ] = function () { - return (_emscripten_bind_AttributeTransformData_transform_type_0 = Module[ - "_emscripten_bind_AttributeTransformData_transform_type_0" - ] = - Module["asm"]["m"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeTransformData___destroy___0 = (Module[ - "_emscripten_bind_AttributeTransformData___destroy___0" - ] = function () { - return (_emscripten_bind_AttributeTransformData___destroy___0 = Module[ - "_emscripten_bind_AttributeTransformData___destroy___0" - ] = - Module["asm"]["n"]).apply(null, arguments); - }); - var _emscripten_bind_GeometryAttribute_GeometryAttribute_0 = (Module[ - "_emscripten_bind_GeometryAttribute_GeometryAttribute_0" - ] = function () { - return (_emscripten_bind_GeometryAttribute_GeometryAttribute_0 = Module[ - "_emscripten_bind_GeometryAttribute_GeometryAttribute_0" - ] = - Module["asm"]["o"]).apply(null, arguments); - }); - var _emscripten_bind_GeometryAttribute___destroy___0 = (Module[ - "_emscripten_bind_GeometryAttribute___destroy___0" - ] = function () { - return (_emscripten_bind_GeometryAttribute___destroy___0 = Module[ - "_emscripten_bind_GeometryAttribute___destroy___0" - ] = - Module["asm"]["p"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_PointAttribute_0 = (Module[ - "_emscripten_bind_PointAttribute_PointAttribute_0" - ] = function () { - return (_emscripten_bind_PointAttribute_PointAttribute_0 = Module[ - "_emscripten_bind_PointAttribute_PointAttribute_0" - ] = - Module["asm"]["q"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_size_0 = (Module[ - "_emscripten_bind_PointAttribute_size_0" - ] = function () { - return (_emscripten_bind_PointAttribute_size_0 = Module[ - "_emscripten_bind_PointAttribute_size_0" - ] = - Module["asm"]["r"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_GetAttributeTransformData_0 = (Module[ - "_emscripten_bind_PointAttribute_GetAttributeTransformData_0" - ] = function () { - return (_emscripten_bind_PointAttribute_GetAttributeTransformData_0 = - Module["_emscripten_bind_PointAttribute_GetAttributeTransformData_0"] = - Module["asm"]["s"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_attribute_type_0 = (Module[ - "_emscripten_bind_PointAttribute_attribute_type_0" - ] = function () { - return (_emscripten_bind_PointAttribute_attribute_type_0 = Module[ - "_emscripten_bind_PointAttribute_attribute_type_0" - ] = - Module["asm"]["t"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_data_type_0 = (Module[ - "_emscripten_bind_PointAttribute_data_type_0" - ] = function () { - return (_emscripten_bind_PointAttribute_data_type_0 = Module[ - "_emscripten_bind_PointAttribute_data_type_0" - ] = - Module["asm"]["u"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_num_components_0 = (Module[ - "_emscripten_bind_PointAttribute_num_components_0" - ] = function () { - return (_emscripten_bind_PointAttribute_num_components_0 = Module[ - "_emscripten_bind_PointAttribute_num_components_0" - ] = - Module["asm"]["v"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_normalized_0 = (Module[ - "_emscripten_bind_PointAttribute_normalized_0" - ] = function () { - return (_emscripten_bind_PointAttribute_normalized_0 = Module[ - "_emscripten_bind_PointAttribute_normalized_0" - ] = - Module["asm"]["w"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_byte_stride_0 = (Module[ - "_emscripten_bind_PointAttribute_byte_stride_0" - ] = function () { - return (_emscripten_bind_PointAttribute_byte_stride_0 = Module[ - "_emscripten_bind_PointAttribute_byte_stride_0" - ] = - Module["asm"]["x"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_byte_offset_0 = (Module[ - "_emscripten_bind_PointAttribute_byte_offset_0" - ] = function () { - return (_emscripten_bind_PointAttribute_byte_offset_0 = Module[ - "_emscripten_bind_PointAttribute_byte_offset_0" - ] = - Module["asm"]["y"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute_unique_id_0 = (Module[ - "_emscripten_bind_PointAttribute_unique_id_0" - ] = function () { - return (_emscripten_bind_PointAttribute_unique_id_0 = Module[ - "_emscripten_bind_PointAttribute_unique_id_0" - ] = - Module["asm"]["z"]).apply(null, arguments); - }); - var _emscripten_bind_PointAttribute___destroy___0 = (Module[ - "_emscripten_bind_PointAttribute___destroy___0" - ] = function () { - return (_emscripten_bind_PointAttribute___destroy___0 = Module[ - "_emscripten_bind_PointAttribute___destroy___0" - ] = - Module["asm"]["A"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0 = - (Module[ - "_emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0" - ] = function () { - return (_emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0 = - Module[ - "_emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0" - ] = - Module["asm"]["B"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1 = - (Module[ - "_emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1" - ] = function () { - return (_emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1 = - Module[ - "_emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1" - ] = - Module["asm"]["C"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeQuantizationTransform_quantization_bits_0 = - (Module[ - "_emscripten_bind_AttributeQuantizationTransform_quantization_bits_0" - ] = function () { - return (_emscripten_bind_AttributeQuantizationTransform_quantization_bits_0 = - Module[ - "_emscripten_bind_AttributeQuantizationTransform_quantization_bits_0" - ] = - Module["asm"]["D"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeQuantizationTransform_min_value_1 = (Module[ - "_emscripten_bind_AttributeQuantizationTransform_min_value_1" - ] = function () { - return (_emscripten_bind_AttributeQuantizationTransform_min_value_1 = - Module["_emscripten_bind_AttributeQuantizationTransform_min_value_1"] = - Module["asm"]["E"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeQuantizationTransform_range_0 = (Module[ - "_emscripten_bind_AttributeQuantizationTransform_range_0" - ] = function () { - return (_emscripten_bind_AttributeQuantizationTransform_range_0 = Module[ - "_emscripten_bind_AttributeQuantizationTransform_range_0" - ] = - Module["asm"]["F"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeQuantizationTransform___destroy___0 = (Module[ - "_emscripten_bind_AttributeQuantizationTransform___destroy___0" - ] = function () { - return (_emscripten_bind_AttributeQuantizationTransform___destroy___0 = - Module[ - "_emscripten_bind_AttributeQuantizationTransform___destroy___0" - ] = - Module["asm"]["G"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0 = - (Module[ - "_emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0" - ] = function () { - return (_emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0 = - Module[ - "_emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0" - ] = - Module["asm"]["H"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1 = - (Module[ - "_emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1" - ] = function () { - return (_emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1 = - Module[ - "_emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1" - ] = - Module["asm"]["I"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeOctahedronTransform_quantization_bits_0 = - (Module[ - "_emscripten_bind_AttributeOctahedronTransform_quantization_bits_0" - ] = function () { - return (_emscripten_bind_AttributeOctahedronTransform_quantization_bits_0 = - Module[ - "_emscripten_bind_AttributeOctahedronTransform_quantization_bits_0" - ] = - Module["asm"]["J"]).apply(null, arguments); - }); - var _emscripten_bind_AttributeOctahedronTransform___destroy___0 = (Module[ - "_emscripten_bind_AttributeOctahedronTransform___destroy___0" - ] = function () { - return (_emscripten_bind_AttributeOctahedronTransform___destroy___0 = - Module["_emscripten_bind_AttributeOctahedronTransform___destroy___0"] = - Module["asm"]["K"]).apply(null, arguments); - }); - var _emscripten_bind_PointCloud_PointCloud_0 = (Module[ - "_emscripten_bind_PointCloud_PointCloud_0" - ] = function () { - return (_emscripten_bind_PointCloud_PointCloud_0 = Module[ - "_emscripten_bind_PointCloud_PointCloud_0" - ] = - Module["asm"]["L"]).apply(null, arguments); - }); - var _emscripten_bind_PointCloud_num_attributes_0 = (Module[ - "_emscripten_bind_PointCloud_num_attributes_0" - ] = function () { - return (_emscripten_bind_PointCloud_num_attributes_0 = Module[ - "_emscripten_bind_PointCloud_num_attributes_0" - ] = - Module["asm"]["M"]).apply(null, arguments); - }); - var _emscripten_bind_PointCloud_num_points_0 = (Module[ - "_emscripten_bind_PointCloud_num_points_0" - ] = function () { - return (_emscripten_bind_PointCloud_num_points_0 = Module[ - "_emscripten_bind_PointCloud_num_points_0" - ] = - Module["asm"]["N"]).apply(null, arguments); - }); - var _emscripten_bind_PointCloud___destroy___0 = (Module[ - "_emscripten_bind_PointCloud___destroy___0" - ] = function () { - return (_emscripten_bind_PointCloud___destroy___0 = Module[ - "_emscripten_bind_PointCloud___destroy___0" - ] = - Module["asm"]["O"]).apply(null, arguments); - }); - var _emscripten_bind_Mesh_Mesh_0 = (Module["_emscripten_bind_Mesh_Mesh_0"] = - function () { - return (_emscripten_bind_Mesh_Mesh_0 = Module[ - "_emscripten_bind_Mesh_Mesh_0" - ] = - Module["asm"]["P"]).apply(null, arguments); - }); - var _emscripten_bind_Mesh_num_faces_0 = (Module[ - "_emscripten_bind_Mesh_num_faces_0" - ] = function () { - return (_emscripten_bind_Mesh_num_faces_0 = Module[ - "_emscripten_bind_Mesh_num_faces_0" - ] = - Module["asm"]["Q"]).apply(null, arguments); - }); - var _emscripten_bind_Mesh_num_attributes_0 = (Module[ - "_emscripten_bind_Mesh_num_attributes_0" - ] = function () { - return (_emscripten_bind_Mesh_num_attributes_0 = Module[ - "_emscripten_bind_Mesh_num_attributes_0" - ] = - Module["asm"]["R"]).apply(null, arguments); - }); - var _emscripten_bind_Mesh_num_points_0 = (Module[ - "_emscripten_bind_Mesh_num_points_0" - ] = function () { - return (_emscripten_bind_Mesh_num_points_0 = Module[ - "_emscripten_bind_Mesh_num_points_0" - ] = - Module["asm"]["S"]).apply(null, arguments); - }); - var _emscripten_bind_Mesh___destroy___0 = (Module[ - "_emscripten_bind_Mesh___destroy___0" - ] = function () { - return (_emscripten_bind_Mesh___destroy___0 = Module[ - "_emscripten_bind_Mesh___destroy___0" - ] = - Module["asm"]["T"]).apply(null, arguments); - }); - var _emscripten_bind_Metadata_Metadata_0 = (Module[ - "_emscripten_bind_Metadata_Metadata_0" - ] = function () { - return (_emscripten_bind_Metadata_Metadata_0 = Module[ - "_emscripten_bind_Metadata_Metadata_0" - ] = - Module["asm"]["U"]).apply(null, arguments); - }); - var _emscripten_bind_Metadata___destroy___0 = (Module[ - "_emscripten_bind_Metadata___destroy___0" - ] = function () { - return (_emscripten_bind_Metadata___destroy___0 = Module[ - "_emscripten_bind_Metadata___destroy___0" - ] = - Module["asm"]["V"]).apply(null, arguments); - }); - var _emscripten_bind_Status_code_0 = (Module[ - "_emscripten_bind_Status_code_0" - ] = function () { - return (_emscripten_bind_Status_code_0 = Module[ - "_emscripten_bind_Status_code_0" - ] = - Module["asm"]["W"]).apply(null, arguments); - }); - var _emscripten_bind_Status_ok_0 = (Module["_emscripten_bind_Status_ok_0"] = - function () { - return (_emscripten_bind_Status_ok_0 = Module[ - "_emscripten_bind_Status_ok_0" - ] = - Module["asm"]["X"]).apply(null, arguments); - }); - var _emscripten_bind_Status_error_msg_0 = (Module[ - "_emscripten_bind_Status_error_msg_0" - ] = function () { - return (_emscripten_bind_Status_error_msg_0 = Module[ - "_emscripten_bind_Status_error_msg_0" - ] = - Module["asm"]["Y"]).apply(null, arguments); - }); - var _emscripten_bind_Status___destroy___0 = (Module[ - "_emscripten_bind_Status___destroy___0" - ] = function () { - return (_emscripten_bind_Status___destroy___0 = Module[ - "_emscripten_bind_Status___destroy___0" - ] = - Module["asm"]["Z"]).apply(null, arguments); - }); - var _emscripten_bind_DracoFloat32Array_DracoFloat32Array_0 = (Module[ - "_emscripten_bind_DracoFloat32Array_DracoFloat32Array_0" - ] = function () { - return (_emscripten_bind_DracoFloat32Array_DracoFloat32Array_0 = Module[ - "_emscripten_bind_DracoFloat32Array_DracoFloat32Array_0" - ] = - Module["asm"]["_"]).apply(null, arguments); - }); - var _emscripten_bind_DracoFloat32Array_GetValue_1 = (Module[ - "_emscripten_bind_DracoFloat32Array_GetValue_1" - ] = function () { - return (_emscripten_bind_DracoFloat32Array_GetValue_1 = Module[ - "_emscripten_bind_DracoFloat32Array_GetValue_1" - ] = - Module["asm"]["$"]).apply(null, arguments); - }); - var _emscripten_bind_DracoFloat32Array_size_0 = (Module[ - "_emscripten_bind_DracoFloat32Array_size_0" - ] = function () { - return (_emscripten_bind_DracoFloat32Array_size_0 = Module[ - "_emscripten_bind_DracoFloat32Array_size_0" - ] = - Module["asm"]["aa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoFloat32Array___destroy___0 = (Module[ - "_emscripten_bind_DracoFloat32Array___destroy___0" - ] = function () { - return (_emscripten_bind_DracoFloat32Array___destroy___0 = Module[ - "_emscripten_bind_DracoFloat32Array___destroy___0" - ] = - Module["asm"]["ba"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt8Array_DracoInt8Array_0 = (Module[ - "_emscripten_bind_DracoInt8Array_DracoInt8Array_0" - ] = function () { - return (_emscripten_bind_DracoInt8Array_DracoInt8Array_0 = Module[ - "_emscripten_bind_DracoInt8Array_DracoInt8Array_0" - ] = - Module["asm"]["ca"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt8Array_GetValue_1 = (Module[ - "_emscripten_bind_DracoInt8Array_GetValue_1" - ] = function () { - return (_emscripten_bind_DracoInt8Array_GetValue_1 = Module[ - "_emscripten_bind_DracoInt8Array_GetValue_1" - ] = - Module["asm"]["da"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt8Array_size_0 = (Module[ - "_emscripten_bind_DracoInt8Array_size_0" - ] = function () { - return (_emscripten_bind_DracoInt8Array_size_0 = Module[ - "_emscripten_bind_DracoInt8Array_size_0" - ] = - Module["asm"]["ea"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt8Array___destroy___0 = (Module[ - "_emscripten_bind_DracoInt8Array___destroy___0" - ] = function () { - return (_emscripten_bind_DracoInt8Array___destroy___0 = Module[ - "_emscripten_bind_DracoInt8Array___destroy___0" - ] = - Module["asm"]["fa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt8Array_DracoUInt8Array_0 = (Module[ - "_emscripten_bind_DracoUInt8Array_DracoUInt8Array_0" - ] = function () { - return (_emscripten_bind_DracoUInt8Array_DracoUInt8Array_0 = Module[ - "_emscripten_bind_DracoUInt8Array_DracoUInt8Array_0" - ] = - Module["asm"]["ga"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt8Array_GetValue_1 = (Module[ - "_emscripten_bind_DracoUInt8Array_GetValue_1" - ] = function () { - return (_emscripten_bind_DracoUInt8Array_GetValue_1 = Module[ - "_emscripten_bind_DracoUInt8Array_GetValue_1" - ] = - Module["asm"]["ha"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt8Array_size_0 = (Module[ - "_emscripten_bind_DracoUInt8Array_size_0" - ] = function () { - return (_emscripten_bind_DracoUInt8Array_size_0 = Module[ - "_emscripten_bind_DracoUInt8Array_size_0" - ] = - Module["asm"]["ia"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt8Array___destroy___0 = (Module[ - "_emscripten_bind_DracoUInt8Array___destroy___0" - ] = function () { - return (_emscripten_bind_DracoUInt8Array___destroy___0 = Module[ - "_emscripten_bind_DracoUInt8Array___destroy___0" - ] = - Module["asm"]["ja"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt16Array_DracoInt16Array_0 = (Module[ - "_emscripten_bind_DracoInt16Array_DracoInt16Array_0" - ] = function () { - return (_emscripten_bind_DracoInt16Array_DracoInt16Array_0 = Module[ - "_emscripten_bind_DracoInt16Array_DracoInt16Array_0" - ] = - Module["asm"]["ka"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt16Array_GetValue_1 = (Module[ - "_emscripten_bind_DracoInt16Array_GetValue_1" - ] = function () { - return (_emscripten_bind_DracoInt16Array_GetValue_1 = Module[ - "_emscripten_bind_DracoInt16Array_GetValue_1" - ] = - Module["asm"]["la"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt16Array_size_0 = (Module[ - "_emscripten_bind_DracoInt16Array_size_0" - ] = function () { - return (_emscripten_bind_DracoInt16Array_size_0 = Module[ - "_emscripten_bind_DracoInt16Array_size_0" - ] = - Module["asm"]["ma"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt16Array___destroy___0 = (Module[ - "_emscripten_bind_DracoInt16Array___destroy___0" - ] = function () { - return (_emscripten_bind_DracoInt16Array___destroy___0 = Module[ - "_emscripten_bind_DracoInt16Array___destroy___0" - ] = - Module["asm"]["na"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt16Array_DracoUInt16Array_0 = (Module[ - "_emscripten_bind_DracoUInt16Array_DracoUInt16Array_0" - ] = function () { - return (_emscripten_bind_DracoUInt16Array_DracoUInt16Array_0 = Module[ - "_emscripten_bind_DracoUInt16Array_DracoUInt16Array_0" - ] = - Module["asm"]["oa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt16Array_GetValue_1 = (Module[ - "_emscripten_bind_DracoUInt16Array_GetValue_1" - ] = function () { - return (_emscripten_bind_DracoUInt16Array_GetValue_1 = Module[ - "_emscripten_bind_DracoUInt16Array_GetValue_1" - ] = - Module["asm"]["pa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt16Array_size_0 = (Module[ - "_emscripten_bind_DracoUInt16Array_size_0" - ] = function () { - return (_emscripten_bind_DracoUInt16Array_size_0 = Module[ - "_emscripten_bind_DracoUInt16Array_size_0" - ] = - Module["asm"]["qa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt16Array___destroy___0 = (Module[ - "_emscripten_bind_DracoUInt16Array___destroy___0" - ] = function () { - return (_emscripten_bind_DracoUInt16Array___destroy___0 = Module[ - "_emscripten_bind_DracoUInt16Array___destroy___0" - ] = - Module["asm"]["ra"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt32Array_DracoInt32Array_0 = (Module[ - "_emscripten_bind_DracoInt32Array_DracoInt32Array_0" - ] = function () { - return (_emscripten_bind_DracoInt32Array_DracoInt32Array_0 = Module[ - "_emscripten_bind_DracoInt32Array_DracoInt32Array_0" - ] = - Module["asm"]["sa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt32Array_GetValue_1 = (Module[ - "_emscripten_bind_DracoInt32Array_GetValue_1" - ] = function () { - return (_emscripten_bind_DracoInt32Array_GetValue_1 = Module[ - "_emscripten_bind_DracoInt32Array_GetValue_1" - ] = - Module["asm"]["ta"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt32Array_size_0 = (Module[ - "_emscripten_bind_DracoInt32Array_size_0" - ] = function () { - return (_emscripten_bind_DracoInt32Array_size_0 = Module[ - "_emscripten_bind_DracoInt32Array_size_0" - ] = - Module["asm"]["ua"]).apply(null, arguments); - }); - var _emscripten_bind_DracoInt32Array___destroy___0 = (Module[ - "_emscripten_bind_DracoInt32Array___destroy___0" - ] = function () { - return (_emscripten_bind_DracoInt32Array___destroy___0 = Module[ - "_emscripten_bind_DracoInt32Array___destroy___0" - ] = - Module["asm"]["va"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt32Array_DracoUInt32Array_0 = (Module[ - "_emscripten_bind_DracoUInt32Array_DracoUInt32Array_0" - ] = function () { - return (_emscripten_bind_DracoUInt32Array_DracoUInt32Array_0 = Module[ - "_emscripten_bind_DracoUInt32Array_DracoUInt32Array_0" - ] = - Module["asm"]["wa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt32Array_GetValue_1 = (Module[ - "_emscripten_bind_DracoUInt32Array_GetValue_1" - ] = function () { - return (_emscripten_bind_DracoUInt32Array_GetValue_1 = Module[ - "_emscripten_bind_DracoUInt32Array_GetValue_1" - ] = - Module["asm"]["xa"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt32Array_size_0 = (Module[ - "_emscripten_bind_DracoUInt32Array_size_0" - ] = function () { - return (_emscripten_bind_DracoUInt32Array_size_0 = Module[ - "_emscripten_bind_DracoUInt32Array_size_0" - ] = - Module["asm"]["ya"]).apply(null, arguments); - }); - var _emscripten_bind_DracoUInt32Array___destroy___0 = (Module[ - "_emscripten_bind_DracoUInt32Array___destroy___0" - ] = function () { - return (_emscripten_bind_DracoUInt32Array___destroy___0 = Module[ - "_emscripten_bind_DracoUInt32Array___destroy___0" - ] = - Module["asm"]["za"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_MetadataQuerier_0 = (Module[ - "_emscripten_bind_MetadataQuerier_MetadataQuerier_0" - ] = function () { - return (_emscripten_bind_MetadataQuerier_MetadataQuerier_0 = Module[ - "_emscripten_bind_MetadataQuerier_MetadataQuerier_0" - ] = - Module["asm"]["Aa"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_HasEntry_2 = (Module[ - "_emscripten_bind_MetadataQuerier_HasEntry_2" - ] = function () { - return (_emscripten_bind_MetadataQuerier_HasEntry_2 = Module[ - "_emscripten_bind_MetadataQuerier_HasEntry_2" - ] = - Module["asm"]["Ba"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_GetIntEntry_2 = (Module[ - "_emscripten_bind_MetadataQuerier_GetIntEntry_2" - ] = function () { - return (_emscripten_bind_MetadataQuerier_GetIntEntry_2 = Module[ - "_emscripten_bind_MetadataQuerier_GetIntEntry_2" - ] = - Module["asm"]["Ca"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_GetIntEntryArray_3 = (Module[ - "_emscripten_bind_MetadataQuerier_GetIntEntryArray_3" - ] = function () { - return (_emscripten_bind_MetadataQuerier_GetIntEntryArray_3 = Module[ - "_emscripten_bind_MetadataQuerier_GetIntEntryArray_3" - ] = - Module["asm"]["Da"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_GetDoubleEntry_2 = (Module[ - "_emscripten_bind_MetadataQuerier_GetDoubleEntry_2" - ] = function () { - return (_emscripten_bind_MetadataQuerier_GetDoubleEntry_2 = Module[ - "_emscripten_bind_MetadataQuerier_GetDoubleEntry_2" - ] = - Module["asm"]["Ea"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_GetStringEntry_2 = (Module[ - "_emscripten_bind_MetadataQuerier_GetStringEntry_2" - ] = function () { - return (_emscripten_bind_MetadataQuerier_GetStringEntry_2 = Module[ - "_emscripten_bind_MetadataQuerier_GetStringEntry_2" - ] = - Module["asm"]["Fa"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_NumEntries_1 = (Module[ - "_emscripten_bind_MetadataQuerier_NumEntries_1" - ] = function () { - return (_emscripten_bind_MetadataQuerier_NumEntries_1 = Module[ - "_emscripten_bind_MetadataQuerier_NumEntries_1" - ] = - Module["asm"]["Ga"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier_GetEntryName_2 = (Module[ - "_emscripten_bind_MetadataQuerier_GetEntryName_2" - ] = function () { - return (_emscripten_bind_MetadataQuerier_GetEntryName_2 = Module[ - "_emscripten_bind_MetadataQuerier_GetEntryName_2" - ] = - Module["asm"]["Ha"]).apply(null, arguments); - }); - var _emscripten_bind_MetadataQuerier___destroy___0 = (Module[ - "_emscripten_bind_MetadataQuerier___destroy___0" - ] = function () { - return (_emscripten_bind_MetadataQuerier___destroy___0 = Module[ - "_emscripten_bind_MetadataQuerier___destroy___0" - ] = - Module["asm"]["Ia"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_Decoder_0 = (Module[ - "_emscripten_bind_Decoder_Decoder_0" - ] = function () { - return (_emscripten_bind_Decoder_Decoder_0 = Module[ - "_emscripten_bind_Decoder_Decoder_0" - ] = - Module["asm"]["Ja"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_DecodeArrayToPointCloud_3 = (Module[ - "_emscripten_bind_Decoder_DecodeArrayToPointCloud_3" - ] = function () { - return (_emscripten_bind_Decoder_DecodeArrayToPointCloud_3 = Module[ - "_emscripten_bind_Decoder_DecodeArrayToPointCloud_3" - ] = - Module["asm"]["Ka"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_DecodeArrayToMesh_3 = (Module[ - "_emscripten_bind_Decoder_DecodeArrayToMesh_3" - ] = function () { - return (_emscripten_bind_Decoder_DecodeArrayToMesh_3 = Module[ - "_emscripten_bind_Decoder_DecodeArrayToMesh_3" - ] = - Module["asm"]["La"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeId_2 = (Module[ - "_emscripten_bind_Decoder_GetAttributeId_2" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeId_2 = Module[ - "_emscripten_bind_Decoder_GetAttributeId_2" - ] = - Module["asm"]["Ma"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeIdByName_2 = (Module[ - "_emscripten_bind_Decoder_GetAttributeIdByName_2" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeIdByName_2 = Module[ - "_emscripten_bind_Decoder_GetAttributeIdByName_2" - ] = - Module["asm"]["Na"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3" - ] = - Module["asm"]["Oa"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttribute_2 = (Module[ - "_emscripten_bind_Decoder_GetAttribute_2" - ] = function () { - return (_emscripten_bind_Decoder_GetAttribute_2 = Module[ - "_emscripten_bind_Decoder_GetAttribute_2" - ] = - Module["asm"]["Pa"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeByUniqueId_2 = (Module[ - "_emscripten_bind_Decoder_GetAttributeByUniqueId_2" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeByUniqueId_2 = Module[ - "_emscripten_bind_Decoder_GetAttributeByUniqueId_2" - ] = - Module["asm"]["Qa"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetMetadata_1 = (Module[ - "_emscripten_bind_Decoder_GetMetadata_1" - ] = function () { - return (_emscripten_bind_Decoder_GetMetadata_1 = Module[ - "_emscripten_bind_Decoder_GetMetadata_1" - ] = - Module["asm"]["Ra"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeMetadata_2 = (Module[ - "_emscripten_bind_Decoder_GetAttributeMetadata_2" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeMetadata_2 = Module[ - "_emscripten_bind_Decoder_GetAttributeMetadata_2" - ] = - Module["asm"]["Sa"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetFaceFromMesh_3 = (Module[ - "_emscripten_bind_Decoder_GetFaceFromMesh_3" - ] = function () { - return (_emscripten_bind_Decoder_GetFaceFromMesh_3 = Module[ - "_emscripten_bind_Decoder_GetFaceFromMesh_3" - ] = - Module["asm"]["Ta"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetTriangleStripsFromMesh_2 = (Module[ - "_emscripten_bind_Decoder_GetTriangleStripsFromMesh_2" - ] = function () { - return (_emscripten_bind_Decoder_GetTriangleStripsFromMesh_2 = Module[ - "_emscripten_bind_Decoder_GetTriangleStripsFromMesh_2" - ] = - Module["asm"]["Ua"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetTrianglesUInt16Array_3 = (Module[ - "_emscripten_bind_Decoder_GetTrianglesUInt16Array_3" - ] = function () { - return (_emscripten_bind_Decoder_GetTrianglesUInt16Array_3 = Module[ - "_emscripten_bind_Decoder_GetTrianglesUInt16Array_3" - ] = - Module["asm"]["Va"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetTrianglesUInt32Array_3 = (Module[ - "_emscripten_bind_Decoder_GetTrianglesUInt32Array_3" - ] = function () { - return (_emscripten_bind_Decoder_GetTrianglesUInt32Array_3 = Module[ - "_emscripten_bind_Decoder_GetTrianglesUInt32Array_3" - ] = - Module["asm"]["Wa"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeFloat_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeFloat_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeFloat_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeFloat_3" - ] = - Module["asm"]["Xa"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3" - ] = - Module["asm"]["Ya"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeIntForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeIntForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeIntForAllPoints_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeIntForAllPoints_3" - ] = - Module["asm"]["Za"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3" - ] = - Module["asm"]["_a"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3" - ] = - Module["asm"]["$a"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3" - ] = - Module["asm"]["ab"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3 = - Module["_emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3"] = - Module["asm"]["bb"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3 = Module[ - "_emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3" - ] = - Module["asm"]["cb"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3 = (Module[ - "_emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3 = - Module["_emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3"] = - Module["asm"]["db"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5 = (Module[ - "_emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5" - ] = function () { - return (_emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5 = - Module["_emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5"] = - Module["asm"]["eb"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_SkipAttributeTransform_1 = (Module[ - "_emscripten_bind_Decoder_SkipAttributeTransform_1" - ] = function () { - return (_emscripten_bind_Decoder_SkipAttributeTransform_1 = Module[ - "_emscripten_bind_Decoder_SkipAttributeTransform_1" - ] = - Module["asm"]["fb"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1 = (Module[ - "_emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1" - ] = function () { - return (_emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1 = - Module["_emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1"] = - Module["asm"]["gb"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_DecodeBufferToPointCloud_2 = (Module[ - "_emscripten_bind_Decoder_DecodeBufferToPointCloud_2" - ] = function () { - return (_emscripten_bind_Decoder_DecodeBufferToPointCloud_2 = Module[ - "_emscripten_bind_Decoder_DecodeBufferToPointCloud_2" - ] = - Module["asm"]["hb"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder_DecodeBufferToMesh_2 = (Module[ - "_emscripten_bind_Decoder_DecodeBufferToMesh_2" - ] = function () { - return (_emscripten_bind_Decoder_DecodeBufferToMesh_2 = Module[ - "_emscripten_bind_Decoder_DecodeBufferToMesh_2" - ] = - Module["asm"]["ib"]).apply(null, arguments); - }); - var _emscripten_bind_Decoder___destroy___0 = (Module[ - "_emscripten_bind_Decoder___destroy___0" - ] = function () { - return (_emscripten_bind_Decoder___destroy___0 = Module[ - "_emscripten_bind_Decoder___destroy___0" - ] = - Module["asm"]["jb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM = - (Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM" - ] = function () { - return (_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM = - Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM" - ] = - Module["asm"]["kb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM = - (Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM" - ] = function () { - return (_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM = - Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM" - ] = - Module["asm"]["lb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM = - (Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM" - ] = function () { - return (_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM = - Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM" - ] = - Module["asm"]["mb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM = - (Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM" - ] = function () { - return (_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM = - Module[ - "_emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM" - ] = - Module["asm"]["nb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_GeometryAttribute_Type_INVALID = (Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_INVALID" - ] = function () { - return (_emscripten_enum_draco_GeometryAttribute_Type_INVALID = Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_INVALID" - ] = - Module["asm"]["ob"]).apply(null, arguments); - }); - var _emscripten_enum_draco_GeometryAttribute_Type_POSITION = (Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_POSITION" - ] = function () { - return (_emscripten_enum_draco_GeometryAttribute_Type_POSITION = Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_POSITION" - ] = - Module["asm"]["pb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_GeometryAttribute_Type_NORMAL = (Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_NORMAL" - ] = function () { - return (_emscripten_enum_draco_GeometryAttribute_Type_NORMAL = Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_NORMAL" - ] = - Module["asm"]["qb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_GeometryAttribute_Type_COLOR = (Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_COLOR" - ] = function () { - return (_emscripten_enum_draco_GeometryAttribute_Type_COLOR = Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_COLOR" - ] = - Module["asm"]["rb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD = (Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD" - ] = function () { - return (_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD = Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD" - ] = - Module["asm"]["sb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_GeometryAttribute_Type_GENERIC = (Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_GENERIC" - ] = function () { - return (_emscripten_enum_draco_GeometryAttribute_Type_GENERIC = Module[ - "_emscripten_enum_draco_GeometryAttribute_Type_GENERIC" - ] = - Module["asm"]["tb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE = - (Module[ - "_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE" - ] = function () { - return (_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE = - Module[ - "_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE" - ] = - Module["asm"]["ub"]).apply(null, arguments); - }); - var _emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD = (Module[ - "_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD" - ] = function () { - return (_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD = Module[ - "_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD" - ] = - Module["asm"]["vb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH = (Module[ - "_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH" - ] = function () { - return (_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH = - Module["_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH"] = - Module["asm"]["wb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_INVALID = (Module[ - "_emscripten_enum_draco_DataType_DT_INVALID" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_INVALID = Module[ - "_emscripten_enum_draco_DataType_DT_INVALID" - ] = - Module["asm"]["xb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_INT8 = (Module[ - "_emscripten_enum_draco_DataType_DT_INT8" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_INT8 = Module[ - "_emscripten_enum_draco_DataType_DT_INT8" - ] = - Module["asm"]["yb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_UINT8 = (Module[ - "_emscripten_enum_draco_DataType_DT_UINT8" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_UINT8 = Module[ - "_emscripten_enum_draco_DataType_DT_UINT8" - ] = - Module["asm"]["zb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_INT16 = (Module[ - "_emscripten_enum_draco_DataType_DT_INT16" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_INT16 = Module[ - "_emscripten_enum_draco_DataType_DT_INT16" - ] = - Module["asm"]["Ab"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_UINT16 = (Module[ - "_emscripten_enum_draco_DataType_DT_UINT16" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_UINT16 = Module[ - "_emscripten_enum_draco_DataType_DT_UINT16" - ] = - Module["asm"]["Bb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_INT32 = (Module[ - "_emscripten_enum_draco_DataType_DT_INT32" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_INT32 = Module[ - "_emscripten_enum_draco_DataType_DT_INT32" - ] = - Module["asm"]["Cb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_UINT32 = (Module[ - "_emscripten_enum_draco_DataType_DT_UINT32" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_UINT32 = Module[ - "_emscripten_enum_draco_DataType_DT_UINT32" - ] = - Module["asm"]["Db"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_INT64 = (Module[ - "_emscripten_enum_draco_DataType_DT_INT64" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_INT64 = Module[ - "_emscripten_enum_draco_DataType_DT_INT64" - ] = - Module["asm"]["Eb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_UINT64 = (Module[ - "_emscripten_enum_draco_DataType_DT_UINT64" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_UINT64 = Module[ - "_emscripten_enum_draco_DataType_DT_UINT64" - ] = - Module["asm"]["Fb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_FLOAT32 = (Module[ - "_emscripten_enum_draco_DataType_DT_FLOAT32" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_FLOAT32 = Module[ - "_emscripten_enum_draco_DataType_DT_FLOAT32" - ] = - Module["asm"]["Gb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_FLOAT64 = (Module[ - "_emscripten_enum_draco_DataType_DT_FLOAT64" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_FLOAT64 = Module[ - "_emscripten_enum_draco_DataType_DT_FLOAT64" - ] = - Module["asm"]["Hb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_BOOL = (Module[ - "_emscripten_enum_draco_DataType_DT_BOOL" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_BOOL = Module[ - "_emscripten_enum_draco_DataType_DT_BOOL" - ] = - Module["asm"]["Ib"]).apply(null, arguments); - }); - var _emscripten_enum_draco_DataType_DT_TYPES_COUNT = (Module[ - "_emscripten_enum_draco_DataType_DT_TYPES_COUNT" - ] = function () { - return (_emscripten_enum_draco_DataType_DT_TYPES_COUNT = Module[ - "_emscripten_enum_draco_DataType_DT_TYPES_COUNT" - ] = - Module["asm"]["Jb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_StatusCode_OK = (Module[ - "_emscripten_enum_draco_StatusCode_OK" - ] = function () { - return (_emscripten_enum_draco_StatusCode_OK = Module[ - "_emscripten_enum_draco_StatusCode_OK" - ] = - Module["asm"]["Kb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_StatusCode_DRACO_ERROR = (Module[ - "_emscripten_enum_draco_StatusCode_DRACO_ERROR" - ] = function () { - return (_emscripten_enum_draco_StatusCode_DRACO_ERROR = Module[ - "_emscripten_enum_draco_StatusCode_DRACO_ERROR" - ] = - Module["asm"]["Lb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_StatusCode_IO_ERROR = (Module[ - "_emscripten_enum_draco_StatusCode_IO_ERROR" - ] = function () { - return (_emscripten_enum_draco_StatusCode_IO_ERROR = Module[ - "_emscripten_enum_draco_StatusCode_IO_ERROR" - ] = - Module["asm"]["Mb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_StatusCode_INVALID_PARAMETER = (Module[ - "_emscripten_enum_draco_StatusCode_INVALID_PARAMETER" - ] = function () { - return (_emscripten_enum_draco_StatusCode_INVALID_PARAMETER = Module[ - "_emscripten_enum_draco_StatusCode_INVALID_PARAMETER" - ] = - Module["asm"]["Nb"]).apply(null, arguments); - }); - var _emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION = (Module[ - "_emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION" - ] = function () { - return (_emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION = Module[ - "_emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION" - ] = - Module["asm"]["Ob"]).apply(null, arguments); - }); - var _emscripten_enum_draco_StatusCode_UNKNOWN_VERSION = (Module[ - "_emscripten_enum_draco_StatusCode_UNKNOWN_VERSION" - ] = function () { - return (_emscripten_enum_draco_StatusCode_UNKNOWN_VERSION = Module[ - "_emscripten_enum_draco_StatusCode_UNKNOWN_VERSION" - ] = - Module["asm"]["Pb"]).apply(null, arguments); - }); - var ___errno_location = function () { - return (___errno_location = Module["asm"]["__errno_location"]).apply( - null, - arguments, - ); - }; - var _malloc = (Module["_malloc"] = function () { - return (_malloc = Module["_malloc"] = Module["asm"]["Qb"]).apply( - null, - arguments, - ); - }); - var _free = (Module["_free"] = function () { - return (_free = Module["_free"] = Module["asm"]["Rb"]).apply( - null, - arguments, - ); - }); - var ___cxa_is_pointer_type = function () { - return (___cxa_is_pointer_type = Module["asm"]["Sb"]).apply( - null, - arguments, - ); - }; - var ___start_em_js = (Module["___start_em_js"] = 11660); - var ___stop_em_js = (Module["___stop_em_js"] = 11758); - var calledRun; - dependenciesFulfilled = function runCaller() { - if (!calledRun) run(); - if (!calledRun) dependenciesFulfilled = runCaller; - }; - function run() { - if (runDependencies > 0) { - return; - } - preRun(); - if (runDependencies > 0) { - return; - } - function doRun() { - if (calledRun) return; - calledRun = true; - Module["calledRun"] = true; - if (ABORT) return; - initRuntime(); - readyPromiseResolve(Module); - if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); - postRun(); - } - if (Module["setStatus"]) { - Module["setStatus"]("Running..."); - setTimeout(() => { - setTimeout(() => { - Module["setStatus"](""); - }, 1); - doRun(); - }, 1); - } else { - doRun(); - } - } - if (Module["preInit"]) { - if (typeof Module["preInit"] == "function") - Module["preInit"] = [Module["preInit"]]; - while (Module["preInit"].length > 0) { - Module["preInit"].pop()(); - } - } - run(); - function WrapperObject() {} - WrapperObject.prototype = Object.create(WrapperObject.prototype); - WrapperObject.prototype.constructor = WrapperObject; - WrapperObject.prototype.__class__ = WrapperObject; - WrapperObject.__cache__ = {}; - Module["WrapperObject"] = WrapperObject; - function getCache(__class__) { - return (__class__ || WrapperObject).__cache__; - } - Module["getCache"] = getCache; - function wrapPointer(ptr, __class__) { - var cache = getCache(__class__); - var ret = cache[ptr]; - if (ret) return ret; - ret = Object.create((__class__ || WrapperObject).prototype); - ret.ptr = ptr; - return (cache[ptr] = ret); - } - Module["wrapPointer"] = wrapPointer; - function castObject(obj, __class__) { - return wrapPointer(obj.ptr, __class__); - } - Module["castObject"] = castObject; - Module["NULL"] = wrapPointer(0); - function destroy(obj) { - if (!obj["__destroy__"]) - throw "Error: Cannot destroy object. (Did you create it yourself?)"; - obj["__destroy__"](); - delete getCache(obj.__class__)[obj.ptr]; - } - Module["destroy"] = destroy; - function compare(obj1, obj2) { - return obj1.ptr === obj2.ptr; - } - Module["compare"] = compare; - function getPointer(obj) { - return obj.ptr; - } - Module["getPointer"] = getPointer; - function getClass(obj) { - return obj.__class__; - } - Module["getClass"] = getClass; - var ensureCache = { - buffer: 0, - size: 0, - pos: 0, - temps: [], - needed: 0, - prepare: () => { - if (ensureCache.needed) { - for (var i = 0; i < ensureCache.temps.length; i++) { - Module["_free"](ensureCache.temps[i]); - } - ensureCache.temps.length = 0; - Module["_free"](ensureCache.buffer); - ensureCache.buffer = 0; - ensureCache.size += ensureCache.needed; - ensureCache.needed = 0; - } - if (!ensureCache.buffer) { - ensureCache.size += 128; - ensureCache.buffer = Module["_malloc"](ensureCache.size); - assert(ensureCache.buffer); - } - ensureCache.pos = 0; - }, - alloc: (array, view) => { - assert(ensureCache.buffer); - var bytes = view.BYTES_PER_ELEMENT; - var len = array.length * bytes; - len = (len + 7) & -8; - var ret; - if (ensureCache.pos + len >= ensureCache.size) { - assert(len > 0); - ensureCache.needed += len; - ret = Module["_malloc"](len); - ensureCache.temps.push(ret); - } else { - ret = ensureCache.buffer + ensureCache.pos; - ensureCache.pos += len; - } - return ret; - }, - copy: (array, view, offset) => { - offset >>>= 0; - var bytes = view.BYTES_PER_ELEMENT; - switch (bytes) { - case 2: - offset >>>= 1; - break; - case 4: - offset >>>= 2; - break; - case 8: - offset >>>= 3; - break; - } - for (var i = 0; i < array.length; i++) { - view[offset + i] = array[i]; - } - }, - }; - function ensureString(value) { - if (typeof value === "string") { - var intArray = intArrayFromString(value); - var offset = ensureCache.alloc(intArray, HEAP8); - ensureCache.copy(intArray, HEAP8, offset); - return offset; - } - return value; - } - function ensureInt8(value) { - if (typeof value === "object") { - var offset = ensureCache.alloc(value, HEAP8); - ensureCache.copy(value, HEAP8, offset); - return offset; - } - return value; - } - function VoidPtr() { - throw "cannot construct a VoidPtr, no constructor in IDL"; - } - VoidPtr.prototype = Object.create(WrapperObject.prototype); - VoidPtr.prototype.constructor = VoidPtr; - VoidPtr.prototype.__class__ = VoidPtr; - VoidPtr.__cache__ = {}; - Module["VoidPtr"] = VoidPtr; - VoidPtr.prototype["__destroy__"] = VoidPtr.prototype.__destroy__ = - function () { - var self = this.ptr; - _emscripten_bind_VoidPtr___destroy___0(self); - }; - function DecoderBuffer() { - this.ptr = _emscripten_bind_DecoderBuffer_DecoderBuffer_0(); - getCache(DecoderBuffer)[this.ptr] = this; - } - DecoderBuffer.prototype = Object.create(WrapperObject.prototype); - DecoderBuffer.prototype.constructor = DecoderBuffer; - DecoderBuffer.prototype.__class__ = DecoderBuffer; - DecoderBuffer.__cache__ = {}; - Module["DecoderBuffer"] = DecoderBuffer; - DecoderBuffer.prototype["Init"] = DecoderBuffer.prototype.Init = function ( - data, - data_size, - ) { - var self = this.ptr; - ensureCache.prepare(); - if (typeof data == "object") { - data = ensureInt8(data); - } - if (data_size && typeof data_size === "object") data_size = data_size.ptr; - _emscripten_bind_DecoderBuffer_Init_2(self, data, data_size); - }; - DecoderBuffer.prototype["__destroy__"] = - DecoderBuffer.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DecoderBuffer___destroy___0(self); - }; - function AttributeTransformData() { - this.ptr = - _emscripten_bind_AttributeTransformData_AttributeTransformData_0(); - getCache(AttributeTransformData)[this.ptr] = this; - } - AttributeTransformData.prototype = Object.create(WrapperObject.prototype); - AttributeTransformData.prototype.constructor = AttributeTransformData; - AttributeTransformData.prototype.__class__ = AttributeTransformData; - AttributeTransformData.__cache__ = {}; - Module["AttributeTransformData"] = AttributeTransformData; - AttributeTransformData.prototype["transform_type"] = - AttributeTransformData.prototype.transform_type = function () { - var self = this.ptr; - return _emscripten_bind_AttributeTransformData_transform_type_0(self); - }; - AttributeTransformData.prototype["__destroy__"] = - AttributeTransformData.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_AttributeTransformData___destroy___0(self); - }; - function GeometryAttribute() { - this.ptr = _emscripten_bind_GeometryAttribute_GeometryAttribute_0(); - getCache(GeometryAttribute)[this.ptr] = this; - } - GeometryAttribute.prototype = Object.create(WrapperObject.prototype); - GeometryAttribute.prototype.constructor = GeometryAttribute; - GeometryAttribute.prototype.__class__ = GeometryAttribute; - GeometryAttribute.__cache__ = {}; - Module["GeometryAttribute"] = GeometryAttribute; - GeometryAttribute.prototype["__destroy__"] = - GeometryAttribute.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_GeometryAttribute___destroy___0(self); - }; - function PointAttribute() { - this.ptr = _emscripten_bind_PointAttribute_PointAttribute_0(); - getCache(PointAttribute)[this.ptr] = this; - } - PointAttribute.prototype = Object.create(WrapperObject.prototype); - PointAttribute.prototype.constructor = PointAttribute; - PointAttribute.prototype.__class__ = PointAttribute; - PointAttribute.__cache__ = {}; - Module["PointAttribute"] = PointAttribute; - PointAttribute.prototype["size"] = PointAttribute.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_PointAttribute_size_0(self); - }; - PointAttribute.prototype["GetAttributeTransformData"] = - PointAttribute.prototype.GetAttributeTransformData = function () { - var self = this.ptr; - return wrapPointer( - _emscripten_bind_PointAttribute_GetAttributeTransformData_0(self), - AttributeTransformData, - ); - }; - PointAttribute.prototype["attribute_type"] = - PointAttribute.prototype.attribute_type = function () { - var self = this.ptr; - return _emscripten_bind_PointAttribute_attribute_type_0(self); - }; - PointAttribute.prototype["data_type"] = PointAttribute.prototype.data_type = - function () { - var self = this.ptr; - return _emscripten_bind_PointAttribute_data_type_0(self); - }; - PointAttribute.prototype["num_components"] = - PointAttribute.prototype.num_components = function () { - var self = this.ptr; - return _emscripten_bind_PointAttribute_num_components_0(self); - }; - PointAttribute.prototype["normalized"] = - PointAttribute.prototype.normalized = function () { - var self = this.ptr; - return !!_emscripten_bind_PointAttribute_normalized_0(self); - }; - PointAttribute.prototype["byte_stride"] = - PointAttribute.prototype.byte_stride = function () { - var self = this.ptr; - return _emscripten_bind_PointAttribute_byte_stride_0(self); - }; - PointAttribute.prototype["byte_offset"] = - PointAttribute.prototype.byte_offset = function () { - var self = this.ptr; - return _emscripten_bind_PointAttribute_byte_offset_0(self); - }; - PointAttribute.prototype["unique_id"] = PointAttribute.prototype.unique_id = - function () { - var self = this.ptr; - return _emscripten_bind_PointAttribute_unique_id_0(self); - }; - PointAttribute.prototype["__destroy__"] = - PointAttribute.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_PointAttribute___destroy___0(self); - }; - function AttributeQuantizationTransform() { - this.ptr = - _emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0(); - getCache(AttributeQuantizationTransform)[this.ptr] = this; - } - AttributeQuantizationTransform.prototype = Object.create( - WrapperObject.prototype, - ); - AttributeQuantizationTransform.prototype.constructor = - AttributeQuantizationTransform; - AttributeQuantizationTransform.prototype.__class__ = - AttributeQuantizationTransform; - AttributeQuantizationTransform.__cache__ = {}; - Module["AttributeQuantizationTransform"] = AttributeQuantizationTransform; - AttributeQuantizationTransform.prototype["InitFromAttribute"] = - AttributeQuantizationTransform.prototype.InitFromAttribute = function ( - att, - ) { - var self = this.ptr; - if (att && typeof att === "object") att = att.ptr; - return !!_emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1( - self, - att, - ); - }; - AttributeQuantizationTransform.prototype["quantization_bits"] = - AttributeQuantizationTransform.prototype.quantization_bits = function () { - var self = this.ptr; - return _emscripten_bind_AttributeQuantizationTransform_quantization_bits_0( - self, - ); - }; - AttributeQuantizationTransform.prototype["min_value"] = - AttributeQuantizationTransform.prototype.min_value = function (axis) { - var self = this.ptr; - if (axis && typeof axis === "object") axis = axis.ptr; - return _emscripten_bind_AttributeQuantizationTransform_min_value_1( - self, - axis, - ); - }; - AttributeQuantizationTransform.prototype["range"] = - AttributeQuantizationTransform.prototype.range = function () { - var self = this.ptr; - return _emscripten_bind_AttributeQuantizationTransform_range_0(self); - }; - AttributeQuantizationTransform.prototype["__destroy__"] = - AttributeQuantizationTransform.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_AttributeQuantizationTransform___destroy___0(self); - }; - function AttributeOctahedronTransform() { - this.ptr = - _emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0(); - getCache(AttributeOctahedronTransform)[this.ptr] = this; - } - AttributeOctahedronTransform.prototype = Object.create( - WrapperObject.prototype, - ); - AttributeOctahedronTransform.prototype.constructor = - AttributeOctahedronTransform; - AttributeOctahedronTransform.prototype.__class__ = - AttributeOctahedronTransform; - AttributeOctahedronTransform.__cache__ = {}; - Module["AttributeOctahedronTransform"] = AttributeOctahedronTransform; - AttributeOctahedronTransform.prototype["InitFromAttribute"] = - AttributeOctahedronTransform.prototype.InitFromAttribute = function ( - att, - ) { - var self = this.ptr; - if (att && typeof att === "object") att = att.ptr; - return !!_emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1( - self, - att, - ); - }; - AttributeOctahedronTransform.prototype["quantization_bits"] = - AttributeOctahedronTransform.prototype.quantization_bits = function () { - var self = this.ptr; - return _emscripten_bind_AttributeOctahedronTransform_quantization_bits_0( - self, - ); - }; - AttributeOctahedronTransform.prototype["__destroy__"] = - AttributeOctahedronTransform.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_AttributeOctahedronTransform___destroy___0(self); - }; - function PointCloud() { - this.ptr = _emscripten_bind_PointCloud_PointCloud_0(); - getCache(PointCloud)[this.ptr] = this; - } - PointCloud.prototype = Object.create(WrapperObject.prototype); - PointCloud.prototype.constructor = PointCloud; - PointCloud.prototype.__class__ = PointCloud; - PointCloud.__cache__ = {}; - Module["PointCloud"] = PointCloud; - PointCloud.prototype["num_attributes"] = - PointCloud.prototype.num_attributes = function () { - var self = this.ptr; - return _emscripten_bind_PointCloud_num_attributes_0(self); - }; - PointCloud.prototype["num_points"] = PointCloud.prototype.num_points = - function () { - var self = this.ptr; - return _emscripten_bind_PointCloud_num_points_0(self); - }; - PointCloud.prototype["__destroy__"] = PointCloud.prototype.__destroy__ = - function () { - var self = this.ptr; - _emscripten_bind_PointCloud___destroy___0(self); - }; - function Mesh() { - this.ptr = _emscripten_bind_Mesh_Mesh_0(); - getCache(Mesh)[this.ptr] = this; - } - Mesh.prototype = Object.create(WrapperObject.prototype); - Mesh.prototype.constructor = Mesh; - Mesh.prototype.__class__ = Mesh; - Mesh.__cache__ = {}; - Module["Mesh"] = Mesh; - Mesh.prototype["num_faces"] = Mesh.prototype.num_faces = function () { - var self = this.ptr; - return _emscripten_bind_Mesh_num_faces_0(self); - }; - Mesh.prototype["num_attributes"] = Mesh.prototype.num_attributes = - function () { - var self = this.ptr; - return _emscripten_bind_Mesh_num_attributes_0(self); - }; - Mesh.prototype["num_points"] = Mesh.prototype.num_points = function () { - var self = this.ptr; - return _emscripten_bind_Mesh_num_points_0(self); - }; - Mesh.prototype["__destroy__"] = Mesh.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_Mesh___destroy___0(self); - }; - function Metadata() { - this.ptr = _emscripten_bind_Metadata_Metadata_0(); - getCache(Metadata)[this.ptr] = this; - } - Metadata.prototype = Object.create(WrapperObject.prototype); - Metadata.prototype.constructor = Metadata; - Metadata.prototype.__class__ = Metadata; - Metadata.__cache__ = {}; - Module["Metadata"] = Metadata; - Metadata.prototype["__destroy__"] = Metadata.prototype.__destroy__ = - function () { - var self = this.ptr; - _emscripten_bind_Metadata___destroy___0(self); - }; - function Status() { - throw "cannot construct a Status, no constructor in IDL"; - } - Status.prototype = Object.create(WrapperObject.prototype); - Status.prototype.constructor = Status; - Status.prototype.__class__ = Status; - Status.__cache__ = {}; - Module["Status"] = Status; - Status.prototype["code"] = Status.prototype.code = function () { - var self = this.ptr; - return _emscripten_bind_Status_code_0(self); - }; - Status.prototype["ok"] = Status.prototype.ok = function () { - var self = this.ptr; - return !!_emscripten_bind_Status_ok_0(self); - }; - Status.prototype["error_msg"] = Status.prototype.error_msg = function () { - var self = this.ptr; - return UTF8ToString(_emscripten_bind_Status_error_msg_0(self)); - }; - Status.prototype["__destroy__"] = Status.prototype.__destroy__ = - function () { - var self = this.ptr; - _emscripten_bind_Status___destroy___0(self); - }; - function DracoFloat32Array() { - this.ptr = _emscripten_bind_DracoFloat32Array_DracoFloat32Array_0(); - getCache(DracoFloat32Array)[this.ptr] = this; - } - DracoFloat32Array.prototype = Object.create(WrapperObject.prototype); - DracoFloat32Array.prototype.constructor = DracoFloat32Array; - DracoFloat32Array.prototype.__class__ = DracoFloat32Array; - DracoFloat32Array.__cache__ = {}; - Module["DracoFloat32Array"] = DracoFloat32Array; - DracoFloat32Array.prototype["GetValue"] = - DracoFloat32Array.prototype.GetValue = function (index) { - var self = this.ptr; - if (index && typeof index === "object") index = index.ptr; - return _emscripten_bind_DracoFloat32Array_GetValue_1(self, index); - }; - DracoFloat32Array.prototype["size"] = DracoFloat32Array.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_DracoFloat32Array_size_0(self); - }; - DracoFloat32Array.prototype["__destroy__"] = - DracoFloat32Array.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DracoFloat32Array___destroy___0(self); - }; - function DracoInt8Array() { - this.ptr = _emscripten_bind_DracoInt8Array_DracoInt8Array_0(); - getCache(DracoInt8Array)[this.ptr] = this; - } - DracoInt8Array.prototype = Object.create(WrapperObject.prototype); - DracoInt8Array.prototype.constructor = DracoInt8Array; - DracoInt8Array.prototype.__class__ = DracoInt8Array; - DracoInt8Array.__cache__ = {}; - Module["DracoInt8Array"] = DracoInt8Array; - DracoInt8Array.prototype["GetValue"] = DracoInt8Array.prototype.GetValue = - function (index) { - var self = this.ptr; - if (index && typeof index === "object") index = index.ptr; - return _emscripten_bind_DracoInt8Array_GetValue_1(self, index); - }; - DracoInt8Array.prototype["size"] = DracoInt8Array.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_DracoInt8Array_size_0(self); - }; - DracoInt8Array.prototype["__destroy__"] = - DracoInt8Array.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DracoInt8Array___destroy___0(self); - }; - function DracoUInt8Array() { - this.ptr = _emscripten_bind_DracoUInt8Array_DracoUInt8Array_0(); - getCache(DracoUInt8Array)[this.ptr] = this; - } - DracoUInt8Array.prototype = Object.create(WrapperObject.prototype); - DracoUInt8Array.prototype.constructor = DracoUInt8Array; - DracoUInt8Array.prototype.__class__ = DracoUInt8Array; - DracoUInt8Array.__cache__ = {}; - Module["DracoUInt8Array"] = DracoUInt8Array; - DracoUInt8Array.prototype["GetValue"] = DracoUInt8Array.prototype.GetValue = - function (index) { - var self = this.ptr; - if (index && typeof index === "object") index = index.ptr; - return _emscripten_bind_DracoUInt8Array_GetValue_1(self, index); - }; - DracoUInt8Array.prototype["size"] = DracoUInt8Array.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_DracoUInt8Array_size_0(self); - }; - DracoUInt8Array.prototype["__destroy__"] = - DracoUInt8Array.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DracoUInt8Array___destroy___0(self); - }; - function DracoInt16Array() { - this.ptr = _emscripten_bind_DracoInt16Array_DracoInt16Array_0(); - getCache(DracoInt16Array)[this.ptr] = this; - } - DracoInt16Array.prototype = Object.create(WrapperObject.prototype); - DracoInt16Array.prototype.constructor = DracoInt16Array; - DracoInt16Array.prototype.__class__ = DracoInt16Array; - DracoInt16Array.__cache__ = {}; - Module["DracoInt16Array"] = DracoInt16Array; - DracoInt16Array.prototype["GetValue"] = DracoInt16Array.prototype.GetValue = - function (index) { - var self = this.ptr; - if (index && typeof index === "object") index = index.ptr; - return _emscripten_bind_DracoInt16Array_GetValue_1(self, index); - }; - DracoInt16Array.prototype["size"] = DracoInt16Array.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_DracoInt16Array_size_0(self); - }; - DracoInt16Array.prototype["__destroy__"] = - DracoInt16Array.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DracoInt16Array___destroy___0(self); - }; - function DracoUInt16Array() { - this.ptr = _emscripten_bind_DracoUInt16Array_DracoUInt16Array_0(); - getCache(DracoUInt16Array)[this.ptr] = this; - } - DracoUInt16Array.prototype = Object.create(WrapperObject.prototype); - DracoUInt16Array.prototype.constructor = DracoUInt16Array; - DracoUInt16Array.prototype.__class__ = DracoUInt16Array; - DracoUInt16Array.__cache__ = {}; - Module["DracoUInt16Array"] = DracoUInt16Array; - DracoUInt16Array.prototype["GetValue"] = - DracoUInt16Array.prototype.GetValue = function (index) { - var self = this.ptr; - if (index && typeof index === "object") index = index.ptr; - return _emscripten_bind_DracoUInt16Array_GetValue_1(self, index); - }; - DracoUInt16Array.prototype["size"] = DracoUInt16Array.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_DracoUInt16Array_size_0(self); - }; - DracoUInt16Array.prototype["__destroy__"] = - DracoUInt16Array.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DracoUInt16Array___destroy___0(self); - }; - function DracoInt32Array() { - this.ptr = _emscripten_bind_DracoInt32Array_DracoInt32Array_0(); - getCache(DracoInt32Array)[this.ptr] = this; - } - DracoInt32Array.prototype = Object.create(WrapperObject.prototype); - DracoInt32Array.prototype.constructor = DracoInt32Array; - DracoInt32Array.prototype.__class__ = DracoInt32Array; - DracoInt32Array.__cache__ = {}; - Module["DracoInt32Array"] = DracoInt32Array; - DracoInt32Array.prototype["GetValue"] = DracoInt32Array.prototype.GetValue = - function (index) { - var self = this.ptr; - if (index && typeof index === "object") index = index.ptr; - return _emscripten_bind_DracoInt32Array_GetValue_1(self, index); - }; - DracoInt32Array.prototype["size"] = DracoInt32Array.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_DracoInt32Array_size_0(self); - }; - DracoInt32Array.prototype["__destroy__"] = - DracoInt32Array.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DracoInt32Array___destroy___0(self); - }; - function DracoUInt32Array() { - this.ptr = _emscripten_bind_DracoUInt32Array_DracoUInt32Array_0(); - getCache(DracoUInt32Array)[this.ptr] = this; - } - DracoUInt32Array.prototype = Object.create(WrapperObject.prototype); - DracoUInt32Array.prototype.constructor = DracoUInt32Array; - DracoUInt32Array.prototype.__class__ = DracoUInt32Array; - DracoUInt32Array.__cache__ = {}; - Module["DracoUInt32Array"] = DracoUInt32Array; - DracoUInt32Array.prototype["GetValue"] = - DracoUInt32Array.prototype.GetValue = function (index) { - var self = this.ptr; - if (index && typeof index === "object") index = index.ptr; - return _emscripten_bind_DracoUInt32Array_GetValue_1(self, index); - }; - DracoUInt32Array.prototype["size"] = DracoUInt32Array.prototype.size = - function () { - var self = this.ptr; - return _emscripten_bind_DracoUInt32Array_size_0(self); - }; - DracoUInt32Array.prototype["__destroy__"] = - DracoUInt32Array.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_DracoUInt32Array___destroy___0(self); - }; - function MetadataQuerier() { - this.ptr = _emscripten_bind_MetadataQuerier_MetadataQuerier_0(); - getCache(MetadataQuerier)[this.ptr] = this; - } - MetadataQuerier.prototype = Object.create(WrapperObject.prototype); - MetadataQuerier.prototype.constructor = MetadataQuerier; - MetadataQuerier.prototype.__class__ = MetadataQuerier; - MetadataQuerier.__cache__ = {}; - Module["MetadataQuerier"] = MetadataQuerier; - MetadataQuerier.prototype["HasEntry"] = MetadataQuerier.prototype.HasEntry = - function (metadata, entry_name) { - var self = this.ptr; - ensureCache.prepare(); - if (metadata && typeof metadata === "object") metadata = metadata.ptr; - if (entry_name && typeof entry_name === "object") - entry_name = entry_name.ptr; - else entry_name = ensureString(entry_name); - return !!_emscripten_bind_MetadataQuerier_HasEntry_2( - self, - metadata, - entry_name, - ); - }; - MetadataQuerier.prototype["GetIntEntry"] = - MetadataQuerier.prototype.GetIntEntry = function (metadata, entry_name) { - var self = this.ptr; - ensureCache.prepare(); - if (metadata && typeof metadata === "object") metadata = metadata.ptr; - if (entry_name && typeof entry_name === "object") - entry_name = entry_name.ptr; - else entry_name = ensureString(entry_name); - return _emscripten_bind_MetadataQuerier_GetIntEntry_2( - self, - metadata, - entry_name, - ); - }; - MetadataQuerier.prototype["GetIntEntryArray"] = - MetadataQuerier.prototype.GetIntEntryArray = function ( - metadata, - entry_name, - out_values, - ) { - var self = this.ptr; - ensureCache.prepare(); - if (metadata && typeof metadata === "object") metadata = metadata.ptr; - if (entry_name && typeof entry_name === "object") - entry_name = entry_name.ptr; - else entry_name = ensureString(entry_name); - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - _emscripten_bind_MetadataQuerier_GetIntEntryArray_3( - self, - metadata, - entry_name, - out_values, - ); - }; - MetadataQuerier.prototype["GetDoubleEntry"] = - MetadataQuerier.prototype.GetDoubleEntry = function ( - metadata, - entry_name, - ) { - var self = this.ptr; - ensureCache.prepare(); - if (metadata && typeof metadata === "object") metadata = metadata.ptr; - if (entry_name && typeof entry_name === "object") - entry_name = entry_name.ptr; - else entry_name = ensureString(entry_name); - return _emscripten_bind_MetadataQuerier_GetDoubleEntry_2( - self, - metadata, - entry_name, - ); - }; - MetadataQuerier.prototype["GetStringEntry"] = - MetadataQuerier.prototype.GetStringEntry = function ( - metadata, - entry_name, - ) { - var self = this.ptr; - ensureCache.prepare(); - if (metadata && typeof metadata === "object") metadata = metadata.ptr; - if (entry_name && typeof entry_name === "object") - entry_name = entry_name.ptr; - else entry_name = ensureString(entry_name); - return UTF8ToString( - _emscripten_bind_MetadataQuerier_GetStringEntry_2( - self, - metadata, - entry_name, - ), - ); - }; - MetadataQuerier.prototype["NumEntries"] = - MetadataQuerier.prototype.NumEntries = function (metadata) { - var self = this.ptr; - if (metadata && typeof metadata === "object") metadata = metadata.ptr; - return _emscripten_bind_MetadataQuerier_NumEntries_1(self, metadata); - }; - MetadataQuerier.prototype["GetEntryName"] = - MetadataQuerier.prototype.GetEntryName = function (metadata, entry_id) { - var self = this.ptr; - if (metadata && typeof metadata === "object") metadata = metadata.ptr; - if (entry_id && typeof entry_id === "object") entry_id = entry_id.ptr; - return UTF8ToString( - _emscripten_bind_MetadataQuerier_GetEntryName_2( - self, - metadata, - entry_id, - ), - ); - }; - MetadataQuerier.prototype["__destroy__"] = - MetadataQuerier.prototype.__destroy__ = function () { - var self = this.ptr; - _emscripten_bind_MetadataQuerier___destroy___0(self); - }; - function Decoder() { - this.ptr = _emscripten_bind_Decoder_Decoder_0(); - getCache(Decoder)[this.ptr] = this; - } - Decoder.prototype = Object.create(WrapperObject.prototype); - Decoder.prototype.constructor = Decoder; - Decoder.prototype.__class__ = Decoder; - Decoder.__cache__ = {}; - Module["Decoder"] = Decoder; - Decoder.prototype["DecodeArrayToPointCloud"] = - Decoder.prototype.DecodeArrayToPointCloud = function ( - data, - data_size, - out_point_cloud, - ) { - var self = this.ptr; - ensureCache.prepare(); - if (typeof data == "object") { - data = ensureInt8(data); - } - if (data_size && typeof data_size === "object") - data_size = data_size.ptr; - if (out_point_cloud && typeof out_point_cloud === "object") - out_point_cloud = out_point_cloud.ptr; - return wrapPointer( - _emscripten_bind_Decoder_DecodeArrayToPointCloud_3( - self, - data, - data_size, - out_point_cloud, - ), - Status, - ); - }; - Decoder.prototype["DecodeArrayToMesh"] = - Decoder.prototype.DecodeArrayToMesh = function ( - data, - data_size, - out_mesh, - ) { - var self = this.ptr; - ensureCache.prepare(); - if (typeof data == "object") { - data = ensureInt8(data); - } - if (data_size && typeof data_size === "object") - data_size = data_size.ptr; - if (out_mesh && typeof out_mesh === "object") out_mesh = out_mesh.ptr; - return wrapPointer( - _emscripten_bind_Decoder_DecodeArrayToMesh_3( - self, - data, - data_size, - out_mesh, - ), - Status, - ); - }; - Decoder.prototype["GetAttributeId"] = Decoder.prototype.GetAttributeId = - function (pc, type) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (type && typeof type === "object") type = type.ptr; - return _emscripten_bind_Decoder_GetAttributeId_2(self, pc, type); - }; - Decoder.prototype["GetAttributeIdByName"] = - Decoder.prototype.GetAttributeIdByName = function (pc, name) { - var self = this.ptr; - ensureCache.prepare(); - if (pc && typeof pc === "object") pc = pc.ptr; - if (name && typeof name === "object") name = name.ptr; - else name = ensureString(name); - return _emscripten_bind_Decoder_GetAttributeIdByName_2(self, pc, name); - }; - Decoder.prototype["GetAttributeIdByMetadataEntry"] = - Decoder.prototype.GetAttributeIdByMetadataEntry = function ( - pc, - name, - value, - ) { - var self = this.ptr; - ensureCache.prepare(); - if (pc && typeof pc === "object") pc = pc.ptr; - if (name && typeof name === "object") name = name.ptr; - else name = ensureString(name); - if (value && typeof value === "object") value = value.ptr; - else value = ensureString(value); - return _emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3( - self, - pc, - name, - value, - ); - }; - Decoder.prototype["GetAttribute"] = Decoder.prototype.GetAttribute = - function (pc, att_id) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (att_id && typeof att_id === "object") att_id = att_id.ptr; - return wrapPointer( - _emscripten_bind_Decoder_GetAttribute_2(self, pc, att_id), - PointAttribute, - ); - }; - Decoder.prototype["GetAttributeByUniqueId"] = - Decoder.prototype.GetAttributeByUniqueId = function (pc, unique_id) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (unique_id && typeof unique_id === "object") - unique_id = unique_id.ptr; - return wrapPointer( - _emscripten_bind_Decoder_GetAttributeByUniqueId_2( - self, - pc, - unique_id, - ), - PointAttribute, - ); - }; - Decoder.prototype["GetMetadata"] = Decoder.prototype.GetMetadata = - function (pc) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - return wrapPointer( - _emscripten_bind_Decoder_GetMetadata_1(self, pc), - Metadata, - ); - }; - Decoder.prototype["GetAttributeMetadata"] = - Decoder.prototype.GetAttributeMetadata = function (pc, att_id) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (att_id && typeof att_id === "object") att_id = att_id.ptr; - return wrapPointer( - _emscripten_bind_Decoder_GetAttributeMetadata_2(self, pc, att_id), - Metadata, - ); - }; - Decoder.prototype["GetFaceFromMesh"] = Decoder.prototype.GetFaceFromMesh = - function (m, face_id, out_values) { - var self = this.ptr; - if (m && typeof m === "object") m = m.ptr; - if (face_id && typeof face_id === "object") face_id = face_id.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetFaceFromMesh_3( - self, - m, - face_id, - out_values, - ); - }; - Decoder.prototype["GetTriangleStripsFromMesh"] = - Decoder.prototype.GetTriangleStripsFromMesh = function (m, strip_values) { - var self = this.ptr; - if (m && typeof m === "object") m = m.ptr; - if (strip_values && typeof strip_values === "object") - strip_values = strip_values.ptr; - return _emscripten_bind_Decoder_GetTriangleStripsFromMesh_2( - self, - m, - strip_values, - ); - }; - Decoder.prototype["GetTrianglesUInt16Array"] = - Decoder.prototype.GetTrianglesUInt16Array = function ( - m, - out_size, - out_values, - ) { - var self = this.ptr; - if (m && typeof m === "object") m = m.ptr; - if (out_size && typeof out_size === "object") out_size = out_size.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetTrianglesUInt16Array_3( - self, - m, - out_size, - out_values, - ); - }; - Decoder.prototype["GetTrianglesUInt32Array"] = - Decoder.prototype.GetTrianglesUInt32Array = function ( - m, - out_size, - out_values, - ) { - var self = this.ptr; - if (m && typeof m === "object") m = m.ptr; - if (out_size && typeof out_size === "object") out_size = out_size.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetTrianglesUInt32Array_3( - self, - m, - out_size, - out_values, - ); - }; - Decoder.prototype["GetAttributeFloat"] = - Decoder.prototype.GetAttributeFloat = function ( - pa, - att_index, - out_values, - ) { - var self = this.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (att_index && typeof att_index === "object") - att_index = att_index.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeFloat_3( - self, - pa, - att_index, - out_values, - ); - }; - Decoder.prototype["GetAttributeFloatForAllPoints"] = - Decoder.prototype.GetAttributeFloatForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeIntForAllPoints"] = - Decoder.prototype.GetAttributeIntForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeIntForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeInt8ForAllPoints"] = - Decoder.prototype.GetAttributeInt8ForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeUInt8ForAllPoints"] = - Decoder.prototype.GetAttributeUInt8ForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeInt16ForAllPoints"] = - Decoder.prototype.GetAttributeInt16ForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeUInt16ForAllPoints"] = - Decoder.prototype.GetAttributeUInt16ForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeInt32ForAllPoints"] = - Decoder.prototype.GetAttributeInt32ForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeUInt32ForAllPoints"] = - Decoder.prototype.GetAttributeUInt32ForAllPoints = function ( - pc, - pa, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3( - self, - pc, - pa, - out_values, - ); - }; - Decoder.prototype["GetAttributeDataArrayForAllPoints"] = - Decoder.prototype.GetAttributeDataArrayForAllPoints = function ( - pc, - pa, - data_type, - out_size, - out_values, - ) { - var self = this.ptr; - if (pc && typeof pc === "object") pc = pc.ptr; - if (pa && typeof pa === "object") pa = pa.ptr; - if (data_type && typeof data_type === "object") - data_type = data_type.ptr; - if (out_size && typeof out_size === "object") out_size = out_size.ptr; - if (out_values && typeof out_values === "object") - out_values = out_values.ptr; - return !!_emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5( - self, - pc, - pa, - data_type, - out_size, - out_values, - ); - }; - Decoder.prototype["SkipAttributeTransform"] = - Decoder.prototype.SkipAttributeTransform = function (att_type) { - var self = this.ptr; - if (att_type && typeof att_type === "object") att_type = att_type.ptr; - _emscripten_bind_Decoder_SkipAttributeTransform_1(self, att_type); - }; - Decoder.prototype["GetEncodedGeometryType_Deprecated"] = - Decoder.prototype.GetEncodedGeometryType_Deprecated = function ( - in_buffer, - ) { - var self = this.ptr; - if (in_buffer && typeof in_buffer === "object") - in_buffer = in_buffer.ptr; - return _emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1( - self, - in_buffer, - ); - }; - Decoder.prototype["DecodeBufferToPointCloud"] = - Decoder.prototype.DecodeBufferToPointCloud = function ( - in_buffer, - out_point_cloud, - ) { - var self = this.ptr; - if (in_buffer && typeof in_buffer === "object") - in_buffer = in_buffer.ptr; - if (out_point_cloud && typeof out_point_cloud === "object") - out_point_cloud = out_point_cloud.ptr; - return wrapPointer( - _emscripten_bind_Decoder_DecodeBufferToPointCloud_2( - self, - in_buffer, - out_point_cloud, - ), - Status, - ); - }; - Decoder.prototype["DecodeBufferToMesh"] = - Decoder.prototype.DecodeBufferToMesh = function (in_buffer, out_mesh) { - var self = this.ptr; - if (in_buffer && typeof in_buffer === "object") - in_buffer = in_buffer.ptr; - if (out_mesh && typeof out_mesh === "object") out_mesh = out_mesh.ptr; - return wrapPointer( - _emscripten_bind_Decoder_DecodeBufferToMesh_2( - self, - in_buffer, - out_mesh, - ), - Status, - ); - }; - Decoder.prototype["__destroy__"] = Decoder.prototype.__destroy__ = - function () { - var self = this.ptr; - _emscripten_bind_Decoder___destroy___0(self); - }; - (() => { - function setupEnums() { - Module["ATTRIBUTE_INVALID_TRANSFORM"] = - _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM(); - Module["ATTRIBUTE_NO_TRANSFORM"] = - _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM(); - Module["ATTRIBUTE_QUANTIZATION_TRANSFORM"] = - _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM(); - Module["ATTRIBUTE_OCTAHEDRON_TRANSFORM"] = - _emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM(); - Module["INVALID"] = - _emscripten_enum_draco_GeometryAttribute_Type_INVALID(); - Module["POSITION"] = - _emscripten_enum_draco_GeometryAttribute_Type_POSITION(); - Module["NORMAL"] = - _emscripten_enum_draco_GeometryAttribute_Type_NORMAL(); - Module["COLOR"] = _emscripten_enum_draco_GeometryAttribute_Type_COLOR(); - Module["TEX_COORD"] = - _emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD(); - Module["GENERIC"] = - _emscripten_enum_draco_GeometryAttribute_Type_GENERIC(); - Module["INVALID_GEOMETRY_TYPE"] = - _emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE(); - Module["POINT_CLOUD"] = - _emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD(); - Module["TRIANGULAR_MESH"] = - _emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH(); - Module["DT_INVALID"] = _emscripten_enum_draco_DataType_DT_INVALID(); - Module["DT_INT8"] = _emscripten_enum_draco_DataType_DT_INT8(); - Module["DT_UINT8"] = _emscripten_enum_draco_DataType_DT_UINT8(); - Module["DT_INT16"] = _emscripten_enum_draco_DataType_DT_INT16(); - Module["DT_UINT16"] = _emscripten_enum_draco_DataType_DT_UINT16(); - Module["DT_INT32"] = _emscripten_enum_draco_DataType_DT_INT32(); - Module["DT_UINT32"] = _emscripten_enum_draco_DataType_DT_UINT32(); - Module["DT_INT64"] = _emscripten_enum_draco_DataType_DT_INT64(); - Module["DT_UINT64"] = _emscripten_enum_draco_DataType_DT_UINT64(); - Module["DT_FLOAT32"] = _emscripten_enum_draco_DataType_DT_FLOAT32(); - Module["DT_FLOAT64"] = _emscripten_enum_draco_DataType_DT_FLOAT64(); - Module["DT_BOOL"] = _emscripten_enum_draco_DataType_DT_BOOL(); - Module["DT_TYPES_COUNT"] = - _emscripten_enum_draco_DataType_DT_TYPES_COUNT(); - Module["OK"] = _emscripten_enum_draco_StatusCode_OK(); - Module["DRACO_ERROR"] = _emscripten_enum_draco_StatusCode_DRACO_ERROR(); - Module["IO_ERROR"] = _emscripten_enum_draco_StatusCode_IO_ERROR(); - Module["INVALID_PARAMETER"] = - _emscripten_enum_draco_StatusCode_INVALID_PARAMETER(); - Module["UNSUPPORTED_VERSION"] = - _emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION(); - Module["UNKNOWN_VERSION"] = - _emscripten_enum_draco_StatusCode_UNKNOWN_VERSION(); - } - if (runtimeInitialized) setupEnums(); - else addOnInit(setupEnums); - })(); - if (typeof Module["onModuleParsed"] === "function") { - Module["onModuleParsed"](); - } - Module["Decoder"].prototype.GetEncodedGeometryType = (array) => { - if (array.__class__ && array.__class__ === Module.DecoderBuffer) { - return Module.Decoder.prototype.GetEncodedGeometryType_Deprecated( - array, - ); - } - if (array.byteLength < 8) return Module.INVALID_GEOMETRY_TYPE; - switch (array[7]) { - case 0: - return Module.POINT_CLOUD; - case 1: - return Module.TRIANGULAR_MESH; - default: - return Module.INVALID_GEOMETRY_TYPE; - } - }; - - return DracoDecoderModule.ready; - }; -})(); -if (typeof exports === "object" && typeof module === "object") - module.exports = DracoDecoderModule; -else if (typeof define === "function" && define["amd"]) - define([], () => DracoDecoderModule); -else if (typeof exports === "object") - exports["DracoDecoderModule"] = DracoDecoderModule; diff --git a/plugins/plugin-companion/public/vrm-decoders/draco/draco_decoder.wasm b/plugins/plugin-companion/public/vrm-decoders/draco/draco_decoder.wasm deleted file mode 100644 index 469904ebcb7b8..0000000000000 Binary files a/plugins/plugin-companion/public/vrm-decoders/draco/draco_decoder.wasm and /dev/null differ diff --git a/plugins/plugin-companion/public/vrm-decoders/draco/draco_wasm_wrapper.js b/plugins/plugin-companion/public/vrm-decoders/draco/draco_wasm_wrapper.js deleted file mode 100644 index 5b6a12c26b94a..0000000000000 --- a/plugins/plugin-companion/public/vrm-decoders/draco/draco_wasm_wrapper.js +++ /dev/null @@ -1,2474 +0,0 @@ -var $jscomp = $jscomp || {}; -$jscomp.scope = {}; -$jscomp.arrayIteratorImpl = (h) => { - var n = 0; - return () => (n < h.length ? { done: !1, value: h[n++] } : { done: !0 }); -}; -$jscomp.arrayIterator = (h) => ({ next: $jscomp.arrayIteratorImpl(h) }); -$jscomp.makeIterator = (h) => { - var n = "undefined" != typeof Symbol && Symbol.iterator && h[Symbol.iterator]; - return n ? n.call(h) : $jscomp.arrayIterator(h); -}; -$jscomp.ASSUME_ES5 = !1; -$jscomp.ASSUME_NO_NATIVE_MAP = !1; -$jscomp.ASSUME_NO_NATIVE_SET = !1; -$jscomp.SIMPLE_FROUND_POLYFILL = !1; -$jscomp.ISOLATE_POLYFILLS = !1; -$jscomp.FORCE_POLYFILL_PROMISE = !1; -$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION = !1; -$jscomp.getGlobal = (h) => { - h = [ - "object" == typeof globalThis && globalThis, - h, - "object" == typeof window && window, - "object" == typeof self && self, - "object" == typeof global && global, - ]; - for (var n = 0; n < h.length; ++n) { - var k = h[n]; - if (k && k.Math == Math) return k; - } - throw Error("Cannot find global object"); -}; -$jscomp.global = $jscomp.getGlobal(this); -$jscomp.defineProperty = - $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties - ? Object.defineProperty - : (h, n, k) => { - if (h == Array.prototype || h == Object.prototype) return h; - h[n] = k.value; - return h; - }; -$jscomp.IS_SYMBOL_NATIVE = - "function" === typeof Symbol && "symbol" === typeof Symbol("x"); -$jscomp.TRUST_ES6_POLYFILLS = - !$jscomp.ISOLATE_POLYFILLS || $jscomp.IS_SYMBOL_NATIVE; -$jscomp.polyfills = {}; -$jscomp.propertyToPolyfillSymbol = {}; -$jscomp.POLYFILL_PREFIX = "$jscp$"; -var $jscomp$lookupPolyfilledValue = (h, n) => { - var k = $jscomp.propertyToPolyfillSymbol[n]; - if (null == k) return h[n]; - k = h[k]; - return void 0 !== k ? k : h[n]; -}; -$jscomp.polyfill = (h, n, k, p) => { - n && - ($jscomp.ISOLATE_POLYFILLS - ? $jscomp.polyfillIsolated(h, n, k, p) - : $jscomp.polyfillUnisolated(h, n, k, p)); -}; -$jscomp.polyfillUnisolated = (h, n, k, p) => { - k = $jscomp.global; - h = h.split("."); - for (p = 0; p < h.length - 1; p++) { - var l = h[p]; - if (!(l in k)) return; - k = k[l]; - } - h = h[h.length - 1]; - p = k[h]; - n = n(p); - n != p && - null != n && - $jscomp.defineProperty(k, h, { configurable: !0, writable: !0, value: n }); -}; -$jscomp.polyfillIsolated = (h, n, k, p) => { - var l = h.split("."); - h = 1 === l.length; - p = l[0]; - p = !h && p in $jscomp.polyfills ? $jscomp.polyfills : $jscomp.global; - for (var y = 0; y < l.length - 1; y++) { - var f = l[y]; - if (!(f in p)) return; - p = p[f]; - } - l = l[l.length - 1]; - k = $jscomp.IS_SYMBOL_NATIVE && "es6" === k ? p[l] : null; - n = n(k); - null != n && - (h - ? $jscomp.defineProperty($jscomp.polyfills, l, { - configurable: !0, - writable: !0, - value: n, - }) - : n !== k && - (void 0 === $jscomp.propertyToPolyfillSymbol[l] && - ((k = (1e9 * Math.random()) >>> 0), - ($jscomp.propertyToPolyfillSymbol[l] = $jscomp.IS_SYMBOL_NATIVE - ? $jscomp.global.Symbol(l) - : $jscomp.POLYFILL_PREFIX + k + "$" + l)), - $jscomp.defineProperty(p, $jscomp.propertyToPolyfillSymbol[l], { - configurable: !0, - writable: !0, - value: n, - }))); -}; -$jscomp.polyfill( - "Promise", - (h) => { - function n() { - this.batch_ = null; - } - function k(f) { - return f instanceof l - ? f - : new l((q, u) => { - q(f); - }); - } - if ( - h && - (!( - $jscomp.FORCE_POLYFILL_PROMISE || - ($jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION && - "undefined" === typeof $jscomp.global.PromiseRejectionEvent) - ) || - !$jscomp.global.Promise || - -1 === $jscomp.global.Promise.toString().indexOf("[native code]")) - ) - return h; - n.prototype.asyncExecute = function (f) { - if (null == this.batch_) { - this.batch_ = []; - - this.asyncExecuteFunction(() => { - this.executeBatch_(); - }); - } - this.batch_.push(f); - }; - var p = $jscomp.global.setTimeout; - n.prototype.asyncExecuteFunction = (f) => { - p(f, 0); - }; - n.prototype.executeBatch_ = function () { - for (; this.batch_ && this.batch_.length; ) { - var f = this.batch_; - this.batch_ = []; - for (var q = 0; q < f.length; ++q) { - var u = f[q]; - f[q] = null; - try { - u(); - } catch (A) { - this.asyncThrow_(A); - } - } - } - this.batch_ = null; - }; - n.prototype.asyncThrow_ = function (f) { - this.asyncExecuteFunction(() => { - throw f; - }); - }; - var l = function (f) { - this.state_ = 0; - this.result_ = void 0; - this.onSettledCallbacks_ = []; - this.isRejectionHandled_ = !1; - var q = this.createResolveAndReject_(); - try { - f(q.resolve, q.reject); - } catch (u) { - q.reject(u); - } - }; - l.prototype.createResolveAndReject_ = function () { - function f(A) { - return (F) => { - u || ((u = !0), A.call(q, F)); - }; - } - var q = this, - u = !1; - return { resolve: f(this.resolveTo_), reject: f(this.reject_) }; - }; - l.prototype.resolveTo_ = function (f) { - if (f === this) - this.reject_(new TypeError("A Promise cannot resolve to itself")); - else if (f instanceof l) this.settleSameAsPromise_(f); - else { - switch (typeof f) { - case "object": { - var q = null != f; - break; - } - case "function": - q = !0; - break; - default: - q = !1; - } - q ? this.resolveToNonPromiseObj_(f) : this.fulfill_(f); - } - }; - l.prototype.resolveToNonPromiseObj_ = function (f) { - var q = void 0; - try { - q = f.then; - } catch (u) { - this.reject_(u); - return; - } - "function" == typeof q - ? this.settleSameAsThenable_(q, f) - : this.fulfill_(f); - }; - l.prototype.reject_ = function (f) { - this.settle_(2, f); - }; - l.prototype.fulfill_ = function (f) { - this.settle_(1, f); - }; - l.prototype.settle_ = function (f, q) { - if (0 != this.state_) - throw Error( - "Cannot settle(" + - f + - ", " + - q + - "): Promise already settled in state" + - this.state_, - ); - this.state_ = f; - this.result_ = q; - 2 === this.state_ && this.scheduleUnhandledRejectionCheck_(); - this.executeOnSettledCallbacks_(); - }; - l.prototype.scheduleUnhandledRejectionCheck_ = function () { - p(() => { - if (this.notifyUnhandledRejection_()) { - var q = $jscomp.global.console; - "undefined" !== typeof q && q.error(this.result_); - } - }, 1); - }; - l.prototype.notifyUnhandledRejection_ = function () { - if (this.isRejectionHandled_) return !1; - var f = $jscomp.global.CustomEvent, - q = $jscomp.global.Event, - u = $jscomp.global.dispatchEvent; - if ("undefined" === typeof u) return !0; - "function" === typeof f - ? (f = new f("unhandledrejection", { cancelable: !0 })) - : "function" === typeof q - ? (f = new q("unhandledrejection", { cancelable: !0 })) - : ((f = $jscomp.global.document.createEvent("CustomEvent")), - f.initCustomEvent("unhandledrejection", !1, !0, f)); - f.promise = this; - f.reason = this.result_; - return u(f); - }; - l.prototype.executeOnSettledCallbacks_ = function () { - if (null != this.onSettledCallbacks_) { - for (var f = 0; f < this.onSettledCallbacks_.length; ++f) - y.asyncExecute(this.onSettledCallbacks_[f]); - this.onSettledCallbacks_ = null; - } - }; - var y = new n(); - l.prototype.settleSameAsPromise_ = function (f) { - var q = this.createResolveAndReject_(); - f.callWhenSettled_(q.resolve, q.reject); - }; - l.prototype.settleSameAsThenable_ = function (f, q) { - var u = this.createResolveAndReject_(); - try { - f.call(q, u.resolve, u.reject); - } catch (A) { - u.reject(A); - } - }; - l.prototype.then = function (f, q) { - function u(w, B) { - return "function" == typeof w - ? (R) => { - try { - A(w(R)); - } catch (Z) { - F(Z); - } - } - : B; - } - var A, - F, - v = new l((w, B) => { - A = w; - F = B; - }); - this.callWhenSettled_(u(f, A), u(q, F)); - return v; - }; - l.prototype.catch = function (f) { - return this.then(void 0, f); - }; - l.prototype.callWhenSettled_ = function (f, q) { - function u() { - switch (A.state_) { - case 1: - f(A.result_); - break; - case 2: - q(A.result_); - break; - default: - throw Error("Unexpected state: " + A.state_); - } - } - var A = this; - null == this.onSettledCallbacks_ - ? y.asyncExecute(u) - : this.onSettledCallbacks_.push(u); - this.isRejectionHandled_ = !0; - }; - l.resolve = k; - l.reject = (f) => - new l((q, u) => { - u(f); - }); - l.race = (f) => - new l((q, u) => { - for ( - var A = $jscomp.makeIterator(f), F = A.next(); - !F.done; - F = A.next() - ) - k(F.value).callWhenSettled_(q, u); - }); - l.all = (f) => { - var q = $jscomp.makeIterator(f), - u = q.next(); - return u.done - ? k([]) - : new l((A, F) => { - function v(R) { - return (Z) => { - w[R] = Z; - B--; - 0 == B && A(w); - }; - } - var w = [], - B = 0; - do - w.push(void 0), - B++, - k(u.value).callWhenSettled_(v(w.length - 1), F), - (u = q.next()); - while (!u.done); - }); - }; - return l; - }, - "es6", - "es3", -); -$jscomp.owns = (h, n) => Object.hasOwn(h, n); -$jscomp.assign = - $jscomp.TRUST_ES6_POLYFILLS && "function" == typeof Object.assign - ? Object.assign - : function (h, n) { - for (var k = 1; k < arguments.length; k++) { - var p = arguments[k]; - if (p) for (var l in p) $jscomp.owns(p, l) && (h[l] = p[l]); - } - return h; - }; -$jscomp.polyfill("Object.assign", (h) => h || $jscomp.assign, "es6", "es3"); -$jscomp.checkStringArgs = (h, n, k) => { - if (null == h) - throw new TypeError( - "The 'this' value for String.prototype." + - k + - " must not be null or undefined", - ); - if (n instanceof RegExp) - throw new TypeError( - "First argument to String.prototype." + - k + - " must not be a regular expression", - ); - return h + ""; -}; -$jscomp.polyfill( - "String.prototype.startsWith", - (h) => - h - ? h - : function (n, k) { - var p = $jscomp.checkStringArgs(this, n, "startsWith"); - n += ""; - var l = p.length, - y = n.length; - k = Math.max(0, Math.min(k | 0, p.length)); - for (var f = 0; f < y && k < l; ) if (p[k++] != n[f++]) return !1; - return f >= y; - }, - "es6", - "es3", -); -$jscomp.polyfill( - "Array.prototype.copyWithin", - (h) => { - function n(k) { - k = Number(k); - return Infinity === k || -Infinity === k ? k : k | 0; - } - return h - ? h - : function (k, p, l) { - var y = this.length; - k = n(k); - p = n(p); - l = void 0 === l ? y : n(l); - k = 0 > k ? Math.max(y + k, 0) : Math.min(k, y); - p = 0 > p ? Math.max(y + p, 0) : Math.min(p, y); - l = 0 > l ? Math.max(y + l, 0) : Math.min(l, y); - if (k < p) - for (; p < l; ) - p in this ? (this[k++] = this[p++]) : (delete this[k++], p++); - else - for (l = Math.min(l, y + p - k), k += l - p; l > p; ) - --l in this ? (this[--k] = this[l]) : delete this[--k]; - return this; - }; - }, - "es6", - "es3", -); -$jscomp.typedArrayCopyWithin = (h) => (h ? h : Array.prototype.copyWithin); -$jscomp.polyfill( - "Int8Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Uint8Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Uint8ClampedArray.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Int16Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Uint16Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Int32Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Uint32Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Float32Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -$jscomp.polyfill( - "Float64Array.prototype.copyWithin", - $jscomp.typedArrayCopyWithin, - "es6", - "es5", -); -var DracoDecoderModule = (() => { - var h = - "undefined" !== typeof document && document.currentScript - ? document.currentScript.src - : void 0; - "undefined" !== typeof __filename && (h = h || __filename); - return (n) => { - function k(e) { - return a.locateFile ? a.locateFile(e, U) : U + e; - } - function p(e, b) { - if (e) { - var c = ia; - var d = e + b; - for (b = e; c[b] && !(b >= d); ) ++b; - if (16 < b - e && c.buffer && ra) c = ra.decode(c.subarray(e, b)); - else { - for (d = ""; e < b; ) { - var g = c[e++]; - if (g & 128) { - var t = c[e++] & 63; - if (192 == (g & 224)) - d += String.fromCharCode(((g & 31) << 6) | t); - else { - var aa = c[e++] & 63; - g = - 224 == (g & 240) - ? ((g & 15) << 12) | (t << 6) | aa - : ((g & 7) << 18) | (t << 12) | (aa << 6) | (c[e++] & 63); - 65536 > g - ? (d += String.fromCharCode(g)) - : ((g -= 65536), - (d += String.fromCharCode( - 55296 | (g >> 10), - 56320 | (g & 1023), - ))); - } - } else d += String.fromCharCode(g); - } - c = d; - } - } else c = ""; - return c; - } - function l() { - var e = ja.buffer; - a.HEAP8 = W = new Int8Array(e); - a.HEAP16 = new Int16Array(e); - a.HEAP32 = ca = new Int32Array(e); - a.HEAPU8 = ia = new Uint8Array(e); - a.HEAPU16 = new Uint16Array(e); - a.HEAPU32 = Y = new Uint32Array(e); - a.HEAPF32 = new Float32Array(e); - a.HEAPF64 = new Float64Array(e); - } - function y(e) { - if (a.onAbort) a.onAbort(e); - e = "Aborted(" + e + ")"; - da(e); - sa = !0; - e = new WebAssembly.RuntimeError( - e + ". Build with -sASSERTIONS for more info.", - ); - ka(e); - throw e; - } - function f(e) { - try { - if (e == P && ea) return new Uint8Array(ea); - if (ma) return ma(e); - throw "both async and sync fetching of the wasm failed"; - } catch (b) { - y(b); - } - } - function q() { - if (!ea && (ta || fa)) { - if ("function" == typeof fetch && !P.startsWith("file://")) - return fetch(P, { credentials: "same-origin" }) - .then((e) => { - if (!e.ok) throw "failed to load wasm binary file at '" + P + "'"; - return e.arrayBuffer(); - }) - .catch(() => f(P)); - if (na) - return new Promise((e, b) => { - na( - P, - (c) => { - e(new Uint8Array(c)); - }, - b, - ); - }); - } - return Promise.resolve().then(() => f(P)); - } - function u(e) { - for (; 0 < e.length; ) e.shift()(a); - } - function A(e) { - this.excPtr = e; - this.ptr = e - 24; - this.set_type = function (b) { - Y[(this.ptr + 4) >> 2] = b; - }; - this.get_type = function () { - return Y[(this.ptr + 4) >> 2]; - }; - this.set_destructor = function (b) { - Y[(this.ptr + 8) >> 2] = b; - }; - this.get_destructor = function () { - return Y[(this.ptr + 8) >> 2]; - }; - this.set_refcount = function (b) { - ca[this.ptr >> 2] = b; - }; - this.set_caught = function (b) { - W[(this.ptr + 12) >> 0] = b ? 1 : 0; - }; - this.get_caught = function () { - return 0 != W[(this.ptr + 12) >> 0]; - }; - this.set_rethrown = function (b) { - W[(this.ptr + 13) >> 0] = b ? 1 : 0; - }; - this.get_rethrown = function () { - return 0 != W[(this.ptr + 13) >> 0]; - }; - this.init = function (b, c) { - this.set_adjusted_ptr(0); - this.set_type(b); - this.set_destructor(c); - this.set_refcount(0); - this.set_caught(!1); - this.set_rethrown(!1); - }; - this.add_ref = function () { - ca[this.ptr >> 2] += 1; - }; - this.release_ref = function () { - var b = ca[this.ptr >> 2]; - ca[this.ptr >> 2] = b - 1; - return 1 === b; - }; - this.set_adjusted_ptr = function (b) { - Y[(this.ptr + 16) >> 2] = b; - }; - this.get_adjusted_ptr = function () { - return Y[(this.ptr + 16) >> 2]; - }; - this.get_exception_ptr = function () { - if (ua(this.get_type())) return Y[this.excPtr >> 2]; - var b = this.get_adjusted_ptr(); - return 0 !== b ? b : this.excPtr; - }; - } - function F() { - function e() { - if (!la && ((la = !0), (a.calledRun = !0), !sa)) { - va = !0; - u(oa); - wa(a); - if (a.onRuntimeInitialized) a.onRuntimeInitialized(); - if (a.postRun) - for ( - "function" == typeof a.postRun && (a.postRun = [a.postRun]); - a.postRun.length; - ) - xa.unshift(a.postRun.shift()); - u(xa); - } - } - if (!(0 < ba)) { - if (a.preRun) - for ( - "function" == typeof a.preRun && (a.preRun = [a.preRun]); - a.preRun.length; - ) - ya.unshift(a.preRun.shift()); - u(ya); - 0 < ba || - (a.setStatus - ? (a.setStatus("Running..."), - setTimeout(() => { - setTimeout(() => { - a.setStatus(""); - }, 1); - e(); - }, 1)) - : e()); - } - } - function v() {} - function w(e) { - return (e || v).__cache__; - } - function B(e, b) { - var c = w(b), - d = c[e]; - if (d) return d; - d = Object.create((b || v).prototype); - d.ptr = e; - return (c[e] = d); - } - function R(e) { - if ("string" === typeof e) { - for (var b = 0, c = 0; c < e.length; ++c) { - var d = e.charCodeAt(c); - 127 >= d - ? b++ - : 2047 >= d - ? (b += 2) - : 55296 <= d && 57343 >= d - ? ((b += 4), ++c) - : (b += 3); - } - b = Array(b + 1); - c = 0; - d = b.length; - if (0 < d) { - d = c + d - 1; - for (var g = 0; g < e.length; ++g) { - var t = e.charCodeAt(g); - if (55296 <= t && 57343 >= t) { - var aa = e.charCodeAt(++g); - t = (65536 + ((t & 1023) << 10)) | (aa & 1023); - } - if (127 >= t) { - if (c >= d) break; - b[c++] = t; - } else { - if (2047 >= t) { - if (c + 1 >= d) break; - b[c++] = 192 | (t >> 6); - } else { - if (65535 >= t) { - if (c + 2 >= d) break; - b[c++] = 224 | (t >> 12); - } else { - if (c + 3 >= d) break; - b[c++] = 240 | (t >> 18); - b[c++] = 128 | ((t >> 12) & 63); - } - b[c++] = 128 | ((t >> 6) & 63); - } - b[c++] = 128 | (t & 63); - } - } - b[c] = 0; - } - e = r.alloc(b, W); - r.copy(b, W, e); - return e; - } - return e; - } - function Z(e) { - if ("object" === typeof e) { - var b = r.alloc(e, W); - r.copy(e, W, b); - return b; - } - return e; - } - function X() { - throw "cannot construct a VoidPtr, no constructor in IDL"; - } - function S() { - this.ptr = za(); - w(S)[this.ptr] = this; - } - function Q() { - this.ptr = Aa(); - w(Q)[this.ptr] = this; - } - function V() { - this.ptr = Ba(); - w(V)[this.ptr] = this; - } - function x() { - this.ptr = Ca(); - w(x)[this.ptr] = this; - } - function D() { - this.ptr = Da(); - w(D)[this.ptr] = this; - } - function G() { - this.ptr = Ea(); - w(G)[this.ptr] = this; - } - function H() { - this.ptr = Fa(); - w(H)[this.ptr] = this; - } - function E() { - this.ptr = Ga(); - w(E)[this.ptr] = this; - } - function T() { - this.ptr = Ha(); - w(T)[this.ptr] = this; - } - function C() { - throw "cannot construct a Status, no constructor in IDL"; - } - function I() { - this.ptr = Ia(); - w(I)[this.ptr] = this; - } - function J() { - this.ptr = Ja(); - w(J)[this.ptr] = this; - } - function K() { - this.ptr = Ka(); - w(K)[this.ptr] = this; - } - function L() { - this.ptr = La(); - w(L)[this.ptr] = this; - } - function M() { - this.ptr = Ma(); - w(M)[this.ptr] = this; - } - function N() { - this.ptr = Na(); - w(N)[this.ptr] = this; - } - function O() { - this.ptr = Oa(); - w(O)[this.ptr] = this; - } - function z() { - this.ptr = Pa(); - w(z)[this.ptr] = this; - } - function m() { - this.ptr = Qa(); - w(m)[this.ptr] = this; - } - n = void 0 === n ? {} : n; - var a = "undefined" != typeof n ? n : {}, - wa, - ka; - a.ready = new Promise((e, b) => { - wa = e; - ka = b; - }); - var Ra = !1, - Sa = !1; - a.onRuntimeInitialized = () => { - Ra = !0; - if (Sa && "function" === typeof a.onModuleLoaded) a.onModuleLoaded(a); - }; - a.onModuleParsed = () => { - Sa = !0; - if (Ra && "function" === typeof a.onModuleLoaded) a.onModuleLoaded(a); - }; - a.isVersionSupported = (e) => { - if ("string" !== typeof e) return !1; - e = e.split("."); - return 2 > e.length || 3 < e.length - ? !1 - : 1 == e[0] && 0 <= e[1] && 5 >= e[1] - ? !0 - : 0 != e[0] || 10 < e[1] - ? !1 - : !0; - }; - var Ta = Object.assign({}, a), - ta = "object" == typeof window, - fa = "function" == typeof importScripts, - Ua = - "object" == typeof process && - "object" == typeof process.versions && - "string" == typeof process.versions.node, - U = ""; - if (Ua) { - var Va = require("fs"), - pa = require("path"); - U = fa ? pa.dirname(U) + "/" : __dirname + "/"; - var Wa = (e, b) => { - e = e.startsWith("file://") ? new URL(e) : pa.normalize(e); - return Va.readFileSync(e, b ? void 0 : "utf8"); - }; - var ma = (e) => { - e = Wa(e, !0); - e.buffer || (e = new Uint8Array(e)); - return e; - }; - var na = (e, b, c) => { - e = e.startsWith("file://") ? new URL(e) : pa.normalize(e); - Va.readFile(e, (d, g) => { - d ? c(d) : b(g.buffer); - }); - }; - 1 < process.argv.length && process.argv[1].replace(/\\/g, "/"); - process.argv.slice(2); - a.inspect = () => "[Emscripten Module object]"; - } else if (ta || fa) - fa - ? (U = self.location.href) - : "undefined" != typeof document && - document.currentScript && - (U = document.currentScript.src), - h && (U = h), - (U = - 0 !== U.indexOf("blob:") - ? U.substr(0, U.replace(/[?#].*/, "").lastIndexOf("/") + 1) - : ""), - (Wa = (e) => { - var b = new XMLHttpRequest(); - b.open("GET", e, !1); - b.send(null); - return b.responseText; - }), - fa && - (ma = (e) => { - var b = new XMLHttpRequest(); - b.open("GET", e, !1); - b.responseType = "arraybuffer"; - b.send(null); - return new Uint8Array(b.response); - }), - (na = (e, b, c) => { - var d = new XMLHttpRequest(); - d.open("GET", e, !0); - d.responseType = "arraybuffer"; - d.onload = () => { - 200 == d.status || (0 == d.status && d.response) - ? b(d.response) - : c(); - }; - d.onerror = c; - d.send(null); - }); - a.print || console.log.bind(console); - var da = a.printErr || console.warn.bind(console); - Object.assign(a, Ta); - Ta = null; - var ea; - a.wasmBinary && (ea = a.wasmBinary); - "object" != typeof WebAssembly && y("no native wasm support detected"); - var ja, - sa = !1, - ra = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, - W, - ia, - ca, - Y, - ya = [], - oa = [], - xa = [], - va = !1, - ba = 0, - qa = null, - ha = null; - var P = "draco_decoder_gltf.wasm"; - P.startsWith("data:application/octet-stream;base64,") || (P = k(P)); - var pd = 0, - qd = { - b: (e, b, c) => { - new A(e).init(b, c); - pd++; - throw e; - }, - a: () => { - y(""); - }, - d: (e, b, c) => { - ia.copyWithin(e, b, b + c); - }, - c: (e) => { - var b = ia.length; - e >>>= 0; - if (2147483648 < e) return !1; - for (var c = 1; 4 >= c; c *= 2) { - var d = b * (1 + 0.2 / c); - d = Math.min(d, e + 100663296); - var g = Math; - d = Math.max(e, d); - g = g.min.call(g, 2147483648, d + ((65536 - (d % 65536)) % 65536)); - a: { - d = ja.buffer; - try { - ja.grow((g - d.byteLength + 65535) >>> 16); - l(); - var t = 1; - break a; - } catch (aa) {} - t = void 0; - } - if (t) return !0; - } - return !1; - }, - }; - (() => { - function e(g, t) { - a.asm = g.exports; - ja = a.asm.e; - l(); - oa.unshift(a.asm.f); - ba--; - a.monitorRunDependencies && a.monitorRunDependencies(ba); - 0 == ba && - (null !== qa && (clearInterval(qa), (qa = null)), - ha && ((g = ha), (ha = null), g())); - } - function b(g) { - e(g.instance); - } - function c(g) { - return q() - .then((t) => WebAssembly.instantiate(t, d)) - .then((t) => t) - .then(g, (t) => { - da("failed to asynchronously prepare wasm: " + t); - y(t); - }); - } - var d = { a: qd }; - ba++; - a.monitorRunDependencies && a.monitorRunDependencies(ba); - if (a.instantiateWasm) - try { - return a.instantiateWasm(d, e); - } catch (g) { - da("Module.instantiateWasm callback failed with error: " + g), ka(g); - } - (() => - ea || - "function" != typeof WebAssembly.instantiateStreaming || - P.startsWith("data:application/octet-stream;base64,") || - P.startsWith("file://") || - Ua || - "function" != typeof fetch - ? c(b) - : fetch(P, { credentials: "same-origin" }).then((g) => - WebAssembly.instantiateStreaming(g, d).then(b, (t) => { - da("wasm streaming compile failed: " + t); - da("falling back to ArrayBuffer instantiation"); - return c(b); - }), - ))().catch(ka); - return {}; - })(); - var Xa = (a._emscripten_bind_VoidPtr___destroy___0 = function () { - return (Xa = a._emscripten_bind_VoidPtr___destroy___0 = a.asm.h).apply( - null, - arguments, - ); - }), - za = (a._emscripten_bind_DecoderBuffer_DecoderBuffer_0 = function () { - return (za = a._emscripten_bind_DecoderBuffer_DecoderBuffer_0 = - a.asm.i).apply(null, arguments); - }), - Ya = (a._emscripten_bind_DecoderBuffer_Init_2 = function () { - return (Ya = a._emscripten_bind_DecoderBuffer_Init_2 = a.asm.j).apply( - null, - arguments, - ); - }), - Za = (a._emscripten_bind_DecoderBuffer___destroy___0 = function () { - return (Za = a._emscripten_bind_DecoderBuffer___destroy___0 = - a.asm.k).apply(null, arguments); - }), - Aa = (a._emscripten_bind_AttributeTransformData_AttributeTransformData_0 = - function () { - return (Aa = - a._emscripten_bind_AttributeTransformData_AttributeTransformData_0 = - a.asm.l).apply(null, arguments); - }), - $a = (a._emscripten_bind_AttributeTransformData_transform_type_0 = - function () { - return ($a = - a._emscripten_bind_AttributeTransformData_transform_type_0 = - a.asm.m).apply(null, arguments); - }), - ab = (a._emscripten_bind_AttributeTransformData___destroy___0 = - function () { - return (ab = a._emscripten_bind_AttributeTransformData___destroy___0 = - a.asm.n).apply(null, arguments); - }), - Ba = (a._emscripten_bind_GeometryAttribute_GeometryAttribute_0 = - function () { - return (Ba = - a._emscripten_bind_GeometryAttribute_GeometryAttribute_0 = - a.asm.o).apply(null, arguments); - }), - bb = (a._emscripten_bind_GeometryAttribute___destroy___0 = function () { - return (bb = a._emscripten_bind_GeometryAttribute___destroy___0 = - a.asm.p).apply(null, arguments); - }), - Ca = (a._emscripten_bind_PointAttribute_PointAttribute_0 = function () { - return (Ca = a._emscripten_bind_PointAttribute_PointAttribute_0 = - a.asm.q).apply(null, arguments); - }), - cb = (a._emscripten_bind_PointAttribute_size_0 = function () { - return (cb = a._emscripten_bind_PointAttribute_size_0 = a.asm.r).apply( - null, - arguments, - ); - }), - db = (a._emscripten_bind_PointAttribute_GetAttributeTransformData_0 = - function () { - return (db = - a._emscripten_bind_PointAttribute_GetAttributeTransformData_0 = - a.asm.s).apply(null, arguments); - }), - eb = (a._emscripten_bind_PointAttribute_attribute_type_0 = function () { - return (eb = a._emscripten_bind_PointAttribute_attribute_type_0 = - a.asm.t).apply(null, arguments); - }), - fb = (a._emscripten_bind_PointAttribute_data_type_0 = function () { - return (fb = a._emscripten_bind_PointAttribute_data_type_0 = - a.asm.u).apply(null, arguments); - }), - gb = (a._emscripten_bind_PointAttribute_num_components_0 = function () { - return (gb = a._emscripten_bind_PointAttribute_num_components_0 = - a.asm.v).apply(null, arguments); - }), - hb = (a._emscripten_bind_PointAttribute_normalized_0 = function () { - return (hb = a._emscripten_bind_PointAttribute_normalized_0 = - a.asm.w).apply(null, arguments); - }), - ib = (a._emscripten_bind_PointAttribute_byte_stride_0 = function () { - return (ib = a._emscripten_bind_PointAttribute_byte_stride_0 = - a.asm.x).apply(null, arguments); - }), - jb = (a._emscripten_bind_PointAttribute_byte_offset_0 = function () { - return (jb = a._emscripten_bind_PointAttribute_byte_offset_0 = - a.asm.y).apply(null, arguments); - }), - kb = (a._emscripten_bind_PointAttribute_unique_id_0 = function () { - return (kb = a._emscripten_bind_PointAttribute_unique_id_0 = - a.asm.z).apply(null, arguments); - }), - lb = (a._emscripten_bind_PointAttribute___destroy___0 = function () { - return (lb = a._emscripten_bind_PointAttribute___destroy___0 = - a.asm.A).apply(null, arguments); - }), - Da = - (a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0 = - function () { - return (Da = - a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0 = - a.asm.B).apply(null, arguments); - }), - mb = - (a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1 = - function () { - return (mb = - a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1 = - a.asm.C).apply(null, arguments); - }), - nb = - (a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0 = - function () { - return (nb = - a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0 = - a.asm.D).apply(null, arguments); - }), - ob = (a._emscripten_bind_AttributeQuantizationTransform_min_value_1 = - function () { - return (ob = - a._emscripten_bind_AttributeQuantizationTransform_min_value_1 = - a.asm.E).apply(null, arguments); - }), - pb = (a._emscripten_bind_AttributeQuantizationTransform_range_0 = - function () { - return (pb = - a._emscripten_bind_AttributeQuantizationTransform_range_0 = - a.asm.F).apply(null, arguments); - }), - qb = (a._emscripten_bind_AttributeQuantizationTransform___destroy___0 = - function () { - return (qb = - a._emscripten_bind_AttributeQuantizationTransform___destroy___0 = - a.asm.G).apply(null, arguments); - }), - Ea = - (a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0 = - function () { - return (Ea = - a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0 = - a.asm.H).apply(null, arguments); - }), - rb = - (a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1 = - function () { - return (rb = - a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1 = - a.asm.I).apply(null, arguments); - }), - sb = - (a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0 = - function () { - return (sb = - a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0 = - a.asm.J).apply(null, arguments); - }), - tb = (a._emscripten_bind_AttributeOctahedronTransform___destroy___0 = - function () { - return (tb = - a._emscripten_bind_AttributeOctahedronTransform___destroy___0 = - a.asm.K).apply(null, arguments); - }), - Fa = (a._emscripten_bind_PointCloud_PointCloud_0 = function () { - return (Fa = a._emscripten_bind_PointCloud_PointCloud_0 = - a.asm.L).apply(null, arguments); - }), - ub = (a._emscripten_bind_PointCloud_num_attributes_0 = function () { - return (ub = a._emscripten_bind_PointCloud_num_attributes_0 = - a.asm.M).apply(null, arguments); - }), - vb = (a._emscripten_bind_PointCloud_num_points_0 = function () { - return (vb = a._emscripten_bind_PointCloud_num_points_0 = - a.asm.N).apply(null, arguments); - }), - wb = (a._emscripten_bind_PointCloud___destroy___0 = function () { - return (wb = a._emscripten_bind_PointCloud___destroy___0 = - a.asm.O).apply(null, arguments); - }), - Ga = (a._emscripten_bind_Mesh_Mesh_0 = function () { - return (Ga = a._emscripten_bind_Mesh_Mesh_0 = a.asm.P).apply( - null, - arguments, - ); - }), - xb = (a._emscripten_bind_Mesh_num_faces_0 = function () { - return (xb = a._emscripten_bind_Mesh_num_faces_0 = a.asm.Q).apply( - null, - arguments, - ); - }), - yb = (a._emscripten_bind_Mesh_num_attributes_0 = function () { - return (yb = a._emscripten_bind_Mesh_num_attributes_0 = a.asm.R).apply( - null, - arguments, - ); - }), - zb = (a._emscripten_bind_Mesh_num_points_0 = function () { - return (zb = a._emscripten_bind_Mesh_num_points_0 = a.asm.S).apply( - null, - arguments, - ); - }), - Ab = (a._emscripten_bind_Mesh___destroy___0 = function () { - return (Ab = a._emscripten_bind_Mesh___destroy___0 = a.asm.T).apply( - null, - arguments, - ); - }), - Ha = (a._emscripten_bind_Metadata_Metadata_0 = function () { - return (Ha = a._emscripten_bind_Metadata_Metadata_0 = a.asm.U).apply( - null, - arguments, - ); - }), - Bb = (a._emscripten_bind_Metadata___destroy___0 = function () { - return (Bb = a._emscripten_bind_Metadata___destroy___0 = a.asm.V).apply( - null, - arguments, - ); - }), - Cb = (a._emscripten_bind_Status_code_0 = function () { - return (Cb = a._emscripten_bind_Status_code_0 = a.asm.W).apply( - null, - arguments, - ); - }), - Db = (a._emscripten_bind_Status_ok_0 = function () { - return (Db = a._emscripten_bind_Status_ok_0 = a.asm.X).apply( - null, - arguments, - ); - }), - Eb = (a._emscripten_bind_Status_error_msg_0 = function () { - return (Eb = a._emscripten_bind_Status_error_msg_0 = a.asm.Y).apply( - null, - arguments, - ); - }), - Fb = (a._emscripten_bind_Status___destroy___0 = function () { - return (Fb = a._emscripten_bind_Status___destroy___0 = a.asm.Z).apply( - null, - arguments, - ); - }), - Ia = (a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0 = - function () { - return (Ia = - a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0 = - a.asm._).apply(null, arguments); - }), - Gb = (a._emscripten_bind_DracoFloat32Array_GetValue_1 = function () { - return (Gb = a._emscripten_bind_DracoFloat32Array_GetValue_1 = - a.asm.$).apply(null, arguments); - }), - Hb = (a._emscripten_bind_DracoFloat32Array_size_0 = function () { - return (Hb = a._emscripten_bind_DracoFloat32Array_size_0 = - a.asm.aa).apply(null, arguments); - }), - Ib = (a._emscripten_bind_DracoFloat32Array___destroy___0 = function () { - return (Ib = a._emscripten_bind_DracoFloat32Array___destroy___0 = - a.asm.ba).apply(null, arguments); - }), - Ja = (a._emscripten_bind_DracoInt8Array_DracoInt8Array_0 = function () { - return (Ja = a._emscripten_bind_DracoInt8Array_DracoInt8Array_0 = - a.asm.ca).apply(null, arguments); - }), - Jb = (a._emscripten_bind_DracoInt8Array_GetValue_1 = function () { - return (Jb = a._emscripten_bind_DracoInt8Array_GetValue_1 = - a.asm.da).apply(null, arguments); - }), - Kb = (a._emscripten_bind_DracoInt8Array_size_0 = function () { - return (Kb = a._emscripten_bind_DracoInt8Array_size_0 = a.asm.ea).apply( - null, - arguments, - ); - }), - Lb = (a._emscripten_bind_DracoInt8Array___destroy___0 = function () { - return (Lb = a._emscripten_bind_DracoInt8Array___destroy___0 = - a.asm.fa).apply(null, arguments); - }), - Ka = (a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0 = function () { - return (Ka = a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0 = - a.asm.ga).apply(null, arguments); - }), - Mb = (a._emscripten_bind_DracoUInt8Array_GetValue_1 = function () { - return (Mb = a._emscripten_bind_DracoUInt8Array_GetValue_1 = - a.asm.ha).apply(null, arguments); - }), - Nb = (a._emscripten_bind_DracoUInt8Array_size_0 = function () { - return (Nb = a._emscripten_bind_DracoUInt8Array_size_0 = - a.asm.ia).apply(null, arguments); - }), - Ob = (a._emscripten_bind_DracoUInt8Array___destroy___0 = function () { - return (Ob = a._emscripten_bind_DracoUInt8Array___destroy___0 = - a.asm.ja).apply(null, arguments); - }), - La = (a._emscripten_bind_DracoInt16Array_DracoInt16Array_0 = function () { - return (La = a._emscripten_bind_DracoInt16Array_DracoInt16Array_0 = - a.asm.ka).apply(null, arguments); - }), - Pb = (a._emscripten_bind_DracoInt16Array_GetValue_1 = function () { - return (Pb = a._emscripten_bind_DracoInt16Array_GetValue_1 = - a.asm.la).apply(null, arguments); - }), - Qb = (a._emscripten_bind_DracoInt16Array_size_0 = function () { - return (Qb = a._emscripten_bind_DracoInt16Array_size_0 = - a.asm.ma).apply(null, arguments); - }), - Rb = (a._emscripten_bind_DracoInt16Array___destroy___0 = function () { - return (Rb = a._emscripten_bind_DracoInt16Array___destroy___0 = - a.asm.na).apply(null, arguments); - }), - Ma = (a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0 = - function () { - return (Ma = a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0 = - a.asm.oa).apply(null, arguments); - }), - Sb = (a._emscripten_bind_DracoUInt16Array_GetValue_1 = function () { - return (Sb = a._emscripten_bind_DracoUInt16Array_GetValue_1 = - a.asm.pa).apply(null, arguments); - }), - Tb = (a._emscripten_bind_DracoUInt16Array_size_0 = function () { - return (Tb = a._emscripten_bind_DracoUInt16Array_size_0 = - a.asm.qa).apply(null, arguments); - }), - Ub = (a._emscripten_bind_DracoUInt16Array___destroy___0 = function () { - return (Ub = a._emscripten_bind_DracoUInt16Array___destroy___0 = - a.asm.ra).apply(null, arguments); - }), - Na = (a._emscripten_bind_DracoInt32Array_DracoInt32Array_0 = function () { - return (Na = a._emscripten_bind_DracoInt32Array_DracoInt32Array_0 = - a.asm.sa).apply(null, arguments); - }), - Vb = (a._emscripten_bind_DracoInt32Array_GetValue_1 = function () { - return (Vb = a._emscripten_bind_DracoInt32Array_GetValue_1 = - a.asm.ta).apply(null, arguments); - }), - Wb = (a._emscripten_bind_DracoInt32Array_size_0 = function () { - return (Wb = a._emscripten_bind_DracoInt32Array_size_0 = - a.asm.ua).apply(null, arguments); - }), - Xb = (a._emscripten_bind_DracoInt32Array___destroy___0 = function () { - return (Xb = a._emscripten_bind_DracoInt32Array___destroy___0 = - a.asm.va).apply(null, arguments); - }), - Oa = (a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0 = - function () { - return (Oa = a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0 = - a.asm.wa).apply(null, arguments); - }), - Yb = (a._emscripten_bind_DracoUInt32Array_GetValue_1 = function () { - return (Yb = a._emscripten_bind_DracoUInt32Array_GetValue_1 = - a.asm.xa).apply(null, arguments); - }), - Zb = (a._emscripten_bind_DracoUInt32Array_size_0 = function () { - return (Zb = a._emscripten_bind_DracoUInt32Array_size_0 = - a.asm.ya).apply(null, arguments); - }), - $b = (a._emscripten_bind_DracoUInt32Array___destroy___0 = function () { - return ($b = a._emscripten_bind_DracoUInt32Array___destroy___0 = - a.asm.za).apply(null, arguments); - }), - Pa = (a._emscripten_bind_MetadataQuerier_MetadataQuerier_0 = function () { - return (Pa = a._emscripten_bind_MetadataQuerier_MetadataQuerier_0 = - a.asm.Aa).apply(null, arguments); - }), - ac = (a._emscripten_bind_MetadataQuerier_HasEntry_2 = function () { - return (ac = a._emscripten_bind_MetadataQuerier_HasEntry_2 = - a.asm.Ba).apply(null, arguments); - }), - bc = (a._emscripten_bind_MetadataQuerier_GetIntEntry_2 = function () { - return (bc = a._emscripten_bind_MetadataQuerier_GetIntEntry_2 = - a.asm.Ca).apply(null, arguments); - }), - cc = (a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3 = - function () { - return (cc = a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3 = - a.asm.Da).apply(null, arguments); - }), - dc = (a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2 = function () { - return (dc = a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2 = - a.asm.Ea).apply(null, arguments); - }), - ec = (a._emscripten_bind_MetadataQuerier_GetStringEntry_2 = function () { - return (ec = a._emscripten_bind_MetadataQuerier_GetStringEntry_2 = - a.asm.Fa).apply(null, arguments); - }), - fc = (a._emscripten_bind_MetadataQuerier_NumEntries_1 = function () { - return (fc = a._emscripten_bind_MetadataQuerier_NumEntries_1 = - a.asm.Ga).apply(null, arguments); - }), - gc = (a._emscripten_bind_MetadataQuerier_GetEntryName_2 = function () { - return (gc = a._emscripten_bind_MetadataQuerier_GetEntryName_2 = - a.asm.Ha).apply(null, arguments); - }), - hc = (a._emscripten_bind_MetadataQuerier___destroy___0 = function () { - return (hc = a._emscripten_bind_MetadataQuerier___destroy___0 = - a.asm.Ia).apply(null, arguments); - }), - Qa = (a._emscripten_bind_Decoder_Decoder_0 = function () { - return (Qa = a._emscripten_bind_Decoder_Decoder_0 = a.asm.Ja).apply( - null, - arguments, - ); - }), - ic = (a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3 = function () { - return (ic = a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3 = - a.asm.Ka).apply(null, arguments); - }), - jc = (a._emscripten_bind_Decoder_DecodeArrayToMesh_3 = function () { - return (jc = a._emscripten_bind_Decoder_DecodeArrayToMesh_3 = - a.asm.La).apply(null, arguments); - }), - kc = (a._emscripten_bind_Decoder_GetAttributeId_2 = function () { - return (kc = a._emscripten_bind_Decoder_GetAttributeId_2 = - a.asm.Ma).apply(null, arguments); - }), - lc = (a._emscripten_bind_Decoder_GetAttributeIdByName_2 = function () { - return (lc = a._emscripten_bind_Decoder_GetAttributeIdByName_2 = - a.asm.Na).apply(null, arguments); - }), - mc = (a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3 = - function () { - return (mc = - a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3 = - a.asm.Oa).apply(null, arguments); - }), - nc = (a._emscripten_bind_Decoder_GetAttribute_2 = function () { - return (nc = a._emscripten_bind_Decoder_GetAttribute_2 = - a.asm.Pa).apply(null, arguments); - }), - oc = (a._emscripten_bind_Decoder_GetAttributeByUniqueId_2 = function () { - return (oc = a._emscripten_bind_Decoder_GetAttributeByUniqueId_2 = - a.asm.Qa).apply(null, arguments); - }), - pc = (a._emscripten_bind_Decoder_GetMetadata_1 = function () { - return (pc = a._emscripten_bind_Decoder_GetMetadata_1 = a.asm.Ra).apply( - null, - arguments, - ); - }), - qc = (a._emscripten_bind_Decoder_GetAttributeMetadata_2 = function () { - return (qc = a._emscripten_bind_Decoder_GetAttributeMetadata_2 = - a.asm.Sa).apply(null, arguments); - }), - rc = (a._emscripten_bind_Decoder_GetFaceFromMesh_3 = function () { - return (rc = a._emscripten_bind_Decoder_GetFaceFromMesh_3 = - a.asm.Ta).apply(null, arguments); - }), - sc = (a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2 = - function () { - return (sc = a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2 = - a.asm.Ua).apply(null, arguments); - }), - tc = (a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3 = function () { - return (tc = a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3 = - a.asm.Va).apply(null, arguments); - }), - uc = (a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3 = function () { - return (uc = a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3 = - a.asm.Wa).apply(null, arguments); - }), - vc = (a._emscripten_bind_Decoder_GetAttributeFloat_3 = function () { - return (vc = a._emscripten_bind_Decoder_GetAttributeFloat_3 = - a.asm.Xa).apply(null, arguments); - }), - wc = (a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3 = - function () { - return (wc = - a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3 = - a.asm.Ya).apply(null, arguments); - }), - xc = (a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3 = - function () { - return (xc = - a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3 = - a.asm.Za).apply(null, arguments); - }), - yc = (a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3 = - function () { - return (yc = - a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3 = - a.asm._a).apply(null, arguments); - }), - zc = (a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3 = - function () { - return (zc = - a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3 = - a.asm.$a).apply(null, arguments); - }), - Ac = (a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3 = - function () { - return (Ac = - a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3 = - a.asm.ab).apply(null, arguments); - }), - Bc = (a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3 = - function () { - return (Bc = - a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3 = - a.asm.bb).apply(null, arguments); - }), - Cc = (a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3 = - function () { - return (Cc = - a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3 = - a.asm.cb).apply(null, arguments); - }), - Dc = (a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3 = - function () { - return (Dc = - a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3 = - a.asm.db).apply(null, arguments); - }), - Ec = (a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5 = - function () { - return (Ec = - a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5 = - a.asm.eb).apply(null, arguments); - }), - Fc = (a._emscripten_bind_Decoder_SkipAttributeTransform_1 = function () { - return (Fc = a._emscripten_bind_Decoder_SkipAttributeTransform_1 = - a.asm.fb).apply(null, arguments); - }), - Gc = (a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1 = - function () { - return (Gc = - a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1 = - a.asm.gb).apply(null, arguments); - }), - Hc = (a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2 = - function () { - return (Hc = a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2 = - a.asm.hb).apply(null, arguments); - }), - Ic = (a._emscripten_bind_Decoder_DecodeBufferToMesh_2 = function () { - return (Ic = a._emscripten_bind_Decoder_DecodeBufferToMesh_2 = - a.asm.ib).apply(null, arguments); - }), - Jc = (a._emscripten_bind_Decoder___destroy___0 = function () { - return (Jc = a._emscripten_bind_Decoder___destroy___0 = a.asm.jb).apply( - null, - arguments, - ); - }), - Kc = - (a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM = - function () { - return (Kc = - a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM = - a.asm.kb).apply(null, arguments); - }), - Lc = - (a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM = - function () { - return (Lc = - a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM = - a.asm.lb).apply(null, arguments); - }), - Mc = - (a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM = - function () { - return (Mc = - a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM = - a.asm.mb).apply(null, arguments); - }), - Nc = - (a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM = - function () { - return (Nc = - a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM = - a.asm.nb).apply(null, arguments); - }), - Oc = (a._emscripten_enum_draco_GeometryAttribute_Type_INVALID = - function () { - return (Oc = a._emscripten_enum_draco_GeometryAttribute_Type_INVALID = - a.asm.ob).apply(null, arguments); - }), - Pc = (a._emscripten_enum_draco_GeometryAttribute_Type_POSITION = - function () { - return (Pc = - a._emscripten_enum_draco_GeometryAttribute_Type_POSITION = - a.asm.pb).apply(null, arguments); - }), - Qc = (a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL = - function () { - return (Qc = a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL = - a.asm.qb).apply(null, arguments); - }), - Rc = (a._emscripten_enum_draco_GeometryAttribute_Type_COLOR = - function () { - return (Rc = a._emscripten_enum_draco_GeometryAttribute_Type_COLOR = - a.asm.rb).apply(null, arguments); - }), - Sc = (a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD = - function () { - return (Sc = - a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD = - a.asm.sb).apply(null, arguments); - }), - Tc = (a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC = - function () { - return (Tc = a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC = - a.asm.tb).apply(null, arguments); - }), - Uc = (a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE = - function () { - return (Uc = - a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE = - a.asm.ub).apply(null, arguments); - }), - Vc = (a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD = - function () { - return (Vc = - a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD = - a.asm.vb).apply(null, arguments); - }), - Wc = (a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH = - function () { - return (Wc = - a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH = - a.asm.wb).apply(null, arguments); - }), - Xc = (a._emscripten_enum_draco_DataType_DT_INVALID = function () { - return (Xc = a._emscripten_enum_draco_DataType_DT_INVALID = - a.asm.xb).apply(null, arguments); - }), - Yc = (a._emscripten_enum_draco_DataType_DT_INT8 = function () { - return (Yc = a._emscripten_enum_draco_DataType_DT_INT8 = - a.asm.yb).apply(null, arguments); - }), - Zc = (a._emscripten_enum_draco_DataType_DT_UINT8 = function () { - return (Zc = a._emscripten_enum_draco_DataType_DT_UINT8 = - a.asm.zb).apply(null, arguments); - }), - $c = (a._emscripten_enum_draco_DataType_DT_INT16 = function () { - return ($c = a._emscripten_enum_draco_DataType_DT_INT16 = - a.asm.Ab).apply(null, arguments); - }), - ad = (a._emscripten_enum_draco_DataType_DT_UINT16 = function () { - return (ad = a._emscripten_enum_draco_DataType_DT_UINT16 = - a.asm.Bb).apply(null, arguments); - }), - bd = (a._emscripten_enum_draco_DataType_DT_INT32 = function () { - return (bd = a._emscripten_enum_draco_DataType_DT_INT32 = - a.asm.Cb).apply(null, arguments); - }), - cd = (a._emscripten_enum_draco_DataType_DT_UINT32 = function () { - return (cd = a._emscripten_enum_draco_DataType_DT_UINT32 = - a.asm.Db).apply(null, arguments); - }), - dd = (a._emscripten_enum_draco_DataType_DT_INT64 = function () { - return (dd = a._emscripten_enum_draco_DataType_DT_INT64 = - a.asm.Eb).apply(null, arguments); - }), - ed = (a._emscripten_enum_draco_DataType_DT_UINT64 = function () { - return (ed = a._emscripten_enum_draco_DataType_DT_UINT64 = - a.asm.Fb).apply(null, arguments); - }), - fd = (a._emscripten_enum_draco_DataType_DT_FLOAT32 = function () { - return (fd = a._emscripten_enum_draco_DataType_DT_FLOAT32 = - a.asm.Gb).apply(null, arguments); - }), - gd = (a._emscripten_enum_draco_DataType_DT_FLOAT64 = function () { - return (gd = a._emscripten_enum_draco_DataType_DT_FLOAT64 = - a.asm.Hb).apply(null, arguments); - }), - hd = (a._emscripten_enum_draco_DataType_DT_BOOL = function () { - return (hd = a._emscripten_enum_draco_DataType_DT_BOOL = - a.asm.Ib).apply(null, arguments); - }), - id = (a._emscripten_enum_draco_DataType_DT_TYPES_COUNT = function () { - return (id = a._emscripten_enum_draco_DataType_DT_TYPES_COUNT = - a.asm.Jb).apply(null, arguments); - }), - jd = (a._emscripten_enum_draco_StatusCode_OK = function () { - return (jd = a._emscripten_enum_draco_StatusCode_OK = a.asm.Kb).apply( - null, - arguments, - ); - }), - kd = (a._emscripten_enum_draco_StatusCode_DRACO_ERROR = function () { - return (kd = a._emscripten_enum_draco_StatusCode_DRACO_ERROR = - a.asm.Lb).apply(null, arguments); - }), - ld = (a._emscripten_enum_draco_StatusCode_IO_ERROR = function () { - return (ld = a._emscripten_enum_draco_StatusCode_IO_ERROR = - a.asm.Mb).apply(null, arguments); - }), - md = (a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER = - function () { - return (md = a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER = - a.asm.Nb).apply(null, arguments); - }), - nd = (a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION = - function () { - return (nd = a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION = - a.asm.Ob).apply(null, arguments); - }), - od = (a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION = function () { - return (od = a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION = - a.asm.Pb).apply(null, arguments); - }); - a._malloc = function () { - return (a._malloc = a.asm.Qb).apply(null, arguments); - }; - a._free = function () { - return (a._free = a.asm.Rb).apply(null, arguments); - }; - var ua = function () { - return (ua = a.asm.Sb).apply(null, arguments); - }; - a.___start_em_js = 11660; - a.___stop_em_js = 11758; - var la; - ha = function b() { - la || F(); - la || (ha = b); - }; - if (a.preInit) - for ( - "function" == typeof a.preInit && (a.preInit = [a.preInit]); - 0 < a.preInit.length; - ) - a.preInit.pop()(); - F(); - v.prototype = Object.create(v.prototype); - v.prototype.constructor = v; - v.prototype.__class__ = v; - v.__cache__ = {}; - a.WrapperObject = v; - a.getCache = w; - a.wrapPointer = B; - a.castObject = (b, c) => B(b.ptr, c); - a.NULL = B(0); - a.destroy = (b) => { - if (!b.__destroy__) - throw "Error: Cannot destroy object. (Did you create it yourself?)"; - b.__destroy__(); - delete w(b.__class__)[b.ptr]; - }; - a.compare = (b, c) => b.ptr === c.ptr; - a.getPointer = (b) => b.ptr; - a.getClass = (b) => b.__class__; - var r = { - buffer: 0, - size: 0, - pos: 0, - temps: [], - needed: 0, - prepare: () => { - if (r.needed) { - for (var b = 0; b < r.temps.length; b++) a._free(r.temps[b]); - r.temps.length = 0; - a._free(r.buffer); - r.buffer = 0; - r.size += r.needed; - r.needed = 0; - } - r.buffer || - ((r.size += 128), - (r.buffer = a._malloc(r.size)), - r.buffer || y(void 0)); - r.pos = 0; - }, - alloc: (b, c) => { - r.buffer || y(void 0); - b = b.length * c.BYTES_PER_ELEMENT; - b = (b + 7) & -8; - r.pos + b >= r.size - ? (0 < b || y(void 0), - (r.needed += b), - (c = a._malloc(b)), - r.temps.push(c)) - : ((c = r.buffer + r.pos), (r.pos += b)); - return c; - }, - copy: (b, c, d) => { - d >>>= 0; - switch (c.BYTES_PER_ELEMENT) { - case 2: - d >>>= 1; - break; - case 4: - d >>>= 2; - break; - case 8: - d >>>= 3; - } - for (var g = 0; g < b.length; g++) c[d + g] = b[g]; - }, - }; - X.prototype = Object.create(v.prototype); - X.prototype.constructor = X; - X.prototype.__class__ = X; - X.__cache__ = {}; - a.VoidPtr = X; - X.prototype.__destroy__ = X.prototype.__destroy__ = function () { - Xa(this.ptr); - }; - S.prototype = Object.create(v.prototype); - S.prototype.constructor = S; - S.prototype.__class__ = S; - S.__cache__ = {}; - a.DecoderBuffer = S; - S.prototype.Init = S.prototype.Init = function (b, c) { - var d = this.ptr; - r.prepare(); - "object" == typeof b && (b = Z(b)); - c && "object" === typeof c && (c = c.ptr); - Ya(d, b, c); - }; - S.prototype.__destroy__ = S.prototype.__destroy__ = function () { - Za(this.ptr); - }; - Q.prototype = Object.create(v.prototype); - Q.prototype.constructor = Q; - Q.prototype.__class__ = Q; - Q.__cache__ = {}; - a.AttributeTransformData = Q; - Q.prototype.transform_type = Q.prototype.transform_type = function () { - return $a(this.ptr); - }; - Q.prototype.__destroy__ = Q.prototype.__destroy__ = function () { - ab(this.ptr); - }; - V.prototype = Object.create(v.prototype); - V.prototype.constructor = V; - V.prototype.__class__ = V; - V.__cache__ = {}; - a.GeometryAttribute = V; - V.prototype.__destroy__ = V.prototype.__destroy__ = function () { - bb(this.ptr); - }; - x.prototype = Object.create(v.prototype); - x.prototype.constructor = x; - x.prototype.__class__ = x; - x.__cache__ = {}; - a.PointAttribute = x; - x.prototype.size = x.prototype.size = function () { - return cb(this.ptr); - }; - x.prototype.GetAttributeTransformData = - x.prototype.GetAttributeTransformData = function () { - return B(db(this.ptr), Q); - }; - x.prototype.attribute_type = x.prototype.attribute_type = function () { - return eb(this.ptr); - }; - x.prototype.data_type = x.prototype.data_type = function () { - return fb(this.ptr); - }; - x.prototype.num_components = x.prototype.num_components = function () { - return gb(this.ptr); - }; - x.prototype.normalized = x.prototype.normalized = function () { - return !!hb(this.ptr); - }; - x.prototype.byte_stride = x.prototype.byte_stride = function () { - return ib(this.ptr); - }; - x.prototype.byte_offset = x.prototype.byte_offset = function () { - return jb(this.ptr); - }; - x.prototype.unique_id = x.prototype.unique_id = function () { - return kb(this.ptr); - }; - x.prototype.__destroy__ = x.prototype.__destroy__ = function () { - lb(this.ptr); - }; - D.prototype = Object.create(v.prototype); - D.prototype.constructor = D; - D.prototype.__class__ = D; - D.__cache__ = {}; - a.AttributeQuantizationTransform = D; - D.prototype.InitFromAttribute = D.prototype.InitFromAttribute = function ( - b, - ) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return !!mb(c, b); - }; - D.prototype.quantization_bits = D.prototype.quantization_bits = - function () { - return nb(this.ptr); - }; - D.prototype.min_value = D.prototype.min_value = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return ob(c, b); - }; - D.prototype.range = D.prototype.range = function () { - return pb(this.ptr); - }; - D.prototype.__destroy__ = D.prototype.__destroy__ = function () { - qb(this.ptr); - }; - G.prototype = Object.create(v.prototype); - G.prototype.constructor = G; - G.prototype.__class__ = G; - G.__cache__ = {}; - a.AttributeOctahedronTransform = G; - G.prototype.InitFromAttribute = G.prototype.InitFromAttribute = function ( - b, - ) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return !!rb(c, b); - }; - G.prototype.quantization_bits = G.prototype.quantization_bits = - function () { - return sb(this.ptr); - }; - G.prototype.__destroy__ = G.prototype.__destroy__ = function () { - tb(this.ptr); - }; - H.prototype = Object.create(v.prototype); - H.prototype.constructor = H; - H.prototype.__class__ = H; - H.__cache__ = {}; - a.PointCloud = H; - H.prototype.num_attributes = H.prototype.num_attributes = function () { - return ub(this.ptr); - }; - H.prototype.num_points = H.prototype.num_points = function () { - return vb(this.ptr); - }; - H.prototype.__destroy__ = H.prototype.__destroy__ = function () { - wb(this.ptr); - }; - E.prototype = Object.create(v.prototype); - E.prototype.constructor = E; - E.prototype.__class__ = E; - E.__cache__ = {}; - a.Mesh = E; - E.prototype.num_faces = E.prototype.num_faces = function () { - return xb(this.ptr); - }; - E.prototype.num_attributes = E.prototype.num_attributes = function () { - return yb(this.ptr); - }; - E.prototype.num_points = E.prototype.num_points = function () { - return zb(this.ptr); - }; - E.prototype.__destroy__ = E.prototype.__destroy__ = function () { - Ab(this.ptr); - }; - T.prototype = Object.create(v.prototype); - T.prototype.constructor = T; - T.prototype.__class__ = T; - T.__cache__ = {}; - a.Metadata = T; - T.prototype.__destroy__ = T.prototype.__destroy__ = function () { - Bb(this.ptr); - }; - C.prototype = Object.create(v.prototype); - C.prototype.constructor = C; - C.prototype.__class__ = C; - C.__cache__ = {}; - a.Status = C; - C.prototype.code = C.prototype.code = function () { - return Cb(this.ptr); - }; - C.prototype.ok = C.prototype.ok = function () { - return !!Db(this.ptr); - }; - C.prototype.error_msg = C.prototype.error_msg = function () { - return p(Eb(this.ptr)); - }; - C.prototype.__destroy__ = C.prototype.__destroy__ = function () { - Fb(this.ptr); - }; - I.prototype = Object.create(v.prototype); - I.prototype.constructor = I; - I.prototype.__class__ = I; - I.__cache__ = {}; - a.DracoFloat32Array = I; - I.prototype.GetValue = I.prototype.GetValue = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Gb(c, b); - }; - I.prototype.size = I.prototype.size = function () { - return Hb(this.ptr); - }; - I.prototype.__destroy__ = I.prototype.__destroy__ = function () { - Ib(this.ptr); - }; - J.prototype = Object.create(v.prototype); - J.prototype.constructor = J; - J.prototype.__class__ = J; - J.__cache__ = {}; - a.DracoInt8Array = J; - J.prototype.GetValue = J.prototype.GetValue = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Jb(c, b); - }; - J.prototype.size = J.prototype.size = function () { - return Kb(this.ptr); - }; - J.prototype.__destroy__ = J.prototype.__destroy__ = function () { - Lb(this.ptr); - }; - K.prototype = Object.create(v.prototype); - K.prototype.constructor = K; - K.prototype.__class__ = K; - K.__cache__ = {}; - a.DracoUInt8Array = K; - K.prototype.GetValue = K.prototype.GetValue = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Mb(c, b); - }; - K.prototype.size = K.prototype.size = function () { - return Nb(this.ptr); - }; - K.prototype.__destroy__ = K.prototype.__destroy__ = function () { - Ob(this.ptr); - }; - L.prototype = Object.create(v.prototype); - L.prototype.constructor = L; - L.prototype.__class__ = L; - L.__cache__ = {}; - a.DracoInt16Array = L; - L.prototype.GetValue = L.prototype.GetValue = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Pb(c, b); - }; - L.prototype.size = L.prototype.size = function () { - return Qb(this.ptr); - }; - L.prototype.__destroy__ = L.prototype.__destroy__ = function () { - Rb(this.ptr); - }; - M.prototype = Object.create(v.prototype); - M.prototype.constructor = M; - M.prototype.__class__ = M; - M.__cache__ = {}; - a.DracoUInt16Array = M; - M.prototype.GetValue = M.prototype.GetValue = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Sb(c, b); - }; - M.prototype.size = M.prototype.size = function () { - return Tb(this.ptr); - }; - M.prototype.__destroy__ = M.prototype.__destroy__ = function () { - Ub(this.ptr); - }; - N.prototype = Object.create(v.prototype); - N.prototype.constructor = N; - N.prototype.__class__ = N; - N.__cache__ = {}; - a.DracoInt32Array = N; - N.prototype.GetValue = N.prototype.GetValue = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Vb(c, b); - }; - N.prototype.size = N.prototype.size = function () { - return Wb(this.ptr); - }; - N.prototype.__destroy__ = N.prototype.__destroy__ = function () { - Xb(this.ptr); - }; - O.prototype = Object.create(v.prototype); - O.prototype.constructor = O; - O.prototype.__class__ = O; - O.__cache__ = {}; - a.DracoUInt32Array = O; - O.prototype.GetValue = O.prototype.GetValue = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Yb(c, b); - }; - O.prototype.size = O.prototype.size = function () { - return Zb(this.ptr); - }; - O.prototype.__destroy__ = O.prototype.__destroy__ = function () { - $b(this.ptr); - }; - z.prototype = Object.create(v.prototype); - z.prototype.constructor = z; - z.prototype.__class__ = z; - z.__cache__ = {}; - a.MetadataQuerier = z; - z.prototype.HasEntry = z.prototype.HasEntry = function (b, c) { - var d = this.ptr; - r.prepare(); - b && "object" === typeof b && (b = b.ptr); - c = c && "object" === typeof c ? c.ptr : R(c); - return !!ac(d, b, c); - }; - z.prototype.GetIntEntry = z.prototype.GetIntEntry = function (b, c) { - var d = this.ptr; - r.prepare(); - b && "object" === typeof b && (b = b.ptr); - c = c && "object" === typeof c ? c.ptr : R(c); - return bc(d, b, c); - }; - z.prototype.GetIntEntryArray = z.prototype.GetIntEntryArray = function ( - b, - c, - d, - ) { - var g = this.ptr; - r.prepare(); - b && "object" === typeof b && (b = b.ptr); - c = c && "object" === typeof c ? c.ptr : R(c); - d && "object" === typeof d && (d = d.ptr); - cc(g, b, c, d); - }; - z.prototype.GetDoubleEntry = z.prototype.GetDoubleEntry = function (b, c) { - var d = this.ptr; - r.prepare(); - b && "object" === typeof b && (b = b.ptr); - c = c && "object" === typeof c ? c.ptr : R(c); - return dc(d, b, c); - }; - z.prototype.GetStringEntry = z.prototype.GetStringEntry = function (b, c) { - var d = this.ptr; - r.prepare(); - b && "object" === typeof b && (b = b.ptr); - c = c && "object" === typeof c ? c.ptr : R(c); - return p(ec(d, b, c)); - }; - z.prototype.NumEntries = z.prototype.NumEntries = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return fc(c, b); - }; - z.prototype.GetEntryName = z.prototype.GetEntryName = function (b, c) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return p(gc(d, b, c)); - }; - z.prototype.__destroy__ = z.prototype.__destroy__ = function () { - hc(this.ptr); - }; - m.prototype = Object.create(v.prototype); - m.prototype.constructor = m; - m.prototype.__class__ = m; - m.__cache__ = {}; - a.Decoder = m; - m.prototype.DecodeArrayToPointCloud = m.prototype.DecodeArrayToPointCloud = - function (b, c, d) { - var g = this.ptr; - r.prepare(); - "object" == typeof b && (b = Z(b)); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return B(ic(g, b, c, d), C); - }; - m.prototype.DecodeArrayToMesh = m.prototype.DecodeArrayToMesh = function ( - b, - c, - d, - ) { - var g = this.ptr; - r.prepare(); - "object" == typeof b && (b = Z(b)); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return B(jc(g, b, c, d), C); - }; - m.prototype.GetAttributeId = m.prototype.GetAttributeId = function (b, c) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return kc(d, b, c); - }; - m.prototype.GetAttributeIdByName = m.prototype.GetAttributeIdByName = - function (b, c) { - var d = this.ptr; - r.prepare(); - b && "object" === typeof b && (b = b.ptr); - c = c && "object" === typeof c ? c.ptr : R(c); - return lc(d, b, c); - }; - m.prototype.GetAttributeIdByMetadataEntry = - m.prototype.GetAttributeIdByMetadataEntry = function (b, c, d) { - var g = this.ptr; - r.prepare(); - b && "object" === typeof b && (b = b.ptr); - c = c && "object" === typeof c ? c.ptr : R(c); - d = d && "object" === typeof d ? d.ptr : R(d); - return mc(g, b, c, d); - }; - m.prototype.GetAttribute = m.prototype.GetAttribute = function (b, c) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return B(nc(d, b, c), x); - }; - m.prototype.GetAttributeByUniqueId = m.prototype.GetAttributeByUniqueId = - function (b, c) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return B(oc(d, b, c), x); - }; - m.prototype.GetMetadata = m.prototype.GetMetadata = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return B(pc(c, b), T); - }; - m.prototype.GetAttributeMetadata = m.prototype.GetAttributeMetadata = - function (b, c) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return B(qc(d, b, c), T); - }; - m.prototype.GetFaceFromMesh = m.prototype.GetFaceFromMesh = function ( - b, - c, - d, - ) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!rc(g, b, c, d); - }; - m.prototype.GetTriangleStripsFromMesh = - m.prototype.GetTriangleStripsFromMesh = function (b, c) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return sc(d, b, c); - }; - m.prototype.GetTrianglesUInt16Array = m.prototype.GetTrianglesUInt16Array = - function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!tc(g, b, c, d); - }; - m.prototype.GetTrianglesUInt32Array = m.prototype.GetTrianglesUInt32Array = - function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!uc(g, b, c, d); - }; - m.prototype.GetAttributeFloat = m.prototype.GetAttributeFloat = function ( - b, - c, - d, - ) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!vc(g, b, c, d); - }; - m.prototype.GetAttributeFloatForAllPoints = - m.prototype.GetAttributeFloatForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!wc(g, b, c, d); - }; - m.prototype.GetAttributeIntForAllPoints = - m.prototype.GetAttributeIntForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!xc(g, b, c, d); - }; - m.prototype.GetAttributeInt8ForAllPoints = - m.prototype.GetAttributeInt8ForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!yc(g, b, c, d); - }; - m.prototype.GetAttributeUInt8ForAllPoints = - m.prototype.GetAttributeUInt8ForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!zc(g, b, c, d); - }; - m.prototype.GetAttributeInt16ForAllPoints = - m.prototype.GetAttributeInt16ForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!Ac(g, b, c, d); - }; - m.prototype.GetAttributeUInt16ForAllPoints = - m.prototype.GetAttributeUInt16ForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!Bc(g, b, c, d); - }; - m.prototype.GetAttributeInt32ForAllPoints = - m.prototype.GetAttributeInt32ForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!Cc(g, b, c, d); - }; - m.prototype.GetAttributeUInt32ForAllPoints = - m.prototype.GetAttributeUInt32ForAllPoints = function (b, c, d) { - var g = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - return !!Dc(g, b, c, d); - }; - m.prototype.GetAttributeDataArrayForAllPoints = - m.prototype.GetAttributeDataArrayForAllPoints = function (b, c, d, g, t) { - var aa = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - d && "object" === typeof d && (d = d.ptr); - g && "object" === typeof g && (g = g.ptr); - t && "object" === typeof t && (t = t.ptr); - return !!Ec(aa, b, c, d, g, t); - }; - m.prototype.SkipAttributeTransform = m.prototype.SkipAttributeTransform = - function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - Fc(c, b); - }; - m.prototype.GetEncodedGeometryType_Deprecated = - m.prototype.GetEncodedGeometryType_Deprecated = function (b) { - var c = this.ptr; - b && "object" === typeof b && (b = b.ptr); - return Gc(c, b); - }; - m.prototype.DecodeBufferToPointCloud = - m.prototype.DecodeBufferToPointCloud = function (b, c) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return B(Hc(d, b, c), C); - }; - m.prototype.DecodeBufferToMesh = m.prototype.DecodeBufferToMesh = function ( - b, - c, - ) { - var d = this.ptr; - b && "object" === typeof b && (b = b.ptr); - c && "object" === typeof c && (c = c.ptr); - return B(Ic(d, b, c), C); - }; - m.prototype.__destroy__ = m.prototype.__destroy__ = function () { - Jc(this.ptr); - }; - (() => { - function b() { - a.ATTRIBUTE_INVALID_TRANSFORM = Kc(); - a.ATTRIBUTE_NO_TRANSFORM = Lc(); - a.ATTRIBUTE_QUANTIZATION_TRANSFORM = Mc(); - a.ATTRIBUTE_OCTAHEDRON_TRANSFORM = Nc(); - a.INVALID = Oc(); - a.POSITION = Pc(); - a.NORMAL = Qc(); - a.COLOR = Rc(); - a.TEX_COORD = Sc(); - a.GENERIC = Tc(); - a.INVALID_GEOMETRY_TYPE = Uc(); - a.POINT_CLOUD = Vc(); - a.TRIANGULAR_MESH = Wc(); - a.DT_INVALID = Xc(); - a.DT_INT8 = Yc(); - a.DT_UINT8 = Zc(); - a.DT_INT16 = $c(); - a.DT_UINT16 = ad(); - a.DT_INT32 = bd(); - a.DT_UINT32 = cd(); - a.DT_INT64 = dd(); - a.DT_UINT64 = ed(); - a.DT_FLOAT32 = fd(); - a.DT_FLOAT64 = gd(); - a.DT_BOOL = hd(); - a.DT_TYPES_COUNT = id(); - a.OK = jd(); - a.DRACO_ERROR = kd(); - a.IO_ERROR = ld(); - a.INVALID_PARAMETER = md(); - a.UNSUPPORTED_VERSION = nd(); - a.UNKNOWN_VERSION = od(); - } - va ? b() : oa.unshift(b); - })(); - if ("function" === typeof a.onModuleParsed) a.onModuleParsed(); - a.Decoder.prototype.GetEncodedGeometryType = (b) => { - if (b.__class__ && b.__class__ === a.DecoderBuffer) - return a.Decoder.prototype.GetEncodedGeometryType_Deprecated(b); - if (8 > b.byteLength) return a.INVALID_GEOMETRY_TYPE; - switch (b[7]) { - case 0: - return a.POINT_CLOUD; - case 1: - return a.TRIANGULAR_MESH; - default: - return a.INVALID_GEOMETRY_TYPE; - } - }; - return n.ready; - }; -})(); -"object" === typeof exports && "object" === typeof module - ? (module.exports = DracoDecoderModule) - : "function" === typeof define && define.amd - ? define([], () => DracoDecoderModule) - : "object" === typeof exports && - (exports.DracoDecoderModule = DracoDecoderModule); diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-1.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-1.png deleted file mode 100644 index a02edcbf84ab7..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-1.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-2.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-2.png deleted file mode 100644 index 3515789a8483b..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-2.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-3.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-3.png deleted file mode 100644 index 13b587669db6f..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-3.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-4.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-4.png deleted file mode 100644 index baee3f2c93f30..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-4.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-5.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-5.png deleted file mode 100644 index 956183a942110..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-5.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-6.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-6.png deleted file mode 100644 index 2510d0b82c125..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-6.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-7.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-7.png deleted file mode 100644 index 8a27406e447c8..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-7.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/backgrounds/eliza-8.png b/plugins/plugin-companion/public/vrms/backgrounds/eliza-8.png deleted file mode 100644 index 4feaf584ae4f7..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/backgrounds/eliza-8.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-1.png b/plugins/plugin-companion/public/vrms/previews/eliza-1.png deleted file mode 100644 index a02edcbf84ab7..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-1.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-2.png b/plugins/plugin-companion/public/vrms/previews/eliza-2.png deleted file mode 100644 index 3515789a8483b..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-2.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-3.png b/plugins/plugin-companion/public/vrms/previews/eliza-3.png deleted file mode 100644 index 13b587669db6f..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-3.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-4.png b/plugins/plugin-companion/public/vrms/previews/eliza-4.png deleted file mode 100644 index baee3f2c93f30..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-4.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-5.png b/plugins/plugin-companion/public/vrms/previews/eliza-5.png deleted file mode 100644 index 956183a942110..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-5.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-6.png b/plugins/plugin-companion/public/vrms/previews/eliza-6.png deleted file mode 100644 index 2510d0b82c125..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-6.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-7.png b/plugins/plugin-companion/public/vrms/previews/eliza-7.png deleted file mode 100644 index 8a27406e447c8..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-7.png and /dev/null differ diff --git a/plugins/plugin-companion/public/vrms/previews/eliza-8.png b/plugins/plugin-companion/public/vrms/previews/eliza-8.png deleted file mode 100644 index 4feaf584ae4f7..0000000000000 Binary files a/plugins/plugin-companion/public/vrms/previews/eliza-8.png and /dev/null differ diff --git a/plugins/plugin-companion/public_src/README.md b/plugins/plugin-companion/public_src/README.md deleted file mode 100644 index d79db7f7e9f32..0000000000000 --- a/plugins/plugin-companion/public_src/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Archived app assets that should stay in-repo but not ship in the runtime bundle. - -`apps/app/public/` is Vite's live static asset root and gets copied into builds. -Move source-only, debug, or superseded assets here when they are useful to keep -around but should not increase packaged app size. diff --git a/plugins/plugin-companion/public_src/animations/emotes/chopping.glb b/plugins/plugin-companion/public_src/animations/emotes/chopping.glb deleted file mode 100644 index 5b56d2afb6831..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/chopping.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/crawling.glb b/plugins/plugin-companion/public_src/animations/emotes/crawling.glb deleted file mode 100644 index 02193de9e0d37..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/crawling.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/crying.glb b/plugins/plugin-companion/public_src/animations/emotes/crying.glb deleted file mode 100644 index 79f3a1b345743..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/crying.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/dance-breaking.glb b/plugins/plugin-companion/public_src/animations/emotes/dance-breaking.glb deleted file mode 100644 index 9005ae9892d20..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/dance-breaking.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/dance-hiphop.glb b/plugins/plugin-companion/public_src/animations/emotes/dance-hiphop.glb deleted file mode 100644 index 0dc7608668c21..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/dance-hiphop.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/death.glb b/plugins/plugin-companion/public_src/animations/emotes/death.glb deleted file mode 100644 index e6370d05b8748..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/death.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/fall.glb b/plugins/plugin-companion/public_src/animations/emotes/fall.glb deleted file mode 100644 index a0728c300488f..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/fall.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/firing-gun.glb b/plugins/plugin-companion/public_src/animations/emotes/firing-gun.glb deleted file mode 100644 index a8ffbbe12880a..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/firing-gun.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/flip.glb b/plugins/plugin-companion/public_src/animations/emotes/flip.glb deleted file mode 100644 index 18df76688c891..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/flip.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/float.glb b/plugins/plugin-companion/public_src/animations/emotes/float.glb deleted file mode 100644 index fa4adddc6515d..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/float.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/hook-punch.glb b/plugins/plugin-companion/public_src/animations/emotes/hook-punch.glb deleted file mode 100644 index 4e08afdfd4365..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/hook-punch.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/idle.glb b/plugins/plugin-companion/public_src/animations/emotes/idle.glb deleted file mode 100644 index e1b00c6347843..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/idle.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/jump.glb b/plugins/plugin-companion/public_src/animations/emotes/jump.glb deleted file mode 100644 index 417dc2629b36d..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/jump.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/kiss.glb b/plugins/plugin-companion/public_src/animations/emotes/kiss.glb deleted file mode 100644 index ad562eb1865ec..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/kiss.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/looking-around.glb b/plugins/plugin-companion/public_src/animations/emotes/looking-around.glb deleted file mode 100644 index 1215dc0ce10e4..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/looking-around.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/punching.glb b/plugins/plugin-companion/public_src/animations/emotes/punching.glb deleted file mode 100644 index a7e469b389dfe..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/punching.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/range.glb b/plugins/plugin-companion/public_src/animations/emotes/range.glb deleted file mode 100644 index dee9c125e3b33..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/range.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/rude-gesture.glb b/plugins/plugin-companion/public_src/animations/emotes/rude-gesture.glb deleted file mode 100644 index c145d2d5362b8..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/rude-gesture.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/run.glb b/plugins/plugin-companion/public_src/animations/emotes/run.glb deleted file mode 100644 index 5f742820d7d90..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/run.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/sorrow.glb b/plugins/plugin-companion/public_src/animations/emotes/sorrow.glb deleted file mode 100644 index e48328ec0012f..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/sorrow.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/spell-cast.glb b/plugins/plugin-companion/public_src/animations/emotes/spell-cast.glb deleted file mode 100644 index 2ec6c9f172bbb..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/spell-cast.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/squat.glb b/plugins/plugin-companion/public_src/animations/emotes/squat.glb deleted file mode 100644 index 6e8b2fac3a4a4..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/squat.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/sword_swing.glb b/plugins/plugin-companion/public_src/animations/emotes/sword_swing.glb deleted file mode 100644 index 0886262497bb8..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/sword_swing.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/talk.glb b/plugins/plugin-companion/public_src/animations/emotes/talk.glb deleted file mode 100644 index f23586fb93150..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/talk.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/walk.glb b/plugins/plugin-companion/public_src/animations/emotes/walk.glb deleted file mode 100644 index 88542431e571b..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/walk.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/emotes/waving-both-hands.glb b/plugins/plugin-companion/public_src/animations/emotes/waving-both-hands.glb deleted file mode 100644 index 4dfb7306eafde..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/emotes/waving-both-hands.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/animations/idle.glb b/plugins/plugin-companion/public_src/animations/idle.glb deleted file mode 100644 index e1b00c6347843..0000000000000 Binary files a/plugins/plugin-companion/public_src/animations/idle.glb and /dev/null differ diff --git a/plugins/plugin-companion/public_src/dev/vrm-gzip-smoke.html b/plugins/plugin-companion/public_src/dev/vrm-gzip-smoke.html deleted file mode 100644 index d79163cce5d82..0000000000000 --- a/plugins/plugin-companion/public_src/dev/vrm-gzip-smoke.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - VRM Gzip Smoke - - - -
- -
booting
-
- - - diff --git a/plugins/plugin-companion/public_src/screenshotter.html b/plugins/plugin-companion/public_src/screenshotter.html deleted file mode 100644 index aeaf687b9020a..0000000000000 --- a/plugins/plugin-companion/public_src/screenshotter.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - -VRM Screenshotter - - - -

VRM Screenshotter

-

Renders each VRM in idle pose and captures a framed preview image.

-
- - -
-
- - - - diff --git a/plugins/plugin-companion/registry-entry.json b/plugins/plugin-companion/registry-entry.json deleted file mode 100644 index 9cea237fbcd46..0000000000000 --- a/plugins/plugin-companion/registry-entry.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "id": "companion", - "name": "Companion", - "description": "The companion overlay shell for ambient agent presence.", - "npmName": "@elizaos/plugin-companion", - "source": "bundled", - "tags": [], - "config": {}, - "render": { - "visible": true, - "pinTo": [], - "style": "card", - "icon": "Bot", - "group": "Curated", - "groupOrder": 0, - "actions": ["launch", "configure"] - }, - "resources": {}, - "dependsOn": [], - "kind": "app", - "subtype": "shell", - "launch": { - "type": "overlay", - "target": "companion", - "capabilities": [], - "curatedSlug": "companion" - }, - "curatedApp": { - "slug": "companion", - "order": 0, - "aliases": [] - } -} diff --git a/plugins/plugin-companion/src/actions/emote.ts b/plugins/plugin-companion/src/actions/emote.ts deleted file mode 100644 index e463496b63a0b..0000000000000 --- a/plugins/plugin-companion/src/actions/emote.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * PLAY_EMOTE action — plays an emote animation on the VRM companion avatar. - * - * Lives in @elizaos/plugin-companion so emote catalog and behavior stay with the - * companion app. Session gating is applied at the plugin level - * (`gatePluginSessionForHostedApp`). - */ - -import type { - Action, - HandlerOptions, - IAgentRuntime, - Memory, -} from "@elizaos/core"; -import { AGENT_EMOTE_BY_ID, AGENT_EMOTE_CATALOG } from "../emotes/catalog.js"; - -/** API port for posting emote requests (matches dashboard static server default). */ -const API_PORT = process.env.API_PORT || process.env.SERVER_PORT || "2138"; -const EMOTE_REQUEST_TIMEOUT_MS = 2_500; - -export const emoteAction: Action = { - name: "PLAY_EMOTE", - contexts: ["media", "general"], - contextGate: { anyOf: ["media", "general"] }, - roleGate: { minRole: "USER" }, - - similes: [ - "EMOTE", - "ANIMATE", - "GESTURE", - "DANCE", - "WAVE", - "PLAY_ANIMATION", - "DO_EMOTE", - "PERFORM", - ], - - description: - "Play a one-shot emote animation on your 3D VRM avatar, then return to idle. " + - "Use whenever a visible gesture, reaction, or trick helps convey emotion. " + - "This is a silent non-blocking visual side action that does not create " + - "chat text on its own. Only call it when you set the required emote " + - "parameter to a valid emote ID. If you also want speech, chain it " + - "before, after, or alongside other actions in the same turn " + - "(for example with REPLY, MESSAGE operation=send, or stream actions).", - descriptionCompressed: - "Play one-shot VRM avatar emote animation. Silent visual side-action.", - - validate: async (runtime: IAgentRuntime, message: Memory, _state) => { - if (runtime.character.settings?.DISABLE_EMOTES) return false; - const source = (message.content as Record)?.source; - return source === "client_chat"; - }, - - handler: async (_runtime, _message, _state, options) => { - const params = (options as HandlerOptions | undefined)?.parameters as - | { emote?: string } - | undefined; - const emoteId = params?.emote?.trim(); - - if (!emoteId) return { text: "", success: false }; - - const emote = AGENT_EMOTE_BY_ID.get(emoteId); - if (!emote) return { text: "", success: false }; - - const controller = new AbortController(); - const timeout = setTimeout( - () => controller.abort(), - EMOTE_REQUEST_TIMEOUT_MS, - ); - try { - const response = await fetch(`http://localhost:${API_PORT}/api/emote`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ emoteId: emote.id }), - signal: controller.signal, - }); - - if (!response.ok) { - return { text: "", success: false }; - } - } catch { - return { text: "", success: false }; - } finally { - clearTimeout(timeout); - } - - return { - text: "", - success: true, - data: { emoteId: emote.id }, - }; - }, - - parameters: [ - { - name: "emote", - description: - "Required emote ID to play once silently before returning to idle. " + - "Common mappings: dance/vibe → dance-happy, wave/greet → wave, " + - "flip/backflip → flip, cry/sad → crying, fight/punch → punching, fish → fishing", - required: true, - schema: { - type: "string" as const, - enum: AGENT_EMOTE_CATALOG.map((e) => e.id), - }, - }, - ], -}; diff --git a/plugins/plugin-companion/src/character-catalog.ts b/plugins/plugin-companion/src/character-catalog.ts deleted file mode 100644 index 556198e08b855..0000000000000 --- a/plugins/plugin-companion/src/character-catalog.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { - DEFAULT_ELIZA_CHARACTER_ASSET, - getCharacterAsset, - getCharacterAssets, - getInjectedCharacter, - getInjectedCharacters, -} from "@elizaos/ui/character-catalog"; diff --git a/plugins/plugin-companion/src/components/avatar/MathEnvironment.ts b/plugins/plugin-companion/src/components/avatar/MathEnvironment.ts deleted file mode 100644 index 0d897ff4e7a7c..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/MathEnvironment.ts +++ /dev/null @@ -1,322 +0,0 @@ -/** - * MathEnvironment — Matrix Construct-style Three.js background scene. - * - * Light mode: white void with faint receding grid and translucent screen - * panels — the loading construct from The Matrix. - * - * Dark mode: dark void with purple/neon-green grid and glowing screens - * — cyberpunk matrix terminal aesthetic. - * - * No external models or textures — everything is procedural geometry. - */ - -import * as THREE from "three"; - -const GRID_SIZE = 60; -const GRID_DIVISIONS = 60; -const GRID_Y = -0.75; - -/** Screen panel definitions — distant ambient panels for visual depth. */ -const SCREEN_DEFS: Array<{ - width: number; - height: number; - x: number; - y: number; - z: number; - rotY?: number; -}> = [ - { width: 1.2, height: 0.75, x: -3.1, y: 2.2, z: -6.4 }, - { width: 1.25, height: 0.8, x: 2.9, y: 2.0, z: -6.8 }, - { width: 0.9, height: 0.55, x: -1.4, y: 3.0, z: -5.8, rotY: 0.12 }, - { width: 0.85, height: 0.52, x: 1.4, y: 3.1, z: -6.2, rotY: -0.12 }, -]; - -const THEME_LIGHT = { - fogColor: 0xf5f5f5, - fogDensity: 0.045, - gridColor: new THREE.Color(0.82, 0.84, 0.86), - gridCenterColor: new THREE.Color(0.7, 0.75, 0.8), - gridOpacity: 0.2, - gridCenterOpacity: 0.25, - screenEmissive: new THREE.Color(0.55, 0.75, 0.9), - screenBaseColor: new THREE.Color(0.92, 0.94, 0.96), - screenBorderColor: new THREE.Color(0.7, 0.72, 0.75), - screenOpacity: 0.35, - screenEmissiveIntensity: 0.25, - scanBaseOpacity: 0.15, - bgColor: 0xf5f5f5, -}; - -const THEME_DARK = { - fogColor: 0x08060e, - fogDensity: 0.035, - gridColor: new THREE.Color(0.11, 0.08, 0.2), - gridCenterColor: new THREE.Color(0.28, 0.19, 0.42), - gridOpacity: 0.26, - gridCenterOpacity: 0.34, - screenEmissive: new THREE.Color(0.72, 0.52, 0.22), - screenBaseColor: new THREE.Color(0.035, 0.03, 0.05), - screenBorderColor: new THREE.Color(0.72, 0.54, 0.24), - screenOpacity: 0.08, - screenEmissiveIntensity: 0.16, - scanBaseOpacity: 0.08, - bgColor: 0x08060e, -}; - -type ThemeConfig = typeof THEME_LIGHT; - -export class MathEnvironment { - private group = new THREE.Group(); - private gridHelper: THREE.GridHelper | null = null; - private gridMaterial: THREE.LineBasicMaterial | null = null; - private gridCenterMaterial: THREE.LineBasicMaterial | null = null; - private fog: THREE.FogExp2 | null = null; - private screens: THREE.Mesh[] = []; - private screenMaterials: THREE.MeshStandardMaterial[] = []; - private borderMeshes: THREE.LineSegments[] = []; - private borderMaterials: THREE.LineBasicMaterial[] = []; - private scanLineMeshes: THREE.Mesh[] = []; - private scanLineMaterials: THREE.MeshBasicMaterial[] = []; - private elapsedTime = 0; - private theme: "light" | "dark" = "dark"; - private sceneRef: THREE.Scene | null = null; - - /** Build and attach the environment to the given scene. */ - build(scene: THREE.Scene, theme: "light" | "dark"): void { - this.theme = theme; - this.sceneRef = scene; - const config = theme === "light" ? THEME_LIGHT : THEME_DARK; - - this.group.name = "MathEnvironment"; - - // White fog — everything fades to white at distance - this.fog = new THREE.FogExp2(config.fogColor, config.fogDensity); - scene.fog = this.fog; - scene.background = new THREE.Color(config.bgColor); - - // Grid floor — faint in light mode, neon in dark mode - this.gridMaterial = new THREE.LineBasicMaterial({ - color: config.gridColor, - transparent: true, - opacity: config.gridOpacity, - depthWrite: false, - }); - this.gridCenterMaterial = new THREE.LineBasicMaterial({ - color: config.gridCenterColor, - transparent: true, - opacity: config.gridCenterOpacity, - depthWrite: false, - }); - this.gridHelper = new THREE.GridHelper( - GRID_SIZE, - GRID_DIVISIONS, - config.gridCenterColor, - config.gridColor, - ); - this.gridHelper.position.y = GRID_Y; - const gridMats = this.gridHelper.material; - if (Array.isArray(gridMats)) { - for (const m of gridMats) { - (m as THREE.LineBasicMaterial).transparent = true; - (m as THREE.LineBasicMaterial).opacity = config.gridOpacity; - (m as THREE.LineBasicMaterial).depthWrite = false; - } - } - this.group.add(this.gridHelper); - - // Floating screen panels - this.buildScreens(config); - - scene.add(this.group); - } - - private buildScreens(config: ThemeConfig): void { - for (const def of SCREEN_DEFS) { - const geo = new THREE.PlaneGeometry(def.width, def.height); - - // Screen surface — slightly translucent, emissive glow - const mat = new THREE.MeshStandardMaterial({ - color: config.screenBaseColor, - emissive: config.screenEmissive, - emissiveIntensity: config.screenEmissiveIntensity, - transparent: true, - opacity: config.screenOpacity, - side: THREE.DoubleSide, - depthWrite: false, - }); - this.screenMaterials.push(mat); - - const mesh = new THREE.Mesh(geo, mat); - mesh.position.set(def.x, def.y, def.z); - if (def.rotY != null) { - mesh.rotation.y = def.rotY; - } else { - // Face toward origin - mesh.lookAt(0, def.y, 0); - } - this.screens.push(mesh); - this.group.add(mesh); - - // Thin border frame around each screen - const edgeGeo = new THREE.EdgesGeometry(geo); - const edgeMat = new THREE.LineBasicMaterial({ - color: config.screenBorderColor, - transparent: true, - opacity: 0.18, - depthWrite: false, - }); - this.borderMaterials.push(edgeMat); - const edgeMesh = new THREE.LineSegments(edgeGeo, edgeMat); - edgeMesh.position.copy(mesh.position); - edgeMesh.rotation.copy(mesh.rotation); - edgeMesh.quaternion.copy(mesh.quaternion); - this.borderMeshes.push(edgeMesh); - this.group.add(edgeMesh); - - // Horizontal scan line sweeping across each screen - const scanGeo = new THREE.PlaneGeometry(def.width * 0.92, 0.015); - const scanMat = new THREE.MeshBasicMaterial({ - color: config.screenEmissive, - transparent: true, - opacity: 0.08, - depthWrite: false, - side: THREE.DoubleSide, - }); - this.scanLineMaterials.push(scanMat); - const scanMesh = new THREE.Mesh(scanGeo, scanMat); - scanMesh.position.copy(mesh.position); - scanMesh.quaternion.copy(mesh.quaternion); - this.scanLineMeshes.push(scanMesh); - this.group.add(scanMesh); - } - } - - /** Per-frame update — call from the render loop. */ - update(deltaTime: number, _camera: THREE.Camera): void { - this.elapsedTime += deltaTime; - const config = this.theme === "light" ? THEME_LIGHT : THEME_DARK; - - for (let i = 0; i < this.screens.length; i++) { - const screen = this.screens[i]; - const def = SCREEN_DEFS[i]; - - // Gentle float / bob - screen.position.y = - def.y + Math.sin(this.elapsedTime * 0.35 + i * 1.4) * 0.04; - - // Sync border position - const border = this.borderMeshes[i]; - border.position.y = screen.position.y; - - // Emissive pulse — subtle in light, prominent neon glow in dark - const mat = this.screenMaterials[i]; - const baseEmissive = config.screenEmissiveIntensity; - const pulseRange = this.theme === "dark" ? 0.04 : 0.1; - mat.emissiveIntensity = - baseEmissive + Math.sin(this.elapsedTime * 0.6 + i * 0.8) * pulseRange; - - // Scan line sweeps vertically - const scan = this.scanLineMeshes[i]; - const scanPhase = ((this.elapsedTime * 0.2 + i * 0.5) % 1.0) * 2.0 - 1.0; - const upDir = new THREE.Vector3(0, 1, 0); - scan.position.copy(screen.position); - scan.position.addScaledVector(upDir, scanPhase * def.height * 0.45); - const scanMat = this.scanLineMaterials[i]; - scanMat.opacity = - config.scanBaseOpacity * (1.0 - Math.abs(scanPhase) * 0.5); - } - - // Grid subtle pulse - if (this.gridCenterMaterial) { - const basePulse = config.gridCenterOpacity; - this.gridCenterMaterial.opacity = - basePulse + Math.sin(this.elapsedTime * 0.3) * 0.05; - } - } - - /** Switch theme without rebuilding. */ - setTheme(theme: "light" | "dark"): void { - if (theme === this.theme) return; - this.theme = theme; - const config = theme === "light" ? THEME_LIGHT : THEME_DARK; - - if (this.fog) { - this.fog.color.set(config.fogColor); - this.fog.density = config.fogDensity; - } - if (this.sceneRef) { - this.sceneRef.background = new THREE.Color(config.bgColor); - } - if (this.gridMaterial) { - this.gridMaterial.color.copy(config.gridColor); - this.gridMaterial.opacity = config.gridOpacity; - } - if (this.gridCenterMaterial) { - this.gridCenterMaterial.color.copy(config.gridCenterColor); - this.gridCenterMaterial.opacity = config.gridCenterOpacity; - } - if (this.gridHelper) { - const gridMats = this.gridHelper.material; - if (Array.isArray(gridMats)) { - for (const m of gridMats) { - (m as THREE.LineBasicMaterial).opacity = config.gridOpacity; - } - } - } - for (const mat of this.screenMaterials) { - mat.color.copy(config.screenBaseColor); - mat.emissive.copy(config.screenEmissive); - mat.emissiveIntensity = config.screenEmissiveIntensity; - mat.opacity = config.screenOpacity; - } - for (const mat of this.borderMaterials) { - mat.color.copy(config.screenBorderColor); - } - for (const mat of this.scanLineMaterials) { - mat.color.copy(config.screenEmissive); - } - } - - /** Dispose all Three.js objects. */ - dispose(): void { - for (const mesh of this.screens) { - mesh.geometry.dispose(); - } - for (const mat of this.screenMaterials) { - mat.dispose(); - } - for (const mesh of this.borderMeshes) { - mesh.geometry.dispose(); - } - for (const mat of this.borderMaterials) { - mat.dispose(); - } - for (const mesh of this.scanLineMeshes) { - mesh.geometry.dispose(); - } - for (const mat of this.scanLineMaterials) { - mat.dispose(); - } - this.gridHelper?.geometry.dispose(); - this.gridMaterial?.dispose(); - this.gridCenterMaterial?.dispose(); - - if (this.sceneRef) { - this.sceneRef.remove(this.group); - this.sceneRef.fog = null; - this.sceneRef.background = null; - } - - this.screens = []; - this.screenMaterials = []; - this.borderMeshes = []; - this.borderMaterials = []; - this.scanLineMeshes = []; - this.scanLineMaterials = []; - this.gridHelper = null; - this.gridMaterial = null; - this.gridCenterMaterial = null; - this.fog = null; - this.sceneRef = null; - } -} diff --git a/plugins/plugin-companion/src/components/avatar/SceneOverlayManager.ts b/plugins/plugin-companion/src/components/avatar/SceneOverlayManager.ts deleted file mode 100644 index 388e2e52b3fc1..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/SceneOverlayManager.ts +++ /dev/null @@ -1,414 +0,0 @@ -/** - * SceneOverlayManager — manages holographic floating panels in the three.js scene. - * - * Creates billboard panels (chat, agent status, heartbeats) as textured - * planes with emissive materials, plus additional chat-mirror panels - * scattered around the scene to create the "floating screens with chat" - * effect in the Matrix Construct environment. - */ - -import * as THREE from "three"; -import { - type AgentStatusOverlay, - type ChatOverlayMessage, - renderChatPanel, - renderHeartbeatsPanel, - renderStatusPanel, - type TriggerOverlay, -} from "./scene-overlay-renderer"; - -// -- Panel configuration ------------------------------------------------------ - -/** Canvas resolution multiplier for crisp text. */ -const CANVAS_SCALE = 2; - -interface PanelConfig { - /** World-space position of the panel center. */ - position: THREE.Vector3; - /** World-space size (width, height) of the panel quad. */ - size: [width: number, height: number]; - /** Canvas pixel dimensions before CANVAS_SCALE. */ - canvasSize: [width: number, height: number]; -} - -const CHAT_PANEL: PanelConfig = { - position: new THREE.Vector3(-0.8, 1.3, 0.2), - size: [1.0, 1.5], - canvasSize: [360, 540], -}; - -const STATUS_PANEL: PanelConfig = { - position: new THREE.Vector3(0.8, 1.6, 0.2), - size: [0.9, 0.55], - canvasSize: [360, 220], -}; - -const HEARTBEATS_PANEL: PanelConfig = { - position: new THREE.Vector3(0.8, 0.9, 0.2), - size: [0.9, 0.65], - canvasSize: [360, 260], -}; - -/** Extra chat-mirror panels positioned among the floating screens. */ -const CHAT_MIRROR_PANELS: PanelConfig[] = [ - { - // Back-left screen - position: new THREE.Vector3(-3.0, 1.7, -5.2), - size: [1.6, 2.4], - canvasSize: [320, 480], - }, - { - // Back-center screen - position: new THREE.Vector3(0.6, 2.1, -5.8), - size: [1.8, 2.6], - canvasSize: [340, 500], - }, - { - // Right side screen - position: new THREE.Vector3(3.6, 1.4, -5.0), - size: [1.4, 2.0], - canvasSize: [300, 440], - }, -]; - -// -- OverlayPanel helper ------------------------------------------------------ - -interface OverlayPanel { - group: THREE.Group; - mesh: THREE.Mesh; - glowMesh: THREE.Mesh; - canvas: HTMLCanvasElement; - ctx: CanvasRenderingContext2D; - texture: THREE.CanvasTexture; - dirty: boolean; - /** Current opacity for fade-in animation. */ - opacity: number; - /** Target opacity (1 when data present, 0 when empty). */ - targetOpacity: number; -} - -function createPanel(config: PanelConfig): OverlayPanel { - const [cw, ch] = config.canvasSize; - const scaledW = cw * CANVAS_SCALE; - const scaledH = ch * CANVAS_SCALE; - - const canvas = document.createElement("canvas"); - canvas.width = scaledW; - canvas.height = scaledH; - const ctx = canvas.getContext("2d"); - if (!ctx) throw new Error("Failed to get 2D context for overlay panel"); - - ctx.scale(CANVAS_SCALE, CANVAS_SCALE); - - const texture = new THREE.CanvasTexture(canvas); - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.colorSpace = THREE.SRGBColorSpace; - - const [w, h] = config.size; - - const geometry = new THREE.PlaneGeometry(w, h); - const material = new THREE.MeshBasicMaterial({ - map: texture, - transparent: true, - opacity: 0, - depthWrite: false, - side: THREE.DoubleSide, - }); - const mesh = new THREE.Mesh(geometry, material); - - // Subtle glow plane behind the panel — soft blue for construct theme - const glowGeometry = new THREE.PlaneGeometry(w * 1.08, h * 1.08); - const glowMaterial = new THREE.MeshBasicMaterial({ - color: new THREE.Color(0x6a9fd8), - transparent: true, - opacity: 0, - depthWrite: false, - side: THREE.DoubleSide, - }); - const glowMesh = new THREE.Mesh(glowGeometry, glowMaterial); - glowMesh.position.z = -0.01; - - const group = new THREE.Group(); - group.name = "OverlayPanel"; - group.position.copy(config.position); - group.add(glowMesh); - group.add(mesh); - - return { - group, - mesh, - glowMesh, - canvas, - ctx, - texture, - dirty: true, - opacity: 0, - targetOpacity: 0, - }; -} - -function disposePanel(panel: OverlayPanel): void { - const mat = panel.mesh.material as THREE.MeshBasicMaterial; - mat.map?.dispose(); - mat.dispose(); - panel.mesh.geometry.dispose(); - - const glowMat = panel.glowMesh.material as THREE.MeshBasicMaterial; - glowMat.dispose(); - panel.glowMesh.geometry.dispose(); - - panel.texture.dispose(); - panel.group.removeFromParent(); -} - -// -- JSON-stable shallow comparison ------------------------------------------- - -function shallowArrayEquals(a: T[], b: T[], keys: (keyof T)[]): boolean { - if (a.length !== b.length) return false; - for (let i = 0; i < a.length; i++) { - for (const key of keys) { - if (a[i]?.[key] !== b[i]?.[key]) return false; - } - } - return true; -} - -// -- SceneOverlayManager ----------------------------------------------------- - -export class SceneOverlayManager { - private chatPanel: OverlayPanel; - private statusPanel: OverlayPanel; - private heartbeatsPanel: OverlayPanel; - private chatMirrorPanels: OverlayPanel[] = []; - private attached = false; - private disposed = false; - - // Data snapshots for dirty checking - private chatData: ChatOverlayMessage[] = []; - private statusData: AgentStatusOverlay | null = null; - private heartbeatsData: TriggerOverlay[] = []; - - private fontsChecked = false; - - constructor() { - this.chatPanel = createPanel(CHAT_PANEL); - this.statusPanel = createPanel(STATUS_PANEL); - this.heartbeatsPanel = createPanel(HEARTBEATS_PANEL); - - // Create chat-mirror panels that echo the conversation onto distant screens - for (const config of CHAT_MIRROR_PANELS) { - this.chatMirrorPanels.push(createPanel(config)); - } - } - - /** Add panel groups to the scene. Called once when the engine is ready. */ - attach(scene: THREE.Scene): void { - if (this.attached || this.disposed) return; - scene.add(this.chatPanel.group); - scene.add(this.statusPanel.group); - scene.add(this.heartbeatsPanel.group); - for (const mirror of this.chatMirrorPanels) { - scene.add(mirror.group); - } - this.attached = true; - } - - /** - * Per-frame update: billboard panels toward camera, animate opacity, - * and repaint dirty canvases. - */ - update(camera: THREE.PerspectiveCamera, delta: number): void { - if (this.disposed || !this.attached) return; - - // Lazy font check - if (!this.fontsChecked) { - this.fontsChecked = true; - void document.fonts.ready.then(() => { - if (this.disposed) return; - this.chatPanel.dirty = true; - this.statusPanel.dirty = true; - this.heartbeatsPanel.dirty = true; - for (const mirror of this.chatMirrorPanels) { - mirror.dirty = true; - } - }); - } - - this.updatePanel(this.chatPanel, camera, delta); - this.updatePanel(this.statusPanel, camera, delta); - this.updatePanel(this.heartbeatsPanel, camera, delta); - for (const mirror of this.chatMirrorPanels) { - this.updatePanel(mirror, camera, delta); - } - - // Repaint dirty canvases - if (this.chatPanel.dirty) { - this.chatPanel.dirty = false; - this.chatPanel.ctx.save(); - this.chatPanel.ctx.setTransform(CANVAS_SCALE, 0, 0, CANVAS_SCALE, 0, 0); - renderChatPanel( - this.chatPanel.ctx, - CHAT_PANEL.canvasSize[0], - CHAT_PANEL.canvasSize[1], - this.chatData, - ); - this.chatPanel.ctx.restore(); - this.chatPanel.texture.needsUpdate = true; - } - - if (this.statusPanel.dirty) { - this.statusPanel.dirty = false; - this.statusPanel.ctx.save(); - this.statusPanel.ctx.setTransform(CANVAS_SCALE, 0, 0, CANVAS_SCALE, 0, 0); - renderStatusPanel( - this.statusPanel.ctx, - STATUS_PANEL.canvasSize[0], - STATUS_PANEL.canvasSize[1], - this.statusData, - ); - this.statusPanel.ctx.restore(); - this.statusPanel.texture.needsUpdate = true; - } - - if (this.heartbeatsPanel.dirty) { - this.heartbeatsPanel.dirty = false; - this.heartbeatsPanel.ctx.save(); - this.heartbeatsPanel.ctx.setTransform( - CANVAS_SCALE, - 0, - 0, - CANVAS_SCALE, - 0, - 0, - ); - renderHeartbeatsPanel( - this.heartbeatsPanel.ctx, - HEARTBEATS_PANEL.canvasSize[0], - HEARTBEATS_PANEL.canvasSize[1], - this.heartbeatsData, - ); - this.heartbeatsPanel.ctx.restore(); - this.heartbeatsPanel.texture.needsUpdate = true; - } - - // Repaint chat-mirror panels - for (let i = 0; i < this.chatMirrorPanels.length; i++) { - const mirror = this.chatMirrorPanels[i]; - if (mirror.dirty) { - mirror.dirty = false; - const config = CHAT_MIRROR_PANELS[i]; - mirror.ctx.save(); - mirror.ctx.setTransform(CANVAS_SCALE, 0, 0, CANVAS_SCALE, 0, 0); - renderChatPanel( - mirror.ctx, - config.canvasSize[0], - config.canvasSize[1], - this.chatData, - ); - mirror.ctx.restore(); - mirror.texture.needsUpdate = true; - } - } - } - - // -- Data setters ----------------------------------------------------------- - - setChatMessages(messages: ChatOverlayMessage[]): void { - if (this.disposed) return; - if (shallowArrayEquals(this.chatData, messages, ["id", "role", "text"])) { - return; - } - this.chatData = messages.map((m) => ({ ...m })); - this.chatPanel.dirty = true; - this.chatPanel.targetOpacity = 1; - - // Mark all chat-mirror panels dirty too - for (const mirror of this.chatMirrorPanels) { - mirror.dirty = true; - mirror.targetOpacity = 1; - } - } - - setAgentStatus(status: AgentStatusOverlay | null): void { - if (this.disposed) return; - const prev = this.statusData; - if ( - prev?.state === status?.state && - prev?.agentName === status?.agentName && - prev?.uptime === status?.uptime && - prev?.sessions.length === (status?.sessions.length ?? 0) - ) { - return; - } - this.statusData = status - ? { ...status, sessions: status.sessions.map((s) => ({ ...s })) } - : null; - this.statusPanel.dirty = true; - this.statusPanel.targetOpacity = status ? 1 : 0; - } - - setHeartbeats(triggers: TriggerOverlay[]): void { - if (this.disposed) return; - if ( - shallowArrayEquals(this.heartbeatsData, triggers, [ - "id", - "enabled", - "lastStatus", - ]) - ) { - return; - } - this.heartbeatsData = triggers.map((t) => ({ ...t })); - this.heartbeatsPanel.dirty = true; - this.heartbeatsPanel.targetOpacity = triggers.length > 0 ? 1 : 0; - } - - // -- Cleanup ---------------------------------------------------------------- - - dispose(): void { - if (this.disposed) return; - this.disposed = true; - disposePanel(this.chatPanel); - disposePanel(this.statusPanel); - disposePanel(this.heartbeatsPanel); - for (const mirror of this.chatMirrorPanels) { - disposePanel(mirror); - } - this.chatMirrorPanels = []; - } - - // -- Internal --------------------------------------------------------------- - - private updatePanel( - panel: OverlayPanel, - camera: THREE.PerspectiveCamera, - delta: number, - ): void { - // Billboard: make panel face the camera - panel.group.quaternion.copy(camera.quaternion); - - // Animate opacity - const fadeSpeed = 3.0; - if (Math.abs(panel.opacity - panel.targetOpacity) > 0.001) { - if (panel.opacity < panel.targetOpacity) { - panel.opacity = Math.min( - panel.targetOpacity, - panel.opacity + delta * fadeSpeed, - ); - } else { - panel.opacity = Math.max( - panel.targetOpacity, - panel.opacity - delta * fadeSpeed, - ); - } - const mat = panel.mesh.material as THREE.MeshBasicMaterial; - mat.opacity = panel.opacity * 0.92; - - const glowMat = panel.glowMesh.material as THREE.MeshBasicMaterial; - glowMat.opacity = panel.opacity * 0.03; - } - - panel.group.visible = panel.opacity > 0.001; - } -} diff --git a/plugins/plugin-companion/src/components/avatar/VrmAnimationLoader.ts b/plugins/plugin-companion/src/components/avatar/VrmAnimationLoader.ts deleted file mode 100644 index 2ecb41167cea5..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/VrmAnimationLoader.ts +++ /dev/null @@ -1,147 +0,0 @@ -import type { VRM } from "@pixiv/three-vrm"; -import type * as THREE from "three"; -import { FBXLoader } from "three/examples/jsm/loaders/FBXLoader.js"; -import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; -import { retargetMixamoFbxToVrm } from "./retargetMixamoFbxToVrm"; -import { retargetMixamoGltfToVrm } from "./retargetMixamoGltfToVrm"; - -/** - * Context needed by the animation loader to check whether the owning engine - * is still alive / relevant for the load request. - */ -export type AnimationLoaderContext = { - /** Returns `true` if the loading sequence was aborted (engine disposed). */ - isAborted: () => boolean; - /** Returns `true` if `vrm` is still the active model in the engine. */ - isCurrentVrm: (vrm: VRM) => boolean; -}; - -function isGzipBuffer(buffer: ArrayBuffer): boolean { - if (buffer.byteLength < 2) return false; - const bytes = new Uint8Array(buffer, 0, 2); - return bytes[0] === 0x1f && bytes[1] === 0x8b; -} - -async function decompressGzipBuffer(buffer: ArrayBuffer): Promise { - if (typeof DecompressionStream !== "function") { - throw new Error( - "This runtime does not support gzip-compressed animation assets.", - ); - } - - const stream = new Blob([buffer]) - .stream() - .pipeThrough(new DecompressionStream("gzip")); - return await new Response(stream).arrayBuffer(); -} - -async function fetchAnimationBuffer(path: string): Promise { - const response = await fetch(path); - if (!response.ok) { - throw new Error(`Failed to fetch animation asset: ${response.status}`); - } - - const buffer = await response.arrayBuffer(); - return isGzipBuffer(buffer) ? await decompressGzipBuffer(buffer) : buffer; -} - -function getAssetResourcePath(path: string): string { - const withoutQuery = path.split(/[?#]/, 1)[0] ?? path; - const lastSlash = withoutQuery.lastIndexOf("/"); - return lastSlash >= 0 ? withoutQuery.slice(0, lastSlash + 1) : "./"; -} - -function isFbxAsset(path: string): boolean { - const normalized = path.toLowerCase(); - return normalized.endsWith(".fbx") || normalized.endsWith(".fbx.gz"); -} - -/** - * Load and return an idle {@link THREE.AnimationClip} for the given VRM. - * - * Loads the GLB idle animation and retargets it to VRM bones. - * Returns `null` when the load was aborted (engine disposed / VRM replaced). - * Throws when the idle clip cannot be loaded. - */ -export async function loadIdleClip( - vrm: VRM, - idleGlbUrl: string, - ctx: AnimationLoaderContext, -): Promise { - if (ctx.isAborted() || !ctx.isCurrentVrm(vrm)) return null; - - const gltfLoader = new GLTFLoader(); - const gltf = await gltfLoader.parseAsync( - await fetchAnimationBuffer(idleGlbUrl), - getAssetResourcePath(idleGlbUrl), - ); - if (ctx.isAborted() || !ctx.isCurrentVrm(vrm)) return null; - - gltf.scene.updateMatrixWorld(true); - vrm.scene.updateMatrixWorld(true); - const clip = retargetMixamoGltfToVrm( - { scene: gltf.scene, animations: gltf.animations }, - vrm, - ); - - if (!clip) { - throw new Error("No usable idle animation (idle.glb)"); - } - - if (ctx.isAborted() || !ctx.isCurrentVrm(vrm)) return null; - return clip; -} - -/** - * Load a single emote animation clip (GLB/FBX) and retarget it to - * the supplied VRM. Returns `null` when the load was aborted or the file - * format could not be processed. - * - * Supports both `.glb` / `.gltf` files (retargeted via retargetMixamoGltfToVrm) - * and Mixamo `.fbx` files (retargeted via retargetMixamoFbxToVrm). - */ -export async function loadEmoteClip( - path: string, - vrm: VRM, - ctx: AnimationLoaderContext, -): Promise { - try { - if (!ctx.isCurrentVrm(vrm)) return null; - - const isFbx = isFbxAsset(path); - - if (isFbx) { - const fbxLoader = new FBXLoader(); - const fbx = fbxLoader.parse( - await fetchAnimationBuffer(path), - getAssetResourcePath(path), - ); - if (!ctx.isCurrentVrm(vrm)) return null; - - const sourceClip = fbx.animations[0]; - if (!sourceClip) { - console.warn(`[VrmEngine] FBX has no animations: ${path}`); - return null; - } - const retargeted = retargetMixamoFbxToVrm(fbx, sourceClip, vrm); - return retargeted; - } - - const loader = new GLTFLoader(); - const gltf = await loader.parseAsync( - await fetchAnimationBuffer(path), - getAssetResourcePath(path), - ); - if (!ctx.isCurrentVrm(vrm)) return null; - - gltf.scene.updateMatrixWorld(true); - vrm.scene.updateMatrixWorld(true); - return retargetMixamoGltfToVrm( - { scene: gltf.scene, animations: gltf.animations }, - vrm, - ); - } catch (err) { - console.error(`[VrmEngine] Failed to load emote: ${path}`, err); - return null; - } -} diff --git a/plugins/plugin-companion/src/components/avatar/VrmBlinkController.ts b/plugins/plugin-companion/src/components/avatar/VrmBlinkController.ts deleted file mode 100644 index bb283205bd78d..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/VrmBlinkController.ts +++ /dev/null @@ -1,118 +0,0 @@ -/** Blink animation phase */ -type BlinkPhase = "idle" | "closing" | "closed" | "opening"; - -/** - * Self-contained blink state machine for VRM eye-blink animation. - * - * State flow: idle -> closing -> closed -> opening -> idle - * Random interval between blinks with occasional double-blinks. - */ -export class VrmBlinkController { - private blinkPhase: BlinkPhase = "idle"; - private blinkTimer = 0; - private blinkPhaseTimer = 0; - private _blinkValue = 0; - private nextBlinkDelay = 2 + Math.random() * 3; - - /** Duration (seconds) for eyelids to close */ - private static readonly BLINK_CLOSE_DURATION = 0.06; - /** Duration (seconds) eyelids stay fully closed */ - private static readonly BLINK_HOLD_DURATION = 0.04; - /** Duration (seconds) for eyelids to re-open */ - private static readonly BLINK_OPEN_DURATION = 0.12; - /** Minimum seconds between blinks */ - private static readonly BLINK_MIN_INTERVAL = 1.8; - /** Maximum seconds between blinks */ - private static readonly BLINK_MAX_INTERVAL = 5.5; - /** Probability of a quick double-blink */ - private static readonly DOUBLE_BLINK_CHANCE = 0.15; - - /** Current blink expression weight (0 = open, 1 = closed). */ - get blinkValue(): number { - return this._blinkValue; - } - - /** - * Advance the blink state machine by `delta` seconds. - * Returns the current blink expression weight (0..1). - */ - update(delta: number): number { - switch (this.blinkPhase) { - case "idle": - this.blinkTimer += delta; - if (this.blinkTimer >= this.nextBlinkDelay) { - this.blinkPhase = "closing"; - this.blinkPhaseTimer = 0; - } - break; - - case "closing": { - this.blinkPhaseTimer += delta; - const t = Math.min( - 1, - this.blinkPhaseTimer / VrmBlinkController.BLINK_CLOSE_DURATION, - ); - // Ease-in (accelerate) — eyelids speed up as they close - this._blinkValue = t * t; - if (t >= 1) { - this.blinkPhase = "closed"; - this.blinkPhaseTimer = 0; - this._blinkValue = 1; - } - break; - } - - case "closed": - this.blinkPhaseTimer += delta; - if (this.blinkPhaseTimer >= VrmBlinkController.BLINK_HOLD_DURATION) { - this.blinkPhase = "opening"; - this.blinkPhaseTimer = 0; - } - break; - - case "opening": { - this.blinkPhaseTimer += delta; - const t = Math.min( - 1, - this.blinkPhaseTimer / VrmBlinkController.BLINK_OPEN_DURATION, - ); - // Ease-out (decelerate) — eyelids slow down as they finish opening - const eased = 1 - (1 - t) * (1 - t); - this._blinkValue = 1 - eased; - if (t >= 1) { - this.blinkPhase = "idle"; - this.blinkPhaseTimer = 0; - this._blinkValue = 0; - this.blinkTimer = 0; - this.scheduleNextBlink(); - } - break; - } - } - - return this._blinkValue; - } - - /** Reset blink state (called when a new VRM is loaded). */ - reset(): void { - this.blinkPhase = "idle"; - this.blinkTimer = 0; - this.blinkPhaseTimer = 0; - this._blinkValue = 0; - this.nextBlinkDelay = 1.5 + Math.random() * 2; - } - - /** Pick the delay (seconds) until the next blink. */ - private scheduleNextBlink(): void { - const range = - VrmBlinkController.BLINK_MAX_INTERVAL - - VrmBlinkController.BLINK_MIN_INTERVAL; - this.nextBlinkDelay = - VrmBlinkController.BLINK_MIN_INTERVAL + Math.random() * range; - - // Occasional quick double-blink - if (Math.random() < VrmBlinkController.DOUBLE_BLINK_CHANCE) { - this.nextBlinkDelay = 0.12 + Math.random() * 0.08; - } - } -} diff --git a/plugins/plugin-companion/src/components/avatar/VrmCameraManager.ts b/plugins/plugin-companion/src/components/avatar/VrmCameraManager.ts deleted file mode 100644 index f6b4c33f84d9f..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/VrmCameraManager.ts +++ /dev/null @@ -1,385 +0,0 @@ -import type { VRM } from "@pixiv/three-vrm"; -import * as THREE from "three"; -import type { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"; - -const sizeScratch = new THREE.Vector3(); - -export type CameraProfile = "chat" | "companion"; -export type InteractionMode = "free" | "orbitZoom"; - -export type CameraAnimationConfig = { - enabled: boolean; - swayAmplitude: number; - bobAmplitude: number; - rotationAmplitude: number; - speed: number; -}; - -/** - * Handles VRM avatar framing, camera profile application, companion-mode - * bounds-based camera fitting, subtle companion camera motion, interaction modes, - * and VRM face-orientation correction. - */ -export class VrmCameraManager { - private readonly tempBoundsSize = new THREE.Vector3(); - private readonly tempBoundsCenter = new THREE.Vector3(); - private readonly tempWorldPosition = new THREE.Vector3(); - private readonly tempSecondaryWorldPosition = new THREE.Vector3(); - private readonly tempTertiaryWorldPosition = new THREE.Vector3(); - private readonly tempOrbitOffset = new THREE.Vector3(); - private readonly tempOrbitSpherical = new THREE.Spherical(); - - /** - * Position and scale the VRM for the active camera profile, then place the - * camera accordingly. Updates `lookAtTarget` and `baseCameraPosition` in place. - */ - centerAndFrame( - vrm: VRM, - camera: THREE.PerspectiveCamera, - controls: OrbitControls | null, - cameraProfile: CameraProfile, - lookAtTarget: THREE.Vector3, - baseCameraPosition: THREE.Vector3, - applyInteractionMode: (controls: OrbitControls) => void, - skipControlUpdate = false, - ): void { - this.normalizeAvatarToStage(vrm, cameraProfile); - vrm.scene.updateMatrixWorld(true); - camera.near = 0.1; - camera.far = 100.0; - this.applyCameraProfileToCamera(camera, controls, cameraProfile); - this.adjustCompanionCameraForAvatarBounds( - vrm, - camera, - controls, - cameraProfile, - lookAtTarget, - ); - camera.updateProjectionMatrix(); - baseCameraPosition.copy(camera.position); - - if (controls) { - if (!skipControlUpdate) { - controls.target.copy(lookAtTarget); - } - applyInteractionMode(controls); - if (!skipControlUpdate) { - controls.update(); - } - } - } - - private normalizeAvatarToStage(vrm: VRM, cameraProfile: CameraProfile): void { - vrm.scene.scale.setScalar(1); - vrm.scene.position.set(0, 0, 0); - vrm.scene.updateMatrixWorld(true); - - const initialBounds = new THREE.Box3().setFromObject(vrm.scene); - if (initialBounds.isEmpty()) return; - - const initialSize = initialBounds.getSize(this.tempBoundsSize); - const avatarHeight = Math.max(initialSize.y, 1e-3); - const targetHeight = cameraProfile === "chat" ? 1.62 : 1.76; - const normalizedScale = THREE.MathUtils.clamp( - targetHeight / avatarHeight, - 0.75, - 2.35, - ); - - vrm.scene.scale.setScalar(normalizedScale); - vrm.scene.updateMatrixWorld(true); - - const normalizedBounds = new THREE.Box3().setFromObject(vrm.scene); - if (normalizedBounds.isEmpty()) return; - - const feetAnchor = this.getAvatarFeetAnchor(vrm, normalizedBounds); - normalizedBounds.getCenter(this.tempBoundsCenter); - vrm.scene.position.set( - -this.tempBoundsCenter.x, - -feetAnchor.y, - -this.tempBoundsCenter.z, - ); - vrm.scene.updateMatrixWorld(true); - } - - /** - * For the companion profile, adapt camera distance so the full avatar - * body stays in frame regardless of model dimensions. - */ - adjustCompanionCameraForAvatarBounds( - vrm: VRM, - camera: THREE.PerspectiveCamera, - controls: OrbitControls | null, - cameraProfile: CameraProfile, - lookAtTarget: THREE.Vector3, - ): void { - const bounds = new THREE.Box3().setFromObject(vrm.scene); - if (bounds.isEmpty()) return; - - const size = this.tempBoundsSize; - const center = this.tempBoundsCenter; - bounds.getSize(size); - bounds.getCenter(center); - - if ( - !Number.isFinite(size.x) || - !Number.isFinite(size.y) || - !Number.isFinite(size.z) - ) { - return; - } - - const verticalPadding = cameraProfile === "chat" ? 1.18 : 1.1; - const horizontalPadding = cameraProfile === "chat" ? 1.18 : 1.08; - const halfHeight = Math.max((size.y * verticalPadding) / 2, 0.58); - const halfWidth = Math.max((size.x * horizontalPadding) / 2, 0.4); - - const verticalFov = THREE.MathUtils.degToRad(camera.fov); - const horizontalFov = - 2 * Math.atan(Math.max(1e-4, Math.tan(verticalFov / 2) * camera.aspect)); - - const distanceByHeight = - halfHeight / Math.max(1e-4, Math.tan(verticalFov / 2)); - const distanceByWidth = - halfWidth / Math.max(1e-4, Math.tan(horizontalFov / 2)); - const fitDistance = Math.max(distanceByHeight, distanceByWidth); - const neckY = this.getAvatarNeckHeight(vrm, bounds); - let lookAtY = neckY; - let distance = fitDistance; - let cameraY = neckY + Math.min(size.y * 0.08, 0.18); - - if (cameraProfile === "companion") { - lookAtY = neckY; - distance = Math.max(9.6, fitDistance * 1.35); - cameraY = neckY + Math.min(size.y * 0.1, 0.18); - } else { - lookAtY = THREE.MathUtils.clamp( - neckY - size.y * 0.08, - bounds.min.y + size.y * 0.38, - bounds.max.y - size.y * 0.16, - ); - distance = Math.max(5.6, fitDistance * 1.02); - cameraY = lookAtY + Math.min(size.y * 0.12, 0.24); - } - - lookAtTarget.set(center.x, lookAtY, center.z); - camera.position.set(center.x, cameraY, center.z + distance); - - if (controls) { - controls.minDistance = Math.max(2.8, distance * 0.7); - controls.maxDistance = Math.max(12.8, distance * 1.8); - } - } - - private getAvatarFeetAnchor(vrm: VRM, bounds: THREE.Box3): THREE.Vector3 { - const humanoid = vrm.humanoid; - const leftFoot = humanoid?.getNormalizedBoneNode("leftFoot"); - const rightFoot = humanoid?.getNormalizedBoneNode("rightFoot"); - if (leftFoot && rightFoot) { - leftFoot.getWorldPosition(this.tempWorldPosition); - rightFoot.getWorldPosition(this.tempSecondaryWorldPosition); - return this.tempTertiaryWorldPosition - .copy(this.tempWorldPosition) - .add(this.tempSecondaryWorldPosition) - .multiplyScalar(0.5); - } - - const center = bounds.getCenter(this.tempTertiaryWorldPosition); - return center.set(center.x, bounds.min.y, center.z); - } - - private getAvatarNeckHeight(vrm: VRM, bounds: THREE.Box3): number { - const humanoid = vrm.humanoid; - const neckNode = humanoid?.getNormalizedBoneNode("neck"); - if (neckNode) { - neckNode.getWorldPosition(this.tempWorldPosition); - if (Number.isFinite(this.tempWorldPosition.y)) { - return this.tempWorldPosition.y; - } - } - - const headNode = humanoid?.getNormalizedBoneNode("head"); - const chestNode = - humanoid?.getNormalizedBoneNode("upperChest") ?? - humanoid?.getNormalizedBoneNode("chest") ?? - humanoid?.getNormalizedBoneNode("spine"); - if (headNode && chestNode) { - headNode.getWorldPosition(this.tempWorldPosition); - chestNode.getWorldPosition(this.tempSecondaryWorldPosition); - const averagedY = - (this.tempWorldPosition.y + this.tempSecondaryWorldPosition.y) / 2; - if (Number.isFinite(averagedY)) { - return averagedY; - } - } - - return bounds.min.y + Math.max(bounds.getSize(sizeScratch).y * 0.72, 0.9); - } - - /** - * Apply preset camera position, FOV and orbit constraints for the given - * camera profile. - */ - applyCameraProfileToCamera( - camera: THREE.PerspectiveCamera, - controls: OrbitControls | null, - _cameraProfile: CameraProfile, - ): void { - camera.fov = 12; - camera.near = 2.5; - if (controls) { - controls.minDistance = 4.0; - controls.maxDistance = 10.0; - controls.minPolarAngle = Math.PI * 0.06; - controls.maxPolarAngle = Math.PI * 0.94; - controls.minAzimuthAngle = -Infinity; - controls.maxAzimuthAngle = Infinity; - } - } - - /** - * Animate the camera in a shallow front-facing orbit around the avatar's - * look target so companion mode feels alive without breaking the framing. - */ - applyCameraMotion( - camera: THREE.PerspectiveCamera, - baseCameraPosition: THREE.Vector3, - lookAtTarget: THREE.Vector3, - cameraAnimation: CameraAnimationConfig, - elapsedTime: number, - ): void { - const baseOffset = this.tempOrbitOffset - .copy(baseCameraPosition) - .sub(lookAtTarget); - if (baseOffset.lengthSq() < 1e-6) { - camera.position.copy(baseCameraPosition); - return; - } - - const spherical = this.tempOrbitSpherical.setFromVector3(baseOffset); - const t = elapsedTime * Math.max(cameraAnimation.speed, 1e-3); - - // Layered low-frequency motion keeps the camera drifting without ever - // swinging wide enough to leave the avatar's front hemisphere. - const yawSeed = - Math.sin(t * 0.21 + 0.35) * 0.58 + - Math.sin(t * 0.11 + 1.8) * 0.29 + - Math.sin(t * 0.37 + 2.6) * 0.13; - const pitchSeed = - Math.sin(t * 0.17 + 0.9) * 0.55 + - Math.sin(t * 0.31 + 2.1) * 0.3 + - Math.sin(t * 0.07 + 0.2) * 0.15; - const radiusSeed = - Math.sin(t * 0.13 + 1.2) * 0.62 + Math.sin(t * 0.23 + 2.7) * 0.38; - - const yawRange = THREE.MathUtils.clamp( - cameraAnimation.swayAmplitude * 4.2 + - cameraAnimation.rotationAmplitude * 3.8, - 0.05, - 0.22, - ); - const pitchRange = THREE.MathUtils.clamp( - cameraAnimation.bobAmplitude * 1.8 + - cameraAnimation.rotationAmplitude * 1.4, - 0.015, - 0.085, - ); - const radiusRange = THREE.MathUtils.clamp( - cameraAnimation.swayAmplitude * 2.4 + cameraAnimation.bobAmplitude * 1.1, - 0.025, - 0.18, - ); - - spherical.theta += yawSeed * yawRange; - spherical.phi = THREE.MathUtils.clamp( - spherical.phi + pitchSeed * pitchRange, - 0.42, - Math.PI - 0.42, - ); - spherical.radius = Math.max( - 0.5, - spherical.radius + radiusSeed * radiusRange, - ); - - camera.position - .copy(lookAtTarget) - .add(baseOffset.setFromSpherical(spherical)); - } - - /** Configure OrbitControls for the given interaction mode. */ - applyInteractionMode( - controls: OrbitControls, - interactionMode: InteractionMode, - ): void { - if (interactionMode === "orbitZoom") { - controls.enablePan = false; - controls.enableRotate = true; - controls.enableZoom = true; - controls.screenSpacePanning = false; - controls.rotateSpeed = 1.15; - controls.zoomSpeed = 0.85; - return; - } - - controls.enablePan = true; - controls.enableRotate = true; - controls.enableZoom = true; - controls.screenSpacePanning = true; - controls.rotateSpeed = 0.75; - controls.zoomSpeed = 0.9; - } - - /** - * Detect whether the VRM is facing away from the camera using eye-bone - * heuristics, and rotate it 180 degrees if needed. - */ - ensureFacingCamera(vrm: VRM, camera: THREE.PerspectiveCamera): void { - vrm.scene.updateMatrixWorld(true); - - const forward = new THREE.Vector3(); - const humanoid = vrm.humanoid; - const leftEye = humanoid?.getNormalizedBoneNode("leftEye"); - const rightEye = humanoid?.getNormalizedBoneNode("rightEye"); - - if (leftEye && rightEye) { - const left = new THREE.Vector3(); - const right = new THREE.Vector3(); - leftEye.getWorldPosition(left); - rightEye.getWorldPosition(right); - - const eyeRight = right.sub(left); - if (eyeRight.lengthSq() > 1e-6) { - // Up x Right best matches this VRM rig orientation in our current scene setup. - forward - .copy(new THREE.Vector3(0, 1, 0)) - .cross(eyeRight) - .normalize(); - } - } - - if (forward.lengthSq() < 1e-6) { - // Fallback when eye bones are unavailable. - vrm.scene.getWorldDirection(forward); - } - - const anchor = - humanoid?.getNormalizedBoneNode("head") ?? - humanoid?.getNormalizedBoneNode("hips") ?? - vrm.scene; - const anchorPos = new THREE.Vector3(); - anchor.getWorldPosition(anchorPos); - const toCamera = new THREE.Vector3().subVectors(camera.position, anchorPos); - - forward.y = 0; - toCamera.y = 0; - if (forward.lengthSq() < 1e-6 || toCamera.lengthSq() < 1e-6) return; - - forward.normalize(); - toCamera.normalize(); - - if (forward.dot(toCamera) < 0) { - vrm.scene.rotateY(Math.PI); - vrm.scene.updateMatrixWorld(true); - } - } -} diff --git a/plugins/plugin-companion/src/components/avatar/VrmEngine.ts b/plugins/plugin-companion/src/components/avatar/VrmEngine.ts deleted file mode 100644 index d5f6a743863a9..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/VrmEngine.ts +++ /dev/null @@ -1,2656 +0,0 @@ -import { resolveAppAssetUrl } from "@elizaos/ui/utils"; -import { - MToonMaterialLoaderPlugin, - type VRM, - VRMLoaderPlugin, - VRMUtils, -} from "@pixiv/three-vrm"; -import * as THREE from "three"; -import { MathEnvironment } from "./MathEnvironment"; -import { SceneOverlayManager } from "./SceneOverlayManager"; -import type { - TeleportSparkleParticle, - TeleportSparkleSystem, -} from "./VrmTeleportEffect"; - -/** - * TSL node for MeshStandardMaterial - not in public @types/three. - * Used for emissiveNode/opacityNode in NodeMaterial (three/tsl). - */ -interface TslMaterialNode { - mul?(v: unknown): unknown; - add?(v: unknown): unknown; -} - -/** Three.js NodeMaterial exposes emissiveNode/opacityNode but they are not in public MeshStandardMaterial types. */ -interface MeshStandardMaterialWithNodeProps { - emissiveNode?: TslMaterialNode | null; - opacityNode?: TslMaterialNode | null; -} - -import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"; - -// biome-ignore lint/suspicious/noExplicitAny: Three.js TSL shader nodes are opaque chainable objects with no exported types. -type TslNode = any; -type TslModule = { - uniform(value: number): TslNode; - positionWorld: { x: TslNode; y: TslNode; z: TslNode }; - sin(value: unknown): TslNode; - cos(value: unknown): TslNode; - step(edge: unknown, value: unknown): TslNode; - float(value: number): TslNode; - fract(value: unknown): TslNode; - smoothstep(edge0: unknown, edge1: unknown, value: unknown): TslNode; - vec3(x: unknown, y: unknown, z: unknown): TslNode; -}; -type WebGpuRendererConstructor = new (options: { - canvas: HTMLCanvasElement; - alpha: boolean; - antialias: boolean; -}) => unknown; -type VrmLoaderParser = ConstructorParameters< - typeof MToonMaterialLoaderPlugin ->[0]; - -import { MeshoptDecoder } from "three/examples/jsm/libs/meshopt_decoder.module.js"; -import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js"; -import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; -import { - type AnimationLoaderContext, - loadEmoteClip, - loadIdleClip, -} from "./VrmAnimationLoader"; -import { VrmBlinkController } from "./VrmBlinkController"; -import { - type CameraAnimationConfig, - type CameraProfile, - type InteractionMode, - VrmCameraManager, -} from "./VrmCameraManager"; - -export type { CameraAnimationConfig, CameraProfile, InteractionMode }; - -export type VrmEngineState = { - vrmLoaded: boolean; - vrmName: string | null; - loadError: string | null; - idlePlaying: boolean; - idleTime: number; - idleTracks: number; - revealStarted: boolean; - loadingProgress?: number; -}; - -type DebugVector3 = { - x: number; - y: number; - z: number; -}; - -type DebugBounds = { - min: DebugVector3; - max: DebugVector3; - center: DebugVector3; - size: DebugVector3; -}; - -export type VrmEngineDebugInfo = { - initialized: boolean; - rendererBackend: RendererBackend; - cameraProfile: CameraProfile; - sceneChildren: string[]; - camera: { - parentName: string | null; - position: DebugVector3 | null; - rotation: DebugVector3 | null; - fov: number | null; - lookAtTarget: DebugVector3; - }; - avatar: { - loaded: boolean; - ready: boolean; - parentName: string | null; - position: DebugVector3 | null; - scale: DebugVector3 | null; - bounds: DebugBounds | null; - }; -}; - -type UpdateCallback = () => void; -type RendererBackend = "webgl" | "webgpu"; -type RendererPreference = "auto" | "webgl"; -type AnimationMixerFinishedEvent = { - type: "finished"; - action: THREE.AnimationAction; - direction: number; -}; -type ElectrobunRuntimeWindow = Window & { - __electrobunWindowId?: number; - __electrobunWebviewId?: number; -}; -type RendererLike = Pick< - THREE.WebGLRenderer, - | "dispose" - | "domElement" - | "render" - | "setClearColor" - | "setPixelRatio" - | "setSize" -> & { - forceContextLoss?: () => void; - outputColorSpace?: string; - shadowMap?: { - enabled: boolean; - type: THREE.ShadowMapType; - }; - toneMapping?: THREE.ToneMapping; - toneMappingExposure?: number; - xr?: THREE.WebGLRenderer["xr"]; - setAnimationLoop?: ( - callback: ((time: number, frame?: unknown) => void) | null, - ) => void; -}; - -const DEFAULT_CAMERA_ANIMATION: CameraAnimationConfig = { - enabled: false, - swayAmplitude: 0.06, - bobAmplitude: 0.03, - rotationAmplitude: 0.01, - speed: 0.8, -}; -const CAMERA_PROFILE_TRANSITION_DURATION_SECONDS = 0.8; -const AVATAR_SWITCH_CAMERA_TRANSITION_DURATION_SECONDS = 3; -const TELEPORT_DISSOLVE_START_Y = -1.2; -const TELEPORT_DISSOLVE_END_Y = 1.0; -const COMPANION_ZOOM_NEAR_FACTOR = 0.25; -const COMPANION_ZOOM_MIN_RADIUS = 1.2; -const MAX_RENDERER_PIXEL_RATIO = 2; -const AVATAR_RENDERER_OVERRIDE_KEY = "eliza.avatarRenderer"; -const KNOWN_VRM_WEBGPU_WARNING = - 'TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'; - -let knownVrmWebGpuWarningFilterRefs = 0; -let releaseKnownVrmWebGpuWarningFilterGlobal: (() => void) | null = null; -let sharedDracoLoader: DRACOLoader | null = null; -type CompatibleDracoLoader = Parameters[0]; -type CompatibleMeshoptDecoder = Parameters[0]; -let teleportSparkleTexture: THREE.CanvasTexture | null = null; -let _cachedDracoDecoderPath: string | null = null; -/** Lazy + cached: module-load resolution can be wrong in bundled/desktop init order. */ -function getDracoDecoderPath(): string { - _cachedDracoDecoderPath ??= resolveAppAssetUrl("vrm-decoders/draco/"); - return _cachedDracoDecoderPath; -} - -function getRendererPixelRatio(): number { - if (typeof window === "undefined") return 1; - return Math.min( - Math.max(window.devicePixelRatio || 1, 1), - MAX_RENDERER_PIXEL_RATIO, - ); -} - -function isElectrobunAvatarRuntime(): boolean { - if (typeof window === "undefined") return false; - const runtimeWindow = window as ElectrobunRuntimeWindow; - return ( - typeof runtimeWindow.__electrobunWindowId === "number" || - typeof runtimeWindow.__electrobunWebviewId === "number" - ); -} - -function getPreferredAvatarRendererBackend(): RendererBackend { - if (typeof window === "undefined") return "webgl"; - const override = (() => { - try { - return window.localStorage.getItem(AVATAR_RENDERER_OVERRIDE_KEY); - } catch { - return null; - } - })(); - const normalizedOverride = override?.trim().toLowerCase(); - if (normalizedOverride === "webgpu" || normalizedOverride === "webgl") { - return normalizedOverride; - } - return isElectrobunAvatarRuntime() ? "webgpu" : "webgl"; -} - -function installKnownVrmWebGpuWarningFilter(): () => void { - knownVrmWebGpuWarningFilterRefs += 1; - - if (!releaseKnownVrmWebGpuWarningFilterGlobal) { - const originalWarn = console.warn.bind(console); - console.warn = (...args: Parameters) => { - if ( - typeof args[0] === "string" && - args[0].includes(KNOWN_VRM_WEBGPU_WARNING) - ) { - return; - } - originalWarn(...args); - }; - releaseKnownVrmWebGpuWarningFilterGlobal = () => { - knownVrmWebGpuWarningFilterRefs = Math.max( - 0, - knownVrmWebGpuWarningFilterRefs - 1, - ); - if (knownVrmWebGpuWarningFilterRefs === 0) { - console.warn = originalWarn; - releaseKnownVrmWebGpuWarningFilterGlobal = null; - } - }; - } - - return () => { - releaseKnownVrmWebGpuWarningFilterGlobal?.(); - }; -} - -function getSharedDracoLoader(): CompatibleDracoLoader { - if (!sharedDracoLoader) { - sharedDracoLoader = new DRACOLoader(); - sharedDracoLoader.setDecoderConfig({ type: "wasm" }); - sharedDracoLoader.setDecoderPath(getDracoDecoderPath()); - sharedDracoLoader.preload(); - } - // three/examples and the current GLTF loader declarations diverge on the - // decoder surface, but this runtime instance is the loader we use in app. - return sharedDracoLoader as CompatibleDracoLoader; -} - -function callMeshoptFunction(name: string, ...args: unknown[]): unknown { - const method = Reflect.get(MeshoptDecoder, name); - if (typeof method !== "function") { - throw new Error(`MeshoptDecoder.${name} is unavailable`); - } - return method.apply(MeshoptDecoder, args); -} - -const compatibleMeshoptDecoder: NonNullable = { - supported: MeshoptDecoder.supported, - ready: MeshoptDecoder.ready, - useWorkers(count: number) { - callMeshoptFunction("useWorkers", count); - }, - decodeVertexBuffer( - target: Uint8Array, - count: number, - size: number, - source: Uint8Array, - filter?: string, - ) { - callMeshoptFunction( - "decodeVertexBuffer", - target, - count, - size, - source, - filter, - ); - }, - decodeIndexBuffer( - target: Uint8Array, - count: number, - size: number, - source: Uint8Array, - ) { - callMeshoptFunction("decodeIndexBuffer", target, count, size, source); - }, - decodeIndexSequence( - target: Uint8Array, - count: number, - size: number, - source: Uint8Array, - ) { - callMeshoptFunction("decodeIndexSequence", target, count, size, source); - }, - decodeGltfBuffer( - target: Uint8Array, - count: number, - size: number, - source: Uint8Array, - mode: string, - filter?: string, - ) { - callMeshoptFunction( - "decodeGltfBuffer", - target, - count, - size, - source, - mode, - filter, - ); - }, - async decodeGltfBufferAsync( - count: number, - size: number, - source: Uint8Array, - mode: string, - filter?: string, - ) { - const decoded = await callMeshoptFunction( - "decodeGltfBufferAsync", - count, - size, - source, - mode, - filter, - ); - if (!(decoded instanceof Uint8Array)) { - throw new Error( - "MeshoptDecoder.decodeGltfBufferAsync returned an invalid buffer", - ); - } - return decoded; - }, -}; - -function configureVrmGltfLoader(loader: GLTFLoader): void { - // three/examples and the current GLTF loader declarations diverge on the - // meshopt decoder surface, but this runtime instance is the decoder we ship. - loader.setMeshoptDecoder(compatibleMeshoptDecoder); - loader.setDRACOLoader(getSharedDracoLoader()); -} - -function getTeleportSparkleTexture(): THREE.CanvasTexture { - if (teleportSparkleTexture) return teleportSparkleTexture; - const canvas = document.createElement("canvas"); - canvas.width = 128; - canvas.height = 128; - const context = canvas.getContext("2d"); - if (!context) { - teleportSparkleTexture = new THREE.CanvasTexture(canvas); - return teleportSparkleTexture; - } - - const gradient = context.createRadialGradient(64, 64, 6, 64, 64, 64); - gradient.addColorStop(0.0, "rgba(255,255,255,1)"); - gradient.addColorStop(0.2, "rgba(190,245,255,0.95)"); - gradient.addColorStop(0.55, "rgba(112,214,255,0.48)"); - gradient.addColorStop(1.0, "rgba(112,214,255,0)"); - context.fillStyle = gradient; - context.fillRect(0, 0, 128, 128); - - teleportSparkleTexture = new THREE.CanvasTexture(canvas); - teleportSparkleTexture.needsUpdate = true; - return teleportSparkleTexture; -} - -function isGzipBuffer(buffer: ArrayBuffer): boolean { - if (buffer.byteLength < 2) return false; - const bytes = new Uint8Array(buffer, 0, 2); - return bytes[0] === 0x1f && bytes[1] === 0x8b; -} - -async function decompressGzipBuffer(buffer: ArrayBuffer): Promise { - if (typeof DecompressionStream !== "function") { - throw new Error( - "This runtime does not support gzip-compressed VRM assets.", - ); - } - const stream = new Blob([buffer]) - .stream() - .pipeThrough(new DecompressionStream("gzip")); - return await new Response(stream).arrayBuffer(); -} - -/* ── In-memory VRM ArrayBuffer cache ───────────────────────────────────────── - * Caches the decompressed (ready-to-parse) ArrayBuffer keyed by URL so that - * switching back to a previously-loaded avatar skips the network fetch entirely. - * We intentionally cache raw bytes rather than parsed GLTF/VRM objects because - * three.js scene graphs carry GPU-bound resources that cannot be safely shared - * or cloned across instances. Re-parsing from an ArrayBuffer is fast (<200ms) - * and avoids an entire class of WebGL state bugs. - * - * LRU eviction keeps memory bounded (default: 8 entries ≈ 80-160 MB). - * ──────────────────────────────────────────────────────────────────────────── */ - -interface VrmBufferCacheEntry { - /** Decompressed, ready-to-parse ArrayBuffer. */ - buffer: ArrayBuffer; - /** Monotonic timestamp for LRU eviction. */ - lastUsed: number; -} - -const vrmBufferCache = new Map(); -const VRM_BUFFER_CACHE_MAX = 8; - -/** - * In-flight prefetch promises keyed by URL. Prevents duplicate concurrent - * downloads when `loadGltfAsset` runs while a prefetch for the same URL is - * still in progress. - */ -const vrmPrefetchInflight = new Map>(); - -function touchVrmCacheEntry(url: string, buffer: ArrayBuffer): void { - vrmBufferCache.set(url, { buffer, lastUsed: performance.now() }); - - // Evict oldest entries when over capacity. - while (vrmBufferCache.size > VRM_BUFFER_CACHE_MAX) { - let oldestKey: string | null = null; - let oldestTime = Infinity; - for (const [key, entry] of vrmBufferCache) { - if (entry.lastUsed < oldestTime) { - oldestTime = entry.lastUsed; - oldestKey = key; - } - } - if (oldestKey) vrmBufferCache.delete(oldestKey); - else break; - } -} - -/** - * Prefetch a VRM file into the in-memory buffer cache without parsing it. - * Fire-and-forget: silently swallows errors since prefetch is best-effort. - * Calling this when the character tab opens means the buffer is ready before - * the user clicks a character, turning a ~3-8 s cold fetch into a <200 ms - * re-parse from cache. - */ -export async function prefetchVrmToCache(url: string): Promise { - if (vrmBufferCache.has(url)) return; // already warm - - // If a prefetch for this URL is already in flight, join it instead of - // starting a duplicate download. - const existing = vrmPrefetchInflight.get(url); - if (existing) return existing; - - const work = (async () => { - try { - const response = await fetch(url, { cache: "force-cache" }); - if (!response.ok) return; - let buffer = await response.arrayBuffer(); - if (isGzipBuffer(buffer)) buffer = await decompressGzipBuffer(buffer); - touchVrmCacheEntry(url, buffer); - } catch { - // Prefetch is best-effort — network errors are silently ignored. - } finally { - vrmPrefetchInflight.delete(url); - } - })(); - - vrmPrefetchInflight.set(url, work); - return work; -} - -async function loadGltfAsset( - loader: GLTFLoader, - url: string, - onProgress?: (progress: number) => void, -): Promise>> { - let buffer: ArrayBuffer; - - // If a prefetch for this URL is in flight, await it so we hit the - // in-memory cache instead of starting a duplicate network request. - const inflight = vrmPrefetchInflight.get(url); - if (inflight) { - await inflight; - } - - const cached = vrmBufferCache.get(url); - if (cached) { - // Cache hit — skip network entirely, copy the buffer so the cache stays - // valid even if GLTFLoader transfers/neuters the original. - buffer = cached.buffer.slice(0); - touchVrmCacheEntry(url, cached.buffer); - onProgress?.(1); - } else { - // Cache miss — fetch from network/browser cache. - const response = await fetch(url, { cache: "force-cache" }); - if (!response.ok) { - throw new Error(`Failed to fetch VRM asset: ${response.status}`); - } - - const contentLength = Number(response.headers.get("content-length") || 0); - - if (!contentLength || !response.body || !onProgress) { - buffer = await response.arrayBuffer(); - onProgress?.(1); - } else { - const reader = response.body.getReader(); - let received = 0; - const chunks: Uint8Array[] = []; - for (;;) { - const { done, value } = await reader.read(); - if (done) break; - if (value) { - chunks.push(value); - received += value.length; - onProgress(Math.min(received / contentLength, 1)); - } - } - const combined = new Uint8Array(received); - let offset = 0; - for (const chunk of chunks) { - combined.set(chunk, offset); - offset += chunk.length; - } - buffer = combined.buffer; - } - - // Decompress gzip if needed, then store the decompressed bytes. - if (isGzipBuffer(buffer)) { - buffer = await decompressGzipBuffer(buffer); - } - - // Store a copy in the cache (keep the original for parsing below). - touchVrmCacheEntry(url, buffer.slice(0)); - } - - const objectUrl = URL.createObjectURL( - new Blob([buffer], { type: "model/gltf-binary" }), - ); - try { - return await loader.loadAsync(objectUrl); - } finally { - URL.revokeObjectURL(objectUrl); - } -} - -/** - * Create the best available renderer for the canvas. - * Tries WebGPURenderer only when preference allows, Electrobun defaults prefer - * webgpu, and `navigator.gpu` exists; otherwise uses WebGL (also on WebGPU init failure). - * Non-Electrobun (e.g. browser dev) defaults preference to WebGL to reduce TSL noise. - * `localStorage` can force `webgpu` or `webgl`. WebGPURenderer is async; await `init()` when present. - */ -async function createRenderer( - canvas: HTMLCanvasElement, - preference: RendererPreference = "auto", -): Promise<{ backend: RendererBackend; renderer: RendererLike }> { - if ( - preference !== "webgl" && - getPreferredAvatarRendererBackend() === "webgpu" && - typeof navigator !== "undefined" && - navigator.gpu - ) { - try { - const { WebGPURenderer } = (await import("three/webgpu")) as unknown as { - WebGPURenderer?: WebGpuRendererConstructor; - }; - if (!WebGPURenderer) { - throw new Error("three/webgpu did not expose WebGPURenderer"); - } - const renderer = new WebGPURenderer({ - canvas, - alpha: true, - antialias: true, - }) as RendererLike & { init?: () => Promise }; - await renderer.init?.(); - console.info("[VrmEngine] Using WebGPURenderer"); - return { backend: "webgpu", renderer }; - } catch (err) { - console.warn( - "[VrmEngine] WebGPURenderer failed, falling back to WebGL:", - err, - ); - } - } - const renderer = new THREE.WebGLRenderer({ - canvas, - alpha: true, - antialias: true, - }) as RendererLike; - console.info("[VrmEngine] Using WebGLRenderer"); - return { backend: "webgl", renderer }; -} - -export class VrmEngine { - private renderer: RendererLike | null = null; - private rendererBackend: RendererBackend = "webgl"; - private rendererPreference: RendererPreference = "auto"; - private scene: THREE.Scene | null = null; - private mathEnvironment: MathEnvironment | null = null; - private overlayManager: SceneOverlayManager | null = null; - private avatarRoot: THREE.Group | null = null; - private camera: THREE.PerspectiveCamera | null = null; - private clock = new THREE.Clock(); - private vrm: VRM | null = null; - private mixer: THREE.AnimationMixer | null = null; - private idleAction: THREE.AnimationAction | null = null; - private idleLoadPromise: Promise | null = null; - private animationFrameId: number | null = null; - private onUpdate: UpdateCallback | null = null; - private initialized = false; - private loadingAborted = false; - private vrmLoadRequestId = 0; - private vrmReady = false; - private lastLoadError: string | null = null; - private teleportProgress = 1.0; - private loadingProgress = 0; - /** Timestamp (from elapsedTime) when the teleport dissolve finished. */ - private teleportCompleteTime = -Infinity; - private teleportProgressUniform: { value: number } | null = null; - private teleportDissolvedMaterials: THREE.Material[] = []; - private teleportFallbackShaders: { - uniforms: { uTeleportProgress: { value: number } }; - isOutgoing?: boolean; - }[] = []; - private teleportSparkles: TeleportSparkleSystem | null = null; - private revealStarted = false; - private mouthValue = 0; - private mouthSmoothed = 0; - private vrmName: string | null = null; - private lookAtTarget = new THREE.Vector3(0, 0.5, 0); - private readonly idleGlbUrl = resolveAppAssetUrl("animations/idle.glb.gz"); - - private outgoingVrm: VRM | null = null; - private outgoingMixer: THREE.AnimationMixer | null = null; - private cameraAnimation: CameraAnimationConfig = { - ...DEFAULT_CAMERA_ANIMATION, - }; - private baseCameraPosition = new THREE.Vector3(); - private elapsedTime = 0; - private speaking = false; - private speakingStartTime = 0; - private readonly blinkController = new VrmBlinkController(); - - private readonly cameraManager = new VrmCameraManager(); - private emoteAction: THREE.AnimationAction | null = null; - private emoteTimeout: ReturnType | null = null; - private emoteCompletionCleanup: (() => void) | null = null; - private emoteClipCache = new Map(); - private emoteRequestId = 0; - private controls: OrbitControls | null = null; - /** Key light used for avatar shadows — toggled in low-power mode. */ - private keyDirectionalLight: THREE.DirectionalLight | null = null; - /** When true, cap effective `devicePixelRatio` at 1 (fewer shaded pixels on Retina). */ - private lowPowerRenderMode = false; - /** - * When true, skip every other animation tick (~half display rate). Independent - * of {@link lowPowerRenderMode}; `Clock.getDelta()` on active ticks absorbs skips. - */ - private halfFramerateMode = false; - private halfFramerateSkipNext = false; - private paused = false; - /** - * When true, only VRM idle/physics keep running (document hidden + user opt-in). - */ - private minimalBackgroundMode = false; - private interactionEnabled = false; - private interactionMode: InteractionMode = "free"; - private cameraProfile: CameraProfile = "chat"; - private pointerParallaxEnabled = false; - private pointerParallaxTarget = new THREE.Vector2(); - private pointerParallaxCurrent = new THREE.Vector2(); - private pointerParallaxPosition = new THREE.Vector3(); - private pointerParallaxLookAt = new THREE.Vector3(); - private dragOrbitTarget = new THREE.Vector2(); - private dragOrbitCurrent = new THREE.Vector2(); - private companionZoomTarget = 0; - private companionZoomCurrent = 0; - private cameraXOffsetTarget = 0; - private cameraXOffsetCurrent = 0; - /** Orbital yaw offset applied by the editor camera shift. */ - private cameraYawOffsetTarget = 0; - private cameraYawOffsetCurrent = 0; - private avatarLookTarget: THREE.Group | null = null; - private headLookTarget = new THREE.Vector2(); - private headLookCurrent = new THREE.Vector2(); - private clearEmoteTimeout(): void { - if (this.emoteTimeout !== null) { - clearTimeout(this.emoteTimeout); - this.emoteTimeout = null; - } - } - - private clearEmoteCompletionCleanup(): void { - this.emoteCompletionCleanup?.(); - this.emoteCompletionCleanup = null; - } - - private clearPendingEmoteCompletion(): void { - this.clearEmoteTimeout(); - this.clearEmoteCompletionCleanup(); - } - - private watchOneShotEmoteCompletion( - mixer: THREE.AnimationMixer, - action: THREE.AnimationAction, - requestId: number, - fallbackDurationSeconds: number, - ): void { - const handleFinished = (event: AnimationMixerFinishedEvent): void => { - if (event.action !== action) return; - if (this.emoteRequestId !== requestId || this.emoteAction !== action) { - return; - } - this.stopEmote(); - }; - - mixer.addEventListener("finished", handleFinished); - this.emoteCompletionCleanup = () => { - mixer.removeEventListener("finished", handleFinished); - }; - - const safeDuration = - Number.isFinite(fallbackDurationSeconds) && fallbackDurationSeconds > 0 - ? fallbackDurationSeconds - : 3; - - // Keep a timer fallback in case the mixer completion event is missed. - this.emoteTimeout = setTimeout( - () => { - if (this.emoteRequestId !== requestId || this.emoteAction !== action) { - return; - } - this.stopEmote(); - }, - Math.max(0.25, safeDuration + 0.1) * 1000, - ); - } - - private activateAction(action: THREE.AnimationAction): void { - action.enabled = true; - action.paused = false; - action.setEffectiveTimeScale(1); - action.setEffectiveWeight(1); - action.play(); - } - - private async ensureIdleAction( - vrm: VRM, - mixer: THREE.AnimationMixer, - ): Promise { - if (this.idleAction) return this.idleAction; - if (this.idleLoadPromise) return this.idleLoadPromise; - - this.idleLoadPromise = (async () => { - const clip = await loadIdleClip( - vrm, - this.idleGlbUrl, - this.animationLoaderContext, - ); - if (!clip || this.loadingAborted || this.vrm !== vrm) { - return null; - } - const activeMixer = this.mixer ?? mixer; - if (!activeMixer || this.vrm !== vrm) { - return null; - } - const action = activeMixer.clipAction(clip); - action.reset(); - action.setLoop(THREE.LoopRepeat, Infinity); - action.timeScale = 1.0; - this.idleAction = action; - activeMixer.update(1 / 60); - return action; - })().finally(() => { - this.idleLoadPromise = null; - }); - - return this.idleLoadPromise; - } - - private restoreIdleAfterEmote( - activeEmote: THREE.AnimationAction | null, - fadeDuration: number, - vrm: VRM, - mixer: THREE.AnimationMixer, - ): void { - void this.ensureIdleAction(vrm, mixer).then((idleAction) => { - if (!idleAction || this.loadingAborted || this.vrm !== vrm) { - activeEmote?.fadeOut(fadeDuration); - return; - } - this.activateAction(idleAction); - if (activeEmote && activeEmote !== idleAction) { - idleAction.crossFadeFrom(activeEmote, fadeDuration, false); - } else { - idleAction.fadeIn(fadeDuration); - } - }); - } - private avatarLookRig: { - headBone: THREE.Object3D | null; - neckBone: THREE.Object3D | null; - spineBone: THREE.Object3D | null; - } = { - headBone: null, - neckBone: null, - spineBone: null, - }; - private readonly tempCameraOrbitOffset = new THREE.Vector3(); - private readonly tempCameraSpherical = new THREE.Spherical(); - private readonly tempAvatarLookTarget = new THREE.Vector3(); - private readonly tempAvatarLocalTarget = new THREE.Vector3(); - private readonly tempAvatarLocalAnchor = new THREE.Vector3(); - private readonly tempAvatarHeadWorld = new THREE.Vector3(); - private readyPromise: Promise = Promise.resolve(); - private resolveReady: (() => void) | null = null; - private rejectReady: ((error?: unknown) => void) | null = null; - private releaseKnownWebGpuWarningFilter: (() => void) | null = null; - - // Transition state - private isCameraTransitioning = false; - private transitionStartFov = 0; - private transitionTargetFov = 0; - private transitionStartPos = new THREE.Vector3(); - private transitionTargetPos = new THREE.Vector3(); - private transitionStartLookAt = new THREE.Vector3(); - private transitionTargetLookAt = new THREE.Vector3(); - private transitionProgress = 0; - private transitionDuration = CAMERA_PROFILE_TRANSITION_DURATION_SECONDS; - - private handleControlStart = (): void => { - if (!this.interactionEnabled) return; - }; - private handleControlEnd = (): void => { - if (!this.interactionEnabled) return; - if (this.controls) { - this.lookAtTarget.copy(this.controls.target); - } - }; - - private scheduleNextFrame(): void { - if (!this.initialized || this.paused || this.animationFrameId !== null) { - return; - } - if (this.renderer?.setAnimationLoop) { - this.animationFrameId = 1; - this.renderer.setAnimationLoop(() => { - this.loop(); - }); - } else { - this.animationFrameId = requestAnimationFrame(() => { - this.animationFrameId = null; - this.loop(); - }); - } - } - - private stopLoop(): void { - if (this.animationFrameId !== null) { - if (this.renderer?.setAnimationLoop) { - this.renderer.setAnimationLoop(null); - } else { - cancelAnimationFrame(this.animationFrameId); - } - this.animationFrameId = null; - } - this.clock.stop(); - } - - /** - * Re-applies `setPixelRatio` from DPR and battery policy, then - * resizes the drawing buffer to match the canvas CSS size. - * - * **WHY:** `setPixelRatio` alone does not always refit the buffer after - * snapshot capture or when toggling low-power mode mid-session. - */ - private applyRendererPixelRatio(): void { - if (!this.renderer || !this.camera) return; - const base = getRendererPixelRatio(); - const ratio = this.lowPowerRenderMode ? Math.min(base, 1) : base; - this.renderer.setPixelRatio(ratio); - const canvas = this.renderer.domElement as HTMLCanvasElement | undefined; - if (!canvas) return; - const w = canvas.clientWidth; - const h = canvas.clientHeight; - if (w > 0 && h > 0) { - this.resize(w, h); - } - } - - /** Disable expensive directional shadow maps on battery — big GPU savings. */ - private applyLowPowerShadowPolicy(): void { - const light = this.keyDirectionalLight; - if (!light) return; - if (this.lowPowerRenderMode) { - light.castShadow = false; - } else { - light.castShadow = true; - light.shadow.mapSize.setScalar(1024); - } - const r = this.renderer as THREE.WebGLRenderer | null; - if (r?.shadowMap) { - r.shadowMap.needsUpdate = true; - } - } - - private resumeLoop(): void { - if (!this.initialized || this.paused) return; - this.clock.start(); - this.scheduleNextFrame(); - } - - private applyCompanionZoom( - camera: THREE.PerspectiveCamera, - stableDelta: number, - ): void { - const isCompanionProfile = this.cameraProfile === "companion"; - const follow = Math.min(1, stableDelta * 10); - const targetZoom = isCompanionProfile ? this.companionZoomTarget : 0; - this.companionZoomCurrent = THREE.MathUtils.lerp( - this.companionZoomCurrent, - targetZoom, - follow, - ); - if (this.companionZoomCurrent < 1e-4) return; - - const baseRadius = this.baseCameraPosition.distanceTo(this.lookAtTarget); - if (!Number.isFinite(baseRadius) || baseRadius < 1e-4) return; - - const orbitOffset = this.tempCameraOrbitOffset - .copy(camera.position) - .sub(this.lookAtTarget); - if (orbitOffset.lengthSq() < 1e-6) return; - - const spherical = this.tempCameraSpherical.setFromVector3(orbitOffset); - const nearRadius = Math.max( - COMPANION_ZOOM_MIN_RADIUS, - baseRadius * COMPANION_ZOOM_NEAR_FACTOR, - ); - spherical.radius = THREE.MathUtils.lerp( - baseRadius, - nearRadius, - this.companionZoomCurrent, - ); - camera.position - .copy(this.lookAtTarget) - .add(orbitOffset.setFromSpherical(spherical)); - } - - private configureAvatarLookTracking(vrm: VRM): void { - const target = this.avatarLookTarget; - if (target) { - target.position.set(0, 1.5, 2); - target.updateMatrixWorld(true); - } - if (vrm.lookAt && target) { - vrm.lookAt.autoUpdate = true; - vrm.lookAt.target = target; - } - - const humanoid = vrm.humanoid; - const headBone = humanoid?.getRawBoneNode("head") ?? null; - const neckBone = humanoid?.getRawBoneNode("neck") ?? null; - const spineBone = - humanoid?.getRawBoneNode("upperChest") ?? - humanoid?.getRawBoneNode("chest") ?? - humanoid?.getRawBoneNode("spine") ?? - null; - - this.avatarLookRig = { - headBone, - neckBone, - spineBone, - }; - this.headLookTarget.set(0, 0); - this.headLookCurrent.set(0, 0); - } - - private updateAvatarLookTarget( - camera: THREE.PerspectiveCamera, - stableDelta: number, - ): void { - const target = this.avatarLookTarget; - if (!target) return; - this.tempAvatarLookTarget.copy(camera.position); - const follow = Math.min(1, stableDelta * 24); - target.position.lerp(this.tempAvatarLookTarget, follow); - target.updateMatrixWorld(true); - } - - private refreshAvatarEyeTracking(): void { - const vrm = this.vrm; - if (!vrm?.lookAt || !this.avatarLookTarget) return; - vrm.lookAt.update(0); - vrm.expressionManager?.update(); - } - - private applyAvatarHeadTracking( - camera: THREE.PerspectiveCamera, - stableDelta: number, - ): void { - const vrm = this.vrm; - const { headBone, neckBone, spineBone } = this.avatarLookRig; - if (!vrm || !headBone) return; - const headParent = headBone.parent; - if (!headParent || typeof headParent.worldToLocal !== "function") return; - if ( - typeof THREE.Euler !== "function" || - typeof THREE.Quaternion !== "function" || - typeof headBone.quaternion.clone !== "function" - ) { - return; - } - const lookAtState = vrm.lookAt as - | ({ _yaw?: number; _pitch?: number } & object) - | null - | undefined; - const lookAtYawDegrees = lookAtState?._yaw; - const lookAtPitchDegrees = lookAtState?._pitch; - - if ( - Number.isFinite(lookAtYawDegrees) && - Number.isFinite(lookAtPitchDegrees) - ) { - this.headLookTarget.set( - THREE.MathUtils.clamp( - THREE.MathUtils.degToRad(lookAtYawDegrees || 0), - -0.55, - 0.55, - ), - THREE.MathUtils.clamp( - THREE.MathUtils.degToRad(lookAtPitchDegrees || 0), - -0.3, - 0.24, - ), - ); - } else { - headBone.getWorldPosition(this.tempAvatarHeadWorld); - this.tempAvatarLocalTarget.copy(camera.position); - this.tempAvatarLocalTarget.y -= 0.04; - headParent.worldToLocal(this.tempAvatarLocalTarget); - headParent.worldToLocal( - this.tempAvatarLocalAnchor.copy(this.tempAvatarHeadWorld), - ); - this.tempAvatarLocalTarget.sub(this.tempAvatarLocalAnchor); - - const planarDistance = Math.max( - 1e-4, - Math.hypot(this.tempAvatarLocalTarget.x, this.tempAvatarLocalTarget.z), - ); - this.headLookTarget.set( - THREE.MathUtils.clamp( - Math.atan2( - -this.tempAvatarLocalTarget.x, - Math.max(-this.tempAvatarLocalTarget.z, 1e-4), - ), - -0.55, - 0.55, - ), - THREE.MathUtils.clamp( - Math.atan2(this.tempAvatarLocalTarget.y, planarDistance), - -0.3, - 0.24, - ), - ); - } - this.headLookCurrent.lerp( - this.headLookTarget, - Math.min(1, stableDelta * 4.5), - ); - - const applyTrackedBone = ( - bone: THREE.Object3D | null, - yawWeight: number, - pitchWeight: number, - ) => { - if (!bone?.quaternion || typeof bone.quaternion.clone !== "function") { - return; - } - const offsetEuler = new THREE.Euler( - this.headLookCurrent.y * pitchWeight, - this.headLookCurrent.x * yawWeight, - 0, - "YXZ", - ); - const offsetQuaternion = new THREE.Quaternion().setFromEuler(offsetEuler); - const animatedPose = bone.quaternion.clone(); - bone.quaternion.copy(animatedPose).multiply(offsetQuaternion); - }; - - applyTrackedBone(spineBone, 0.12, 0.06); - applyTrackedBone(neckBone, 0.3, 0.18); - applyTrackedBone(headBone, 0.52, 0.28); - } - - private toDebugVector3(vector: THREE.Vector3 | null): DebugVector3 | null { - if (!vector) return null; - return { - x: Number(vector.x.toFixed(4)), - y: Number(vector.y.toFixed(4)), - z: Number(vector.z.toFixed(4)), - }; - } - - private toDebugBounds(object: THREE.Object3D | null): DebugBounds | null { - if (!object) return null; - const bounds = new THREE.Box3().setFromObject(object); - if (bounds.isEmpty()) return null; - return this.toDebugBoundsFromBox(bounds); - } - - private toDebugBoundsFromBox(bounds: THREE.Box3 | null): DebugBounds | null { - if (!bounds || bounds.isEmpty()) return null; - const center = bounds.getCenter(new THREE.Vector3()); - const size = bounds.getSize(new THREE.Vector3()); - const min = this.toDebugVector3(bounds.min.clone()); - const max = this.toDebugVector3(bounds.max.clone()); - const centerVector = this.toDebugVector3(center); - const sizeVector = this.toDebugVector3(size); - if (!min || !max || !centerVector || !sizeVector) return null; - return { - min, - max, - center: centerVector, - size: sizeVector, - }; - } - - getDebugInfo(): VrmEngineDebugInfo { - this.scene?.updateMatrixWorld(true); - this.vrm?.scene.updateMatrixWorld(true); - - const cameraRotation = this.camera - ? new THREE.Vector3( - this.camera.rotation.x, - this.camera.rotation.y, - this.camera.rotation.z, - ) - : null; - const lookAtTarget = - this.toDebugVector3(this.lookAtTarget) ?? - ({ x: 0, y: 0, z: 0 } satisfies DebugVector3); - - return { - initialized: this.initialized, - rendererBackend: this.rendererBackend, - cameraProfile: this.cameraProfile, - sceneChildren: - this.scene?.children.map( - (child: THREE.Object3D) => child.name || child.type, - ) ?? [], - camera: { - parentName: this.camera?.parent?.name ?? null, - position: this.toDebugVector3(this.camera?.position ?? null), - rotation: this.toDebugVector3(cameraRotation), - fov: this.camera?.fov ?? null, - lookAtTarget, - }, - avatar: { - loaded: this.vrm !== null, - ready: this.vrmReady, - parentName: this.vrm?.scene.parent?.name ?? null, - position: this.toDebugVector3(this.vrm?.scene.position ?? null), - scale: this.toDebugVector3(this.vrm?.scene.scale ?? null), - bounds: this.toDebugBounds(this.vrm?.scene ?? null), - }, - }; - } - - setDebugAvatarVisible(visible: boolean): void { - if (!this.vrm) return; - this.vrm.scene.visible = visible; - } - - setDebugCamera(position: THREE.Vector3, target: THREE.Vector3): void { - if (!this.camera) return; - this.isCameraTransitioning = false; - this.camera.position.copy(position); - this.baseCameraPosition.copy(position); - this.lookAtTarget.copy(target); - this.controls?.target.copy(target); - this.controls?.update(); - this.camera.lookAt(target); - } - - private startCameraTransition( - startPos: THREE.Vector3, - startLookAt: THREE.Vector3, - startFov: number, - targetPos: THREE.Vector3, - targetLookAt: THREE.Vector3, - targetFov: number, - durationSeconds: number, - ): void { - if (!this.camera) return; - - this.transitionStartFov = startFov; - this.transitionTargetFov = targetFov; - this.transitionStartPos.copy(startPos); - this.transitionTargetPos.copy(targetPos); - this.transitionStartLookAt.copy(startLookAt); - this.transitionTargetLookAt.copy(targetLookAt); - this.transitionDuration = Math.max(0.01, durationSeconds); - - this.camera.fov = startFov; - this.camera.position.copy(startPos); - this.camera.updateProjectionMatrix(); - this.baseCameraPosition.copy(startPos); - this.lookAtTarget.copy(startLookAt); - if (this.controls) { - this.controls.target.copy(startLookAt); - this.controls.update(); - } - this.camera.lookAt(startLookAt); - this.isCameraTransitioning = true; - this.transitionProgress = 0; - } - - private transitionCameraToFramedAvatar( - vrm: VRM, - durationSeconds: number, - ): void { - if (!this.camera) return; - - const startPos = new THREE.Vector3().copy(this.baseCameraPosition); - const startLookAt = new THREE.Vector3().copy(this.lookAtTarget); - const startFov = this.camera.fov; - const targetLookAt = new THREE.Vector3(); - const defaultProfileTargetPos = new THREE.Vector3(); - - const dummyCamera = this.camera.clone(); - - this.cameraManager.centerAndFrame( - vrm, - dummyCamera, - this.controls, - this.cameraProfile, - targetLookAt, - defaultProfileTargetPos, - (c) => this.cameraManager.applyInteractionMode(c, this.interactionMode), - true, // skipControlUpdate - ); - - // To prevent frame-based dynamic offsets (yaw, sway, zoom) from accumulating and causing camera spin, - // compute the pristine tracking offset from baseCameraPosition, which is unaffected by post-process - // modifiers in applyCameraMotion. We do NOT use OrbitControls' getDistance/getAzimuthalAngle because - // OrbitControls reads from `camera.position` which has the temporary view shifts applied to it every frame. - const currentOffset = new THREE.Vector3(); - currentOffset.copy(this.baseCameraPosition).sub(startLookAt); - - const targetPos = new THREE.Vector3().copy(targetLookAt).add(currentOffset); - - this.startCameraTransition( - startPos, - startLookAt, - startFov, - targetPos, - targetLookAt, - dummyCamera.fov, - durationSeconds, - ); - } - - whenReady(): Promise { - return this.readyPromise; - } - - private resetReadyPromise(): void { - this.readyPromise = new Promise((resolve, reject) => { - this.resolveReady = resolve; - this.rejectReady = reject; - }); - } - - private settleReady(error?: unknown): void { - if (error) { - this.rejectReady?.(error); - } else { - this.resolveReady?.(); - } - this.resolveReady = null; - this.rejectReady = null; - } - - setup( - canvas: HTMLCanvasElement, - onUpdate: UpdateCallback, - options?: { - rendererPreference?: RendererPreference; - }, - ): void { - if (this.initialized && this.renderer?.domElement === canvas) { - this.onUpdate = onUpdate; - return; - } - if (this.initialized) this.dispose(); - this.onUpdate = onUpdate; - this.loadingAborted = false; - this.rendererPreference = options?.rendererPreference ?? "auto"; - this.resetReadyPromise(); - // Async renderer creation: tries WebGPU, falls back to WebGL. - // setup() remains synchronous for callers; the loop starts after init resolves. - void (async () => { - try { - const { backend, renderer } = await createRenderer( - canvas, - this.rendererPreference, - ); - const releaseKnownWebGpuWarningFilter = - backend === "webgpu" ? installKnownVrmWebGpuWarningFilter() : null; - // Guard: if dispose() was called while we were awaiting, abort. - if (this.loadingAborted) { - releaseKnownWebGpuWarningFilter?.(); - renderer.dispose(); - this.settleReady(); - return; - } - this.releaseKnownWebGpuWarningFilter = releaseKnownWebGpuWarningFilter; - this.renderer = renderer; - renderer.setClearColor(0x000000, 0); - if (backend === "webgl") { - const webglRenderer = renderer as THREE.WebGLRenderer; - webglRenderer.shadowMap.enabled = true; - webglRenderer.shadowMap.type = THREE.PCFSoftShadowMap; - webglRenderer.toneMapping = THREE.NoToneMapping; - webglRenderer.toneMappingExposure = 1.0; - webglRenderer.outputColorSpace = THREE.SRGBColorSpace; - } - this.rendererBackend = backend; - const scene = new THREE.Scene(); - this.scene = scene; - // Build construct environment (white void, floating screens, fog) - this.mathEnvironment = new MathEnvironment(); - this.mathEnvironment.build(scene, "light"); - const avatarRoot = new THREE.Group(); - avatarRoot.name = "AvatarRoot"; - scene.add(avatarRoot); - this.avatarRoot = avatarRoot; - const avatarLookTarget = new THREE.Group(); - avatarLookTarget.name = "AvatarLookTarget"; - scene.add(avatarLookTarget); - this.avatarLookTarget = avatarLookTarget; - const cameraRig = new THREE.Group(); - cameraRig.name = "AvatarCameraRig"; - scene.add(cameraRig); - const camera = new THREE.PerspectiveCamera(30, 1, 0.1, 20); - camera.position.set(0, 1.2, 5.0); - cameraRig.add(camera); - this.camera = camera; - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = false; - controls.target.copy(this.lookAtTarget); - controls.addEventListener("start", this.handleControlStart); - controls.addEventListener("end", this.handleControlEnd); - this.cameraManager.applyInteractionMode(controls, this.interactionMode); - controls.update(); - this.controls = controls; - this.setInteractionEnabled(this.interactionEnabled); - // Apply deferred camera profile (setCameraProfile may have been called - // before the camera existed) and initialize baseCameraPosition so that - // drag-orbit and companion-zoom have a valid reference point from the - // very first frame. - this.cameraManager.applyCameraProfileToCamera( - camera, - controls, - this.cameraProfile, - ); - this.baseCameraPosition.copy(camera.position); - this.lookAtTarget.copy(controls.target); - const ambient = new THREE.AmbientLight(0xffffff, 1.2); - scene.add(ambient); - const keyLight = new THREE.DirectionalLight(0xffffff, 1.0); - keyLight.position.set(1, 1.5, 1).normalize(); - keyLight.castShadow = true; - keyLight.shadow.mapSize.setScalar(1024); - scene.add(keyLight); - this.keyDirectionalLight = keyLight; - const fillLight = new THREE.DirectionalLight(0xffffff, 0.6); - fillLight.position.set(-1, 0.5, -1).normalize(); - scene.add(fillLight); - this.applyRendererPixelRatio(); - if (this.lowPowerRenderMode) { - this.applyLowPowerShadowPolicy(); - } - // Auto-create the scene overlay manager for floating HUD panels. - if (!this.overlayManager && this.scene) { - try { - this.overlayManager = new SceneOverlayManager(); - this.overlayManager.attach(this.scene); - } catch { - // Overlay panels require a full 2D canvas context; gracefully - // skip when running in headless / test environments. - } - } - this.initialized = true; - this.resumeLoop(); - this.settleReady(); - } catch (error) { - this.initialized = false; - this.releaseKnownWebGpuWarningFilter?.(); - this.releaseKnownWebGpuWarningFilter = null; - this.renderer = null; - this.rendererBackend = "webgl"; - this.scene = null; - this.camera = null; - this.controls = null; - this.keyDirectionalLight = null; - console.error("[VrmEngine] Failed to initialize renderer:", error); - this.settleReady(error); - } - })(); - } - - isInitialized(): boolean { - return this.initialized && this.renderer !== null; - } - dispose(): void { - this.loadingAborted = true; - this.stopLoop(); - this.mathEnvironment?.dispose(); - this.mathEnvironment = null; - this.overlayManager?.dispose(); - this.overlayManager = null; - this.initialized = false; - this.settleReady(); - this.releaseKnownWebGpuWarningFilter?.(); - this.releaseKnownWebGpuWarningFilter = null; - if (this.vrm?.scene.parent) { - this.vrm.scene.parent.remove(this.vrm.scene); - VRMUtils.deepDispose(this.vrm.scene); - } - if (this.controls) { - this.controls.removeEventListener("start", this.handleControlStart); - this.controls.removeEventListener("end", this.handleControlEnd); - this.controls.dispose(); - this.controls = null; - } - this.vrm = null; - this.vrmReady = false; - this.vrmName = null; - this.lastLoadError = null; - this.mixer = null; - this.idleAction = null; - this.idleLoadPromise = null; - this.clearPendingEmoteCompletion(); - this.emoteAction = null; - this.emoteClipCache.clear(); - this.teleportProgress = 1.0; - this.cleanupTeleportDissolve(); - this.cleanupTeleportSparkles(); - this.avatarLookTarget?.parent?.remove(this.avatarLookTarget); - this.avatarLookTarget = null; - this.avatarLookRig = { - headBone: null, - neckBone: null, - spineBone: null, - }; - this.headLookTarget.set(0, 0); - this.headLookCurrent.set(0, 0); - if (this.renderer) { - this.renderer.dispose(); - } - this.renderer = null; - this.rendererBackend = "webgl"; - this.keyDirectionalLight = null; - this.scene = null; - this.avatarRoot = null; - this.camera = null; - this.onUpdate = null; - this.paused = false; - } - - setPaused(paused: boolean): void { - if (this.paused === paused) return; - this.paused = paused; - if (paused) { - this.stopLoop(); - return; - } - this.resumeLoop(); - } - - /** - * Keeps the animation/render loop alive so the avatar keeps idling while - * background is hidden. Restores prior state when disabled. - */ - setMinimalBackgroundMode(enabled: boolean): void { - if (this.minimalBackgroundMode === enabled) return; - this.minimalBackgroundMode = enabled; - } - - /** - * When true, caps the WebGL/WebGPU pixel ratio at **1** on top of the usual - * DPR clamp and applies cheaper shadows — primarily for - * **battery** on Retina. Does **not** change frame cadence; use - * {@link setHalfFramerateMode} for ~half refresh rate. - * - * **WHY:** shader cost scales with physical pixels; `desktopGetPowerState` - * → `onBattery` toggles this from the Electrobun shell without a full reload. - */ - setLowPowerRenderMode(enabled: boolean): void { - if (this.lowPowerRenderMode === enabled) return; - this.lowPowerRenderMode = enabled; - this.applyRendererPixelRatio(); - this.applyLowPowerShadowPolicy(); - } - - /** - * When true, the main loop skips every other tick so `renderer.render` runs at - * roughly half the display refresh rate; skipped ticks do not call - * `clock.getDelta()`, so the next tick’s delta spans two intervals. - */ - setHalfFramerateMode(enabled: boolean): void { - if (this.halfFramerateMode === enabled) return; - this.halfFramerateMode = enabled; - this.halfFramerateSkipNext = false; - } - - setInteractionEnabled(enabled: boolean): void { - this.interactionEnabled = enabled; - if (this.controls) { - this.controls.enabled = enabled; - } - } - setInteractionMode(mode: InteractionMode): void { - this.interactionMode = mode; - if (this.controls) { - this.cameraManager.applyInteractionMode(this.controls, mode); - this.controls.update(); - } - } - setCameraProfile(profile: CameraProfile): void { - if (this.cameraProfile === profile) return; - - if (this.camera) { - const startFov = this.camera.fov; - const startPos = new THREE.Vector3().copy(this.camera.position); - const startLookAt = new THREE.Vector3().copy(this.lookAtTarget); - - this.cameraProfile = profile; - - const targetLookAt = new THREE.Vector3().copy(this.lookAtTarget); - const targetPos = new THREE.Vector3().copy(this.camera.position); - - let targetFov = this.camera.fov; - - if (this.vrm) { - const dummyCamera = this.camera.clone(); - this.cameraManager.centerAndFrame( - this.vrm, - dummyCamera, - this.controls, - this.cameraProfile, - targetLookAt, - targetPos, - (c) => - this.cameraManager.applyInteractionMode(c, this.interactionMode), - true, // skipControlUpdate - ); - targetFov = dummyCamera.fov; - } else { - const dummyCamera = this.camera.clone(); - this.cameraManager.applyCameraProfileToCamera( - dummyCamera, - this.controls, - this.cameraProfile, - ); - targetPos.copy(dummyCamera.position); - targetFov = dummyCamera.fov; - // controls.target handles lookAt internally or we just leap - if (this.controls) { - // Skipping instant snap of controls.target, we let transition handle it - targetLookAt.copy(this.controls.target); - } - } - - this.startCameraTransition( - startPos, - startLookAt, - startFov, - targetPos, - targetLookAt, - targetFov, - CAMERA_PROFILE_TRANSITION_DURATION_SECONDS, - ); - } else { - this.cameraProfile = profile; - } - } - resize(width: number, height: number): void { - if (!this.renderer || !this.camera) return; - if (width <= 0 || height <= 0) return; - const aspect = width / height; - if (!Number.isFinite(aspect) || aspect <= 0) return; - this.renderer.setSize(width, height, false); - this.camera.aspect = aspect; - this.camera.updateProjectionMatrix(); - } - getState(): VrmEngineState { - const idlePlaying = this.idleAction?.isRunning() ?? false; - return { - vrmLoaded: this.vrm !== null && this.vrmReady, - vrmName: this.vrmName, - loadError: this.lastLoadError, - idlePlaying, - idleTime: this.idleAction?.time ?? 0, - idleTracks: this.idleAction?.getClip()?.tracks.length ?? 0, - revealStarted: this.revealStarted, - loadingProgress: this.loadingProgress, - }; - } - setMouthOpen(value: number): void { - this.mouthValue = Math.max(0, Math.min(1, value)); - } - setSpeaking(speaking: boolean): void { - if (speaking && !this.speaking) { - this.speakingStartTime = this.elapsedTime; - } - this.speaking = speaking; - } - attachOverlayManager(manager: SceneOverlayManager): void { - this.overlayManager = manager; - if (this.scene) manager.attach(this.scene); - } - getOverlayManager(): SceneOverlayManager | null { - return this.overlayManager; - } - setCameraAnimation(config: Partial): void { - this.cameraAnimation = { ...this.cameraAnimation, ...config }; - } - setPointerParallaxEnabled(enabled: boolean): void { - this.pointerParallaxEnabled = enabled; - if (!enabled) { - this.pointerParallaxTarget.set(0, 0); - } - } - setPointerParallaxTarget(x: number, y: number): void { - this.pointerParallaxTarget.set( - THREE.MathUtils.clamp(x, -1, 1), - THREE.MathUtils.clamp(y, -1, 1), - ); - } - resetPointerParallax(): void { - this.pointerParallaxTarget.set(0, 0); - } - setDragOrbitTarget(yaw: number, pitch: number): void { - this.dragOrbitTarget.set( - THREE.MathUtils.clamp(yaw, -0.6, 0.6), - THREE.MathUtils.clamp(pitch, -0.35, 0.35), - ); - } - resetDragOrbit(): void { - this.dragOrbitTarget.set(0, 0); - } - setCompanionZoomNormalized(value: number): void { - this.companionZoomTarget = THREE.MathUtils.clamp(value, 0, 1); - } - setCameraXOffset(offset: number): void { - this.cameraXOffsetTarget = THREE.MathUtils.clamp(offset, -3, 3); - // Map the X offset to an orbital yaw offset (radians). - // Positive X offset → negative theta (orbit camera to the right so - // character appears on the left). - this.cameraYawOffsetTarget = -offset * 0.7; - } - - async setWorldUrl(_url: string | null): Promise { - // World backgrounds removed — math environment managed separately. - } - - /** Switch the mathematical environment theme. */ - setEnvironmentTheme(theme: "light" | "dark"): void { - this.mathEnvironment?.setTheme(theme); - } - async playEmote( - path: string, - duration: number, - loop: boolean, - ): Promise { - const vrm = this.vrm; - const mixer = this.mixer; - if (!vrm || !mixer) return; - // Don't start emotes while the teleport dissolve is still running or - // within a short cooldown afterwards — the idle animation needs time - // to settle into a stable pose before we can cross-fade from it. - const POST_TELEPORT_COOLDOWN = 0.3; // seconds - if ( - this.teleportProgress < 1.0 || - this.elapsedTime - this.teleportCompleteTime < POST_TELEPORT_COOLDOWN - ) { - return; - } - this.clearPendingEmoteCompletion(); - this.emoteRequestId++; - const requestId = this.emoteRequestId; - const currentEmote = this.emoteAction; - const clip = await this.loadEmoteClipCached(path, vrm); - if (!clip || this.vrm !== vrm || this.mixer !== mixer) return; - if (this.emoteRequestId !== requestId) return; - const action = mixer.clipAction(clip); - action.setLoop( - loop ? THREE.LoopRepeat : THREE.LoopOnce, - loop ? Infinity : 1, - ); - action.clampWhenFinished = !loop; - const fadeDuration = 0.4; - // Use explicit fadeOut + fadeIn instead of crossFadeFrom. crossFadeFrom - // only blends tracks that exist in BOTH clips — emotes exported with - // non-uniform keyframes (sparse Mixamo optimization) leave body/leg - // bones without tracks, so idle's tracks for those bones continue at - // full weight, creating visible overlap. Fading out the source - // explicitly ensures ALL its tracks fade away cleanly. - if (currentEmote && currentEmote !== action) { - currentEmote.fadeOut(fadeDuration); - } - if (this.idleAction && this.idleAction !== action) { - this.idleAction.fadeOut(fadeDuration); - } - action.reset(); - this.activateAction(action); - action.fadeIn(fadeDuration); - this.emoteAction = action; - if (!loop) { - const clipDuration = - Number.isFinite(duration) && duration > 0 ? duration : clip.duration; - this.watchOneShotEmoteCompletion(mixer, action, requestId, clipDuration); - } - } - stopEmote(): void { - this.clearPendingEmoteCompletion(); - const fadeDuration = 0.4; - const activeEmote = this.emoteAction; - this.emoteAction = null; - if (this.idleAction) { - this.activateAction(this.idleAction); - if (activeEmote && activeEmote !== this.idleAction) { - this.idleAction.crossFadeFrom(activeEmote, fadeDuration, false); - } else { - this.idleAction.fadeIn(fadeDuration); - } - return; - } - if (this.vrm && this.mixer) { - this.restoreIdleAfterEmote( - activeEmote, - fadeDuration, - this.vrm, - this.mixer, - ); - return; - } - activeEmote?.fadeOut(fadeDuration); - } - - /** Play a one-shot wave greeting after the VRM becomes visible. */ - playWaveGreeting(): void { - this.playEmote( - resolveAppAssetUrl("animations/emotes/greeting.fbx"), - 3, - false, - ); - } - - async loadVrmFromUrl(url: string, name?: string): Promise { - await this.whenReady(); - if (!this.scene) throw new Error("VrmEngine not initialized"); - if (!this.camera) throw new Error("VrmEngine not initialized"); - if (this.loadingAborted) return; - const requestId = ++this.vrmLoadRequestId; - const hadPreviousVrm = this.vrm !== null; - if (this.vrm) { - if (this.outgoingVrm) { - this.outgoingVrm.scene.parent?.remove(this.outgoingVrm.scene); - VRMUtils.deepDispose(this.outgoingVrm.scene); - } - this.outgoingVrm = this.vrm; - this.outgoingMixer = this.mixer; - this.vrm = null; - this.vrmReady = false; - this.vrmName = null; - this.mixer = null; - this.idleAction = null; - this.idleLoadPromise = null; - this.revealStarted = false; - this.clearPendingEmoteCompletion(); - this.emoteAction = null; - this.emoteClipCache.clear(); - } - this.lastLoadError = null; - this.loadingProgress = 0; - this.onUpdate?.(); - const loader = new GLTFLoader(); - configureVrmGltfLoader(loader); - const webGpuNodes = - this.rendererBackend === "webgpu" - ? await import("@pixiv/three-vrm/nodes") - : null; - loader.register((parser: VrmLoaderParser) => { - if (webGpuNodes) { - const mtoonOptions = { - materialType: webGpuNodes.MToonNodeMaterial as unknown, - } as ConstructorParameters[1]; - const mtoonMaterialPlugin = new MToonMaterialLoaderPlugin( - parser, - mtoonOptions, - ); - return new VRMLoaderPlugin(parser, { mtoonMaterialPlugin }); - } - return new VRMLoaderPlugin(parser); - }); - let gltf: Awaited>; - try { - gltf = await loadGltfAsset(loader, url, (progress) => { - if (this.vrmLoadRequestId === requestId && !this.loadingAborted) { - this.loadingProgress = progress; - this.onUpdate?.(); - } - }); - } catch (error) { - if (!this.loadingAborted && requestId === this.vrmLoadRequestId) { - this.lastLoadError = - error instanceof Error ? error.message : String(error); - this.onUpdate?.(); - } - throw error; - } - if ( - this.loadingAborted || - !this.scene || - requestId !== this.vrmLoadRequestId - ) { - const staleVrm = gltf.userData.vrm as VRM | undefined; - if (staleVrm) VRMUtils.deepDispose(staleVrm.scene); - return; - } - const vrm = gltf.userData.vrm as VRM | undefined; - if (!vrm) throw new Error("Loaded asset is not a VRM"); - VRMUtils.removeUnnecessaryVertices(vrm.scene); - if (this.camera) { - if (!hadPreviousVrm) { - this.cameraManager.centerAndFrame( - vrm, - this.camera, - this.controls, - this.cameraProfile, - this.lookAtTarget, - this.baseCameraPosition, - (c) => - this.cameraManager.applyInteractionMode(c, this.interactionMode), - ); - } - } - try { - VRMUtils.rotateVRM0(vrm); - } catch { - /* optional in some versions */ - } - this.cameraManager.ensureFacingCamera(vrm, this.camera); - this.configureAvatarLookTracking(vrm); - if ( - this.loadingAborted || - !this.scene || - requestId !== this.vrmLoadRequestId - ) { - VRMUtils.deepDispose(vrm.scene); - return; - } - vrm.scene.visible = false; - vrm.scene.traverse((obj: THREE.Object3D) => { - obj.frustumCulled = false; - }); - const avatarParent = this.avatarRoot ?? this.scene; - avatarParent.add(vrm.scene); - this.vrm = vrm; - this.vrmName = name ?? null; - this.lastLoadError = null; - vrm.springBoneManager?.reset?.(); - this.blinkController.reset(); - - try { - await this.loadAndPlayIdle(vrm); - if (!this.loadingAborted && this.vrm === vrm) { - this.vrmReady = true; - // Let the idle animation settle into a natural pose before revealing - await new Promise((resolve) => setTimeout(resolve, 300)); - if (this.loadingAborted || this.vrm !== vrm) return; - await this.playTeleportReveal(vrm); - vrm.scene.visible = true; - // Greeting animation is handled by CharacterEditor via vrm-teleport-complete event - } - } catch { - if (!this.loadingAborted && this.vrm === vrm) { - this.vrmReady = true; - vrm.scene.visible = true; - // Teleport animation failed (e.g. WebGPU unavailable) — still notify - // the app so companion UI (header, chat) becomes visible. - if (typeof window !== "undefined") { - window.dispatchEvent(new CustomEvent("eliza:vrm-teleport-complete")); - } - } - } - } - - private async playTeleportReveal(vrm: VRM): Promise { - if (this.outgoingVrm && this.camera) { - this.transitionCameraToFramedAvatar( - vrm, - AVATAR_SWITCH_CAMERA_TRANSITION_DURATION_SECONDS, - ); - } - - this.teleportProgress = 0.0; - this.cleanupTeleportDissolve(); - let appliedNodeDissolve = false; - - try { - const tsl = (await import("three/tsl")) as unknown as TslModule; - - const uProgress = tsl.uniform(0.0); - this.teleportProgressUniform = uProgress; - - const applyTslDissolve = (targetVrm: VRM, isOutgoing: boolean) => { - targetVrm.scene.traverse((obj: THREE.Object3D) => { - if (!(obj instanceof THREE.Mesh)) return; - const mats = Array.isArray(obj.material) - ? obj.material - : [obj.material]; - for (const mat of mats) { - if (!mat.isNodeMaterial || mat.userData._dissolveApplied) continue; - appliedNodeDissolve = true; - mat.userData._dissolveApplied = true; - mat.userData._origOpacityNode = mat.opacityNode ?? null; - mat.userData._origEmissiveNode = - (mat as MeshStandardMaterialWithNodeProps).emissiveNode ?? null; - mat.userData._origAlphaTest = mat.alphaTest; - - const worldY = tsl.positionWorld.y; - const threshold = uProgress - .mul(TELEPORT_DISSOLVE_END_Y - TELEPORT_DISSOLVE_START_Y) - .add(TELEPORT_DISSOLVE_START_Y); - const diff = worldY.sub(threshold); - - const nx = tsl.sin( - tsl.positionWorld.x.mul(18.0).add(worldY.mul(12.0)), - ); - const ny = tsl.cos( - worldY.mul(15.0).add(tsl.positionWorld.z.mul(10.0)), - ); - const nz = tsl.sin( - tsl.positionWorld.z.mul(18.0).add(tsl.positionWorld.x.mul(10.0)), - ); - const noise = nx.add(ny).add(nz).div(3.0).add(1.0).mul(0.5); - const ratio = diff.div(0.3).clamp(0.0, 1.0); - - const baseAlpha = tsl.step(ratio, noise); - const dissolveAlpha = isOutgoing - ? tsl.float(1.0).sub(baseAlpha) - : baseAlpha; - - const edgeDist = diff.abs(); - const glowWidth = tsl.float(0.08); - const glowIntensity = tsl - .float(1.0) - .sub(edgeDist.div(glowWidth).clamp(0.0, 1.0)); - const hueShift = tsl.fract(worldY.mul(3.0).add(uProgress.mul(2.0))); - const holoR = tsl - .smoothstep(tsl.float(0.3), tsl.float(0.7), hueShift) - .mul(0.8) - .add(0.2); - const holoG = tsl.float(0.9); - const holoB = tsl - .smoothstep(tsl.float(0.7), tsl.float(0.3), hueShift) - .mul(0.8) - .add(0.2); - const holoColor = tsl.vec3(holoR, holoG, holoB); - - const glowActive = tsl - .step(tsl.float(0.001), uProgress) - .mul(tsl.float(1.0).sub(tsl.step(tsl.float(0.999), uProgress))); - const emissiveBoost = holoColor.mul( - glowIntensity.mul(10.0).mul(glowActive).mul(dissolveAlpha), - ); - - const origOpacity = mat.opacityNode as TslNode; - mat.opacityNode = origOpacity - ? (origOpacity.mul(dissolveAlpha) ?? dissolveAlpha) - : dissolveAlpha; - - const matWithEmissive = mat as THREE.Material & { - emissiveNode?: TslNode; - }; - const origEmissive = matWithEmissive.emissiveNode; - matWithEmissive.emissiveNode = origEmissive - ? origEmissive.add(emissiveBoost) - : emissiveBoost; - - mat.alphaTest = 0.01; - mat.needsUpdate = true; - this.teleportDissolvedMaterials.push(mat); - } - }); - }; - - applyTslDissolve(vrm, false); - if (this.outgoingVrm) { - applyTslDissolve(this.outgoingVrm, true); - } - } catch (err) { - console.warn( - "[VrmEngine] TSL dissolve unavailable, showing instantly:", - err, - ); - } - - if (!appliedNodeDissolve) { - this.applyTeleportFallbackDissolve(vrm, false); - if (this.outgoingVrm) { - this.applyTeleportFallbackDissolve(this.outgoingVrm, true); - } - } - - // Force shader compilation by rendering invisible frames before displaying particles - await new Promise((resolve) => setTimeout(resolve, 0)); - if (typeof window !== "undefined") { - await new Promise((resolve) => - requestAnimationFrame(() => requestAnimationFrame(resolve)), - ); - } - - if (this.loadingAborted || this.vrm !== vrm) return; - - this.revealStarted = true; - this.startTeleportSparkles(vrm); - } - - private applyTeleportFallbackDissolve(vrm: VRM, isOutgoing: boolean): void { - vrm.scene.traverse((obj: THREE.Object3D) => { - if (!(obj instanceof THREE.Mesh)) return; - const mats = Array.isArray(obj.material) ? obj.material : [obj.material]; - for (const mat of mats) { - if (mat.userData._dissolveApplied) continue; - mat.userData._dissolveApplied = true; - mat.userData._origAlphaTest = mat.alphaTest; - mat.userData._origOnBeforeCompile = mat.onBeforeCompile; - mat.userData._origCustomProgramCacheKey = mat.customProgramCacheKey; - - const shaderRef = { - uniforms: { uTeleportProgress: { value: this.teleportProgress } }, - isOutgoing, - }; - this.teleportFallbackShaders.push(shaderRef); - - mat.alphaTest = Math.max(mat.alphaTest ?? 0, 0.01); - mat.onBeforeCompile = (shader: { - uniforms: Record; - vertexShader: string; - fragmentShader: string; - }) => { - shader.uniforms.uTeleportProgress = - shaderRef.uniforms.uTeleportProgress; - shader.vertexShader = ` -varying vec3 vTeleportWorldPosition; -${shader.vertexShader} -`.replace( - "#include ", - `vec4 teleportWorldPosTemp = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING -teleportWorldPosTemp = instanceMatrix * teleportWorldPosTemp; -#endif -teleportWorldPosTemp = modelMatrix * teleportWorldPosTemp; -vTeleportWorldPosition = teleportWorldPosTemp.xyz; -#include `, - ); - shader.fragmentShader = ` -uniform float uTeleportProgress; -varying vec3 vTeleportWorldPosition; -float teleportSmoothNoise(vec3 p) { - float nx = sin(p.x * 18.0 + p.y * 12.0); - float ny = cos(p.y * 15.0 + p.z * 10.0); - float nz = sin(p.z * 18.0 + p.x * 10.0); - return (nx + ny + nz) / 3.0 * 0.5 + 0.5; -} -${shader.fragmentShader} -` - .replace( - "#include ", - `float teleportThreshold = mix(${TELEPORT_DISSOLVE_START_Y.toFixed(1)}, ${TELEPORT_DISSOLVE_END_Y.toFixed(1)}, uTeleportProgress); -float teleportDiff = vTeleportWorldPosition.y - teleportThreshold; -float teleportRatio = clamp(teleportDiff / 0.3, 0.0, 1.0); -float teleportNoise = teleportSmoothNoise(vTeleportWorldPosition); -${isOutgoing ? "if (teleportNoise >= teleportRatio) discard;" : "if (teleportNoise < teleportRatio) discard;"} -#include `, - ) - .replace( - "#include ", - `#include - float teleportGlowDist = abs(teleportDiff); - float teleportGlowIntensity = 1.0 - clamp(teleportGlowDist / 0.08, 0.0, 1.0); - vec3 teleportHoloColor = vec3(0.3, 0.9, 0.8); - float teleportGlowActive = step(0.001, uTeleportProgress) * (1.0 - step(0.999, uTeleportProgress)); - float teleportDissolveAlpha = ${isOutgoing ? "1.0 - step(teleportRatio, teleportNoise)" : "step(teleportRatio, teleportNoise)"}; - totalEmissiveRadiance += teleportHoloColor * (teleportGlowIntensity * 10.0 * teleportGlowActive * teleportDissolveAlpha);`, - ); - - const originalOnBeforeCompile = mat.userData._origOnBeforeCompile; - if (typeof originalOnBeforeCompile === "function") { - originalOnBeforeCompile( - shader, - this.renderer as THREE.WebGLRenderer, - ); - } - }; - const origCacheKey = mat.userData._origCustomProgramCacheKey; - mat.customProgramCacheKey = () => { - const baseKey = - typeof origCacheKey === "function" ? origCacheKey.call(mat) : ""; - return `${baseKey}:${mat.type}:teleport-dissolve-fallback:${isOutgoing ? "out" : "in"}`; - }; - mat.needsUpdate = true; - this.teleportDissolvedMaterials.push(mat); - } - }); - } - - private startTeleportSparkles(vrm: VRM): void { - const parent = this.avatarRoot ?? this.scene; - if (!parent) return; - - this.cleanupTeleportSparkles(); - - const bounds = new THREE.Box3().setFromObject(vrm.scene); - const center = bounds.getCenter(new THREE.Vector3()); - const size = bounds.getSize(new THREE.Vector3()); - const sparkleGroup = new THREE.Group(); - sparkleGroup.position.set(center.x, bounds.min.y + 0.06, center.z); - parent.add(sparkleGroup); - - const texture = getTeleportSparkleTexture(); - const particleHeight = THREE.MathUtils.clamp(size.y * 0.82, 0.95, 1.75); - const particles: TeleportSparkleParticle[] = []; - - // Central high-energy flash - const flashMaterial = new THREE.SpriteMaterial({ - map: texture, - color: new THREE.Color().setHSL(0.55, 0.95, 0.65), - transparent: true, - opacity: 0, - depthWrite: false, - depthTest: false, - blending: THREE.AdditiveBlending, - }); - const flashSprite = new THREE.Sprite(flashMaterial); - flashSprite.visible = false; - flashSprite.renderOrder = 9999; - sparkleGroup.add(flashSprite); - particles.push({ - sprite: flashSprite, - material: flashMaterial, - baseAngle: 0, - baseRadius: 0, - height: size.y * 0.5, - start: 0, - duration: 0.3, - spin: 0, - wobble: 0, - wobbleSpeed: 0, - baseSize: 1.8, // Massive size marks it as the central flash - }); - - // Vertical streaks - for (let index = 0; index < 60; index += 1) { - const hue = 0.52 + Math.random() * 0.08; - const material = new THREE.SpriteMaterial({ - map: texture, - color: new THREE.Color().setHSL(hue, 0.95, 0.8), - transparent: true, - opacity: 0, - depthWrite: false, - depthTest: false, - blending: THREE.AdditiveBlending, - }); - const sprite = new THREE.Sprite(material); - sprite.visible = false; - sprite.renderOrder = 9999; - sparkleGroup.add(sprite); - - particles.push({ - sprite, - material, - baseAngle: Math.random() * Math.PI * 2, - baseRadius: Math.random() * 0.4 + 0.05, - height: particleHeight * (1.1 + Math.random() * 0.5), - start: Math.random() * 0.3, // Fast start - duration: 0.2 + Math.random() * 0.25, // Snappy duration - spin: (Math.random() - 0.5) * 0.5, - wobble: 0, - wobbleSpeed: 0, - baseSize: 0.02 + Math.random() * 0.05, // Thin width - }); - } - - this.teleportSparkles = { - group: sparkleGroup, - particles, - }; - this.updateTeleportSparkles(); - } - - private updateTeleportSparkles(): void { - const system = this.teleportSparkles; - if (!system) return; - - const progress = THREE.MathUtils.clamp(this.teleportProgress, 0, 1); - let anyVisible = false; - - for (const particle of system.particles) { - const localProgress = THREE.MathUtils.clamp( - (progress - particle.start) / particle.duration, - 0, - 1, - ); - - if (localProgress <= 0 || localProgress >= 1) { - particle.material.opacity = 0; - particle.sprite.visible = false; - continue; - } - - anyVisible = true; - const opacity = Math.sin(localProgress * Math.PI) * 1.5; - - if (particle.baseSize > 1.0) { - // Central flash - const scale = particle.baseSize * (1.0 + localProgress * 2.0); - particle.sprite.position.set(0, particle.height, 0); - particle.sprite.scale.setScalar(scale); - particle.sprite.visible = opacity > 0.01; - particle.material.opacity = Math.min(opacity, 1.0) * 0.45; - } else { - // Vertical streaks - const rise = localProgress ** 1.5; - const angle = particle.baseAngle + progress * particle.spin; - const radial = particle.baseRadius * (1.0 + rise * 0.6); - const x = Math.cos(angle) * radial; - const z = Math.sin(angle) * radial; - const y = particle.height * rise; - - const width = particle.baseSize * 0.6; - const height = particle.baseSize * (8.0 + localProgress * 6.0); - - particle.sprite.position.set(x, y, z); - particle.sprite.scale.set(width, height, 1); - particle.sprite.visible = opacity > 0.01; - particle.material.opacity = Math.min(opacity, 1.0); - } - } - - if (!anyVisible && progress >= 1) { - this.cleanupTeleportSparkles(); - } - } - - private cleanupTeleportDissolve(): void { - for (const mat of this.teleportDissolvedMaterials) { - if (mat.userData._dissolveApplied) { - if (mat.userData._origOpacityNode !== undefined) { - (mat as MeshStandardMaterialWithNodeProps).opacityNode = - mat.userData._origOpacityNode ?? null; - } - if (mat.userData._origEmissiveNode !== undefined) { - (mat as MeshStandardMaterialWithNodeProps).emissiveNode = - mat.userData._origEmissiveNode ?? null; - } - mat.alphaTest = mat.userData._origAlphaTest ?? 0; - mat.onBeforeCompile = - mat.userData._origOnBeforeCompile ?? mat.onBeforeCompile; - mat.customProgramCacheKey = - mat.userData._origCustomProgramCacheKey ?? mat.customProgramCacheKey; - delete mat.userData._dissolveApplied; - delete mat.userData._origOpacityNode; - delete mat.userData._origEmissiveNode; - delete mat.userData._origAlphaTest; - delete mat.userData._origOnBeforeCompile; - delete mat.userData._origCustomProgramCacheKey; - mat.needsUpdate = true; - } - } - this.teleportDissolvedMaterials = []; - this.teleportProgressUniform = null; - this.teleportFallbackShaders = []; - } - - private cleanupTeleportSparkles(): void { - if (!this.teleportSparkles) return; - for (const particle of this.teleportSparkles.particles) { - particle.sprite.parent?.remove(particle.sprite); - particle.material.dispose(); - } - this.teleportSparkles.group.parent?.remove(this.teleportSparkles.group); - this.teleportSparkles = null; - } - private get animationLoaderContext(): AnimationLoaderContext { - return { - isAborted: () => this.loadingAborted, - isCurrentVrm: (vrm: VRM) => this.vrm === vrm, - }; - } - private loop(): void { - if (this.paused) return; - this.scheduleNextFrame(); - const renderer = this.renderer; - const scene = this.scene; - const camera = this.camera; - if (!renderer || !scene || !camera) return; - - if (this.halfFramerateMode) { - if (this.halfFramerateSkipNext) { - this.halfFramerateSkipNext = false; - return; - } - this.halfFramerateSkipNext = true; - } else { - this.halfFramerateSkipNext = false; - } - - // Reset camera to the pristine tracking base before processing this frame's - // motion and offsets. This ensures OrbitControls and transitions never see - // the temporary frame-based dynamic offsets (zoom, yaw, depth shift), - // which prevents them from being doubled or accumulated into the state. - if (this.baseCameraPosition.lengthSq() > 1e-6) { - camera.position.copy(this.baseCameraPosition); - } - const rawDelta = this.clock.getDelta(); - const stableDelta = Math.min(rawDelta, 1 / 30); - this.elapsedTime += rawDelta; - this.mixer?.update(rawDelta); - this.outgoingMixer?.update(rawDelta); - if (this.outgoingVrm) { - this.applyMouthToVrm(this.outgoingVrm); - this.outgoingVrm.update(stableDelta); - } - if (this.vrm) { - if (this.teleportProgress < 1.0) { - this.teleportProgress += stableDelta * 2.8; // ~0.35 seconds duration - if (this.teleportProgress > 1.0) this.teleportProgress = 1.0; - - if (this.teleportProgressUniform) { - this.teleportProgressUniform.value = this.teleportProgress; - } - for (const shader of this.teleportFallbackShaders) { - shader.uniforms.uTeleportProgress.value = this.teleportProgress; - } - - if (this.teleportProgress >= 1.0) { - if (this.outgoingVrm) { - this.outgoingVrm.scene.parent?.remove(this.outgoingVrm.scene); - VRMUtils.deepDispose(this.outgoingVrm.scene); - this.outgoingVrm = null; - this.outgoingMixer = null; - } - this.cleanupTeleportDissolve(); - this.cleanupTeleportSparkles(); - this.teleportCompleteTime = this.elapsedTime; - // Notify the app that the teleport-in animation has finished - if (typeof window !== "undefined") { - window.dispatchEvent( - new CustomEvent("eliza:vrm-teleport-complete"), - ); - } - } - } - this.updateTeleportSparkles(); - - this.applyMouthToVrm(this.vrm); - const blinkValue = this.blinkController.update(rawDelta); - this.vrm.expressionManager?.setValue("blink", blinkValue); - } - - // Process camera transition - if (this.isCameraTransitioning) { - this.transitionProgress += stableDelta / this.transitionDuration; - let finished = false; - if (this.transitionProgress >= 1.0) { - this.transitionProgress = 1.0; - this.isCameraTransitioning = false; - finished = true; - } - - // Smooth step easing - const t = this.transitionProgress; - const ease = t * t * (3.0 - 2.0 * t); - - camera.position.lerpVectors( - this.transitionStartPos, - this.transitionTargetPos, - ease, - ); - this.baseCameraPosition.copy(camera.position); - - this.lookAtTarget.lerpVectors( - this.transitionStartLookAt, - this.transitionTargetLookAt, - ease, - ); - - camera.fov = THREE.MathUtils.lerp( - this.transitionStartFov, - this.transitionTargetFov, - ease, - ); - camera.updateProjectionMatrix(); - - if (this.controls) { - this.controls.target.copy(this.lookAtTarget); - if (finished) { - this.controls.update(); // Sync once at the very end when bounds match - } - } - } - - const manualCameraActive = this.interactionEnabled; - if ( - !manualCameraActive && - this.cameraAnimation.enabled && - this.baseCameraPosition.length() > 0 - ) { - this.cameraManager.applyCameraMotion( - camera, - this.baseCameraPosition, - this.lookAtTarget, - this.cameraAnimation, - this.elapsedTime, - ); - } - const dragOrbitFollow = Math.min(1, stableDelta * 9); - this.dragOrbitCurrent.lerp(this.dragOrbitTarget, dragOrbitFollow); - if ( - this.dragOrbitCurrent.lengthSq() > 1e-6 && - this.baseCameraPosition.lengthSq() > 1e-6 - ) { - const orbitOffset = this.tempCameraOrbitOffset - .copy(camera.position) - .sub(this.lookAtTarget); - if (orbitOffset.lengthSq() > 1e-6) { - const spherical = this.tempCameraSpherical.setFromVector3(orbitOffset); - spherical.theta += this.dragOrbitCurrent.x; - spherical.phi = THREE.MathUtils.clamp( - spherical.phi + this.dragOrbitCurrent.y, - 0.2, - Math.PI - 0.2, - ); - orbitOffset.setFromSpherical(spherical); - camera.position.copy(this.lookAtTarget).add(orbitOffset); - } - } - this.applyCompanionZoom(camera, stableDelta); - // Smoothly lerp camera orbital yaw offset (used by CharacterEditor to - // rotate around the character so she appears on the left side). - const editorFollow = Math.min(1, stableDelta * 5); - this.cameraXOffsetCurrent = THREE.MathUtils.lerp( - this.cameraXOffsetCurrent, - this.cameraXOffsetTarget, - editorFollow, - ); - this.cameraYawOffsetCurrent = THREE.MathUtils.lerp( - this.cameraYawOffsetCurrent, - this.cameraYawOffsetTarget, - editorFollow, - ); - // Scale offset by inverse zoom: more shift when zoomed out, less when in - const zoomScale = 1 - this.companionZoomCurrent * 0.8; - if (Math.abs(this.cameraYawOffsetCurrent) > 1e-5) { - const orbitVec = this.tempCameraOrbitOffset - .copy(camera.position) - .sub(this.lookAtTarget); - if (orbitVec.lengthSq() > 1e-6) { - const sph = this.tempCameraSpherical.setFromVector3(orbitVec); - sph.theta += this.cameraYawOffsetCurrent * zoomScale; - orbitVec.setFromSpherical(sph); - camera.position.copy(this.lookAtTarget).add(orbitVec); - } - } - // Also translate camera on X for the positional shift - const scaledXOffset = this.cameraXOffsetCurrent * zoomScale; - if (Math.abs(scaledXOffset) > 1e-4) { - camera.position.x += scaledXOffset; - } - if (this.pointerParallaxEnabled) { - const follow = Math.min(1, stableDelta * 7.5); - this.pointerParallaxCurrent.lerp(this.pointerParallaxTarget, follow); - this.pointerParallaxPosition.set( - this.pointerParallaxCurrent.x * 0.18, - this.pointerParallaxCurrent.y * 0.12, - 0, - ); - camera.position.add(this.pointerParallaxPosition); - this.pointerParallaxLookAt - .copy(this.lookAtTarget) - .add( - new THREE.Vector3( - this.pointerParallaxCurrent.x * 0.08 + scaledXOffset, - this.pointerParallaxCurrent.y * 0.05, - 0, - ), - ); - } else { - this.pointerParallaxCurrent.lerp(this.pointerParallaxTarget, 0.12); - this.pointerParallaxLookAt.copy(this.lookAtTarget); - if (Math.abs(scaledXOffset) > 1e-4) { - this.pointerParallaxLookAt.x += scaledXOffset; - } - } - if (this.controls) { - if (manualCameraActive && !this.isCameraTransitioning) { - this.controls.update(); - this.lookAtTarget.copy(this.controls.target); - // Track the manual move in our clean base position - this.baseCameraPosition.copy(camera.position); - } else if (!this.isCameraTransitioning) { - this.controls.target.copy(this.lookAtTarget); - } - } - if (!manualCameraActive || this.isCameraTransitioning) { - camera.lookAt(this.pointerParallaxLookAt); - } - if (this.vrm) { - this.updateAvatarLookTarget(camera, stableDelta); - this.vrm.update(stableDelta); - this.applyAvatarHeadTracking(camera, stableDelta); - this.refreshAvatarEyeTracking(); - } - this.mathEnvironment?.update(stableDelta, camera); - this.overlayManager?.update(camera, stableDelta); - renderer.render(scene, camera); - this.onUpdate?.(); - } - private async loadAndPlayIdle(vrm: VRM): Promise { - if (this.loadingAborted) return; - const mixer = this.mixer ?? new THREE.AnimationMixer(vrm.scene); - this.mixer = mixer; - const action = await this.ensureIdleAction(vrm, mixer); - if (!action) return; - action.fadeIn(0.25); - action.play(); - mixer.update(1 / 60); - } - private async loadEmoteClipCached( - path: string, - vrm: VRM, - ): Promise { - const cached = this.emoteClipCache.get(path); - if (cached) return cached; - const clip = await loadEmoteClip(path, vrm, this.animationLoaderContext); - if (clip) { - this.emoteClipCache.set(path, clip); - } - return clip; - } - private applyMouthToVrm(vrm: VRM): void { - const manager = vrm.expressionManager; - if (!manager) return; - let target: number; - if (this.speaking) { - const elapsed = this.elapsedTime - this.speakingStartTime; - const base = Math.sin(elapsed * 12) * 0.3 + 0.4; - const detail = Math.sin(elapsed * 18.7) * 0.15; - const slow = Math.sin(elapsed * 4.2) * 0.1; - target = Math.max(0, Math.min(1, base + detail + slow)); - } else { - target = this.mouthValue; - } - const next = Math.max(0, Math.min(1, target)); - const alpha = next > this.mouthSmoothed ? 0.3 : 0.2; - this.mouthSmoothed = this.mouthSmoothed * (1 - alpha) + next * alpha; - manager.setValue("aa", this.mouthSmoothed); - } - - /** - * Capture a single-frame snapshot of the current VRM as a PNG Blob. - * - * When `disablePhysics` is true (the default), spring bone simulation is - * frozen for the capture frame so hair and cloth render in their rest pose, - * then restored afterwards. The render loop is paused during capture to - * prevent physics from re-running between reset and canvas capture. - */ - async snapshot(options?: { - width?: number; - height?: number; - disablePhysics?: boolean; - }): Promise { - const renderer = this.renderer; - const scene = this.scene; - const camera = this.camera; - if (!renderer || !scene || !camera) return null; - - const canvas = renderer.domElement as HTMLCanvasElement; - if (!canvas) return null; - - const disablePhysics = options?.disablePhysics ?? true; - const width = options?.width ?? canvas.width; - const height = options?.height ?? canvas.height; - - // Pause the render loop so physics doesn't re-run between reset and capture - const wasPaused = this.paused; - this.setPaused(true); - // Cancel any pending animation frame to ensure the loop truly stops - if (this.animationFrameId !== null) { - cancelAnimationFrame(this.animationFrameId); - this.animationFrameId = null; - } - - // Reset spring bones to rest pose (hair/cloth at initial position) - const springBoneManager = this.vrm?.springBoneManager ?? null; - if (disablePhysics && springBoneManager?.reset) { - springBoneManager.reset(); - } - - // Resize renderer for the capture resolution - renderer.setPixelRatio(1); - renderer.setSize(width, height); - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - // Update VRM transforms without physics - if (this.vrm) { - if (disablePhysics && springBoneManager) { - // Update only the humanoid/expression without spring bones - this.vrm.humanoid?.update?.(); - this.vrm.expressionManager?.update?.(); - } else { - this.vrm.update(0); - } - } - - // Render the frame (synchronous — captures immediately to canvas) - renderer.render(scene, camera); - - // Capture the canvas - const blob = await new Promise((resolve) => { - canvas.toBlob((b) => resolve(b), "image/png"); - }); - - // Restore drawing buffer + DPR policy (matches normal display, including - // low-power cap) instead of raw `devicePixelRatio` alone. - this.applyRendererPixelRatio(); - - // Restore paused state — resume the render loop - this.setPaused(wasPaused); - - return blob; - } -} diff --git a/plugins/plugin-companion/src/components/avatar/VrmFootShadow.ts b/plugins/plugin-companion/src/components/avatar/VrmFootShadow.ts deleted file mode 100644 index a42543059a887..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/VrmFootShadow.ts +++ /dev/null @@ -1,97 +0,0 @@ -import type { VRM } from "@pixiv/three-vrm"; -import * as THREE from "three"; - -/** - * Manages a soft radial shadow disc placed beneath the VRM avatar's feet. - */ -export class VrmFootShadow { - private mesh: THREE.Mesh | null = null; - private readonly tempLeft = new THREE.Vector3(); - private readonly tempRight = new THREE.Vector3(); - private readonly tempCenter = new THREE.Vector3(); - - /** Create (or recreate) the shadow disc and add it to `scene`. */ - create(scene: THREE.Scene): void { - this.dispose(scene); - - const shadowCanvas = document.createElement("canvas"); - shadowCanvas.width = 128; - shadowCanvas.height = 128; - - const context = shadowCanvas.getContext("2d"); - if (!context) return; - - const gradient = context.createRadialGradient(64, 64, 0, 64, 64, 64); - gradient.addColorStop(0, "rgba(0, 0, 0, 0.4)"); - gradient.addColorStop(0.5, "rgba(0, 0, 0, 0.2)"); - gradient.addColorStop(1, "rgba(0, 0, 0, 0)"); - - context.fillStyle = gradient; - context.fillRect(0, 0, 128, 128); - - const shadowTexture = new THREE.CanvasTexture(shadowCanvas); - const shadowGeometry = new THREE.PlaneGeometry(2.2, 2.2); - const shadowMaterial = new THREE.MeshBasicMaterial({ - map: shadowTexture, - transparent: true, - alphaTest: 0.001, - depthWrite: false, - }); - - const shadow = new THREE.Mesh(shadowGeometry, shadowMaterial); - shadow.rotation.x = -Math.PI / 2; - shadow.position.set(0, 0, 0); - scene.add(shadow); - this.mesh = shadow; - } - - /** Update shadow position to follow the VRM on the ground plane. */ - update(vrm: VRM): void { - if (!this.mesh) return; - vrm.scene.updateMatrixWorld(true); - const humanoid = vrm.humanoid; - const leftFoot = humanoid?.getNormalizedBoneNode("leftFoot"); - const rightFoot = humanoid?.getNormalizedBoneNode("rightFoot"); - - if (leftFoot && rightFoot) { - leftFoot.getWorldPosition(this.tempLeft); - rightFoot.getWorldPosition(this.tempRight); - this.tempCenter - .copy(this.tempLeft) - .add(this.tempRight) - .multiplyScalar(0.5); - this.mesh.position.copy(this.tempCenter); - return; - } - - const bounds = new THREE.Box3().setFromObject(vrm.scene); - if (!bounds.isEmpty()) { - bounds.getCenter(this.tempCenter); - this.mesh.position.set( - this.tempCenter.x, - bounds.min.y, - this.tempCenter.z, - ); - } - } - - /** Remove and dispose of the shadow mesh, releasing GPU resources. */ - dispose(scene: THREE.Scene): void { - if (!this.mesh) return; - scene.remove(this.mesh); - this.mesh.geometry.dispose(); - const material = this.mesh.material; - if (Array.isArray(material)) { - for (const mat of material) { - const meshMat = mat as THREE.MeshBasicMaterial; - meshMat.map?.dispose(); - meshMat.dispose(); - } - } else { - const meshMat = material as THREE.MeshBasicMaterial; - meshMat.map?.dispose(); - meshMat.dispose(); - } - this.mesh = null; - } -} diff --git a/plugins/plugin-companion/src/components/avatar/VrmTeleportEffect.ts b/plugins/plugin-companion/src/components/avatar/VrmTeleportEffect.ts deleted file mode 100644 index 1ccececbe6514..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/VrmTeleportEffect.ts +++ /dev/null @@ -1,525 +0,0 @@ -import type { VRM } from "@pixiv/three-vrm"; -import * as THREE from "three"; - -/** Three.js NodeMaterial exposes emissiveNode/opacityNode but they are not in public MeshStandardMaterial types. */ -interface MeshStandardMaterialWithNodeProps { - emissiveNode?: unknown | null; - opacityNode?: unknown | null; -} - -// biome-ignore lint/suspicious/noExplicitAny: Three.js TSL shader nodes are opaque chainable objects with no exported types. -type TslNodeLike = any; - -type TslModule = { - uniform(value: number): TslNodeLike; - positionWorld: { x: TslNodeLike; y: TslNodeLike; z: TslNodeLike }; - sin(value: unknown): TslNodeLike; - cos(value: unknown): TslNodeLike; - step(edge: unknown, value: unknown): TslNodeLike; - float(value: number): TslNodeLike; - fract(value: unknown): TslNodeLike; - smoothstep(edge0: unknown, edge1: unknown, value: unknown): TslNodeLike; - vec3(x: unknown, y: unknown, z: unknown): TslNodeLike; -}; - -export type TeleportFallbackShader = { - uniforms: { uTeleportProgress: { value: number } }; - isOutgoing?: boolean; -}; - -export type TeleportSparkleParticle = { - sprite: THREE.Sprite; - material: THREE.SpriteMaterial; - baseAngle: number; - baseRadius: number; - height: number; - start: number; - duration: number; - spin: number; - wobble: number; - wobbleSpeed: number; - baseSize: number; -}; - -export type TeleportSparkleSystem = { - group: THREE.Group; - particles: TeleportSparkleParticle[]; -}; - -const TELEPORT_DISSOLVE_START_Y = -1.2; -const TELEPORT_DISSOLVE_END_Y = 1.0; - -let teleportSparkleTexture: THREE.CanvasTexture | null = null; -function getTeleportSparkleTexture(): THREE.CanvasTexture { - if (teleportSparkleTexture) return teleportSparkleTexture; - const canvas = document.createElement("canvas"); - canvas.width = 128; - canvas.height = 128; - const context = canvas.getContext("2d"); - if (!context) { - teleportSparkleTexture = new THREE.CanvasTexture(canvas); - return teleportSparkleTexture; - } - - const gradient = context.createRadialGradient(64, 64, 6, 64, 64, 64); - gradient.addColorStop(0.0, "rgba(255,255,255,1)"); - gradient.addColorStop(0.2, "rgba(190,245,255,0.95)"); - gradient.addColorStop(0.55, "rgba(112,214,255,0.48)"); - gradient.addColorStop(1.0, "rgba(112,214,255,0)"); - context.fillStyle = gradient; - context.fillRect(0, 0, 128, 128); - - teleportSparkleTexture = new THREE.CanvasTexture(canvas); - teleportSparkleTexture.needsUpdate = true; - return teleportSparkleTexture; -} - -export class VrmTeleportEffect { - private progress = 1.0; - private completeTime = -Infinity; - private progressUniform: { value: number } | null = null; - private dissolvedMaterials: THREE.Material[] = []; - private fallbackShaders: TeleportFallbackShader[] = []; - private sparkles: TeleportSparkleSystem | null = null; - private revealStarted = false; - - public get teleportProgress() { - return this.progress; - } - public get teleportCompleteTime() { - return this.completeTime; - } - public get isRevealStarted() { - return this.revealStarted; - } - - public resetState() { - this.progress = 1.0; - this.revealStarted = false; - this.cleanupDissolve(); - this.cleanupSparkles(); - } - - public async play( - vrm: VRM, - outgoingVrm: VRM | null, - avatarParent: THREE.Object3D, - renderer: THREE.WebGLRenderer | null, - onAborted: () => boolean, - ): Promise { - this.progress = 0.0; - this.cleanupDissolve(); - let appliedNodeDissolve = false; - - try { - const tsl = (await import("three/tsl")) as TslModule; - const uProgress = tsl.uniform(0.0); - this.progressUniform = uProgress; - - const applyTslDissolve = (targetVrm: VRM, isOutgoing: boolean) => { - targetVrm.scene.traverse((obj: THREE.Object3D) => { - if (!(obj instanceof THREE.Mesh)) return; - const mats = Array.isArray(obj.material) - ? obj.material - : [obj.material]; - for (const mat of mats) { - if (!mat.isNodeMaterial || mat.userData._dissolveApplied) continue; - appliedNodeDissolve = true; - mat.userData._dissolveApplied = true; - mat.userData._origOpacityNode = mat.opacityNode ?? null; - mat.userData._origEmissiveNode = - (mat as MeshStandardMaterialWithNodeProps).emissiveNode ?? null; - mat.userData._origAlphaTest = mat.alphaTest; - - const worldY = tsl.positionWorld.y; - const threshold = uProgress - .mul(TELEPORT_DISSOLVE_END_Y - TELEPORT_DISSOLVE_START_Y) - .add(TELEPORT_DISSOLVE_START_Y); - const diff = worldY.sub(threshold); - - const nx = tsl.sin( - tsl.positionWorld.x.mul(18.0).add(worldY.mul(12.0)), - ); - const ny = tsl.cos( - worldY.mul(15.0).add(tsl.positionWorld.z.mul(10.0)), - ); - const nz = tsl.sin( - tsl.positionWorld.z.mul(18.0).add(tsl.positionWorld.x.mul(10.0)), - ); - const noise = nx.add(ny).add(nz).div(3.0).add(1.0).mul(0.5); - const ratio = diff.div(0.3).clamp(0.0, 1.0); - - const baseAlpha = tsl.step(ratio, noise); - const dissolveAlpha = isOutgoing - ? tsl.float(1.0).sub(baseAlpha) - : baseAlpha; - - const edgeDist = diff.abs(); - const glowWidth = tsl.float(0.08); - const glowIntensity = tsl - .float(1.0) - .sub(edgeDist.div(glowWidth).clamp(0.0, 1.0)); - const hueShift = tsl.fract(worldY.mul(3.0).add(uProgress.mul(2.0))); - const holoR = tsl - .smoothstep(tsl.float(0.3), tsl.float(0.7), hueShift) - .mul(0.8) - .add(0.2); - const holoG = tsl.float(0.9); - const holoB = tsl - .smoothstep(tsl.float(0.7), tsl.float(0.3), hueShift) - .mul(0.8) - .add(0.2); - const holoColor = tsl.vec3(holoR, holoG, holoB); - - const glowActive = tsl - .step(tsl.float(0.001), uProgress) - .mul(tsl.float(1.0).sub(tsl.step(tsl.float(0.999), uProgress))); - const emissiveBoost = holoColor.mul( - glowIntensity.mul(10.0).mul(glowActive).mul(dissolveAlpha), - ); - - const nodeMaterial = mat as MeshStandardMaterialWithNodeProps & - THREE.Material; - const origOpacity = nodeMaterial.opacityNode as - | TslNodeLike - | null - | undefined; - nodeMaterial.opacityNode = origOpacity - ? (origOpacity.mul(dissolveAlpha) ?? dissolveAlpha) - : dissolveAlpha; - - const origEmissive = nodeMaterial.emissiveNode as - | TslNodeLike - | null - | undefined; - nodeMaterial.emissiveNode = origEmissive - ? origEmissive.add(emissiveBoost) - : emissiveBoost; - - mat.alphaTest = 0.01; - mat.needsUpdate = true; - this.dissolvedMaterials.push(mat); - } - }); - }; - - applyTslDissolve(vrm, false); - if (outgoingVrm) { - applyTslDissolve(outgoingVrm, true); - } - } catch (err) { - console.warn( - "[VrmTeleportEffect] TSL dissolve unavailable, showing instantly:", - err, - ); - } - - if (!appliedNodeDissolve) { - this.applyFallbackDissolve(vrm, false, renderer); - if (outgoingVrm) { - this.applyFallbackDissolve(outgoingVrm, true, renderer); - } - } - - await new Promise((resolve) => setTimeout(resolve, 0)); - if (typeof window !== "undefined") { - await new Promise((resolve) => - requestAnimationFrame(() => requestAnimationFrame(resolve)), - ); - } - - if (onAborted()) return; - - this.revealStarted = true; - this.startSparkles(vrm, avatarParent); - } - - public update( - stableDelta: number, - elapsedTime: number, - onComplete?: () => void, - ): void { - if (this.progress < 1.0) { - this.progress += stableDelta * 2.8; // ~0.35 seconds duration - if (this.progress > 1.0) this.progress = 1.0; - - if (this.progressUniform) { - this.progressUniform.value = this.progress; - } - for (const shader of this.fallbackShaders) { - shader.uniforms.uTeleportProgress.value = this.progress; - } - - if (this.progress >= 1.0) { - this.cleanupDissolve(); - this.cleanupSparkles(); - this.completeTime = elapsedTime; - onComplete?.(); - } - } - this.updateSparkles(); - } - - public dispose(): void { - this.resetState(); - } - - private applyFallbackDissolve( - vrm: VRM, - isOutgoing: boolean, - renderer: THREE.WebGLRenderer | null, - ): void { - vrm.scene.traverse((obj: THREE.Object3D) => { - if (!(obj instanceof THREE.Mesh)) return; - const mats = Array.isArray(obj.material) ? obj.material : [obj.material]; - for (const mat of mats) { - if (mat.userData._dissolveApplied) continue; - mat.userData._dissolveApplied = true; - mat.userData._origAlphaTest = mat.alphaTest; - mat.userData._origOnBeforeCompile = mat.onBeforeCompile; - mat.userData._origCustomProgramCacheKey = mat.customProgramCacheKey; - - const shaderRef = { - uniforms: { uTeleportProgress: { value: this.progress } }, - isOutgoing, - }; - this.fallbackShaders.push(shaderRef); - - mat.alphaTest = Math.max(mat.alphaTest ?? 0, 0.01); - mat.onBeforeCompile = (shader: { - uniforms: Record; - vertexShader: string; - fragmentShader: string; - }) => { - shader.uniforms.uTeleportProgress = - shaderRef.uniforms.uTeleportProgress; - shader.vertexShader = ` -varying vec3 vTeleportWorldPosition; -${shader.vertexShader} -`.replace( - "#include ", - `vec4 teleportWorldPosTemp = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING -teleportWorldPosTemp = instanceMatrix * teleportWorldPosTemp; -#endif -teleportWorldPosTemp = modelMatrix * teleportWorldPosTemp; -vTeleportWorldPosition = teleportWorldPosTemp.xyz; -#include `, - ); - shader.fragmentShader = ` -uniform float uTeleportProgress; -varying vec3 vTeleportWorldPosition; -float teleportSmoothNoise(vec3 p) { - float nx = sin(p.x * 18.0 + p.y * 12.0); - float ny = cos(p.y * 15.0 + p.z * 10.0); - float nz = sin(p.z * 18.0 + p.x * 10.0); - return (nx + ny + nz) / 3.0 * 0.5 + 0.5; -} -${shader.fragmentShader} -` - .replace( - "#include ", - `float teleportThreshold = mix(${TELEPORT_DISSOLVE_START_Y.toFixed(1)}, ${TELEPORT_DISSOLVE_END_Y.toFixed(1)}, uTeleportProgress); -float teleportDiff = vTeleportWorldPosition.y - teleportThreshold; -float teleportRatio = clamp(teleportDiff / 0.3, 0.0, 1.0); -float teleportNoise = teleportSmoothNoise(vTeleportWorldPosition); -${isOutgoing ? "if (teleportNoise >= teleportRatio) discard;" : "if (teleportNoise < teleportRatio) discard;"} -#include `, - ) - .replace( - "#include ", - `#include - float teleportGlowDist = abs(teleportDiff); - float teleportGlowIntensity = 1.0 - clamp(teleportGlowDist / 0.08, 0.0, 1.0); - vec3 teleportHoloColor = vec3(0.3, 0.9, 0.8); - float teleportGlowActive = step(0.001, uTeleportProgress) * (1.0 - step(0.999, uTeleportProgress)); - float teleportDissolveAlpha = ${isOutgoing ? "1.0 - step(teleportRatio, teleportNoise)" : "step(teleportRatio, teleportNoise)"}; - totalEmissiveRadiance += teleportHoloColor * (teleportGlowIntensity * 10.0 * teleportGlowActive * teleportDissolveAlpha);`, - ); - - const originalOnBeforeCompile = mat.userData._origOnBeforeCompile; - if (typeof originalOnBeforeCompile === "function") { - originalOnBeforeCompile(shader, renderer); - } - }; - const origCacheKey = mat.userData._origCustomProgramCacheKey; - mat.customProgramCacheKey = () => { - const baseKey = - typeof origCacheKey === "function" ? origCacheKey.call(mat) : ""; - return `${baseKey}:${mat.type}:teleport-dissolve-fallback:${isOutgoing ? "out" : "in"}`; - }; - mat.needsUpdate = true; - this.dissolvedMaterials.push(mat); - } - }); - } - - private startSparkles(vrm: VRM, parent: THREE.Object3D): void { - this.cleanupSparkles(); - - const bounds = new THREE.Box3().setFromObject(vrm.scene); - const center = bounds.getCenter(new THREE.Vector3()); - const size = bounds.getSize(new THREE.Vector3()); - const sparkleGroup = new THREE.Group(); - sparkleGroup.position.set(center.x, bounds.min.y + 0.06, center.z); - parent.add(sparkleGroup); - - const texture = getTeleportSparkleTexture(); - const particleHeight = THREE.MathUtils.clamp(size.y * 0.82, 0.95, 1.75); - const particles: TeleportSparkleParticle[] = []; - - const flashMaterial = new THREE.SpriteMaterial({ - map: texture, - color: new THREE.Color().setHSL(0.55, 0.95, 0.65), - transparent: true, - opacity: 0, - depthWrite: false, - depthTest: false, - blending: THREE.AdditiveBlending, - }); - const flashSprite = new THREE.Sprite(flashMaterial); - flashSprite.visible = false; - flashSprite.renderOrder = 9999; - sparkleGroup.add(flashSprite); - particles.push({ - sprite: flashSprite, - material: flashMaterial, - baseAngle: 0, - baseRadius: 0, - height: size.y * 0.5, - start: 0, - duration: 0.3, - spin: 0, - wobble: 0, - wobbleSpeed: 0, - baseSize: 1.8, - }); - - for (let index = 0; index < 60; index += 1) { - const hue = 0.52 + Math.random() * 0.08; - const material = new THREE.SpriteMaterial({ - map: texture, - color: new THREE.Color().setHSL(hue, 0.95, 0.8), - transparent: true, - opacity: 0, - depthWrite: false, - depthTest: false, - blending: THREE.AdditiveBlending, - }); - const sprite = new THREE.Sprite(material); - sprite.visible = false; - sprite.renderOrder = 9999; - sparkleGroup.add(sprite); - - particles.push({ - sprite, - material, - baseAngle: Math.random() * Math.PI * 2, - baseRadius: Math.random() * 0.4 + 0.05, - height: particleHeight * (1.1 + Math.random() * 0.5), - start: Math.random() * 0.3, - duration: 0.2 + Math.random() * 0.25, - spin: (Math.random() - 0.5) * 0.5, - wobble: 0, - wobbleSpeed: 0, - baseSize: 0.02 + Math.random() * 0.05, - }); - } - - this.sparkles = { - group: sparkleGroup, - particles, - }; - this.updateSparkles(); - } - - private updateSparkles(): void { - if (!this.sparkles) return; - const currentProgress = THREE.MathUtils.clamp(this.progress, 0, 1); - let anyVisible = false; - - for (const particle of this.sparkles.particles) { - const localProgress = THREE.MathUtils.clamp( - (currentProgress - particle.start) / particle.duration, - 0, - 1, - ); - - if (localProgress <= 0 || localProgress >= 1) { - particle.material.opacity = 0; - particle.sprite.visible = false; - continue; - } - - anyVisible = true; - const opacity = Math.sin(localProgress * Math.PI) * 1.5; - - if (particle.baseSize > 1.0) { - const scale = particle.baseSize * (1.0 + localProgress * 2.0); - particle.sprite.position.set(0, particle.height, 0); - particle.sprite.scale.setScalar(scale); - particle.sprite.visible = opacity > 0.01; - particle.material.opacity = Math.min(opacity, 1.0) * 0.45; - } else { - const rise = localProgress ** 1.5; - const angle = particle.baseAngle + currentProgress * particle.spin; - const radial = particle.baseRadius * (1.0 + rise * 0.6); - const x = Math.cos(angle) * radial; - const z = Math.sin(angle) * radial; - const y = particle.height * rise; - - const width = particle.baseSize * 0.6; - const height = particle.baseSize * (8.0 + localProgress * 6.0); - - particle.sprite.position.set(x, y, z); - particle.sprite.scale.set(width, height, 1); - particle.sprite.visible = opacity > 0.01; - particle.material.opacity = Math.min(opacity, 1.0); - } - } - - if (!anyVisible && currentProgress >= 1) { - this.cleanupSparkles(); - } - } - - private cleanupDissolve(): void { - for (const mat of this.dissolvedMaterials) { - if (mat.userData._dissolveApplied) { - if (mat.userData._origOpacityNode !== undefined) { - (mat as MeshStandardMaterialWithNodeProps).opacityNode = - mat.userData._origOpacityNode ?? null; - } - if (mat.userData._origEmissiveNode !== undefined) { - (mat as MeshStandardMaterialWithNodeProps).emissiveNode = - mat.userData._origEmissiveNode ?? null; - } - mat.alphaTest = mat.userData._origAlphaTest ?? 0; - mat.onBeforeCompile = - mat.userData._origOnBeforeCompile ?? mat.onBeforeCompile; - mat.customProgramCacheKey = - mat.userData._origCustomProgramCacheKey ?? mat.customProgramCacheKey; - delete mat.userData._dissolveApplied; - delete mat.userData._origOpacityNode; - delete mat.userData._origEmissiveNode; - delete mat.userData._origAlphaTest; - delete mat.userData._origOnBeforeCompile; - delete mat.userData._origCustomProgramCacheKey; - mat.needsUpdate = true; - } - } - this.dissolvedMaterials = []; - this.progressUniform = null; - this.fallbackShaders = []; - } - - private cleanupSparkles(): void { - if (!this.sparkles) return; - for (const particle of this.sparkles.particles) { - particle.sprite.parent?.remove(particle.sprite); - particle.material.dispose(); - } - this.sparkles.group.parent?.remove(this.sparkles.group); - this.sparkles = null; - } -} diff --git a/plugins/plugin-companion/src/components/avatar/VrmViewer.tsx b/plugins/plugin-companion/src/components/avatar/VrmViewer.tsx deleted file mode 100644 index c243921abafd4..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/VrmViewer.tsx +++ /dev/null @@ -1,613 +0,0 @@ -/** - * VRM avatar canvas component. - * - * Renders a VRM model with idle animation and mouth-sync driven by - * the `mouthOpen` prop. Sized to fill its parent container. - */ - -import { - CHAT_AVATAR_VOICE_EVENT, - type ChatAvatarVoiceEventDetail, -} from "@elizaos/ui/events"; -import type { - CompanionHalfFramerateMode, - CompanionVrmPowerMode, -} from "@elizaos/ui/state"; -import { useEffect, useEffectEvent, useRef } from "react"; -import { getVrmCount, getVrmUrl } from "../../vrm-assets"; -import { - type CameraProfile, - type InteractionMode, - VrmEngine, - type VrmEngineDebugInfo, - type VrmEngineState, -} from "./VrmEngine"; -import { - refreshVrmDesktopBatteryPixelPolicy, - VRM_DESKTOP_BATTERY_POLL_MS, -} from "./vrm-desktop-energy"; -import { computeVrmPausePolicy } from "./vrm-pause-policy"; - -/** Resolved lazily — boot config may not be set at module-load time (bundled builds). */ -function getDefaultVrmPath(): string { - return getVrmUrl(1); -} - -export type VrmViewerProps = { - /** When false the loaded scene stays resident but the render loop is paused */ - active?: boolean; - /** Path to the VRM file to load (default: bundled Miwaifus #1) */ - vrmPath?: string; - /** Enable drag-rotate + wheel/pinch zoom camera controls */ - interactive?: boolean; - /** Camera profile preset (chat default, companion for hero-stage framing) */ - cameraProfile?: CameraProfile; - /** Interaction behavior for camera controls */ - interactiveMode?: InteractionMode; - /** Theme for the mathematical environment behind the avatar */ - environmentTheme?: "light" | "dark"; - /** User Settings: quality / balanced / efficiency for VRM power policy. */ - companionVrmPowerMode?: CompanionVrmPowerMode; - /** When to apply ~half display FPS. */ - companionHalfFramerateMode?: CompanionHalfFramerateMode; - /** When true and the document is hidden, keep the loop running in minimal mode. */ - companionAnimateWhenHidden?: boolean; - /** Enable springy drag/touch camera offset instead of orbit controls */ - pointerParallax?: boolean; - onEngineState?: (state: VrmEngineState) => void; - onEngineReady?: (engine: VrmEngine) => void; - onRevealStart?: () => void; - createEngine?: () => VrmEngine; -}; - -type VrmEngineDebugRegistryEntry = { - id: string; - role: "world-stage" | "chat-avatar"; - vrmPath: string; - engine: VrmEngine; - getDebugInfo: () => VrmEngineDebugInfo; -}; - -declare global { - interface Window { - __ELIZA_VRM_ENGINES__?: VrmEngineDebugRegistryEntry[]; - __captureVrmPreviews__?: typeof captureVrmPreviews; - } -} - -/** - * Dev utility: capture preview PNGs for all bundled VRM avatars with spring bone - * physics disabled (hair/cloth in rest pose). Call from the browser console: - * - * await window.__captureVrmPreviews__() - * - * Each VRM is loaded in sequence, a snapshot is taken with physics frozen, and - * the resulting PNG is downloaded. The existing world-stage engine is reused - * if available; otherwise a temporary offscreen engine is created. - */ -async function captureVrmPreviews(options?: { - width?: number; - height?: number; -}): Promise { - const width = options?.width ?? 512; - const height = options?.height ?? 768; - - // Try to reuse the existing world-stage engine, fall back to any available engine - const registry = window.__ELIZA_VRM_ENGINES__ ?? []; - const registryEntry = - registry.find((e) => e.role === "world-stage") ?? registry[0] ?? null; - const engine = registryEntry?.engine; - if (!engine) { - console.error( - "[captureVrmPreviews] No active VRM engine found. Navigate to the character view first.", - ); - return; - } - - const count = getVrmCount(); - console.log( - `[captureVrmPreviews] Capturing ${count} VRM previews at ${width}×${height} with physics disabled...`, - ); - - for (let i = 1; i <= count; i++) { - const vrmUrl = getVrmUrl(i); - const slug = - vrmUrl - .split("/") - .pop() - ?.replace(/\.vrm(\.gz)?$/, "") ?? `vrm-${i}`; - - console.log(`[captureVrmPreviews] Loading VRM ${i}/${count}: ${slug}...`); - try { - await engine.loadVrmFromUrl(vrmUrl, slug); - // Let the idle animation settle - await new Promise((resolve) => setTimeout(resolve, 500)); - - const blob = await engine.snapshot({ - width, - height, - disablePhysics: true, - }); - if (!blob) { - console.warn(`[captureVrmPreviews] Failed to capture ${slug}`); - continue; - } - - // Download the PNG - const url = URL.createObjectURL(blob); - const a = document.createElement("a"); - a.href = url; - a.download = `${slug}.png`; - a.click(); - URL.revokeObjectURL(url); - console.log(`[captureVrmPreviews] Saved ${slug}.png`); - } catch (err) { - console.error(`[captureVrmPreviews] Error capturing ${slug}:`, err); - } - } - - console.log("[captureVrmPreviews] Done!"); -} - -// Expose globally in dev mode -if (typeof window !== "undefined") { - window.__captureVrmPreviews__ = captureVrmPreviews; -} - -export function VrmViewer(props: VrmViewerProps) { - const canvasRef = useRef(null); - const engineRef = useRef(null); - const mouthOpenRef = useRef(0); - const activeRef = useRef(props.active ?? true); - const isSpeakingRef = useRef(false); - const interactiveRef = useRef(props.interactive ?? false); - const cameraProfileRef = useRef(props.cameraProfile ?? "chat"); - const interactionModeRef = useRef( - props.interactiveMode ?? "free", - ); - const pointerParallaxRef = useRef(props.pointerParallax ?? false); - const lastStateEmitMsRef = useRef(0); - const mountedRef = useRef(true); - // Whether the canvas is actually on screen. Defaults true (SSR / no - // IntersectionObserver → behave as before); an observer flips it so a - // scrolled-away / occluded canvas pauses the GPU loop, not just a hidden tab. - const onScreenRef = useRef(true); - const currentVrmPathRef = useRef(""); - const rendererInitFailedRef = useRef(false); - const pointerStateRef = useRef<{ - active: boolean; - id: number | null; - startX: number; - startY: number; - }>({ - active: false, - id: null, - startX: 0, - startY: 0, - }); - const onEngineReadyRef = useRef(props.onEngineReady); - const onEngineStateRef = useRef(props.onEngineState); - const onRevealStartRef = useRef(props.onRevealStart); - const companionVrmPowerModeRef = useRef( - props.companionVrmPowerMode ?? "balanced", - ); - const companionAnimateWhenHiddenRef = useRef( - props.companionAnimateWhenHidden ?? false, - ); - const companionHalfFramerateModeRef = useRef( - props.companionHalfFramerateMode ?? "when_saving_power", - ); - const revealStartedRef = useRef(false); - const debugRegistryIdRef = useRef( - `vrm-viewer-${Math.random().toString(36).slice(2, 10)}`, - ); - - activeRef.current = props.active ?? true; - interactiveRef.current = props.interactive ?? false; - cameraProfileRef.current = props.cameraProfile ?? "chat"; - interactionModeRef.current = props.interactiveMode ?? "free"; - pointerParallaxRef.current = props.pointerParallax ?? false; - onEngineReadyRef.current = props.onEngineReady; - onEngineStateRef.current = props.onEngineState; - onRevealStartRef.current = props.onRevealStart; - companionVrmPowerModeRef.current = props.companionVrmPowerMode ?? "balanced"; - companionAnimateWhenHiddenRef.current = - props.companionAnimateWhenHidden ?? false; - companionHalfFramerateModeRef.current = - props.companionHalfFramerateMode ?? "when_saving_power"; - - const applyVisibilityAndBackgroundPolicy = useEffectEvent(() => { - const engine = engineRef.current; - if (!engine || rendererInitFailedRef.current) return; - const docVisible = - typeof document === "undefined" || document.visibilityState === "visible"; - const { paused, halfFramerateWhileHidden } = computeVrmPausePolicy({ - active: activeRef.current, - onScreen: onScreenRef.current, - docVisible, - animateHidden: companionAnimateWhenHiddenRef.current, - }); - engine.setPaused(paused); - // "animate when hidden": the old setMinimalBackgroundMode() was a no-op (the - // flag is read nowhere in the loop), so the engine ran FULL rate on a hidden - // tab. Use the real half-framerate throttle instead; the visible-path battery - // policy below restores the correct rate when the tab returns. - if (halfFramerateWhileHidden) engine.setHalfFramerateMode(true); - if (docVisible) { - void refreshVrmDesktopBatteryPixelPolicy(engine, { - companionVrmPowerMode: companionVrmPowerModeRef.current, - companionHalfFramerateMode: companionHalfFramerateModeRef.current, - }); - } - }); - - const reportRendererInitFailure = useEffectEvent((error: unknown) => { - rendererInitFailedRef.current = true; - currentVrmPathRef.current = ""; - revealStartedRef.current = false; - - const fallbackMessage = - error instanceof Error && error.message.trim() - ? error.message - : "Failed to initialize VRM renderer."; - const currentState = engineRef.current?.getState(); - - onEngineStateRef.current?.( - currentState - ? { - ...currentState, - vrmLoaded: false, - revealStarted: false, - loadError: currentState.loadError ?? fallbackMessage, - } - : { - vrmLoaded: false, - vrmName: null, - loadError: fallbackMessage, - idlePlaying: false, - idleTime: 0, - idleTracks: 0, - revealStarted: false, - }, - ); - }); - - const applyInitialEnvironmentTheme = useEffectEvent((engine: VrmEngine) => { - if (props.environmentTheme) { - engine.setEnvironmentTheme(props.environmentTheme); - } - }); - - const syncDebugRegistry = useEffectEvent(() => { - const meta = import.meta as ImportMeta & { env?: { DEV?: boolean } }; - if (meta.env?.DEV !== true) return; - if (typeof window === "undefined") return; - const engine = engineRef.current; - const registry = window.__ELIZA_VRM_ENGINES__ ?? []; - const id = debugRegistryIdRef.current; - const nextEntry: VrmEngineDebugRegistryEntry | null = engine - ? { - id, - role: props.environmentTheme ? "world-stage" : "chat-avatar", - vrmPath: props.vrmPath ?? getDefaultVrmPath(), - engine, - getDebugInfo: () => engine.getDebugInfo(), - } - : null; - - window.__ELIZA_VRM_ENGINES__ = nextEntry - ? [...registry.filter((entry) => entry.id !== id), nextEntry] - : registry.filter((entry) => entry.id !== id); - }); - - // Setup engine once - useEffect(() => { - const canvas = canvasRef.current; - if (!canvas) return; - - mountedRef.current = true; - - let engine = engineRef.current; - if (!engine?.isInitialized()) { - engine = props.createEngine ? props.createEngine() : new VrmEngine(); - engineRef.current = engine; - } - - const applyDesktopBatteryPolicy = () => { - void refreshVrmDesktopBatteryPixelPolicy(engineRef.current, { - companionVrmPowerMode: companionVrmPowerModeRef.current, - companionHalfFramerateMode: companionHalfFramerateModeRef.current, - }); - }; - - const syncPauseForVisibilityAndActive = () => { - applyVisibilityAndBackgroundPolicy(); - }; - - engine.setup( - canvas, - () => { - // Frame loop: guard all state-setting calls against unmount. - if (!mountedRef.current) return; - engine.setMouthOpen(mouthOpenRef.current); - engine.setSpeaking(isSpeakingRef.current); - const now = performance.now(); - if (now - lastStateEmitMsRef.current >= 250) { - lastStateEmitMsRef.current = now; - const state = engine.getState(); - if (state.revealStarted && !revealStartedRef.current) { - revealStartedRef.current = true; - onRevealStartRef.current?.(); - } - onEngineStateRef.current?.(state); - } - }, - {}, - ); - syncPauseForVisibilityAndActive(); - - if (typeof document !== "undefined") { - document.addEventListener( - "visibilitychange", - syncPauseForVisibilityAndActive, - ); - } - - const batteryTimer = window.setInterval(() => { - applyDesktopBatteryPolicy(); - }, VRM_DESKTOP_BATTERY_POLL_MS); - applyDesktopBatteryPolicy(); - - // One-time initial camera/control setup (subsequent changes handled by effects). - engine.setCameraProfile(cameraProfileRef.current); - engine.setInteractionMode(interactionModeRef.current); - engine.setInteractionEnabled(interactiveRef.current); - engine.setPointerParallaxEnabled(pointerParallaxRef.current); - - const resize = () => { - const el = canvasRef.current; - if (!el) return; - const rect = el.getBoundingClientRect(); - engine.resize(rect.width, rect.height); - }; - const resizeObserver = - typeof ResizeObserver !== "undefined" - ? new ResizeObserver(() => resize()) - : null; - resizeObserver?.observe(canvas); - // Pause the GPU render loop whenever the canvas leaves the viewport (scrolled - // away / behind another view), not just when the browser tab is hidden — the - // avatar is the heaviest GPU/battery cost in the app. - const intersectionObserver = - typeof IntersectionObserver !== "undefined" - ? new IntersectionObserver( - (entries) => { - const onScreen = entries.some((e) => e.isIntersecting); - if (onScreen === onScreenRef.current) return; - onScreenRef.current = onScreen; - applyVisibilityAndBackgroundPolicy(); - }, - { threshold: 0 }, - ) - : null; - intersectionObserver?.observe(canvas); - window.addEventListener("resize", resize); - void engine.whenReady().then( - () => { - if (!mountedRef.current) return; - applyInitialEnvironmentTheme(engine); - resize(); - applyDesktopBatteryPolicy(); - applyVisibilityAndBackgroundPolicy(); - syncDebugRegistry(); - onEngineReadyRef.current?.(engine); - }, - (error: unknown) => { - if (!mountedRef.current) return; - reportRendererInitFailure(error); - console.warn("Failed to initialize VRM renderer:", error); - }, - ); - - // Listen for voice events imperatively — updates refs without React re-renders. - const handleVoiceEvent = (event: Event) => { - const detail = (event as CustomEvent).detail; - if (detail) { - mouthOpenRef.current = detail.mouthOpen; - isSpeakingRef.current = detail.isSpeaking; - } - }; - window.addEventListener(CHAT_AVATAR_VOICE_EVENT, handleVoiceEvent); - - return () => { - mountedRef.current = false; - window.removeEventListener(CHAT_AVATAR_VOICE_EVENT, handleVoiceEvent); - if (typeof document !== "undefined") { - document.removeEventListener( - "visibilitychange", - syncPauseForVisibilityAndActive, - ); - } - window.clearInterval(batteryTimer); - window.removeEventListener("resize", resize); - resizeObserver?.disconnect(); - intersectionObserver?.disconnect(); - - engine.dispose(); - if (engineRef.current === engine) { - engineRef.current = null; - } - syncDebugRegistry(); - }; - }, [props.createEngine]); - - useEffect(() => { - const engine = engineRef.current; - if (!engine) return; - void refreshVrmDesktopBatteryPixelPolicy(engine, { - companionVrmPowerMode: props.companionVrmPowerMode ?? "balanced", - companionHalfFramerateMode: - props.companionHalfFramerateMode ?? "when_saving_power", - }); - }, [props.companionVrmPowerMode, props.companionHalfFramerateMode]); - - useEffect(() => { - syncDebugRegistry(); - }); - - useEffect(() => { - applyVisibilityAndBackgroundPolicy(); - }, []); - - useEffect(() => { - const engine = engineRef.current; - if (!engine) return; - engine.setInteractionEnabled(props.interactive ?? false); - }, [props.interactive]); - - useEffect(() => { - const engine = engineRef.current; - if (!engine) return; - engine.setCameraProfile(props.cameraProfile ?? "chat"); - }, [props.cameraProfile]); - - useEffect(() => { - const engine = engineRef.current; - if (!engine) return; - engine.setInteractionMode(props.interactiveMode ?? "free"); - }, [props.interactiveMode]); - - useEffect(() => { - const engine = engineRef.current; - if (!engine) return; - engine.setPointerParallaxEnabled(props.pointerParallax ?? false); - if (!(props.pointerParallax ?? false)) { - engine.resetPointerParallax(); - } - }, [props.pointerParallax]); - - // Load VRM when path changes - useEffect(() => { - const engine = engineRef.current; - if (!engine) return; - - const vrmUrl = props.vrmPath ?? getDefaultVrmPath(); - if (vrmUrl === currentVrmPathRef.current) return; - currentVrmPathRef.current = vrmUrl; - revealStartedRef.current = false; - - const abortController = new AbortController(); - - void (async () => { - try { - await engine.whenReady(); - if (!mountedRef.current || abortController.signal.aborted) return; - await engine.loadVrmFromUrl( - vrmUrl, - vrmUrl.split("/").pop() ?? "avatar.vrm", - ); - if (!mountedRef.current || abortController.signal.aborted) return; - const state = engine.getState(); - if (state.revealStarted && !revealStartedRef.current) { - revealStartedRef.current = true; - onRevealStartRef.current?.(); - } - onEngineStateRef.current?.(state); - } catch (err) { - if (err instanceof Error && err.name === "AbortError") return; - if (rendererInitFailedRef.current) return; - if (currentVrmPathRef.current === vrmUrl) { - currentVrmPathRef.current = ""; - } - console.warn("Failed to load VRM:", err); - } - })(); - - return () => { - abortController.abort(); - if (currentVrmPathRef.current === vrmUrl) { - currentVrmPathRef.current = ""; - } - }; - }, [props.vrmPath]); - - // Forward environment theme changes to the engine - useEffect(() => { - if (!props.environmentTheme) return; - engineRef.current?.setEnvironmentTheme(props.environmentTheme); - }, [props.environmentTheme]); - - const updateParallaxFromPointer = ( - clientX: number, - clientY: number, - release = false, - ) => { - const engine = engineRef.current; - const canvas = canvasRef.current; - const pointerState = pointerStateRef.current; - if (!engine || !canvas || !pointerParallaxRef.current) return; - if (release) { - engine.resetPointerParallax(); - return; - } - const rect = canvas.getBoundingClientRect(); - const deltaX = clientX - pointerState.startX; - const deltaY = clientY - pointerState.startY; - const normalizedX = rect.width > 0 ? deltaX / rect.width : 0; - const normalizedY = rect.height > 0 ? deltaY / rect.height : 0; - engine.setPointerParallaxTarget(normalizedX * 2.2, -normalizedY * 2.2); - }; - - return ( - { - if (!pointerParallaxRef.current) return; - pointerStateRef.current = { - active: true, - id: event.pointerId, - startX: event.clientX, - startY: event.clientY, - }; - event.currentTarget.setPointerCapture(event.pointerId); - }} - onPointerMove={(event) => { - const pointerState = pointerStateRef.current; - if ( - !pointerParallaxRef.current || - !pointerState.active || - pointerState.id !== event.pointerId - ) { - return; - } - updateParallaxFromPointer(event.clientX, event.clientY); - }} - onPointerUp={(event) => { - const pointerState = pointerStateRef.current; - if (pointerState.id !== event.pointerId) return; - pointerStateRef.current.active = false; - event.currentTarget.releasePointerCapture(event.pointerId); - updateParallaxFromPointer(event.clientX, event.clientY, true); - }} - onPointerCancel={(event) => { - const pointerState = pointerStateRef.current; - if (pointerState.id !== event.pointerId) return; - pointerStateRef.current.active = false; - updateParallaxFromPointer(event.clientX, event.clientY, true); - }} - style={{ - position: "absolute", - inset: 0, - display: "block", - width: "100vw", - height: "100vh", - minWidth: "100vw", - minHeight: "100vh", - background: "transparent", - cursor: props.pointerParallax || props.interactive ? "grab" : "default", - touchAction: props.pointerParallax ? "none" : "auto", - }} - /> - ); -} diff --git a/plugins/plugin-companion/src/components/avatar/mixamoVRMRigMap.ts b/plugins/plugin-companion/src/components/avatar/mixamoVRMRigMap.ts deleted file mode 100644 index 616d1ecc1be57..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/mixamoVRMRigMap.ts +++ /dev/null @@ -1,62 +0,0 @@ -import type { VRMHumanBoneName } from "@pixiv/three-vrm"; - -// Mixamo -> VRM humanoid bone mapping. -// Keys are normalized to `mixamorig`. -export const mixamoVRMRigMap: Record = { - mixamorigHips: "hips", - mixamorigSpine: "spine", - mixamorigSpine1: "chest", - mixamorigSpine2: "upperChest", - mixamorigNeck: "neck", - mixamorigHead: "head", - - mixamorigLeftShoulder: "leftShoulder", - mixamorigLeftArm: "leftUpperArm", - mixamorigLeftForeArm: "leftLowerArm", - mixamorigLeftHand: "leftHand", - mixamorigLeftHandThumb1: "leftThumbMetacarpal", - mixamorigLeftHandThumb2: "leftThumbProximal", - mixamorigLeftHandThumb3: "leftThumbDistal", - mixamorigLeftHandIndex1: "leftIndexProximal", - mixamorigLeftHandIndex2: "leftIndexIntermediate", - mixamorigLeftHandIndex3: "leftIndexDistal", - mixamorigLeftHandMiddle1: "leftMiddleProximal", - mixamorigLeftHandMiddle2: "leftMiddleIntermediate", - mixamorigLeftHandMiddle3: "leftMiddleDistal", - mixamorigLeftHandRing1: "leftRingProximal", - mixamorigLeftHandRing2: "leftRingIntermediate", - mixamorigLeftHandRing3: "leftRingDistal", - mixamorigLeftHandPinky1: "leftLittleProximal", - mixamorigLeftHandPinky2: "leftLittleIntermediate", - mixamorigLeftHandPinky3: "leftLittleDistal", - - mixamorigRightShoulder: "rightShoulder", - mixamorigRightArm: "rightUpperArm", - mixamorigRightForeArm: "rightLowerArm", - mixamorigRightHand: "rightHand", - mixamorigRightHandPinky1: "rightLittleProximal", - mixamorigRightHandPinky2: "rightLittleIntermediate", - mixamorigRightHandPinky3: "rightLittleDistal", - mixamorigRightHandRing1: "rightRingProximal", - mixamorigRightHandRing2: "rightRingIntermediate", - mixamorigRightHandRing3: "rightRingDistal", - mixamorigRightHandMiddle1: "rightMiddleProximal", - mixamorigRightHandMiddle2: "rightMiddleIntermediate", - mixamorigRightHandMiddle3: "rightMiddleDistal", - mixamorigRightHandIndex1: "rightIndexProximal", - mixamorigRightHandIndex2: "rightIndexIntermediate", - mixamorigRightHandIndex3: "rightIndexDistal", - mixamorigRightHandThumb1: "rightThumbMetacarpal", - mixamorigRightHandThumb2: "rightThumbProximal", - mixamorigRightHandThumb3: "rightThumbDistal", - - mixamorigLeftUpLeg: "leftUpperLeg", - mixamorigLeftLeg: "leftLowerLeg", - mixamorigLeftFoot: "leftFoot", - mixamorigLeftToeBase: "leftToes", - - mixamorigRightUpLeg: "rightUpperLeg", - mixamorigRightLeg: "rightLowerLeg", - mixamorigRightFoot: "rightFoot", - mixamorigRightToeBase: "rightToes", -}; diff --git a/plugins/plugin-companion/src/components/avatar/retargetMixamoFbxToVrm.ts b/plugins/plugin-companion/src/components/avatar/retargetMixamoFbxToVrm.ts deleted file mode 100644 index 3119ff81f149a..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/retargetMixamoFbxToVrm.ts +++ /dev/null @@ -1,196 +0,0 @@ -import type { VRM, VRMHumanBoneName } from "@pixiv/three-vrm"; -import * as THREE from "three"; -import { mixamoVRMRigMap } from "./mixamoVRMRigMap"; - -function normalizeMixamoRigName(name: string): string { - const pipe = name.lastIndexOf("|"); - const base = pipe >= 0 ? name.slice(pipe + 1) : name; - const colon = base.indexOf(":"); - if (colon >= 0) { - const ns = base.slice(0, colon); - const rest = base.slice(colon + 1); - if (ns === "mixamorig") return `mixamorig${rest}`; - return rest; - } - return base; -} - -function isVrm0(vrm: VRM): boolean { - const mv = String(vrm.meta?.metaVersion); - return mv.startsWith("0"); -} - -function findNode( - scene: THREE.Object3D, - rawName: string, - normalizedName: string, -): THREE.Object3D | null { - return ( - scene.getObjectByName(rawName) ?? - scene.getObjectByName(normalizedName) ?? - scene.getObjectByName( - rawName.includes(":") ? (rawName.split(":")[1] ?? rawName) : rawName, - ) ?? - null - ); -} - -/** - * Retarget a Mixamo FBX animation clip onto a VRM. - * Quaternion tracks are converted into VRM space and position tracks are - * scaled by hips height ratio. - */ -export function retargetMixamoFbxToVrm( - sourceScene: THREE.Group, - sourceClip: THREE.AnimationClip, - vrm: VRM, -): THREE.AnimationClip { - sourceScene.updateMatrixWorld(true); - vrm.scene.updateMatrixWorld(true); - const humanoid = vrm.humanoid; - if (!humanoid) { - throw new Error("VRM has no humanoid rig"); - } - - // ── Diagnostic logging for greeting arm-rotation debugging ── - const mapped: string[] = []; - const unmappedNames: string[] = []; - const unmappedNodes: string[] = []; - - const tracks: THREE.KeyframeTrack[] = []; - const restRotationInverse = new THREE.Quaternion(); - const parentRestWorldRotation = new THREE.Quaternion(); - const q = new THREE.Quaternion(); - - const motionHipsNode = findNode( - sourceScene, - "mixamorigHips", - "mixamorigHips", - ); - const motionHipsHeight = Math.abs(motionHipsNode?.position.y ?? 0); - const vrmHipsHeight = Math.abs( - humanoid.normalizedRestPose.hips?.position?.[1] ?? 0, - ); - const hipsPositionScale = - motionHipsHeight > 1e-6 && vrmHipsHeight > 1e-6 - ? vrmHipsHeight / motionHipsHeight - : 1; - - for (const track of sourceClip.tracks) { - const parts = track.name.split("."); - const rawRigName = parts[0]; - const propertyName = parts[1]; - if (!rawRigName || !propertyName) continue; - const normalizedRigName = normalizeMixamoRigName(rawRigName); - const vrmBoneName = mixamoVRMRigMap[normalizedRigName]; - if (!vrmBoneName) { - if (!unmappedNames.includes(normalizedRigName)) { - unmappedNames.push(normalizedRigName); - } - continue; - } - - const vrmNode = humanoid.getNormalizedBoneNode( - vrmBoneName as VRMHumanBoneName, - ); - if (!vrmNode) continue; - - const mixamoRigNode = findNode(sourceScene, rawRigName, normalizedRigName); - if (!mixamoRigNode?.parent) { - if (!unmappedNodes.includes(normalizedRigName)) { - unmappedNodes.push(`${normalizedRigName}→${vrmBoneName}`); - } - continue; - } - - if (!mapped.includes(vrmBoneName)) { - mapped.push(vrmBoneName); - } - - mixamoRigNode.getWorldQuaternion(restRotationInverse).invert(); - mixamoRigNode.parent.getWorldQuaternion(parentRestWorldRotation); - - if ( - propertyName === "quaternion" && - track instanceof THREE.QuaternionKeyframeTrack - ) { - const values = track.values.slice(); - for (let i = 0; i < values.length; i += 4) { - q.fromArray(values, i); - q.premultiply(parentRestWorldRotation).multiply(restRotationInverse); - q.toArray(values, i); - } - - tracks.push( - new THREE.QuaternionKeyframeTrack( - `${vrmNode.name}.quaternion`, - track.times, - values.map((v: number, i: number) => - isVrm0(vrm) && i % 2 === 0 ? -v : v, - ), - ), - ); - continue; - } - - // Keep position-track behavior aligned with Girlfie runtime. - if ( - propertyName === "position" && - track instanceof THREE.VectorKeyframeTrack - ) { - const isHips = - vrmNode === humanoid.getNormalizedBoneNode("hips" as VRMHumanBoneName); - - if (!isHips) continue; - - const values = track.values.map((v: number, i: number) => { - return (isVrm0(vrm) && i % 3 !== 1 ? -v : v) * hipsPositionScale; - }); - tracks.push( - new THREE.VectorKeyframeTrack( - `${vrmNode.name}.position`, - track.times, - values, - ), - ); - } - } - - const hasHipsTrack = tracks.some((track) => - track.name.startsWith( - `${humanoid.getNormalizedBoneNode("hips" as VRMHumanBoneName)?.name ?? "__missing__"}.`, - ), - ); - if (!hasHipsTrack) { - throw new Error( - `Idle FBX retargeting failed: no hips bone track found (mapped ${tracks.length} tracks). ` + - "Expected Mixamo bone names like mixamorigHips/mixamorigSpine...", - ); - } - - const clip = new THREE.AnimationClip("idle", sourceClip.duration, tracks); - clip.optimize(); - - // ── Diagnostic summary ── - const armBones = [ - "leftShoulder", - "leftUpperArm", - "leftLowerArm", - "leftHand", - "rightShoulder", - "rightUpperArm", - "rightLowerArm", - "rightHand", - ]; - const missingArms = armBones.filter((b) => !mapped.includes(b)); - console.debug( - `[retargetMixamoFbx] clip="${sourceClip.name}" ` + - `tracks=${sourceClip.tracks.length}→${tracks.length} ` + - `mapped=${mapped.length} ` + - `unmappedNames=[${unmappedNames.join(",")}] ` + - `unmappedNodes=[${unmappedNodes.join(",")}] ` + - `missingArmBones=[${missingArms.join(",")}]`, - ); - - return clip; -} diff --git a/plugins/plugin-companion/src/components/avatar/retargetMixamoGltfToVrm.ts b/plugins/plugin-companion/src/components/avatar/retargetMixamoGltfToVrm.ts deleted file mode 100644 index e7655fa87eaf4..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/retargetMixamoGltfToVrm.ts +++ /dev/null @@ -1,164 +0,0 @@ -import type { VRM, VRMHumanBoneName } from "@pixiv/three-vrm"; -import * as THREE from "three"; -import { mixamoVRMRigMap } from "./mixamoVRMRigMap"; - -function normalizeMixamoRigName(name: string): string { - const pipe = name.lastIndexOf("|"); - const base = pipe >= 0 ? name.slice(pipe + 1) : name; - const colon = base.indexOf(":"); - if (colon >= 0) { - const ns = base.slice(0, colon); - const rest = base.slice(colon + 1); - if (ns === "mixamorig") return `mixamorig${rest}`; - return rest; - } - return base; -} - -function isVrm0(vrm: VRM): boolean { - const mv = String(vrm.meta?.metaVersion); - return mv.startsWith("0"); -} - -function findNode( - scene: THREE.Object3D, - rawName: string, - normalizedName: string, -): THREE.Object3D | null { - return ( - scene.getObjectByName(rawName) ?? - scene.getObjectByName(normalizedName) ?? - scene.getObjectByName( - rawName.includes(":") ? (rawName.split(":")[1] ?? rawName) : rawName, - ) ?? - null - ); -} - -/** - * Retarget a Mixamo-style GLB animation clip onto a VRM. - * Position tracks are ignored to avoid root motion. - */ -export function retargetMixamoGltfToVrm( - animation: { scene: THREE.Group; animations: THREE.AnimationClip[] }, - vrm: VRM, - clipName?: string, -): THREE.AnimationClip { - animation.scene.updateMatrixWorld(true); - vrm.scene.updateMatrixWorld(true); - - const sourceClip = animation.animations[0]; - if (!sourceClip) { - throw new Error("GLB contains no animation clips"); - } - const humanoid = vrm.humanoid; - if (!humanoid) { - throw new Error("VRM has no humanoid rig"); - } - - const motionHipsNode = findNode( - animation.scene, - "mixamorigHips", - "mixamorigHips", - ); - const motionHipsHeight = Math.abs(motionHipsNode?.position.y ?? 0); - const vrmHipsHeight = Math.abs( - humanoid.normalizedRestPose.hips?.position?.[1] ?? 0, - ); - const hipsPositionScale = - motionHipsHeight > 1e-6 && vrmHipsHeight > 1e-6 - ? vrmHipsHeight / motionHipsHeight - : 1; - - const tracks: Array = []; - const restRotationInverse = new THREE.Quaternion(); - const parentRestWorldRotation = new THREE.Quaternion(); - const q = new THREE.Quaternion(); - - for (const track of sourceClip.tracks) { - const parts = track.name.split("."); - const rawRigName = parts[0]; - const propertyName = parts[1]; - if (!rawRigName || !propertyName) continue; - - const normalizedRigName = normalizeMixamoRigName(rawRigName); - const vrmBoneName = mixamoVRMRigMap[normalizedRigName]; - if (!vrmBoneName) continue; - - const vrmNode = humanoid.getNormalizedBoneNode( - vrmBoneName as VRMHumanBoneName, - ); - if (!vrmNode) continue; - - const mixamoRigNode = findNode( - animation.scene, - rawRigName, - normalizedRigName, - ); - if (!mixamoRigNode?.parent) continue; - - if ( - propertyName === "quaternion" && - track instanceof THREE.QuaternionKeyframeTrack - ) { - mixamoRigNode.getWorldQuaternion(restRotationInverse).invert(); - mixamoRigNode.parent.getWorldQuaternion(parentRestWorldRotation); - - const values = track.values.slice(); - for (let i = 0; i < values.length; i += 4) { - q.fromArray(values, i); - q.premultiply(parentRestWorldRotation).multiply(restRotationInverse); - q.toArray(values, i); - } - - tracks.push( - new THREE.QuaternionKeyframeTrack( - `${vrmNode.name}.quaternion`, - track.times, - values.map((v: number, i: number) => - isVrm0(vrm) && i % 2 === 0 ? -v : v, - ), - ), - ); - continue; - } - - if ( - propertyName === "position" && - track instanceof THREE.VectorKeyframeTrack - ) { - const isHips = - vrmNode === humanoid.getNormalizedBoneNode("hips" as VRMHumanBoneName); - - if (!isHips) continue; - - const values = track.values.map((v: number, i: number) => { - return (isVrm0(vrm) && i % 3 !== 1 ? -v : v) * hipsPositionScale; - }); - tracks.push( - new THREE.VectorKeyframeTrack( - `${vrmNode.name}.position`, - track.times, - values, - ), - ); - } - } - - const hasHipsTrack = tracks.some((track) => - track.name.startsWith( - `${humanoid.getNormalizedBoneNode("hips" as VRMHumanBoneName)?.name ?? "__missing__"}.`, - ), - ); - if (!hasHipsTrack) { - throw new Error( - `Retargeting failed: no hips bone track found (mapped ${tracks.length} tracks). ` + - "Expected Mixamo bone names like mixamorigHips/mixamorigSpine...", - ); - } - - const name = clipName ?? sourceClip.name; - const clip = new THREE.AnimationClip(name, sourceClip.duration, tracks); - clip.optimize(); - return clip; -} diff --git a/plugins/plugin-companion/src/components/avatar/scene-overlay-renderer.ts b/plugins/plugin-companion/src/components/avatar/scene-overlay-renderer.ts deleted file mode 100644 index 81741ef32b665..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/scene-overlay-renderer.ts +++ /dev/null @@ -1,459 +0,0 @@ -/** - * Canvas2D rendering functions for the 3D scene overlay panels. - * - * Each function paints a panel onto a provided CanvasRenderingContext2D - * using a light construct aesthetic: translucent frosted-glass panels, - * subtle borders, dark text on light backgrounds. - */ - -import { getSceneTokens } from "./scene-theme-tokens"; - -// -- Design tokens (resolved from CSS vars at paint time) --------------------- -// Kept as module-level aliases so existing call-sites compile unchanged. -// Functions that paint call `refreshTokens()` at the top of each frame. -let _t = getSceneTokens(); -let ACCENT = _t.accent; -let TEXT_PRIMARY = _t.textPrimary; -let TEXT_SECONDARY = _t.textSecondary; -let TEXT_MUTED = _t.textMuted; -let STATUS_GREEN = _t.statusGreen; -let STATUS_RED = _t.statusRed; -let STATUS_YELLOW = _t.statusYellow; -let STATUS_BLUE = _t.statusBlue; -let FONT_SANS = _t.fontSans; -let FONT_MONO = _t.fontMono; - -/** Re-read CSS custom properties so canvas colors track the active theme. */ -export function refreshTokens() { - _t = getSceneTokens(); - ACCENT = _t.accent; - TEXT_PRIMARY = _t.textPrimary; - TEXT_SECONDARY = _t.textSecondary; - TEXT_MUTED = _t.textMuted; - STATUS_GREEN = _t.statusGreen; - STATUS_RED = _t.statusRed; - STATUS_YELLOW = _t.statusYellow; - STATUS_BLUE = _t.statusBlue; - FONT_SANS = _t.fontSans; - FONT_MONO = _t.fontMono; -} - -// -- Shared types ------------------------------------------------------------- - -export interface ChatOverlayMessage { - id: string; - role: "user" | "assistant"; - text: string; -} - -export interface AgentStatusOverlay { - state: string; - agentName: string; - uptime?: number; - sessions: Array<{ - sessionId: string; - label: string; - agentType: string; - }>; -} - -export interface TriggerOverlay { - id: string; - displayName: string; - triggerType: string; - enabled: boolean; - lastStatus?: string; - cronExpression?: string; - intervalMs?: number; -} - -// -- Helpers ------------------------------------------------------------------ - -function roundRect( - ctx: CanvasRenderingContext2D, - x: number, - y: number, - w: number, - h: number, - r: number, -): void { - ctx.beginPath(); - ctx.moveTo(x + r, y); - ctx.lineTo(x + w - r, y); - ctx.quadraticCurveTo(x + w, y, x + w, y + r); - ctx.lineTo(x + w, y + h - r); - ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h); - ctx.lineTo(x + r, y + h); - ctx.quadraticCurveTo(x, y + h, x, y + h - r); - ctx.lineTo(x, y + r); - ctx.quadraticCurveTo(x, y, x + r, y); - ctx.closePath(); -} - -function wrapText( - ctx: CanvasRenderingContext2D, - text: string, - maxWidth: number, -): string[] { - const words = text.split(/\s+/); - const lines: string[] = []; - let currentLine = ""; - - for (const word of words) { - const testLine = currentLine ? `${currentLine} ${word}` : word; - if (ctx.measureText(testLine).width > maxWidth && currentLine) { - lines.push(currentLine); - currentLine = word; - } else { - currentLine = testLine; - } - } - if (currentLine) lines.push(currentLine); - return lines; -} - -function drawStatusDot( - ctx: CanvasRenderingContext2D, - x: number, - y: number, - color: string, - radius = 6, -): void { - ctx.save(); - ctx.shadowColor = color; - ctx.shadowBlur = 6; - ctx.beginPath(); - ctx.arc(x, y, radius, 0, Math.PI * 2); - ctx.fillStyle = color; - ctx.fill(); - ctx.restore(); -} - -function formatUptimeMs(ms: number | undefined): string { - if (ms == null || ms <= 0) return "--"; - const totalSeconds = Math.floor(ms / 1000); - const hours = Math.floor(totalSeconds / 3600); - const minutes = Math.floor((totalSeconds % 3600) / 60); - if (hours > 0) return `${hours}h ${minutes}m`; - return `${minutes}m`; -} - -function formatInterval(ms: number | undefined): string { - if (!ms) return ""; - const minutes = Math.round(ms / 60_000); - if (minutes < 60) return `every ${minutes}m`; - const hours = Math.round(minutes / 60); - return `every ${hours}h`; -} - -function agentStateColor(state: string): string { - switch (state) { - case "running": - return STATUS_GREEN; - case "starting": - case "restarting": - return STATUS_YELLOW; - case "error": - return STATUS_RED; - default: - return TEXT_MUTED; - } -} - -function triggerStatusColor(status: string | undefined): string { - switch (status) { - case "success": - return STATUS_GREEN; - case "error": - return STATUS_RED; - case "skipped": - return STATUS_YELLOW; - default: - return TEXT_MUTED; - } -} - -// -- Panel renderers ---------------------------------------------------------- - -export function renderChatPanel( - ctx: CanvasRenderingContext2D, - w: number, - h: number, - messages: ChatOverlayMessage[], -): void { - refreshTokens(); - ctx.clearRect(0, 0, w, h); - - const pad = 10; - const bubbleMaxWidth = w - pad * 2 - 12; - const fontSize = 11; - const lineHeight = fontSize * 1.35; - const bubblePadX = 10; - const bubblePadY = 6; - const bubbleRadius = 10; - const bubbleGap = 4; - - const visibleMessages = messages.slice(-10); - if (visibleMessages.length === 0) return; - - // Pre-calculate all bubble heights to bottom-align - const bubbleInfos: Array<{ - msg: ChatOverlayMessage; - lines: string[]; - height: number; - }> = []; - for (const msg of visibleMessages) { - ctx.font = `400 ${fontSize}px ${FONT_SANS}`; - const truncatedText = - msg.text.length > 200 ? `${msg.text.slice(0, 197)}...` : msg.text; - const lines = wrapText(ctx, truncatedText, bubbleMaxWidth - bubblePadX * 2); - const height = lines.length * lineHeight + bubblePadY * 2; - bubbleInfos.push({ msg, lines, height }); - } - - let y = h - pad; - - for (let i = bubbleInfos.length - 1; i >= 0; i--) { - const bubbleInfo = bubbleInfos[i]; - if (!bubbleInfo) continue; - const { msg, lines, height } = bubbleInfo; - const isUser = msg.role === "user"; - const bubbleWidth = Math.min( - bubbleMaxWidth, - Math.max(...lines.map((l) => ctx.measureText(l).width)) + - bubblePadX * 2 + - 4, - ); - - y -= height; - if (y < 0) break; - - const bubbleX = isUser ? w - pad - bubbleWidth : pad; - - if (isUser) { - // User bubble — soft blue tint - roundRect(ctx, bubbleX, y, bubbleWidth, height, bubbleRadius); - const grad = ctx.createLinearGradient(bubbleX, y, bubbleX, y + height); - grad.addColorStop(0, "rgba(58, 123, 213, 0.14)"); - grad.addColorStop(1, "rgba(58, 123, 213, 0.06)"); - ctx.fillStyle = grad; - ctx.fill(); - ctx.strokeStyle = "rgba(58, 123, 213, 0.25)"; - ctx.lineWidth = 1; - ctx.stroke(); - } else { - // Assistant bubble — frosted white card - roundRect(ctx, bubbleX, y, bubbleWidth, height, bubbleRadius); - const grad = ctx.createLinearGradient(bubbleX, y, bubbleX, y + height); - grad.addColorStop(0, "rgba(255, 255, 255, 0.85)"); - grad.addColorStop(1, "rgba(240, 243, 248, 0.9)"); - ctx.fillStyle = grad; - ctx.fill(); - ctx.strokeStyle = "rgba(0, 0, 0, 0.08)"; - ctx.lineWidth = 1; - ctx.stroke(); - } - - // Text - ctx.fillStyle = TEXT_PRIMARY; - ctx.font = `400 ${fontSize}px ${FONT_SANS}`; - let textY = y + bubblePadY + fontSize; - for (const line of lines) { - ctx.fillText(line, bubbleX + bubblePadX, textY); - textY += lineHeight; - } - - y -= bubbleGap; - } -} - -export function renderStatusPanel( - ctx: CanvasRenderingContext2D, - w: number, - h: number, - status: AgentStatusOverlay | null, -): void { - refreshTokens(); - ctx.clearRect(0, 0, w, h); - - const pad = 12; - const fs = 12; - const fsMono = 10; - - // Frosted panel frame - ctx.save(); - ctx.strokeStyle = "rgba(58, 123, 213, 0.2)"; - ctx.lineWidth = 1; - const cx = 10; - ctx.beginPath(); - ctx.moveTo(pad + cx, pad); - ctx.lineTo(w - pad, pad); - ctx.lineTo(w - pad, h - pad - cx); - ctx.lineTo(w - pad - cx, h - pad); - ctx.lineTo(pad, h - pad); - ctx.lineTo(pad, pad + cx); - ctx.closePath(); - ctx.fillStyle = "rgba(255, 255, 255, 0.7)"; - ctx.fill(); - ctx.stroke(); - ctx.restore(); - - // Top accent line - ctx.strokeStyle = ACCENT; - ctx.lineWidth = 1.5; - ctx.beginPath(); - ctx.moveTo(pad + cx, pad); - ctx.lineTo(pad + cx + 50, pad); - ctx.stroke(); - - let y = pad + 16; - - ctx.font = `600 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = ACCENT; - ctx.fillText("SYS:STATUS", pad + 8, y); - y += 14; - - if (!status) { - ctx.font = `400 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = TEXT_MUTED; - ctx.fillText("OFFLINE", pad + 8, y + 10); - return; - } - - const stateColor = agentStateColor(status.state); - - drawStatusDot(ctx, pad + 14, y + 5, stateColor, 3); - ctx.font = `500 ${fs}px ${FONT_SANS}`; - ctx.fillStyle = TEXT_PRIMARY; - ctx.fillText(status.state.toUpperCase(), pad + 24, y + 9); - - ctx.font = `400 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = TEXT_SECONDARY; - const uptimeStr = formatUptimeMs(status.uptime); - const uptimeW = ctx.measureText(uptimeStr).width; - ctx.fillText(uptimeStr, w - pad - uptimeW - 8, y + 9); - y += 18; - - ctx.strokeStyle = "rgba(58, 123, 213, 0.1)"; - ctx.lineWidth = 0.5; - ctx.beginPath(); - ctx.moveTo(pad + 8, y); - ctx.lineTo(w - pad - 8, y); - ctx.stroke(); - y += 8; - - ctx.font = `400 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = TEXT_MUTED; - ctx.fillText((status.agentName || "agent").toUpperCase(), pad + 8, y + 8); - y += 16; - - if (status.sessions.length > 0) { - for (const session of status.sessions.slice(0, 3)) { - if (y > h - pad - 8) break; - drawStatusDot(ctx, pad + 14, y + 5, STATUS_BLUE, 2.5); - ctx.font = `400 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = TEXT_SECONDARY; - const label = - session.label.length > 22 - ? `${session.label.slice(0, 19)}...` - : session.label; - ctx.fillText(label, pad + 22, y + 8); - y += 14; - } - } -} - -export function renderHeartbeatsPanel( - ctx: CanvasRenderingContext2D, - w: number, - h: number, - triggers: TriggerOverlay[], -): void { - refreshTokens(); - ctx.clearRect(0, 0, w, h); - - const pad = 12; - const fsMono = 10; - - // Frosted panel frame - ctx.save(); - ctx.strokeStyle = "rgba(58, 123, 213, 0.2)"; - ctx.lineWidth = 1; - const cx = 10; - ctx.beginPath(); - ctx.moveTo(pad + cx, pad); - ctx.lineTo(w - pad, pad); - ctx.lineTo(w - pad, h - pad - cx); - ctx.lineTo(w - pad - cx, h - pad); - ctx.lineTo(pad, h - pad); - ctx.lineTo(pad, pad + cx); - ctx.closePath(); - ctx.fillStyle = "rgba(255, 255, 255, 0.7)"; - ctx.fill(); - ctx.stroke(); - ctx.restore(); - - // Top accent line - ctx.strokeStyle = ACCENT; - ctx.lineWidth = 1.5; - ctx.beginPath(); - ctx.moveTo(pad + cx, pad); - ctx.lineTo(pad + cx + 50, pad); - ctx.stroke(); - - let y = pad + 16; - - ctx.font = `600 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = ACCENT; - ctx.fillText("SYS:HEARTBEAT", pad + 8, y); - y += 14; - - if (triggers.length === 0) { - ctx.font = `400 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = TEXT_MUTED; - ctx.fillText("NO TRIGGERS", pad + 8, y + 8); - return; - } - - for (const trigger of triggers.slice(0, 6)) { - if (y > h - pad - 8) break; - - drawStatusDot( - ctx, - pad + 14, - y + 5, - trigger.enabled ? STATUS_GREEN : TEXT_MUTED, - 2.5, - ); - - ctx.font = `400 ${fsMono}px ${FONT_MONO}`; - ctx.fillStyle = trigger.enabled ? TEXT_PRIMARY : TEXT_MUTED; - const name = - trigger.displayName.length > 18 - ? `${trigger.displayName.slice(0, 15)}...` - : trigger.displayName; - ctx.fillText(name, pad + 22, y + 8); - - const scheduleText = - trigger.triggerType === "cron" - ? (trigger.cronExpression ?? "cron") - : trigger.triggerType === "interval" - ? formatInterval(trigger.intervalMs) - : "once"; - ctx.fillStyle = TEXT_MUTED; - const schedW = ctx.measureText(scheduleText).width; - ctx.fillText(scheduleText, w - pad - schedW - 8, y + 8); - - if (trigger.lastStatus) { - drawStatusDot( - ctx, - w - pad - 4, - y + 5, - triggerStatusColor(trigger.lastStatus), - 2, - ); - } - - y += 16; - } -} diff --git a/plugins/plugin-companion/src/components/avatar/scene-theme-tokens.ts b/plugins/plugin-companion/src/components/avatar/scene-theme-tokens.ts deleted file mode 100644 index 59b987654b681..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/scene-theme-tokens.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Theme-aware design tokens for Canvas2D scene overlay rendering. - * - * Canvas2D cannot read CSS variables directly, so we read computed - * values from the document root at call time, with hardcoded fallbacks - * for SSR / off-screen contexts. - */ - -function css(prop: string, fallback: string): string { - const readComputedStyle = globalThis.getComputedStyle; - if ( - typeof document === "undefined" || - typeof readComputedStyle !== "function" - ) { - return fallback; - } - return ( - readComputedStyle(document.documentElement).getPropertyValue(prop).trim() || - fallback - ); -} - -function cssWithAlpha(prop: string, alpha: number, fallback: string): string { - const raw = css(prop, ""); - if (!raw) return fallback; - // Wrap in rgb()/hsl() alpha if it looks like a hex or keyword - if (raw.startsWith("#")) { - const r = parseInt(raw.slice(1, 3), 16); - const g = parseInt(raw.slice(3, 5), 16); - const b = parseInt(raw.slice(5, 7), 16); - return `rgba(${r}, ${g}, ${b}, ${alpha})`; - } - return fallback; -} - -/** Read current theme tokens for canvas rendering. Call once per paint. */ -export function getSceneTokens() { - return { - accent: css("--status-info", "#3a7bd5"), - accentBorder: cssWithAlpha("--status-info", 0.3, "rgba(58, 123, 213, 0.3)"), - bgPanel: cssWithAlpha("--card", 0.82, "rgba(255, 255, 255, 0.82)"), - bgCard: cssWithAlpha("--bg-accent", 0.75, "rgba(240, 243, 248, 0.75)"), - textPrimary: css("--text", "#1a1a2e"), - textSecondary: cssWithAlpha("--text", 0.6, "rgba(26, 26, 46, 0.6)"), - textMuted: cssWithAlpha("--text", 0.35, "rgba(26, 26, 46, 0.35)"), - statusGreen: css("--ok", "#10b981"), - statusRed: css("--danger", "#ef4444"), - statusYellow: css("--warn", "#f59e0b"), - statusBlue: css("--status-info", "#3b82f6"), - fontSans: css("--font-body", '"DM Sans", "Inter", sans-serif'), - fontMono: css("--mono", '"JetBrains Mono", "Fira Code", monospace'), - cornerRadius: 16, - } as const; -} - -export type SceneTokens = ReturnType; diff --git a/plugins/plugin-companion/src/components/avatar/vector-browser-three.ts b/plugins/plugin-companion/src/components/avatar/vector-browser-three.ts deleted file mode 100644 index 0d2aad284af12..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/vector-browser-three.ts +++ /dev/null @@ -1,32 +0,0 @@ -import * as THREE from "three"; - -export { THREE }; - -type WebGpuRendererCtor = new (options?: { - antialias?: boolean; -}) => THREE.WebGLRenderer & { init?: () => Promise }; - -export async function createVectorBrowserRenderer(): Promise { - if (typeof navigator !== "undefined" && navigator.gpu) { - try { - const webgpuModule = (await import("three/webgpu")) as Record< - string, - unknown - >; - const WebGPURenderer = webgpuModule.WebGPURenderer as - | WebGpuRendererCtor - | undefined; - if (WebGPURenderer) { - const renderer = new (WebGPURenderer as WebGpuRendererCtor)({ - antialias: true, - }); - await renderer.init?.(); - return renderer; - } - } catch { - // Fall through to WebGL in environments without WebGPU support. - } - } - - return new THREE.WebGLRenderer({ antialias: true }); -} diff --git a/plugins/plugin-companion/src/components/avatar/vector-browser-utils.ts b/plugins/plugin-companion/src/components/avatar/vector-browser-utils.ts deleted file mode 100644 index 0103ffa6b4dc1..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/vector-browser-utils.ts +++ /dev/null @@ -1,20 +0,0 @@ -export type { - MemoryRecord, - VectorGraph2DBounds, - VectorGraph2DLayout, - ViewMode, -} from "@elizaos/ui/components/pages/vector-browser-utils"; -export { - buildVectorGraph2DLayout, - DIM_COLUMNS, - hasEmbedding, - MAX_THREE_PIXEL_RATIO, - PAGE_SIZE, - parseContent, - parseEmbedding, - projectTo2D, - rowToMemory, - toVectorGraph2DScreenX, - toVectorGraph2DScreenY, - VECTOR_GRAPH_2D_PALETTE, -} from "@elizaos/ui/components/pages/vector-browser-utils"; diff --git a/plugins/plugin-companion/src/components/avatar/vrm-desktop-energy.ts b/plugins/plugin-companion/src/components/avatar/vrm-desktop-energy.ts deleted file mode 100644 index 9801b2a6e9069..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/vrm-desktop-energy.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { - invokeDesktopBridgeRequest, - isElectrobunRuntime, -} from "@elizaos/ui/bridge"; -import type { - CompanionHalfFramerateMode, - CompanionVrmPowerMode, -} from "@elizaos/ui/state"; -import type { DesktopPowerState } from "@elizaos/ui/utils"; - -/** How often to re-read AC vs battery in the Electrobun shell (ms). */ -export const VRM_DESKTOP_BATTERY_POLL_MS = 60_000; - -/** - * localStorage: set to **`"0"`** to keep full Retina VRM resolution on battery. - * - * **WHY:** some users prefer visual fidelity over the default **1×** pixel cap - * when unplugged. - */ -export const VRM_BATTERY_PIXEL_CAP_STORAGE_KEY = "eliza.vrmBatteryPixelCap"; - -export function isVrmBatteryPixelCapEnabled(): boolean { - if (typeof window === "undefined") return true; - try { - return ( - window.localStorage.getItem(VRM_BATTERY_PIXEL_CAP_STORAGE_KEY) !== "0" - ); - } catch { - return true; - } -} - -export type VrmEngineBatteryPolicyTarget = { - isInitialized(): boolean; - /** DPR cap + shadow + Spark tuning — independent of frame cadence. */ - setLowPowerRenderMode(enabled: boolean): void; - /** ~Half display refresh: skip alternate ticks; uses `Clock` accumulation. */ - setHalfFramerateMode(enabled: boolean): void; -}; - -export type RefreshVrmDesktopBatteryPixelPolicyOptions = { - /** User Settings: quality / balanced / efficiency (default `balanced`). */ - companionVrmPowerMode?: CompanionVrmPowerMode; - /** - * When to apply half-FPS: never, whenever pixel low-power is active, or always. - * Default `when_saving_power` matches historic “bundled” behavior. - */ - companionHalfFramerateMode?: CompanionHalfFramerateMode; -}; - -function resolveHalfFramerateEnabled( - halfMode: CompanionHalfFramerateMode, - lowPowerVisual: boolean, -): boolean { - if (halfMode === "off") return false; - if (halfMode === "always") return true; - return lowPowerVisual; -} - -/** - * Syncs **`VrmEngine`** **pixel / shadow / Spark** policy and **half-FPS** from - * **`desktop:getPowerState`** (Electrobun) and **`companionVrmPowerMode`**. - * - * - **`quality`:** never low-power visuals. - * - **`efficiency`:** always low-power visuals. - * - **`balanced`:** low-power visuals only when on battery and the battery pixel cap path is active. - * - * Half-FPS follows **`companionHalfFramerateMode`**: default ties it to the same - * moments as low-power visuals (`when_saving_power`). - */ -export async function refreshVrmDesktopBatteryPixelPolicy( - engine: VrmEngineBatteryPolicyTarget | null, - options?: RefreshVrmDesktopBatteryPixelPolicyOptions, -): Promise { - const mode = options?.companionVrmPowerMode ?? "balanced"; - const halfMode = options?.companionHalfFramerateMode ?? "when_saving_power"; - if (!engine?.isInitialized()) return; - - let lowPowerVisual: boolean; - - if (!isElectrobunRuntime()) { - lowPowerVisual = mode === "efficiency"; - engine.setLowPowerRenderMode(lowPowerVisual); - engine.setHalfFramerateMode( - resolveHalfFramerateEnabled(halfMode, lowPowerVisual), - ); - return; - } - if (!isVrmBatteryPixelCapEnabled()) { - lowPowerVisual = mode === "efficiency"; - engine.setLowPowerRenderMode(lowPowerVisual); - engine.setHalfFramerateMode( - resolveHalfFramerateEnabled(halfMode, lowPowerVisual), - ); - return; - } - const power = await invokeDesktopBridgeRequest({ - rpcMethod: "desktopGetPowerState", - ipcChannel: "desktop:getPowerState", - }); - if (!power) return; - if (mode === "quality") { - lowPowerVisual = false; - } else if (mode === "efficiency") { - lowPowerVisual = true; - } else { - lowPowerVisual = power.onBattery === true; - } - engine.setLowPowerRenderMode(lowPowerVisual); - engine.setHalfFramerateMode( - resolveHalfFramerateEnabled(halfMode, lowPowerVisual), - ); -} diff --git a/plugins/plugin-companion/src/components/avatar/vrm-pause-policy.test.ts b/plugins/plugin-companion/src/components/avatar/vrm-pause-policy.test.ts deleted file mode 100644 index 4f9a4cf81b7bd..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/vrm-pause-policy.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { computeVrmPausePolicy } from "./vrm-pause-policy"; - -// #9141: the VRM avatar is the heaviest GPU/battery cost. These pin the gating -// so the render loop only runs when the avatar is actually producing useful -// pixels — active, on screen, and (the tab visible OR opted into animate-hidden). - -const base = { - active: true, - onScreen: true, - docVisible: true, - animateHidden: false, -}; - -describe("computeVrmPausePolicy (#9141)", () => { - it("runs full-rate when active, on screen, and the tab is visible", () => { - expect(computeVrmPausePolicy(base)).toEqual({ - paused: false, - halfFramerateWhileHidden: false, - }); - }); - - it("pauses when inactive", () => { - expect(computeVrmPausePolicy({ ...base, active: false }).paused).toBe(true); - }); - - it("pauses when scrolled offscreen even if visible + active", () => { - expect(computeVrmPausePolicy({ ...base, onScreen: false }).paused).toBe( - true, - ); - }); - - it("pauses on a hidden tab by default (no animate-when-hidden)", () => { - expect(computeVrmPausePolicy({ ...base, docVisible: false }).paused).toBe( - true, - ); - }); - - it("keeps rendering at HALF rate on a hidden tab when animate-when-hidden is on", () => { - expect( - computeVrmPausePolicy({ - ...base, - docVisible: false, - animateHidden: true, - }), - ).toEqual({ paused: false, halfFramerateWhileHidden: true }); - }); - - it("offscreen still wins over animate-when-hidden (no point rendering offscreen)", () => { - const p = computeVrmPausePolicy({ - ...base, - onScreen: false, - docVisible: false, - animateHidden: true, - }); - expect(p.paused).toBe(true); - expect(p.halfFramerateWhileHidden).toBe(false); - }); -}); diff --git a/plugins/plugin-companion/src/components/avatar/vrm-pause-policy.ts b/plugins/plugin-companion/src/components/avatar/vrm-pause-policy.ts deleted file mode 100644 index e02880247fedb..0000000000000 --- a/plugins/plugin-companion/src/components/avatar/vrm-pause-policy.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Pure decision for the VRM render loop's pause + throttle state (#9141). - * - * The VRM avatar canvas is the heaviest GPU/battery cost in the app. Extracted - * from VrmViewer (which pulls three.js) so the gating is unit-testable without a - * WebGL context. - * - * - `paused`: stop the GPU loop entirely — the avatar produces no useful pixels - * when it's inactive, scrolled offscreen, or the tab is hidden (unless the user - * opted into animate-when-hidden). Offscreen always wins. - * - `halfFramerateWhileHidden`: when the user DID opt into animate-when-hidden - * and the tab is hidden (but the canvas is still on the page + active), run at - * half rate instead of full — the one case where we keep rendering hidden. - */ -export interface VrmPausePolicyInput { - /** The `active` prop — false while the avatar is logically off (e.g. collapsed). */ - active: boolean; - /** Whether the canvas geometrically intersects the viewport. */ - onScreen: boolean; - /** document.visibilityState === "visible". */ - docVisible: boolean; - /** User opted into keeping the avatar animating while the tab is hidden. */ - animateHidden: boolean; -} - -export interface VrmPausePolicy { - paused: boolean; - halfFramerateWhileHidden: boolean; -} - -export function computeVrmPausePolicy( - input: VrmPausePolicyInput, -): VrmPausePolicy { - const { active, onScreen, docVisible, animateHidden } = input; - return { - paused: !active || !onScreen || (!docVisible && !animateHidden), - halfFramerateWhileHidden: - animateHidden && !docVisible && active && onScreen, - }; -} diff --git a/plugins/plugin-companion/src/components/chat/ChatAvatar.stories.tsx b/plugins/plugin-companion/src/components/chat/ChatAvatar.stories.tsx deleted file mode 100644 index 7b30681656c7a..0000000000000 --- a/plugins/plugin-companion/src/components/chat/ChatAvatar.stories.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; - -/** - * ChatAvatar depends on @elizaos/app-core/state (useApp) and VrmViewer - * (WebGL). Full rendering requires a 3D context. - * - * This static story documents the component interface; interactive - * stories will be added once a MockVrmScene decorator is available. - */ - -function ChatAvatarStaticStory() { - return ( -
-
- VRM -
-

- ChatAvatar renders a live VRM avatar in the chat sidebar. -
- Requires WebGL context — see CompanionSceneHost for full 3D stories. -

-
- ); -} - -const meta = { - title: "Companion/ChatAvatar", - component: ChatAvatarStaticStory, - tags: ["autodocs"], - parameters: { - layout: "centered", - }, -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const StaticInterface: Story = {}; diff --git a/plugins/plugin-companion/src/components/chat/ChatAvatar.tsx b/plugins/plugin-companion/src/components/chat/ChatAvatar.tsx deleted file mode 100644 index ac0dcbcb29f65..0000000000000 --- a/plugins/plugin-companion/src/components/chat/ChatAvatar.tsx +++ /dev/null @@ -1,158 +0,0 @@ -import { - APP_EMOTE_EVENT, - type AppEmoteEventDetail, - STOP_EMOTE_EVENT, -} from "@elizaos/ui/events"; -import { - getVrmPreviewUrl, - getVrmUrl, - useAppSelectorShallow, -} from "@elizaos/ui/state"; -import { resolveAppAssetUrl } from "@elizaos/ui/utils"; -import { useCallback, useEffect, useRef, useState } from "react"; - -import type { VrmEngine, VrmEngineState } from "../avatar/VrmEngine"; -import { VrmViewer } from "../avatar/VrmViewer"; - -export type ChatAvatarProps = Record; - -export function ChatAvatar(_props: ChatAvatarProps) { - const { - selectedVrmIndex, - customVrmUrl, - companionVrmPowerMode, - companionHalfFramerateMode, - companionAnimateWhenHidden, - } = useAppSelectorShallow((s) => ({ - selectedVrmIndex: s.selectedVrmIndex, - customVrmUrl: s.customVrmUrl, - companionVrmPowerMode: s.companionVrmPowerMode, - companionHalfFramerateMode: s.companionHalfFramerateMode, - companionAnimateWhenHidden: s.companionAnimateWhenHidden, - })); - - // Resolve VRM path from selected index or custom upload - const vrmPath = - selectedVrmIndex === 0 && customVrmUrl - ? customVrmUrl - : getVrmUrl(selectedVrmIndex || 1); - const fallbackPreviewUrl = - selectedVrmIndex > 0 - ? getVrmPreviewUrl(selectedVrmIndex) - : getVrmPreviewUrl(1); - - const vrmEngineRef = useRef(null); - const [engineReady, setEngineReady] = useState(false); - const [vrmLoaded, setVrmLoaded] = useState(false); - const [showFallback, setShowFallback] = useState(false); - - const avatarVisible = engineReady || vrmLoaded || showFallback; - - const handleEngineReady = useCallback((engine: VrmEngine) => { - vrmEngineRef.current = engine; - setEngineReady(true); - }, []); - - const handleEngineState = useCallback((state: VrmEngineState) => { - if (state.vrmLoaded) { - setVrmLoaded(true); - setShowFallback(false); - return; - } - if (state.loadError) { - setVrmLoaded(false); - setShowFallback(true); - } - }, []); - - // biome-ignore lint/correctness/useExhaustiveDependencies: reset the loading UI when the requested VRM changes. - useEffect(() => { - setVrmLoaded(false); - setShowFallback(false); - }, [vrmPath]); - - useEffect(() => { - if (!engineReady) return; - const handler = (event: Event) => { - const engine = vrmEngineRef.current; - if (!engine) return; - const detail = (event as CustomEvent).detail; - if (!detail.path) return; - const resolvedPath = resolveAppAssetUrl(detail.path); - const duration = - typeof detail.duration === "number" && Number.isFinite(detail.duration) - ? detail.duration - : 3; - const isLoop = detail.loop === true; - void engine.playEmote(resolvedPath, duration, isLoop); - }; - window.addEventListener(APP_EMOTE_EVENT, handler); - return () => window.removeEventListener(APP_EMOTE_EVENT, handler); - }, [engineReady]); - - // Listen for stop-emote events from the EmotePicker control panel. - useEffect(() => { - if (!engineReady) return; - const handler = () => { - vrmEngineRef.current?.stopEmote(); - }; - document.addEventListener(STOP_EMOTE_EVENT, handler); - return () => document.removeEventListener(STOP_EMOTE_EVENT, handler); - }, [engineReady]); - - return ( -
-
-
-
-
- - {showFallback && !vrmLoaded && ( - avatar preview - )} - - {!vrmLoaded && !showFallback && ( -
-
-
- )} -
-
-
- ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionAppView.tsx b/plugins/plugin-companion/src/components/companion/CompanionAppView.tsx deleted file mode 100644 index dbe5577d54848..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionAppView.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import type { OverlayAppContext } from "@elizaos/ui/components/apps/overlay-app-api"; -import { useRenderGuard } from "@elizaos/ui/hooks"; -import { useAppSelector } from "@elizaos/ui/state"; -import { memo, useEffect } from "react"; -import { CompanionSceneHost } from "./CompanionSceneHost"; -import { useCompanionSceneStatus } from "./companion-scene-status-context"; -import { EmotePicker } from "./EmotePicker"; - -/** - * Inner overlay rendered on top of the avatar scene. The companion now shows - * just the avatar — no header / nav bar — so this only hosts the emote picker - * overlay plus an Escape-to-exit affordance (the full-screen overlay app has no - * visible chrome to close it otherwise). - */ -const CompanionOverlay = memo(function CompanionOverlay({ - exitToApps, -}: { - exitToApps: () => void; -}) { - useRenderGuard("CompanionAppView"); - const emotePickerOpen = useAppSelector((s) => s.emotePickerOpen); - const { avatarReady } = useCompanionSceneStatus(); - - useEffect(() => { - const onKeyDown = (event: KeyboardEvent) => { - // While the emote picker is open it owns Escape (to close itself). - if (event.key === "Escape" && !emotePickerOpen) { - exitToApps(); - } - }; - window.addEventListener("keydown", onKeyDown); - return () => { - window.removeEventListener("keydown", onKeyDown); - }; - }, [emotePickerOpen, exitToApps]); - - return ( -
- - - -
- - - {avatarReady ? "Companion avatar ready" : "Companion avatar loading"} - -
- -
-
- ); -}); - -/** - * CompanionAppView — top-level overlay app component. - * - * Mounts CompanionSceneHost (which owns VrmStage → VrmViewer → VrmEngine). - * Everything loads on mount, everything disposes on unmount. - */ -export function CompanionAppView(props: OverlayAppContext) { - return ( -
- - - -
- ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionHeader.stories.tsx b/plugins/plugin-companion/src/components/companion/CompanionHeader.stories.tsx deleted file mode 100644 index 7e6eae0c87acf..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionHeader.stories.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { CompanionHeader } from "./CompanionHeader"; - -const meta = { - title: "Companion/CompanionHeader", - component: CompanionHeader, - tags: ["autodocs"], - argTypes: { - activeView: { - control: "select", - options: ["companion", "character"], - }, - chatAgentVoiceMuted: { control: "boolean" }, - }, - args: { - activeView: "companion", - uiLanguage: "en" as const, - setUiLanguage: () => {}, - uiTheme: "dark" as const, - setUiTheme: () => {}, - t: (key: string) => key, - onExitToDesktop: () => {}, - onExitToCharacter: () => {}, - onSwitchToCompanion: () => {}, - onToggleVoiceMute: () => {}, - onNewChat: () => {}, - chatAgentVoiceMuted: false, - }, - parameters: { - layout: "fullscreen", - }, -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const Default: Story = {}; - -export const CharacterView: Story = { - args: { activeView: "character" }, -}; - -export const VoiceMuted: Story = { - args: { chatAgentVoiceMuted: true }, -}; diff --git a/plugins/plugin-companion/src/components/companion/CompanionHeader.tsx b/plugins/plugin-companion/src/components/companion/CompanionHeader.tsx deleted file mode 100644 index 5e03f53573513..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionHeader.tsx +++ /dev/null @@ -1,392 +0,0 @@ -import { useAgentElement } from "@elizaos/ui/agent-surface"; -import { Button, LanguageDropdown, ThemeToggle } from "@elizaos/ui/components"; -import { useMediaQuery } from "@elizaos/ui/hooks"; -import type { UiLanguage } from "@elizaos/ui/i18n"; -import type { UiTheme } from "@elizaos/ui/state"; -import { - MessageCirclePlus, - Monitor, - PencilLine, - Settings, - Smartphone, - Sparkles, - UserRound, - Volume2, - VolumeX, -} from "lucide-react"; -import { memo, type ReactNode, useCallback, useRef } from "react"; - -const SHELL_MODE_MOBILE_BREAKPOINT = 639; -const SHELL_MODE_MOBILE_MEDIA_QUERY = `(max-width: ${SHELL_MODE_MOBILE_BREAKPOINT}px)`; - -export type CompanionShellView = "companion" | "character" | "settings"; - -export interface CompanionHeaderProps { - /** Which internal view is currently active. */ - activeView?: CompanionShellView; - /** Exit companion overlay and navigate to chat / desktop. */ - onExitToDesktop: () => void; - /** Switch to the character editor view within the companion overlay. */ - onExitToCharacter: () => void; - /** Switch to companion-local settings within the overlay. */ - onOpenSettings?: () => void; - /** Switch back to the companion chat view within the overlay. */ - onSwitchToCompanion?: () => void; - uiLanguage: UiLanguage; - setUiLanguage: (language: UiLanguage) => void; - uiTheme: UiTheme; - setUiTheme: (theme: UiTheme) => void; - t: (key: string) => string; - chatAgentVoiceMuted?: boolean; - onToggleVoiceMute?: () => void; - onNewChat?: () => void; - onToggleEmotePicker?: () => void; - /** Shown in the shell header right cluster (e.g. inference / cloud alert). */ - rightExtras?: ReactNode; -} - -export const CompanionHeader = memo(function CompanionHeader( - props: CompanionHeaderProps, -) { - const { - activeView = "companion", - onExitToDesktop, - onExitToCharacter, - onOpenSettings, - onSwitchToCompanion, - uiLanguage, - setUiLanguage, - uiTheme, - setUiTheme, - t, - chatAgentVoiceMuted = false, - onToggleVoiceMute, - onNewChat, - onToggleEmotePicker, - rightExtras, - } = props; - - const isMobileViewport = useMediaQuery(SHELL_MODE_MOBILE_MEDIA_QUERY); - - const voiceToggleLabel = chatAgentVoiceMuted - ? t("companion.agentVoiceOff") - : t("companion.agentVoiceOn"); - - // Mode selector pill — companion & character switch views within the - // overlay; desktop exits the overlay entirely. - const shellOptions = [ - { - view: "companion" as const, - agentId: "tab-companion", - label: t("header.companionMode"), - Icon: UserRound, - onClick: - activeView === "companion" - ? () => {} - : (onSwitchToCompanion ?? (() => {})), - }, - { - view: "character" as const, - agentId: "tab-character", - label: t("header.characterMode"), - Icon: PencilLine, - onClick: activeView === "character" ? () => {} : onExitToCharacter, - }, - { - view: "settings" as const, - agentId: "tab-settings", - label: "Companion settings", - Icon: Settings, - onClick: - activeView === "settings" ? () => {} : (onOpenSettings ?? (() => {})), - }, - { - view: "desktop" as const, - agentId: "tab-desktop", - label: t("header.nativeMode"), - Icon: isMobileViewport ? Smartphone : Monitor, - onClick: onExitToDesktop, - }, - ]; - - return ( -
-
-
-
- {/* Left: mode selector pill */} -
-
- {t("aria.switchShellView")} - {shellOptions.map((option, index) => { - const edgeClass = - index === 0 - ? "rounded-l-xl rounded-r-none" - : index === shellOptions.length - 1 - ? "rounded-l-none rounded-r-xl" - : "rounded-none"; - return ( - - ); - })} -
-
- - {/* Center: voice + new chat */} -
-
-
- {onToggleVoiceMute ? ( - - {chatAgentVoiceMuted ? ( - - ) : ( - - )} - - ) : null} - {onToggleEmotePicker ? ( - - - - ) : null} - {onNewChat ? ( - - - - ) : null} -
-
-
- - {/* Right: extras + language + theme */} -
- {rightExtras} - - - - - - -
-
-
-
-
- ); -}); - -interface CompanionShellOption { - view: "companion" | "character" | "settings" | "desktop"; - agentId: string; - label: string; - Icon: (props: { className?: string }) => ReactNode; - onClick: () => void; -} - -const CompanionShellToggleButton = memo(function CompanionShellToggleButton({ - option, - selected, - edgeClass, -}: { - option: CompanionShellOption; - selected: boolean; - edgeClass: string; -}) { - const { ref, agentProps } = useAgentElement({ - id: option.agentId, - role: "tab", - label: option.label, - group: "companion-shell-views", - status: selected ? "active" : "inactive", - description: `Switch the companion overlay to ${option.label}`, - }); - const { Icon } = option; - return ( - - ); -}); - -const COMPANION_HEADER_ICON_BUTTON_CLASS = - "inline-flex h-11 w-11 min-h-touch min-w-touch items-center justify-center rounded-xl border border-border/42 bg-[linear-gradient(180deg,color-mix(in_srgb,var(--card)_72%,transparent),color-mix(in_srgb,var(--bg)_44%,transparent))] text-txt shadow-[inset_0_1px_0_rgba(255,255,255,0.18),0_14px_32px_rgba(3,5,10,0.14)] ring-1 ring-inset ring-white/6 backdrop-blur-xl supports-[backdrop-filter]:bg-[linear-gradient(180deg,color-mix(in_srgb,var(--card)_62%,transparent),color-mix(in_srgb,var(--bg)_34%,transparent))] transition-[border-color,background-color,color,transform,box-shadow] duration-200 hover:border-accent/55 hover:bg-[linear-gradient(180deg,color-mix(in_srgb,var(--card)_78%,transparent),color-mix(in_srgb,var(--bg-hover)_52%,transparent))] hover:text-txt hover:shadow-[inset_0_1px_0_rgba(255,255,255,0.22),0_18px_36px_rgba(3,5,10,0.18)] active:scale-[0.98] disabled:active:scale-100 disabled:hover:border-border/42 disabled:hover:bg-[linear-gradient(180deg,color-mix(in_srgb,var(--card)_72%,transparent),color-mix(in_srgb,var(--bg)_44%,transparent))] disabled:hover:text-txt pointer-events-auto text-sm leading-none"; - -function CompanionHeaderIconButton({ - agentId, - label, - ariaPressed, - onClick, - testId, - children, -}: { - agentId: string; - label: string; - ariaPressed?: boolean; - onClick: () => void; - testId: string; - children: ReactNode; -}) { - const { ref, agentProps } = useAgentElement({ - id: agentId, - role: "button", - label, - group: "companion-header-actions", - description: label, - }); - return ( - - ); -} - -/** - * Wraps a shared @elizaos/ui control (LanguageDropdown / ThemeToggle) that does - * not forward an agent ref. Registers the slot and activates the control by - * clicking the trigger button it renders inside. - */ -function CompanionHeaderControlSlot({ - agentId, - label, - description, - children, -}: { - agentId: string; - label: string; - description: string; - children: ReactNode; -}) { - const slotRef = useRef(null); - const activate = useCallback(() => { - slotRef.current?.querySelector("button")?.click(); - }, []); - const { ref, agentProps } = useAgentElement({ - id: agentId, - role: "button", - label, - group: "companion-header-actions", - description, - onActivate: activate, - }); - const setRef = useCallback( - (node: HTMLDivElement | null) => { - slotRef.current = node; - ref.current = node; - }, - [ref], - ); - return ( -
- {children} -
- ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionPerformanceSettings.tsx b/plugins/plugin-companion/src/components/companion/CompanionPerformanceSettings.tsx deleted file mode 100644 index f32dcde125590..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionPerformanceSettings.tsx +++ /dev/null @@ -1,206 +0,0 @@ -import { useAgentElement } from "@elizaos/ui/agent-surface"; -import { Button, Switch } from "@elizaos/ui/components"; -import type { - CompanionHalfFramerateMode, - CompanionVrmPowerMode, -} from "@elizaos/ui/state"; -import { useAppSelectorShallow } from "@elizaos/ui/state"; -import { - COMPANION_HALF_FRAMERATE_OPTIONS, - COMPANION_VRM_POWER_OPTIONS, -} from "../../types/render-modes"; - -export function CompanionPerformanceSettings() { - const { - companionVrmPowerMode, - setCompanionVrmPowerMode, - companionHalfFramerateMode, - setCompanionHalfFramerateMode, - companionAnimateWhenHidden, - setCompanionAnimateWhenHidden, - t, - } = useAppSelectorShallow((s) => ({ - companionVrmPowerMode: s.companionVrmPowerMode, - setCompanionVrmPowerMode: s.setCompanionVrmPowerMode, - companionHalfFramerateMode: s.companionHalfFramerateMode, - setCompanionHalfFramerateMode: s.setCompanionHalfFramerateMode, - companionAnimateWhenHidden: s.companionAnimateWhenHidden, - setCompanionAnimateWhenHidden: s.setCompanionAnimateWhenHidden, - t: s.t, - })); - - return ( -
-

- {t("settings.appearance.companionPerformance", { - defaultValue: "Companion performance", - })} -

-
-
-
- {t("settings.companionVrmPower.label", { - defaultValue: "Companion rendering", - })} -
-
- {t("settings.companionVrmPower.desc", { - defaultValue: - "Control how much GPU the 3D companion uses while rendering.", - })} -
-
- - {COMPANION_VRM_POWER_OPTIONS.map((mode: CompanionVrmPowerMode) => ( - setCompanionVrmPowerMode(mode)} - /> - ))} - -
-
-
- {t("settings.companionHalfFramerate.label", { - defaultValue: "Companion frame rate", - })} -
-
- {t("settings.companionHalfFramerate.desc", { - defaultValue: - "Optionally cap the 3D companion at about half display refresh rate.", - })} -
-
- - {COMPANION_HALF_FRAMERATE_OPTIONS.map( - (mode: CompanionHalfFramerateMode) => ( - setCompanionHalfFramerateMode(mode)} - /> - ), - )} - -
-
-
- {t("settings.companionAnimateWhenHidden.title", { - defaultValue: "Animate in background", - })} -
-
-
- {t("settings.companionAnimateWhenHidden.desc", { - defaultValue: - "Keep the avatar idling while the window or tab is hidden.", - })} -
- -
-
-
-
- ); -} - -function SegmentedSetting({ children }: { children: React.ReactNode }) { - return
{children}
; -} - -function CompanionPerfModeButton({ - agentId, - group, - label, - testId, - active, - onSelect, -}: { - agentId: string; - group: string; - label: string; - testId: string; - active: boolean; - onSelect: () => void; -}) { - const { ref, agentProps } = useAgentElement({ - id: agentId, - role: "tab", - label, - group, - status: active ? "active" : "inactive", - description: `Set companion rendering to ${label}`, - }); - return ( - - ); -} - -function CompanionAnimateWhenHiddenToggle({ - checked, - onCheckedChange, - label, -}: { - checked: boolean; - onCheckedChange: (next: boolean) => void; - label: string; -}) { - const { ref, agentProps } = useAgentElement({ - id: "settings-animate-when-hidden", - role: "toggle", - label, - group: "companion-performance", - status: checked ? "active" : "inactive", - description: "Keep the avatar animating while the window is hidden", - onActivate: () => onCheckedChange(!checked), - }); - return ( - - ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionSceneHost.tsx b/plugins/plugin-companion/src/components/companion/CompanionSceneHost.tsx deleted file mode 100644 index 639b1523a139e..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionSceneHost.tsx +++ /dev/null @@ -1,699 +0,0 @@ -import { resolveCharacterGreetingAnimation } from "@elizaos/ui/components"; -import { - dispatchAppEmoteEvent, - VRM_TELEPORT_COMPLETE_EVENT, -} from "@elizaos/ui/events"; -import { useRenderGuard } from "@elizaos/ui/hooks"; -import { - getVrmPreviewUrl, - getVrmUrl, - useCompanionSceneConfig, - useTranslation, - VRM_COUNT, -} from "@elizaos/ui/state"; -import { - memo, - type ReactNode, - type PointerEvent as ReactPointerEvent, - useCallback, - useEffect, - useMemo, - useRef, - useState, -} from "react"; -import type { VrmEngine } from "../avatar/VrmEngine"; -import { prefetchVrmToCache } from "../avatar/VrmEngine"; -import { CompanionStageBackdrop } from "./CompanionStageBackdrop"; -import { CompanionSceneStatusContext } from "./companion-scene-status-context"; -import { SharedCompanionSceneContext } from "./shared-companion-scene-context"; -import { VrmStage } from "./VrmStage"; - -const COMPANION_ZOOM_WHEEL_SENSITIVITY = 1 / 720; -const COMPANION_ZOOM_PINCH_SENSITIVITY = 2.35; -const COMPANION_ZOOM_STORAGE_KEY = "eliza.companion.zoom.v1"; -const DEFAULT_COMPANION_ZOOM = 0.95; -const COMPANION_TELEPORT_GREETING_DELAY_MS = 400; -const CAMERA_DRAG_IGNORE_SELECTOR = - 'button, a, label, input, textarea, select, option, [role="button"], [role="listbox"], [role="tab"], [aria-expanded], [aria-haspopup], [contenteditable="true"], [data-no-camera-drag="true"]'; -const CAMERA_ZOOM_IGNORE_SELECTOR = '[data-no-camera-zoom="true"]'; -const NON_TEXT_INPUT_TYPES = new Set([ - "button", - "checkbox", - "color", - "file", - "hidden", - "image", - "radio", - "range", - "reset", - "submit", -]); - -// SharedCompanionSceneContext is imported from ./shared-companion-scene-context -// to keep the hook importable without pulling in the 3D stack. - -type TouchPoint = { - x: number; - y: number; -}; - -type CompanionWheelEvent = Pick< - WheelEvent, - "ctrlKey" | "deltaMode" | "deltaY" | "preventDefault" | "target" ->; - -let _companionTeleportCompletedOnce = false; - -function getTouchDistance(points: Map): number { - const touchPoints = [...points.values()]; - if (touchPoints.length < 2) return 0; - const [firstPoint, secondPoint] = touchPoints; - if (!firstPoint || !secondPoint) return 0; - return Math.hypot(secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y); -} - -function getWheelPixels( - event: Pick, -): number { - if (event.deltaMode === 1) return event.deltaY * 16; - if (event.deltaMode === 2) { - return event.deltaY * (window.innerHeight || 1); - } - return event.deltaY; -} - -function hasFocusedTextEntry(): boolean { - if (typeof document === "undefined") return false; - const activeElement = document.activeElement; - if (activeElement instanceof HTMLTextAreaElement) { - return true; - } - if (activeElement instanceof HTMLInputElement) { - return !NON_TEXT_INPUT_TYPES.has(activeElement.type.toLowerCase()); - } - return activeElement instanceof HTMLElement - ? activeElement.isContentEditable - : false; -} - -function shouldIgnoreCameraDrag(target: EventTarget | null): boolean { - return target instanceof Element - ? Boolean(target.closest(CAMERA_DRAG_IGNORE_SELECTOR)) - : false; -} - -function shouldIgnoreCameraZoom(target: EventTarget | null): boolean { - return target instanceof Element - ? Boolean(target.closest(CAMERA_ZOOM_IGNORE_SELECTOR)) - : false; -} - -function clampCompanionZoom(value: number): number { - return Math.max(0, Math.min(1, value)); -} - -function loadStoredCompanionZoom(): number { - if (typeof localStorage === "undefined") return DEFAULT_COMPANION_ZOOM; - try { - const raw = localStorage.getItem(COMPANION_ZOOM_STORAGE_KEY); - if (raw === null) return DEFAULT_COMPANION_ZOOM; - const parsed = Number(raw); - return Number.isFinite(parsed) - ? clampCompanionZoom(parsed) - : DEFAULT_COMPANION_ZOOM; - } catch (err) { - console.warn( - "[CompanionSceneHost] Failed to load stored companion zoom:", - err, - ); - return DEFAULT_COMPANION_ZOOM; - } -} - -function persistCompanionZoom(value: number): void { - if (typeof localStorage === "undefined") return; - try { - localStorage.setItem( - COMPANION_ZOOM_STORAGE_KEY, - String(clampCompanionZoom(value)), - ); - } catch (err) { - console.warn("[CompanionSceneHost] Failed to persist companion zoom:", err); - } -} - -function CompanionSceneSurface({ - active, - interactive = true, - children, -}: { - active: boolean; - interactive?: boolean; - children?: ReactNode; -}) { - useRenderGuard("CompanionSceneHost"); - const { - selectedVrmIndex, - customVrmUrl, - uiTheme, - tab, - companionVrmPowerMode, - companionHalfFramerateMode, - companionAnimateWhenHidden, - } = useCompanionSceneConfig(); - const { t } = useTranslation(); - const rootRef = useRef(null); - const stageEnginesRef = useRef(new Set()); - const companionZoomRef = useRef(DEFAULT_COMPANION_ZOOM); - const companionZoomHydratedRef = useRef(false); - const dragOrbitRef = useRef({ yaw: 0, pitch: 0 }); - const dragStateRef = useRef<{ - active: boolean; - pointerId: number | null; - startX: number; - startY: number; - }>({ - active: false, - pointerId: null, - startX: 0, - startY: 0, - }); - const touchPointsRef = useRef(new Map()); - const pinchStateRef = useRef<{ - active: boolean; - startDistance: number; - startZoom: number; - }>({ - active: false, - startDistance: 0, - startZoom: 0, - }); - - if (!companionZoomHydratedRef.current) { - companionZoomRef.current = loadStoredCompanionZoom(); - companionZoomHydratedRef.current = true; - } - - // Lazy-mount VrmStage: only initialize the 3D engine once the scene is - // actually needed (first time active becomes true). This prevents the WebGL - // context and asset loads from firing in native/chat mode on startup. - const hasEverBeenActiveRef = useRef(active); - if (active) hasEverBeenActiveRef.current = true; - const shouldMountVrm = hasEverBeenActiveRef.current; - - const setCompanionZoom = useCallback((value: number) => { - const nextZoom = clampCompanionZoom(value); - companionZoomRef.current = nextZoom; - persistCompanionZoom(nextZoom); - for (const engine of stageEnginesRef.current) { - engine.setCompanionZoomNormalized(nextZoom); - } - }, []); - - const handleStageEngineReady = useCallback((engine: VrmEngine) => { - stageEnginesRef.current.add(engine); - engine.setCompanionZoomNormalized(companionZoomRef.current); - engine.setDragOrbitTarget( - dragOrbitRef.current.yaw, - dragOrbitRef.current.pitch, - ); - }, []); - - const handleStageLayerEngineReady = useCallback( - (_vrmPath: string, engine: VrmEngine) => { - stageEnginesRef.current.add(engine); - engine.setCompanionZoomNormalized(companionZoomRef.current); - engine.setDragOrbitTarget( - dragOrbitRef.current.yaw, - dragOrbitRef.current.pitch, - ); - }, - [], - ); - - const handlePointerDownCapture = useCallback( - (event: ReactPointerEvent) => { - if (!active || !interactive || shouldIgnoreCameraDrag(event.target)) { - return; - } - /* Stop event from reaching children — this is a camera drag */ - event.stopPropagation(); - if (typeof window.getSelection === "function") { - window.getSelection()?.removeAllRanges(); - } - if (event.pointerType === "touch") { - touchPointsRef.current.set(event.pointerId, { - x: event.clientX, - y: event.clientY, - }); - } - event.currentTarget.setPointerCapture(event.pointerId); - if (event.pointerType === "touch" && touchPointsRef.current.size >= 2) { - pinchStateRef.current = { - active: true, - startDistance: getTouchDistance(touchPointsRef.current), - startZoom: companionZoomRef.current, - }; - dragStateRef.current = { - active: false, - pointerId: null, - startX: 0, - startY: 0, - }; - dragOrbitRef.current = { yaw: 0, pitch: 0 }; - for (const engine of stageEnginesRef.current) { - engine.resetDragOrbit(); - } - event.preventDefault(); - return; - } - dragStateRef.current = { - active: true, - pointerId: event.pointerId, - startX: event.clientX, - startY: event.clientY, - }; - event.preventDefault(); - }, - [active, interactive], - ); - - const handlePointerMoveCapture = useCallback( - (event: ReactPointerEvent) => { - if (!active || !interactive) return; - if ( - event.pointerType === "touch" && - touchPointsRef.current.has(event.pointerId) - ) { - touchPointsRef.current.set(event.pointerId, { - x: event.clientX, - y: event.clientY, - }); - if ( - pinchStateRef.current.active && - touchPointsRef.current.size >= 2 && - pinchStateRef.current.startDistance > 0 - ) { - const viewportSpan = Math.max( - 1, - Math.min( - window.innerWidth || event.currentTarget.clientWidth || 1, - window.innerHeight || event.currentTarget.clientHeight || 1, - ), - ); - const pinchDistance = getTouchDistance(touchPointsRef.current); - const zoomDelta = - ((pinchDistance - pinchStateRef.current.startDistance) / - viewportSpan) * - COMPANION_ZOOM_PINCH_SENSITIVITY; - setCompanionZoom(pinchStateRef.current.startZoom + zoomDelta); - event.preventDefault(); - return; - } - } - const dragState = dragStateRef.current; - if (!dragState.active || dragState.pointerId !== event.pointerId) { - return; - } - const width = window.innerWidth || event.currentTarget.clientWidth || 1; - const height = - window.innerHeight || event.currentTarget.clientHeight || 1; - const deltaX = event.clientX - dragState.startX; - const deltaY = event.clientY - dragState.startY; - const yaw = (deltaX / width) * 1.35; - const pitch = (-deltaY / height) * 0.85; - dragOrbitRef.current = { yaw, pitch }; - for (const engine of stageEnginesRef.current) { - engine.setDragOrbitTarget(yaw, pitch); - } - event.preventDefault(); - }, - [active, interactive, setCompanionZoom], - ); - - const handleWheelCapture = useCallback( - (event: CompanionWheelEvent) => { - if (!active || !interactive) return; - const wheelPixels = getWheelPixels(event); - if (Math.abs(wheelPixels) < 0.01) return; - setCompanionZoom( - companionZoomRef.current - - wheelPixels * COMPANION_ZOOM_WHEEL_SENSITIVITY, - ); - event.preventDefault(); - }, - [active, interactive, setCompanionZoom], - ); - - const handleRootWheelCapture = useCallback( - (event: CompanionWheelEvent) => { - if (!active || !interactive) return; - if (hasFocusedTextEntry()) { - event.preventDefault(); - return; - } - if (shouldIgnoreCameraZoom(event.target)) { - return; - } - handleWheelCapture(event); - }, - [active, interactive, handleWheelCapture], - ); - - const releaseCameraDrag = useCallback( - (event: ReactPointerEvent) => { - if (event.pointerType === "touch") { - touchPointsRef.current.delete(event.pointerId); - if (touchPointsRef.current.size < 2) { - pinchStateRef.current = { - active: false, - startDistance: 0, - startZoom: companionZoomRef.current, - }; - } - } - const dragState = dragStateRef.current; - if (event.currentTarget.hasPointerCapture(event.pointerId)) { - event.currentTarget.releasePointerCapture(event.pointerId); - } - if (dragState.pointerId !== event.pointerId) return; - dragStateRef.current = { - active: false, - pointerId: null, - startX: 0, - startY: 0, - }; - dragOrbitRef.current = { yaw: 0, pitch: 0 }; - for (const engine of stageEnginesRef.current) { - engine.resetDragOrbit(); - } - }, - [], - ); - - const safeSelectedVrmIndex = selectedVrmIndex > 0 ? selectedVrmIndex : 1; - const vrmPath = - selectedVrmIndex === 0 && customVrmUrl - ? customVrmUrl - : getVrmUrl(safeSelectedVrmIndex); - const fallbackPreviewUrl = - selectedVrmIndex > 0 - ? getVrmPreviewUrl(safeSelectedVrmIndex) - : getVrmPreviewUrl(1); - const teleportKey = vrmPath; - const [teleportCompletedKey, setTeleportCompletedKey] = useState< - string | null - >(null); - const teleportKeyRef = useRef(teleportKey); - const greetingAnimationPathRef = useRef( - resolveCharacterGreetingAnimation({ avatarIndex: selectedVrmIndex }), - ); - const greetingEmoteTimerRef = useRef(null); - - useEffect(() => { - const handleTeleportComplete = () => { - _companionTeleportCompletedOnce = true; - setTeleportCompletedKey(teleportKeyRef.current); - if (greetingEmoteTimerRef.current != null) { - window.clearTimeout(greetingEmoteTimerRef.current); - } - // Give the idle blend a moment to settle after the dissolve before - // cross-fading into the greeting emote. - greetingEmoteTimerRef.current = window.setTimeout(() => { - greetingEmoteTimerRef.current = null; - const greetingAnimationPath = greetingAnimationPathRef.current; - if (!greetingAnimationPath) { - return; - } - dispatchAppEmoteEvent({ - emoteId: "greeting", - path: `/${greetingAnimationPath}`, - duration: 3, - loop: false, - showOverlay: false, - }); - }, COMPANION_TELEPORT_GREETING_DELAY_MS); - }; - window.addEventListener( - VRM_TELEPORT_COMPLETE_EVENT, - handleTeleportComplete, - ); - return () => { - window.removeEventListener( - VRM_TELEPORT_COMPLETE_EVENT, - handleTeleportComplete, - ); - if (greetingEmoteTimerRef.current != null) { - window.clearTimeout(greetingEmoteTimerRef.current); - greetingEmoteTimerRef.current = null; - } - }; - }, []); - - useEffect(() => { - const root = rootRef.current; - if (!root) return; - - const handleNativeWheel = (event: WheelEvent) => { - handleRootWheelCapture(event); - }; - - root.addEventListener("wheel", handleNativeWheel, { - capture: true, - passive: false, - }); - - return () => { - root.removeEventListener("wheel", handleNativeWheel, { - capture: true, - }); - }; - }, [handleRootWheelCapture]); - - useEffect(() => { - const root = rootRef.current; - if (!root) return; - - const preventGestureZoom = (event: Event) => { - event.preventDefault(); - }; - - root.addEventListener("gesturestart", preventGestureZoom, { - passive: false, - }); - root.addEventListener("gesturechange", preventGestureZoom, { - passive: false, - }); - root.addEventListener("gestureend", preventGestureZoom, { - passive: false, - }); - - return () => { - root.removeEventListener("gesturestart", preventGestureZoom); - root.removeEventListener("gesturechange", preventGestureZoom); - root.removeEventListener("gestureend", preventGestureZoom); - }; - }, []); - - useEffect(() => { - if (active && interactive) return; - touchPointsRef.current.clear(); - pinchStateRef.current = { - active: false, - startDistance: 0, - startZoom: companionZoomRef.current, - }; - dragStateRef.current = { - active: false, - pointerId: null, - startX: 0, - startY: 0, - }; - dragOrbitRef.current = { yaw: 0, pitch: 0 }; - for (const engine of stageEnginesRef.current) { - engine.resetDragOrbit(); - } - }, [active, interactive]); - - useEffect(() => { - return () => { - stageEnginesRef.current.clear(); - }; - }, []); - - /* ── Camera X-offset for CharacterEditor panel ──────────────────── */ - useEffect(() => { - const handler = (event: Event) => { - const detail = (event as CustomEvent<{ offset: number }>).detail; - const offset = detail?.offset; - for (const engine of stageEnginesRef.current) { - engine.setCameraXOffset(offset); - } - }; - window.addEventListener("eliza:editor-camera-offset", handler); - return () => - window.removeEventListener("eliza:editor-camera-offset", handler); - }, []); - const avatarReady = teleportCompletedKey === teleportKey; - const sceneStatus = useMemo( - () => ({ - avatarReady, - teleportKey, - }), - [avatarReady, teleportKey], - ); - - useEffect(() => { - greetingAnimationPathRef.current = resolveCharacterGreetingAnimation({ - avatarIndex: selectedVrmIndex, - }); - }, [selectedVrmIndex]); - - useEffect(() => { - teleportKeyRef.current = teleportKey; - _companionTeleportCompletedOnce = false; - setTeleportCompletedKey(null); - if (greetingEmoteTimerRef.current != null) { - window.clearTimeout(greetingEmoteTimerRef.current); - greetingEmoteTimerRef.current = null; - } - }, [teleportKey]); - - const preloadPreviews = useMemo(() => { - if (tab !== "character" && tab !== "character-select") { - return []; - } - return Array.from({ length: VRM_COUNT }, (_, index) => { - const avatarIndex = index + 1; - return { previewUrl: getVrmPreviewUrl(avatarIndex) }; - }); - }, [tab]); - - /* ── Preload only lightweight preview thumbnails (~80KB each) for the - * character-select grid. Full VRMs (~10MB each) are fetched on-demand - * when the user actually selects an avatar, and cached in-memory by - * VrmEngine so subsequent swaps skip the network entirely. ── */ - const preloadedRef = useRef(false); - useEffect(() => { - if (preloadedRef.current || preloadPreviews.length === 0) return; - preloadedRef.current = true; - for (const entry of preloadPreviews) { - const img = new Image(); - img.src = entry.previewUrl; - } - }, [preloadPreviews]); - - /* ── Prefetch VRM buffers into the in-memory cache as soon as the character - * tab opens. Fire-and-forget: errors are silently swallowed inside - * prefetchVrmToCache. This converts the first character-click from a - * cold ~3-8 s network fetch into a <200 ms re-parse from cached bytes. ── */ - const vrmPrefetchedRef = useRef(false); - useEffect(() => { - if (tab !== "character" && tab !== "character-select") return; - if (vrmPrefetchedRef.current) return; - vrmPrefetchedRef.current = true; - for (let i = 1; i <= VRM_COUNT; i++) { - void prefetchVrmToCache(getVrmUrl(i)); - } - }, [tab]); - - return ( -
-
- {shouldMountVrm && ( - - )} - - {/* Aesthetic loading stage. The VRM canvas renders an opaque "Construct" - environment (white/dark void + grid + fog), so a backdrop placed - *behind* it never shows. Instead this overlays the canvas while the - avatar is still teleporting in: a gradient wash + accent silhouette so - the companion reads as a designed stage, never a flat void. It fades - out the instant the live avatar is ready. pointer-events:none keeps - camera drag / zoom working through it. */} -
- -
-
- - - {children} - -
- ); -} - -// Do NOT use a custom memo comparator that ignores children here. -// shellContent (which includes ViewRouter / tab content) is passed as -// children — ignoring children changes blocks all tab navigation. -// If keystroke re-renders are a concern, memoize shellContent in App.tsx. -export const CompanionSceneHost = memo(CompanionSceneSurface); - -export function SharedCompanionScene({ - active, - interactive = true, - children, -}: { - active: boolean; - interactive?: boolean; - children: ReactNode; -}) { - return ( - - - {children} - - - ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionSettingsPanel.tsx b/plugins/plugin-companion/src/components/companion/CompanionSettingsPanel.tsx deleted file mode 100644 index c9b5280112518..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionSettingsPanel.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { CompanionPerformanceSettings } from "./CompanionPerformanceSettings"; - -export function CompanionSettingsPanel() { - return ( -
-
- -
-
- ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionShell.tsx b/plugins/plugin-companion/src/components/companion/CompanionShell.tsx deleted file mode 100644 index 78d12f7f28ed7..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionShell.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { LoadingScreen } from "@elizaos/ui/components"; -import { useRenderGuard } from "@elizaos/ui/hooks"; -import type { Tab } from "@elizaos/ui/navigation"; -import type { ActionNotice } from "@elizaos/ui/state"; -import { memo, useEffect, useState } from "react"; -import { getVrmCount, getVrmUrl, VRM_COUNT } from "../../vrm-assets"; -import { prefetchVrmToCache } from "../avatar/VrmEngine"; -import { CompanionView } from "./CompanionView"; - -/* ── Main component ────────────────────────────────────────────────── */ - -export interface CompanionShellProps { - tab: Tab; - actionNotice: ActionNotice | null; -} - -export const CompanionShell = memo(function CompanionShell( - _props: CompanionShellProps, -) { - useRenderGuard("CompanionShell"); - - // The first time the companion mounts, VRM buffers may not be in cache - // yet — render the LoadingScreen until every prefetch settles so the - // user doesn't see a flash of empty stage before the avatar can parse. - // Prefetch is best-effort (network errors are swallowed by VrmEngine); - // we await Promise.allSettled so a single failed asset doesn't block - // the rest of the UI from coming up. - const [vrmsReady, setVrmsReady] = useState(false); - useEffect(() => { - let cancelled = false; - const total = getVrmCount() || VRM_COUNT; - const work: Array> = []; - for (let i = 1; i <= total; i++) { - work.push(prefetchVrmToCache(getVrmUrl(i))); - } - Promise.allSettled(work).then(() => { - if (!cancelled) setVrmsReady(true); - }); - return () => { - cancelled = true; - }; - }, []); - - if (!vrmsReady) { - // Prime the loader's staged-fetch UI with the first VRM so users see - // a real percentage instead of an empty bar. - return ; - } - - return ( -
- -
- ); -}); diff --git a/plugins/plugin-companion/src/components/companion/CompanionSpatialView.test.tsx b/plugins/plugin-companion/src/components/companion/CompanionSpatialView.test.tsx deleted file mode 100644 index 3cf4bb6cb74e8..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionSpatialView.test.tsx +++ /dev/null @@ -1,269 +0,0 @@ -// @vitest-environment jsdom - -import { visibleWidth } from "@elizaos/tui"; -import { SpatialSurface } from "@elizaos/ui/spatial"; -import { - getTerminalView, - registerSpatialTerminalView, - renderViewToLines, -} from "@elizaos/ui/spatial/tui"; -import { cleanup, fireEvent, render, screen } from "@testing-library/react"; -import { renderToStaticMarkup } from "react-dom/server"; -import { afterEach, describe, expect, it, vi } from "vitest"; -import { AGENT_EMOTE_CATALOG, EMOTE_CATALOG } from "../../emotes/catalog"; -import { - type CompanionSnapshot, - CompanionSpatialView, -} from "./CompanionSpatialView.tsx"; -import { interact } from "./CompanionView.interact"; - -const eventDispatchers = vi.hoisted(() => ({ - dispatchAppEvent: vi.fn(), - dispatchAppEmoteEvent: vi.fn(), -})); - -vi.mock("@elizaos/ui/events", () => ({ - dispatchAppEvent: eventDispatchers.dispatchAppEvent, - dispatchAppEmoteEvent: eventDispatchers.dispatchAppEmoteEvent, - STOP_EMOTE_EVENT: "eliza:stop-emote", -})); - -const snapshot: CompanionSnapshot = { - avatarReady: true, - selectedVrmIndex: 3, - customVrmUrl: null, - uiTheme: "dark", - companionZoom: 1.25, - dragOrbit: { yaw: 30, pitch: -10 }, - messageCount: 4, - assistantCount: 2, - userCount: 2, - interruptedAssistantCount: 1, - lastMessage: "hello there", - lastUsageModel: "gpt-test", - chatAgentVoiceMuted: false, - emoteCount: 24, - agentEmoteCount: 18, - emotesByCategory: { greeting: 3, dance: 5, idle: 1 }, - emotePickerOpen: false, - playingEmoteId: "wave", - elizaCloudConnected: true, - elizaCloudEnabled: true, - elizaCloudAuthRejected: false, - elizaCloudCreditsError: false, - inferenceNoticeKind: "connected", - uiLanguage: "en", - tab: "companion", - activeOverlayApp: "companion", -}; - -const view = ; - -describe("CompanionSpatialView one source, three modalities", () => { - it("TUI: renders to terminal lines honoring the width contract (54 + 32)", () => { - for (const width of [54, 32]) { - const lines = renderViewToLines(view, width); - for (const line of lines) expect(visibleWidth(line)).toBe(width); - const flat = lines.join("\n"); - expect(flat).toContain("avatar-ready"); - expect(flat).toContain("VRM #3"); - expect(flat).toContain("gpt-test"); // last model - expect(flat).toContain("New chat"); - // "playing wave" may wrap across lines at narrow widths; assert tokens. - expect(flat).toContain("playing"); - expect(flat).toContain("wave"); - } - }); - - it("GUI + XR: renders DOM with agent hooks, XR scaled up", () => { - const gui = renderToStaticMarkup( - {view}, - ); - const xr = renderToStaticMarkup( - {view}, - ); - expect(gui).toContain('data-spatial-surface="gui"'); - expect(xr).toContain('data-spatial-surface="xr"'); - for (const html of [gui, xr]) { - expect(html).toContain("avatar-ready"); - expect(html).toContain("VRM #3"); - expect(html).toContain('data-agent-id="new-chat"'); - expect(html).toContain('data-agent-id="toggle-voice"'); - } - }); - - it("registers as a terminal view the agent terminal can mount and render", () => { - const unregister = registerSpatialTerminalView( - "companion-test", - () => view, - ); - try { - const component = getTerminalView("companion-test"); - expect(component).toBeTruthy(); - const lines = component?.render(50) ?? []; - expect(lines.length).toBeGreaterThan(0); - for (const line of lines) expect(visibleWidth(line)).toBe(50); - expect(lines.join("\n")).toContain("avatar-ready"); - } finally { - unregister(); - } - }); -}); - -// Control affordances: clicking each agent button dispatches the matching action -// id through `onAction`. The host wires these to the companion app state -// (toggle-voice / new-chat / toggle-emotes / settings). Only Button/Field are -// DOM-clickable in spatial views, so these are the four operator controls. -describe("CompanionSpatialView controls dispatch onAction", () => { - afterEach(() => { - cleanup(); - vi.clearAllMocks(); - }); - - it("wires each control button to its onAction id", () => { - const onAction = vi.fn(); - render( - - - , - ); - - // Default snapshot is voice-live, so the toggle reads "Mute". - fireEvent.click(screen.getByText("Mute")); - expect(onAction).toHaveBeenCalledWith("toggle-voice"); - - fireEvent.click(screen.getByText("New chat")); - expect(onAction).toHaveBeenCalledWith("new-chat"); - - fireEvent.click(screen.getByText("Open emotes")); - expect(onAction).toHaveBeenCalledWith("toggle-emotes"); - - fireEvent.click(screen.getByText("Settings")); - expect(onAction).toHaveBeenCalledWith("settings"); - - // Snapshot has a playing emote, so the Stop control is present and wired. - fireEvent.click(screen.getByText("Stop")); - expect(onAction).toHaveBeenCalledWith("stop-emote"); - }); - - it("reflects voice/emote-picker state in the control labels", () => { - const onAction = vi.fn(); - render( - - - , - ); - - // Muted -> the voice toggle reads "Unmute". - expect(screen.getByText("Unmute")).toBeTruthy(); - fireEvent.click(screen.getByText("Unmute")); - expect(onAction).toHaveBeenCalledWith("toggle-voice"); - - // Open picker -> the emote toggle reads "Close emotes". - expect(screen.getByText("Close emotes")).toBeTruthy(); - expect(screen.queryByText("Open emotes")).toBeNull(); - - // No playing emote -> no Stop control. - expect(screen.queryByText("Stop")).toBeNull(); - }); -}); - -// The view bundle's `interact` capability handler powers the terminal companion -// surface (state / emote listing / play / stop). It is independent of any React -// component and ships in the same bundle as CompanionView. -describe("companion view-bundle interact() capabilities", () => { - afterEach(() => { - vi.clearAllMocks(); - }); - - it("supports terminal capabilities for state, emotes, play, and stop", async () => { - await expect(interact("terminal-companion-state")).resolves.toMatchObject({ - viewType: "tui", - emoteCount: expect.any(Number), - agentEmoteCount: expect.any(Number), - capabilities: expect.arrayContaining(["terminal-companion-play-emote"]), - }); - - await expect( - interact("terminal-companion-emotes", { - category: "greeting", - source: "agent", - }), - ).resolves.toMatchObject({ - viewType: "tui", - emotes: expect.arrayContaining([ - expect.objectContaining({ id: "wave", category: "greeting" }), - ]), - }); - - await expect( - interact("terminal-companion-play-emote", { emote: "wave" }), - ).resolves.toEqual({ viewType: "tui", played: "wave" }); - expect(eventDispatchers.dispatchAppEmoteEvent).toHaveBeenCalledWith( - expect.objectContaining({ emoteId: "wave", showOverlay: true }), - ); - - await expect(interact("terminal-companion-stop-emote")).resolves.toEqual({ - viewType: "tui", - stopped: true, - }); - expect(eventDispatchers.dispatchAppEvent).toHaveBeenCalledWith( - "eliza:stop-emote", - ); - }); - - it("rejects terminal-companion-play-emote for missing and unknown emotes", async () => { - await expect(interact("terminal-companion-play-emote")).rejects.toThrow( - "emote is required", - ); - await expect( - interact("terminal-companion-play-emote", { emote: " " }), - ).rejects.toThrow("emote is required"); - await expect( - interact("terminal-companion-play-emote", { emote: "not-a-real-emote" }), - ).rejects.toThrow("Unknown emote: not-a-real-emote"); - // No emote event is dispatched on the error paths. - expect(eventDispatchers.dispatchAppEmoteEvent).not.toHaveBeenCalled(); - }); - - it("returns the full catalog for terminal-companion-emotes with default source and no category", async () => { - const all = (await interact("terminal-companion-emotes")) as { - viewType: string; - emotes: Array<{ id: string }>; - }; - // Default source = "all" -> full EMOTE_CATALOG, no category filter. - expect(all.viewType).toBe("tui"); - expect(all.emotes).toHaveLength(EMOTE_CATALOG.length); - - // source = "agent" returns the agent-allowed subset (excludes idle loop). - const agent = (await interact("terminal-companion-emotes", { - source: "agent", - })) as { emotes: Array<{ id: string }> }; - expect(agent.emotes).toHaveLength(AGENT_EMOTE_CATALOG.length); - expect(agent.emotes.length).toBeLessThan(all.emotes.length); - expect(agent.emotes.some((e) => e.id === "idle")).toBe(false); - - // Each returned emote carries the contract fields the WS payload needs. - const wave = all.emotes.find((e) => e.id === "wave") as - | { id: string; path: string; duration: number; loop: boolean } - | undefined; - expect(wave).toBeDefined(); - expect(wave?.path.endsWith(".gz")).toBe(true); - expect(typeof wave?.duration).toBe("number"); - expect(typeof wave?.loop).toBe("boolean"); - }); - - it("rejects an unsupported capability", async () => { - await expect(interact("terminal-companion-bogus")).rejects.toThrow( - "Unsupported companion TUI capability: terminal-companion-bogus", - ); - }); -}); diff --git a/plugins/plugin-companion/src/components/companion/CompanionSpatialView.tsx b/plugins/plugin-companion/src/components/companion/CompanionSpatialView.tsx deleted file mode 100644 index e83bad4ff6773..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionSpatialView.tsx +++ /dev/null @@ -1,279 +0,0 @@ -/** - * CompanionSpatialView — the companion surface authored once with the spatial - * vocabulary, so it renders correctly wherever it is displayed: - * - * - GUI / XR — mounted in `` (DOM; XR scales up). - * - TUI — rendered to real terminal lines by the agent terminal, via - * `registerSpatialTerminalView` (see `register-terminal-view.tsx`). - * - * The primary companion view is a Three.js WebGL canvas hosting a 3D VRM avatar - * (`VrmStage`/`VrmViewer`/`VrmEngine`), which cannot render in XR-scaled DOM or - * in a terminal. This is the `canvasOnly` operator panel: a concise, purely - * presentational status + controls surface (a snapshot + an action callback in, - * primitives out). It imports only the cross-modality primitives, so it is safe - * to render in the Node agent process where the terminal lives (no Three.js / - * Capacitor runtime import). - */ - -import { - Button, - Card, - Divider, - HStack, - List, - type SpatialTone, - Text, -} from "@elizaos/ui/spatial"; - -/** Cloud-inference notice severity, derived in a use-case before this view. */ -export type CompanionInferenceNoticeKind = - | "connected" - | "disconnected" - | "auth" - | "credits" - | "disabled" - | null; - -export interface CompanionSnapshot { - /** 3D VRM avatar / scene. */ - avatarReady: boolean; - selectedVrmIndex: number; - customVrmUrl: string | null; - uiTheme: string; - companionZoom: number; - dragOrbit: { yaw: number; pitch: number }; - - /** Conversation state. */ - messageCount: number; - assistantCount: number; - userCount: number; - interruptedAssistantCount: number; - lastMessage: string | null; - lastUsageModel: string | null; - chatAgentVoiceMuted: boolean; - - /** Emote system. */ - emoteCount: number; - agentEmoteCount: number; - emotesByCategory: Record; - emotePickerOpen: boolean; - playingEmoteId: string | null; - - /** Cloud inference status. */ - elizaCloudConnected: boolean; - elizaCloudEnabled: boolean; - elizaCloudAuthRejected: boolean; - elizaCloudCreditsError: boolean; - inferenceNoticeKind: CompanionInferenceNoticeKind; - - /** UI state. */ - uiLanguage: string; - tab: string | null; - activeOverlayApp: string | null; -} - -function noticeTone(kind: CompanionInferenceNoticeKind): SpatialTone { - switch (kind) { - case "auth": - case "disconnected": - return "danger"; - case "credits": - return "warning"; - case "disabled": - return "muted"; - case "connected": - return "success"; - default: - return "muted"; - } -} - -function noticeLabel(kind: CompanionInferenceNoticeKind): string { - switch (kind) { - case "auth": - return "cloud auth rejected"; - case "credits": - return "cloud credits error"; - case "disconnected": - return "cloud disconnected"; - case "disabled": - return "cloud disabled"; - case "connected": - return "cloud connected"; - default: - return "no notice"; - } -} - -function avatarLabel(snapshot: CompanionSnapshot): string { - if (snapshot.customVrmUrl) return "custom VRM"; - return `VRM #${snapshot.selectedVrmIndex}`; -} - -export interface CompanionSpatialViewProps { - snapshot: CompanionSnapshot; - /** Dispatch by agent id: `toggle-voice`, `new-chat`, `toggle-emotes`, `stop-emote`, `settings`. */ - onAction?: (action: string) => void; -} - -export function CompanionSpatialView({ - snapshot, - onAction, -}: CompanionSpatialViewProps) { - const dispatch = (action: string) => () => onAction?.(action); - const categories = Object.entries(snapshot.emotesByCategory).slice(0, 6); - return ( - - - - {snapshot.avatarReady ? "avatar-ready" : "avatar-loading"} - - - {snapshot.messageCount} msgs - - - - - - - - avatar - - {avatarLabel(snapshot)} - - - - theme - - {snapshot.uiTheme} - - - - zoom / orbit - - - {snapshot.companionZoom.toFixed(2)}x y{" "} - {snapshot.dragOrbit.yaw.toFixed(0)} p{" "} - {snapshot.dragOrbit.pitch.toFixed(0)} - - - - - - - - - user / assistant - - - {snapshot.userCount} / {snapshot.assistantCount} - - - {snapshot.interruptedAssistantCount > 0 ? ( - - - interrupted - - {snapshot.interruptedAssistantCount} - - ) : null} - - - last model - - {snapshot.lastUsageModel ?? "none"} - - - - voice - - - {snapshot.chatAgentVoiceMuted ? "muted" : "live"} - - - - - - - {noticeLabel(snapshot.inferenceNoticeKind)} - - - - - - {snapshot.emoteCount} total / {snapshot.agentEmoteCount} agent - - {snapshot.playingEmoteId ? ( - - playing {snapshot.playingEmoteId} - - ) : null} - - {categories.length === 0 ? ( - - None - - ) : ( - - {categories.map(([category, count]) => ( - - - {category} - - {count} - - ))} - - )} - - - - - - - - - {snapshot.playingEmoteId ? ( - - ) : null} - - - - ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionStageBackdrop.tsx b/plugins/plugin-companion/src/components/companion/CompanionStageBackdrop.tsx deleted file mode 100644 index 4f826434b60f4..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionStageBackdrop.tsx +++ /dev/null @@ -1,165 +0,0 @@ -import { type CSSProperties, memo } from "react"; - -/** - * CompanionStageBackdrop — the aesthetic stage that lives *behind* the - * transparent VRM canvas. When the avatar renders, the WebGL layer (cleared - * to alpha 0) composites on top and this shows through as a soft backdrop + - * floor glow. When the avatar is absent or still loading, this layer is the - * visible centerpiece: a gradient stage plus a gradient-filled avatar - * silhouette, so the companion is never an empty void. - * - * Sizing/positioning use inline styles, NOT Tailwind arbitrary utilities: the - * companion view ships as a standalone bundle with no compiled Tailwind CSS, so - * arbitrary classes like `h-[120%]` / `w-[34%]` resolve to nothing and collapse - * the layer to 0×0. Inline styles are self-contained and always paint. - */ -const fill: CSSProperties = { - position: "absolute", - inset: 0, -}; - -export const CompanionStageBackdrop = memo(function CompanionStageBackdrop({ - theme, - showSilhouette, -}: { - theme: "light" | "dark"; - showSilhouette: boolean; -}) { - const dark = theme === "dark"; - return ( -
- {/* Ambient stage wash — soft accent halo over a neutral vignette. */} -
- - {/* Centre spotlight that grounds the avatar. */} -
- - {showSilhouette && } - - {/* Floor reflection ellipse so the figure feels planted. */} -
-
- ); -}); - -/** - * Gradient-filled avatar silhouette — a calm, accent-tinted figure that reads - * as "your companion lives here" without claiming a specific character. Shown - * only while the live VRM has not painted yet. - */ -function CompanionAvatarSilhouette({ dark }: { dark: boolean }) { - const stroke = dark ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.08)"; - return ( -
- - - - - - - - - - - - - - {/* Soft halo behind the head/shoulders */} - - - {/* Head */} - - {/* Shoulders + torso, rounded bust silhouette */} - - -
- ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionView.helpers.ts b/plugins/plugin-companion/src/components/companion/CompanionView.helpers.ts deleted file mode 100644 index 79c87ae026b19..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionView.helpers.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Shared (non-component) helpers for the companion view. Kept out of -// CompanionView.tsx so that file exports only React components and stays -// Fast-Refresh-compatible. Used by both the view components and the view-bundle -// `interact` handler. - -import { EMOTE_CATALOG, type EmoteCategory } from "../../emotes/catalog"; - -export function countByCategory(): Record { - return EMOTE_CATALOG.reduce>( - (counts, emote) => { - counts[emote.category] = (counts[emote.category] ?? 0) + 1; - return counts; - }, - { - greeting: 0, - emotion: 0, - dance: 0, - combat: 0, - idle: 0, - movement: 0, - gesture: 0, - other: 0, - }, - ); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionView.interact.ts b/plugins/plugin-companion/src/components/companion/CompanionView.interact.ts deleted file mode 100644 index 08c26418c5fab..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionView.interact.ts +++ /dev/null @@ -1,83 +0,0 @@ -// View-bundle `interact` capability handler, split out of CompanionView.tsx so -// that file exports only React components and stays Fast-Refresh-compatible -// (Vite would full-reload a component file that also exports a plain function). -// The view bundle re-exports `interact` via ./companion-view-bundle.ts. - -import { - dispatchAppEmoteEvent, - dispatchAppEvent, - STOP_EMOTE_EVENT, -} from "@elizaos/ui/events"; -import { - AGENT_EMOTE_CATALOG, - EMOTE_CATALOG, - type EmoteCategory, - getEmote, -} from "../../emotes/catalog"; -import { countByCategory } from "./CompanionView.helpers"; - -export async function interact( - capability: string, - params?: Record, -): Promise { - if (capability === "terminal-companion-state") { - return { - viewType: "tui", - emoteCount: EMOTE_CATALOG.length, - agentEmoteCount: AGENT_EMOTE_CATALOG.length, - emotesByCategory: countByCategory(), - capabilities: [ - "terminal-companion-state", - "terminal-companion-emotes", - "terminal-companion-play-emote", - "terminal-companion-stop-emote", - ], - }; - } - - if (capability === "terminal-companion-emotes") { - const category = - typeof params?.category === "string" - ? (params.category.trim() as EmoteCategory) - : null; - const source = - typeof params?.source === "string" ? params.source.trim() : "all"; - const catalog = source === "agent" ? AGENT_EMOTE_CATALOG : EMOTE_CATALOG; - return { - viewType: "tui", - emotes: catalog - .filter((emote) => !category || emote.category === category) - .map((emote) => ({ - id: emote.id, - name: emote.name, - category: emote.category, - duration: emote.duration, - loop: emote.loop, - path: emote.path, - })), - }; - } - - if (capability === "terminal-companion-play-emote") { - const emoteId = - typeof params?.emote === "string" ? params.emote.trim() : ""; - if (!emoteId) throw new Error("emote is required"); - const emote = getEmote(emoteId); - if (!emote) throw new Error(`Unknown emote: ${emoteId}`); - dispatchAppEmoteEvent({ - emoteId: emote.id, - path: emote.path, - duration: emote.duration, - loop: emote.loop, - showOverlay: true, - }); - return { viewType: "tui", played: emote.id }; - } - - if (capability === "terminal-companion-stop-emote") { - dispatchAppEvent(STOP_EMOTE_EVENT); - return { viewType: "tui", stopped: true }; - } - - throw new Error(`Unsupported companion TUI capability: ${capability}`); -} diff --git a/plugins/plugin-companion/src/components/companion/CompanionView.test.tsx b/plugins/plugin-companion/src/components/companion/CompanionView.test.tsx deleted file mode 100644 index c16deb6a3b34e..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionView.test.tsx +++ /dev/null @@ -1,128 +0,0 @@ -// @vitest-environment jsdom - -// Standard + XR companion view (componentExport `CompanionView`). The two -// registrations (`viewType: "gui"` and `viewType: "xr"`) render the IDENTICAL -// component — there is no xr-specific branch in the component — so a single -// render exercises both surfaces. The 3D scene host is mocked to a passthrough -// (three / @pixiv-three-vrm are peer deps and not asserted here); the emote -// picker overlay has its own dedicated test. This test asserts the overlay's -// data regions: the avatar-ready StatusChip and the emote-count chips, against -// the REAL catalog values (imported, never magic numbers) so the assertions -// track the catalog as it changes. - -import { cleanup, render, screen } from "@testing-library/react"; -import React from "react"; -import { afterEach, describe, expect, it, vi } from "vitest"; -import { AGENT_EMOTE_CATALOG, EMOTE_CATALOG } from "../../emotes/catalog"; -import { countByCategory } from "./CompanionView.helpers"; -import { CompanionSceneStatusContext } from "./companion-scene-status-context"; - -// useRenderGuard is the only @elizaos/ui hook the overlay itself calls; the -// vitest alias maps `@elizaos/ui` and `@elizaos/ui/hooks` to the same module -// id, so this mock covers the `/hooks` subpath import in CompanionView. -vi.mock("@elizaos/ui", () => ({ - useRenderGuard: vi.fn(), -})); - -// The scene host is the VRM 3D stage. Mock it to a passthrough that also lets -// the test drive the avatar-ready context value consumed by StatusChip. -const sceneStatus = vi.hoisted(() => ({ avatarReady: false })); -vi.mock("./CompanionSceneHost", () => ({ - CompanionSceneHost: ({ children }: { children: React.ReactNode }) => - React.createElement( - CompanionSceneStatusContext.Provider, - { - value: { avatarReady: sceneStatus.avatarReady, teleportKey: "" }, - }, - children, - ), -})); - -// EmotePicker has its own dedicated test; here it is an inert placeholder so the -// overlay renders without pulling in the full picker tree. -vi.mock("./EmotePicker", () => ({ - EmotePicker: () => - React.createElement("div", { "data-testid": "emote-picker-stub" }), -})); - -import { CompanionView } from "./CompanionView"; - -afterEach(() => { - cleanup(); - vi.clearAllMocks(); - sceneStatus.avatarReady = false; -}); - -const SUCCESS_BG = "var(--status-success-bg)"; -const SUCCESS_FG = "var(--status-success)"; -const ACCENT_BG = "var(--accent-subtle)"; -const ACCENT_FG = "var(--accent)"; - -describe("CompanionView (standard/xr overlay chips)", () => { - it("renders the avatar-ready StatusChip and emote-count chips with real catalog values when ready", () => { - sceneStatus.avatarReady = true; - const categoryCount = Object.keys(countByCategory()).length; - - render(React.createElement(CompanionView)); - - // StatusChip: ready text + success colors, no pulse. - const statusLabel = screen.getByText("ready"); - expect(statusLabel).toBeTruthy(); - // The dot + chip use the success theme tokens when ready. - const statusChip = statusLabel.parentElement as HTMLElement; - expect(statusChip.style.background).toBe(SUCCESS_BG); - expect(statusChip.style.color).toBe(SUCCESS_FG); - const dot = statusChip.querySelector("span") as HTMLElement; - expect(dot.style.background).toBe(SUCCESS_FG); - // No pulse animation when ready. - expect(dot.style.animation === "" || dot.style.animation == null).toBe( - true, - ); - - // " emotes" chip — tracks the real catalog. - expect(AGENT_EMOTE_CATALOG.length).toBeGreaterThan(0); - expect( - screen.getByText(`${AGENT_EMOTE_CATALOG.length} emotes`), - ).toBeTruthy(); - - // "/ catalog" chip. - expect(EMOTE_CATALOG.length).toBeGreaterThan(0); - expect(categoryCount).toBeGreaterThan(0); - expect( - screen.getByText(`${EMOTE_CATALOG.length}/${categoryCount} catalog`), - ).toBeTruthy(); - - // Static "overlay relay" chip. - expect(screen.getByText("overlay relay")).toBeTruthy(); - - // The agent emote count must be a strict subset of the full catalog (the - // catalog includes the locomotion/idle loops the agent cannot trigger). - expect(AGENT_EMOTE_CATALOG.length).toBeLessThanOrEqual( - EMOTE_CATALOG.length, - ); - }); - - it("flips the StatusChip to loading (accent + pulse) when the avatar is not ready", () => { - sceneStatus.avatarReady = false; - - render(React.createElement(CompanionView)); - - const statusLabel = screen.getByText("loading"); - expect(statusLabel).toBeTruthy(); - expect(screen.queryByText("ready")).toBeNull(); - - const statusChip = statusLabel.parentElement as HTMLElement; - expect(statusChip.style.background).toBe(ACCENT_BG); - expect(statusChip.style.color).toBe(ACCENT_FG); - - const dot = statusChip.querySelector("span") as HTMLElement; - expect(dot.style.background).toBe(ACCENT_FG); - // Pulse animation runs while loading. - expect(dot.style.animation).toContain("companion-chip-pulse"); - - // Emote count chips still render regardless of avatar-ready state. - expect( - screen.getByText(`${AGENT_EMOTE_CATALOG.length} emotes`), - ).toBeTruthy(); - }); -}); diff --git a/plugins/plugin-companion/src/components/companion/CompanionView.tsx b/plugins/plugin-companion/src/components/companion/CompanionView.tsx deleted file mode 100644 index be64422327b40..0000000000000 --- a/plugins/plugin-companion/src/components/companion/CompanionView.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import { useRenderGuard } from "@elizaos/ui/hooks"; -import { type CSSProperties, memo } from "react"; -import { AGENT_EMOTE_CATALOG, EMOTE_CATALOG } from "../../emotes/catalog"; -import { CompanionSceneHost } from "./CompanionSceneHost"; -import { countByCategory } from "./CompanionView.helpers"; -import { useCompanionSceneStatus } from "./companion-scene-status-context"; -import { EmotePicker } from "./EmotePicker"; - -/** - * Inner overlay rendered on top of the avatar scene. The companion now shows - * just the avatar — no header / nav bar — so this only hosts the emote picker - * overlay. Chat/voice happen in the global floating pill that floats over every - * view; character + settings live in the main app's own tabs. - */ -const CompanionViewOverlay = memo(function CompanionViewOverlay() { - useRenderGuard("CompanionView"); - const emoteCategories = countByCategory(); - const categoryCount = Object.keys(emoteCategories).length; - const { avatarReady } = useCompanionSceneStatus(); - - return ( -
- - - {/* Status metadata remains in the DOM for agent/a11y inspection without - adding visible chrome over the avatar stage. */} -
- - - - -
- -
-
- ); -}); - -const CHIP_BASE: CSSProperties = { - display: "inline-flex", - alignItems: "center", - gap: 6, - minHeight: 28, - padding: "0 1px", - fontSize: 11, - fontWeight: 600, - lineHeight: 1, - whiteSpace: "nowrap", -}; - -function StatusChip({ ready }: { ready: boolean }) { - return ( - - - {ready ? "ready" : "loading"} - - - ); -} - -function CompanionChip({ - label, - title, - subtle = false, -}: { - label: string; - title: string; - subtle?: boolean; -}) { - return ( - - {label} - - ); -} - -/** - * CompanionView — thin shell that composes CompanionSceneHost + overlay. - * Does NOT subscribe to useApp() so CompanionSceneHost receives stable - * children and avoids re-rendering the 3D scene on unrelated state changes. - */ -export const CompanionView = memo(function CompanionView() { - return ( - - - - ); -}); diff --git a/plugins/plugin-companion/src/components/companion/EmotePicker.test.tsx b/plugins/plugin-companion/src/components/companion/EmotePicker.test.tsx deleted file mode 100644 index 987e452805222..0000000000000 --- a/plugins/plugin-companion/src/components/companion/EmotePicker.test.tsx +++ /dev/null @@ -1,178 +0,0 @@ -// @vitest-environment jsdom - -// EmotePicker is the standard/xr companion view's only interactive surface (and -// is also opened from the TUI). This drives EVERY control: search filtering, -// category tab selection, the Stop + Close buttons, the playing/disabled state -// after an emote click, and the closed-state null render. The picker's emote -// grid is built from its own hardcoded ALL_EMOTES (see emote-picker-catalog -// contract test for the documented divergence from the runtime catalog). - -import { - act, - cleanup, - fireEvent, - render, - screen, -} from "@testing-library/react"; -import React from "react"; -import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; - -const appState = vi.hoisted(() => ({ - closeEmotePicker: vi.fn(), - emotePickerOpen: true, - openEmotePicker: vi.fn(), - t: (_key: string, options?: { defaultValue?: string }) => - options?.defaultValue ?? _key, -})); - -const uiMocks = vi.hoisted(() => ({ - dispatchAppEvent: vi.fn(), - playEmote: vi.fn(), -})); - -vi.mock("@elizaos/ui", () => ({ - APP_EMOTE_EVENT: "eliza:test-app-emote", - Button: ({ - children, - ...props - }: React.ButtonHTMLAttributes) => ( - - ), - client: { - playEmote: uiMocks.playEmote, - }, - dispatchAppEvent: uiMocks.dispatchAppEvent, - EMOTE_PICKER_EVENT: "eliza:test-emote-picker", - Input: React.forwardRef< - HTMLInputElement, - React.InputHTMLAttributes - >((props, ref) => ), - STOP_EMOTE_EVENT: "eliza:test-stop-emote", - useApp: () => appState, - useAppSelector: (selector: (s: typeof appState) => T): T => - selector(appState), - useAppSelectorShallow: (selector: (s: typeof appState) => T): T => - selector(appState), - useTimeout: () => ({ setTimeout: window.setTimeout.bind(window) }), - Z_GLOBAL_EMOTE: 10, - Z_SYSTEM_CRITICAL: 20, -})); - -import { EmotePicker } from "./EmotePicker"; - -afterEach(() => { - cleanup(); - vi.useRealTimers(); -}); - -beforeEach(() => { - vi.clearAllMocks(); - appState.emotePickerOpen = true; - uiMocks.playEmote.mockResolvedValue({ ok: true }); -}); - -describe("EmotePicker controls", () => { - it("returns null when emotePickerOpen is false", () => { - appState.emotePickerOpen = false; - const { container } = render(); - expect(container.querySelector('[data-testid="emote-picker"]')).toBeNull(); - }); - - it("filters the grid by search text and shows the empty state for no matches", () => { - render(); - - const search = screen.getByTestId( - "emote-picker-search", - ) as HTMLInputElement; - - // Typing "dance" narrows to the four dance items only. - fireEvent.change(search, { target: { value: "dance" } }); - expect(screen.getByTestId("emote-picker-item-dance-happy")).toBeTruthy(); - expect(screen.getByTestId("emote-picker-item-dance-breaking")).toBeTruthy(); - expect(screen.getByTestId("emote-picker-item-dance-hiphop")).toBeTruthy(); - expect(screen.getByTestId("emote-picker-item-dance-popping")).toBeTruthy(); - // Non-matching items are gone. - expect(screen.queryByTestId("emote-picker-item-wave")).toBeNull(); - expect(screen.queryByTestId("emote-picker-item-punching")).toBeNull(); - - // Gibberish search -> empty state. - fireEvent.change(search, { target: { value: "zzzznotanemote" } }); - expect(screen.queryByTestId("emote-picker-item-dance-happy")).toBeNull(); - expect(screen.getByText("emotepicker.NoEmotesFound")).toBeTruthy(); - }); - - it("selects a category tab and shows only that category's emotes", () => { - render(); - - // Click the "dance" category tab. - const danceTab = screen.getByTestId("emote-picker-category-dance"); - fireEvent.click(danceTab); - - expect(danceTab.getAttribute("aria-current")).toBe("true"); - // Active tab uses the accent background. - expect((danceTab as HTMLElement).style.background).toBe("var(--accent)"); - - // Only dance items render; greeting/combat items are filtered out. - expect(screen.getByTestId("emote-picker-item-dance-happy")).toBeTruthy(); - expect(screen.queryByTestId("emote-picker-item-wave")).toBeNull(); - expect(screen.queryByTestId("emote-picker-item-firing-gun")).toBeNull(); - - // Clicking "all" resets the filter (wave reappears). - const allTab = screen.getByTestId("emote-picker-category-all"); - fireEvent.click(allTab); - expect(allTab.getAttribute("aria-current")).toBe("true"); - expect(screen.getByTestId("emote-picker-item-wave")).toBeTruthy(); - }); - - it("dispatches STOP_EMOTE_EVENT when the Stop button is clicked", () => { - render(); - fireEvent.click(screen.getByTestId("emote-picker-stop")); - expect(uiMocks.dispatchAppEvent).toHaveBeenCalledWith( - "eliza:test-stop-emote", - ); - }); - - it("calls closeEmotePicker when the Close button is clicked", () => { - render(); - fireEvent.click(screen.getByTestId("emote-picker-close")); - expect(appState.closeEmotePicker).toHaveBeenCalledTimes(1); - }); - - it("plays an emote (client.playEmote) and disables the button while playing, re-enabling after the timeout", async () => { - vi.useFakeTimers(); - render(); - - const waveButton = screen.getByTestId( - "emote-picker-item-wave", - ) as HTMLButtonElement; - expect(waveButton.disabled).toBe(false); - - await act(async () => { - fireEvent.click(waveButton); - }); - - expect(uiMocks.playEmote).toHaveBeenCalledWith("wave"); - // The button is disabled immediately (playing state) before the 1s timeout. - expect( - (screen.getByTestId("emote-picker-item-wave") as HTMLButtonElement) - .disabled, - ).toBe(true); - - // Advance past the 1000ms reset window — button re-enables. - await act(async () => { - vi.advanceTimersByTime(1100); - }); - expect( - (screen.getByTestId("emote-picker-item-wave") as HTMLButtonElement) - .disabled, - ).toBe(false); - }); - - it("toggles the picker closed on Escape", () => { - render(); - fireEvent.keyDown(window, { key: "Escape" }); - expect(appState.closeEmotePicker).toHaveBeenCalled(); - }); -}); diff --git a/plugins/plugin-companion/src/components/companion/EmotePicker.tsx b/plugins/plugin-companion/src/components/companion/EmotePicker.tsx deleted file mode 100644 index 975d2ea356900..0000000000000 --- a/plugins/plugin-companion/src/components/companion/EmotePicker.tsx +++ /dev/null @@ -1,491 +0,0 @@ -import { useAgentElement } from "@elizaos/ui/agent-surface"; -import { client } from "@elizaos/ui/api"; -import { Button, Input } from "@elizaos/ui/components"; -import { - dispatchAppEvent, - EMOTE_PICKER_EVENT, - STOP_EMOTE_EVENT, -} from "@elizaos/ui/events"; -import { useTimeout } from "@elizaos/ui/hooks"; -import { useAppSelectorShallow } from "@elizaos/ui/state"; -import { Z_SYSTEM_CRITICAL } from "@elizaos/ui/utils"; -import { type LucideIcon, Menu, Sparkles, X } from "lucide-react"; -import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { EMOTE_CATALOG } from "../../emotes/catalog"; -import { - buildCategoryList, - buildEmoteGrid, - CATEGORY_ICONS, - categoryLabel, - type EmoteItem, -} from "./emote-picker-grid"; - -// All emotes — derived from the runtime EMOTE_CATALOG (the exact set the agent -// server's POST /api/emote accepts, validated against EMOTE_BY_ID in -// packages/agent/src/api/misc-routes.ts). Building from the catalog (rather than -// a hand-maintained list) guarantees every clickable item is a server-valid id -// and that no catalog emote is silently omitted. emote-picker-grid.test.ts -// asserts this alignment so the two cannot drift apart again. -const ALL_EMOTES: EmoteItem[] = buildEmoteGrid(EMOTE_CATALOG); -const CATEGORIES = buildCategoryList(ALL_EMOTES); -const CATEGORY_LABELS: Record = Object.fromEntries( - CATEGORIES.map((cat) => [cat, categoryLabel(cat)]), -); - -export function EmotePicker() { - const { setTimeout } = useTimeout(); - - const { emotePickerOpen, openEmotePicker, closeEmotePicker, t } = - useAppSelectorShallow((s) => ({ - emotePickerOpen: s.emotePickerOpen, - openEmotePicker: s.openEmotePicker, - closeEmotePicker: s.closeEmotePicker, - t: s.t, - })); - const [search, setSearch] = useState(""); - const [playing, setPlaying] = useState(null); - const [activeCategory, setActiveCategory] = useState(null); - - const inputRef = useRef(null); - const { ref: searchAgentRef, agentProps: searchAgentProps } = - useAgentElement({ - id: "emotes-search", - role: "text-input", - label: t("emotepicker.SearchEmotes"), - group: "emotes-picker", - description: "Filter the emote grid by name", - getValue: () => search, - onFill: (value: string) => setSearch(value), - }); - const setSearchRef = useCallback( - (node: HTMLInputElement | null) => { - inputRef.current = node; - searchAgentRef.current = node; - }, - [searchAgentRef], - ); - const panelRef = useRef(null); - const posRef = useRef({ x: 0, y: 0 }); - const dragOrigin = useRef<{ - startX: number; - startY: number; - rect: DOMRect; - } | null>(null); - - // Apply position to panel - const applyPosition = useCallback((x: number, y: number) => { - const el = panelRef.current; - if (!el) return; - - el.style.left = `${x}px`; - el.style.top = `${y}px`; - el.style.bottom = "auto"; - el.style.right = "auto"; - - posRef.current = { x, y }; - }, []); - - // Drag handlers - const onPointerDown = useCallback( - (e: React.PointerEvent) => { - const el = panelRef.current; - if (!el) return; - - const rect = el.getBoundingClientRect(); - dragOrigin.current = { - startX: e.clientX, - startY: e.clientY, - rect, - }; - - const onPointerMove = (moveEvent: PointerEvent) => { - if (!dragOrigin.current) return; - - const dx = moveEvent.clientX - dragOrigin.current.startX; - const dy = moveEvent.clientY - dragOrigin.current.startY; - - let newX = dragOrigin.current.rect.left + dx; - let newY = dragOrigin.current.rect.top + dy; - - // Clamp to viewport - const maxX = window.innerWidth - dragOrigin.current.rect.width; - const maxY = window.innerHeight - dragOrigin.current.rect.height; - - newX = Math.max(0, Math.min(newX, maxX)); - newY = Math.max(0, Math.min(newY, maxY)); - - applyPosition(newX, newY); - }; - - const onPointerUp = () => { - dragOrigin.current = null; - window.removeEventListener("pointermove", onPointerMove); - window.removeEventListener("pointerup", onPointerUp); - }; - - window.addEventListener("pointermove", onPointerMove); - window.addEventListener("pointerup", onPointerUp); - }, - [applyPosition], - ); - - // Reset position on open - useEffect(() => { - if (emotePickerOpen && panelRef.current) { - panelRef.current.style.left = ""; - panelRef.current.style.top = ""; - panelRef.current.style.bottom = ""; - panelRef.current.style.right = ""; - posRef.current = { x: 0, y: 0 }; - } - }, [emotePickerOpen]); - - // Filter emotes - const filteredEmotes = useMemo(() => { - let emotes = ALL_EMOTES; - - if (activeCategory) { - emotes = emotes.filter((e) => e.category === activeCategory); - } - - if (search.trim()) { - const query = search.toLowerCase(); - emotes = emotes.filter( - (e) => - e.name.toLowerCase().includes(query) || - e.id.toLowerCase().includes(query), - ); - } - - return emotes; - }, [search, activeCategory]); - - // Play emote - const playEmote = useCallback( - async (emoteId: string) => { - setPlaying(emoteId); - try { - await client.playEmote(emoteId); - } catch (err) { - console.error("Failed to play emote:", err); - } finally { - setTimeout(() => setPlaying(null), 1000); - } - }, - [setTimeout], - ); - - // Stop emote - const stopEmote = useCallback(() => { - dispatchAppEvent(STOP_EMOTE_EVENT); - setPlaying(null); - }, []); - - // Keyboard shortcuts - useEffect(() => { - const handleKeyDown = (e: KeyboardEvent) => { - // Cmd+E toggle - if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "e") { - e.preventDefault(); - if (emotePickerOpen) { - closeEmotePicker(); - } else { - openEmotePicker(); - } - } - - // Escape to close - if (e.key === "Escape" && emotePickerOpen) { - closeEmotePicker(); - } - }; - - window.addEventListener("keydown", handleKeyDown, { capture: true }); - return () => - window.removeEventListener("keydown", handleKeyDown, { capture: true }); - }, [emotePickerOpen, openEmotePicker, closeEmotePicker]); - - // Desktop bridge listener - useEffect(() => { - const handleDesktopToggle = () => { - if (emotePickerOpen) { - closeEmotePicker(); - } else { - openEmotePicker(); - } - }; - - document.addEventListener(EMOTE_PICKER_EVENT, handleDesktopToggle); - return () => - document.removeEventListener(EMOTE_PICKER_EVENT, handleDesktopToggle); - }, [emotePickerOpen, openEmotePicker, closeEmotePicker]); - - if (!emotePickerOpen) return null; - - return ( -
- {/* Header */} -
-
- - - {t("emotepicker.Emotes")} - -
- -
- {/* Stop button */} - - - {/* Shortcut label */} - - ⌘E - - - {/* Close button */} - -
-
- - {/* Search */} -
- ) => - setSearch(e.target.value) - } - placeholder={t("emotepicker.SearchEmotes")} - className="w-full rounded px-2 py-1 text-sm focus:outline-none focus:ring-1" - data-testid="emote-picker-search" - style={{ - background: "var(--surface)", - color: "var(--text-strong)", - border: "1px solid var(--border)", - }} - {...searchAgentProps} - /> -
- - {/* Category tabs */} -
- setActiveCategory(null)} - /> - {CATEGORIES.map((cat) => ( - setActiveCategory(cat)} - /> - ))} -
- - {/* Emote grid */} -
-
- {filteredEmotes.map((emote: EmoteItem) => ( - - ))} -
- - {filteredEmotes.length === 0 && ( -
- {t("emotepicker.NoEmotesFound")} -
- )} -
-
- ); -} - -function EmotePickerStopButton({ - onStop, - label, -}: { - onStop: () => void; - label: string; -}) { - const { ref, agentProps } = useAgentElement({ - id: "emotes-stop", - role: "button", - label, - group: "emotes-picker", - description: "Stop the currently playing emote", - }); - return ( - - ); -} - -function EmotePickerCloseButton({ - onClose, - label, -}: { - onClose: () => void; - label: string; -}) { - const { ref, agentProps } = useAgentElement({ - id: "emotes-close", - role: "button", - label, - group: "emotes-picker", - description: "Close the emote picker", - }); - return ( - - ); -} - -function EmotePickerCategoryButton({ - categoryId, - label, - icon: CategoryIcon, - active, - onSelect, -}: { - categoryId: string; - label: string; - icon?: LucideIcon; - active: boolean; - onSelect: () => void; -}) { - const { ref, agentProps } = useAgentElement({ - id: `emotes-category-${categoryId}`, - role: "tab", - label, - group: "emotes-categories", - status: active ? "active" : "inactive", - description: `Filter emotes to the ${label} category`, - }); - return ( - - ); -} - -const EmotePickerEmoteButton = memo(function EmotePickerEmoteButton({ - emote, - playing, - onPlay, -}: { - emote: EmoteItem; - playing: boolean; - onPlay: (emoteId: string) => void | Promise; -}) { - const { ref, agentProps } = useAgentElement({ - id: `emotes-play-${emote.id}`, - role: "list-item", - label: emote.name, - group: "emotes-grid", - status: playing ? "active" : undefined, - description: `Play the ${emote.name} emote`, - }); - const EmoteIcon = emote.icon; - return ( - - ); -}); diff --git a/plugins/plugin-companion/src/components/companion/EmoteVisuals.test.tsx b/plugins/plugin-companion/src/components/companion/EmoteVisuals.test.tsx deleted file mode 100644 index c122626b11d67..0000000000000 --- a/plugins/plugin-companion/src/components/companion/EmoteVisuals.test.tsx +++ /dev/null @@ -1,148 +0,0 @@ -// @vitest-environment jsdom - -import { - act, - cleanup, - fireEvent, - render, - screen, - waitFor, -} from "@testing-library/react"; -import React from "react"; -import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; - -const appState = vi.hoisted(() => ({ - closeEmotePicker: vi.fn(), - emotePickerOpen: true, - openEmotePicker: vi.fn(), - t: (_key: string, options?: { defaultValue?: string }) => - options?.defaultValue ?? _key, -})); - -const uiMocks = vi.hoisted(() => ({ - dispatchAppEvent: vi.fn(), - playEmote: vi.fn(), -})); - -vi.mock("@elizaos/ui", () => ({ - APP_EMOTE_EVENT: "eliza:test-app-emote", - Button: ({ - children, - ...props - }: React.ButtonHTMLAttributes) => ( - - ), - client: { - playEmote: uiMocks.playEmote, - }, - dispatchAppEvent: uiMocks.dispatchAppEvent, - EMOTE_PICKER_EVENT: "eliza:test-emote-picker", - Input: React.forwardRef< - HTMLInputElement, - React.InputHTMLAttributes - >((props, ref) => ), - STOP_EMOTE_EVENT: "eliza:test-stop-emote", - useApp: () => appState, - useAppSelector: (selector: (s: typeof appState) => T): T => - selector(appState), - useAppSelectorShallow: (selector: (s: typeof appState) => T): T => - selector(appState), - useTimeout: () => ({ setTimeout: window.setTimeout.bind(window) }), - Z_GLOBAL_EMOTE: 10, - Z_SYSTEM_CRITICAL: 20, -})); - -import { EmotePicker } from "./EmotePicker"; -import { GlobalEmoteOverlay } from "./GlobalEmoteOverlay"; - -const rawEmoteGlyphs = /[\u{1F300}-\u{1FAFF}\u2694\u2728]/u; - -describe("Companion emote visuals", () => { - beforeEach(() => { - vi.clearAllMocks(); - appState.emotePickerOpen = true; - uiMocks.playEmote.mockResolvedValue(undefined); - }); - - afterEach(() => { - cleanup(); - }); - - it("renders the emote picker with icon components instead of raw emote glyphs", async () => { - const { container } = render(); - - expect(screen.getByTestId("emote-picker")).toBeTruthy(); - expect(screen.getByTestId("emote-picker-category-greeting")).toBeTruthy(); - expect(screen.getByTestId("emote-picker-item-wave")).toBeTruthy(); - expect(container.querySelectorAll("svg").length).toBeGreaterThan(8); - expect(container.textContent ?? "").not.toMatch(rawEmoteGlyphs); - - fireEvent.click(screen.getByTestId("emote-picker-item-wave")); - - await waitFor(() => { - expect(uiMocks.playEmote).toHaveBeenCalledWith("wave"); - }); - }); - - it("renders global emote bursts as icon overlays instead of emoji text", async () => { - const { container } = render(); - - fireEvent( - window, - new CustomEvent("eliza:test-app-emote", { - detail: { emoteId: "dance-happy" }, - }), - ); - - const overlay = await screen.findByTestId("global-emote-overlay"); - expect(overlay.getAttribute("data-emote-id")).toBe("dance-happy"); - expect(overlay.textContent ?? "").not.toMatch(rawEmoteGlyphs); - expect(container.querySelector("svg")).toBeTruthy(); - }); - - it("ignores emote events with showOverlay:false", () => { - render(); - - fireEvent( - window, - new CustomEvent("eliza:test-app-emote", { - detail: { emoteId: "dance-happy", showOverlay: false }, - }), - ); - - expect(screen.queryByTestId("global-emote-overlay")).toBeNull(); - }); - - it("auto-hides the overlay after OVERLAY_LIFETIME_MS (2400ms)", async () => { - vi.useFakeTimers(); - try { - render(); - - act(() => { - window.dispatchEvent( - new CustomEvent("eliza:test-app-emote", { - detail: { emoteId: "wave" }, - }), - ); - }); - - expect(screen.getByTestId("global-emote-overlay")).toBeTruthy(); - - // Just before the lifetime expires the overlay is still visible. - act(() => { - vi.advanceTimersByTime(2399); - }); - expect(screen.queryByTestId("global-emote-overlay")).toBeTruthy(); - - // After the full 2400ms lifetime it disappears. - act(() => { - vi.advanceTimersByTime(2); - }); - expect(screen.queryByTestId("global-emote-overlay")).toBeNull(); - } finally { - vi.useRealTimers(); - } - }); -}); diff --git a/plugins/plugin-companion/src/components/companion/GlobalEmoteOverlay.tsx b/plugins/plugin-companion/src/components/companion/GlobalEmoteOverlay.tsx deleted file mode 100644 index 7495383f5aaa9..0000000000000 --- a/plugins/plugin-companion/src/components/companion/GlobalEmoteOverlay.tsx +++ /dev/null @@ -1,187 +0,0 @@ -import { APP_EMOTE_EVENT, type AppEmoteEventDetail } from "@elizaos/ui/events"; -import { Z_GLOBAL_EMOTE } from "@elizaos/ui/utils"; -import { - Accessibility, - Activity, - ArrowUp, - Axe, - Bird, - Bone, - ChevronsUp, - Cloud, - Dumbbell, - Eye, - Fish, - Footprints, - Frown, - Hand, - Heart, - Leaf, - type LucideIcon, - MessageCircle, - Music2, - Rabbit, - Shield, - Skull, - Sparkles, - Swords, - Target, - WandSparkles, - Waves, -} from "lucide-react"; -import { useEffect, useRef, useState } from "react"; - -const OVERLAY_LIFETIME_MS = 2400; - -const EMOTE_ICONS: Record = { - wave: Hand, - kiss: Heart, - crying: Waves, - sorrow: Frown, - "rude-gesture": Hand, - "looking-around": Eye, - "dance-happy": Music2, - "dance-breaking": Accessibility, - "dance-hiphop": Activity, - "dance-popping": Sparkles, - "hook-punch": Dumbbell, - punching: Shield, - "firing-gun": Target, - "sword-swing": Swords, - chopping: Axe, - "spell-cast": WandSparkles, - range: Target, - death: Skull, - talk: MessageCircle, - squat: Accessibility, - fishing: Fish, - float: Bird, - jump: ArrowUp, - flip: ChevronsUp, - crawling: Bone, - fall: Cloud, - run: Rabbit, - walk: Footprints, - idle: Leaf, -}; - -function getOverlayIcon(emoteId: string): LucideIcon { - return EMOTE_ICONS[emoteId] ?? Sparkles; -} - -export function GlobalEmoteOverlay() { - const [activeEmote, setActiveEmote] = useState<{ - key: number; - emoteId: string; - Icon: LucideIcon; - } | null>(null); - const hideTimerRef = useRef(null); - const nextKeyRef = useRef(1); - - useEffect(() => { - const handler = (event: Event) => { - const detail = (event as CustomEvent).detail; - if (!detail.emoteId) return; - if (detail.showOverlay === false) return; - if (hideTimerRef.current != null) { - window.clearTimeout(hideTimerRef.current); - } - const nextOverlay = { - key: nextKeyRef.current, - emoteId: detail.emoteId, - Icon: getOverlayIcon(detail.emoteId), - }; - nextKeyRef.current += 1; - setActiveEmote(nextOverlay); - hideTimerRef.current = window.setTimeout(() => { - setActiveEmote((current) => - current?.key === nextOverlay.key ? null : current, - ); - hideTimerRef.current = null; - }, OVERLAY_LIFETIME_MS); - }; - - window.addEventListener(APP_EMOTE_EVENT, handler); - return () => { - window.removeEventListener(APP_EMOTE_EVENT, handler); - if (hideTimerRef.current != null) { - window.clearTimeout(hideTimerRef.current); - hideTimerRef.current = null; - } - }; - }, []); - - return ( - <> - - {activeEmote && ( -