diff --git a/.github/workflows/mirror-2-dev-db.yml b/.github/workflows/mirror-2-dev-db.yml new file mode 100644 index 00000000..1cc081a4 --- /dev/null +++ b/.github/workflows/mirror-2-dev-db.yml @@ -0,0 +1,31 @@ +name: Deploy Migrations to Dev + +on: + push: + branches: [dev] + paths: + - 'mirror-2/**' + pull_request: + branches: [dev] + paths: + - 'mirror-2/**' + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.DEV_DB_PASSWORD }} + SUPABASE_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }} + + steps: + - uses: actions/checkout@v3 + + - uses: supabase/setup-cli@v1 + with: + version: latest + + - run: supabase link --project-ref $SUPABASE_PROJECT_ID + - run: supabase db push diff --git a/LICENSE.txt b/LICENSE.txt index 3c2b95a1..d6cb58e8 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,3 +1,5 @@ +The below licenses apply to everything in this repository with the exception of the /mirror-2 folder; for the mirror-2 folder, see /mirror-2/LICENSE.txt. + MIT License Copyright (c) 2022-present The Mirror Megaverse Inc. diff --git a/mirror-2/.env.example b/mirror-2/.env.example new file mode 100644 index 00000000..07783698 --- /dev/null +++ b/mirror-2/.env.example @@ -0,0 +1,8 @@ +# Update these with your Supabase details from your project settings > API +# https://app.supabase.com/project/_/settings/api +NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 +NEXT_PUBLIC_SUPABASE_ANON_KEY=SUPABASE_CLIENT_API_KEY +NEXT_PUBLIC_APP_NAME="The Mirror" # only use The Mirror or Reflekt +NEXT_PUBLIC_DISCORD_INVITE_URL=https://themirror.space/discord +NEXT_PUBLIC_VERSION_NAME="JavaScript" +NEXT_PUBLIC_AMPLITUDE_PUBLIC_KEY= diff --git a/mirror-2/.gitignore b/mirror-2/.gitignore new file mode 100644 index 00000000..00bba9bb --- /dev/null +++ b/mirror-2/.gitignore @@ -0,0 +1,37 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local +.env + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/mirror-2/.prettierignore b/mirror-2/.prettierignore new file mode 100644 index 00000000..a10c0d6c --- /dev/null +++ b/mirror-2/.prettierignore @@ -0,0 +1,6 @@ +# Ignore artifacts: +build +coverage +dist +# ignore JS for now because of vanilla JS file imports might mess up some text replacement. Can revisit in the future but not high priority +*.js diff --git a/mirror-2/.prettierrc b/mirror-2/.prettierrc new file mode 100644 index 00000000..ffca9292 --- /dev/null +++ b/mirror-2/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "none", + "semi": false, + "endOfLine": "auto" +} diff --git a/mirror-2/.vscode/launch.json b/mirror-2/.vscode/launch.json new file mode 100644 index 00000000..d184594a --- /dev/null +++ b/mirror-2/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Next.js: debug full stack", + "type": "node-terminal", + "request": "launch", + "command": "yarn dev", + "serverReadyAction": { + "pattern": "- Local:.+(https?://.+)", + "uriFormat": "%s", + "action": "debugWithChrome" + } + } + ] +} diff --git a/mirror-2/.vscode/settings.json b/mirror-2/.vscode/settings.json new file mode 100644 index 00000000..68adb827 --- /dev/null +++ b/mirror-2/.vscode/settings.json @@ -0,0 +1,23 @@ +{ + "deno.enablePaths": ["supabase/functions"], + "deno.lint": true, + "deno.unstable": [ + "bare-node-builtins", + "byonm", + "sloppy-imports", + "unsafe-proto", + "webgpu", + "broadcast-channel", + "worker-options", + "cron", + "kv", + "ffi", + "fs", + "http", + "net" + ], + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/mirror-2/LICENSE.txt b/mirror-2/LICENSE.txt new file mode 100644 index 00000000..f3078b4f --- /dev/null +++ b/mirror-2/LICENSE.txt @@ -0,0 +1,46 @@ +RevShare: A Source Available License + +Copyright (c) 2024-Present The Mirror Megaverse Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the following conditions: + +1. Revenue Sharing Requirement +If any revenue is generated through the use of the Software, including but not limited to sales, in-game transactions, or any other form of monetization, the user agrees to pay a fee to the owner of the Software (“Company”). The fee structure and payment requirements are detailed on the Company’s website, and users are responsible for staying updated on any changes to these terms. The fee is 15% as of Sept 2024 and subject to change (the website is the source of truth for this fee if the amount in this license differs). + +2. Payment in Fiat Currency +If revenue is generated in fiat currency (e.g., USD, EUR), the user agrees to remit payments to the Company based on the fee structure listed on the Company’s website. Failure to comply with these payment terms will result in the revocation of the license. + +3. Payment in Cryptocurrency and Royalties for Non-Fungible Tokens +Cryptocurrency integrations are exclusive to the Reflekt version of the Software, a separate fork of The Mirror. In contrast, The Mirror version of the Software does not support cryptocurrency usage. This structure is designed to give developers the flexibility to choose between traditional web2 approaches and blockchain-integrated games. + +Direct Cryptocurrency Transactions: If revenue is generated directly through the Software in the form of cryptocurrency (e.g., in-game transactions, purchases, or other forms of monetization), the user agrees to pay a 10% fee on all such transactions. Payments must be made to the Company’s wallet address as specified on its website. Users are responsible for ensuring accurate and timely payments to the listed address. + +Non-Fungible Token Royalties: If the Software is used to issue or mint Non-Fungible Tokens (NFTs), the user agrees to pay a 10% royalty on all subsequent sales or transfers of the NFT, regardless of the marketplace or platform where the transaction occurs. If the NFT was minted outside of the platform and a transaction takes place using the Software, the user agrees to pay the same percent fee via direct cryptocurrency transfer to the company's wallet. + +4. Warranty Disclaimer +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +By using the Software, you agree to the terms outlined above. These terms are subject to change due to early versions of the Software and the team is open to feedback! + +--- +The below copyright notice and MIT license is included for compliance with the MIT license of the PlayCanvas Engine: https://github.com/playcanvas/engine + +Copyright (c) 2011-2024 PlayCanvas Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/mirror-2/README.md b/mirror-2/README.md new file mode 100644 index 00000000..5a07d3cb --- /dev/null +++ b/mirror-2/README.md @@ -0,0 +1 @@ +Alea iacta est. diff --git a/mirror-2/actions/auth.ts b/mirror-2/actions/auth.ts new file mode 100644 index 00000000..5a9928a1 --- /dev/null +++ b/mirror-2/actions/auth.ts @@ -0,0 +1,124 @@ +'use server' + +import { createServerClient } from '@/utils/supabase/server' +import { encodedRedirect } from '@/utils/utils' +import { headers } from 'next/headers' +import { redirect } from 'next/navigation' + +export const createAccountAction = async (formData: FormData) => { + const email = formData.get('email')?.toString() + const password = formData.get('password')?.toString() + const supabase = createServerClient() + const origin = headers().get('origin') + + if (!email || !password) { + return { error: 'Email and password are required' } + } + + const { error } = await supabase.auth.signUp({ + email, + password, + options: { + emailRedirectTo: `${origin}/auth/callback` + } + }) + + if (error) { + console.error(error.code + ' ' + error.message) + return encodedRedirect('error', '/create-account', error.message) + } else { + return encodedRedirect( + 'success', + '/create-account', + 'Thanks for signing up! Please check your email for a verification link.' + ) + } +} + +export const loginAction = async (formData: FormData) => { + const email = formData.get('email') as string + const password = formData.get('password') as string + const supabase = createServerClient() + + const { error } = await supabase.auth.signInWithPassword({ + email, + password + }) + + if (error) { + return encodedRedirect('error', '/login', error.message) + } + + return redirect('/home') +} + +export const forgotPasswordAction = async (formData: FormData) => { + const email = formData.get('email')?.toString() + const supabase = createServerClient() + const origin = headers().get('origin') + const callbackUrl = formData.get('callbackUrl')?.toString() + + if (!email) { + return encodedRedirect('error', '/forgot-password', 'Email is required') + } + + const { error } = await supabase.auth.resetPasswordForEmail(email, { + redirectTo: `${origin}/auth/callback?redirect_to=/protected/reset-password` + }) + + if (error) { + console.error(error.message) + return encodedRedirect( + 'error', + '/forgot-password', + 'Could not reset password' + ) + } + + if (callbackUrl) { + return redirect(callbackUrl) + } + + return encodedRedirect( + 'success', + '/forgot-password', + 'Check your email for a link to reset your password.' + ) +} + +export const resetPasswordAction = async (formData: FormData) => { + const supabase = createServerClient() + + const password = formData.get('password') as string + const confirmPassword = formData.get('confirmPassword') as string + + if (!password || !confirmPassword) { + encodedRedirect( + 'error', + '/protected/reset-password', + 'Password and confirm password are required' + ) + } + + if (password !== confirmPassword) { + encodedRedirect( + 'error', + '/protected/reset-password', + 'Passwords do not match' + ) + } + + const { error } = await supabase.auth.updateUser({ + password: password + }) + + if (error) { + encodedRedirect( + 'error', + '/protected/reset-password', + 'Password update failed' + ) + } + + encodedRedirect('success', '/protected/reset-password', 'Password updated') +} diff --git a/mirror-2/actions/name-generator.ts b/mirror-2/actions/name-generator.ts new file mode 100644 index 00000000..fe7dcb61 --- /dev/null +++ b/mirror-2/actions/name-generator.ts @@ -0,0 +1,34 @@ +'use server' +import { + uniqueNamesGenerator, + Config, + adjectives, + colors, + animals +} from 'unique-names-generator' + +const randomName: string = uniqueNamesGenerator({ + dictionaries: [adjectives, animals] +}) + +export async function generateSpaceName() { + const customConfig: Config = { + dictionaries: [adjectives, animals], + separator: ' ', + length: 2, + style: 'capital' + } + + return uniqueNamesGenerator(customConfig) +} + +export async function generateSceneName() { + const customConfig: Config = { + dictionaries: [adjectives], + separator: ' ', + length: 1, + style: 'capital' + } + + return uniqueNamesGenerator(customConfig) +} diff --git a/mirror-2/ampli.json b/mirror-2/ampli.json new file mode 100644 index 00000000..f1cce44f --- /dev/null +++ b/mirror-2/ampli.json @@ -0,0 +1,14 @@ +{ + "Zone": "us", + "OrgId": "308710", + "WorkspaceId": "a2da908b-27c1-4013-b214-f7ce5531bbe7", + "SourceId": "b077387d-b743-4f18-bd57-94effffd3ad1", + "Runtime": "browser:typescript-ampli-v2", + "Platform": "Browser", + "Language": "TypeScript", + "SDK": "@amplitude/analytics-browser@^1.0", + "Branch": "main", + "Version": "1.0.0", + "VersionId": "84e8930d-d0e7-4c92-b6c6-629ff838c9a6", + "Path": "./src/ampli" +} \ No newline at end of file diff --git a/mirror-2/app/(auth-pages)/create-account/page.tsx b/mirror-2/app/(auth-pages)/create-account/page.tsx new file mode 100644 index 00000000..ad893381 --- /dev/null +++ b/mirror-2/app/(auth-pages)/create-account/page.tsx @@ -0,0 +1,73 @@ +'use client' +import { createAccountAction, loginAction } from '@/actions/auth' +import { FormMessage, Message } from '@/components/form-message' +import { SubmitButton } from '@/components/submit-button' +import { + Card, + CardHeader, + CardTitle, + CardContent, + CardFooter +} from '@/components/ui/card' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' +import { useRedirectToHomeIfSignedIn } from '@/hooks/auth' +import { AppLogoImageMedium } from '@/lib/theme-service' +import Link from 'next/link' + +export default function CreateAccount({ + searchParams +}: { + searchParams: Message +}) { + useRedirectToHomeIfSignedIn() + return ( +
+ + + +
+ +
+ Create Account +
+
+ +
+ + +
+
+ + +
+
+ + + Create Account + + +

+ Already have an account?{' '} + + Login + +

+
+
+
+ ) +} diff --git a/mirror-2/app/(auth-pages)/forgot-password/page.tsx b/mirror-2/app/(auth-pages)/forgot-password/page.tsx new file mode 100644 index 00000000..09938fff --- /dev/null +++ b/mirror-2/app/(auth-pages)/forgot-password/page.tsx @@ -0,0 +1,38 @@ +import { forgotPasswordAction } from '@/actions/auth' +import { FormMessage, Message } from '@/components/form-message' +import { SubmitButton } from '@/components/submit-button' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' +import Link from 'next/link' +import { SmtpMessage } from '../smtp-message' + +export default function ForgotPassword({ + searchParams +}: { + searchParams: Message +}) { + return ( + <> +
+
+

Reset Password

+

+ Already have an account?{' '} + + Login + +

+
+
+ + + + Reset Password + + +
+
+ + + ) +} diff --git a/mirror-2/app/(auth-pages)/layout.tsx b/mirror-2/app/(auth-pages)/layout.tsx new file mode 100644 index 00000000..74e01480 --- /dev/null +++ b/mirror-2/app/(auth-pages)/layout.tsx @@ -0,0 +1,11 @@ +export default async function Layout({ + children +}: { + children: React.ReactNode +}) { + return ( +
+ {children} +
+ ) +} diff --git a/mirror-2/app/(auth-pages)/login/page.tsx b/mirror-2/app/(auth-pages)/login/page.tsx new file mode 100644 index 00000000..c7014e02 --- /dev/null +++ b/mirror-2/app/(auth-pages)/login/page.tsx @@ -0,0 +1,123 @@ +'use client' +import { loginAction } from '@/actions/auth' +import { FormMessage, Message } from '@/components/form-message' +import { SubmitButton } from '@/components/submit-button' +import { + Card, + CardHeader, + CardTitle, + CardContent, + CardFooter +} from '@/components/ui/card' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' +import { useRedirectToHomeIfSignedIn } from '@/hooks/auth' +import { AppLogoImageMedium } from '@/lib/theme-service' +import Link from 'next/link' +import { useRef } from 'react' + +const isDevelopment = process.env.NODE_ENV === 'development' + +export default function Login({ searchParams }: { searchParams: Message }) { + useRedirectToHomeIfSignedIn() + + // References for email and password fields + const emailRef = useRef(null) + const passwordRef = useRef(null) + + // Function to simulate login with specific user + const handleDevLoginWithUser = (userEmail: string) => { + if (emailRef.current && passwordRef.current) { + emailRef.current.value = userEmail + passwordRef.current.value = 'password' // Default password for all dev users + } + + // Simulate form submission by calling formAction + // Since the SubmitButton uses formAction, this will trigger loginAction + ;(document.getElementById('login-form') as HTMLFormElement)?.requestSubmit() + } + + return ( +
+ + + +
+ +
+ Login +
+
+ +
+ + +
+
+ + +
+
+ + + Login + + +

+ Don't have an account?{' '} + + Create Account + +

+ + {/* Development-only login buttons */} + {isDevelopment && ( +
+ + + +
+ )} +
+
+
+ ) +} diff --git a/mirror-2/app/(auth-pages)/smtp-message.tsx b/mirror-2/app/(auth-pages)/smtp-message.tsx new file mode 100644 index 00000000..f5f46633 --- /dev/null +++ b/mirror-2/app/(auth-pages)/smtp-message.tsx @@ -0,0 +1,25 @@ +import { ArrowUpRight, InfoIcon } from 'lucide-react' +import Link from 'next/link' + +export function SmtpMessage() { + return ( +
+ +
+ + Note: Emails are rate limited. Enable Custom SMTP to + increase the rate limit. + +
+ + Learn more + +
+
+
+ ) +} diff --git a/mirror-2/app/auth/callback/route.ts b/mirror-2/app/auth/callback/route.ts new file mode 100644 index 00000000..db2dcd7d --- /dev/null +++ b/mirror-2/app/auth/callback/route.ts @@ -0,0 +1,24 @@ +import { createServerClient } from '@/utils/supabase/server' +import { NextResponse } from 'next/server' + +export async function GET(request: Request) { + // The `/auth/callback` route is required for the server-side auth flow implemented + // by the SSR package. It exchanges an auth code for the user's session. + // https://supabase.com/docs/guides/auth/server-side/nextjs + const requestUrl = new URL(request.url) + const code = requestUrl.searchParams.get('code') + const origin = requestUrl.origin + const redirectTo = requestUrl.searchParams.get('redirect_to')?.toString() + + if (code) { + const supabase = createServerClient() + await supabase.auth.exchangeCodeForSession(code) + } + + if (redirectTo) { + return NextResponse.redirect(`${origin}${redirectTo}`) + } + + // URL to redirect to after sign up process completes + return NextResponse.redirect(`${origin}/protected`) +} diff --git a/mirror-2/app/globals.css b/mirror-2/app/globals.css new file mode 100644 index 00000000..94158222 --- /dev/null +++ b/mirror-2/app/globals.css @@ -0,0 +1,94 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; + --primary: 221.2 83.2% 53.3%; + --primary-foreground: 210 40% 98%; + --secondary: 210 40% 96.1%; + --secondary-foreground: 222.2 47.4% 11.2%; + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + --accent: 165 100% 67%; + --accent-foreground: 222.2 47.4% 11.2%; + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + --ring: 221.2 83.2% 53.3%; + --radius: 0.75rem; + --chart-1: 12 76% 61%; + --chart-2: 173 58% 39%; + --chart-3: 197 37% 24%; + --chart-4: 43 74% 66%; + --chart-5: 27 87% 67%; + } + + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + --card: 222.2 84% 4.9%; + --card-foreground: 210 40% 98%; + --popover: 222.2 84% 4.9%; + --popover-foreground: 210 40% 98%; + --primary: 217.2 91.2% 59.8%; + --primary-foreground: 222.2 47.4% 100%; + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + --accent: 165 100% 67%; + --accent-foreground: 210 40% 98%; + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + --ring: 224.3 76.3% 48%; + --chart-1: 220 70% 50%; + --chart-2: 160 60% 45%; + --chart-3: 30 80% 55%; + --chart-4: 280 65% 60%; + --chart-5: 340 75% 55%; + } +} + +#application-canvas { + display: block; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; +} +#application-canvas.fill-mode-NONE { + margin: auto; +} +#application-canvas.fill-mode-KEEP_ASPECT { + width: 100%; + height: auto; + margin: 0; +} +#application-canvas.fill-mode-FILL_WINDOW { + width: 100%; + height: 100%; + margin: 0; +} + +canvas:focus { + outline: none; +} + +/* leaving here bc will probably need to tweak */ +.ant-tree-switcher_close { + /* margin-top: 0.5rem !important; */ +} +.ant-tree-switcher_open { + /* margin-top: 0.5rem !important; */ +} diff --git a/mirror-2/app/home/components/album-artwork.tsx b/mirror-2/app/home/components/album-artwork.tsx new file mode 100644 index 00000000..efccc20b --- /dev/null +++ b/mirror-2/app/home/components/album-artwork.tsx @@ -0,0 +1,95 @@ +import Image from 'next/image' + +import { cn } from '@/lib/utils' + +import { Album } from '../data/albums' +import { playlists } from '../data/playlists' +import { + ContextMenu, + ContextMenuTrigger, + ContextMenuContent, + ContextMenuItem, + ContextMenuSub, + ContextMenuSubTrigger, + ContextMenuSubContent, + ContextMenuSeparator +} from '@/components/ui/context-menu' +import { PlusCircleIcon } from 'lucide-react' + +interface AlbumArtworkProps extends React.HTMLAttributes { + album: Album + aspectRatio?: 'portrait' | 'square' + width?: number + height?: number +} + +export function AlbumArtwork({ + album, + aspectRatio = 'portrait', + width, + height, + className, + ...props +}: AlbumArtworkProps) { + return ( +
+ + +
+ {album.name} +
+
+ + Add to Library + + Add to Playlist + + + + New Playlist + + + {playlists.map((playlist) => ( + + + + + {playlist} + + ))} + + + + Play Next + Play Later + Create Station + + Like + Share + +
+
+

{album.name}

+

{album.artist}

+
+
+ ) +} diff --git a/mirror-2/app/home/components/menu.tsx b/mirror-2/app/home/components/menu.tsx new file mode 100644 index 00000000..06f79afb --- /dev/null +++ b/mirror-2/app/home/components/menu.tsx @@ -0,0 +1,200 @@ +import { + Menubar, + MenubarMenu, + MenubarTrigger, + MenubarContent, + MenubarItem, + MenubarSeparator, + MenubarShortcut, + MenubarSub, + MenubarSubTrigger, + MenubarSubContent, + MenubarCheckboxItem, + MenubarLabel, + MenubarRadioGroup, + MenubarRadioItem +} from '@/components/ui/menubar' + +export function Menu() { + return ( + + + Music + + About Music + + + Preferences... ⌘, + + + + Hide Music... ⌘H + + + Hide Others... ⇧⌘H + + + + Quit Music ⌘Q + + + + + File + + + New + + + Playlist ⌘N + + + Playlist from Selection ⇧⌘N + + + Smart Playlist... ⌥⌘N + + Playlist Folder + Genius Playlist + + + + Open Stream URL... ⌘U + + + Close Window ⌘W + + + + Library + + Update Cloud Library + Update Genius + + Organize Library... + Export Library... + + Import Playlist... + Export Playlist... + Show Duplicate Items + + Get Album Artwork + Get Track Names + + + + Import... ⌘O + + Burn Playlist to Disc... + + + Show in Finder ⇧⌘R{' '} + + Convert + + Page Setup... + + Print... ⌘P + + + + + Edit + + + Undo ⌘Z + + + Redo ⇧⌘Z + + + + Cut ⌘X + + + Copy ⌘C + + + Paste ⌘V + + + + Select All ⌘A + + + Deselect All ⇧⌘A + + + + Smart Dictation...{' '} + + + + + + + + + Emoji & Symbols{' '} + + + + + + + + + + + View + + Show Playing Next + Show Lyrics + + + Show Status Bar + + + Hide Sidebar + + Enter Full Screen + + + + + Account + + Switch Account + + + Andy + Benoit + Luis + + + Manage Family... + + Add Account... + + + + ) +} diff --git a/mirror-2/app/home/components/podcast-empty-placeholder.tsx b/mirror-2/app/home/components/podcast-empty-placeholder.tsx new file mode 100644 index 00000000..a0258004 --- /dev/null +++ b/mirror-2/app/home/components/podcast-empty-placeholder.tsx @@ -0,0 +1,64 @@ +import { Button } from '@/components/ui/button' +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger +} from '@/components/ui/dialog' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' + +export function PodcastEmptyPlaceholder() { + return ( +
+
+ + + + + + +

No episodes added

+

+ You have not added any podcasts. Add one below. +

+ + + + + + + Add Podcast + + Copy and paste the podcast feed URL to import. + + +
+
+ + +
+
+ + + +
+
+
+
+ ) +} diff --git a/mirror-2/app/home/components/sidebar.tsx b/mirror-2/app/home/components/sidebar.tsx new file mode 100644 index 00000000..9c99a7e2 --- /dev/null +++ b/mirror-2/app/home/components/sidebar.tsx @@ -0,0 +1,48 @@ +import { cn } from '@/lib/utils' + +import { Playlist } from '../data/playlists' +import { Button } from '@/components/ui/button' +import Link from 'next/link' +import { Axis3D, Gamepad2, PlusCircleIcon } from 'lucide-react' + +interface SidebarProps extends React.HTMLAttributes { + playlists: Playlist[] +} + +export function Sidebar({ className, playlists }: SidebarProps) { + return ( +
+
+
+

+ Discover +

+
+ + {process.env.NEXT_PUBLIC_DISCORD_INVITE_URL && ( + + )} + +
+
+
+
+ ) +} diff --git a/mirror-2/app/home/data/albums.ts b/mirror-2/app/home/data/albums.ts new file mode 100644 index 00000000..73b11b5f --- /dev/null +++ b/mirror-2/app/home/data/albums.ts @@ -0,0 +1,71 @@ +export interface Album { + name: string + artist: string + cover: string +} + +export const listenNowAlbums: Album[] = [ + { + name: 'React Rendezvous', + artist: 'Ethan Byte', + cover: + 'https://images.unsplash.com/photo-1611348586804-61bf6c080437?w=300&dpr=2&q=80' + }, + { + name: 'Async Awakenings', + artist: 'Nina Netcode', + cover: + 'https://images.unsplash.com/photo-1468817814611-b7edf94b5d60?w=300&dpr=2&q=80' + }, + { + name: 'The Art of Reusability', + artist: 'Lena Logic', + cover: + 'https://images.unsplash.com/photo-1528143358888-6d3c7f67bd5d?w=300&dpr=2&q=80' + }, + { + name: 'Stateful Symphony', + artist: 'Beth Binary', + cover: + 'https://images.unsplash.com/photo-1490300472339-79e4adc6be4a?w=300&dpr=2&q=80' + } +] + +export const madeForYouAlbums: Album[] = [ + { + name: 'Thinking Components', + artist: 'Lena Logic', + cover: + 'https://images.unsplash.com/photo-1615247001958-f4bc92fa6a4a?w=300&dpr=2&q=80' + }, + { + name: 'Functional Fury', + artist: 'Beth Binary', + cover: + 'https://images.unsplash.com/photo-1513745405825-efaf9a49315f?w=300&dpr=2&q=80' + }, + { + name: 'React Rendezvous', + artist: 'Ethan Byte', + cover: + 'https://images.unsplash.com/photo-1614113489855-66422ad300a4?w=300&dpr=2&q=80' + }, + { + name: 'Stateful Symphony', + artist: 'Beth Binary', + cover: + 'https://images.unsplash.com/photo-1446185250204-f94591f7d702?w=300&dpr=2&q=80' + }, + { + name: 'Async Awakenings', + artist: 'Nina Netcode', + cover: + 'https://images.unsplash.com/photo-1468817814611-b7edf94b5d60?w=300&dpr=2&q=80' + }, + { + name: 'The Art of Reusability', + artist: 'Lena Logic', + cover: + 'https://images.unsplash.com/photo-1490300472339-79e4adc6be4a?w=300&dpr=2&q=80' + } +] diff --git a/mirror-2/app/home/data/playlists.ts b/mirror-2/app/home/data/playlists.ts new file mode 100644 index 00000000..afa7678e --- /dev/null +++ b/mirror-2/app/home/data/playlists.ts @@ -0,0 +1,16 @@ +export type Playlist = (typeof playlists)[number] + +export const playlists = [ + 'Recently Added', + 'Recently Played', + 'Top Songs', + 'Top Albums', + 'Top Artists', + 'Logic Discography', + 'Bedtime Beats', + 'Feeling Happy', + 'I miss Y2K Pop', + 'Runtober', + 'Mellow Days', + 'Eminem Essentials' +] diff --git a/mirror-2/app/home/page.tsx b/mirror-2/app/home/page.tsx new file mode 100644 index 00000000..1e05673e --- /dev/null +++ b/mirror-2/app/home/page.tsx @@ -0,0 +1,142 @@ +import Image from 'next/image' + +import { AlbumArtwork } from './components/album-artwork' +import { Menu } from './components/menu' +import { PodcastEmptyPlaceholder } from './components/podcast-empty-placeholder' +import { Sidebar } from './components/sidebar' +import { listenNowAlbums, madeForYouAlbums } from './data/albums' +import { playlists } from './data/playlists' +import { PlusCircleIcon } from 'lucide-react' +import { Button } from '@/components/ui/button' +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' +import { Separator } from '@/components/ui/separator' +import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area' +import Link from 'next/link' +import { appDescription, appName } from '@/lib/theme-service' +import { Metadata } from 'next' +import AccountDropdownMenu from '@/components/ui/account-dropdown-menu' + +export default function MusicPage() { + return ( + <> +
+ Music + Music +
+
+ {/* */} +
+
+
+ +
+
+ +
+ +
+
+

+ The Next Era of The Mirror +

+

+ Welcome, let's build. +

+
+
+ +
+ +
+ +
+ +
+ {listenNowAlbums.map((album) => ( + + ))} +
+ +
+
+
+

+ Play +

+

+ Published Spaces from other builders. +

+
+ +
+ +
+ {madeForYouAlbums.map((album) => ( + + ))} +
+ +
+
+
+ +
+
+

+ New Episodes +

+

+ Your favorite podcasts. Updated daily. +

+
+
+ + +
+
+
+
+
+
+
+
+ + ) +} diff --git a/mirror-2/app/layout.client.tsx b/mirror-2/app/layout.client.tsx new file mode 100644 index 00000000..46ec8b74 --- /dev/null +++ b/mirror-2/app/layout.client.tsx @@ -0,0 +1,26 @@ +'use client' +import { store } from '@/state/store' +import { Provider } from 'react-redux' +import { ThemeProvider } from 'next-themes' +import { useSetupAuthEvents } from '@/hooks/auth' + +export default function ClientLayout({ children }) { + return ( + + + + + + ) +} + +// separate component here because auth setup needs to be within the store +export function AuthLayout({ children }) { + useSetupAuthEvents() + return
{children}
+} diff --git a/mirror-2/app/layout.tsx b/mirror-2/app/layout.tsx new file mode 100644 index 00000000..2bf8eef5 --- /dev/null +++ b/mirror-2/app/layout.tsx @@ -0,0 +1,28 @@ +import ClientLayout from '@/app/layout.client' +import { Montserrat } from 'next/font/google' +import './globals.css' +import { Metadata } from 'next' +import { appName, appDescription, faviconPath } from '@/lib/theme-service' +import '@/utils/analytics/analytics' + +export const metadata: Metadata = { + title: appName(), + description: appDescription() +} + +const montserrat = Montserrat({ + subsets: ['latin'], + display: 'swap' +}) +export default function RootLayout({ children }) { + return ( + + + + + + {children} + + + ) +} diff --git a/mirror-2/app/page.tsx b/mirror-2/app/page.tsx new file mode 100644 index 00000000..9b2d3e15 --- /dev/null +++ b/mirror-2/app/page.tsx @@ -0,0 +1,6 @@ +import Hero from '@/components/hero' +import { hasEnvVars } from '@/utils/supabase/check-env-vars' + +export default async function Index() { + return <>Temp, should be deleted +} diff --git a/mirror-2/app/protected/blank-redirect.tsx b/mirror-2/app/protected/blank-redirect.tsx new file mode 100644 index 00000000..0c43113f --- /dev/null +++ b/mirror-2/app/protected/blank-redirect.tsx @@ -0,0 +1,8 @@ +'use client' + +import { useRedirectToHomeIfSignedIn } from '@/hooks/auth' + +export function BlankRedirect() { + useRedirectToHomeIfSignedIn() + return <> +} diff --git a/mirror-2/app/protected/page.tsx b/mirror-2/app/protected/page.tsx new file mode 100644 index 00000000..a5b4c418 --- /dev/null +++ b/mirror-2/app/protected/page.tsx @@ -0,0 +1,20 @@ +import { BlankRedirect } from '@/app/protected/blank-redirect' +import { createServerClient } from '@/utils/supabase/server' +import { redirect } from 'next/navigation' + +export default async function ProtectedPage() { + const supabase = createServerClient() + + const { + data: { user } + } = await supabase.auth.getUser() + + if (!user) { + return redirect('/login') + } + + return ( + // delete this page eventually. it's here from boilerplate auth that users server side + + ) +} diff --git a/mirror-2/app/protected/reset-password/page.tsx b/mirror-2/app/protected/reset-password/page.tsx new file mode 100644 index 00000000..25fd72c5 --- /dev/null +++ b/mirror-2/app/protected/reset-password/page.tsx @@ -0,0 +1,38 @@ +import { resetPasswordAction } from '@/actions/auth' +import { FormMessage, Message } from '@/components/form-message' +import { SubmitButton } from '@/components/submit-button' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' + +export default async function ResetPassword({ + searchParams +}: { + searchParams: Message +}) { + return ( +
+

Reset password

+

+ Please enter your new password below. +

+ + + + + + Reset password + + + + ) +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/NodeService.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/NodeService.tsx new file mode 100644 index 00000000..3d60aee5 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/NodeService.tsx @@ -0,0 +1,437 @@ +export const NodeService = { + getTreeNodesData() { + return [ + { + key: 'documents-id', + label: 'Documents', + data: 'Documents Folder', + icon: 'pi pi-fw pi-inbox', + children: [ + { + key: 'work-d', + label: 'Work', + data: 'Work Folder', + icon: 'pi pi-fw pi-cog', + children: [ + { key: '0-0-0', label: 'Expenses.doc', icon: 'pi pi-fw pi-file', data: 'Expenses Document' }, + { key: '0-0-1', label: 'Resume.doc', icon: 'pi pi-fw pi-file', data: 'Resume Document' } + ] + }, + { + key: 'home-id', + label: 'Home', + data: 'Home Folder', + icon: 'pi pi-fw pi-home', + children: [ + { + key: 'invoices-id', label: 'Invoices.txt', icon: 'pi pi-fw pi-file', data: 'Invoices for this month', children: [ + { key: 'invoices-id2', label: 'Invoices2.txt', icon: 'pi pi-fw pi-file', data: 'Invoices for this month' } + ] + } + ] + } + ] + }, + { + key: 'events-id', + label: 'Events', + data: 'Events Folder', + icon: 'pi pi-fw pi-calendar', + children: [ + { key: 'meeting-d', label: 'Meeting', icon: 'pi pi-fw pi-calendar-plus', data: 'Meeting' }, + { key: 'product-launch-id', label: 'Product Launch', icon: 'pi pi-fw pi-calendar-plus', data: 'Product Launch' }, + { key: 'report-review-id', label: 'Report Review', icon: 'pi pi-fw pi-calendar-plus', data: 'Report Review' } + ] + }, + { + key: 'movies-id', + label: 'Movies', + data: 'Movies Folder', + icon: 'pi pi-fw pi-star-fill', + children: [ + { + key: 'al-pacino-id', + icon: 'pi pi-fw pi-star-fill', + label: 'Al Pacino', + data: 'Pacino Movies', + children: [ + { key: 'scarface-id', label: 'Scarface', icon: 'pi pi-fw pi-video', data: 'Scarface Movie' }, + { key: 'serpico-id', label: 'Serpico', icon: 'pi pi-fw pi-video', data: 'Serpico Movie' } + ] + }, + { + key: 'robert-de-niro-id', + label: 'Robert De Niro', + icon: 'pi pi-fw pi-star-fill', + data: 'De Niro Movies', + children: [ + { key: 'goodfellas-id', label: 'Goodfellas', icon: 'pi pi-fw pi-video', data: 'Goodfellas Movie' }, + { key: 'untouchables-id', label: 'Untouchables', icon: 'pi pi-fw pi-video', data: 'Untouchables Movie' } + ] + } + ] + } + ]; + }, + + getTreeTableNodesData() { + return [ + { + key: '0', + data: { + name: 'Applications', + size: '100kb', + type: 'Folder' + }, + children: [ + { + key: '0-0', + data: { + name: 'React', + size: '25kb', + type: 'Folder' + }, + children: [ + { + key: '0-0-0', + data: { + name: 'react.app', + size: '10kb', + type: 'Application' + } + }, + { + key: '0-0-1', + data: { + name: 'native.app', + size: '10kb', + type: 'Application' + } + }, + { + key: '0-0-2', + data: { + name: 'mobile.app', + size: '5kb', + type: 'Application' + } + } + ] + }, + { + key: '0-1', + data: { + name: 'editor.app', + size: '25kb', + type: 'Application' + } + }, + { + key: '0-2', + data: { + name: 'settings.app', + size: '50kb', + type: 'Application' + } + } + ] + }, + { + key: '1', + data: { + name: 'Cloud', + size: '20kb', + type: 'Folder' + }, + children: [ + { + key: '1-0', + data: { + name: 'backup-1.zip', + size: '10kb', + type: 'Zip' + } + }, + { + key: '1-1', + data: { + name: 'backup-2.zip', + size: '10kb', + type: 'Zip' + } + } + ] + }, + { + key: '2', + data: { + name: 'Desktop', + size: '150kb', + type: 'Folder' + }, + children: [ + { + key: '2-0', + data: { + name: 'note-meeting.txt', + size: '50kb', + type: 'Text' + } + }, + { + key: '2-1', + data: { + name: 'note-todo.txt', + size: '100kb', + type: 'Text' + } + } + ] + }, + { + key: '3', + data: { + name: 'Documents', + size: '75kb', + type: 'Folder' + }, + children: [ + { + key: '3-0', + data: { + name: 'Work', + size: '55kb', + type: 'Folder' + }, + children: [ + { + key: '3-0-0', + data: { + name: 'Expenses.doc', + size: '30kb', + type: 'Document' + } + }, + { + key: '3-0-1', + data: { + name: 'Resume.doc', + size: '25kb', + type: 'Resume' + } + } + ] + }, + { + key: '3-1', + data: { + name: 'Home', + size: '20kb', + type: 'Folder' + }, + children: [ + { + key: '3-1-0', + data: { + name: 'Invoices', + size: '20kb', + type: 'Text' + } + } + ] + } + ] + }, + { + key: '4', + data: { + name: 'Downloads', + size: '25kb', + type: 'Folder' + }, + children: [ + { + key: '4-0', + data: { + name: 'Spanish', + size: '10kb', + type: 'Folder' + }, + children: [ + { + key: '4-0-0', + data: { + name: 'tutorial-a1.txt', + size: '5kb', + type: 'Text' + } + }, + { + key: '4-0-1', + data: { + name: 'tutorial-a2.txt', + size: '5kb', + type: 'Text' + } + } + ] + }, + { + key: '4-1', + data: { + name: 'Travel', + size: '15kb', + type: 'Text' + }, + children: [ + { + key: '4-1-0', + data: { + name: 'Hotel.pdf', + size: '10kb', + type: 'PDF' + } + }, + { + key: '4-1-1', + data: { + name: 'Flight.pdf', + size: '5kb', + type: 'PDF' + } + } + ] + } + ] + }, + { + key: '5', + data: { + name: 'Main', + size: '50kb', + type: 'Folder' + }, + children: [ + { + key: '5-0', + data: { + name: 'bin', + size: '50kb', + type: 'Link' + } + }, + { + key: '5-1', + data: { + name: 'etc', + size: '100kb', + type: 'Link' + } + }, + { + key: '5-2', + data: { + name: 'var', + size: '100kb', + type: 'Link' + } + } + ] + }, + { + key: '6', + data: { + name: 'Other', + size: '5kb', + type: 'Folder' + }, + children: [ + { + key: '6-0', + data: { + name: 'todo.txt', + size: '3kb', + type: 'Text' + } + }, + { + key: '6-1', + data: { + name: 'logo.png', + size: '2kb', + type: 'Picture' + } + } + ] + }, + { + key: '7', + data: { + name: 'Pictures', + size: '150kb', + type: 'Folder' + }, + children: [ + { + key: '7-0', + data: { + name: 'barcelona.jpg', + size: '90kb', + type: 'Picture' + } + }, + { + key: '7-1', + data: { + name: 'primeng.png', + size: '30kb', + type: 'Picture' + } + }, + { + key: '7-2', + data: { + name: 'prime.jpg', + size: '30kb', + type: 'Picture' + } + } + ] + }, + { + key: '8', + data: { + name: 'Videos', + size: '1500kb', + type: 'Folder' + }, + children: [ + { + key: '8-0', + data: { + name: 'primefaces.mkv', + size: '1000kb', + type: 'Video' + } + }, + { + key: '8-1', + data: { + name: 'intro.avi', + size: '500kb', + type: 'Video' + } + } + ] + } + ]; + }, + + getTreeTableNodes() { + return Promise.resolve(this.getTreeTableNodesData()); + }, + + getTreeNodes() { + return Promise.resolve(this.getTreeNodesData()); + } +}; diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/assets.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/assets.tsx new file mode 100644 index 00000000..79dfef5a --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/assets.tsx @@ -0,0 +1,158 @@ +'use client'; +import AssetThumbnail from '@/components/ui/asset-thumbnail'; +import { Button } from '@/components/ui/button'; +import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from '@/components/ui/context-menu'; +import AssetUploadButton from '@/components/ui/custom-buttons/asset-upload.button'; +import { Form, FormControl, FormField, FormItem, FormMessage, FormSuccessMessage } from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { useLazySearchAssetsQuery, useLazyGetUserMostRecentlyUpdatedAssetsQuery, useLazyDownloadAssetQuery } from '@/state/api/assets'; + +import downloadFile from '@/utils/download-file'; +import { createSupabaseBrowserClient } from '@/utils/supabase/client'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { ScrollArea } from '@radix-ui/react-scroll-area'; +import { useThrottleCallback } from '@react-hook/throttle'; +import { FileDown, XIcon } from 'lucide-react'; +import { useEffect, useState } from 'react'; +import { useForm } from 'react-hook-form'; +import { z } from "zod"; + +const formSchema = z.object({ + text: z.string().min(3) +}) + +export default function Assets() { + const [selectedAssetId, setSelectedAssetId] = useState(null); + + // Define the form + const form = useForm>({ + resolver: zodResolver(formSchema), + mode: "onChange", + defaultValues: { + text: "", + }, + }); + + const [triggerSearch, { data: assets, isLoading, isSuccess, error }] = useLazySearchAssetsQuery(); + const [triggerGetUserMostRecentlyUpdatedAssets, { data: recentAssets }] = useLazyGetUserMostRecentlyUpdatedAssetsQuery({}); + const [triggerDownloadAsset] = useLazyDownloadAssetQuery(); + + const throttledSubmit = useThrottleCallback(() => { + triggerSearch({ text: form.getValues("text")?.trim() }); + }, 3, true); + + async function onSubmit(values: z.infer) { + throttledSubmit(); + } + + // Watch the text input value + useEffect(() => { + const subscription = form.watch(({ text }, { name, type }) => { + if (text && text?.length >= 3) { + form.handleSubmit(onSubmit)(); + } + }); + return () => subscription.unsubscribe(); + }, []); + + useEffect(() => { + triggerGetUserMostRecentlyUpdatedAssets({}); + }, [triggerGetUserMostRecentlyUpdatedAssets]); + + // Handle download action from the context menu + const handleDownload = async (assetId: string) => { + // const { data, error } = await triggerDownloadAsset({ assetId }); + const supabase = createSupabaseBrowserClient(); + + const { data, error } = await supabase.storage + .from('assets') // Use your actual bucket name + .download(`users/${assetId}`); + + if (data) { + // Use the helper function to trigger the file download + downloadFile(data, `${assetId}.jpg`); // Customize the filename as needed + } + }; + + return ( + <> + {/* Search bar */} +
+ + ( + + +
+ + { + form.formState.isDirty && + } +
+
+ + {assets?.length} Results +
+ )} + /> + + + + {/* Asset Upload Button */} + + + {/* Scrollable area that takes up remaining space */} +
+ +
+ {form.formState.isSubmitted ? assets?.map((asset) => ( + + setSelectedAssetId(asset.id)}> +
+ +
+
+ + selectedAssetId && handleDownload(selectedAssetId)}> + + Download + + +
+ )) : recentAssets?.map((asset) => ( + + setSelectedAssetId(asset.id)}> +
+ +
+
+ + selectedAssetId && handleDownload(selectedAssetId)}> + + Download + + +
+ ))} +
+
+
+ + ); +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/code.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/code.tsx new file mode 100644 index 00000000..ad432f13 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/code.tsx @@ -0,0 +1,11 @@ +'use client'; +import ControlBar from "@/app/space/[spaceId]/build/controlBar/control-bar"; +import { Suspense } from "react"; + +export default function Code() { + + return ( +
Code
+ ); +} + diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/control-bar.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/control-bar.tsx new file mode 100644 index 00000000..bff5540b --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/control-bar.tsx @@ -0,0 +1,184 @@ +'use client'; + +import { Button } from "@/components/ui/button"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; +import { useUiHoverSoundEffect } from "@/components/ui/ui-sounds"; +import { useAppDispatch, useAppSelector } from "@/hooks/hooks"; +import { ControlBarView, selectControlBarCurrentView, selectUiSoundsCanPlay, setControlBarCurrentView, turnOffUiSounds, turnOnUiSounds } from "@/state/local.slice"; +import { Box, Clapperboard, Code2, Database, GitBranch, ListTree, Settings, Volume2, VolumeOff } from "lucide-react"; + +export default function ControlBar() { + const currentView = useAppSelector(selectControlBarCurrentView); + const dispatch = useAppDispatch(); + const uiSoundsCanPlay = useAppSelector(selectUiSoundsCanPlay); + const [play] = useUiHoverSoundEffect(); + + const handleViewChange = (view: ControlBarView) => { + // play the sound ONLY if the view has changed + if (currentView !== view) { + play() + } + dispatch(setControlBarCurrentView(view)); + }; + + const getVariant = (view: string) => { + return currentView === view ? "default" : "ghost"; + }; + + + return ( + + + + ); +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/database.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/database.tsx new file mode 100644 index 00000000..fcdd6a8c --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/database.tsx @@ -0,0 +1,9 @@ +'use client'; + +export default function Database() { + + return ( +
Database
+ ); +} + diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/hierarchy.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/hierarchy.tsx new file mode 100644 index 00000000..8de76fe2 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/hierarchy.tsx @@ -0,0 +1,46 @@ +"use client"; + +import { Button } from '@/components/ui/button'; +import { PlusCircleIcon } from 'lucide-react'; +import EntityTree from '@/components/entity-tree/entity-tree'; +import { useAppSelector } from '@/hooks/hooks'; +import { useCreateEntityMutation } from '@/state/api/entities'; +import { selectCurrentScene } from '@/state/local.slice'; +import { useParams } from 'next/navigation'; +import { Separator } from '@/components/ui/separator'; +import { H2 } from '@/components/ui/text/h2'; +import { useEffect, useState } from 'react'; + +export default function Hierarchy() { + const currentScene = useAppSelector(selectCurrentScene); + const [createEntity] = useCreateEntityMutation(); + const [isClient, setIsClient] = useState(false); + + useEffect(() => { + // Ensure this runs only on the client-side + setIsClient(true); + }, []); + + return ( + <> + {/* Render nothing dependent on currentScene until client-side rendering */} + {isClient && ( + <> +

{currentScene ? <>Scene: {currentScene.name} : "Loading..."}

+ + {currentScene && ( + + )} + + + )} + + ); +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/inner-control-bar.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/inner-control-bar.tsx new file mode 100644 index 00000000..51169832 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/inner-control-bar.tsx @@ -0,0 +1,56 @@ +'use client'; + +import Assets from "@/app/space/[spaceId]/build/controlBar/assets"; +import Code from "@/app/space/[spaceId]/build/controlBar/code"; +import Database from "@/app/space/[spaceId]/build/controlBar/database"; +import Hierarchy from "@/app/space/[spaceId]/build/controlBar/hierarchy"; +import Scenes from "@/app/space/[spaceId]/build/controlBar/scenes"; +import Settings from "@/app/space/[spaceId]/build/controlBar/settings"; +import { SkeletonCard } from "@/app/space/[spaceId]/build/controlBar/skeleton-card"; +import Versions from "@/app/space/[spaceId]/build/controlBar/versions"; +import { useGetFileUpload } from "@/hooks/file-upload"; +import { useAppSelector } from "@/hooks/hooks"; +import { selectControlBarCurrentView } from "@/state/local.slice"; +import { Suspense } from "react"; +import { useDropzone } from "react-dropzone"; + +export default function InnerControlBar() { + const currentView = useAppSelector(selectControlBarCurrentView); + + // File dropzone + const onDrop = useGetFileUpload(); + + const { getRootProps, getInputProps, isDragActive } = useDropzone({ + noClick: true, + noKeyboard: true, + onDrop, + }); + + return ( +
+ {/* Input element for handling file uploads */} + + + {/* Overlay that is shown when a file is dragged over the area */} +
+

Drop Your Asset Here

+
+ + {/* Content of the control bar */} + }> +
+ {currentView === "scenes" && } + {currentView === "hierarchy" && } + {currentView === "assets" && } + {currentView === "code" && } + {currentView === "database" && } + {currentView === "versions" && } + {currentView === "settings" && } +
+
+
+ ); +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/layout.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/layout.tsx new file mode 100644 index 00000000..f86f72da --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/layout.tsx @@ -0,0 +1,15 @@ +import ControlBar from '@/app/space/[spaceId]/build/controlBar/control-bar' +import InnerControlBar from '@/app/space/[spaceId]/build/controlBar/inner-control-bar' + +export default function Layout({ children }: { children: React.ReactNode }) { + return ( +
+
+ +
+
+ +
+
+ ) +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/loading.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/loading.tsx new file mode 100644 index 00000000..7c30e9c6 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/loading.tsx @@ -0,0 +1,7 @@ +export default function Loading() { + return ( +
+
+
+ ); +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/page.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/page.tsx new file mode 100644 index 00000000..ef1b7cb3 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Build Page
+} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/scenes.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/scenes.tsx new file mode 100644 index 00000000..3bdf39c6 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/scenes.tsx @@ -0,0 +1,112 @@ +'use client'; +import { Button } from '@/components/ui/button'; + +import { ScrollArea } from '@radix-ui/react-scroll-area'; +import { PlusCircleIcon, MoreHorizontal } from 'lucide-react'; // Import MoreHorizontal for ellipsis icon +import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '@/components/ui/dropdown-menu'; // shadcn dropdown menu +import { useParams } from 'next/navigation'; + +import { z } from 'zod'; // Import zod for validation +import { SyncedInput } from '@/components/ui/synced-inputs/synced-input'; +import { useAppDispatch, useAppSelector } from '@/hooks/hooks'; +import { selectCurrentScene, setControlBarCurrentView, setCurrentScene } from '@/state/local.slice'; +import { DatabaseScene, useCreateSceneMutation, useDeleteSceneMutation, useGetAllScenesQuery, useGetSingleSceneQuery, useUpdateSceneMutation } from '@/state/api/scenes'; +import { cn } from '@/utils/cn'; +import { generateSceneName } from '@/actions/name-generator'; +import { Input } from '@/components/ui/input'; + +export default function Scenes() { + const params = useParams<{ spaceId: string }>() + const spaceId: number = parseInt(params.spaceId, 10) // Use parseInt for safer conversion + + const { data: scenes } = useGetAllScenesQuery(spaceId); + const [createScene, { data: createdScene }] = useCreateSceneMutation(); + const [deleteScene] = useDeleteSceneMutation(); + const [updateScene] = useUpdateSceneMutation(); + const dispatch = useAppDispatch(); + const currentScene = useAppSelector(selectCurrentScene); + + // Validation schema for scene name + const formSchema = z.object({ + name: z.string().min(3, { message: "Scene name must be at least 3 characters long" }), + }); + + return ( + <> + {/* Create Scene Button */} + + + {/* Scrollable area that takes up remaining space */} +
+ +
+ {scenes?.map((scene: DatabaseScene) => ( +
{ + // Handle scene click + dispatch(setCurrentScene(scene)); + dispatch(setControlBarCurrentView('hierarchy')); + }} + > + {scene.name} +
+
+ ( + + )} + /> +
+
+ + + + + + deleteScene(scene.id)}> + Delete + + + +
+
+
+ ))} +
+
+
+ + ); +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/settings.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/settings.tsx new file mode 100644 index 00000000..4b91b1bf --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/settings.tsx @@ -0,0 +1,55 @@ +'use client'; + +import { useRef } from 'react'; +import { Button } from '@/components/ui/button'; +import { FolderInput } from 'lucide-react'; +import { useSpacePackZipFileUpload } from '@/utils/space-pack'; +import { useParams } from 'next/navigation'; + + +export default function Settings() { + const fileInputRef = useRef(null); + const params = useParams<{ spaceId: string }>() + const spaceId: number = parseInt(params.spaceId, 10) // Use parseInt for safer conversion + const { uploading, handlePCZipFileUpload } = useSpacePackZipFileUpload(spaceId); // Use the hook + + const handleFileInputChange = async (event: React.ChangeEvent) => { + const file = event.target.files?.[0]; + if (file) { + await handlePCZipFileUpload(file); // Call the hook function + } + }; + + const openFileDialog = () => { + if (fileInputRef.current) { + fileInputRef.current.click(); // Open the file dialog + } + }; + + return ( + <> + + +
+

To import an existing app from PlayCanvas, export it as a .zip.

+

The export must have:

+
    +
  • Engine Version: {'>=1.74.0'}
  • +
  • Concatenate Scripts: Unchecked
  • +
  • Optimize Scene Format: Unchecked
  • +
  • Format: .zip
  • +
+
+ + ); +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/skeleton-card.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/skeleton-card.tsx new file mode 100644 index 00000000..7be3859a --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/skeleton-card.tsx @@ -0,0 +1,13 @@ +import { Skeleton } from "@/components/ui/skeleton" + +export function SkeletonCard() { + return ( +
+ +
+ + +
+
+ ) +} diff --git a/mirror-2/app/space/[spaceId]/build/controlBar/versions.tsx b/mirror-2/app/space/[spaceId]/build/controlBar/versions.tsx new file mode 100644 index 00000000..3a89c58b --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/controlBar/versions.tsx @@ -0,0 +1,9 @@ +'use client'; + +export default function Versions() { + + return ( +
Versions
+ ); +} + diff --git a/mirror-2/app/space/[spaceId]/build/inspector/entity.formgroup.tsx b/mirror-2/app/space/[spaceId]/build/inspector/entity.formgroup.tsx new file mode 100644 index 00000000..45b0f77d --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/inspector/entity.formgroup.tsx @@ -0,0 +1,116 @@ +"use client"; +import { DatabaseEntity, useGetSingleEntityQuery, useUpdateEntityMutation } from "@/state/api/entities"; +import { Separator } from "@/components/ui/separator"; +import SyncedVector3Input from "@/components/ui/synced-inputs/synced-vector3-input"; +import { SyncedInput } from "@/components/ui/synced-inputs/synced-input"; +import { cn } from "@/lib/utils"; +import { z } from "zod"; +import { Input } from "@/components/ui/input"; +import { Checkbox } from "@/components/ui/checkbox"; +import { FormItem, FormLabel } from "@/components/ui/form"; + + +export function EntityFormGroup({ entity }: { entity: DatabaseEntity }) { + return ( + <> + ( + + )} + /> + + + + ( + <> + + +
+ + Enabled + +
+
+ + )} + /> + + + + + + + + + + + + ); +} diff --git a/mirror-2/app/space/[spaceId]/build/inspector/inspector.tsx b/mirror-2/app/space/[spaceId]/build/inspector/inspector.tsx new file mode 100644 index 00000000..4c67d4f1 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/inspector/inspector.tsx @@ -0,0 +1,23 @@ +"use client" +import { EntityFormGroup } from "@/app/space/[spaceId]/build/inspector/entity.formgroup"; +import { Button } from "@/components/ui/button"; +import { CreateComponentButton } from "@/components/ui/custom-buttons/create-component.button"; +import { useAppSelector } from "@/hooks/hooks"; +import { selectCurrentEntity } from "@/state/local.slice"; +import { cn } from "@/utils/cn"; +import { PlusCircleIcon } from "lucide-react"; + +export default function Inspector({ className }) { + const entity = useAppSelector(selectCurrentEntity) + + return
+ {entity && + <> + + {/* Create Component Button */} + + + } +
+ +} diff --git a/mirror-2/app/space/[spaceId]/build/layout.tsx b/mirror-2/app/space/[spaceId]/build/layout.tsx new file mode 100644 index 00000000..21727082 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/layout.tsx @@ -0,0 +1,44 @@ +"use client" +import InnerControlBar from "@/app/space/[spaceId]/build/controlBar/inner-control-bar" +import Inspector from "@/app/space/[spaceId]/build/inspector/inspector" +import { Sidebar } from "@/app/space/[spaceId]/build/sidebar" +import { TopNavbar } from "@/app/space/[spaceId]/build/top-navbar" +import SpaceViewport from "@/components/engine/space-viewport" +import { useParams } from "next/navigation" + +export default function Layout({ children, params }: { + children: React.ReactNode, + spaceViewport: React.ReactNode, + params: { spaceId: string } +}) { + const spaceId: number = parseInt(params.spaceId, 10) // Use parseInt for safer conversion + return ( +
+ + {/*
*/} +
+ {/* Sidebar with fixed width */} +
+ +
+ + {/* Inner control bar takes flexible space */} +
+ +
+ + {/* Space viewport (main content) */} +
+ +
+ + {/* Instead of a div wrapping here, passing in className so that this component can be server compoonent; the Inspector has to use a hook for checking if entity selected */} + + + + {/* Children for additional content */} + {children} +
+
+ ); +} diff --git a/mirror-2/app/space/[spaceId]/build/page.tsx b/mirror-2/app/space/[spaceId]/build/page.tsx new file mode 100644 index 00000000..79a8aeb4 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/page.tsx @@ -0,0 +1,38 @@ +"use client" + +import { useAppDispatch, useAppSelector } from "@/hooks/hooks" +import { selectCurrentScene, setCurrentScene } from "@/state/local.slice" +import { useGetAllScenesQuery } from "@/state/api/scenes" +import { useGetSingleSpaceQuery } from "@/state/api/spaces" + +import { useParams } from "next/navigation" +import { useEffect } from "react" +import dynamic from "next/dynamic" +import { store } from "@/state/store" + + +// blank page since we're using the parallel routes for spaceViewport, controlBar, etc. +export default function Page() { + const currentScene = useAppSelector(selectCurrentScene); + const params = useParams<{ spaceId: string }>() + const spaceId: number = parseInt(params.spaceId, 10) // Use parseInt for safer conversion + + const { data: space, error } = useGetSingleSpaceQuery(spaceId) + const { data: scenes, isLoading: isScenesLoading } = useGetAllScenesQuery(spaceId) + + // after successful query, update the current scene to the first in the space.scenes array + const dispatch = useAppDispatch(); + useEffect(() => { + // if no current Scene, set it to the first scene + if (scenes && scenes?.length > 0 && scenes[0]) { + if (!currentScene?.id) { + console.log("setting current scene to first scene", scenes[0]) + dispatch(setCurrentScene(scenes[0])) + } + } else { + console.log('No scenes to set', scenes, currentScene) + } + }, [space, scenes]) + + return null +} diff --git a/mirror-2/app/space/[spaceId]/build/sidebar.tsx b/mirror-2/app/space/[spaceId]/build/sidebar.tsx new file mode 100644 index 00000000..337b0ae8 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/sidebar.tsx @@ -0,0 +1,10 @@ +"use client" +import ControlBar from "@/app/space/[spaceId]/build/controlBar/control-bar"; + +export function Sidebar() { + return ( +
+ +
+ ) +} diff --git a/mirror-2/app/space/[spaceId]/build/top-navbar.tsx b/mirror-2/app/space/[spaceId]/build/top-navbar.tsx new file mode 100644 index 00000000..38e3d3b7 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/build/top-navbar.tsx @@ -0,0 +1,61 @@ +"use client" +import { EditableSpaceName } from "@/components/editable-space-name"; +import { ThemeSwitcher } from "@/components/theme-switcher"; +import AccountDropdownMenu from "@/components/ui/account-dropdown-menu"; +import { Button } from "@/components/ui/button"; +import { useAppSelector } from "@/hooks/hooks"; +import { AppLogoImageSmall } from "@/lib/theme-service"; +import { selectLocalUser } from "@/state/local.slice"; +import { Play } from "lucide-react"; +import Link from "next/link"; +import { useParams } from "next/navigation"; +import { useEffect, useState } from "react"; + +export function TopNavbar() { + const localUserState = useAppSelector(selectLocalUser) + const [hasMounted, setHasMounted] = useState(false); + const params = useParams<{ spaceId: string }>() + const spaceId: number = parseInt(params.spaceId, 10) // Use parseInt for safer conversion + + // Check if the component is fully mounted (client-side) + useEffect(() => { + setHasMounted(true); + }, []); + + return ( +
+ +
+ +
+ +
+ +
+ + {hasMounted && + <> + + {!localUserState?.id && } + + } + +
+ ); +} diff --git a/mirror-2/app/space/[spaceId]/play/layout.tsx b/mirror-2/app/space/[spaceId]/play/layout.tsx new file mode 100644 index 00000000..7428b669 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/play/layout.tsx @@ -0,0 +1,4 @@ +// separating this out for server-side vs client +export default function PlayLayout({ children }) { + return children +} diff --git a/mirror-2/app/space/[spaceId]/play/page.tsx b/mirror-2/app/space/[spaceId]/play/page.tsx new file mode 100644 index 00000000..a36bffd9 --- /dev/null +++ b/mirror-2/app/space/[spaceId]/play/page.tsx @@ -0,0 +1,14 @@ +import SpaceViewport from '@/components/engine/space-viewport' + +export default function PlayPage() { + console.log('play') + debugger + return ( + <> + + + ) +} diff --git a/mirror-2/app/space/new/page.tsx b/mirror-2/app/space/new/page.tsx new file mode 100644 index 00000000..22e303e0 --- /dev/null +++ b/mirror-2/app/space/new/page.tsx @@ -0,0 +1,51 @@ +'use client' +import { ProgressIndeterminate } from '@/components/ui/progress-indeterminate' +import { Skeleton } from '@/components/ui/skeleton' + +import { useRouter } from 'next/navigation' +import { useCreateSpaceMutation } from '@/state/api/spaces' +import { useEffect, useState } from 'react' + +// Note: with React 19 this will annoying run twice with strict mode. Not sure about solution and I don't want to disable strict mode. https://stackoverflow.com/questions/72238175/why-useeffect-running-twice-and-how-to-handle-it-well-in-react#comment139336889_78443665 +export default function NewSpacePage() { + const [createSpace] = useCreateSpaceMutation() + const [started, setStarted] = useState(false) + const router = useRouter() + useEffect(() => { + async function create() { + const { data, error } = await createSpace({}) + if (error) { + console.error(error) + return + } + // navigate to the space + router.replace(`/space/${data.id}/build`) + } + if (!started) { + setStarted(true) + create() + } + }, []) + return ( +
+ {/* Top Menu Bar */} +
+ +
+ +
+ {/* Sidebar (20% of the width) */} +
+ +
+ + {/* Main content area (80% of the width) */} +
+
+ +
+
+
+
+ ) +} diff --git a/mirror-2/components.json b/mirror-2/components.json new file mode 100644 index 00000000..d77a3f82 --- /dev/null +++ b/mirror-2/components.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "app/globals.css", + "baseColor": "slate", + "cssVariables": false, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + } +} \ No newline at end of file diff --git a/mirror-2/components/editable-space-name.tsx b/mirror-2/components/editable-space-name.tsx new file mode 100644 index 00000000..879f8f7f --- /dev/null +++ b/mirror-2/components/editable-space-name.tsx @@ -0,0 +1,90 @@ +'use client' +import { + Form, + FormControl, + FormField, + FormItem, + FormMessage +} from '@/components/ui/form' +import { Input } from '@/components/ui/input' +import { Skeleton } from '@/components/ui/skeleton' +import { + useGetSingleSpaceQuery, + useUpdateSpaceMutation +} from '@/state/api/spaces' +import { zodResolver } from '@hookform/resolvers/zod' +import { useParams } from 'next/navigation' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' +import { z } from 'zod' + +const formSchema = z.object({ + name: z.string().min(3) +}) + +export function EditableSpaceName() { + const params = useParams<{ spaceId: string }>() + const spaceId: number = parseInt(params.spaceId, 10) // Use parseInt for safer conversion + + const { + data: space, + isLoading, + isSuccess, + error + } = useGetSingleSpaceQuery(spaceId) + const [updateSpace] = useUpdateSpaceMutation() + + // define the form + const form = useForm>({ + resolver: zodResolver(formSchema), + mode: 'onBlur', + defaultValues: { + name: space?.name || '' + } + // errors: error TODO add error handling here + }) + // 2. Define a submit handler. + async function onSubmit(values: z.infer) { + // update the space name + await updateSpace({ id: space.id, updateData: { name: values.name } }) + } + + // Reset the form values when the space data is fetched + useEffect(() => { + if (space && isSuccess) { + form.reset({ + name: space.name || '' // Set the form value once space.name is available + }) + } + }, [space, isSuccess, form]) // Only run this effect when space or isLoading changes + + return isLoading ? ( + + ) : ( +
+ + ( + + + + + {/* TODO add better styling for this so it doesn't shift the input field */} + + + )} + /> + + + ) +} diff --git a/mirror-2/components/engine/__start-custom__.js b/mirror-2/components/engine/__start-custom__.js new file mode 100644 index 00000000..a1605358 --- /dev/null +++ b/mirror-2/components/engine/__start-custom__.js @@ -0,0 +1,775 @@ +// Custom from the boilerplate from PC; it's recommended on docs to modify this, so ts-nocheck since it comes as JS file for initial boilerplate. https://developer.playcanvas.com/user-manual/publishing/web/communicating-webpage/ +import * as pc from 'playcanvas' + +// Shared Lib +export var CANVAS_ID = 'application-canvas'; + +// Needed as we will have edge cases for particular versions of iOS +// returns null if not iOS +var getIosVersion = function () { + if (/iP(hone|od|ad)/.test(navigator.platform)) { + var v = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/); + var version = [ + parseInt(v[1], 10), + parseInt(v[2], 10), + parseInt(v[3] || 0, 10), + ]; + return version; + } + + return null; +}; + +var lastWindowHeight +var lastWindowWidth +var windowSizeChangeIntervalHandler = null; + +/** + * this was var pcBoostrap = ... but putting it in a function because of ssr issues + */ +function getPcBootstrap() { + return { + reflowHandler: null, + iosVersion: getIosVersion(), + + createCanvas: function () { + var canvas = document.createElement('canvas'); + canvas.setAttribute('id', CANVAS_ID); + canvas.setAttribute('tabindex', 0); + + // Disable I-bar cursor on click+drag + canvas.onselectstart = function () { + return false; + }; + + // Disable long-touch select on iOS devices + canvas.style['-webkit-user-select'] = 'none'; + canvas.className = "transition-opacity duration-750 opacity-0" + // document.body.appendChild(canvas); + document.getElementById('direct-container').appendChild(canvas); + + setTimeout(() => { + canvas.classList.add('opacity-100'); // This will smoothly transition to visible + canvas.classList.remove('opacity-0'); // This will smoothly transition to visible + }, 50); // A slight delay to ensure the DOM is updated before applying the transition + + return canvas; + }, + + resizeCanvas: function (app, canvas) { + // change to __start__ script here + var fillMode = app._fillMode; + + canvas.style.width = ''; + canvas.style.height = ''; + if (fillMode === pc.FILLMODE_NONE) { + // our change for build mode (see below too) + const canvasContainer = document.getElementById('build-container') + app.resizeCanvas(canvasContainer.offsetWidth, canvasContainer.offsetHeight); + } else { + // non-custom behavior + app.resizeCanvas(canvas.width, canvas.height); + } + + + if (fillMode === pc.FILLMODE_NONE || fillMode === pc.FILLMODE_KEEP_ASPECT) { + if ( + (fillMode === pc.FILLMODE_NONE && + canvas.clientHeight < window.innerHeight) || + canvas.clientWidth / canvas.clientHeight >= + window.innerWidth / window.innerHeight + ) { + // old line here for posterity + // canvas.style.marginTop = Math.floor((window.innerHeight - canvas.clientHeight) / 2) + 'px'; + const canvasContainer = document.getElementById('build-container') + canvas.style.marginTop = canvasContainer.offsetTop + 'px' + canvas.style.marginLeft = canvasContainer.offsetLeft + 'px' + + } else { + canvas.style.marginTop = ''; + } + } + + lastWindowHeight = window.innerHeight; + lastWindowWidth = window.innerWidth; + + // Work around when in landscape to work on iOS 12 otherwise + // the content is under the URL bar at the top + if (this.iosVersion && this.iosVersion[0] <= 12) { + window.scrollTo(0, 0); + } + }, + + reflow: function (app, canvas) { + this.resizeCanvas(app, canvas); + + // Poll for size changes as the window inner height can change after the resize event for iOS + // Have one tab only, and rotate from portrait -> landscape -> portrait + if (windowSizeChangeIntervalHandler === null) { + windowSizeChangeIntervalHandler = setInterval( + function () { + if ( + lastWindowHeight !== window.innerHeight || + lastWindowWidth !== window.innerWidth + ) { + this.resizeCanvas(app, canvas); + } + }.bind(this), + 100 + ); + + // Don't want to do this all the time so stop polling after some short time + setTimeout(function () { + if (!!windowSizeChangeIntervalHandler) { + clearInterval(windowSizeChangeIntervalHandler); + windowSizeChangeIntervalHandler = null; + } + }, 2000); + } + }, + }; +} + +// Expose the reflow to users so that they can override the existing +// reflow logic if need be +// window.pcBootstrap = pcBootstrap; +// })(); + +// (function () { +// template varants +var LTC_MAT_1 = []; +var LTC_MAT_2 = []; + +var app; +var canvas; + +export function getApp() { + return app +} + +function initCSS() { + if (document.head.querySelector) { + // css media query for aspect ratio changes + // TODO: Change these from private properties + var css = `@media screen and (min-aspect-ratio: ${app._width}/${app._height}) { + #application-canvas.fill-mode-KEEP_ASPECT { + width: auto; + height: 100%; + margin: 0 auto; + } + }`; + document.getElementById('import-style').innerHTML += css; // Replace with getElementById for 'import-style' + + } + + // Configure resolution and resize event + if (canvas.classList) { + canvas.classList.add(`fill-mode-${app.fillMode}`); + } +} + +function displayError(html) { + var div = document.createElement('div'); + div.innerHTML = ` + + + +
+
+
${html}
+
+
`; + document.body.appendChild(div); +} + +function createGraphicsDevice(callback) { + var deviceOptions = window.CONTEXT_OPTIONS ? window.CONTEXT_OPTIONS : {}; + + if (typeof window.Promise === 'function') { + var LEGACY_WEBGL = 'webgl'; + var deviceTypes = + deviceOptions.preferWebGl2 === false + ? [pc.DEVICETYPE_WEBGL2] // DEVICETYPE_WEBGL1 was removed in engine 2.0 + : deviceOptions.deviceTypes; + if (!deviceTypes) { + deviceTypes = [] + } + deviceTypes.push(LEGACY_WEBGL); + + var gpuLibPath = window.ASSET_PREFIX + ? window.ASSET_PREFIX.replace(/\/$/g, '') + '/' + : ''; + + // new graphics device creation function with promises + var gfxOptions = { + deviceTypes: deviceTypes, + glslangUrl: gpuLibPath + 'glslang.js', + twgslUrl: gpuLibPath + 'twgsl.js', + powerPreference: deviceOptions.powerPreference, + antialias: deviceOptions.antialias !== false, + alpha: deviceOptions.alpha === true, + preserveDrawingBuffer: !!deviceOptions.preserveDrawingBuffer, + }; + + pc.createGraphicsDevice(canvas, gfxOptions) + .then((device) => { + callback(device); + }) + .catch((e) => { + console.error('Device creation error:', e); + callback(null); + }); + } else { + var igl1 = deviceOptions.deviceTypes.indexOf('webgl1'); + var igl2 = deviceOptions.deviceTypes.indexOf('webgl2'); + + // old webgl graphics device creation + var options = { + powerPreference: deviceOptions.powerPreference, + antialias: deviceOptions.antialias !== false, + alpha: deviceOptions.transparentCanvas !== false, + preserveDrawingBuffer: !!deviceOptions.preserveDrawingBuffer, + preferWebGl2: igl2 > igl1, + }; + + if (pc.platform.browser && !!navigator.xr) { + options.xrCompatible = true; + } + + callback(new pc.WebglGraphicsDevice(canvas, options)); + } +} + +function initApp(device, inputSettings = { + useKeyboard: true, + useMouse: true, + useGamepads: false, + useTouch: true +}) { + try { + var createOptions = new pc.AppOptions(); + createOptions.graphicsDevice = device; + + createOptions.componentSystems = [ + pc.RigidBodyComponentSystem, + pc.CollisionComponentSystem, + pc.JointComponentSystem, + pc.AnimationComponentSystem, + pc.AnimComponentSystem, + pc.ModelComponentSystem, + pc.RenderComponentSystem, + pc.CameraComponentSystem, + pc.LightComponentSystem, + pc.ScriptComponentSystem, // ScriptLegacyComponentSystem removed in engine 2.0 + // pc.AudioSourceComponentSystem, // removed in engine 2.0 + pc.SoundComponentSystem, + pc.AudioListenerComponentSystem, + pc.ParticleSystemComponentSystem, + pc.ScreenComponentSystem, + pc.ElementComponentSystem, + pc.ButtonComponentSystem, + pc.ScrollViewComponentSystem, + pc.ScrollbarComponentSystem, + pc.SpriteComponentSystem, + pc.LayoutGroupComponentSystem, + pc.LayoutChildComponentSystem, + pc.ZoneComponentSystem, + pc.GSplatComponentSystem, + ].filter(Boolean); + + createOptions.resourceHandlers = [ + pc.RenderHandler, + pc.AnimationHandler, + pc.AnimClipHandler, + pc.AnimStateGraphHandler, + pc.ModelHandler, + pc.MaterialHandler, + pc.TextureHandler, + pc.TextHandler, + pc.JsonHandler, + pc.AudioHandler, + pc.ScriptHandler, + pc.SceneHandler, + pc.CubemapHandler, + pc.HtmlHandler, + pc.CssHandler, + pc.ShaderHandler, + pc.HierarchyHandler, + pc.FolderHandler, + pc.FontHandler, + pc.BinaryHandler, + pc.TextureAtlasHandler, + pc.SpriteHandler, + pc.TemplateHandler, + pc.ContainerHandler, + pc.GSplatHandler, + ].filter(Boolean); + + createOptions.elementInput = new pc.ElementInput(canvas, { + useMouse: inputSettings.useMouse, + useTouch: inputSettings.useTouch, + }); + createOptions.keyboard = inputSettings.useKeyboard + ? new pc.Keyboard(window) + : null; + createOptions.mouse = inputSettings.useMouse ? new pc.Mouse(canvas) : null; + createOptions.gamepads = inputSettings.useGamepads + ? new pc.GamePads() + : null; + createOptions.touch = + inputSettings.useTouch && pc.platform.touch + ? new pc.TouchDevice(canvas) + : null; + createOptions.assetPrefix = window.ASSET_PREFIX || ''; + createOptions.scriptPrefix = window.SCRIPT_PREFIX || ''; + createOptions.scriptsOrder = window.SCRIPTS || []; + createOptions.soundManager = new pc.SoundManager(); + createOptions.lightmapper = pc.Lightmapper; + createOptions.batchManager = pc.BatchManager; + createOptions.xr = pc.XrManager; + + app.init(createOptions); + + return true; + } catch (e) { + displayError('Could not initialize application. Error: ' + e); + console.error(e); + return false; + } +} + +/** + * This retrieves the 3 properties in config.json: { application_properties, scenes, assets } THEN calls app.scenes.loadScene and app.start() + */ +function configureAndStart() { + + // app.configure(window.CONFIG_FILENAME, (err) => { + + // const props = response.application_properties; + const props = { + "i18nAssets": [], + "useTouch": true, + "layerOrder": [ + { + "layer": 0, + "enabled": true, + "transparent": false + }, + { + "layer": 1, + "enabled": true, + "transparent": false + }, + { + "layer": 2, + "enabled": true, + "transparent": false + }, + { + "layer": 0, + "enabled": true, + "transparent": true + }, + { + "layer": 3, + "enabled": true, + "transparent": false + }, + { + "layer": 3, + "enabled": true, + "transparent": true + }, + { + "layer": 4, + "enabled": true, + "transparent": true + } + ], + "externalScripts": [], + "height": 720, + "vr": false, + "useModelV2": false, + "antiAlias": true, + "layers": { + "0": { + "transparentSortMode": 3, + "opaqueSortMode": 2, + "name": "World" + }, + "1": { + "transparentSortMode": 3, + "opaqueSortMode": 2, + "name": "Depth" + }, + "2": { + "transparentSortMode": 3, + "opaqueSortMode": 0, + "name": "Skybox" + }, + "3": { + "transparentSortMode": 3, + "opaqueSortMode": 0, + "name": "Immediate" + }, + "4": { + "transparentSortMode": 1, + "opaqueSortMode": 1, + "name": "UI" + } + }, + "width": 1280, + "useDevicePixelRatio": true, + "useKeyboard": true, + "maxAssetRetries": 5, + "powerPreference": "high-performance", + "batchGroups": [], + "preserveDrawingBuffer": false, + "useLegacyScripts": false, + "enableSharedArrayBuffer": false, + "fillMode": "FILL_WINDOW", + "scripts": [], + "useMouse": true, + "use3dPhysics": false, + "transparentCanvas": false, + "resolutionMode": "AUTO", + "loadingScreenScript": null, + "preferWebGl2": true, + "useGamepads": false, + "deviceTypes": [ + "webgl2", + "webgl1" + ], + "libraries": [] + } + // const scenes = response.scenes; + const scenes = [ + { + "name": "Untitled", + "url": "2090341.json" + } + ] + // const assets = response.assets; + const assets = { + "199423271": { + "name": "sky", + "type": "cubemap", + "file": { + "filename": "sky.png", + "size": 147883, + "hash": "9a07d61f34e67a5e96fb6e579ce5c813", + "url": "files/assets/199423271/1/sky.png" + }, + "data": { + "name": "New Cubemap", + "textures": [ + 199423276, + 199423275, + 199423274, + 199423272, + 199423273, + 199423277 + ], + "minFilter": 5, + "magFilter": 1, + "anisotropy": 1, + "rgbm": true + }, + "preload": true, + "tags": [], + "i18n": {}, + "id": "199423271" + }, + "199423272": { + "name": "sky_negy.png", + "type": "texture", + "file": { + "filename": "sky_negy.png", + "hash": "ff5cfefbc0d5d485bf9a0b9a31b25810", + "size": 152642, + "variants": {}, + "url": "files/assets/199423272/1/sky_negy.png" + }, + "data": { + "addressu": "repeat", + "addressv": "repeat", + "minfilter": "linear_mip_linear", + "magfilter": "linear", + "anisotropy": 1, + "rgbm": true, + "mipmaps": true + }, + "preload": true, + "tags": [], + "i18n": {}, + "id": "199423272" + }, + "199423273": { + "name": "sky_posz.png", + "type": "texture", + "file": { + "filename": "sky_posz.png", + "hash": "53a9aab04b23a2e8f7be2d99115ca09d", + "size": 198593, + "variants": {}, + "url": "files/assets/199423273/1/sky_posz.png" + }, + "data": { + "addressu": "repeat", + "addressv": "repeat", + "minfilter": "linear_mip_linear", + "magfilter": "linear", + "anisotropy": 1, + "rgbm": true, + "mipmaps": true + }, + "preload": true, + "tags": [], + "i18n": {}, + "id": "199423273" + }, + "199423274": { + "name": "sky_posy.png", + "type": "texture", + "file": { + "filename": "sky_posy.png", + "hash": "f11af8966b2e0fe99e343108d777403d", + "size": 170046, + "variants": {}, + "url": "files/assets/199423274/1/sky_posy.png" + }, + "data": { + "addressu": "repeat", + "addressv": "repeat", + "minfilter": "linear_mip_linear", + "magfilter": "linear", + "anisotropy": 1, + "rgbm": true, + "mipmaps": true + }, + "preload": true, + "tags": [], + "i18n": {}, + "id": "199423274" + }, + "199423275": { + "name": "sky_negx.png", + "type": "texture", + "file": { + "filename": "sky_negx.png", + "hash": "34f64e48aa3125598094e24eeb02d574", + "size": 155167, + "variants": {}, + "url": "files/assets/199423275/1/sky_negx.png" + }, + "data": { + "addressu": "repeat", + "addressv": "repeat", + "minfilter": "linear_mip_linear", + "magfilter": "linear", + "anisotropy": 1, + "rgbm": true, + "mipmaps": true + }, + "preload": true, + "tags": [], + "i18n": {}, + "id": "199423275" + }, + "199423276": { + "name": "sky_posx.png", + "type": "texture", + "file": { + "filename": "sky_posx.png", + "hash": "bb45a6c2eed8c3763777eaed6f44527f", + "size": 172680, + "variants": {}, + "url": "files/assets/199423276/1/sky_posx.png" + }, + "data": { + "addressu": "repeat", + "addressv": "repeat", + "minfilter": "linear_mip_linear", + "magfilter": "linear", + "anisotropy": 1, + "rgbm": true, + "mipmaps": true + }, + "preload": true, + "tags": [], + "i18n": {}, + "id": "199423276" + }, + "199423277": { + "name": "sky_negz.png", + "type": "texture", + "file": { + "filename": "sky_negz.png", + "hash": "2be10e522c5e12bc0b791b48181895b9", + "size": 147065, + "variants": {}, + "url": "files/assets/199423277/1/sky_negz.png" + }, + "data": { + "addressu": "repeat", + "addressv": "repeat", + "minfilter": "linear_mip_linear", + "magfilter": "linear", + "anisotropy": 1, + "rgbm": true, + "mipmaps": true + }, + "preload": true, + "tags": [], + "i18n": {}, + "id": "199423277" + } + } + + // this inits a ton of (good?) settings from application_properties; keep this for now + app._parseApplicationProperties(props, (err) => { + // app._parseScenes(scenes); + // app._parseAssets(assets); + if (err) { + throw new Error(err) + } + + if (err) { + console.error(err); + return; + } + + initCSS(canvas, app._fillMode, app._width, app._height); + + if ( + LTC_MAT_1.length && + LTC_MAT_2.length && + app.setAreaLightLuts.length === 2 + ) { + app.setAreaLightLuts(LTC_MAT_1, LTC_MAT_2); + } + + // do the first reflow after a timeout because of + // iOS showing a squished iframe sometimes + setTimeout(() => { + pcBootstrap.reflow(app, canvas); + pcBootstrap.reflowHandler = function () { + pcBootstrap.reflow(app, canvas); + }; + + window.addEventListener('resize', pcBootstrap.reflowHandler, false); + window.addEventListener( + 'orientationchange', + pcBootstrap.reflowHandler, + false + ); + + // TODO add preloading after setting up assets + // app.preload(() => { + // TODO add in first scene loading + // app.scenes.loadScene(window.SCENE_PATH, (err) => { + // if (err) { + // console.error(err); + // return; + // } + + app.start(); + + if (window.location.href.includes("build")) { + setFillMode(pc.FILLMODE_NONE) + } else if (window.location.href.includes("play")) { + setFillMode(pc.FILLMODE_FILL_WINDOW) + } + + // }); + // }); + }); + }); +} + +function initEngine() { + if (typeof window === 'undefined') { + console.warn('initEngine called on the server side; returning'); + return; // Prevent the engine from initializing on the server side + } + const pcBootstrap = getPcBootstrap() + window.pcBootstrap = pcBootstrap; + lastWindowHeight = window.innerHeight; + lastWindowWidth = window.innerWidth; + windowSizeChangeIntervalHandler = null; + // NOTE: I moved this out of the initial execution of the file to avoid a race condition. There may be a way to speed up loading though to bootstrap most things on page load. The issue was that the document.getElementById to append the canvas was failing because the viewport wasn't loaded yet. + canvas = pcBootstrap.createCanvas(); + app = new pc.AppBase(canvas); + + createGraphicsDevice((device) => { + if (!device) { + return; + } + + if (!initApp(device)) { + return; + } + + if (window && window.PRELOAD_MODULES && window.PRELOAD_MODULES.length) { + loadModules(window.PRELOAD_MODULES, window.ASSET_PREFIX, () => { + configureAndStart(() => { + console.timeEnd('start'); + }); + }); + } else { + configureAndStart(); + } + }); + console.log('Completed initEngine()') + return app +} + + + +// update code called every frame +function setFillMode(mode) { + const canvas = app.graphicsDevice.canvas; + // if (this.app.keyboard.wasPressed(pc.KEY_1)) { + if (mode === pc.FILLMODE_FILL_WINDOW) { + updateCanvas(pc.FILLMODE_FILL_WINDOW); + } + + // if (this.app.keyboard.wasPressed(pc.KEY_2)) { + // Set the aspect ratio + if (mode === pc.FILLMODE_KEEP_ASPECT) { + canvas.width = 1280; + canvas.height = 720; + updateCanvas(pc.FILLMODE_KEEP_ASPECT); + } + + if (mode === pc.FILLMODE_NONE) { + canvas.width = 1000; + canvas.height = 500; + updateCanvas(pc.FILLMODE_NONE); + } +}; + + +function updateCanvas(fillMode) { + const previousFillMode = app.fillMode; + + app.setCanvasFillMode(fillMode); + const canvas = app.graphicsDevice.canvas; + + // Update the CSS style on the canvas + if (canvas.classList) { + canvas.classList.remove('fill-mode-' + previousFillMode); + canvas.classList.add('fill-mode-' + fillMode); + } + + // Invoke a resize from the boilerplate to move the canvas + // into the right place + pcBootstrap.resizeCanvas(app, canvas); + + // Have to correct the CSS due to bug in the pcBootstrap + if (fillMode === pc.FILLMODE_FILL_WINDOW) { + canvas.style.marginTop = ''; + } +}; + +export default initEngine diff --git a/mirror-2/components/engine/space-engine.utils.tsx b/mirror-2/components/engine/space-engine.utils.tsx new file mode 100644 index 00000000..31db2f66 --- /dev/null +++ b/mirror-2/components/engine/space-engine.utils.tsx @@ -0,0 +1,77 @@ +import { useAppSelector } from '@/hooks/hooks' +import { DatabaseEntity, useGetAllEntitiesQuery } from '@/state/api/entities' +import { useGetSingleSpaceQuery } from '@/state/api/spaces' +import { selectCurrentScene } from '@/state/local.slice' +import { skipToken } from '@reduxjs/toolkit/query' +import { useEffect, useState } from 'react' +import * as pc from 'playcanvas' +import { SceneId } from '@/state/api/scenes' +import { getApp } from '@/components/engine/__start-custom__' + +export const setUpSpace = ( + currentScene: SceneId, + entities: DatabaseEntity[] +) => { + // const [hasSetUpEntities, setHasSetUpEntities] = useState(false) + // const { + // data: space, + // error: spaceError, + // isSuccess: isSuccessGetSingleSpace, + // isLoading, + // isUninitialized, + // isError + // } = useGetSingleSpaceQuery(spaceId || skipToken) + // const currentScene = useAppSelector(selectCurrentScene) + // if (!currentScene) { + // return + // } + // const { data: entities, error } = useGetAllEntitiesQuery(currentScene.id) + + // useEffect(() => { + // only run setup once + // if (hasSetUpEntities) { + // return + // } + + // add the entities to the scene/engine + // if (entities && entities.length > 0) { + // Initialize PlayCanvas app + // const app = new pc.Application(document.getElementById('canvas'), {}); + const app = getApp() + // Create a camera + const camera = new pc.Entity('camera') + camera.addComponent('camera', { + clearColor: new pc.Color(0.1, 0.1, 0.1) + }) + camera.setPosition(0, 0, 3) + app.root.addChild(camera) + + // Create a directional light + const light = new pc.Entity('light') + light.addComponent('light', { + type: 'directional', + color: new pc.Color(1, 1, 1), + intensity: 1 + }) + light.setEulerAngles(45, 0, 0) + app.root.addChild(light) + + // Create a sphere + // const sphere = new pc.Entity('sphere') + // sphere.addComponent('model', { + // type: 'sphere' + // }) + // app.root.addChild(sphere) + + // Start the application + // app.start(); + + // Set up entities in the scene + // entities.forEach(entity => { + // // Add custom logic to set up each entity + // }); + + // setHasSetUpEntities(true) + // } + // }, [entities, hasSetUpEntities]) +} diff --git a/mirror-2/components/engine/space-viewport-from-pc-import.tsx b/mirror-2/components/engine/space-viewport-from-pc-import.tsx new file mode 100644 index 00000000..ca0f3274 --- /dev/null +++ b/mirror-2/components/engine/space-viewport-from-pc-import.tsx @@ -0,0 +1,140 @@ +'use client' + +import { cn } from '@/utils/cn' +import Script from 'next/script' +import * as pc from 'playcanvas' +import { useEffect, useRef, useState } from 'react' +import { createSupabaseBrowserClient } from '@/utils/supabase/client' +import { useAppSelector } from '@/hooks/hooks' +import { selectLocalUser } from '@/state/local.slice' + +import { + getASSET_PREFIXForLoadingEngineApp, + getBrowserScriptTagUrlForLoadingScriptsFromStorage, + getSCRIPT_PREFIXForLoadingEngineApp, + modifySettingsFileFromSupabase +} from '@/utils/space-pack' +import { + SPACE_PACKS_BUCKET_NAME, + useGetSingleSpacePackQuery +} from '@/state/api/space-packs' + +interface SpaceViewportProps { + spacePackId: number + mode?: 'build' | 'play' // Optional mode prop with default value 'play' +} + +export default function SpaceViewport({ + spacePackId, + mode = 'play' +}: SpaceViewportProps) { + const [isScriptReady, setIsScriptReady] = useState(false) + const [engineLoaded, setEngineLoaded] = useState(false) + const [settingsScriptUrl, setSettingsScriptUrl] = useState('') + const [modifiedSettingsFileText, setModifiedSettingsFileText] = useState('') + const [modulesScriptUrl, setModulesScriptUrl] = useState('') + const [importedConfigJsonUrl, setImportedConfigJsonUrl] = useState('') + const [hasLoadedExternalFiles, setHasLoadedExternalFiles] = useState(false) + const canvasRef = useRef(null) + const user = useAppSelector(selectLocalUser) + + const startScriptPath = `/scripts/__start-custom__.js` + const supabase = createSupabaseBrowserClient() + + useEffect(() => { + // // Ensure this runs only on the client-side + if (typeof window !== 'undefined' && !window['pc']) { + window['pc'] = pc // Declare global PlayCanvas variable + } + }, []) + + // Use RTK Query to fetch the list of filenames related to the spacePackId + const { data: spacePack, error: spacePackImportError } = + useGetSingleSpacePackQuery(spacePackId) + + useEffect(() => { + const loadScripts = async () => { + if (spacePack && !spacePackImportError && user) { + try { + const spacePackImportPath = `${user?.id}/${spacePack.id}` + + // get __settings__.js + const { data: settingsFile } = supabase.storage + .from(SPACE_PACKS_BUCKET_NAME) + .getPublicUrl(spacePackImportPath + '/__settings__.js') + setSettingsScriptUrl(settingsFile.publicUrl) + + const { data: configFile } = supabase.storage + .from(SPACE_PACKS_BUCKET_NAME) + .getPublicUrl(spacePackImportPath + '/config.json') + setImportedConfigJsonUrl(configFile.publicUrl) + + const spacePackBaseUrl = settingsFile.publicUrl.replace( + '/__settings__.js', + '/' + ) + + const modifiedSettingsContent = await modifySettingsFileFromSupabase( + settingsFile.publicUrl, // This is the URL you obtained from Supabase + spacePackBaseUrl, // Your asset prefix + spacePackBaseUrl, + configFile.publicUrl + ) + setModifiedSettingsFileText(modifiedSettingsContent) + + const { data: modulesFile } = supabase.storage + .from(SPACE_PACKS_BUCKET_NAME) + .getPublicUrl(spacePackImportPath + '/__modules__.js') + setModulesScriptUrl(modulesFile.publicUrl) + + setIsScriptReady(true) + setHasLoadedExternalFiles(true) + + // // // Ensure this runs only on the client-side + // if (typeof window !== 'undefined') { + // window['pc'] = pc // Declare global PlayCanvas variable + // } + } catch (error) { + console.error('Error loading external files:', error) + } + } else { + console.log('Did not retrieve spacePack yet') + } + } + + if (user?.id && spacePackId && !hasLoadedExternalFiles && spacePack) { + loadScripts() + } + }, [user, spacePackId, spacePack, spacePackImportError]) + + return ( + <> + {isScriptReady && settingsScriptUrl && modulesScriptUrl && ( + <> + {/* Load all the dynamic scripts from the project folder */} + + + + + + + + + diff --git a/mirror-2/public/sample/logo.png b/mirror-2/public/sample/logo.png new file mode 100644 index 00000000..bb25c220 Binary files /dev/null and b/mirror-2/public/sample/logo.png differ diff --git a/mirror-2/public/sample/manifest.json b/mirror-2/public/sample/manifest.json new file mode 100644 index 00000000..72fc3cfa --- /dev/null +++ b/mirror-2/public/sample/manifest.json @@ -0,0 +1,28 @@ +{ + "short_name": "Blank Project 2", + "name": "Blank Project 2", + "start_url": "", + "display": "fullscreen", + "icons": [ + { + "src": "thumbs/180.jpg", + "sizes": "180x180", + "type": "image/jpeg" + }, + { + "src": "thumbs/360.jpg", + "sizes": "360x360", + "type": "image/jpeg" + }, + { + "src": "thumbs/540.jpg", + "sizes": "540x540", + "type": "image/jpeg" + }, + { + "src": "thumbs/720.jpg", + "sizes": "720x720", + "type": "image/jpeg" + } + ] +} diff --git a/mirror-2/public/sample/playcanvas-stable.min.js b/mirror-2/public/sample/playcanvas-stable.min.js new file mode 100644 index 00000000..b1ef108e --- /dev/null +++ b/mirror-2/public/sample/playcanvas-stable.min.js @@ -0,0 +1,9 @@ +/** + * @license + * PlayCanvas Engine v1.74.0 revision aa4b13e (RELEASE) + * Copyright 2011-2024 PlayCanvas Ltd. All rights reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pc={})}(this,(function(t){var e="undefined"!=typeof document?document.currentScript:null;function i(t,e,i){t.prototype[e]||Object.defineProperty(t.prototype,e,{value:i,configurable:!0,enumerable:!1,writable:!0})}i(Array,"fill",(function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),i=e.length>>>0,n=arguments[1]|0,s=n<0?Math.max(i+n,0):Math.min(n,i),r=arguments[2],a=void 0===r?i:r|0,o=a<0?Math.max(i+a,0):Math.min(a,i);s>>0;if("function"!=typeof t)throw TypeError("predicate must be a function");for(var n=arguments[1],s=0;s>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],s=0;s0)-(t<0)||+t}),void 0===Number.isFinite&&(Number.isFinite=function(t){return"number"==typeof t&&isFinite(t)}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),n=1;nthis.length)&&(e=this.length),this.substring(e-t.length,e)===t})),i(String,"includes",(function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)})),i(String,"startsWith",(function(t,e){var i=e>0?0|e:0;return this.substring(i,i+t.length)===t})),i(String,"trimEnd",(function(){return this.replace(new RegExp(/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/.source+"$","g"),"")}));for(var n=0,s=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array];nt.length)&&(e=t.length);for(var i=0,n=Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){return y=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return s("end");if(a.tryLoc<=this.prev){var h=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(h&&l){if(this.prev=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),R(i),_}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var s=n.arg;R(i)}return s}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:D(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),_}},e}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function T(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}var w=function(){function t(){}return t.set=function(t,e){},t.get=function(e){return t._traceChannels.has(e)},t}();w._traceChannels=new Set,w.stack=!1;var E,A,C,M=function(){function t(t,e,i,n,s){void 0===s&&(s=!1),this.handler=void 0,this.name=void 0,this.callback=void 0,this.scope=void 0,this._once=void 0,this._removed=!1,this.handler=t,this.name=e,this.callback=i,this.scope=n,this._once=s}var e=t.prototype;return e.off=function(){this._removed||this.handler.off(this.name,this.callback,this.scope)},e.on=function(t,e,i){return void 0===i&&(i=this),this.handler._addCallback(t,e,i,!1)},e.once=function(t,e,i){return void 0===i&&(i=this),this.handler._addCallback(t,e,i,!0)},v(t,[{key:"removed",get:function(){return this._removed},set:function(t){t&&(this._removed=!0)}}])}(),P=function(){function t(){this._callbacks=new Map,this._callbackActive=new Map}var e=t.prototype;return e.initEventHandler=function(){this._callbacks=new Map,this._callbackActive=new Map},e._addCallback=function(t,e,i,n){if(this._callbacks.has(t)||this._callbacks.set(t,[]),this._callbackActive.has(t)){var s=this._callbackActive.get(t);s&&s===this._callbacks.get(t)&&this._callbackActive.set(t,s.slice())}var r=new M(this,t,e,i,n);return this._callbacks.get(t).push(r),r},e.on=function(t,e,i){return void 0===i&&(i=this),this._addCallback(t,e,i,!1)},e.once=function(t,e,i){return void 0===i&&(i=this),this._addCallback(t,e,i,!0)},e.off=function(t,e,i){if(t)this._callbackActive.has(t)&&this._callbackActive.get(t)===this._callbacks.get(t)&&this._callbackActive.set(t,this._callbackActive.get(t).slice());else for(var n,s=g(this._callbackActive);!(n=s()).done;){var r=n.value,a=r[0],o=r[1];this._callbacks.has(a)&&(this._callbacks.get(a)===o&&this._callbackActive.set(a,o.slice()))}if(t)if(e){var h=this._callbacks.get(t);if(!h)return this;for(var l=0;l0?r=r.slice(0,r.length-2):(a>0&&r.push(D.delimiter),r.push(n[a])));return s=r.join(""),e||s[0]!==D.delimiter||(s=s.slice(1)),i&&s[s.length-1]!==D.delimiter&&(s+=D.delimiter),s},split:function(t){var e=t.lastIndexOf(D.delimiter);return-1!==e?[t.substring(0,e),t.substring(e+1)]:["",t]},getBasename:function(t){return D.split(t)[1]},getDirectory:function(t){return D.split(t)[0]},getExtension:function(t){var e=t.split("?")[0].split(".").pop();return e!==t?"."+e:""},isRelativePath:function(t){return"/"!==t.charAt(0)&&null===t.match(/:\/\//)},extractPath:function(t){var e="",i=t.split("/"),n=0;if(i.length>1)if(D.isRelativePath(t))if("."===i[0])for(n=0;n0),U=!("browser"!==k||!navigator.getGamepads&&!navigator.webkitGetGamepads),z="undefined"!=typeof Worker,V=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t=!0,!1}});window.addEventListener("testpassive",null,e),window.removeEventListener("testpassive",null,e)}catch(t){}return t}(),G={name:O,environment:k,global:null!=(E=null!=(A=null!=(C="undefined"!=typeof globalThis&&globalThis)?C:"browser"===k&&window)?A:"node"===k&&global)?E:"worker"===k&&self,browser:"browser"===k,worker:"worker"===k,desktop:["windows","osx","linux","cros"].includes(O),mobile:["android","ios"].includes(O),ios:"ios"===O,android:"android"===O,xbox:B,gamepads:U,touch:N,workers:z,passiveEvents:V,browserName:F},H="abcdefghijklmnopqrstuvwxyz",W="ABCDEFGHIJKLMNOPQRSTUVWXYZ",X=55296,j=56319,q=56320,Y=57343,K=127462,Z=127487,Q=65024,J=65039;function $(t,e){void 0===e&&(e=0);var i=t.length;if(e<0||e>=i)return null;var n=t.charCodeAt(e);if(i>1&&n>=X&&n<=j){var s=t.charCodeAt(e+1);if(s>=q&&s<=Y)return{code:1024*(n-X)+s-q+65536,long:!0}}return{code:n,long:!1}}function tt(t,e,i){if(!t)return!1;var n=$(t);if(n){var s=n.code;return s>=e&&s<=i}return!1}function et(t,e){if(e===t.length-1)return 1;if(tt(t[e],X,j)){var i=t.substring(e,e+2),n=t.substring(e+2,e+4);return tt(n,127995,127999)||tt(i,K,Z)&&tt(n,K,Z)?4:tt(n,Q,J)?3:2}return tt(t[e+1],Q,J)?2:1}var it,nt,st,rt={ASCII_LOWERCASE:H,ASCII_UPPERCASE:W,ASCII_LETTERS:H+W,format:function(t){for(var e=0;e<(arguments.length<=1?0:arguments.length-1);e++)t=t.replace("{"+e+"}",e+1<1||arguments.length<=e+1?void 0:arguments[e+1]);return t},getCodePoint:function(t,e){var i=$(t,e);return i&&i.code},getCodePoints:function(t){if("string"!=typeof t)throw new TypeError("Not a string");for(var e,i=0,n=[];e=$(t,i);)n.push(e.code),i+=e.long?2:1;return n},getSymbols:function(t){if("string"!=typeof t)throw new TypeError("Not a string");for(var e,i=0,n=t.length,s=[],r=0;i65535?[55296+(e>>10),e%1024+56320]:[t],n.push(String.fromCharCode.apply(null,i));return n.join("")}},at=function(){function t(){this._list=[],this._index={}}var e=t.prototype;return e.push=function(t,e){if(this._index[t])throw Error("Key already in index "+t);var i=this._list.push(e)-1;this._index[t]=i},e.has=function(t){return void 0!==this._index[t]},e.get=function(t){var e=this._index[t];return void 0!==e?this._list[e]:null},e.remove=function(t){var e=this._index[t];if(void 0!==e){for(t in this._list.splice(e,1),delete this._index[t],this._index){var i=this._index[t];i>e&&(this._index[t]=i-1)}return!0}return!1},e.list=function(){return this._list},e.clear=function(){for(var t in this._list.length=0,this._index)delete this._index[t]},t}(),ot=function(){function t(){}return t.loadScript=function(t,e){var i=document.createElement("script");i.setAttribute("src",t),i.onload=function(){e(null)},i.onerror=function(){e("Failed to load script='"+t+"'")},document.body.appendChild(i)},t.loadWasm=function(e,i,n){var s=t.wasmSupported()&&i.glueUrl&&i.wasmUrl?i.glueUrl:i.fallbackUrl;s?t.loadScript(s,(function(t){if(t)n(t,null);else{var s=window[e];window[e]=void 0,s({locateFile:function(){return i.wasmUrl},onAbort:function(){n("wasm module aborted.")}}).then((function(t){n(null,t)}))}})):n("No supported wasm modules found.",null)},t.getModule=function(e){return t.modules.hasOwnProperty(e)||(t.modules[e]={config:null,initializing:!1,instance:null,callbacks:[]}),t.modules[e]},t.initialize=function(e,i){if(!i.initializing){var n=i.config;(n.glueUrl||n.wasmUrl||n.fallbackUrl)&&(i.initializing=!0,t.loadWasm(e,n,(function(t,s){t?n.errorHandler?n.errorHandler(t):console.error("failed to initialize module="+e+" error="+t):(i.instance=s,i.callbacks.forEach((function(t){t(s)})))})))}},t}();ot.modules={},ot.wasmSupported=(it=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1},st=nt={},function(){return st===nt&&(st=it()),st});var ht=function(){function t(){}return t.setConfig=function(t,e){var i=ot.getModule(t);i.config=e,i.callbacks.length>0&&ot.initialize(t,i)},t.getConfig=function(t){var e;return null==(e=ot.modules)||null==(e=e[t])?void 0:e.config},t.getInstance=function(t,e){var i=ot.getModule(t);i.instance?e(i.instance):(i.callbacks.push(e),i.config&&ot.initialize(t,i))},t}(),lt=function(){function t(t){this.arraybuffer=void 0,this.dataView=void 0,this.offset=0,this.arraybuffer=t,this.dataView=new DataView(t)}var e=t.prototype;return e.reset=function(t){void 0===t&&(t=0),this.offset=t},e.skip=function(t){this.offset+=t},e.align=function(t){this.offset=this.offset+t-1&~(t-1)},e._inc=function(t){return this.offset+=t,this.offset-t},e.readChar=function(){return String.fromCharCode(this.dataView.getUint8(this.offset++))},e.readChars=function(t){for(var e="",i=0;i=t.byteLength);){var i=String.fromCharCode(this.readU8());if("\n"===i)break;e+=i}return e},v(t,[{key:"remainingBytes",get:function(){return this.dataView.byteLength-this.offset}}])}(),ct=function(){function t(t){this.items=[],this.length=0,this.loopIndex=-1,this._sortBy=void 0,this._sortHandler=void 0,this._sortBy=t.sortBy,this._sortHandler=this._doSort.bind(this)}var e=t.prototype;return e._binarySearch=function(t){for(var e,i,n=0,s=this.items.length-1,r=t[this._sortBy];n<=s;)e=Math.floor((n+s)/2),(i=this.items[e][this._sortBy])<=r?n=e+1:i>r&&(s=e-1);return n},e._doSort=function(t,e){var i=this._sortBy;return t[i]-e[i]},e.insert=function(t){var e=this._binarySearch(t);this.items.splice(e,0,t),this.length++,this.loopIndex>=e&&this.loopIndex++},e.append=function(t){this.items.push(t),this.length++},e.remove=function(t){var e=this.items.indexOf(t);e<0||(this.items.splice(e,1),this.length--,this.loopIndex>=e&&this.loopIndex--)},e.sort=function(){var t=this.loopIndex>=0?this.items[this.loopIndex]:null;this.items.sort(this._sortHandler),null!==t&&(this.loopIndex=this.items.indexOf(t))},t}(),ut=function(t){function e(e){var i;return(i=t.call(this)||this)._index={},i._list=[],i._parent=e,i}x(e,t);var i=e.prototype;return i.add=function(){for(var t=!1,e=arguments.length,i=new Array(e),n=0;n=i?i:t<=e?e:t},intToBytes24:function(t){return[t>>16&255,t>>8&255,255&t]},intToBytes32:function(t){return[t>>24&255,t>>16&255,t>>8&255,255&t]},bytesToInt24:function(t,e,i){return t.length&&(i=t[2],e=t[1],t=t[0]),t<<16|e<<8|i},bytesToInt32:function(t,e,i,n){return t.length&&(n=t[3],i=t[2],e=t[1],t=t[0]),(t<<24|e<<16|i<<8|n)>>>0},lerp:function(t,e,i){return t+(e-t)*_t.clamp(i,0,1)},lerpAngle:function(t,e,i){return e-t>180&&(e-=360),e-t<-180&&(e+=360),_t.lerp(t,e,_t.clamp(i,0,1))},powerOfTwo:function(t){return 0!==t&&!(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.log(2)))},random:function(t,e){var i=e-t;return Math.random()*i+t},smoothstep:function(t,e,i){return i<=t?0:i>=e?1:(i=(i-t)/(e-t))*i*(3-2*i)},smootherstep:function(t,e,i){return i<=t?0:i>=e?1:(i=(i-t)/(e-t))*i*i*(i*(6*i-15)+10)},roundUp:function(t,e){return 0===e?t:Math.ceil(t/e)*e},between:function(t,e,i,n){var s=Math.min(e,i),r=Math.max(e,i);return n?t>=s&&t<=r:t>s&&t7?e=_t.intToBytes32(i):(e=_t.intToBytes24(i))[3]=255,this.set(e[0]/255,e[1]/255,e[2]/255,e[3]/255),this},e.toString=function(t){var e="#"+((1<<24)+(Math.round(255*this.r)<<16)+(Math.round(255*this.g)<<8)+Math.round(255*this.b)).toString(16).slice(1);if(!0===t){var i=Math.round(255*this.a).toString(16);this.a<16/255?e+="0"+i:e+=i}return e},t}();ft=vt,vt.BLACK=Object.freeze(new ft(0,0,0,1)),vt.BLUE=Object.freeze(new ft(0,0,1,1)),vt.CYAN=Object.freeze(new ft(0,1,1,1)),vt.GRAY=Object.freeze(new ft(.5,.5,.5,1)),vt.GREEN=Object.freeze(new ft(0,1,0,1)),vt.MAGENTA=Object.freeze(new ft(1,0,1,1)),vt.RED=Object.freeze(new ft(1,0,0,1)),vt.WHITE=Object.freeze(new ft(1,1,1,1)),vt.YELLOW=Object.freeze(new ft(1,1,0,1));var gt,yt,xt=function(){function t(t,e){void 0===e&&(e=0),this._curve=void 0,this._left=-1/0,this._right=1/0,this._recip=0,this._p0=0,this._p1=0,this._m0=0,this._m1=0,this._curve=t,this._reset(e)}var e=t.prototype;return e.evaluate=function(t,e){var i;void 0===e&&(e=!1),(e||t=this._right)&&this._reset(t);var n=this._curve.type;if(5===n)i=this._p0;else{var s=0===this._recip?0:(t-this._left)*this._recip;i=0===n?_t.lerp(this._p0,this._p1,s):1===n?_t.lerp(this._p0,this._p1,s*s*(3-2*s)):this._evaluateHermite(this._p0,this._p1,this._m0,this._m1,s)}return i},e._reset=function(t){var e=this._curve.keys,i=e.length;if(i)if(t=e[i-1][0])this._left=e[i-1][0],this._right=1/0,this._recip=0,this._p0=this._p1=e[i-1][1],this._m0=this._m1=0;else{for(var n=0;t>=e[n+1][0];)n++;this._left=e[n][0],this._right=e[n+1][0];var s=1/(this._right-this._left);this._recip=isFinite(s)?s:0,this._p0=e[n][1],this._p1=e[n+1][1],this._isHermite()&&this._calcTangents(e,n)}else this._left=-1/0,this._right=1/0,this._recip=0,this._p0=this._p1=this._m0=this._m1=0},e._isHermite=function(){return 2===this._curve.type||3===this._curve.type||4===this._curve.type},e._calcTangents=function(t,e){var i,n,s=t[e],r=t[e+1];if(i=0===e?[t[0][0]+(t[0][0]-t[1][0]),t[0][1]+(t[0][1]-t[1][1])]:t[e-1],n=e===t.length-2?[t[e+1][0]+(t[e+1][0]-t[e][0]),t[e+1][1]+(t[e+1][1]-t[e][1])]:t[e+2],4===this._curve.type){var a=2*(r[0]-s[0])/(r[0]-i[0]),o=2*(r[0]-s[0])/(n[0]-s[0]);this._m0=this._curve.tension*(isFinite(a)?a:0)*(r[1]-i[1]),this._m1=this._curve.tension*(isFinite(o)?o:0)*(n[1]-s[1])}else{var h=(r[0]-s[0])/(s[0]-i[0]),l=(r[0]-s[0])/(n[0]-r[0]),c=s[1]+(i[1]-s[1])*(isFinite(h)?h:0),u=r[1]+(n[1]-r[1])*(isFinite(l)?l:0),d=2===this._curve.type?.5:this._curve.tension;this._m0=d*(r[1]-c),this._m1=d*(u-s[1])}},e._evaluateHermite=function(t,e,i,n,s){var r=s*s,a=s+s,o=1-s,h=o*o;return t*((1+a)*h)+i*(s*h)+e*(r*(3-a))+n*(r*(s-1))},t}(),St=function(){function t(t){if(this.keys=[],this.type=1,this.tension=.5,this._eval=new xt(this),t)for(var e=0;et);s++);var r=[t,e];return this.keys.splice(s,0,r),r},e.get=function(t){return this.keys[t]},e.sort=function(){this.keys.sort((function(t,e){return t[0]-e[0]}))},e.value=function(t){return this._eval.evaluate(t,!0)},e.closest=function(t){for(var e=this.keys,i=e.length,n=2,s=null,r=0;r=a))break;n=a,s=e[r]}return s},e.clone=function(){var t=new this.constructor;return t.keys=this.keys.map((function(t){return[].concat(t)})),t.type=this.type,t.tension=this.tension,t},e.quantize=function(t){t=Math.max(t,2);var e=new Float32Array(t),i=1/(t-1);e[0]=this._eval.evaluate(0,!0);for(var n=1;n1)for(var t=0;t>16&32768,n=e>>12&2047,s=e>>23&255;return s<103?i:s>142?(i|=31744,i|=(255===s?0:1)&&8388607&e):s<113?i|=((n|=2048)>>114-s)+(n>>113-s&1):(i|=s-112<<10|n>>1,i+=1&n)},t.float2Bytes=function(t,e,i,n){var s=255*t%1;if(e[i+0]=Math.round(255*(t%1-Tt*s)),n>1){var r=65025*t%1;if(e[i+1]=Math.round(255*(s-Tt*r)),n>2){var a=16581375*t%1;e[i+2]=Math.round(255*(r-Tt*a)),n>3&&(e[i+3]=Math.round(255*a))}}},t.float2BytesRange=function(e,i,n,s,r,a){e=_t.clamp((e-s)/(r-s),0,1),t.float2Bytes(e,i,n,a)},t.float2MantissaExponent=function(e,i,n,s){var r=Math.floor(Math.log2(Math.abs(e)))+1;e/=Math.pow(2,r),t.float2BytesRange(e,i,n,-1,1,s-1),i[n+s-1]=Math.round(r+127)},t}(),Ct=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=void 0,this.y=void 0,this.z=void 0,3===t.length?(this.x=t[0],this.y=t[1],this.z=t[2]):(this.x=t,this.y=e,this.z=i)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.cross=function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-a*s,this.y=s*r-o*i,this.z=i*a-r*n,this},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+i*i+n*n)},e.div=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this.z=t.z/e.z,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this.z/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i,this.z=t.z*i}return this},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this.z=Math.floor(t.z),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this.z=Math.ceil(t.z),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this.z=Math.round(t.z),this},e.min=function(t){return t.xthis.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),this},e.project=function(t){var e=(this.x*t.x+this.y*t.y+this.z*t.z)/(t.x*t.x+t.y*t.y+t.z*t.z);return this.x=t.x*e,this.y=t.y*e,this.z=t.z*e,this},e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.toString=function(){return"["+this.x+", "+this.y+", "+this.z+"]"},t}();gt=Ct,Ct.ZERO=Object.freeze(new gt(0,0,0)),Ct.ONE=Object.freeze(new gt(1,1,1)),Ct.UP=Object.freeze(new gt(0,1,0)),Ct.DOWN=Object.freeze(new gt(0,-1,0)),Ct.RIGHT=Object.freeze(new gt(1,0,0)),Ct.LEFT=Object.freeze(new gt(-1,0,0)),Ct.FORWARD=Object.freeze(new gt(0,0,-1)),Ct.BACK=Object.freeze(new gt(0,0,1));var Mt,Pt=function(){function t(){this.data=new Float32Array(9),this.data[0]=this.data[4]=this.data[8]=1}var e=t.prototype;return e.clone=function(){return(new(0,this.constructor)).copy(this)},e.copy=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],this},e.set=function(t){var e=this.data;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},e.getX=function(t){return void 0===t&&(t=new Ct),t.set(this.data[0],this.data[1],this.data[2])},e.getY=function(t){return void 0===t&&(t=new Ct),t.set(this.data[3],this.data[4],this.data[5])},e.getZ=function(t){return void 0===t&&(t=new Ct),t.set(this.data[6],this.data[7],this.data[8])},e.equals=function(t){var e=this.data,i=t.data;return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]},e.isIdentity=function(){var t=this.data;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&1===t[4]&&0===t[5]&&0===t[6]&&0===t[7]&&1===t[8]},e.setIdentity=function(){var t=this.data;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},e.toString=function(){return"["+this.data.join(", ")+"]"},e.transpose=function(t){void 0===t&&(t=this);var e,i=t.data,n=this.data;i===n?(e=i[1],n[1]=i[3],n[3]=e,e=i[2],n[2]=i[6],n[6]=e,e=i[5],n[5]=i[7],n[7]=e):(n[0]=i[0],n[1]=i[3],n[2]=i[6],n[3]=i[1],n[4]=i[4],n[5]=i[7],n[6]=i[2],n[7]=i[5],n[8]=i[8]);return this},e.setFromMat4=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},e.setFromQuat=function(t){var e=t.x,i=t.y,n=t.z,s=t.w,r=e+e,a=i+i,o=n+n,h=e*r,l=e*a,c=e*o,u=i*a,d=i*o,f=n*o,p=s*r,m=s*a,_=s*o,v=this.data;return v[0]=1-(u+f),v[1]=l+_,v[2]=c-m,v[3]=l-_,v[4]=1-(h+f),v[5]=d+p,v[6]=c+m,v[7]=d-p,v[8]=1-(h+u),this},e.invertMat4=function(t){var e=t.data,i=e[0],n=e[1],s=e[2],r=e[4],a=e[5],o=e[6],h=e[8],l=e[9],c=e[10],u=c*a-o*l,d=-c*n+s*l,f=o*n-s*a,p=-c*r+o*h,m=c*i-s*h,_=-o*i+s*r,v=l*r-a*h,g=-l*i+n*h,y=a*i-n*r,x=i*u+n*p+s*v;if(0===x)this.setIdentity();else{var S=1/x,b=this.data;b[0]=u*S,b[1]=d*S,b[2]=f*S,b[3]=p*S,b[4]=m*S,b[5]=_*S,b[6]=v*S,b[7]=g*S,b[8]=y*S}return this},e.transformVector=function(t,e){void 0===e&&(e=new Ct);var i=this.data,n=t.x,s=t.y,r=t.z;return e.x=n*i[0]+s*i[3]+r*i[6],e.y=n*i[1]+s*i[4]+r*i[7],e.z=n*i[2]+s*i[5]+r*i[8],e},t}();yt=Pt,Pt.IDENTITY=Object.freeze(new yt),Pt.ZERO=Object.freeze((new yt).set([0,0,0,0,0,0,0,0,0]));var Rt,It=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=void 0,this.y=void 0,2===t.length?(this.x=t[0],this.y=t[1]):(this.x=t,this.y=e)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y)},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.div=function(t){return this.x/=t.x,this.y/=t.y,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i}return this},e.rotate=function(t){var e=Math.atan2(this.x,this.y)+t*_t.DEG_TO_RAD,i=Math.sqrt(this.x*this.x+this.y*this.y);return this.x=Math.sin(e)*i,this.y=Math.cos(e)*i,this},e.angle=function(){return Math.atan2(this.x,this.y)*_t.RAD_TO_DEG},e.angleTo=function(t){return Math.atan2(this.x*t.y+this.y*t.x,this.x*t.x+this.y*t.y)*_t.RAD_TO_DEG},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this},e.min=function(t){return t.xthis.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),this},e.set=function(t,e){return this.x=t,this.y=e,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this},e.toString=function(){return"["+this.x+", "+this.y+"]"},t.angleRad=function(t,e){return Math.atan2(t.x*e.y-t.y*e.x,t.x*e.x+t.y*e.y)},t}();Mt=It,It.ZERO=Object.freeze(new Mt(0,0)),It.ONE=Object.freeze(new Mt(1,1)),It.UP=Object.freeze(new Mt(0,1)),It.DOWN=Object.freeze(new Mt(0,-1)),It.RIGHT=Object.freeze(new Mt(1,0)),It.LEFT=Object.freeze(new Mt(-1,0));var Dt,Lt=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=void 0,this.y=void 0,this.z=void 0,this.w=void 0,4===t.length?(this.x=t[0],this.y=t[1],this.z=t[2],this.w=t[3]):(this.x=t,this.y=e,this.z=i,this.w=n)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z,this.w)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.div=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this.z=t.z/e.z,this.w=t.w/e.w,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this.z/=t,this.w/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i,this.z=t.z*i,this.w=t.w*i}return this},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this.z=Math.floor(t.z),this.w=Math.floor(t.w),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this.z=Math.ceil(t.z),this.w=Math.ceil(t.w),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this.z=Math.round(t.z),this.w=Math.round(t.w),this},e.min=function(t){return t.xthis.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),t.w>this.w&&(this.w=t.w),this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},e.toString=function(){return"["+this.x+", "+this.y+", "+this.z+", "+this.w+"]"},t}();Rt=Lt,Lt.ZERO=Object.freeze(new Rt(0,0,0,0)),Lt.ONE=Object.freeze(new Rt(1,1,1,1));var kt,Ot=new It,Ft=new Ct,Bt=new Ct,Nt=new Ct,Ut=new Ct,zt=function(){function t(){this.data=new Float32Array(16),this.data[0]=this.data[5]=this.data[10]=this.data[15]=1}t._getPerspectiveHalfSize=function(t,e,i,n,s){s?(t.x=n*Math.tan(e*Math.PI/360),t.y=t.x/i):(t.y=n*Math.tan(e*Math.PI/360),t.x=t.y*i)};var e=t.prototype;return e.add2=function(t,e){var i=t.data,n=e.data,s=this.data;return s[0]=i[0]+n[0],s[1]=i[1]+n[1],s[2]=i[2]+n[2],s[3]=i[3]+n[3],s[4]=i[4]+n[4],s[5]=i[5]+n[5],s[6]=i[6]+n[6],s[7]=i[7]+n[7],s[8]=i[8]+n[8],s[9]=i[9]+n[9],s[10]=i[10]+n[10],s[11]=i[11]+n[11],s[12]=i[12]+n[12],s[13]=i[13]+n[13],s[14]=i[14]+n[14],s[15]=i[15]+n[15],this},e.add=function(t){return this.add2(this,t)},e.clone=function(){return(new(0,this.constructor)).copy(this)},e.copy=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],this},e.equals=function(t){var e=this.data,i=t.data;return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]&&e[9]===i[9]&&e[10]===i[10]&&e[11]===i[11]&&e[12]===i[12]&&e[13]===i[13]&&e[14]===i[14]&&e[15]===i[15]},e.isIdentity=function(){var t=this.data;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]},e.mul2=function(t,e){var i,n,s,r,a=t.data,o=e.data,h=this.data,l=a[0],c=a[1],u=a[2],d=a[3],f=a[4],p=a[5],m=a[6],_=a[7],v=a[8],g=a[9],y=a[10],x=a[11],S=a[12],b=a[13],T=a[14],w=a[15];return i=o[0],n=o[1],s=o[2],r=o[3],h[0]=l*i+f*n+v*s+S*r,h[1]=c*i+p*n+g*s+b*r,h[2]=u*i+m*n+y*s+T*r,h[3]=d*i+_*n+x*s+w*r,i=o[4],n=o[5],s=o[6],r=o[7],h[4]=l*i+f*n+v*s+S*r,h[5]=c*i+p*n+g*s+b*r,h[6]=u*i+m*n+y*s+T*r,h[7]=d*i+_*n+x*s+w*r,i=o[8],n=o[9],s=o[10],r=o[11],h[8]=l*i+f*n+v*s+S*r,h[9]=c*i+p*n+g*s+b*r,h[10]=u*i+m*n+y*s+T*r,h[11]=d*i+_*n+x*s+w*r,i=o[12],n=o[13],s=o[14],r=o[15],h[12]=l*i+f*n+v*s+S*r,h[13]=c*i+p*n+g*s+b*r,h[14]=u*i+m*n+y*s+T*r,h[15]=d*i+_*n+x*s+w*r,this},e.mulAffine2=function(t,e){var i,n,s,r=t.data,a=e.data,o=this.data,h=r[0],l=r[1],c=r[2],u=r[4],d=r[5],f=r[6],p=r[8],m=r[9],_=r[10],v=r[12],g=r[13],y=r[14];return i=a[0],n=a[1],s=a[2],o[0]=h*i+u*n+p*s,o[1]=l*i+d*n+m*s,o[2]=c*i+f*n+_*s,o[3]=0,i=a[4],n=a[5],s=a[6],o[4]=h*i+u*n+p*s,o[5]=l*i+d*n+m*s,o[6]=c*i+f*n+_*s,o[7]=0,i=a[8],n=a[9],s=a[10],o[8]=h*i+u*n+p*s,o[9]=l*i+d*n+m*s,o[10]=c*i+f*n+_*s,o[11]=0,i=a[12],n=a[13],s=a[14],o[12]=h*i+u*n+p*s+v,o[13]=l*i+d*n+m*s+g,o[14]=c*i+f*n+_*s+y,o[15]=1,this},e.mul=function(t){return this.mul2(this,t)},e.transformPoint=function(t,e){void 0===e&&(e=new Ct);var i=this.data,n=t.x,s=t.y,r=t.z;return e.x=n*i[0]+s*i[4]+r*i[8]+i[12],e.y=n*i[1]+s*i[5]+r*i[9]+i[13],e.z=n*i[2]+s*i[6]+r*i[10]+i[14],e},e.transformVector=function(t,e){void 0===e&&(e=new Ct);var i=this.data,n=t.x,s=t.y,r=t.z;return e.x=n*i[0]+s*i[4]+r*i[8],e.y=n*i[1]+s*i[5]+r*i[9],e.z=n*i[2]+s*i[6]+r*i[10],e},e.transformVec4=function(t,e){void 0===e&&(e=new Lt);var i=this.data,n=t.x,s=t.y,r=t.z,a=t.w;return e.x=n*i[0]+s*i[4]+r*i[8]+a*i[12],e.y=n*i[1]+s*i[5]+r*i[9]+a*i[13],e.z=n*i[2]+s*i[6]+r*i[10]+a*i[14],e.w=n*i[3]+s*i[7]+r*i[11]+a*i[15],e},e.setLookAt=function(t,e,i){Nt.sub2(t,e).normalize(),Bt.copy(i).normalize(),Ft.cross(Bt,Nt).normalize(),Bt.cross(Nt,Ft);var n=this.data;return n[0]=Ft.x,n[1]=Ft.y,n[2]=Ft.z,n[3]=0,n[4]=Bt.x,n[5]=Bt.y,n[6]=Bt.z,n[7]=0,n[8]=Nt.x,n[9]=Nt.y,n[10]=Nt.z,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},e.setFrustum=function(t,e,i,n,s,r){var a=2*s,o=e-t,h=n-i,l=r-s,c=this.data;return c[0]=a/o,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=a/h,c[6]=0,c[7]=0,c[8]=(e+t)/o,c[9]=(n+i)/h,c[10]=(-r-s)/l,c[11]=-1,c[12]=0,c[13]=0,c[14]=-a*r/l,c[15]=0,this},e.setPerspective=function(e,i,n,s,r){return t._getPerspectiveHalfSize(Ot,e,i,n,r),this.setFrustum(-Ot.x,Ot.x,-Ot.y,Ot.y,n,s)},e.setOrtho=function(t,e,i,n,s,r){var a=this.data;return a[0]=2/(e-t),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(n-i),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=-2/(r-s),a[11]=0,a[12]=-(e+t)/(e-t),a[13]=-(n+i)/(n-i),a[14]=-(r+s)/(r-s),a[15]=1,this},e.setFromAxisAngle=function(t,e){e*=_t.DEG_TO_RAD;var i=t.x,n=t.y,s=t.z,r=Math.cos(e),a=Math.sin(e),o=1-r,h=o*i,l=o*n,c=this.data;return c[0]=h*i+r,c[1]=h*n+a*s,c[2]=h*s-a*n,c[3]=0,c[4]=h*n-a*s,c[5]=l*n+r,c[6]=l*s+a*i,c[7]=0,c[8]=h*s+a*n,c[9]=l*s-i*a,c[10]=o*s*s+r,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,this},e.setTranslate=function(t,e,i){var n=this.data;return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=t,n[13]=e,n[14]=i,n[15]=1,this},e.setScale=function(t,e,i){var n=this.data;return n[0]=t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=i,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},e.setViewport=function(t,e,i,n){var s=this.data;return s[0]=.5*i,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=.5*n,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=.5,s[11]=0,s[12]=t+.5*i,s[13]=e+.5*n,s[14]=.5,s[15]=1,this},e.setReflection=function(t,e){var i=t.x,n=t.y,s=t.z,r=this.data;return r[0]=1-2*i*i,r[1]=-2*i*n,r[2]=-2*i*s,r[3]=0,r[4]=-2*i*n,r[5]=1-2*n*n,r[6]=-2*n*s,r[7]=0,r[8]=-2*i*s,r[9]=-2*n*s,r[10]=1-2*s*s,r[11]=0,r[12]=-2*i*e,r[13]=-2*n*e,r[14]=-2*s*e,r[15]=1,this},e.invert=function(t){void 0===t&&(t=this);var e=t.data,i=e[0],n=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],l=e[7],c=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],_=e[14],v=e[15],g=i*o-n*a,y=i*h-s*a,x=i*l-r*a,S=n*h-s*o,b=n*l-r*o,T=s*l-r*h,w=c*m-u*p,E=c*_-d*p,A=c*v-f*p,C=u*_-d*m,M=u*v-f*m,P=d*v-f*_,R=g*P-y*M+x*C+S*A-b*E+T*w;if(0===R)this.setIdentity();else{var I=1/R,D=this.data;D[0]=(o*P-h*M+l*C)*I,D[1]=(-n*P+s*M-r*C)*I,D[2]=(m*T-_*b+v*S)*I,D[3]=(-u*T+d*b-f*S)*I,D[4]=(-a*P+h*A-l*E)*I,D[5]=(i*P-s*A+r*E)*I,D[6]=(-p*T+_*x-v*y)*I,D[7]=(c*T-d*x+f*y)*I,D[8]=(a*M-o*A+l*w)*I,D[9]=(-i*M+n*A-r*w)*I,D[10]=(p*b-m*x+v*g)*I,D[11]=(-c*b+u*x-f*g)*I,D[12]=(-a*C+o*E-h*w)*I,D[13]=(i*C-n*E+s*w)*I,D[14]=(-p*S+m*y-_*g)*I,D[15]=(c*S-u*y+d*g)*I}return this},e.set=function(t){var e=this.data;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this},e.setIdentity=function(){var t=this.data;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},e.setTRS=function(t,e,i){var n=e.x,s=e.y,r=e.z,a=e.w,o=i.x,h=i.y,l=i.z,c=n+n,u=s+s,d=r+r,f=n*c,p=n*u,m=n*d,_=s*u,v=s*d,g=r*d,y=a*c,x=a*u,S=a*d,b=this.data;return b[0]=(1-(_+g))*o,b[1]=(p+S)*o,b[2]=(m-x)*o,b[3]=0,b[4]=(p-S)*h,b[5]=(1-(f+g))*h,b[6]=(v+y)*h,b[7]=0,b[8]=(m+x)*l,b[9]=(v-y)*l,b[10]=(1-(f+_))*l,b[11]=0,b[12]=t.x,b[13]=t.y,b[14]=t.z,b[15]=1,this},e.transpose=function(t){void 0===t&&(t=this);var e,i=t.data,n=this.data;i===n?(e=i[1],n[1]=i[4],n[4]=e,e=i[2],n[2]=i[8],n[8]=e,e=i[3],n[3]=i[12],n[12]=e,e=i[6],n[6]=i[9],n[9]=e,e=i[7],n[7]=i[13],n[13]=e,e=i[11],n[11]=i[14],n[14]=e):(n[0]=i[0],n[1]=i[4],n[2]=i[8],n[3]=i[12],n[4]=i[1],n[5]=i[5],n[6]=i[9],n[7]=i[13],n[8]=i[2],n[9]=i[6],n[10]=i[10],n[11]=i[14],n[12]=i[3],n[13]=i[7],n[14]=i[11],n[15]=i[15]);return this},e.getTranslation=function(t){return void 0===t&&(t=new Ct),t.set(this.data[12],this.data[13],this.data[14])},e.getX=function(t){return void 0===t&&(t=new Ct),t.set(this.data[0],this.data[1],this.data[2])},e.getY=function(t){return void 0===t&&(t=new Ct),t.set(this.data[4],this.data[5],this.data[6])},e.getZ=function(t){return void 0===t&&(t=new Ct),t.set(this.data[8],this.data[9],this.data[10])},e.getScale=function(t){return void 0===t&&(t=new Ct),this.getX(Ft),this.getY(Bt),this.getZ(Nt),t.set(Ft.length(),Bt.length(),Nt.length()),t},e.setFromEulerAngles=function(t,e,i){t*=_t.DEG_TO_RAD,e*=_t.DEG_TO_RAD,i*=_t.DEG_TO_RAD;var n=Math.sin(-t),s=Math.cos(-t),r=Math.sin(-e),a=Math.cos(-e),o=Math.sin(-i),h=Math.cos(-i),l=this.data;return l[0]=a*h,l[1]=-a*o,l[2]=r,l[3]=0,l[4]=s*o+h*n*r,l[5]=s*h-n*r*o,l[6]=-a*n,l[7]=0,l[8]=n*o-s*h*r,l[9]=h*n+s*r*o,l[10]=s*a,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this},e.getEulerAngles=function(t){void 0===t&&(t=new Ct),this.getScale(Ut);var e=Ut.x,i=Ut.y,n=Ut.z;if(0===e||0===i||0===n)return t.set(0,0,0);var s,r,a=this.data,o=Math.asin(-a[2]/e),h=.5*Math.PI;return o-h?(s=Math.atan2(a[6]/i,a[10]/n),r=Math.atan2(a[1]/e,a[0]/e)):(r=0,s=-Math.atan2(a[4]/i,a[5]/i)):(r=0,s=Math.atan2(a[4]/i,a[5]/i)),t.set(s,o,r).mulScalar(_t.RAD_TO_DEG)},e.toString=function(){return"["+this.data.join(", ")+"]"},v(t,[{key:"scaleSign",get:function(){return this.getX(Ft),this.getY(Bt),this.getZ(Nt),Ft.cross(Ft,Bt),Ft.dot(Nt)<0?-1:1}}])}();Dt=zt,zt.IDENTITY=Object.freeze(new Dt),zt.ZERO=Object.freeze((new Dt).set([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));var Vt=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this.x=void 0,this.y=void 0,this.z=void 0,this.w=void 0,4===t.length?(this.x=t[0],this.y=t[1],this.z=t[2],this.w=t[3]):(this.x=t,this.y=e,this.z=i,this.w=n)}var e=t.prototype;return e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z,this.w)},e.conjugate=function(t){return void 0===t&&(t=this),this.x=-1*t.x,this.y=-1*t.y,this.z=-1*t.z,this.w=t.w,this},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)=.99999?(e=2*Math.atan2(s,o),i=Math.PI/2,n=0):(e=Math.atan2(2*(o*s+r*a),1-2*(s*s+r*r)),i=Math.asin(h),n=Math.atan2(2*(o*a+s*r),1-2*(r*r+a*a))),t.set(e,i,n).mulScalar(_t.RAD_TO_DEG)},e.invert=function(t){return void 0===t&&(t=this),this.conjugate(t).normalize()},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.mul=function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.x,a=t.y,o=t.z,h=t.w;return this.x=s*r+e*h+i*o-n*a,this.y=s*a+i*h+n*r-e*o,this.z=s*o+n*h+e*a-i*r,this.w=s*h-e*r-i*a-n*o,this},e.mulScalar=function(t,e){return void 0===e&&(e=this),this.x=e.x*t,this.y=e.y*t,this.z=e.z*t,this.w=e.w*t,this},e.mul2=function(t,e){var i=t.x,n=t.y,s=t.z,r=t.w,a=e.x,o=e.y,h=e.z,l=e.w;return this.x=r*a+i*l+n*h-s*o,this.y=r*o+n*l+s*a-i*h,this.z=r*h+s*l+i*o-n*a,this.w=r*l-i*a-n*o-s*h,this},e.normalize=function(t){void 0===t&&(t=this);var e=t.length();return 0===e?(this.x=this.y=this.z=0,this.w=1):(e=1/e,this.x=t.x*e,this.y=t.y*e,this.z=t.z*e,this.w=t.w*e),this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},e.setFromAxisAngle=function(t,e){e*=.5*_t.DEG_TO_RAD;var i=Math.sin(e),n=Math.cos(e);return this.x=i*t.x,this.y=i*t.y,this.z=i*t.z,this.w=n,this},e.setFromEulerAngles=function(t,e,i){if(t instanceof Ct){var n=t;t=n.x,e=n.y,i=n.z}var s=.5*_t.DEG_TO_RAD;t*=s,e*=s,i*=s;var r=Math.sin(t),a=Math.cos(t),o=Math.sin(e),h=Math.cos(e),l=Math.sin(i),c=Math.cos(i);return this.x=r*h*c-a*o*l,this.y=a*o*c+r*h*l,this.z=a*h*l-r*o*c,this.w=a*h*c+r*o*l,this},e.setFromMat4=function(t){var e,i=t.data,n=i[0],s=i[1],r=i[2],a=i[4],o=i[5],h=i[6],l=i[8],c=i[9],u=i[10];return 0===(e=n*n+s*s+r*r)?this.set(0,0,0,1):(n*=e=1/Math.sqrt(e),s*=e,r*=e,0===(e=a*a+o*o+h*h)?this.set(0,0,0,1):(a*=e=1/Math.sqrt(e),o*=e,h*=e,0===(e=l*l+c*c+u*u)?this.set(0,0,0,1):(l*=e=1/Math.sqrt(e),c*=e,(u*=e)<0?n>o?this.set(1+n-o-u,s+a,l+r,h-c):this.set(s+a,1-n+o-u,h+c,l-r):n<-o?this.set(l+r,h+c,1-n-o+u,s-a):this.set(h-c,l-r,s-a,1+n+o+u),this.mulScalar(1/this.length()))))},e.setFromDirections=function(t,e){var i=1+t.dot(e);return iMath.abs(t.y)?(this.x=-t.z,this.y=0,this.z=t.x,this.w=0):(this.x=0,this.y=-t.z,this.z=t.y,this.w=0):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=i),this.normalize()},e.slerp=function(t,e,i){var n=t.x,s=t.y,r=t.z,a=t.w,o=e.x,h=e.y,l=e.z,c=e.w,u=a*c+n*o+s*h+r*l;if(u<0&&(c=-c,o=-o,h=-h,l=-l,u=-u),Math.abs(u)>=1)return this.w=a,this.x=n,this.y=s,this.z=r,this;var d=Math.acos(u),f=Math.sqrt(1-u*u);if(Math.abs(f)<.001)return this.w=.5*a+.5*c,this.x=.5*n+.5*o,this.y=.5*s+.5*h,this.z=.5*r+.5*l,this;var p=Math.sin((1-i)*d)/f,m=Math.sin(i*d)/f;return this.w=a*p+c*m,this.x=n*p+o*m,this.y=s*p+h*m,this.z=r*p+l*m,this},e.transformVector=function(t,e){void 0===e&&(e=new Ct);var i=t.x,n=t.y,s=t.z,r=this.x,a=this.y,o=this.z,h=this.w,l=h*i+a*s-o*n,c=h*n+o*i-r*s,u=h*s+r*n-a*i,d=-r*i-a*n-o*s;return e.x=l*h+d*-r+c*-o-u*-a,e.y=c*h+d*-a+u*-r-l*-o,e.z=u*h+d*-o+l*-a-c*-r,e},e.toString=function(){return"["+this.x+", "+this.y+", "+this.z+", "+this.w+"]"},t}();kt=Vt,Vt.IDENTITY=Object.freeze(new kt(0,0,0,1)),Vt.ZERO=Object.freeze(new kt(0,0,0,0));var Gt=new Ct,Ht=new Ct,Wt=new Ct,Xt=new Ct,jt=new Ct,qt=function(){function t(t,e){void 0===t&&(t=new Ct),void 0===e&&(e=new Ct(.5,.5,.5)),this.center=void 0,this.halfExtents=void 0,this._min=new Ct,this._max=new Ct,this.center=t,this.halfExtents=e}var e=t.prototype;return e.add=function(t){var e=this.center,i=e.x,n=e.y,s=e.z,r=this.halfExtents,a=r.x,o=r.y,h=r.z,l=i-a,c=i+a,u=n-o,d=n+o,f=s-h,p=s+h,m=t.center,_=m.x,v=m.y,g=m.z,y=t.halfExtents,x=y.x,S=y.y,b=y.z,T=_-x,w=_+x,E=v-S,A=v+S,C=g-b,M=g+b;Tc&&(c=w),Ed&&(d=A),Cp&&(p=M),e.x=.5*(l+c),e.y=.5*(u+d),e.z=.5*(f+p),r.x=.5*(c-l),r.y=.5*(d-u),r.z=.5*(p-f)},e.copy=function(t){this.center.copy(t.center),this.halfExtents.copy(t.halfExtents)},e.clone=function(){return new t(this.center.clone(),this.halfExtents.clone())},e.intersects=function(t){var e=this.getMax(),i=this.getMin(),n=t.getMax(),s=t.getMin();return i.x<=n.x&&e.x>=s.x&&i.y<=n.y&&e.y>=s.y&&i.z<=n.z&&e.z>=s.z},e._intersectsRay=function(t,e){var i=Gt.copy(this.getMin()).sub(t.origin),n=Ht.copy(this.getMax()).sub(t.origin),s=t.direction;0===s.x?(i.x=i.x<0?-Number.MAX_VALUE:Number.MAX_VALUE,n.x=n.x<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.x/=s.x,n.x/=s.x),0===s.y?(i.y=i.y<0?-Number.MAX_VALUE:Number.MAX_VALUE,n.y=n.y<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.y/=s.y,n.y/=s.y),0===s.z?(i.z=i.z<0?-Number.MAX_VALUE:Number.MAX_VALUE,n.z=n.z<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.z/=s.z,n.z/=s.z);var r=Wt.set(Math.min(i.x,n.x),Math.min(i.y,n.y),Math.min(i.z,n.z)),a=Xt.set(Math.max(i.x,n.x),Math.max(i.y,n.y),Math.max(i.z,n.z)),o=Math.min(Math.min(a.x,a.y),a.z),h=Math.max(Math.max(r.x,r.y),r.z),l=o>=h&&h>=0;return l&&e.copy(t.direction).mulScalar(h).add(t.origin),l},e._fastIntersectsRay=function(t){var e=Gt,i=Ht,n=Wt,s=Xt,r=jt,a=t.direction;return e.sub2(t.origin,this.center),s.set(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z)),n.mul2(e,a),!(s.x>this.halfExtents.x&&n.x>=0)&&(!(s.y>this.halfExtents.y&&n.y>=0)&&(!(s.z>this.halfExtents.z&&n.z>=0)&&(r.set(Math.abs(a.x),Math.abs(a.y),Math.abs(a.z)),i.cross(a,e),i.set(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z)),!(i.x>this.halfExtents.y*r.z+this.halfExtents.z*r.y)&&(!(i.y>this.halfExtents.x*r.z+this.halfExtents.z*r.x)&&!(i.z>this.halfExtents.x*r.y+this.halfExtents.y*r.x)))))},e.intersectsRay=function(t,e){return e?this._intersectsRay(t,e):this._fastIntersectsRay(t)},e.setMinMax=function(t,e){this.center.add2(e,t).mulScalar(.5),this.halfExtents.sub2(e,t).mulScalar(.5)},e.getMin=function(){return this._min.copy(this.center).sub(this.halfExtents)},e.getMax=function(){return this._max.copy(this.center).add(this.halfExtents)},e.containsPoint=function(t){var e=this.getMin(),i=this.getMax();return!(t.xi.x||t.yi.y||t.zi.z)},e.setFromTransformedAabb=function(t,e,i){void 0===i&&(i=!1);var n=t.center,s=t.halfExtents,r=e.data,a=r[0],o=r[4],h=r[8],l=r[1],c=r[5],u=r[9],d=r[2],f=r[6],p=r[10];if(i){var m=a*a+o*o+h*h;if(m>0){var _=1/Math.sqrt(m);a*=_,o*=_,h*=_}if((m=l*l+c*c+u*u)>0){var v=1/Math.sqrt(m);l*=v,c*=v,u*=v}if((m=d*d+f*f+p*p)>0){var g=1/Math.sqrt(m);d*=g,f*=g,p*=g}}this.center.set(r[12]+a*n.x+o*n.y+h*n.z,r[13]+l*n.x+c*n.y+u*n.z,r[14]+d*n.x+f*n.y+p*n.z),this.halfExtents.set(Math.abs(a)*s.x+Math.abs(o)*s.y+Math.abs(h)*s.z,Math.abs(l)*s.x+Math.abs(c)*s.y+Math.abs(u)*s.z,Math.abs(d)*s.x+Math.abs(f)*s.y+Math.abs(p)*s.z)},t.computeMinMax=function(t,e,i,n){if(void 0===n&&(n=t.length/3),n>0){for(var s=t[0],r=t[1],a=t[2],o=s,h=r,l=a,c=3*n,u=3;uo&&(o=d),f>h&&(h=f),p>l&&(l=p)}e.set(s,r,a),i.set(o,h,l)}},e.compute=function(e,i){t.computeMinMax(e,Gt,Ht,i),this.setMinMax(Gt,Ht)},e.intersectsBoundingSphere=function(t){return this._distanceToBoundingSphereSq(t)<=t.radius*t.radius},e._distanceToBoundingSphereSq=function(t){for(var e=this.getMin(),i=this.getMax(),n=0,s=["x","y","z"],r=0;r<3;++r){var a=0,o=t.center[s[r]],h=e[s[r]],l=i[s[r]],c=0;ol&&(a+=(c=o-l)*c),n+=a}return n},e._expand=function(t,e){Gt.add2(this.getMin(),t),Ht.add2(this.getMax(),e),this.setMinMax(Gt,Ht)},t}(),Yt=new Ct,Kt=new Ct,Zt=function(){function t(t,e){void 0===t&&(t=new Ct),void 0===e&&(e=.5),this.center=void 0,this.radius=void 0,this.center=t,this.radius=e}var e=t.prototype;return e.containsPoint=function(t){var e=Yt.sub2(t,this.center).lengthSq(),i=this.radius;return e0&&n>0)return!1;var r=n*n-s;if(r<0)return!1;var a=Math.abs(-n-Math.sqrt(r));return e&&e.copy(t.direction).mulScalar(a).add(t.origin),!0},e.intersectsBoundingSphere=function(t){Yt.sub2(t.center,this.center);var e=t.radius+this.radius;return Yt.lengthSq()<=e*e},t}(),Qt=function(){function t(){this.planes=[];for(var t=0;t<6;t++)this.planes[t]=[]}var e=t.prototype;return e.setFromMat4=function(t){var e,i=t.data,n=this.planes;(e=n[0])[0]=i[3]-i[0],e[1]=i[7]-i[4],e[2]=i[11]-i[8],e[3]=i[15]-i[12];var s=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=s,e[1]/=s,e[2]/=s,e[3]/=s,(e=n[1])[0]=i[3]+i[0],e[1]=i[7]+i[4],e[2]=i[11]+i[8],e[3]=i[15]+i[12],s=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=s,e[1]/=s,e[2]/=s,e[3]/=s,(e=n[2])[0]=i[3]+i[1],e[1]=i[7]+i[5],e[2]=i[11]+i[9],e[3]=i[15]+i[13],s=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=s,e[1]/=s,e[2]/=s,e[3]/=s,(e=n[3])[0]=i[3]-i[1],e[1]=i[7]-i[5],e[2]=i[11]-i[9],e[3]=i[15]-i[13],s=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=s,e[1]/=s,e[2]/=s,e[3]/=s,(e=n[4])[0]=i[3]-i[2],e[1]=i[7]-i[6],e[2]=i[11]-i[10],e[3]=i[15]-i[14],s=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=s,e[1]/=s,e[2]/=s,e[3]/=s,(e=n[5])[0]=i[3]+i[2],e[1]=i[7]+i[6],e[2]=i[11]+i[10],e[3]=i[15]+i[14],s=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=s,e[1]/=s,e[2]/=s,e[3]/=s},e.containsPoint=function(t){var e,i;for(e=0;e<6;e++)if((i=this.planes[e])[0]*t.x+i[1]*t.y+i[2]*t.z+i[3]<=0)return!1;return!0},e.containsSphere=function(t){var e,i,n,s=0,r=t.radius,a=t.center,o=a.x,h=a.y,l=a.z,c=this.planes;for(i=0;i<6;i++){if((e=(n=c[i])[0]*o+n[1]*h+n[2]*l+n[3])<=-r)return 0;e>r&&s++}return 6===s?2:1},t}(),Jt=function(){function t(t,e){this.origin=new Ct,this.direction=Ct.FORWARD.clone(),t&&this.origin.copy(t),e&&this.direction.copy(e)}var e=t.prototype;return e.set=function(t,e){return this.origin.copy(t),this.direction.copy(e),this},e.copy=function(t){return this.set(t.origin,t.direction)},e.clone=function(){return new this.constructor(this.origin,this.direction)},t}(),$t=new Jt,te=new Ct,ee=new Zt,ie=new zt,ne=function(){function t(t,e){void 0===t&&(t=new zt),void 0===e&&(e=new Ct(.5,.5,.5)),this.halfExtents=void 0,this._modelTransform=void 0,this._worldTransform=void 0,this._aabb=void 0,this.halfExtents=e,this._modelTransform=t.clone().invert(),this._worldTransform=t.clone(),this._aabb=new qt(new Ct,this.halfExtents)}var e=t.prototype;return e.intersectsRay=function(t,e){if(this._modelTransform.transformPoint(t.origin,$t.origin),this._modelTransform.transformVector(t.direction,$t.direction),e){var i=this._aabb._intersectsRay($t,e);return ie.copy(this._modelTransform).invert().transformPoint(e,e),i}return this._aabb._fastIntersectsRay($t)},e.containsPoint=function(t){return this._modelTransform.transformPoint(t,te),this._aabb.containsPoint(te)},e.intersectsBoundingSphere=function(t){return this._modelTransform.transformPoint(t.center,ee.center),ee.radius=t.radius,!!this._aabb.intersectsBoundingSphere(ee)},v(t,[{key:"worldTransform",get:function(){return this._worldTransform},set:function(t){this._worldTransform.copy(t),this._modelTransform.copy(t).invert()}}])}(),se=function(){function t(t,e){void 0===t&&(t=Ct.UP),void 0===e&&(e=0),this.normal=new Ct,this.distance=void 0,this.normal.copy(t),this.distance=e}var e=t.prototype;return e.setFromPointNormal=function(t,e){return this.normal.copy(e),this.distance=-this.normal.dot(t),this},e.intersectsLine=function(t,e,i){var n=this.distance,s=this.normal.dot(t)+n,r=s/(s-(this.normal.dot(e)+n)),a=r>=0&&r<=1;return a&&i&&i.lerp(t,e,r),a},e.intersectsRay=function(t,e){var i=this.normal.dot(t.direction);if(0===i)return!1;var n=-(this.normal.dot(t.origin)+this.distance)/i;return n>=0&&e&&e.copy(t.direction).mulScalar(n).add(t.origin),n>=0},e.copy=function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},e.clone=function(){return(new(0,this.constructor)).copy(this)},t}(),re=new Ct,ae=new Ct,oe=new Ct,he=new Ct,le=new Ct,ce=1e-6,ue=function(){function t(t,e,i){void 0===t&&(t=Ct.ZERO),void 0===e&&(e=Ct.ZERO),void 0===i&&(i=Ct.ZERO),this.v0=new Ct,this.v1=new Ct,this.v2=new Ct,this.set(t,e,i)}var e=t.prototype;return e.set=function(t,e,i){return this.v0.copy(t),this.v1.copy(e),this.v2.copy(i),this},e.intersectsRay=function(t,e){re.sub2(this.v1,this.v0),ae.sub2(this.v2,this.v0),oe.cross(t.direction,ae);var i=re.dot(oe);if(i>-ce&&i1)return!1;le.cross(he,re);var r=n*t.direction.dot(le);if(r<0||s+r>1)return!1;var a=n*ae.dot(le);return a>ce&&(e instanceof Ct&&e.copy(t.direction).mulScalar(a).add(t.origin),!0)},e.toString=function(){return"["+this.v0.toString()+", "+this.v1.toString()+", "+this.v2.toString()+"]"},t}(),de="linear",fe="inverse",pe="exponential",me=128,_e=0,ve=10,ge=11,ye=12,xe=13,Se=14,be=15,Te=16,we=17,Ee=18,Ae=21,Ce=24,Me=25,Pe=26,Re=27,Ie=37,De=49,Le=new Map([[0,{name:"A8",size:1}],[1,{name:"L8",size:1}],[2,{name:"LA8",size:2}],[3,{name:"RGB565",size:2}],[4,{name:"RGBA5551",size:2}],[5,{name:"RGBA4",size:2}],[6,{name:"RGB8",size:4}],[7,{name:"RGBA8",size:4}],[50,{name:"R16F",size:2}],[51,{name:"RG16F",size:4}],[ge,{name:"RGB16F",size:8}],[ye,{name:"RGBA16F",size:8}],[xe,{name:"RGB32F",size:16}],[Se,{name:"RGBA32F",size:16}],[be,{name:"R32F",size:4}],[Te,{name:"DEPTH",size:4}],[we,{name:"DEPTHSTENCIL",size:4}],[Ee,{name:"111110F",size:4}],[19,{name:"SRGB",size:4}],[20,{name:"SRGBA",size:4}],[31,{name:"BGRA8",size:4}],[8,{name:"DXT1",blockSize:8}],[9,{name:"DXT3",blockSize:16}],[ve,{name:"DXT5",blockSize:16}],[Ae,{name:"ETC1",blockSize:8}],[22,{name:"ETC2_RGB",blockSize:8}],[23,{name:"ETC2_RGBA",blockSize:16}],[Ce,{name:"PVRTC_2BPP_RGB_1",blockSize:8}],[Me,{name:"PVRTC_2BPP_RGBA_1",blockSize:8}],[Pe,{name:"PVRTC_4BPP_RGB_1",blockSize:8}],[Re,{name:"PVRTC_4BPP_RGBA_1",blockSize:8}],[28,{name:"ASTC_4x4",blockSize:16}],[29,{name:"ATC_RGB",blockSize:8}],[30,{name:"ATC_RGBA",blockSize:16}],[32,{name:"R8I",size:1,isInt:!0}],[33,{name:"R8U",size:1,isInt:!0}],[34,{name:"R16I",size:2,isInt:!0}],[35,{name:"R16U",size:2,isInt:!0}],[36,{name:"R32I",size:4,isInt:!0}],[Ie,{name:"R32U",size:4,isInt:!0}],[38,{name:"RG8I",size:2,isInt:!0}],[39,{name:"RG8U",size:2,isInt:!0}],[40,{name:"RG16I",size:4,isInt:!0}],[41,{name:"RG16U",size:4,isInt:!0}],[42,{name:"RG32I",size:8,isInt:!0}],[43,{name:"RG32U",size:8,isInt:!0}],[44,{name:"RGBA8I",size:4,isInt:!0}],[45,{name:"RGBA8U",size:4,isInt:!0}],[46,{name:"RGBA16I",size:8,isInt:!0}],[47,{name:"RGBA16U",size:8,isInt:!0}],[48,{name:"RGBA32I",size:16,isInt:!0}],[De,{name:"RGBA32U",size:16,isInt:!0}]]),ke=function(t){var e;return void 0!==(null==(e=Le.get(t))?void 0:e.blockSize)},Oe=function(t){var e;return!0===(null==(e=Le.get(t))?void 0:e.isInt)},Fe=function(t){switch(t){case be:case xe:case Se:return Float32Array;case 36:case 42:case 48:return Int32Array;case Ie:case 43:case De:return Uint32Array;case 34:case 40:case 46:return Int16Array;case 35:case 41:case 47:case 3:case 4:case 5:case 50:case 51:case ge:case ye:return Uint16Array;case 32:case 38:case 44:return Int8Array;default:return Uint8Array}},Be=5,Ne="POSITION",Ue="NORMAL",ze="TANGENT",Ve="BLENDWEIGHT",Ge="BLENDINDICES",He="COLOR",We="TEXCOORD",Xe="TEXCOORD0",je="TEXCOORD1",qe="TEXCOORD2",Ye="TEXCOORD3",Ke="TEXCOORD4",Ze="TEXCOORD5",Qe="TEXCOORD6",Je="TEXCOORD7",$e="ATTR",ti="ATTR0",ei="ATTR1",ii="ATTR2",ni="ATTR3",si="ATTR4",ri="ATTR5",ai="ATTR6",oi="ATTR7",hi="ATTR8",li="ATTR9",ci="ATTR10",ui="ATTR11",di="ATTR12",fi="ATTR13",pi="ATTR14",mi="ATTR15",_i="default",vi="rgbm",gi="rgbe",yi="rgbp",xi="swizzleGGGR",Si="2d",bi="2d-array",Ti="cube",wi="3d",Ei="none",Ai="cube",Ci="equirect",Mi="octahedral",Pi="wgsl",Ri=10,Ii=11,Di=13,Li=14,ki=26,Oi=27,Fi=28,Bi=29,Ni=30,Ui=33,zi=36,Vi=["bool","int","float","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","samplerCube","","sampler2DShadow","samplerCubeShadow","sampler3D","","","","","sampler2DArray","uint","uvec2","uvec3","uvec4","","","","","","","","","","","","","isampler2D","usampler2D","isamplerCube","usamplerCube","isampler3D","usampler3D","isampler2DArray","usampler2DArray"],Gi=new Uint8Array([4,4,6,6,6,6,4,4,4,4,4,4,6,6,6,4,4,6,4,4,4,6,6,6,6,4,5,5,5,5,4,5,4,4,5,4,4,5,4,4,5,4,4,5,4,5,4,5,4,5]),Hi="webgl1",Wi="webgl2",Xi="webgpu",ji="null",qi=["mesh","view"],Yi="default",Ki=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Uint16Array],Zi=[1,1,2,2,4,4,4,2],Qi={Int8Array:0,Uint8Array:1,Int16Array:2,Uint16Array:3,Int32Array:4,Uint32Array:5,Float32Array:6},Ji=[Uint8Array,Uint16Array,Uint32Array],$i=[1,2,4],tn={};tn[Ne]=0,tn[Ue]=1,tn[Ve]=2,tn[Ge]=3,tn[He]=4,tn[Xe]=5,tn[je]=6,tn[qe]=7,tn[Ye]=8,tn[Ke]=9,tn[Ze]=10,tn[Qe]=11,tn[Je]=12,tn[ze]=13,tn[ti]=0,tn[ei]=1,tn[ii]=2,tn[ni]=3,tn[si]=4,tn[ri]=5,tn[ai]=6,tn[oi]=7,tn[hi]=8,tn[li]=9,tn[ci]=10,tn[ui]=11,tn[di]=12,tn[fi]=13,tn[pi]=14,tn[mi]=15;var en,nn="1.65",sn=function(t,e,i,n){return void 0===n&&(n=1),t&~(n<>e&i},an=function(t,e,i){void 0===i&&(i=1);var n=i<3){var a;this.usage=null!=(a=arguments[3])?a:0,s=arguments[4]}this.device=t,this.format=e,this.numVertices=i,this.id=gn++,this.impl=t.createVertexBufferImpl(this,e,n),this.numBytes=e.verticesByteSize?e.verticesByteSize:e.size*i,this.adjustVramSizeTracking(t._vram,this.numBytes),s?this.setData(s):this.storage=new ArrayBuffer(this.numBytes),this.device.buffers.push(this)}var e=t.prototype;return e.destroy=function(){var t=this.device,e=t.buffers.indexOf(this);-1!==e&&t.buffers.splice(e,1),this.impl.initialized&&(this.impl.destroy(t),this.adjustVramSizeTracking(t._vram,-this.storage.byteLength))},e.adjustVramSizeTracking=function(t,e){t.vb+=e},e.loseContext=function(){this.impl.loseContext()},e.getFormat=function(){return this.format},e.getUsage=function(){return this.usage},e.getNumVertices=function(){return this.numVertices},e.lock=function(){return this.storage},e.unlock=function(){this.impl.unlock(this)},e.setData=function(t){return t.byteLength===this.numBytes&&(this.storage=t,this.unlock(),!0)},t}();function xn(t){for(var e=0,i=0,n=t.length;i>>0}var bn,Tn=function(){function t(){this._cache=new Map}var e=t.prototype;return e.get=function(t,e){var i=this;return this._cache.has(t)||(this._cache.set(t,e()),t.on("destroy",(function(){i.remove(t)})),t.on("devicelost",(function(){var e;null==(e=i._cache.get(t))||null==e.loseContext||e.loseContext(t)}))),this._cache.get(t)},e.remove=function(t){var e;null==(e=this._cache.get(t))||null==e.destroy||e.destroy(t),this._cache.delete(t)},t}(),wn=new cn,En=[2,4,8,12,16],An=new Tn,Cn=function(){function t(t,e,i){this.device=t,this._elements=[],this.hasUv0=!1,this.hasUv1=!1,this.hasColor=!1,this.hasTangents=!1,this.verticesByteSize=0,this.vertexCount=i,this.interleaved=void 0===i,this.instancing=!1,this.size=e.reduce((function(t,e){return t+4*Math.ceil(e.components*Zi[e.type]/4)}),0);for(var n,s=0,r=0,a=e.length;r1?m:1),this.autoResolve=null==(r=t.autoResolve)||r,this.name=t.name,this.name)||(this.name=null==(f=this._colorBuffer)?void 0:f.name);this.name||(this.name=null==(p=this._depthBuffer)?void 0:p.name);this.name||(this.name="Untitled"),this.flipY=null!=(a=t.flipY)&&a,this.validateMrt(),this.impl=d.createRenderTargetImpl(this)}var e=t.prototype;return e.destroy=function(){var t=this._device;t&&(t.targets.delete(this),t.renderTarget===this&&t.setRenderTarget(null),this.destroyFrameBuffers())},e.destroyFrameBuffers=function(){var t=this._device;t&&this.impl.destroy(t)},e.destroyTextureBuffers=function(){var t,e;null==(t=this._depthBuffer)||t.destroy(),this._depthBuffer=null,null==(e=this._colorBuffers)||e.forEach((function(t){t.destroy()})),this._colorBuffers=null,this._colorBuffer=null},e.resize=function(t,e){if(this.width!==t||this.height!==e){var i,n,s=this._device;this.destroyFrameBuffers(),s.renderTarget===this&&s.setRenderTarget(null),null==(i=this._depthBuffer)||i.resize(t,e),null==(n=this._colorBuffers)||n.forEach((function(i){i.resize(t,e)})),this.validateMrt(),this.impl=s.createRenderTargetImpl(this)}},e.validateMrt=function(){},e.init=function(){this.impl.init(this._device,this)},e.loseContext=function(){this.impl.loseContext()},e.resolve=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!!this._depthBuffer),this._device&&this._samples>1&&this.impl.resolve(this._device,this,t,e)},e.copy=function(t,e,i){if(!this._device){if(!t._device)return!1;this._device=t._device}return this._device.copyRenderTarget(t,this,e,i)},e.getColorBuffer=function(t){var e;return null==(e=this._colorBuffers)?void 0:e[t]},v(t,[{key:"initialized",get:function(){return this.impl.initialized}},{key:"device",get:function(){return this._device}},{key:"samples",get:function(){return this._samples}},{key:"depth",get:function(){return this._depth}},{key:"stencil",get:function(){return this._stencil}},{key:"colorBuffer",get:function(){return this._colorBuffer}},{key:"depthBuffer",get:function(){return this._depthBuffer}},{key:"face",get:function(){return this._face}},{key:"width",get:function(){var t,e;return(null==(t=this._colorBuffer)?void 0:t.width)||(null==(e=this._depthBuffer)?void 0:e.width)||this._device.width}},{key:"height",get:function(){var t,e;return(null==(t=this._colorBuffer)?void 0:t.height)||(null==(e=this._depthBuffer)?void 0:e.height)||this._device.height}}])}(),Ln=function(){function t(){this.bindGroup=void 0}var e=t.prototype;return e.update=function(t){this.destroy();var e=t.device,i=this.createDescriptor(e,t);this.bindGroup=e.wgpu.createBindGroup(i)},e.destroy=function(){this.bindGroup=null},e.createDescriptor=function(t,e){var i=[],n=e.format,s=e.format.uniformBufferFormats;e.uniformBuffers.forEach((function(t,e){var n=s[e].slot,r=t.persistent?t.impl.buffer:t.allocation.gpuBuffer.buffer;i.push({binding:n,resource:{buffer:r,offset:0,size:t.format.byteSize}})}));var r=e.format.textureFormats;e.textures.forEach((function(e,s){var a=e.impl,o=n.textureFormats[s],h=r[s].slot,l=a.getView(t);if(i.push({binding:h,resource:l}),o.hasSampler){var c=a.getSampler(t,o.sampleType);i.push({binding:h+1,resource:c})}}));var a=e.format.storageTextureFormats;e.storageTextures.forEach((function(e,n){var s=e.impl,r=a[n].slot,o=s.getView(t);i.push({binding:r,resource:o})}));var o=e.format.storageBufferFormats;return e.storageBuffers.forEach((function(t,e){var n=t.impl.buffer,s=o[e].slot;i.push({binding:s,resource:{buffer:n}})})),{layout:e.format.impl.bindGroupLayout,entries:i}},t}(),kn=function(){function t(){}return t.shaderStage=function(t){var e=0;return 1&t&&(e|=GPUShaderStage.VERTEX),2&t&&(e|=GPUShaderStage.FRAGMENT),4&t&&(e|=GPUShaderStage.COMPUTE),e},t}(),On=[];On[0]="",On[1]="r8unorm",On[2]="rg8unorm",On[3]="",On[4]="",On[5]="",On[6]="rgba8unorm",On[7]="rgba8unorm",On[8]="bc1-rgba-unorm",On[9]="bc2-rgba-unorm",On[10]="bc3-rgba-unorm",On[11]="",On[12]="rgba16float",On[50]="r16float",On[51]="rg16float",On[13]="",On[14]="rgba32float",On[15]="r32float",On[16]="depth32float",On[17]="depth24plus-stencil8",On[18]="rg11b10ufloat",On[19]="",On[20]="",On[21]="",On[22]="etc2-rgb8unorm",On[23]="etc2-rgba8unorm",On[24]="",On[25]="",On[26]="",On[27]="",On[28]="astc-4x4-unorm",On[29]="",On[30]="",On[31]="bgra8unorm",On[32]="r8sint",On[33]="r8uint",On[34]="r16sint",On[35]="r16uint",On[36]="r32sint",On[37]="r32uint",On[38]="rg8sint",On[39]="rg8uint",On[40]="rg16sint",On[41]="rg16uint",On[42]="rg32sint",On[43]="rg32uint",On[44]="rgba8sint",On[45]="rgba8uint",On[46]="rgba16sint",On[47]="rgba16uint",On[48]="rgba32sint",On[49]="rgba32uint";var Fn=[];Fn[0]="filtering",Fn[1]="non-filtering",Fn[2]="comparison",Fn[3]="comparison",Fn[4]="comparison";var Bn=[];Bn[0]="float",Bn[1]="unfilterable-float",Bn[2]="depth",Bn[3]="sint",Bn[4]="uint";var Nn=new cn,Un=function(){function t(t){var e=t.device,i=this.createDescriptor(t),n=i.key,s=i.descr;this.key=Nn.get(n),this.bindGroupLayout=e.wgpu.createBindGroupLayout(s)}var e=t.prototype;return e.destroy=function(){this.bindGroupLayout=null},e.loseContext=function(){},e.createDescriptor=function(t){var e=[],i="";return t.uniformBufferFormats.forEach((function(t){var n=kn.shaderStage(t.visibility);i+="#"+t.slot+"U:"+n,e.push({binding:t.slot,visibility:n,buffer:{type:"uniform",hasDynamicOffset:!0}})})),t.textureFormats.forEach((function(t){var n=kn.shaderStage(t.visibility),s=t.sampleType,r=t.textureDimension,a=!1,o=Bn[s];if(i+="#"+t.slot+"T:"+n+"-"+o+"-"+r+"-"+a,e.push({binding:t.slot,visibility:n,texture:{sampleType:o,viewDimension:r,multisampled:a}}),t.hasSampler){var h=Fn[s];i+="#"+(t.slot+1)+"S:"+n+"-"+h,e.push({binding:t.slot+1,visibility:n,sampler:{type:h}})}})),t.storageTextureFormats.forEach((function(t){var n=t.format,s=t.textureDimension,r=t.read,a=t.write;i+="#"+t.slot+"ST:"+n+"-"+s+"-"+(r?"r1":"r0")+"-"+(a?"w1":"w0"),e.push({binding:t.slot,visibility:GPUShaderStage.COMPUTE,storageTexture:{access:r?a?"read-write":"read-only":"write-only",format:On[n],viewDimension:s}})})),t.storageBufferFormats.forEach((function(t){var n=t.readOnly,s=kn.shaderStage(t.visibility);i+="#"+t.slot+"SB:"+s+"-"+(n?"ro":"rw"),e.push({binding:t.slot,visibility:s,buffer:{type:n?"read-only-storage":"storage"}})})),{key:i,descr:{entries:e}}},t}(),zn=function(){function t(t){void 0===t&&(t=0),this.buffer=null,this.usageFlags=0,this.usageFlags=t}var e=t.prototype;return e.destroy=function(t){this.buffer&&(this.buffer.destroy(),this.buffer=null)},e.loseContext=function(){},e.allocate=function(t,e){this.buffer=t.wgpu.createBuffer({size:e,usage:this.usageFlags})},e.unlock=function(t,e){var i,n,s=t.wgpu;if(!this.buffer){var r=e.byteLength+3&-4;this.usageFlags|=GPUBufferUsage.COPY_DST,this.allocate(t,r)}var a=null!=(i=e.byteOffset)?i:0,o=new Uint8Array(null!=(n=e.buffer)?n:e,a,e.byteLength),h=new Uint8Array(this.buffer.size);h.set(o),s.queue.writeBuffer(this.buffer,0,h,0,h.length)},e.read=function(t,e,i,n){return t.readStorageBuffer(this,e,i,n)},e.write=function(t,e,i,n,s){t.writeStorageBuffer(this,e,i,n,s)},e.clear=function(t,e,i){t.clearStorageBuffer(this,e,i)},v(t,[{key:"initialized",get:function(){return!!this.buffer}}])}(),Vn=function(t){function e(e,i){var n;return(n=t.call(this,16|(null!=i&&i.storage?me:0))||this).format=null,n.format=1===e.format?"uint16":"uint32",n}return x(e,t),e.prototype.unlock=function(e){var i=e.device;t.prototype.unlock.call(this,i,e.storage)},e}(zn),Gn=function(t,e){if(t.length!==e.length)return!1;for(var i=0;i1?"x"+o.numComponents:"")}),e&&a!==r-1||(i.push({attributes:s,arrayStride:o.stride,stepMode:n}),s=[])}};return t&&n(t),e&&n(e),i},t}(),jn=function(){function t(t){this.device=t}return t.prototype.getPipelineLayout=function(t){var e=[];t.forEach((function(t){e.push(t.bindGroupLayout)}));var i={bindGroupLayouts:e};return this.device.wgpu.createPipelineLayout(i)},t}(),qn=["point-list","line-list",void 0,"line-strip","triangle-list","triangle-strip",void 0],Yn=["add","subtract","reverse-subtract","min","max"],Kn=["zero","one","src","one-minus-src","dst","one-minus-dst","src-alpha","src-alpha-saturated","one-minus-src-alpha","dst-alpha","one-minus-dst-alpha","constant","one-minus-constant"],Zn=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Qn=["none","back","front"],Jn=["keep","zero","replace","increment-clamp","increment-wrap","decrement-clamp","decrement-wrap","invert"],$n=function(){this.pipeline=void 0,this.hashes=void 0},ts=function(t){function e(e){var i;return(i=t.call(this,e)||this).lookupHashes=new Uint32Array(13),i.vertexBufferLayout=new Xn,i.cache=new Map,i}x(e,t);var i=e.prototype;return i.get=function(t,e,i,n,s,r,a,o,h,l,c,u){var d,f,p,m,_,v,g,y,x=this.lookupHashes;x[0]=t.type,x[1]=n.id,x[2]=h,x[3]=o.key,x[4]=a.key,x[5]=null!=(d=null==e?void 0:e.renderingHash)?d:0,x[6]=null!=(f=null==i?void 0:i.renderingHash)?f:0,x[7]=s.impl.key,x[8]=null!=(p=null==(m=r[0])?void 0:m.key)?p:0,x[9]=null!=(_=null==(v=r[1])?void 0:v.key)?_:0,x[10]=null!=(g=null==(y=r[2])?void 0:y.key)?g:0,x[11]=l?c.key:0,x[12]=l?u.key:0;var S=Sn(x),b=this.cache.get(S);if(b)for(var T=0;T0){var m=0;s.redWrite&&(m|=GPUColorWrite.RED),s.greenWrite&&(m|=GPUColorWrite.GREEN),s.blueWrite&&(m|=GPUColorWrite.BLUE),s.alphaWrite&&(m|=GPUColorWrite.ALPHA);var _=this.getBlend(s);p.forEach((function(t){f.fragment.targets.push({format:t.format,writeMask:m,blend:_})}))}return u.createRenderPipeline(f)},e}(jn),es=function(t){function e(){return t.apply(this,arguments)||this}x(e,t);var i=e.prototype;return i.get=function(t,e){var i=this.getPipelineLayout([e.impl]);return this.create(t,i)},i.create=function(t,e){var i=this.device.wgpu,n=t.impl,s={compute:{module:n.getComputeShaderModule(),entryPoint:n.computeEntryPoint},layout:e};return i.createComputePipeline(s)},e}(jn),is=new cn,ns=function(){function t(){this.format=void 0,this.multisampledBuffer=void 0}return t.prototype.destroy=function(){var t;null==(t=this.multisampledBuffer)||t.destroy(),this.multisampledBuffer=null},t}(),ss=function(){function t(t){var e=this;this.initialized=!1,this.key=void 0,this.colorAttachments=[],this.depthFormat=void 0,this.hasStencil=void 0,this.depthTexture=null,this.depthTextureInternal=!1,this.assignedColorTexture=null,this.renderPassDescriptor={},this.renderTarget=t,t._colorBuffers&&t._colorBuffers.forEach((function(t,i){e.setColorAttachment(i,void 0,t.impl.format)})),this.updateKey()}var e=t.prototype;return e.destroy=function(t){var e;(this.initialized=!1,this.depthTextureInternal)&&(null==(e=this.depthTexture)||e.destroy(),this.depthTexture=null);this.assignedColorTexture=null,this.colorAttachments.forEach((function(t){t.destroy()})),this.colorAttachments.length=0},e.updateKey=function(){var t=this.renderTarget,e=t.samples+":"+(t.depth?this.depthFormat:"nodepth");this.colorAttachments.forEach((function(t){e+=":"+t.format})),this.key=is.get(e)},e.setDepthFormat=function(t){this.depthFormat=t,this.hasStencil="depth24plus-stencil8"===t},e.assignColorTexture=function(t){this.assignedColorTexture=t;var e=t.createView(),i=this.renderPassDescriptor.colorAttachments[0];this.renderTarget.samples>1?i.resolveTarget=e:i.view=e,this.setColorAttachment(0,void 0,t.format),this.updateKey()},e.setColorAttachment=function(t,e,i){this.colorAttachments[t]||(this.colorAttachments[t]=new ns),e&&(this.colorAttachments[t].multisampledBuffer=e),i&&(this.colorAttachments[t].format=i)},e.init=function(t,e){var i,n,s=t.wgpu;this.initDepthStencil(s,e),this.renderPassDescriptor.colorAttachments=[];for(var r=null!=(i=null==(n=e._colorBuffers)?void 0:n.length)?i:1,a=0;a1?GPUTextureUsage.TEXTURE_BINDING:GPUTextureUsage.COPY_SRC,this.depthTexture=t.createTexture(o),this.depthTextureInternal=!0}this.renderPassDescriptor.depthStencilAttachment={view:this.depthTexture.createView()}}},e.initColor=function(t,e,i){var n={},s=e.samples,r=e.width,a=e.height,o=e.getColorBuffer(i),h=null;if(o){h=o.cubemap?o.impl.createView({dimension:"2d",baseArrayLayer:e.face,arrayLayerCount:1,mipLevelCount:1}):o.impl.createView({mipLevelCount:1})}if(s>1){var l,c,u={size:[r,a,1],dimension:"2d",sampleCount:s,format:null!=(l=null==(c=this.colorAttachments[i])?void 0:c.format)?l:o.impl.format,usage:GPUTextureUsage.RENDER_ATTACHMENT},d=t.createTexture(u);this.setColorAttachment(i,d,u.format),n.view=d.createView(),n.resolveTarget=h}else n.view=h;return n},e.setupForRenderPass=function(t){for(var e,i,n=null!=(e=null==(i=this.renderPassDescriptor.colorAttachments)?void 0:i.length)?e:0,s=0;s0)switch(e){case 2:this.updateType=17;break;case 1:this.updateType=Ni;break;case ki:this.updateType=31;break;case 0:this.updateType=32;break;case 3:this.updateType=21;break;case 6:this.updateType=Ui;break;case Oi:this.updateType=34;break;case 9:this.updateType=35;break;case 4:this.updateType=22;break;case 7:this.updateType=zi;break;case Fi:this.updateType=37;break;case Ri:this.updateType=38;break;case 5:this.updateType=23;break;case 8:this.updateType=39;break;case Bi:this.updateType=40;break;case Ii:this.updateType=41;break;case Li:this.updateType=24}this.count=i;var n=this.numComponents;i&&(n=_t.roundUp(n,4)),this.byteSize=4*n,i&&(this.byteSize*=i)}return t.prototype.calculateOffset=function(t){var e=this.byteSize<=8?this.byteSize:16;this.count&&(e=16),t=_t.roundUp(t,e),this.offset=t/4},v(t,[{key:"isArrayType",get:function(){return this.count>0}}])}(),hs=function(){function t(t,e){this.byteSize=0,this.map=new Map,this.scope=t.scope,this.uniforms=e;for(var i=0,n=0;n>e,1)},t.calcMipLevelsCount=function(t,e,i){return void 0===i&&(i=1),1+Math.floor(Math.log2(Math.max(t,e,i)))},t.calcLevelGpuSize=function(t,e,i,n){var s,r,a,o=Le.get(n),h=null!=(s=null==(r=Le.get(n))?void 0:r.size)?s:0;if(h>0)return t*e*i*h;var l=null!=(a=o.blockSize)?a:0,c=Math.floor((t+3)/4),u=Math.floor((e+3)/4),d=Math.floor((i+3)/4);return n!==Ce&&n!==Me||(c=Math.max(Math.floor(c/2),1)),c*u*d*l},t.calcGpuSize=function(e,i,n,s,r,a){for(var o=0;o+=t.calcLevelGpuSize(e,i,n,s),r&&(1!==e||1!==i||1!==n);)e=Math.max(e>>1,1),i=Math.max(i>>1,1),n=Math.max(n>>1,1);return o*(a?6:1)},t}(),Ms=[];Ms[0]="repeat",Ms[1]="clamp-to-edge",Ms[2]="mirror-repeat";var Ps=[];Ps[0]={level:"nearest",mip:"nearest"},Ps[1]={level:"linear",mip:"nearest"},Ps[2]={level:"nearest",mip:"nearest"},Ps[3]={level:"nearest",mip:"linear"},Ps[4]={level:"linear",mip:"nearest"},Ps[5]={level:"linear",mip:"linear"};var Rs=function(){function t(t){this.gpuTexture=void 0,this.view=void 0,this.samplers=[],this.descr=void 0,this.format=void 0,this.texture=t,this.format=On[t.format],this.create(t.device)}var e=t.prototype;return e.create=function(t){var e,i=this.texture,n=t.wgpu,s=i.requiredMipLevels;this.descr={size:{width:i.width,height:i.height,depthOrArrayLayers:i.cubemap?6:i.array?i.arrayLength:1},format:this.format,mipLevelCount:s,sampleCount:1,dimension:i.volume?"3d":"2d",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC|(ke(i.format)?0:GPUTextureUsage.RENDER_ATTACHMENT)|(i.storage?GPUTextureUsage.STORAGE_BINDING:0)},this.gpuTexture=n.createTexture(this.descr),this.texture.format===we&&(e={format:"depth24plus",aspect:"depth-only"}),this.view=this.createView(e)},e.destroy=function(t){},e.propertyChanged=function(t){this.samplers.length=0},e.getView=function(t){return this.uploadImmediate(t,this.texture),this.view},e.createView=function(t){var e,i,n,s,r,a,o,h=null!=t?t:{},l=this.descr,c=this.texture,u={format:null!=(e=h.format)?e:l.format,dimension:null!=(i=h.dimension)?i:c.cubemap?"cube":c.volume?"3d":c.array?"2d-array":"2d",aspect:null!=(n=h.aspect)?n:"all",baseMipLevel:null!=(s=h.baseMipLevel)?s:0,mipLevelCount:null!=(r=h.mipLevelCount)?r:l.mipLevelCount,baseArrayLayer:null!=(a=h.baseArrayLayer)?a:0,arrayLayerCount:null!=(o=h.arrayLayerCount)?o:l.depthOrArrayLayers};return this.gpuTexture.createView(u)},e.getSampler=function(t,e){var i=this.samplers[e];if(!i){var n=this.texture,s={addressModeU:Ms[n.addressU],addressModeV:Ms[n.addressV],addressModeW:Ms[n.addressW]};if(!e&&n.compareOnRead&&(e=2),2===e||3===e||4===e)s.compare="less",s.magFilter="linear",s.minFilter="linear";else if(1===e)s.magFilter="nearest",s.minFilter="nearest",s.mipmapFilter="nearest";else{!t.textureFloatFilterable&&(n.format===Se||n.format===ye)||this.texture.format===we||Oe(this.texture.format)?(s.magFilter="nearest",s.minFilter="nearest",s.mipmapFilter="nearest"):(s.magFilter=Ps[n.magFilter].level,s.minFilter=Ps[n.minFilter].level,s.mipmapFilter=Ps[n.minFilter].mip)}var r="linear"===s.minFilter&&"linear"===s.magFilter&&"linear"===s.mipmapFilter;s.maxAnisotropy=r?_t.clamp(Math.round(n._anisotropy),1,t.maxTextureAnisotropy):1,i=t.wgpu.createSampler(s),this.samplers[e]=i}return i},e.loseContext=function(){},e.uploadImmediate=function(t,e){(e._needsUpload||e._needsMipmapsUpload)&&(this.uploadData(t),e._needsUpload=!1,e._needsMipmapsUpload=!1)},e.uploadData=function(t){var e=this.texture;if(e._levels){for(var i=!1,n=!1,s=e.requiredMipLevels,r=0;r<=|&+-]/g,Gs=/include[ \t]+"([\w-]+)"\r?(?:\n|$)/g,Hs=function(){function t(){}return t.run=function(t,e,i){void 0===e&&(e=new Map),void 0===i&&(i=!1),t=(t=t.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"$1")).split(/\r?\n/).map((function(t){return t.trimEnd()})).join("\n");var n=new Map;if(i){var s=new Map,r=t.match(/(pcFragColor[1-8])\b/g);null==r||r.forEach((function(t){var e,i=parseInt(t.charAt(t.length-1),10);s.set(i,(null!=(e=s.get(i))?e:0)+1)})),s.forEach((function(t,e){1===t&&n.set("REMOVE_COLOR_ATTACHMENT_"+e,"")}))}t=this._preprocess(t,n,e);var a=new Map;return n.forEach((function(t,e){Number.isInteger(parseFloat(t))&&!t.includes(".")&&a.set(e,t)})),t=this.RemoveEmptyLines(t),t=this.processArraySize(t,a)},t.processArraySize=function(t,e){return null!==t&&e.forEach((function(e,i){t=t.replace(new RegExp("\\["+i+"\\]","g"),"["+e+"]")})),t},t.RemoveEmptyLines=function(t){return null!==t&&(t=(t=t.split(/\r?\n/).map((function(t){return""===t.trim()?"":t})).join("\n")).replace(/(\n\n){3,}/g,"\n\n")),t},t._preprocess=function(e,i,n){void 0===i&&(i=new Map);for(var s,r=e,a=[],o=!1;null!==(s=Ls.exec(e));){var h=s[1];switch(h){case"define":ks.lastIndex=s.index;var l=ks.exec(e);o||(o=null===l);var c=l[1];Us.lastIndex=l.index;var u=Us.exec(c)[1],d=c.substring(u.length).trim();""===d&&(d="true"),t._keep(a)&&i.set(u,d),Ls.lastIndex=l.index+l[0].length;break;case"undef":Fs.lastIndex=s.index;var f=Fs.exec(e),p=f[1].trim();t._keep(a)&&i.delete(p),Ls.lastIndex=f.index+f[0].length;break;case"extension":Os.lastIndex=s.index;var m=Os.exec(e);if(o||(o=null===m),m){var _=m[1];t._keep(a)&&i.set(_,"true")}Ls.lastIndex=m.index+m[0].length;break;case"ifdef":case"ifndef":case"if":Bs.lastIndex=s.index;var v=Bs.exec(e),g=v[2],y=t.evaluate(g,i);o||(o=y.error);var x=y.result;"ifndef"===h&&(x=!x),a.push({anyKeep:x,keep:x,start:s.index,end:Bs.lastIndex}),Ls.lastIndex=v.index+v[0].length;break;case"endif":case"else":case"elif":Ns.lastIndex=s.index;var S=Ns.exec(e),b=a.pop(),T=b.keep?e.substring(b.end,s.index):"";e=e.substring(0,b.start)+T+e.substring(Ns.lastIndex),Ls.lastIndex=b.start+T.length;var w=S[1];if("else"===w||"elif"===w){var E=!1;if(!b.anyKeep)if("else"===w)E=!b.keep;else{var A=t.evaluate(S[2],i);E=A.result,o||(o=A.error)}a.push({anyKeep:b.anyKeep||E,keep:E,start:Ls.lastIndex,end:Ls.lastIndex})}break;case"include":Gs.lastIndex=s.index;var C=Gs.exec(e);o||(o=null===C);var M=C[1].trim();if(t._keep(a)){var P=null==n?void 0:n.get(M);P?(e=e.substring(0,C.index-1)+P+e.substring(Gs.lastIndex),Ls.lastIndex=C.index):(console.error("Include not found: "+M),o=!0)}}}return o?(console.warn("Failed to preprocess shader: ",{source:r}),r):e},t._keep=function(t){for(var e=0;e=0;r--){var a=this.usedBuffers[r],o=a.stagingBuffer,h=a.gpuBuffer,l=a.offset,c=a.size,u=o.buffer;u.unmap(),s.copyBufferToBuffer(u,l,h.buffer,l,c),n.push(h)}var d=s.finish();i.addCommandBuffer(d,!0);for(var f=0;f0&&(this._frameTime=e[0]),w.get(a))for(var n=0;n0&&(this.dynamicBuffers.submit(),this.wgpu.queue.submit(this.commandBuffers),this.commandBuffers.length=0,this.dynamicBuffers.onCommandBuffersSubmitted())},n.clear=function(t){t.flags&&this.clearRenderer.clear(this,this.renderTarget,t,this.defaultClearOptions)},n.setViewport=function(t,e,i,n){this.passEncoder&&(this.renderTarget.flipY||(e=this.renderTarget.height-e-n),this.vx=t,this.vy=e,this.vw=i,this.vh=n,this.passEncoder.setViewport(t,e,i,n,0,1))},n.setScissor=function(t,e,i,n){this.passEncoder&&(this.renderTarget.flipY||(e=this.renderTarget.height-e-n),this.sx=t,this.sy=e,this.sw=i,this.sh=n,this.passEncoder.setScissorRect(t,e,i,n))},n.clearStorageBuffer=function(t,e,i){var n;void 0===e&&(e=0),void 0===i&&(i=t.byteSize);var s=null!=(n=this.commandEncoder)?n:this.wgpu.createCommandEncoder();if(s.clearBuffer(t.buffer,e,i),!this.commandEncoder){var r=s.finish();this.addCommandBuffer(r)}},n.readStorageBuffer=function(t,e,i,n,s){var r,a=this;void 0===e&&(e=0),void 0===i&&(i=t.byteSize-e),void 0===n&&(n=null),void 0===s&&(s=!1);var o=this.createBufferImpl(9);o.allocate(this,i);var h=o.buffer,l=null!=(r=this.commandEncoder)?r:this.wgpu.createCommandEncoder();if(l.copyBufferToBuffer(t.buffer,e,h,0,i),!this.commandEncoder){var c=l.finish();this.addCommandBuffer(c)}return new Promise((function(t,e){var r=function(){null==h||h.mapAsync(GPUMapMode.READ).then((function(){null!=n||(n=new Uint8Array(i));var e=h.getMappedRange(0,i),s=n.constructor;n.set(new s(e)),h.unmap(),o.destroy(a),t(n)}))};s?(a.submit(),r()):setTimeout((function(){r()}))}))},n.writeStorageBuffer=function(t,e,i,n,s){void 0===e&&(e=0),void 0===n&&(n=0),this.wgpu.queue.writeBuffer(t.buffer,e,i,n,s)},n.copyRenderTarget=function(t,e,i,n){var s,r={width:t?t.width:e.width,height:t?t.height:e.height,depthOrArrayLayers:1},a=null!=(s=this.commandEncoder)?s:this.wgpu.createCommandEncoder();if(i){var o={texture:t?t.colorBuffer.impl.gpuTexture:this.renderTarget.impl.assignedColorTexture,mipLevel:0},h={texture:e?e.colorBuffer.impl.gpuTexture:this.renderTarget.impl.assignedColorTexture,mipLevel:0};a.copyTextureToTexture(o,h,r)}if(n){var l=(t||this.renderTarget).impl.depthTexture;if(t.samples>1){var c=e.colorBuffer.impl.gpuTexture;this.resolver.resolveDepth(a,l,c)}else{var u={texture:l,mipLevel:0},d={texture:e?e.depthBuffer.impl.gpuTexture:this.renderTarget.impl.depthTexture,mipLevel:0};a.copyTextureToTexture(u,d,r)}}if(!this.commandEncoder){var f=a.finish();this.addCommandBuffer(f)}return!0},e}(Rn),ur=0,dr=function(){function t(t,e){var i,n,s,r,a,o,h,l,c,u,d,f,p,m,_,v,g,y,x,S,b,T;(void 0===e&&(e={}),this.name=void 0,this._gpuSize=0,this.id=ur++,this._invalid=!1,this._lockedLevel=-1,this._lockedMode=0,this.renderVersionDirty=0,this._storage=!1,this.device=t,this.name=null!=(i=e.name)?i:"",this._width=Math.floor(null!=(n=e.width)?n:4),this._height=Math.floor(null!=(s=e.height)?s:4),this._format=null!=(r=e.format)?r:7,this._compressed=ke(this._format),this._integerFormat=Oe(this._format),this._integerFormat&&(e.mipmaps=!1,e.minFilter=0,e.magFilter=0),t.supportsVolumeTextures)?(this._volume=null!=(S=e.volume)&&S,this._depth=Math.floor(null!=(b=e.depth)?b:1),this._arrayLength=Math.floor(null!=(T=e.arrayLength)?T:0)):(this._volume=!1,this._depth=1,this._arrayLength=0);this._storage=null!=(a=e.storage)&&a,this._cubemap=null!=(o=e.cubemap)&&o,this.fixCubemapSeams=null!=(h=e.fixCubemapSeams)&&h,this._flipY=null!=(l=e.flipY)&&l,this._premultiplyAlpha=null!=(c=e.premultiplyAlpha)&&c,this._mipmaps=null==(u=null!=(d=e.mipmaps)?d:e.autoMipmap)||u,this._minFilter=null!=(f=e.minFilter)?f:5,this._magFilter=null!=(p=e.magFilter)?p:1,this._anisotropy=null!=(m=e.anisotropy)?m:1,this._addressU=null!=(_=e.addressU)?_:0,this._addressV=null!=(v=e.addressV)?v:0,this._addressW=null!=(g=e.addressW)?g:0,this._compareOnRead=null!=(y=e.compareOnRead)&&y,this._compareFunc=null!=(x=e.compareFunc)?x:1,this.type=_i,e.hasOwnProperty("type")?this.type=e.type:e.hasOwnProperty("rgbm")?this.type=e.rgbm?vi:_i:e.hasOwnProperty("swizzleGGGR")&&(this.type=e.swizzleGGGR?xi:_i),this.projection=Ei,this._cubemap?this.projection=Ai:e.projection&&e.projection!==Ai&&(this.projection=e.projection),this.impl=t.createTextureImpl(this),this.dirtyAll(),this._levels=e.levels,this._levels?this.upload():this._levels=this._cubemap?[[null,null,null,null,null,null]]:[null],t.textures.push(this)}var e,i=t.prototype;return i.destroy=function(){var t=this.device;if(t){var e=t.textures.indexOf(this);-1!==e&&t.textures.splice(e,1),t.scope.removeValue(this),this.impl.destroy(t),this.adjustVramSizeTracking(t._vram,-this._gpuSize),this._levels=null,this.device=null}},i.resize=function(t,e,i){void 0===i&&(i=1);var n=this.device;this.adjustVramSizeTracking(n._vram,-this._gpuSize),this.impl.destroy(n),this._width=Math.floor(t),this._height=Math.floor(e),this._depth=Math.floor(i),this.impl=n.createTextureImpl(this),this.dirtyAll()},i.loseContext=function(){this.impl.loseContext(),this.dirtyAll()},i.adjustVramSizeTracking=function(t,e){t.tex+=e},i.propertyChanged=function(t){this.impl.propertyChanged(t),this.renderVersionDirty=this.device.renderVersion},i.dirtyAll=function(){this._levelsUpdated=this._cubemap?[[!0,!0,!0,!0,!0,!0]]:[!0],this._needsUpload=!0,this._needsMipmapsUpload=this._mipmaps,this._mipmapsUploaded=!1,this.propertyChanged(255)},i.lock=function(t){var e,i,n;void 0===t&&(t={}),null!=(e=t).level||(e.level=0),null!=(i=t).face||(i.face=0),null!=(n=t).mode||(n.mode=2),this._lockedMode=t.mode,this._lockedLevel=t.level;var s=this.cubemap?this._levels[t.face]:this._levels;if(null===s[t.level]){var r=Math.max(1,this._width>>t.level),a=Math.max(1,this._height>>t.level),o=Math.max(1,this._depth>>t.level),h=new ArrayBuffer(Cs.calcLevelGpuSize(r,a,o,this._format));s[t.level]=new(Fe(this._format))(h)}return s[t.level]},i.setSource=function(t,e){void 0===e&&(e=0);var i,n,s=!1;if(this._cubemap){if(t[0]){i=t[0].width||0,n=t[0].height||0;for(var r=0;r<6;r++){var a=t[r];if(!a||a.width!==i||a.height!==n||!this.device._isBrowserInterface(a)){s=!0;break}}}else s=!0;if(!s)for(var o=0;o<6;o++)this._levels[e][o]!==t[o]&&(this._levelsUpdated[e][o]=!0)}else this.device._isBrowserInterface(t)||(s=!0),s||(t!==this._levels[e]&&(this._levelsUpdated[e]=!0),i=t.width,n=t.height);if(s)if(this._width=4,this._height=4,this._cubemap)for(var h=0;h<6;h++)this._levels[e][h]=null,this._levelsUpdated[e][h]=!0;else this._levels[e]=null,this._levelsUpdated[e]=!0;else 0===e&&(this._width=i,this._height=n),this._levels[e]=t;this._invalid===s&&s||(this._invalid=s,this.upload())},i.getSource=function(t){return void 0===t&&(t=0),this._levels[t]},i.unlock=function(){this._lockedMode,2===this._lockedMode&&this.upload(),this._lockedLevel=-1,this._lockedMode=0},i.upload=function(){var t,e;this._needsUpload=!0,this._needsMipmapsUpload=this._mipmaps,null==(t=(e=this.impl).uploadImmediate)||t.call(e,this.device,this)},i.downloadAsync=(e=m(S().mark((function t(){var e,i,n,s=this;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],i=S().mark((function t(){var i,r,a,o;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=new Dn({colorBuffer:s,depth:!1,face:n}),s.device.setRenderTarget(i),s.device.initRenderTarget(i),(r=s.cubemap?s._levels[n]:s._levels)[0],r[0]&&s.device._isBrowserInterface(r[0])&&(r[0]=null),a=s.lock({face:n}),o=null==s.device.readPixelsAsync?void 0:s.device.readPixelsAsync(0,0,s.width,s.height,a).then((function(){return i.destroy()})),e.push(o);case 9:case"end":return t.stop()}}),t)})),n=0;case 3:if(!(n<(this.cubemap?6:1))){t.next=8;break}return t.delegateYield(i(),"t0",5);case 5:n++,t.next=3;break;case 8:return t.next=10,Promise.all(e);case 10:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)}),v(t,[{key:"requiredMipLevels",get:function(){return this.mipmaps?Cs.calcMipLevelsCount(this.width,this.height):1}},{key:"lockedMode",get:function(){return this._lockedMode}},{key:"minFilter",get:function(){return this._minFilter},set:function(t){this._minFilter!==t&&(Oe(this._format)||(this._minFilter=t,this.propertyChanged(1)))}},{key:"magFilter",get:function(){return this._magFilter},set:function(t){this._magFilter!==t&&(Oe(this._format)||(this._magFilter=t,this.propertyChanged(2)))}},{key:"addressU",get:function(){return this._addressU},set:function(t){this._addressU!==t&&(this._addressU=t,this.propertyChanged(4))}},{key:"addressV",get:function(){return this._addressV},set:function(t){this._addressV!==t&&(this._addressV=t,this.propertyChanged(8))}},{key:"addressW",get:function(){return this._addressW},set:function(t){this.device.supportsVolumeTextures&&this._volume&&t!==this._addressW&&(this._addressW=t,this.propertyChanged(16))}},{key:"compareOnRead",get:function(){return this._compareOnRead},set:function(t){this._compareOnRead!==t&&(this._compareOnRead=t,this.propertyChanged(32))}},{key:"compareFunc",get:function(){return this._compareFunc},set:function(t){this._compareFunc!==t&&(this._compareFunc=t,this.propertyChanged(64))}},{key:"anisotropy",get:function(){return this._anisotropy},set:function(t){this._anisotropy!==t&&(this._anisotropy=t,this.propertyChanged(128))}},{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){this._mipmaps!==t&&(this.device.isWebGPU||Oe(this._format)||(this._mipmaps=t),t&&(this._needsMipmapsUpload=!0))}},{key:"storage",get:function(){return this._storage}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"depth",get:function(){return this._depth}},{key:"format",get:function(){return this._format}},{key:"cubemap",get:function(){return this._cubemap}},{key:"gpuSize",get:function(){var t=this.pot&&this._mipmaps&&!(this._compressed&&1===this._levels.length);return Cs.calcGpuSize(this._width,this._height,this._depth,this._format,t,this._cubemap)}},{key:"array",get:function(){return this._arrayLength>0}},{key:"arrayLength",get:function(){return this._arrayLength}},{key:"volume",get:function(){return this._volume}},{key:"flipY",get:function(){return this._flipY},set:function(t){this._flipY!==t&&(this._flipY=t,this._needsUpload=!0)}},{key:"premultiplyAlpha",get:function(){return this._premultiplyAlpha},set:function(t){this._premultiplyAlpha!==t&&(this._premultiplyAlpha=t,this._needsUpload=!0)}},{key:"pot",get:function(){return _t.powerOfTwo(this._width)&&_t.powerOfTwo(this._height)}},{key:"encoding",get:function(){switch(this.type){case vi:return"rgbm";case gi:return"rgbe";case yi:return"rgbp";default:return this.format===ge||this.format===xe||this.format===ye||this.format===Se||Oe(this.format)?"linear":"srgb"}}}])}(),fr=function(){function t(){this.bufferId=null}var e=t.prototype;return e.destroy=function(t){this.bufferId&&(t.gl.deleteBuffer(this.bufferId),this.bufferId=null)},e.loseContext=function(){this.bufferId=null},e.unlock=function(t,e,i,n){var s=t.gl;if(this.bufferId)s.bindBuffer(i,this.bufferId),s.bufferSubData(i,0,n);else{var r;switch(e){case 0:r=s.STATIC_DRAW;break;case 1:r=s.DYNAMIC_DRAW;break;case 2:r=s.STREAM_DRAW;break;case 3:r=t.isWebGL2?s.DYNAMIC_COPY:s.STATIC_DRAW}this.bufferId=s.createBuffer(),s.bindBuffer(i,this.bufferId),s.bufferData(i,n,r)}},v(t,[{key:"initialized",get:function(){return!!this.bufferId}}])}(),pr=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),s=0;se||n>e){var s=e/Math.max(i,n),r=Math.floor(i*s),a=Math.floor(n*s),o=document.createElement("canvas");return o.width=r,o.height=a,o.getContext("2d").drawImage(t,0,0,i,n,0,0,r,a),o}return t}var Tr=function(){function t(){this._glTexture=null,this._glTarget=void 0,this._glFormat=void 0,this._glInternalFormat=void 0,this._glPixelType=void 0,this._glCreated=void 0,this.dirtyParameterFlags=0}var e=t.prototype;return e.destroy=function(t){if(this._glTexture){for(var e=0;et.maxCubeMapSize||h.height>t.maxCubeMapSize)&&(h=br(h,t.maxCubeMapSize),0===r&&(e._width=h.width,e._height=h.height)),t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated?i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,0,0,this._glFormat,this._glPixelType,h):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,this._glInternalFormat,this._glFormat,this._glPixelType,h)}}else for(s=1/Math.pow(2,r),o=0;o<6;o++)if(e._levelsUpdated[0][o]){var l=n[o];e._compressed?this._glCreated&&l?i.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,0,0,Math.max(e._width*s,1),Math.max(e._height*s,1),this._glInternalFormat,l):i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),0,l):(t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated&&l?i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,0,0,Math.max(e._width*s,1),Math.max(e._height*s,1),this._glFormat,this._glPixelType,l):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),0,this._glFormat,this._glPixelType,l))}}else if(e._volume)e._compressed?i.compressedTexImage3D(i.TEXTURE_3D,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),Math.max(e._depth*s,1),0,n):(t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),i.texImage3D(i.TEXTURE_3D,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),Math.max(e._depth*s,1),0,this._glFormat,this._glPixelType,n));else if(e.array&&"object"==typeof n){if(e._arrayLength===n.length)if(e._compressed)for(var c=0;ct.maxTextureSize||n.height>t.maxTextureSize)&&(n=br(n,t.maxTextureSize),0===r&&(e._width=n.width,e._height=n.height));var d=n.width||n.videoWidth,f=n.height||n.videoHeight;t.setUnpackFlipY(e._flipY),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated&&e._width===d&&e._height===f&&!t._isImageVideoInterface(n)?i.texSubImage2D(i.TEXTURE_2D,r,0,0,this._glFormat,this._glPixelType,n):(i.texImage2D(i.TEXTURE_2D,r,this._glInternalFormat,this._glFormat,this._glPixelType,n),0===r&&(e._width=d,e._height=f))}else s=1/Math.pow(2,r),e._compressed?this._glCreated&&n?i.compressedTexSubImage2D(i.TEXTURE_2D,r,0,0,Math.max(Math.floor(e._width*s),1),Math.max(Math.floor(e._height*s),1),this._glInternalFormat,n):i.compressedTexImage2D(i.TEXTURE_2D,r,this._glInternalFormat,Math.max(Math.floor(e._width*s),1),Math.max(Math.floor(e._height*s),1),0,n):(t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated&&n?i.texSubImage2D(i.TEXTURE_2D,r,0,0,Math.max(e._width*s,1),Math.max(e._height*s,1),this._glFormat,this._glPixelType,n):i.texImage2D(i.TEXTURE_2D,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),0,this._glFormat,this._glPixelType,n));e._mipmapsUploaded=0!==r}r++}else r++;if(e._needsUpload)if(e._cubemap)for(var p=0;p<6;p++)e._levelsUpdated[0][p]=!1;else e._levelsUpdated[0]=!1;!e._compressed&&!e._integerFormat&&e._mipmaps&&e._needsMipmapsUpload&&(e.pot||t.isWebGL2)&&1===e._levels.length&&(i.generateMipmap(this._glTarget),e._mipmapsUploaded=!0),e._gpuSize&&e.adjustVramSizeTracking(t._vram,-e._gpuSize),e._gpuSize=e.gpuSize,e.adjustVramSizeTracking(t._vram,e._gpuSize),this._glCreated=!0}},t}(),wr=function(){function t(t,e){this.msaaFB=void 0,this.resolveFB=void 0,this.msaaFB=t,this.resolveFB=e}return t.prototype.destroy=function(t){this.msaaFB&&(t.deleteRenderbuffer(this.msaaFB),this.msaaFB=null),this.resolveFB&&(t.deleteRenderbuffer(this.resolveFB),this.resolveFB=null)},t}(),Er=function(){function t(){this._glFrameBuffer=null,this._glDepthBuffer=null,this._glResolveFrameBuffer=null,this.colorMrtFramebuffers=null,this._glMsaaColorBuffers=[],this._glMsaaDepthBuffer=null,this.suppliedColorFramebuffer=void 0,this._isInitialized=!1}var e=t.prototype;return e.destroy=function(t){var e,i=t.gl;this._isInitialized=!1,this._glFrameBuffer&&(this._glFrameBuffer!==this.suppliedColorFramebuffer&&i.deleteFramebuffer(this._glFrameBuffer),this._glFrameBuffer=null),this._glDepthBuffer&&(i.deleteRenderbuffer(this._glDepthBuffer),this._glDepthBuffer=null),this._glResolveFrameBuffer&&(this._glResolveFrameBuffer!==this.suppliedColorFramebuffer&&i.deleteFramebuffer(this._glResolveFrameBuffer),this._glResolveFrameBuffer=null),this._glMsaaColorBuffers.forEach((function(t){i.deleteRenderbuffer(t)})),this._glMsaaColorBuffers.length=0,null==(e=this.colorMrtFramebuffers)||e.forEach((function(t){t.destroy(i)})),this.colorMrtFramebuffers=null,this._glMsaaDepthBuffer&&(i.deleteRenderbuffer(this._glMsaaDepthBuffer),this._glMsaaDepthBuffer=null),this.suppliedColorFramebuffer=void 0},e.init=function(t,e){var i=t.gl;this._isInitialized=!0;var n=[];if(void 0!==this.suppliedColorFramebuffer)this._glFrameBuffer=this.suppliedColorFramebuffer;else{var s,r,a,o;this._glFrameBuffer=i.createFramebuffer(),t.setFramebuffer(this._glFrameBuffer);for(var h=null!=(s=null==(r=e._colorBuffers)?void 0:r.length)?s:0,l=t.isWebGL2?i.COLOR_ATTACHMENT0:null!=(a=null==(o=t.extDrawBuffers)?void 0:o.COLOR_ATTACHMENT0_WEBGL)?a:i.COLOR_ATTACHMENT0,c=0;c1&&t.isWebGL2)){if(this._glDepthBuffer||(this._glDepthBuffer=i.createRenderbuffer()),i.bindRenderbuffer(i.RENDERBUFFER,this._glDepthBuffer),e._stencil)i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,this._glDepthBuffer);else{var f=t.isWebGL2?i.DEPTH_COMPONENT32F:i.DEPTH_COMPONENT16;i.renderbufferStorage(i.RENDERBUFFER,f,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,this._glDepthBuffer)}i.bindRenderbuffer(i.RENDERBUFFER,null)}}}if(t.isWebGL2&&e._samples>1){var p,m;this._glResolveFrameBuffer=this._glFrameBuffer,this._glFrameBuffer=i.createFramebuffer(),t.setFramebuffer(this._glFrameBuffer);var _=null!=(p=null==(m=e._colorBuffers)?void 0:m.length)?p:0;if(void 0!==this.suppliedColorFramebuffer){var v=i.createRenderbuffer();this._glMsaaColorBuffers.push(v);var g=7===t.backBufferFormat?i.RGBA8:i.RGB8;i.bindRenderbuffer(i.RENDERBUFFER,v),i.renderbufferStorageMultisample(i.RENDERBUFFER,e._samples,g,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,v)}else for(var y=0;y<_;++y){var x=e.getColorBuffer(y);if(x){var S=i.createRenderbuffer();this._glMsaaColorBuffers.push(S),i.bindRenderbuffer(i.RENDERBUFFER,S),i.renderbufferStorageMultisample(i.RENDERBUFFER,e._samples,x.impl._glInternalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+y,i.RENDERBUFFER,S)}}e._depth&&(this._glMsaaDepthBuffer||(this._glMsaaDepthBuffer=i.createRenderbuffer()),i.bindRenderbuffer(i.RENDERBUFFER,this._glMsaaDepthBuffer),e._stencil?(i.renderbufferStorageMultisample(i.RENDERBUFFER,e._samples,i.DEPTH24_STENCIL8,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,this._glMsaaDepthBuffer)):(i.renderbufferStorageMultisample(i.RENDERBUFFER,e._samples,i.DEPTH_COMPONENT32F,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,this._glMsaaDepthBuffer))),_>1&&(this._createMsaaMrtFramebuffers(t,e,_),t.setFramebuffer(this._glFrameBuffer),t.drawBuffers(n))}},e._createMsaaMrtFramebuffers=function(t,e,i){var n=t.gl;this.colorMrtFramebuffers=[];for(var s=0;s=0&&!(n>0&&"/"===t[n-1]);){var s=t.indexOf(";",n),r=t.lastIndexOf(" ",s),a=t.substring(r+1,s);if(e[a]);else{var o=Lr[a];void 0!==o?e[a]=o:(e[a]="ATTR"+i,i++)}n=t.indexOf("attribute",n+1)}return e},t}(),Or=function(){function t(){this.renderVersion=void 0,this.queries=[]}return t.prototype.destroy=function(t){this.queries.forEach((function(e){return t.deleteQuery(e)})),this.queries=null},t}(),Fr=function(t){function e(e){var i;return(i=t.call(this)||this).device=void 0,i.freeQueries=[],i.frameQueries=[],i.previousFrameQueries=[],i.timings=[],i.device=e,i.ext=e.extDisjointTimerQuery,i}x(e,t);var i=e.prototype;return i.destroy=function(){var t=this;this.freeQueries.forEach((function(e){return t.device.gl.deleteQuery(e)})),this.frameQueries.forEach((function(e){return t.device.gl.deleteQuery(e)})),this.previousFrameQueries.forEach((function(e){return e.destroy(t.device.gl)})),this.freeQueries=null,this.frameQueries=null,this.previousFrameQueries=null},i.loseContext=function(){t.prototype.loseContext.call(this),this.freeQueries=[],this.frameQueries=[],this.previousFrameQueries=[]},i.restoreContext=function(){this.ext=this.device.extDisjointTimerQuery},i.getQuery=function(){var t;return null!=(t=this.freeQueries.pop())?t:this.device.gl.createQuery()},i.start=function(t){if(this.ext){var e=this.getSlot(t),i=this.getQuery();return this.frameQueries[e]=i,this.device.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,i),e}},i.end=function(t){void 0!==t&&this.device.gl.endQuery(this.ext.TIME_ELAPSED_EXT)},i.frameStart=function(){this.processEnableRequest(),this._enabled&&(this.frameGPUMarkerSlot=this.start("GpuFrame"))},i.frameEnd=function(){this._enabled&&this.end(this.frameGPUMarkerSlot)},i.request=function(){var e=this;if(this._enabled){var i=this.ext,n=this.device.gl,s=this.device.renderVersion,r=this.frameQueries;if(r.length>0){this.frameQueries=[];var a=new Or;a.queries=r,a.renderVersion=s,this.previousFrameQueries.push(a)}if(this.previousFrameQueries.length>0){var o=this.previousFrameQueries[0],h=o.queries,l=h[h.length-1],c=n.getQueryParameter(l,n.QUERY_RESULT_AVAILABLE),u=n.getParameter(i.GPU_DISJOINT_EXT);if(c&&!u){this.previousFrameQueries.shift();var d=this.timings;d.length=0;for(var f=0;f=120||115===h)&&(i.antialias=!1)}}var l=null;if(s.backBufferAntialias=null!=(n=i.antialias)&&n,i.antialias=!1,i.gl)l=i.gl;else for(var c=void 0===i.preferWebGl2||i.preferWebGl2?["webgl2","webgl","experimental-webgl"]:["webgl","experimental-webgl"],u=0;u0;var x=s.vertexUniformsCount;return x-=16,x-=8,x-=1,x-=16,s.boneLimit=Math.floor(x/3),s.boneLimit=Math.min(s.boneLimit,128),s.constantTexSource=s.scope.resolve("source"),s.extTextureFloat?s.isWebGL2?s.textureFloatRenderable=!!s.extColorBufferFloat:s.textureFloatRenderable=zr(l,l.FLOAT):s.textureFloatRenderable=!1,s.extColorBufferHalfFloat?s.textureHalfFloatRenderable=!!s.extColorBufferHalfFloat:s.extTextureHalfFloat?s.isWebGL2?s.textureHalfFloatRenderable=!!s.extColorBufferFloat:s.textureHalfFloatRenderable=zr(l,s.extTextureHalfFloat.HALF_FLOAT_OES):s.textureHalfFloatRenderable=!1,s.supportsMorphTargetTexturesCore="highp"===s.maxPrecision&&s.maxVertexTextures>=2,s.supportsDepthShadow=s.isWebGL2,s._textureFloatHighPrecision=void 0,s._textureHalfFloatUpdatable=void 0,s.areaLightLutFormat=7,s.extTextureHalfFloat&&s.textureHalfFloatUpdatable&&s.extTextureHalfFloatLinear?s.areaLightLutFormat=ye:s.extTextureFloat&&s.extTextureFloatLinear&&(s.areaLightLutFormat=Se),s.postInit(),s}x(e,t);var i,n=e.prototype;return n.postInit=function(){t.prototype.postInit.call(this),this.gpuProfiler=new Fr(this)},n.destroy=function(){t.prototype.destroy.call(this);var e=this.gl;this.isWebGL2&&this.feedback&&e.deleteTransformFeedback(this.feedback),this.clearVertexArrayObjectCache(),this.canvas.removeEventListener("webglcontextlost",this._contextLostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this._contextRestoredHandler,!1),this._contextLostHandler=null,this._contextRestoredHandler=null,this.gl=null,t.prototype.postDestroy.call(this)},n.createBackbuffer=function(t){this.supportsStencil=this.initOptions.stencil,this.backBuffer=new Dn({name:"WebglFramebuffer",graphicsDevice:this,depth:this.initOptions.depth,stencil:this.supportsStencil,samples:this.samples}),this.backBuffer.impl.suppliedColorFramebuffer=t},n.updateBackbufferFormat=function(t){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t);var i=this.gl.getParameter(this.gl.ALPHA_BITS);this.backBufferFormat=i?7:6},n.updateBackbuffer=function(){var t=this.canvas.width!==this.backBufferSize.x||this.canvas.height!==this.backBufferSize.y;(this._defaultFramebufferChanged||t)&&(this._defaultFramebufferChanged&&this.updateBackbufferFormat(this._defaultFramebuffer),this._defaultFramebufferChanged=!1,this.backBufferSize.set(this.canvas.width,this.canvas.height),this.backBuffer.destroy(),this.createBackbuffer(this._defaultFramebuffer))},n.createVertexBufferImpl=function(t,e){return new pr},n.createIndexBufferImpl=function(t){return new mr(t)},n.createShaderImpl=function(t){return new Sr(t)},n.createTextureImpl=function(t){return new Tr},n.createRenderTargetImpl=function(t){return new Er},n.getPrecision=function(){var t=this.gl,e="highp";if(t.getShaderPrecisionFormat){var i=t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT),n=t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT),s=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT),r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT);if(i&&n&&s&&r){var a=i.precision>0&&s.precision>0,o=n.precision>0&&r.precision>0;a||(e=o?"mediump":"lowp")}}return e},n.getExtension=function(){for(var t=0;t0&&t.fullSizeClearRect&&s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,Br)}null!=(n=t.colorOps)&&n.resolve&&this.isWebGL2&&t.samples>1&&e.autoResolve&&e.resolve(!0,!1);for(var o=0;o1&&t.autoResolve&&t.resolve();var e=t._colorBuffer;e&&e.impl._glTexture&&e.mipmaps&&(e.pot||this.isWebGL2)&&(this.activeTexture(this.maxCombinedTextures-1),this.bindTexture(e),this.gl.generateMipmap(e.impl._glTarget))}},n.setUnpackFlipY=function(t){if(this.unpackFlipY!==t){this.unpackFlipY=t;var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t)}},n.setUnpackPremultiplyAlpha=function(t){if(this.unpackPremultiplyAlpha!==t){this.unpackPremultiplyAlpha=t;var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t)}},n.activeTexture=function(t){this.textureUnit!==t&&(this.gl.activeTexture(this.gl.TEXTURE0+t),this.textureUnit=t)},n.bindTexture=function(t){var e=t.impl,i=e._glTarget,n=e._glTexture,s=this.textureUnit,r=this.targetToSlot[i];this.textureUnits[s][r]!==n&&(this.gl.bindTexture(i,n),this.textureUnits[s][r]=n)},n.bindTextureOnUnit=function(t,e){var i=t.impl,n=i._glTarget,s=i._glTexture,r=this.targetToSlot[n];this.textureUnits[e][r]!==s&&(this.activeTexture(e),this.gl.bindTexture(n,s),this.textureUnits[e][r]=s)},n.setTextureParameters=function(t){var e=this.gl,i=t.impl.dirtyParameterFlags,n=t.impl._glTarget;if(1&i){var s=t._minFilter;(!t.pot&&!this.isWebGL2||!t._mipmaps||t._compressed&&1===t._levels.length)&&(2===s||3===s?s=0:4!==s&&5!==s||(s=1)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,this.glFilter[s])}if(2&i&&e.texParameteri(n,e.TEXTURE_MAG_FILTER,this.glFilter[t._magFilter]),4&i&&(this.isWebGL2?e.texParameteri(n,e.TEXTURE_WRAP_S,this.glAddress[t._addressU]):e.texParameteri(n,e.TEXTURE_WRAP_S,this.glAddress[t.pot?t._addressU:1])),8&i&&(this.isWebGL2?e.texParameteri(n,e.TEXTURE_WRAP_T,this.glAddress[t._addressV]):e.texParameteri(n,e.TEXTURE_WRAP_T,this.glAddress[t.pot?t._addressV:1])),16&i&&this.isWebGL2&&e.texParameteri(n,e.TEXTURE_WRAP_R,this.glAddress[t._addressW]),32&i&&this.isWebGL2&&e.texParameteri(n,e.TEXTURE_COMPARE_MODE,t._compareOnRead?e.COMPARE_REF_TO_TEXTURE:e.NONE),64&i&&this.isWebGL2&&e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,this.glComparison[t._compareFunc]),128&i){var r=this.extTextureFilterAnisotropic;r&&e.texParameterf(n,r.TEXTURE_MAX_ANISOTROPY_EXT,_t.clamp(Math.round(t._anisotropy),1,this.maxAnisotropy))}},n.setTexture=function(t,e){var i=t.impl;i._glTexture||i.initialize(this,t),i.dirtyParameterFlags>0||t._needsUpload||t._needsMipmapsUpload?(this.activeTexture(e),this.bindTexture(t),i.dirtyParameterFlags&&(this.setTextureParameters(t),i.dirtyParameterFlags=0),(t._needsUpload||t._needsMipmapsUpload)&&(i.upload(this,t),t._needsUpload=!1,t._needsMipmapsUpload=!1)):this.bindTextureOnUnit(t,e)},n.createVertexArray=function(t){var e,i,n=t.length>1;if(n){e="";for(var s=0;s0?n.drawElementsInstanced(S,b,w,E,e):n.drawElements(S,b,w,E)}else{var A=t.base;e>0?n.drawArraysInstanced(S,A,b,e):n.drawArrays(S,A,b)}this.isWebGL2&&this.transformFeedbackBuffer&&(n.endTransformFeedback(),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,null)),this._drawCallsPerFrame++}}},n.clear=function(t){var e,i=this.defaultClearOptions,n=null!=(e=(t=t||i).flags)?e:i.flags;if(0!==n){var s=this.gl;if(1&n){var r,a=null!=(r=t.color)?r:i.color,o=a[0],h=a[1],l=a[2],c=a[3],u=this.clearColor;o===u.r&&h===u.g&&l===u.b&&c===u.a||(this.gl.clearColor(o,h,l,c),this.clearColor.set(o,h,l,c)),this.setBlendState(hn.NOBLEND)}if(2&n){var d,f=null!=(d=t.depth)?d:i.depth;f!==this.clearDepth&&(this.gl.clearDepth(f),this.clearDepth=f),this.setDepthState(dn.WRITEDEPTH)}if(4&n){var p,m=null!=(p=t.stencil)?p:i.stencil;m!==this.clearStencil&&(this.gl.clearStencil(m),this.clearStencil=m),s.stencilMask(255),this.stencilWriteMaskFront=255,this.stencilWriteMaskBack=255}s.clear(this.glClearFlag[n])}},n.submit=function(){this.gl.flush()},n.readPixels=function(t,e,i,n,s){var r=this.gl;r.readPixels(t,e,i,n,r.RGBA,r.UNSIGNED_BYTE,s)},n.readPixelsAsync=(i=m(S().mark((function t(e,i,n,s,r){var a,o,h,l,c,u,d,f,p,m=this;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l=this.gl,this.isWebGL2){t.next=4;break}return this.readPixels(e,i,n,s,r),t.abrupt("return");case 4:return c=function(t,e){var i=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);return m.submit(),new Promise((function(n,s){!function r(){var a=l.clientWaitSync(i,t,0);a===l.WAIT_FAILED?(l.deleteSync(i),s(new Error("webgl clientWaitSync sync failed"))):a===l.TIMEOUT_EXPIRED?setTimeout(r,e):(l.deleteSync(i),n())}()}))},u=null==(a=this.renderTarget.colorBuffer)?void 0:a.impl,d=null!=(o=null==u?void 0:u._glFormat)?o:l.RGBA,f=null!=(h=null==u?void 0:u._glPixelType)?h:l.UNSIGNED_BYTE,p=l.createBuffer(),l.bindBuffer(l.PIXEL_PACK_BUFFER,p),l.bufferData(l.PIXEL_PACK_BUFFER,r.byteLength,l.STREAM_READ),l.readPixels(e,i,n,s,d,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),t.next=15,c(0,20);case 15:l.bindBuffer(l.PIXEL_PACK_BUFFER,p),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,r),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),l.deleteBuffer(p);case 19:case"end":return t.stop()}}),t,this)}))),function(t,e,n,s,r){return i.apply(this,arguments)}),n.setAlphaToCoverage=function(t){this.isWebGL1||this.alphaToCoverage!==t&&(this.alphaToCoverage=t,t?this.gl.enable(this.gl.SAMPLE_ALPHA_TO_COVERAGE):this.gl.disable(this.gl.SAMPLE_ALPHA_TO_COVERAGE))},n.setTransformFeedbackBuffer=function(t){if(this.transformFeedbackBuffer!==t&&(this.transformFeedbackBuffer=t,this.isWebGL2)){var e=this.gl;t?(this.feedback||(this.feedback=e.createTransformFeedback()),e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,this.feedback)):e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}},n.setRaster=function(t){this.raster!==t&&(this.raster=t,this.isWebGL2&&(t?this.gl.disable(this.gl.RASTERIZER_DISCARD):this.gl.enable(this.gl.RASTERIZER_DISCARD)))},n.setStencilTest=function(t){if(this.stencil!==t){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.stencil=t}},n.setStencilFunc=function(t,e,i){this.stencilFuncFront===t&&this.stencilRefFront===e&&this.stencilMaskFront===i&&this.stencilFuncBack===t&&this.stencilRefBack===e&&this.stencilMaskBack===i||(this.gl.stencilFunc(this.glComparison[t],e,i),this.stencilFuncFront=this.stencilFuncBack=t,this.stencilRefFront=this.stencilRefBack=e,this.stencilMaskFront=this.stencilMaskBack=i)},n.setStencilFuncFront=function(t,e,i){if(this.stencilFuncFront!==t||this.stencilRefFront!==e||this.stencilMaskFront!==i){var n=this.gl;n.stencilFuncSeparate(n.FRONT,this.glComparison[t],e,i),this.stencilFuncFront=t,this.stencilRefFront=e,this.stencilMaskFront=i}},n.setStencilFuncBack=function(t,e,i){if(this.stencilFuncBack!==t||this.stencilRefBack!==e||this.stencilMaskBack!==i){var n=this.gl;n.stencilFuncSeparate(n.BACK,this.glComparison[t],e,i),this.stencilFuncBack=t,this.stencilRefBack=e,this.stencilMaskBack=i}},n.setStencilOperation=function(t,e,i,n){this.stencilFailFront===t&&this.stencilZfailFront===e&&this.stencilZpassFront===i&&this.stencilFailBack===t&&this.stencilZfailBack===e&&this.stencilZpassBack===i||(this.gl.stencilOp(this.glStencilOp[t],this.glStencilOp[e],this.glStencilOp[i]),this.stencilFailFront=this.stencilFailBack=t,this.stencilZfailFront=this.stencilZfailBack=e,this.stencilZpassFront=this.stencilZpassBack=i),this.stencilWriteMaskFront===n&&this.stencilWriteMaskBack===n||(this.gl.stencilMask(n),this.stencilWriteMaskFront=n,this.stencilWriteMaskBack=n)},n.setStencilOperationFront=function(t,e,i,n){this.stencilFailFront===t&&this.stencilZfailFront===e&&this.stencilZpassFront===i||(this.gl.stencilOpSeparate(this.gl.FRONT,this.glStencilOp[t],this.glStencilOp[e],this.glStencilOp[i]),this.stencilFailFront=t,this.stencilZfailFront=e,this.stencilZpassFront=i),this.stencilWriteMaskFront!==n&&(this.gl.stencilMaskSeparate(this.gl.FRONT,n),this.stencilWriteMaskFront=n)},n.setStencilOperationBack=function(t,e,i,n){this.stencilFailBack===t&&this.stencilZfailBack===e&&this.stencilZpassBack===i||(this.gl.stencilOpSeparate(this.gl.BACK,this.glStencilOp[t],this.glStencilOp[e],this.glStencilOp[i]),this.stencilFailBack=t,this.stencilZfailBack=e,this.stencilZpassBack=i),this.stencilWriteMaskBack!==n&&(this.gl.stencilMaskSeparate(this.gl.BACK,n),this.stencilWriteMaskBack=n)},n.setBlendState=function(t){var e=this.blendState;if(!e.equals(t)){var i=this.gl,n=t.blend,s=t.colorOp,r=t.alphaOp,a=t.colorSrcFactor,o=t.colorDstFactor,h=t.alphaSrcFactor,l=t.alphaDstFactor;if(e.blend!==n&&(n?i.enable(i.BLEND):i.disable(i.BLEND)),e.colorOp!==s||e.alphaOp!==r){var c=this.glBlendEquation;i.blendEquationSeparate(c[s],c[r])}e.colorSrcFactor===a&&e.colorDstFactor===o&&e.alphaSrcFactor===h&&e.alphaDstFactor===l||i.blendFuncSeparate(this.glBlendFunctionColor[a],this.glBlendFunctionColor[o],this.glBlendFunctionAlpha[h],this.glBlendFunctionAlpha[l]),e.allWrite!==t.allWrite&&this.gl.colorMask(t.redWrite,t.greenWrite,t.blueWrite,t.alphaWrite),e.copy(t)}},n.setBlendColor=function(t,e,i,n){var s=this.blendColor;t===s.r&&e===s.g&&i===s.b&&n===s.a||(this.gl.blendColor(t,e,i,n),s.set(t,e,i,n))},n.setStencilState=function(t,e){t||e?(this.setStencilTest(!0),t===e?(this.setStencilFunc(t.func,t.ref,t.readMask),this.setStencilOperation(t.fail,t.zfail,t.zpass,t.writeMask)):(null!=t||(t=Pn.DEFAULT),this.setStencilFuncFront(t.func,t.ref,t.readMask),this.setStencilOperationFront(t.fail,t.zfail,t.zpass,t.writeMask),null!=e||(e=Pn.DEFAULT),this.setStencilFuncBack(e.func,e.ref,e.readMask),this.setStencilOperationBack(e.fail,e.zfail,e.zpass,e.writeMask))):this.setStencilTest(!1)},n.setDepthState=function(t){var e=this.depthState;if(!e.equals(t)){var i=this.gl,n=t.write;e.write!==n&&i.depthMask(n);var s=t.func,r=t.test;!r&&n&&(r=!0,s=7),e.func!==s&&i.depthFunc(this.glComparison[s]),e.test!==r&&(r?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST));var a=t.depthBias,o=t.depthBiasSlope;a||o?(this.depthBiasEnabled||(this.depthBiasEnabled=!0,this.gl.enable(this.gl.POLYGON_OFFSET_FILL)),i.polygonOffset(o,a)):this.depthBiasEnabled&&(this.depthBiasEnabled=!1,this.gl.disable(this.gl.POLYGON_OFFSET_FILL)),e.copy(t)}},n.setCullMode=function(t){if(this.cullMode!==t){if(t===_e)this.gl.disable(this.gl.CULL_FACE);else{this.cullMode===_e&&this.gl.enable(this.gl.CULL_FACE);var e=this.glCull[t];this.cullFace!==e&&(this.gl.cullFace(e),this.cullFace=e)}this.cullMode=t}},n.setShader=function(t,e){void 0===e&&(e=!1),t!==this.shader&&(this.shader=t,this.shaderAsyncCompile=e,this.shaderValid=void 0)},n.activateShader=function(t){var e=this.shader,i=e.impl;void 0===this.shaderValid&&(e.failed?this.shaderValid=!1:e.ready||(this.shaderAsyncCompile?i.isLinked(t)?i.finalize(this,e)||(e.failed=!0,this.shaderValid=!1):this.shaderValid=!1:i.finalize(this,e)||(e.failed=!0,this.shaderValid=!1))),void 0===this.shaderValid&&(this.gl.useProgram(i.glProgram),this.shaderValid=!0)},n.clearVertexArrayObjectCache=function(){var t=this.gl;this._vaoMap.forEach((function(e,i,n){t.deleteVertexArray(e)})),this._vaoMap.clear()},v(e,[{key:"extDisjointTimerQuery",get:function(){return this._extDisjointTimerQuery||this.isWebGL2&&(this._extDisjointTimerQuery=this.getExtension("EXT_disjoint_timer_query_webgl2","EXT_disjoint_timer_query")),this._extDisjointTimerQuery}},{key:"defaultFramebuffer",get:function(){return this._defaultFramebuffer},set:function(t){this._defaultFramebuffer!==t&&(this._defaultFramebuffer=t,this._defaultFramebufferChanged=!0)}},{key:"fullscreen",get:function(){return!!document.fullscreenElement},set:function(t){t?this.gl.canvas.requestFullscreen():document.exitFullscreen()}},{key:"textureFloatHighPrecision",get:function(){return void 0===this._textureFloatHighPrecision&&(this._textureFloatHighPrecision=function(t){if(!t.textureFloatRenderable)return!1;var e=new Xs(t,kr.createDefinition(t,{name:"ptest1",vertexCode:Nr,fragmentCode:"\nvoid main(void) { \n\tgl_FragColor = vec4(2147483648.0);\n}\n"})),i=new Xs(t,kr.createDefinition(t,{name:"ptest2",vertexCode:Nr,fragmentCode:"\nuniform sampler2D source;\nvec4 packFloat(float depth) {\n\tconst vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n\tconst vec4 bit_mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n\tvec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main(void) {\n\tfloat c = texture2D(source, vec2(0.0)).r;\n\tfloat diff = abs(c - 2147483648.0) / 2147483648.0;\n\tgl_FragColor = packFloat(diff);\n}\n"})),n={format:Se,width:1,height:1,mipmaps:!1,minFilter:0,magFilter:0,name:"testFHP"},s=new dr(t,n),r=new Dn({colorBuffer:s,depth:!1});Ur(t,r,e),n.format=7;var a=new dr(t,n),o=new Dn({colorBuffer:a,depth:!1});t.constantTexSource.setValue(s),Ur(t,o,i);var h=t.activeFramebuffer;t.setFramebuffer(o.impl._glFrameBuffer);var l=new Uint8Array(4);t.readPixels(0,0,1,1,l),t.setFramebuffer(h);var c=l[0]/255/16777216+l[1]/255/65536+l[2]/255/256+l[3]/255;return s.destroy(),r.destroy(),a.destroy(),o.destroy(),e.destroy(),i.destroy(),0===c}(this)),this._textureFloatHighPrecision}},{key:"textureHalfFloatUpdatable",get:function(){return void 0===this._textureHalfFloatUpdatable&&(this.isWebGL2?this._textureHalfFloatUpdatable=!0:this._textureHalfFloatUpdatable=function(t,e){var i=!0,n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE);var s=new Uint16Array(16);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,2,2,0,t.RGBA,e,s),t.getError()!==t.NO_ERROR&&(i=!1,console.log("Above error related to HALF_FLOAT_OES can be ignored, it was triggered by testing half float texture support")),t.bindTexture(t.TEXTURE_2D,null),t.deleteTexture(n),i}(this.gl,this.extTextureHalfFloat.HALF_FLOAT_OES)),this._textureHalfFloatUpdatable}}])}(Rn),Gr=function(){function t(){}return t.prototype.unlock=function(t){},t}(),Hr=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.init=function(t,e){},e.loseContext=function(){},e.resolve=function(t,e,i,n){},t}(),Wr=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.loseContext=function(){},e.restoreContext=function(t,e){},t}(),Xr=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.propertyChanged=function(t){},e.loseContext=function(){},t}(),jr=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.unlock=function(t){},t}(),qr=function(t){function e(e,i){var n;return void 0===i&&(i={}),i=(n=t.call(this,e,i)||this).initOptions,n.isNull=!0,n._deviceType=ji,n.samples=1,n}x(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i.initDeviceCaps=function(){this.disableParticleSystem=!0,this.precision="highp",this.maxPrecision="highp",this.maxSamples=4,this.maxTextures=16,this.maxTextureSize=4096,this.maxCubeMapSize=4096,this.maxVolumeSize=4096,this.maxColorAttachments=8,this.maxPixelRatio=1,this.maxAnisotropy=16,this.supportsInstancing=!0,this.supportsUniformBuffers=!1,this.supportsVolumeTextures=!0,this.supportsBoneTextures=!0,this.supportsMorphTargetTexturesCore=!0,this.supportsAreaLights=!0,this.supportsDepthShadow=!0,this.supportsGpuParticles=!1,this.supportsMrt=!0,this.extUintElement=!0,this.extTextureFloat=!0,this.textureFloatRenderable=!0,this.extTextureHalfFloat=!0,this.textureHalfFloatRenderable=!0,this.textureHalfFloatUpdatable=!0,this.boneLimit=1024,this.supportsImageBitmap=!0,this.extStandardDerivatives=!0,this.extBlendMinmax=!0,this.areaLightLutFormat=7,this.supportsTextureFetch=!0},i.postInit=function(){t.prototype.postInit.call(this)},i.frameStart=function(){t.prototype.frameStart.call(this)},i.frameEnd=function(){t.prototype.frameEnd.call(this)},i.updateBegin=function(){},i.updateEnd=function(){},i.readPixels=function(t,e,i,n,s){},i.createVertexBufferImpl=function(t,e){return new jr(t,e)},i.createIndexBufferImpl=function(t){return new Gr(t)},i.createShaderImpl=function(t){return new Wr(t)},i.createTextureImpl=function(t){return new Xr(t)},i.createRenderTargetImpl=function(t){return new Hr(t)},i.draw=function(t,e,i){},i.setShader=function(t,e){},i.setBlendState=function(t){},i.setDepthState=function(t){},i.setStencilState=function(t,e){},i.setBlendColor=function(t,e,i,n){},i.setCullMode=function(t){},i.setAlphaToCoverage=function(t){},i.initializeContextCaches=function(){t.prototype.initializeContextCaches.call(this)},i.clear=function(t){},i.setViewport=function(t,e,i,n){},i.setScissor=function(t,e,i,n){},i.copyRenderTarget=function(t,e,i,n){return!0},e}(Rn);var Yr=function(){this.value=void 0,this.scopeId=null},Kr=function(){function t(t,e,i){void 0===i&&(i="Unnamed"),this.shader=null,this.name=void 0,this.parameters=new Map,this.countX=1,this.countY=void 0,this.countZ=void 0,this.device=t,this.shader=e,this.name=i,t.supportsCompute&&(this.impl=t.createComputeImpl(this))}var e=t.prototype;return e.setParameter=function(t,e){var i=this.parameters.get(t);i||((i=new Yr).scopeId=this.device.scope.resolve(t),this.parameters.set(t,i)),i.value=e},e.getParameter=function(t){var e;return null==(e=this.parameters.get(t))?void 0:e.value},e.deleteParameter=function(t){this.parameters.delete(t)},e.applyParameters=function(){for(var t,e=g(this.parameters);!(t=e()).done;){var i=t.value[1];i.scopeId.setValue(i.value)}},e.setupDispatch=function(t,e,i){this.countX=t,this.countY=e,this.countZ=i},t}(),Zr=0,Qr=function(){function t(t,e,i,n,s,r){void 0===n&&(n=0),this.device=t,this.format=e,this.numIndices=i,this.usage=n,this.id=Zr++,this.impl=t.createIndexBufferImpl(this,r);var a=$i[e];this.bytesPerIndex=a,this.numBytes=this.numIndices*a,s?this.setData(s):this.storage=new ArrayBuffer(this.numBytes),this.adjustVramSizeTracking(t._vram,this.numBytes),this.device.buffers.push(this)}var e=t.prototype;return e.destroy=function(){var t=this.device,e=t.buffers.indexOf(this);-1!==e&&t.buffers.splice(e,1),this.device.indexBuffer===this&&(this.device.indexBuffer=null),this.impl.initialized&&(this.impl.destroy(t),this.adjustVramSizeTracking(t._vram,-this.storage.byteLength))},e.adjustVramSizeTracking=function(t,e){t.ib+=e},e.loseContext=function(){this.impl.loseContext()},e.getFormat=function(){return this.format},e.getNumIndices=function(){return this.numIndices},e.lock=function(){return this.storage},e.unlock=function(){this.impl.unlock(this)},e.setData=function(t){return t.byteLength===this.numBytes&&(this.storage=t,this.unlock(),!0)},e._lockTypedArray=function(){var t=this.lock();return 2===this.format?new Uint32Array(t):1===this.format?new Uint16Array(t):new Uint8Array(t)},e.writeData=function(t,e){var i=this._lockTypedArray();if(t.length>e)if(ArrayBuffer.isView(t))t=t.subarray(0,e),i.set(t);else for(var n=0;nthis.vertexBuffer.numVertices&&(i=this.vertexBuffer.numVertices);var s=n.numComponents;if(this.vertexBuffer.getFormat().interleaved)for(var r=0,a=0;ai*s){var o=i*s;if(ArrayBuffer.isView(e))e=e.subarray(0,o),n.array.set(e);else for(var h=0;h0?this.wheelDelta=1:i.deltaY<0&&(this.wheelDelta=-1)),ka()?(this.dx=i.movementX||i.webkitMovementX||i.mozMovementX||0,this.dy=i.movementY||i.webkitMovementY||i.mozMovementY||0):(this.dx=this.x-e._lastX,this.dy=this.y-e._lastY),"mousedown"!==i.type&&"mouseup"!==i.type||(this.button=i.button),this.buttons=e._buttons.slice(0),this.element=i.target,this.ctrlKey=null!=(n=i.ctrlKey)&&n,this.altKey=null!=(s=i.altKey)&&s,this.shiftKey=null!=(r=i.shiftKey)&&r,this.metaKey=null!=(a=i.metaKey)&&a,this.event=i},Fa=function(t){function e(e){var i;return(i=t.call(this)||this)._lastX=0,i._lastY=0,i._buttons=[!1,!1,!1],i._lastbuttons=[!1,!1,!1],i._target=null,i._attached=!1,i._upHandler=i._handleUp.bind(i),i._downHandler=i._handleDown.bind(i),i._moveHandler=i._handleMove.bind(i),i._wheelHandler=i._handleWheel.bind(i),i._contextMenuHandler=function(t){t.preventDefault()},i.attach(e),i}x(e,t),e.isPointerLocked=function(){return ka()};var i=e.prototype;return i.attach=function(t){if(this._target=t,!this._attached){this._attached=!0;var e=!!G.passiveEvents&&{passive:!1};window.addEventListener("mouseup",this._upHandler,e),window.addEventListener("mousedown",this._downHandler,e),window.addEventListener("mousemove",this._moveHandler,e),window.addEventListener("wheel",this._wheelHandler,e)}},i.detach=function(){if(this._attached){this._attached=!1,this._target=null;var t=!!G.passiveEvents&&{passive:!1};window.removeEventListener("mouseup",this._upHandler,t),window.removeEventListener("mousedown",this._downHandler,t),window.removeEventListener("mousemove",this._moveHandler,t),window.removeEventListener("wheel",this._wheelHandler,t)}},i.disableContextMenu=function(){this._target&&this._target.addEventListener("contextmenu",this._contextMenuHandler)},i.enableContextMenu=function(){this._target&&this._target.removeEventListener("contextmenu",this._contextMenuHandler)},i.enablePointerLock=function(t,e){if(document.body.requestPointerLock){var i=function(){t(),document.removeEventListener("pointerlockchange",i)},n=function(){e(),document.removeEventListener("pointerlockerror",n)};t&&document.addEventListener("pointerlockchange",i,!1),e&&document.addEventListener("pointerlockerror",n,!1),document.body.requestPointerLock()}else e&&e()},i.disablePointerLock=function(t){if(document.exitPointerLock){var e=function(){t(),document.removeEventListener("pointerlockchange",e)};t&&document.addEventListener("pointerlockchange",e,!1),document.exitPointerLock()}},i.update=function(){this._lastbuttons[0]=this._buttons[0],this._lastbuttons[1]=this._buttons[1],this._lastbuttons[2]=this._buttons[2]},i.isPressed=function(t){return this._buttons[t]},i.wasPressed=function(t){return this._buttons[t]&&!this._lastbuttons[t]},i.wasReleased=function(t){return!this._buttons[t]&&this._lastbuttons[t]},i._handleUp=function(t){this._buttons[t.button]=!1;var e=new Oa(this,t);e.event&&this.fire(wa,e)},i._handleDown=function(t){this._buttons[t.button]=!0;var e=new Oa(this,t);e.event&&this.fire(ba,e)},i._handleMove=function(t){var e=new Oa(this,t);e.event&&(this.fire(Ta,e),this._lastX=e.x,this._lastY=e.y)},i._handleWheel=function(t){var e=new Oa(this,t);e.event&&this.fire(Ea,e)},i._getTargetCoords=function(t){var e=this._target.getBoundingClientRect(),i=Math.floor(e.left),n=Math.floor(e.top);return t.clientX=i+this._target.clientWidth||t.clientY=n+this._target.clientHeight?null:{x:t.clientX-i,y:t.clientY-n}},e}(P);Fa.EVENT_MOUSEMOVE=Ta,Fa.EVENT_MOUSEDOWN=ba,Fa.EVENT_MOUSEUP=wa,Fa.EVENT_MOUSEWHEEL=Ea;var Ba=function(){function t(t,e){void 0===e&&(e={}),this._keyboard=void 0,this._mouse=void 0,this._gamepads=void 0,this._element=null,this._actions={},this._axes={},this._axesValues={},this._keyboard=e.keyboard||null,this._mouse=e.mouse||null,this._gamepads=e.gamepads||null,t&&this.attach(t)}var e=t.prototype;return e.attach=function(t){this._element=t,this._keyboard&&this._keyboard.attach(t),this._mouse&&this._mouse.attach(t)},e.detach=function(){this._keyboard&&this._keyboard.detach(),this._mouse&&this._mouse.detach(),this._element=null},e.disableContextMenu=function(){this._mouse||this._enableMouse(),this._mouse.disableContextMenu()},e.enableContextMenu=function(){this._mouse||this._enableMouse(),this._mouse.enableContextMenu()},e.update=function(t){for(var e in this._keyboard&&this._keyboard.update(),this._mouse&&this._mouse.update(),this._gamepads&&this._gamepads.update(),this._axesValues={},this._axes)this._axesValues[e]=[]},e.appendAction=function(t,e){this._actions[t]=this._actions[t]||[],this._actions[t].push(e)},e.registerKeys=function(t,e){if(this._keyboard||this._enableKeyboard(),this._actions[t])throw new Error("Action: "+t+" already registered");if(void 0===e)throw new Error("Invalid button");e.length||(e=[e]),this.appendAction(t,{type:xa,keys:e})},e.registerMouse=function(t,e){if(this._mouse||this._enableMouse(),void 0===e)throw new Error("Invalid button");this.appendAction(t,{type:ya,button:e})},e.registerPadButton=function(t,e,i){if(void 0===i)throw new Error("Invalid button");this.appendAction(t,{type:Sa,button:i,pad:e})},e.registerAxis=function(t){var e=t.name;this._axes[e]||(this._axes[e]=[]);var i=this._axes[e].push(e);(t=t||{}).pad=t.pad||0;var n=function(n,s,r,a){switch(s){case"mousex":n._mouse.on(Ta,(function(t){n._axesValues[e][i]=t.dx/10}));break;case"mousey":n._mouse.on(Ta,(function(t){n._axesValues[e][i]=t.dy/10}));break;case"key":n._axes[e].push((function(){return n._keyboard.isPressed(a)?r:0}));break;case"padrx":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,2)}));break;case"padry":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,3)}));break;case"padlx":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,0)}));break;case"padly":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,1)}));break;default:throw new Error("Unknown axis")}};n(this,t.positive,1,t.positiveKey),(t.negativeKey||t.negative!==t.positive)&&n(this,t.negative,-1,t.negativeKey)},e.isPressed=function(t){if(!this._actions[t])return!1;for(var e=this._actions[t].length,i=0;iMath.abs(e)&&(e=s)}else this._axesValues[t]&&Math.abs(this._axesValues[t][n])>Math.abs(e)&&(e=this._axesValues[t][n]);return e},e._enableMouse=function(){if(this._mouse=new Fa,!this._element)throw new Error("Controller must be attached to an Element");this._mouse.attach(this._element)},e._enableKeyboard=function(){if(this._keyboard=new La,!this._element)throw new Error("Controller must be attached to an Element");this._keyboard.attach(this._element)},t}(),Na=Object.freeze([]),Ua=function(){return Na};"undefined"!=typeof navigator&&(Ua=(navigator.getGamepads||navigator.webkitGetGamepads||Ua).bind(navigator));var za={buttons:{PAD_FACE_1:0,PAD_FACE_2:1,PAD_FACE_3:2,PAD_FACE_4:3,PAD_L_SHOULDER_1:4,PAD_R_SHOULDER_1:5,PAD_L_SHOULDER_2:6,PAD_R_SHOULDER_2:7,PAD_SELECT:8,PAD_START:9,PAD_L_STICK_BUTTON:10,PAD_R_STICK_BUTTON:11,PAD_UP:12,PAD_DOWN:13,PAD_LEFT:14,PAD_RIGHT:15,PAD_VENDOR:16,XRPAD_TRIGGER:0,XRPAD_SQUEEZE:1,XRPAD_TOUCHPAD_BUTTON:2,XRPAD_STICK_BUTTON:3,XRPAD_A:4,XRPAD_B:5},axes:{PAD_L_STICK_X:0,PAD_L_STICK_Y:1,PAD_R_STICK_X:2,PAD_R_STICK_Y:3,XRPAD_TOUCHPAD_X:0,XRPAD_TOUCHPAD_Y:1,XRPAD_STICK_X:2,XRPAD_STICK_Y:3}},Va={DEFAULT:{buttons:["PAD_FACE_1","PAD_FACE_2","PAD_FACE_3","PAD_FACE_4","PAD_L_SHOULDER_1","PAD_R_SHOULDER_1","PAD_L_SHOULDER_2","PAD_R_SHOULDER_2","PAD_SELECT","PAD_START","PAD_L_STICK_BUTTON","PAD_R_STICK_BUTTON","PAD_UP","PAD_DOWN","PAD_LEFT","PAD_RIGHT","PAD_VENDOR"],axes:["PAD_L_STICK_X","PAD_L_STICK_Y","PAD_R_STICK_X","PAD_R_STICK_Y"]},DEFAULT_DUAL:{buttons:["PAD_FACE_1","PAD_FACE_2","PAD_FACE_3","PAD_FACE_4","PAD_L_SHOULDER_1","PAD_R_SHOULDER_1","PAD_L_SHOULDER_2","PAD_R_SHOULDER_2","PAD_SELECT","PAD_START","PAD_L_STICK_BUTTON","PAD_R_STICK_BUTTON","PAD_VENDOR"],axes:["PAD_L_STICK_X","PAD_L_STICK_Y","PAD_R_STICK_X","PAD_R_STICK_Y"],synthesizedButtons:{PAD_UP:{axis:0,min:0,max:1},PAD_DOWN:{axis:0,min:-1,max:0},PAD_LEFT:{axis:0,min:-1,max:0},PAD_RIGHT:{axis:0,min:0,max:1}}},PS3:{buttons:["PAD_FACE_1","PAD_FACE_2","PAD_FACE_4","PAD_FACE_3","PAD_L_SHOULDER_1","PAD_R_SHOULDER_1","PAD_L_SHOULDER_2","PAD_R_SHOULDER_2","PAD_SELECT","PAD_START","PAD_L_STICK_BUTTON","PAD_R_STICK_BUTTON","PAD_UP","PAD_DOWN","PAD_LEFT","PAD_RIGHT","PAD_VENDOR"],axes:["PAD_L_STICK_X","PAD_L_STICK_Y","PAD_R_STICK_X","PAD_R_STICK_Y"],mapping:"standard"},DEFAULT_XR:{buttons:["XRPAD_TRIGGER","XRPAD_SQUEEZE","XRPAD_TOUCHPAD_BUTTON","XRPAD_STICK_BUTTON","XRPAD_A","XRPAD_B"],axes:["XRPAD_TOUCHPAD_X","XRPAD_TOUCHPAD_Y","XRPAD_STICK_X","XRPAD_STICK_Y"],mapping:"xr-standard"}},Ga={"Product: 0268":"PS3"},Ha={};function Wa(t){var e=Ha[t.id];if(e)return e;for(var i in Ga)if(-1!==t.id.indexOf(i)){var n=Ga[i];if(!t.mapping){var s=Va["RAW_"+n];if(s)return s}return Va[n]}if("xr-standard"===t.mapping)return Va.DEFAULT_XR;var r=Va.DEFAULT,a=t.buttons.length0):(this.value=t.value,this.pressed=t.pressed,this.touched=null!=(i=t.touched)?i:t.value>0);e&&("number"==typeof e?(this.wasPressed=1!==e&&this.pressed,this.wasReleased=1===e&&!this.pressed,this.wasTouched=0===e&&this.touched):(this.wasPressed=!e.pressed&&this.pressed,this.wasReleased=e.pressed&&!this.pressed,this.wasTouched=!(null!=(n=e.touched)?n:e.value>0)&&this.touched))}return t.prototype.update=function(t){var e,i=t.value,n=t.pressed,s=null!=(e=t.touched)?e:i>0;this.wasPressed=!this.pressed&&n,this.wasReleased=this.pressed&&!n,this.wasTouched=!this.touched&&s,this.value=i,this.pressed=n,this.touched=s},t}(),Ya=Object.freeze(new qa(0)),Ka=function(){function t(t,e){this._compiledMapping={buttons:[],axes:[]},this.id=t.id,this.index=t.index,this._buttons=t.buttons.map((function(t){return new qa(t)})),this._axes=[].concat(t.axes),this._previousAxes=[].concat(t.axes),this.mapping=e.mapping,this.map=e,this.hand=t.hand||"none",this.pad=t,this._compileMapping()}var e,i=t.prototype;return i._compileMapping=function(){var t=this,e=this._compiledMapping,i=e.axes,n=e.buttons,s=za.axes,r=za.buttons;i.length=0,n.length=0,this.map.axes&&this.map.axes.forEach((function(e,n){i[s[e]]=function(){return t.pad.axes[n]||0}}));for(var a=0,o=i.length;aXa?e:0},v(t,[{key:"connected",get:function(){return this.pad.connected}},{key:"axes",get:function(){return this._compiledMapping.axes.map((function(t){return t()}))}},{key:"buttons",get:function(){return this._compiledMapping.buttons.map((function(t){return t()}))}}])}(),Za=function(t){function e(){var e;return(e=t.call(this)||this).gamepadsSupported=G.gamepads,e.current=[],e._previous=[],e._ongamepadconnectedHandler=e._ongamepadconnected.bind(e),e._ongamepaddisconnectedHandler=e._ongamepaddisconnected.bind(e),window.addEventListener("gamepadconnected",e._ongamepadconnectedHandler,!1),window.addEventListener("gamepaddisconnected",e._ongamepaddisconnectedHandler,!1),e.poll(),e}x(e,t);var i=e.prototype;return i._ongamepadconnected=function(t){for(var e=new Ka(t.gamepad,this.getMap(t.gamepad)),i=this.current,n=i.findIndex((function(t){return t.index===e.index}));-1!==n;)i.splice(n,1),n=i.findIndex((function(t){return t.index===e.index}));i.push(e),this.fire(Aa,e)},i._ongamepaddisconnected=function(t){var e=this.current,i=e.findIndex((function(e){return e.index===t.gamepad.index}));-1!==i&&(this.fire(Ca,e[i]),e.splice(i,1))},i.update=function(){this.poll()},i.poll=function(t){void 0===t&&(t=[]),t.length>0&&(t.length=0);for(var e=Ua(),i=0,n=e.length;i=0?t.ResponseType.ARRAY_BUFFER:".json"===n?t.ResponseType.JSON:".xml"===n?t.ResponseType.DOCUMENT:t.ResponseType.TEXT},e._isBinaryContentType=function(e){return[t.ContentType.BASIS,t.ContentType.BIN,t.ContentType.DDS,t.ContentType.GLB,t.ContentType.MP3,t.ContentType.MP4,t.ContentType.OGG,t.ContentType.OPUS,t.ContentType.WAV].indexOf(e)>=0},e._isBinaryResponseType=function(e){return e===t.ResponseType.ARRAY_BUFFER||e===t.ResponseType.BLOB||e===t.ResponseType.JSON},e._onReadyStateChange=function(t,e,i,n){if(4===n.readyState)switch(n.status){case 0:n.responseURL&&n.responseURL.startsWith("file:///")?this._onSuccess(t,e,i,n):this._onError(t,e,i,n);break;case 200:case 201:case 206:case 304:this._onSuccess(t,e,i,n);break;default:this._onError(t,e,i,n)}},e._onSuccess=function(e,i,n,s){var r,a,o=s.getResponseHeader("Content-Type");o&&(a=o.split(";")[0].trim());try{r=this._isBinaryContentType(a)||this._isBinaryResponseType(s.responseType)?s.response:a===t.ContentType.JSON||i.split("?")[0].endsWith(".json")?JSON.parse(s.responseText):s.responseType===t.ResponseType.DOCUMENT||a===t.ContentType.XML?s.responseXML:s.responseText,n.callback(null,r)}catch(t){n.callback(t)}},e._onError=function(e,i,n,s){var r=this;if(!n.retrying)if(n.retry&&n.retriesn)return 0;var o=0;return r===de?o=1-s*(a-i)/(n-i):r===fe?o=i/(i+s*(a-i)):r===pe&&(o=Math.pow(a/i,-s)),_t.clamp(o,0,1)}(this.manager.listener.getPosition(),this.position,this.minDistance,this.maxDistance,this.rollOffFactor,this.distanceModel),i=this.getVolume();this.source.volume=i*e}},getMaxDistance:function(){return this.maxDistance},setMaxDistance:function(t){this.maxDistance=t},getMinDistance:function(){return this.minDistance},setMinDistance:function(t){this.minDistance=t},getRollOffFactor:function(){return this.rollOffFactor},setRollOffFactor:function(t){this.rollOffFactor=t},getDistanceModel:function(){return this.distanceModel},setDistanceModel:function(t){this.distanceModel=t}})}var oo=function(){function t(t){this._manager=void 0,this.position=new Ct,this.velocity=new Ct,this.orientation=new zt,this._manager=t}var e=t.prototype;return e.getPosition=function(){return this.position},e.setPosition=function(t){this.position.copy(t);var e=this.listener;e&&("positionX"in e?(e.positionX.value=t.x,e.positionY.value=t.y,e.positionZ.value=t.z):e.setPosition&&e.setPosition(t.x,t.y,t.z))},e.getVelocity=function(){return this.velocity},e.setVelocity=function(t){},e.setOrientation=function(t){this.orientation.copy(t);var e=this.listener;if(e){var i=t.data;"forwardX"in e?(e.forwardX.value=-i[8],e.forwardY.value=-i[9],e.forwardZ.value=-i[10],e.upX.value=i[4],e.upY.value=i[5],e.upZ.value=i[6]):e.setOrientation&&e.setOrientation(-i[8],-i[9],-i[10],i[4],i[5],i[6])}},e.getOrientation=function(){return this.orientation},v(t,[{key:"listener",get:function(){var t=this._manager.context;return t?t.listener:null}}])}(),ho="running",lo=["click","touchstart","mousedown"],co=function(t){function e(){var e;return(e=t.call(this)||this)._context=null,e.AudioContext="undefined"!=typeof AudioContext&&AudioContext||"undefined"!=typeof webkitAudioContext&&webkitAudioContext,e.AudioContext,e._unlockHandlerFunc=e._unlockHandler.bind(e),e._userSuspended=!1,e.listener=new oo(e),e._volume=1,e}x(e,t);var i=e.prototype;return i.suspend=function(){this._userSuspended||(this._userSuspended=!0,this._context&&this._context.state===ho&&this._suspend())},i.resume=function(){this._userSuspended&&(this._userSuspended=!1,this._context&&this._context.state!==ho&&this._resume())},i.destroy=function(){var t;(this.fire("destroy"),this._context)&&(this._removeUnlockListeners(),null==(t=this._context)||t.close(),this._context=null)},i.playSound=function(t,e){void 0===e&&(e={});var i=null;return so&&(i=new so(this,t,e)).play(),i},i.playSound3d=function(t,e,i){void 0===i&&(i={});var n=null;return ro&&((n=new ro(this,t,i)).setPosition(e),i.volume&&n.setVolume(i.volume),i.loop&&n.setLoop(i.loop),i.maxDistance&&n.setMaxDistance(i.maxDistance),i.minDistance&&n.setMinDistance(i.minDistance),i.rollOffFactor&&n.setRollOffFactor(i.rollOffFactor),i.distanceModel&&n.setDistanceModel(i.distanceModel),n.play()),n},i._resume=function(){var t=this;this._context.resume().then((function(){var e=t._context.createBufferSource();e.buffer=t._context.createBuffer(1,1,t._context.sampleRate),e.connect(t._context.destination),e.start(0),e.onended=function(i){e.disconnect(0),t.fire("resume")}}),(function(t){})).catch((function(t){}))},i._suspend=function(){var t=this;this._context.suspend().then((function(){t.fire("suspend")}),(function(t){})).catch((function(t){}))},i._unlockHandler=function(){this._removeUnlockListeners(),this._userSuspended||this._context.state===ho||this._resume()},i._registerUnlockListeners=function(){var t=this;lo.forEach((function(e){window.addEventListener(e,t._unlockHandlerFunc,!1)}))},i._removeUnlockListeners=function(){var t=this;lo.forEach((function(e){window.removeEventListener(e,t._unlockHandlerFunc,!1)}))},v(e,[{key:"volume",get:function(){return this._volume},set:function(t){t=_t.clamp(t,0,1),this._volume=t,this.fire("volumechange",t)}},{key:"suspended",get:function(){return this._userSuspended}},{key:"context",get:function(){return!this._context&&this.AudioContext&&(this._context=new this.AudioContext,this._context.state!==ho&&this._registerUnlockListeners()),this._context}}])}(P),uo=v((function(t){this.audio=void 0,this.buffer=void 0,t instanceof Audio?this.audio=t:this.buffer=t}),[{key:"duration",get:function(){var t=0;return this.buffer?t=this.buffer.duration:this.audio&&(t=this.audio.duration),t||0}}]);function fo(t,e){return t%e||0}var po=function(t){function e(e,i,n){var s;return(s=t.call(this)||this).source=null,s._manager=e,s._volume=void 0!==n.volume?_t.clamp(Number(n.volume)||0,0,1):1,s._pitch=void 0!==n.pitch?Math.max(.01,Number(n.pitch)||0):1,s._loop=!(void 0===n.loop||!n.loop),s._sound=i,s._state=2,s._suspended=!1,s._suspendEndEvent=0,s._suspendInstanceEvents=!1,s._playWhenLoaded=!0,s._startTime=Math.max(0,Number(n.startTime)||0),s._duration=Math.max(0,Number(n.duration)||0),s._startOffset=null,s._onPlayCallback=n.onPlay,s._onPauseCallback=n.onPause,s._onResumeCallback=n.onResume,s._onStopCallback=n.onStop,s._onEndCallback=n.onEnd,no()?(s._startedAt=0,s._currentTime=0,s._currentOffset=0,s._inputNode=null,s._connectorNode=null,s._firstNode=null,s._lastNode=null,s._waitingContextSuspension=!1,s._initializeNodes(),s._endedHandler=s._onEnded.bind(s)):(s._isReady=!1,s._loadedMetadataHandler=s._onLoadedMetadata.bind(s),s._timeUpdateHandler=s._onTimeUpdate.bind(s),s._endedHandler=s._onEnded.bind(s),s._createSource()),s}x(e,t);var i=e.prototype;return i._onPlay=function(){this.fire("play"),this._onPlayCallback&&this._onPlayCallback(this)},i._onPause=function(){this.fire("pause"),this._onPauseCallback&&this._onPauseCallback(this)},i._onResume=function(){this.fire("resume"),this._onResumeCallback&&this._onResumeCallback(this)},i._onStop=function(){this.fire("stop"),this._onStopCallback&&this._onStopCallback(this)},i._onEnded=function(){this._suspendEndEvent>0?this._suspendEndEvent--:(this.fire("end"),this._onEndCallback&&this._onEndCallback(this),this.stop())},i._onManagerVolumeChange=function(){this.volume=this._volume},i._onManagerSuspend=function(){0!==this._state||this._suspended||(this._suspended=!0,this.pause())},i._onManagerResume=function(){this._suspended&&(this._suspended=!1,this.resume())},i._initializeNodes=function(){this.gain=this._manager.context.createGain(),this._inputNode=this.gain,this._connectorNode=this.gain,this._connectorNode.connect(this._manager.context.destination)},i.play=function(){return 2!==this._state&&this.stop(),this._state=0,this._playWhenLoaded=!1,!this._waitingContextSuspension&&(this._manager.suspended?(this._manager.once("resume",this._playAudioImmediate,this),this._waitingContextSuspension=!0,!1):(this._playAudioImmediate(),!0))},i._playAudioImmediate=function(){if(this._waitingContextSuspension=!1,0===this._state){this.source||this._createSource();var t=fo(this._startOffset,this.duration);t=fo(this._startTime+t,this._sound.duration),this._startOffset=null,this._duration?this.source.start(0,t,this._duration):this.source.start(0,t),this._startedAt=this._manager.context.currentTime,this._currentTime=0,this._currentOffset=t,this.volume=this._volume,this.loop=this._loop,this.pitch=this._pitch,this._manager.on("volumechange",this._onManagerVolumeChange,this),this._manager.on("suspend",this._onManagerSuspend,this),this._manager.on("resume",this._onManagerResume,this),this._manager.on("destroy",this._onManagerDestroy,this),this._suspendInstanceEvents||this._onPlay()}},i.pause=function(){return this._playWhenLoaded=!1,0===this._state&&(this._state=1,this._waitingContextSuspension||(this._updateCurrentTime(),this._suspendEndEvent++,this.source.stop(0),this.source=null,this._startOffset=null,this._suspendInstanceEvents||this._onPause()),!0)},i.resume=function(){if(1!==this._state)return!1;var t=this.currentTime;return this._state=0,this._waitingContextSuspension||(this.source||this._createSource(),null!==this._startOffset&&(t=fo(this._startOffset,this.duration),t=fo(this._startTime+t,this._sound.duration),this._startOffset=null),this._duration?this.source.start(0,t,this._duration):this.source.start(0,t),this._startedAt=this._manager.context.currentTime,this._currentOffset=t,this.volume=this._volume,this.loop=this._loop,this.pitch=this._pitch,this._playWhenLoaded=!1,this._suspendInstanceEvents||this._onResume()),!0},i.stop=function(){if(this._playWhenLoaded=!1,2===this._state)return!1;var t=0===this._state;return this._state=2,this._waitingContextSuspension||(this._manager.off("volumechange",this._onManagerVolumeChange,this),this._manager.off("suspend",this._onManagerSuspend,this),this._manager.off("resume",this._onManagerResume,this),this._manager.off("destroy",this._onManagerDestroy,this),this._startedAt=0,this._currentTime=0,this._currentOffset=0,this._startOffset=null,this._suspendEndEvent++,t&&this.source&&this.source.stop(0),this.source=null,this._suspendInstanceEvents||this._onStop()),!0},i.setExternalNodes=function(t,e){if(t){e||(e=t);var i=this._manager.context.destination;this._firstNode!==t&&(this._firstNode?this._connectorNode.disconnect(this._firstNode):this._connectorNode.disconnect(i),this._firstNode=t,this._connectorNode.connect(t)),this._lastNode!==e&&(this._lastNode&&this._lastNode.disconnect(i),this._lastNode=e,this._lastNode.connect(i))}else console.error("The firstNode must be a valid Audio Node")},i.clearExternalNodes=function(){var t=this._manager.context.destination;this._firstNode&&(this._connectorNode.disconnect(this._firstNode),this._firstNode=null),this._lastNode&&(this._lastNode.disconnect(t),this._lastNode=null),this._connectorNode.connect(t)},i.getExternalNodes=function(){return[this._firstNode,this._lastNode]},i._createSource=function(){if(!this._sound)return null;var t=this._manager.context;return this._sound.buffer&&(this.source=t.createBufferSource(),this.source.buffer=this._sound.buffer,this.source.connect(this._inputNode),this.source.onended=this._endedHandler,this.source.loopStart=fo(this._startTime,this.source.buffer.duration),this._duration&&(this.source.loopEnd=Math.max(this.source.loopStart,fo(this._startTime+this._duration,this.source.buffer.duration)))),this.source},i._updateCurrentTime=function(){this._currentTime=fo((this._manager.context.currentTime-this._startedAt)*this._pitch+this._currentOffset,this.duration)},i._onManagerDestroy=function(){this.source&&0===this._state&&(this.source.stop(0),this.source=null)},v(e,[{key:"currentTime",get:function(){return null!==this._startOffset?this._startOffset:1===this._state?this._currentTime:2!==this._state&&this.source?(this._updateCurrentTime(),this._currentTime):0},set:function(t){if(!(t<0))if(0===this._state){var e=this._suspendInstanceEvents;this._suspendInstanceEvents=!0,this.stop(),this._startOffset=t,this.play(),this._suspendInstanceEvents=e}else this._startOffset=t,this._currentTime=t}},{key:"duration",get:function(){return this._sound?this._duration?fo(this._duration,this._sound.duration):this._sound.duration:0},set:function(t){this._duration=Math.max(0,Number(t)||0);var e=0===this._state;this.stop(),e&&this.play()}},{key:"isPaused",get:function(){return 1===this._state}},{key:"isPlaying",get:function(){return 0===this._state}},{key:"isStopped",get:function(){return 2===this._state}},{key:"isSuspended",get:function(){return this._suspended}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=!!t,this.source&&(this.source.loop=this._loop)}},{key:"pitch",get:function(){return this._pitch},set:function(t){this._currentOffset=this.currentTime,this._startedAt=this._manager.context.currentTime,this._pitch=Math.max(Number(t)||0,.01),this.source&&(this.source.playbackRate.value=this._pitch)}},{key:"sound",get:function(){return this._sound},set:function(t){this._sound=t,2!==this._state?this.stop():this._createSource()}},{key:"startTime",get:function(){return this._startTime},set:function(t){this._startTime=Math.max(0,Number(t)||0);var e=0===this._state;this.stop(),e&&this.play()}},{key:"volume",get:function(){return this._volume},set:function(t){t=_t.clamp(t,0,1),this._volume=t,this.gain&&(this.gain.gain.value=t*this._manager.volume)}}])}(P);po.EVENT_PLAY="play",po.EVENT_PAUSE="pause",po.EVENT_RESUME="resume",po.EVENT_STOP="stop",po.EVENT_END="end",no()||(Object.assign(po.prototype,{play:function(){return 2!==this._state&&this.stop(),!(!this.source&&!this._createSource())&&(this.volume=this._volume,this.pitch=this._pitch,this.loop=this._loop,this.source.play(),this._state=0,this._playWhenLoaded=!1,this._manager.on("volumechange",this._onManagerVolumeChange,this),this._manager.on("suspend",this._onManagerSuspend,this),this._manager.on("resume",this._onManagerResume,this),this._manager.on("destroy",this._onManagerDestroy,this),this._manager.suspended&&this._onManagerSuspend(),this._suspendInstanceEvents||this._onPlay(),!0)},pause:function(){return!(!this.source||0!==this._state)&&(this._suspendEndEvent++,this.source.pause(),this._playWhenLoaded=!1,this._state=1,this._startOffset=null,this._suspendInstanceEvents||this._onPause(),!0)},resume:function(){return!(!this.source||1!==this._state)&&(this._state=0,this._playWhenLoaded=!1,this.source.paused&&(this.source.play(),this._suspendInstanceEvents||this._onResume()),!0)},stop:function(){return!(!this.source||2===this._state)&&(this._manager.off("volumechange",this._onManagerVolumeChange,this),this._manager.off("suspend",this._onManagerSuspend,this),this._manager.off("resume",this._onManagerResume,this),this._manager.off("destroy",this._onManagerDestroy,this),this._suspendEndEvent++,this.source.pause(),this._playWhenLoaded=!1,this._state=2,this._startOffset=null,this._suspendInstanceEvents||this._onStop(),!0)},setExternalNodes:function(){},clearExternalNodes:function(){},getExternalNodes:function(){return[null,null]},_onLoadedMetadata:function(){this.source.removeEventListener("loadedmetadata",this._loadedMetadataHandler),this._isReady=!0;var t=fo(this._startOffset,this.duration);t=fo(this._startTime+t,this._sound.duration),this._startOffset=null,this.source.currentTime=t},_createSource:function(){return this._sound&&this._sound.audio&&(this._isReady=!1,this.source=this._sound.audio.cloneNode(!0),this.source.addEventListener("loadedmetadata",this._loadedMetadataHandler),this.source.addEventListener("timeupdate",this._timeUpdateHandler),this.source.onended=this._endedHandler),this.source},_onTimeUpdate:function(){this._duration&&this.source.currentTime>fo(this._startTime+this._duration,this.source.duration)&&(this.loop?this.source.currentTime=fo(this._startTime,this.source.duration):(this.source.removeEventListener("timeupdate",this._timeUpdateHandler),this.source.pause(),this._onEnded()))},_onManagerDestroy:function(){this.source&&this.source.pause()}}),Object.defineProperty(po.prototype,"volume",{get:function(){return this._volume},set:function(t){t=_t.clamp(t,0,1),this._volume=t,this.source&&(this.source.volume=t*this._manager.volume)}}),Object.defineProperty(po.prototype,"pitch",{get:function(){return this._pitch},set:function(t){this._pitch=Math.max(Number(t)||0,.01),this.source&&(this.source.playbackRate=this._pitch)}}),Object.defineProperty(po.prototype,"sound",{get:function(){return this._sound},set:function(t){this.stop(),this._sound=t}}),Object.defineProperty(po.prototype,"currentTime",{get:function(){return null!==this._startOffset?this._startOffset:2!==this._state&&this.source?this.source.currentTime-this._startTime:0},set:function(t){t<0||(this._startOffset=t,this.source&&this._isReady&&(this.source.currentTime=fo(this._startTime+fo(t,this.duration),this._sound.duration),this._startOffset=null))}}));var mo=function(t){function e(e,i,n){var s;return void 0===n&&(n={}),(s=t.call(this,e,i,n)||this)._position=new Ct,s._velocity=new Ct,n.position&&(s.position=n.position),s.maxDistance=void 0!==n.maxDistance?Number(n.maxDistance):1e4,s.refDistance=void 0!==n.refDistance?Number(n.refDistance):1,s.rollOffFactor=void 0!==n.rollOffFactor?Number(n.rollOffFactor):1,s.distanceModel=void 0!==n.distanceModel?n.distanceModel:de,s}return x(e,t),e.prototype._initializeNodes=function(){this.gain=this._manager.context.createGain(),this.panner=this._manager.context.createPanner(),this.panner.connect(this.gain),this._inputNode=this.panner,this._connectorNode=this.gain,this._connectorNode.connect(this._manager.context.destination)},v(e,[{key:"position",get:function(){return this._position},set:function(t){this._position.copy(t);var e=this.panner;"positionX"in e?(e.positionX.value=t.x,e.positionY.value=t.y,e.positionZ.value=t.z):e.setPosition&&e.setPosition(t.x,t.y,t.z)}},{key:"velocity",get:function(){return this._velocity},set:function(t){this._velocity.copy(t)}},{key:"maxDistance",get:function(){return this.panner.maxDistance},set:function(t){this.panner.maxDistance=t}},{key:"refDistance",get:function(){return this.panner.refDistance},set:function(t){this.panner.refDistance=t}},{key:"rollOffFactor",get:function(){return this.panner.rolloffFactor},set:function(t){this.panner.rolloffFactor=t}},{key:"distanceModel",get:function(){return this.panner.distanceModel},set:function(t){this.panner.distanceModel=t}}])}(po);if(!no()){var _o=new Ct;Object.defineProperty(mo.prototype,"position",{get:function(){return this._position},set:function(t){if(this._position.copy(t),this.source){var e=function(t,e,i,n,s,r){var a=(_o=_o.sub2(t,e)).length();if(an)return 0;var o=0;return r===de?o=1-s*(a-i)/(n-i):r===fe?o=i/(i+s*(a-i)):r===pe&&(o=Math.pow(a/i,-s)),_t.clamp(o,0,1)}(this._manager.listener.getPosition(),this._position,this.refDistance,this.maxDistance,this.rollOffFactor,this.distanceModel),i=this.volume;this.source.volume=i*e*this._manager.volume}}}),Object.defineProperty(mo.prototype,"maxDistance",{get:function(){return this._maxDistance},set:function(t){this._maxDistance=t}}),Object.defineProperty(mo.prototype,"refDistance",{get:function(){return this._refDistance},set:function(t){this._refDistance=t}}),Object.defineProperty(mo.prototype,"rollOffFactor",{get:function(){return this._rollOffFactor},set:function(t){this._rollOffFactor=t}}),Object.defineProperty(mo.prototype,"distanceModel",{get:function(){return this._distanceModel},set:function(t){this._distanceModel=t}})}var vo="none",go="linear",yo={0:"PCF3",1:"VSM8",2:"VSM16",3:"VSM32",4:"PCF5",5:"PCF1",6:"PCSS"},xo="mul",So=32,bo=128,To=256,wo=512,Eo=1024,Ao=2048,Co=4096,Mo=8192,Po="infinite",Ro="dome",Io="none",Do="bayer8",Lo="\nvec3 decodeLinear(vec4 raw) {\n\treturn raw.rgb;\n}\nfloat decodeGamma(float raw) {\n\treturn pow(raw, 2.2);\n}\nvec3 decodeGamma(vec3 raw) {\n\treturn pow(raw, vec3(2.2));\n}\nvec3 decodeGamma(vec4 raw) {\n\treturn pow(raw.xyz, vec3(2.2));\n}\nvec3 decodeRGBM(vec4 raw) {\n\tvec3 color = (8.0 * raw.a) * raw.rgb;\n\treturn color * color;\n}\nvec3 decodeRGBP(vec4 raw) {\n\tvec3 color = raw.rgb * (-raw.a * 7.0 + 8.0);\n\treturn color * color;\n}\nvec3 decodeRGBE(vec4 raw) {\n\tif (raw.a == 0.0) {\n\t\treturn vec3(0.0, 0.0, 0.0);\n\t} else {\n\t\treturn raw.xyz * pow(2.0, raw.w * 255.0 - 128.0);\n\t}\n}\nvec4 passThrough(vec4 raw) {\n\treturn raw;\n}\n",ko="\nvec4 encodeLinear(vec3 source) {\n\treturn vec4(source, 1.0);\n}\nvec4 encodeGamma(vec3 source) {\n\treturn vec4(pow(source + 0.0000001, vec3(1.0 / 2.2)), 1.0);\n}\nvec4 encodeRGBM(vec3 source) {\n\tvec4 result;\n\tresult.rgb = pow(source.rgb, vec3(0.5));\n\tresult.rgb *= 1.0 / 8.0;\n\tresult.a = saturate( max( max( result.r, result.g ), max( result.b, 1.0 / 255.0 ) ) );\n\tresult.a = ceil(result.a * 255.0) / 255.0;\n\tresult.rgb /= result.a;\n\treturn result;\n}\nvec4 encodeRGBP(vec3 source) {\n\tvec3 gamma = pow(source, vec3(0.5));\n\tfloat maxVal = min(8.0, max(1.0, max(gamma.x, max(gamma.y, gamma.z))));\n\tfloat v = 1.0 - ((maxVal - 1.0) / 7.0);\n\tv = ceil(v * 255.0) / 255.0;\n\treturn vec4(gamma / (-v * 7.0 + 8.0), v);\t\n}\nvec4 encodeRGBE(vec3 source) {\n\tfloat maxVal = max(source.x, max(source.y, source.z));\n\tif (maxVal < 1e-32) {\n\t\treturn vec4(0, 0, 0, 0);\n\t} else {\n\t\tfloat e = ceil(log2(maxVal));\n\t\treturn vec4(source / pow(2.0, e), (e + 128.0) / 255.0);\n\t}\n}\n",Oo={alphaTestPS:"\nuniform float alpha_ref;\nvoid alphaTest(float a) {\n\tif (a < alpha_ref) discard;\n}\n",ambientConstantPS:"\nvoid addAmbient(vec3 worldNormal) {\n\tdDiffuseLight += light_globalAmbient;\n}\n",ambientEnvPS:"\n#ifndef ENV_ATLAS\n#define ENV_ATLAS\nuniform sampler2D texture_envAtlas;\n#endif\nvoid addAmbient(vec3 worldNormal) {\n\tvec3 dir = normalize(cubeMapRotate(worldNormal) * vec3(-1.0, 1.0, 1.0));\n\tvec2 uv = mapUv(toSphericalUv(dir), vec4(128.0, 256.0 + 128.0, 64.0, 32.0) / atlasSize);\n\tvec4 raw = texture2D(texture_envAtlas, uv);\n\tvec3 linear = $DECODE(raw);\n\tdDiffuseLight += processEnvironment(linear);\n}\n",ambientSHPS:"\nuniform vec3 ambientSH[9];\nvoid addAmbient(vec3 worldNormal) {\n\tvec3 n = cubeMapRotate(worldNormal);\n\tvec3 color =\n\t\tambientSH[0] +\n\t\tambientSH[1] * n.x +\n\t\tambientSH[2] * n.y +\n\t\tambientSH[3] * n.z +\n\t\tambientSH[4] * n.x * n.z +\n\t\tambientSH[5] * n.z * n.y +\n\t\tambientSH[6] * n.y * n.x +\n\t\tambientSH[7] * (3.0 * n.z * n.z - 1.0) +\n\t\tambientSH[8] * (n.x * n.x - n.y * n.y);\n\tdDiffuseLight += processEnvironment(max(color, vec3(0.0)));\n}\n",aoPS:"\nvoid getAO() {\n\tdAo = 1.0;\n\t#ifdef MAPTEXTURE\n\tfloat aoBase = texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\tdAo *= addAoDetail(aoBase);\n\t#endif\n\t#ifdef MAPVERTEX\n\tdAo *= saturate(vVertexColor.$VC);\n\t#endif\n}\n",aoDetailMapPS:"\nfloat addAoDetail(float ao) {\n#ifdef MAPTEXTURE\n\tfloat aoDetail = texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\treturn detailMode_$DETAILMODE(vec3(ao), vec3(aoDetail)).r;\n#else\n\treturn ao;\n#endif\n}\n",aoDiffuseOccPS:"\nvoid occludeDiffuse(float ao) {\n\tdDiffuseLight *= ao;\n}\n",aoSpecOccPS:"\nuniform float material_occludeSpecularIntensity;\nvoid occludeSpecular(float gloss, float ao, vec3 worldNormal, vec3 viewDir) {\n\tfloat specPow = exp2(gloss * 11.0);\n\tfloat specOcc = saturate(pow(dot(worldNormal, viewDir) + ao, 0.01*specPow) - 1.0 + ao);\n\tspecOcc = mix(1.0, specOcc, material_occludeSpecularIntensity);\n\tdSpecularLight *= specOcc;\n\tdReflection *= specOcc;\n\t\n#ifdef LIT_SHEEN\n\tsSpecularLight *= specOcc;\n\tsReflection *= specOcc;\n#endif\n}\n",aoSpecOccConstPS:"\nvoid occludeSpecular(float gloss, float ao, vec3 worldNormal, vec3 viewDir) {\n\tfloat specPow = exp2(gloss * 11.0);\n\tfloat specOcc = saturate(pow(dot(worldNormal, viewDir) + ao, 0.01*specPow) - 1.0 + ao);\n\tdSpecularLight *= specOcc;\n\tdReflection *= specOcc;\n\t\n#ifdef LIT_SHEEN\n\tsSpecularLight *= specOcc;\n\tsReflection *= specOcc;\n#endif\n}\n",aoSpecOccConstSimplePS:"\nvoid occludeSpecular(float gloss, float ao, vec3 worldNormal, vec3 viewDir) {\n\tdSpecularLight *= ao;\n\tdReflection *= ao;\n#ifdef LIT_SHEEN\n\tsSpecularLight *= ao;\n\tsReflection *= ao;\n#endif\n}\n",aoSpecOccSimplePS:"\nuniform float material_occludeSpecularIntensity;\nvoid occludeSpecular(float gloss, float ao, vec3 worldNormal, vec3 viewDir) {\n\tfloat specOcc = mix(1.0, ao, material_occludeSpecularIntensity);\n\tdSpecularLight *= specOcc;\n\tdReflection *= specOcc;\n#ifdef LIT_SHEEN\n\tsSpecularLight *= specOcc;\n\tsReflection *= specOcc;\n#endif\n}\n",basePS:"\nuniform vec3 view_position;\nuniform vec3 light_globalAmbient;\nfloat square(float x) {\n\treturn x*x;\n}\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvec3 saturate(vec3 x) {\n\treturn clamp(x, vec3(0.0), vec3(1.0));\n}\n",baseVS:"\nattribute vec3 vertex_position;\nattribute vec3 vertex_normal;\nattribute vec4 vertex_tangent;\nattribute vec2 vertex_texCoord0;\nattribute vec2 vertex_texCoord1;\nattribute vec4 vertex_color;\nuniform mat4 matrix_viewProjection;\nuniform mat4 matrix_model;\nuniform mat3 matrix_normal;\nvec3 dPositionW;\nmat4 dModelMatrix;\nmat3 dNormalMatrix;\n",baseNineSlicedPS:"\n#define NINESLICED\nvarying vec2 vMask;\nvarying vec2 vTiledUv;\nuniform mediump vec4 innerOffset;\nuniform mediump vec2 outerScale;\nuniform mediump vec4 atlasRect;\nvec2 nineSlicedUv;\n",baseNineSlicedVS:"\n#define NINESLICED\nvarying vec2 vMask;\nvarying vec2 vTiledUv;\nuniform mediump vec4 innerOffset;\nuniform mediump vec2 outerScale;\nuniform mediump vec4 atlasRect;\n",baseNineSlicedTiledPS:"\n#define NINESLICED\n#define NINESLICETILED\nvarying vec2 vMask;\nvarying vec2 vTiledUv;\nuniform mediump vec4 innerOffset;\nuniform mediump vec2 outerScale;\nuniform mediump vec4 atlasRect;\nvec2 nineSlicedUv;\n",bayerPS:"\nfloat bayer2(vec2 p) {\n\treturn mod(2.0 * p.y + p.x + 1.0, 4.0);\n}\nfloat bayer4(vec2 p) {\n\tvec2 p1 = mod(p, 2.0);\n\tvec2 p2 = floor(0.5 * mod(p, 4.0));\n\treturn 4.0 * bayer2(p1) + bayer2(p2);\n}\nfloat bayer8(vec2 p) {\n\tvec2 p1 = mod(p, 2.0);\n\tvec2 p2 = floor(0.5 * mod(p, 4.0));\n\tvec2 p4 = floor(0.25 * mod(p, 8.0));\n\treturn 4.0 * (4.0 * bayer2(p1) + bayer2(p2)) + bayer2(p4);\n}\n",biasConstPS:"\n#define SHADOWBIAS\n#define SHADOW_SAMPLE_Z_BIAS\nfloat getShadowBias(float resolution, float maxBias) {\n\treturn maxBias;\n}\n",blurVSMPS:"\nvarying vec2 vUv0;\nuniform sampler2D source;\nuniform vec2 pixelOffset;\n#ifdef GAUSS\nuniform float weight[SAMPLES];\n#endif\n#ifdef PACKED\nfloat decodeFloatRG(vec2 rg) {\n\treturn rg.y*(1.0/255.0) + rg.x;\n}\nvec2 encodeFloatRG( float v ) {\n\tvec2 enc = vec2(1.0, 255.0) * v;\n\tenc = fract(enc);\n\tenc -= enc.yy * vec2(1.0/255.0, 1.0/255.0);\n\treturn enc;\n}\n#endif\nvoid main(void) {\n\tvec3 moments = vec3(0.0);\n\tvec2 uv = vUv0 - pixelOffset * (float(SAMPLES) * 0.5);\n\tfor (int i=0; i shadowZ ? 1.0 : 0.0;\n\t}\n\t#endif\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF3)\n\tfloat getShadowOmniClusteredPCF3(sampler2D shadowMap, vec4 shadowParams, vec3 omniAtlasViewport, float shadowEdgePixels, vec3 lightDir) {\n\t\tfloat shadowTextureResolution = shadowParams.x;\n\t\tvec2 uv = getCubemapAtlasCoordinates(omniAtlasViewport, shadowEdgePixels, shadowTextureResolution, lightDir);\n\t\tfloat shadowZ = length(lightDir) * shadowParams.w + shadowParams.z;\n\t\tvec3 shadowCoord = vec3(uv, shadowZ);\n\t\treturn getShadowPCF3x3(shadowMap, shadowCoord, shadowParams);\n\t}\n\t#endif\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF5)\n\tfloat getShadowOmniClusteredPCF5(sampler2D shadowMap, vec4 shadowParams, vec3 omniAtlasViewport, float shadowEdgePixels, vec3 lightDir) {\n\t\tfloat shadowTextureResolution = shadowParams.x;\n\t\tvec2 uv = getCubemapAtlasCoordinates(omniAtlasViewport, shadowEdgePixels, shadowTextureResolution, lightDir);\n\t\tfloat shadowZ = length(lightDir) * shadowParams.w + shadowParams.z;\n\t\tvec3 shadowCoord = vec3(uv, shadowZ);\n\t\treturn getShadowPCF3x3(shadowMap, shadowCoord, shadowParams);\n\t}\n\t#endif\n#endif\n#ifdef GL2\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF1)\n\tfloat getShadowSpotClusteredPCF1(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\t\treturn textureShadow(shadowMap, shadowCoord);\n\t}\n\t#endif\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF3)\n\tfloat getShadowSpotClusteredPCF3(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\t\treturn getShadowSpotPCF3x3(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams);\n\t}\n\t#endif\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF5)\n\tfloat getShadowSpotClusteredPCF5(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\t\treturn getShadowPCF5x5(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams);\n\t}\n\t#endif\n#else\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF1)\n\tfloat getShadowSpotClusteredPCF1(sampler2D shadowMap, vec3 shadowCoord, vec4 shadowParams) {\n\t\tfloat depth = unpackFloat(textureShadow(shadowMap, shadowCoord.xy));\n\t\treturn depth > shadowCoord.z ? 1.0 : 0.0;\n\t}\n\t#endif\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF3)\n\tfloat getShadowSpotClusteredPCF3(sampler2D shadowMap, vec3 shadowCoord, vec4 shadowParams) {\n\t\treturn getShadowSpotPCF3x3(shadowMap, shadowCoord, shadowParams);\n\t}\n\t#endif\n\t#if defined(CLUSTER_SHADOW_TYPE_PCF5)\n\tfloat getShadowSpotClusteredPCF5(sampler2D shadowMap, vec3 shadowCoord, vec4 shadowParams) {\n\t\treturn getShadowSpotPCF3x3(shadowMap, shadowCoord, shadowParams);\n\t}\n\t#endif\n#endif\n",clusteredLightUtilsPS:"\nvec2 getCubemapFaceCoordinates(const vec3 dir, out float faceIndex, out vec2 tileOffset)\n{\n\tvec3 vAbs = abs(dir);\n\tfloat ma;\n\tvec2 uv;\n\tif (vAbs.z >= vAbs.x && vAbs.z >= vAbs.y) {\n\t\tfaceIndex = dir.z < 0.0 ? 5.0 : 4.0;\n\t\tma = 0.5 / vAbs.z;\n\t\tuv = vec2(dir.z < 0.0 ? -dir.x : dir.x, -dir.y);\n\t\ttileOffset.x = 2.0;\n\t\ttileOffset.y = dir.z < 0.0 ? 1.0 : 0.0;\n\t} else if(vAbs.y >= vAbs.x) {\n\t\tfaceIndex = dir.y < 0.0 ? 3.0 : 2.0;\n\t\tma = 0.5 / vAbs.y;\n\t\tuv = vec2(dir.x, dir.y < 0.0 ? -dir.z : dir.z);\n\t\ttileOffset.x = 1.0;\n\t\ttileOffset.y = dir.y < 0.0 ? 1.0 : 0.0;\n\t} else {\n\t\tfaceIndex = dir.x < 0.0 ? 1.0 : 0.0;\n\t\tma = 0.5 / vAbs.x;\n\t\tuv = vec2(dir.x < 0.0 ? dir.z : -dir.z, -dir.y);\n\t\ttileOffset.x = 0.0;\n\t\ttileOffset.y = dir.x < 0.0 ? 1.0 : 0.0;\n\t}\n\treturn uv * ma + 0.5;\n}\nvec2 getCubemapAtlasCoordinates(const vec3 omniAtlasViewport, float shadowEdgePixels, float shadowTextureResolution, const vec3 dir) {\n\tfloat faceIndex;\n\tvec2 tileOffset;\n\tvec2 uv = getCubemapFaceCoordinates(dir, faceIndex, tileOffset);\n\tfloat atlasFaceSize = omniAtlasViewport.z;\n\tfloat tileSize = shadowTextureResolution * atlasFaceSize;\n\tfloat offset = shadowEdgePixels / tileSize;\n\tuv = uv * vec2(1.0 - offset * 2.0) + vec2(offset * 1.0);\n\tuv *= atlasFaceSize;\n\tuv += tileOffset * atlasFaceSize;\n\tuv += omniAtlasViewport.xy;\n\treturn uv;\n}\n",clusteredLightPS:"\nuniform highp sampler2D clusterWorldTexture;\nuniform highp sampler2D lightsTexture8;\nuniform highp sampler2D lightsTextureFloat;\n#if defined(CLUSTER_COOKIES)\n\t#define CLUSTER_COOKIES_OR_SHADOWS\n#endif\n#if defined(CLUSTER_SHADOWS)\n\t#define CLUSTER_COOKIES_OR_SHADOWS\n#endif\n#ifdef CLUSTER_SHADOWS\n\t#ifdef GL2\n\t\tuniform sampler2DShadow shadowAtlasTexture;\n\t#else\n\t\tuniform sampler2D shadowAtlasTexture;\n\t#endif\n#endif\n#ifdef CLUSTER_COOKIES\n\tuniform sampler2D cookieAtlasTexture;\n#endif\n#ifdef GL2\n\tuniform int clusterMaxCells;\n#else\n\tuniform float clusterMaxCells;\n\tuniform vec4 lightsTextureInvSize;\n#endif\nuniform float clusterSkip;\nuniform vec3 clusterCellsCountByBoundsSize;\nuniform vec3 clusterTextureSize;\nuniform vec3 clusterBoundsMin;\nuniform vec3 clusterBoundsDelta;\nuniform vec3 clusterCellsDot;\nuniform vec3 clusterCellsMax;\nuniform vec2 clusterCompressionLimit0;\nuniform vec2 shadowAtlasParams;\nstruct ClusterLightData {\n\tvec3 halfWidth;\n\tfloat lightType;\n\tvec3 halfHeight;\n\t#ifdef GL2\n\t\tint lightIndex;\n\t#else\n\t\tfloat lightV;\n\t#endif\n\tvec3 position;\n\tfloat shape;\n\tvec3 direction;\n\tfloat falloffMode;\n\tvec3 color;\n\tfloat shadowIntensity;\n\tvec3 omniAtlasViewport;\n\tfloat range;\n\tvec4 cookieChannelMask;\n\tfloat shadowBias;\n\tfloat shadowNormalBias;\n\tfloat innerConeAngleCos;\n\tfloat outerConeAngleCos;\n\tfloat cookie;\n\tfloat cookieRgb;\n\tfloat cookieIntensity;\n\tfloat mask;\n};\nmat4 lightProjectionMatrix;\n#define isClusteredLightCastShadow(light) ( light.shadowIntensity > 0.0 )\n#define isClusteredLightCookie(light) (light.cookie > 0.5 )\n#define isClusteredLightCookieRgb(light) (light.cookieRgb > 0.5 )\n#define isClusteredLightSpot(light) ( light.lightType > 0.5 )\n#define isClusteredLightFalloffLinear(light) ( light.falloffMode < 0.5 )\n#define isClusteredLightArea(light) ( light.shape > 0.1 )\n#define isClusteredLightRect(light) ( light.shape < 0.3 )\n#define isClusteredLightDisk(light) ( light.shape < 0.6 )\n#ifdef CLUSTER_MESH_DYNAMIC_LIGHTS\n\t#define acceptLightMask(light) ( light.mask < 0.75)\n#else\n\t#define acceptLightMask(light) ( light.mask > 0.25)\n#endif\nvec4 decodeClusterLowRange4Vec4(vec4 d0, vec4 d1, vec4 d2, vec4 d3) {\n\treturn vec4(\n\t\tbytes2floatRange4(d0, -2.0, 2.0),\n\t\tbytes2floatRange4(d1, -2.0, 2.0),\n\t\tbytes2floatRange4(d2, -2.0, 2.0),\n\t\tbytes2floatRange4(d3, -2.0, 2.0)\n\t);\n}\n#ifdef GL2\n\tvec4 sampleLightsTexture8(const ClusterLightData clusterLightData, int index) {\n\t\treturn texelFetch(lightsTexture8, ivec2(index, clusterLightData.lightIndex), 0);\n\t}\n\tvec4 sampleLightTextureF(const ClusterLightData clusterLightData, int index) {\n\t\treturn texelFetch(lightsTextureFloat, ivec2(index, clusterLightData.lightIndex), 0);\n\t}\n#else\n\tvec4 sampleLightsTexture8(const ClusterLightData clusterLightData, float index) {\n\t\treturn texture2DLodEXT(lightsTexture8, vec2(index * lightsTextureInvSize.z, clusterLightData.lightV), 0.0);\n\t}\n\tvec4 sampleLightTextureF(const ClusterLightData clusterLightData, float index) {\n\t\treturn texture2DLodEXT(lightsTextureFloat, vec2(index * lightsTextureInvSize.x, clusterLightData.lightV), 0.0);\n\t}\n#endif\nvoid decodeClusterLightCore(inout ClusterLightData clusterLightData, float lightIndex) {\n\t#ifdef GL2\n\t\tclusterLightData.lightIndex = int(lightIndex);\n\t#else\n\t\tclusterLightData.lightV = (lightIndex + 0.5) * lightsTextureInvSize.w;\n\t#endif\n\tvec4 lightInfo = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_FLAGS);\n\tclusterLightData.lightType = lightInfo.x;\n\tclusterLightData.shape = lightInfo.y;\n\tclusterLightData.falloffMode = lightInfo.z;\n\tclusterLightData.shadowIntensity = lightInfo.w;\n\tvec4 colorA = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COLOR_A);\n\tvec4 colorB = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COLOR_B);\n\tclusterLightData.color = vec3(bytes2float2(colorA.xy), bytes2float2(colorA.zw), bytes2float2(colorB.xy)) * clusterCompressionLimit0.y;\n\tclusterLightData.cookie = colorB.z;\n\tclusterLightData.mask = colorB.w;\n\t#ifdef CLUSTER_TEXTURE_FLOAT\n\t\tvec4 lightPosRange = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_POSITION_RANGE);\n\t\tclusterLightData.position = lightPosRange.xyz;\n\t\tclusterLightData.range = lightPosRange.w;\n\t\tvec4 lightDir_Unused = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_SPOT_DIRECTION);\n\t\tclusterLightData.direction = lightDir_Unused.xyz;\n\t#else\n\t\tvec4 encPosX = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_POSITION_X);\n\t\tvec4 encPosY = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_POSITION_Y);\n\t\tvec4 encPosZ = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_POSITION_Z);\n\t\tclusterLightData.position = vec3(bytes2float4(encPosX), bytes2float4(encPosY), bytes2float4(encPosZ)) * clusterBoundsDelta + clusterBoundsMin;\n\t\tvec4 encRange = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_RANGE);\n\t\tclusterLightData.range = bytes2float4(encRange) * clusterCompressionLimit0.x;\n\t\tvec4 encDirX = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_SPOT_DIRECTION_X);\n\t\tvec4 encDirY = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_SPOT_DIRECTION_Y);\n\t\tvec4 encDirZ = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_SPOT_DIRECTION_Z);\n\t\tclusterLightData.direction = vec3(bytes2float4(encDirX), bytes2float4(encDirY), bytes2float4(encDirZ)) * 2.0 - 1.0;\n\t#endif\n}\nvoid decodeClusterLightSpot(inout ClusterLightData clusterLightData) {\n\tvec4 coneAngle = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_SPOT_ANGLES);\n\tclusterLightData.innerConeAngleCos = bytes2float2(coneAngle.xy) * 2.0 - 1.0;\n\tclusterLightData.outerConeAngleCos = bytes2float2(coneAngle.zw) * 2.0 - 1.0;\n}\nvoid decodeClusterLightOmniAtlasViewport(inout ClusterLightData clusterLightData) {\n\t#ifdef CLUSTER_TEXTURE_FLOAT\n\t\tclusterLightData.omniAtlasViewport = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_0).xyz;\n\t#else\n\t\tvec4 viewportA = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_ATLAS_VIEWPORT_A);\n\t\tvec4 viewportB = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_ATLAS_VIEWPORT_B);\n\t\tclusterLightData.omniAtlasViewport = vec3(bytes2float2(viewportA.xy), bytes2float2(viewportA.zw), bytes2float2(viewportB.xy));\n\t#endif\n}\nvoid decodeClusterLightAreaData(inout ClusterLightData clusterLightData) {\n\t#ifdef CLUSTER_TEXTURE_FLOAT\n\t\tclusterLightData.halfWidth = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_AREA_DATA_WIDTH).xyz;\n\t\tclusterLightData.halfHeight = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_AREA_DATA_HEIGHT).xyz;\n\t#else\n\t\tvec4 areaWidthX = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_AREA_DATA_WIDTH_X);\n\t\tvec4 areaWidthY = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_AREA_DATA_WIDTH_Y);\n\t\tvec4 areaWidthZ = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_AREA_DATA_WIDTH_Z);\n\t\tclusterLightData.halfWidth = vec3(mantissaExponent2Float(areaWidthX), mantissaExponent2Float(areaWidthY), mantissaExponent2Float(areaWidthZ));\n\t\tvec4 areaHeightX = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_AREA_DATA_HEIGHT_X);\n\t\tvec4 areaHeightY = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_AREA_DATA_HEIGHT_Y);\n\t\tvec4 areaHeightZ = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_AREA_DATA_HEIGHT_Z);\n\t\tclusterLightData.halfHeight = vec3(mantissaExponent2Float(areaHeightX), mantissaExponent2Float(areaHeightY), mantissaExponent2Float(areaHeightZ));\n\t#endif\n}\nvoid decodeClusterLightProjectionMatrixData(inout ClusterLightData clusterLightData) {\n\t\n\t#ifdef CLUSTER_TEXTURE_FLOAT\n\t\tvec4 m0 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_0);\n\t\tvec4 m1 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_1);\n\t\tvec4 m2 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_2);\n\t\tvec4 m3 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_3);\n\t#else\n\t\tvec4 m00 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_00);\n\t\tvec4 m01 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_01);\n\t\tvec4 m02 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_02);\n\t\tvec4 m03 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_03);\n\t\tvec4 m0 = decodeClusterLowRange4Vec4(m00, m01, m02, m03);\n\t\tvec4 m10 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_10);\n\t\tvec4 m11 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_11);\n\t\tvec4 m12 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_12);\n\t\tvec4 m13 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_13);\n\t\tvec4 m1 = decodeClusterLowRange4Vec4(m10, m11, m12, m13);\n\t\tvec4 m20 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_20);\n\t\tvec4 m21 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_21);\n\t\tvec4 m22 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_22);\n\t\tvec4 m23 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_23);\n\t\tvec4 m2 = decodeClusterLowRange4Vec4(m20, m21, m22, m23);\n\t\tvec4 m30 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_30);\n\t\tvec4 m31 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_31);\n\t\tvec4 m32 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_32);\n\t\tvec4 m33 = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_PROJ_MAT_33);\n\t\tvec4 m3 = vec4(mantissaExponent2Float(m30), mantissaExponent2Float(m31), mantissaExponent2Float(m32), mantissaExponent2Float(m33));\n\t#endif\n\t\n\tlightProjectionMatrix = mat4(m0, m1, m2, m3);\n}\nvoid decodeClusterLightShadowData(inout ClusterLightData clusterLightData) {\n\t\n\tvec4 biases = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_SHADOW_BIAS);\n\tclusterLightData.shadowBias = bytes2floatRange2(biases.xy, -1.0, 20.0),\n\tclusterLightData.shadowNormalBias = bytes2float2(biases.zw);\n}\nvoid decodeClusterLightCookieData(inout ClusterLightData clusterLightData) {\n\tvec4 cookieA = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COOKIE_A);\n\tclusterLightData.cookieIntensity = cookieA.x;\n\tclusterLightData.cookieRgb = cookieA.y;\n\tclusterLightData.cookieChannelMask = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COOKIE_B);\n}\nvoid evaluateLight(\n\tClusterLightData light, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir,\n#if defined(LIT_CLEARCOAT)\n\tvec3 clearcoatReflectionDir,\n#endif\n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 geometricNormal, \n\tmat3 tbn, \n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel,\n#endif\n\tvec3 clearcoat_worldNormal,\n\tfloat clearcoat_gloss,\n\tfloat sheen_gloss,\n\tfloat iridescence_intensity\n) {\n\tvec3 cookieAttenuation = vec3(1.0);\n\tfloat diffuseAttenuation = 1.0;\n\tfloat falloffAttenuation = 1.0;\n\tgetLightDirPoint(light.position);\n\t#ifdef CLUSTER_AREALIGHTS\n\tif (isClusteredLightArea(light)) {\n\t\tdecodeClusterLightAreaData(light);\n\t\tif (isClusteredLightRect(light)) {\n\t\t\tcalcRectLightValues(light.position, light.halfWidth, light.halfHeight);\n\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\tcalcDiskLightValues(light.position, light.halfWidth, light.halfHeight);\n\t\t} else {\n\t\t\tcalcSphereLightValues(light.position, light.halfWidth, light.halfHeight);\n\t\t}\n\t\tfalloffAttenuation = getFalloffWindow(light.range, dLightDirW);\n\t} else\n\t#endif\n\t{\n\t\tif (isClusteredLightFalloffLinear(light))\n\t\t\tfalloffAttenuation = getFalloffLinear(light.range, dLightDirW);\n\t\telse\n\t\t\tfalloffAttenuation = getFalloffInvSquared(light.range, dLightDirW);\n\t}\n\tif (falloffAttenuation > 0.00001) {\n\t\t#ifdef CLUSTER_AREALIGHTS\n\t\tif (isClusteredLightArea(light)) {\n\t\t\tif (isClusteredLightRect(light)) {\n\t\t\t\tdiffuseAttenuation = getRectLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW) * 16.0;\n\t\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\t\tdiffuseAttenuation = getDiskLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW) * 16.0;\n\t\t\t} else {\n\t\t\t\tdiffuseAttenuation = getSphereLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW) * 16.0;\n\t\t\t}\n\t\t} else\n\t\t#endif\n\t\t{\n\t\t\tfalloffAttenuation *= getLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW); \n\t\t}\n\t\tif (isClusteredLightSpot(light)) {\n\t\t\tdecodeClusterLightSpot(light);\n\t\t\tfalloffAttenuation *= getSpotEffect(light.direction, light.innerConeAngleCos, light.outerConeAngleCos, dLightDirNormW);\n\t\t}\n\t\t#if defined(CLUSTER_COOKIES_OR_SHADOWS)\n\t\tif (falloffAttenuation > 0.00001) {\n\t\t\tif (isClusteredLightCastShadow(light) || isClusteredLightCookie(light)) {\n\t\t\t\tif (isClusteredLightSpot(light)) {\n\t\t\t\t\tdecodeClusterLightProjectionMatrixData(light);\n\t\t\t\t} else {\n\t\t\t\t\tdecodeClusterLightOmniAtlasViewport(light);\n\t\t\t\t}\n\t\t\t\tfloat shadowTextureResolution = shadowAtlasParams.x;\n\t\t\t\tfloat shadowEdgePixels = shadowAtlasParams.y;\n\t\t\t\t#ifdef CLUSTER_COOKIES\n\t\t\t\tif (isClusteredLightCookie(light)) {\n\t\t\t\t\tdecodeClusterLightCookieData(light);\n\t\t\t\t\tif (isClusteredLightSpot(light)) {\n\t\t\t\t\t\tcookieAttenuation = getCookie2DClustered(TEXTURE_PASS(cookieAtlasTexture), lightProjectionMatrix, vPositionW, light.cookieIntensity, isClusteredLightCookieRgb(light), light.cookieChannelMask);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcookieAttenuation = getCookieCubeClustered(TEXTURE_PASS(cookieAtlasTexture), dLightDirW, light.cookieIntensity, isClusteredLightCookieRgb(light), light.cookieChannelMask, shadowTextureResolution, shadowEdgePixels, light.omniAtlasViewport);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#endif\n\t\t\t\t#ifdef CLUSTER_SHADOWS\n\t\t\t\tif (isClusteredLightCastShadow(light)) {\n\t\t\t\t\tdecodeClusterLightShadowData(light);\n\t\t\t\t\tvec4 shadowParams = vec4(shadowTextureResolution, light.shadowNormalBias, light.shadowBias, 1.0 / light.range);\n\t\t\t\t\tif (isClusteredLightSpot(light)) {\n\t\t\t\t\t\tgetShadowCoordPerspZbufferNormalOffset(lightProjectionMatrix, shadowParams, geometricNormal);\n\t\t\t\t\t\t\n\t\t\t\t\t\t#if defined(CLUSTER_SHADOW_TYPE_PCF1)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCF1(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF3)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCF3(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF5)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCF5(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCSS)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCSS(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\tfalloffAttenuation *= mix(1.0, shadow, light.shadowIntensity);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvec3 dir = normalOffsetPointShadow(shadowParams, dLightPosW, dLightDirW, dLightDirNormW, geometricNormal);\n\t\t\t\t\t\t#if defined(CLUSTER_SHADOW_TYPE_PCF1)\n\t\t\t\t\t\t\tfloat shadow = getShadowOmniClusteredPCF1(SHADOWMAP_PASS(shadowAtlasTexture), shadowParams, light.omniAtlasViewport, shadowEdgePixels, dir);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF3)\n\t\t\t\t\t\t\tfloat shadow = getShadowOmniClusteredPCF3(SHADOWMAP_PASS(shadowAtlasTexture), shadowParams, light.omniAtlasViewport, shadowEdgePixels, dir);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF5)\n\t\t\t\t\t\t\tfloat shadow = getShadowOmniClusteredPCF5(SHADOWMAP_PASS(shadowAtlasTexture), shadowParams, light.omniAtlasViewport, shadowEdgePixels, dir);\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\tfalloffAttenuation *= mix(1.0, shadow, light.shadowIntensity);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#endif\n\t\t\t}\n\t\t}\n\t\t#endif\n\t\t#ifdef CLUSTER_AREALIGHTS\n\t\tif (isClusteredLightArea(light)) {\n\t\t\t{\n\t\t\t\tvec3 areaDiffuse = (diffuseAttenuation * falloffAttenuation) * light.color * cookieAttenuation;\n\t\t\t\t#if defined(LIT_SPECULAR)\n\t\t\t\t\t#if defined(LIT_CONSERVE_ENERGY)\n\t\t\t\t\t\tareaDiffuse = mix(areaDiffuse, vec3(0), dLTCSpecFres);\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\tdDiffuseLight += areaDiffuse;\n\t\t\t}\n\t\t\t#ifdef LIT_SPECULAR\n\t\t\t\tfloat areaLightSpecular;\n\t\t\t\tif (isClusteredLightRect(light)) {\n\t\t\t\t\tareaLightSpecular = getRectLightSpecular(worldNormal, viewDir);\n\t\t\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\t\t\tareaLightSpecular = getDiskLightSpecular(worldNormal, viewDir);\n\t\t\t\t} else {\n\t\t\t\t\tareaLightSpecular = getSphereLightSpecular(worldNormal, viewDir);\n\t\t\t\t}\n\t\t\t\tdSpecularLight += dLTCSpecFres * areaLightSpecular * falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#ifdef LIT_CLEARCOAT\n\t\t\t\t\tfloat areaLightSpecularCC;\n\t\t\t\t\tif (isClusteredLightRect(light)) {\n\t\t\t\t\t\tareaLightSpecularCC = getRectLightSpecular(clearcoat_worldNormal, viewDir);\n\t\t\t\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\t\t\t\tareaLightSpecularCC = getDiskLightSpecular(clearcoat_worldNormal, viewDir);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tareaLightSpecularCC = getSphereLightSpecular(clearcoat_worldNormal, viewDir);\n\t\t\t\t\t}\n\t\t\t\t\tccSpecularLight += ccLTCSpecFres * areaLightSpecularCC * falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#endif\n\t\t\t#endif\n\t\t} else\n\t\t#endif\n\t\t{\n\t\t\t{\n\t\t\t\tvec3 punctualDiffuse = falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#if defined(CLUSTER_AREALIGHTS)\n\t\t\t\t#if defined(LIT_SPECULAR)\n\t\t\t\t#if defined(LIT_CONSERVE_ENERGY)\n\t\t\t\t\tpunctualDiffuse = mix(punctualDiffuse, vec3(0), specularity);\n\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\tdDiffuseLight += punctualDiffuse;\n\t\t\t}\n \n\t\t\t#ifdef LIT_SPECULAR\n\t\t\t\tvec3 halfDir = normalize(-dLightDirNormW + viewDir);\n\t\t\t\t\n\t\t\t\t#ifdef LIT_SPECULAR_FRESNEL\n\t\t\t\t\tdSpecularLight += \n\t\t\t\t\t\tgetLightSpecular(halfDir, reflectionDir, worldNormal, viewDir, dLightDirNormW, gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation * \n\t\t\t\t\t\tgetFresnel(\n\t\t\t\t\t\t\tdot(viewDir, halfDir), \n\t\t\t\t\t\t\tgloss, \n\t\t\t\t\t\t\tspecularity\n\t\t\t\t\t\t#if defined(LIT_IRIDESCENCE)\n\t\t\t\t\t\t\t, iridescenceFresnel,\n\t\t\t\t\t\t\tiridescence_intensity\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t);\n\t\t\t\t#else\n\t\t\t\t\tdSpecularLight += getLightSpecular(halfDir, reflectionDir, worldNormal, viewDir, dLightDirNormW, gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation * specularity;\n\t\t\t\t#endif\n\t\t\t\t#ifdef LIT_CLEARCOAT\n\t\t\t\t\t#ifdef LIT_SPECULAR_FRESNEL\n\t\t\t\t\t\tccSpecularLight += getLightSpecular(halfDir, clearcoatReflectionDir, clearcoat_worldNormal, viewDir, dLightDirNormW, clearcoat_gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation * getFresnelCC(dot(viewDir, halfDir));\n\t\t\t\t\t#else\n\t\t\t\t\t\tccSpecularLight += getLightSpecular(halfDir, clearcoatReflectionDir, clearcoat_worldNormal, viewDir, dLightDirNormW, clearcoat_gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation; \n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#ifdef LIT_SHEEN\n\t\t\t\t\tsSpecularLight += getLightSpecularSheen(halfDir, worldNormal, viewDir, dLightDirNormW, sheen_gloss) * falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#endif\n\t\t\t#endif\n\t\t}\n\t}\n\tdAtten = falloffAttenuation;\n\tdAttenD = diffuseAttenuation;\n\tdAtten3 = cookieAttenuation;\n}\nvoid evaluateClusterLight(\n\tfloat lightIndex, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n#if defined(LIT_CLEARCOAT)\n\tvec3 clearcoatReflectionDir,\n#endif\n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 geometricNormal, \n\tmat3 tbn, \n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel,\n#endif\n\tvec3 clearcoat_worldNormal,\n\tfloat clearcoat_gloss,\n\tfloat sheen_gloss,\n\tfloat iridescence_intensity\n) {\n\tClusterLightData clusterLightData;\n\tdecodeClusterLightCore(clusterLightData, lightIndex);\n\tif (acceptLightMask(clusterLightData))\n\t\tevaluateLight(\n\t\t\tclusterLightData, \n\t\t\tworldNormal, \n\t\t\tviewDir, \n\t\t\treflectionDir, \n#if defined(LIT_CLEARCOAT)\n\t\t\tclearcoatReflectionDir, \n#endif\n\t\t\tgloss, \n\t\t\tspecularity, \n\t\t\tgeometricNormal, \n\t\t\ttbn, \n#if defined(LIT_IRIDESCENCE)\n\t\t\tiridescenceFresnel,\n#endif\n\t\t\tclearcoat_worldNormal,\n\t\t\tclearcoat_gloss,\n\t\t\tsheen_gloss,\n\t\t\tiridescence_intensity\n\t\t);\n}\nvoid addClusteredLights(\n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n#if defined(LIT_CLEARCOAT)\n\tvec3 clearcoatReflectionDir,\n#endif\n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 geometricNormal, \n\tmat3 tbn, \n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel,\n#endif\n\tvec3 clearcoat_worldNormal,\n\tfloat clearcoat_gloss,\n\tfloat sheen_gloss,\n\tfloat iridescence_intensity\n) {\n\tif (clusterSkip > 0.5)\n\t\treturn;\n\tvec3 cellCoords = floor((vPositionW - clusterBoundsMin) * clusterCellsCountByBoundsSize);\n\tif (!(any(lessThan(cellCoords, vec3(0.0))) || any(greaterThanEqual(cellCoords, clusterCellsMax)))) {\n\t\tfloat cellIndex = dot(clusterCellsDot, cellCoords);\n\t\tfloat clusterV = floor(cellIndex * clusterTextureSize.y);\n\t\tfloat clusterU = cellIndex - (clusterV * clusterTextureSize.x);\n\t\t#ifdef GL2\n\t\t\tfor (int lightCellIndex = 0; lightCellIndex < clusterMaxCells; lightCellIndex++) {\n\t\t\t\tfloat lightIndex = texelFetch(clusterWorldTexture, ivec2(int(clusterU) + lightCellIndex, clusterV), 0).x;\n\t\t\t\tif (lightIndex <= 0.0)\n\t\t\t\t\t\treturn;\n\t\t\t\tevaluateClusterLight(\n\t\t\t\t\tlightIndex * 255.0, \n\t\t\t\t\tworldNormal, \n\t\t\t\t\tviewDir, \n\t\t\t\t\treflectionDir,\n#if defined(LIT_CLEARCOAT)\n\t\t\t\t\tclearcoatReflectionDir,\n#endif\n\t\t\t\t\tgloss, \n\t\t\t\t\tspecularity, \n\t\t\t\t\tgeometricNormal, \n\t\t\t\t\ttbn, \n#if defined(LIT_IRIDESCENCE)\n\t\t\t\t\tiridescenceFresnel,\n#endif\n\t\t\t\t\tclearcoat_worldNormal,\n\t\t\t\t\tclearcoat_gloss,\n\t\t\t\t\tsheen_gloss,\n\t\t\t\t\tiridescence_intensity\n\t\t\t\t); \n\t\t\t}\n\t\t#else\n\t\t\tclusterV = (clusterV + 0.5) * clusterTextureSize.z;\n\t\t\tconst float maxLightCells = 256.0;\n\t\t\tfor (float lightCellIndex = 0.5; lightCellIndex < maxLightCells; lightCellIndex++) {\n\t\t\t\tfloat lightIndex = texture2DLodEXT(clusterWorldTexture, vec2(clusterTextureSize.y * (clusterU + lightCellIndex), clusterV), 0.0).x;\n\t\t\t\tif (lightIndex <= 0.0)\n\t\t\t\t\treturn;\n\t\t\t\t\n\t\t\t\tevaluateClusterLight(\n\t\t\t\t\tlightIndex * 255.0, \n\t\t\t\t\tworldNormal, \n\t\t\t\t\tviewDir, \n\t\t\t\t\treflectionDir,\n#if defined(LIT_CLEARCOAT)\n\t\t\t\t\tclearcoatReflectionDir,\n#endif\n\t\t\t\t\tgloss, \n\t\t\t\t\tspecularity, \n\t\t\t\t\tgeometricNormal, \n\t\t\t\t\ttbn, \n#if defined(LIT_IRIDESCENCE)\n\t\t\t\t\tiridescenceFresnel,\n#endif\n\t\t\t\t\tclearcoat_worldNormal,\n\t\t\t\t\tclearcoat_gloss,\n\t\t\t\t\tsheen_gloss,\n\t\t\t\t\tiridescence_intensity\n\t\t\t\t); \n\t\t\t\tif (lightCellIndex >= clusterMaxCells) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t#endif\n\t}\n}\n",combinePS:"\nvec3 combineColor(vec3 albedo, vec3 sheenSpecularity, float clearcoatSpecularity) {\n\tvec3 ret = vec3(0);\n#ifdef LIT_OLD_AMBIENT\n\tret += (dDiffuseLight - light_globalAmbient) * albedo + material_ambient * light_globalAmbient;\n#else\n\tret += albedo * dDiffuseLight;\n#endif\n#ifdef LIT_SPECULAR\n\tret += dSpecularLight;\n#endif\n#ifdef LIT_REFLECTIONS\n\tret += dReflection.rgb * dReflection.a;\n#endif\n#ifdef LIT_SHEEN\n\tfloat sheenScaling = 1.0 - max(max(sheenSpecularity.r, sheenSpecularity.g), sheenSpecularity.b) * 0.157;\n\tret = ret * sheenScaling + (sSpecularLight + sReflection.rgb) * sheenSpecularity;\n#endif\n#ifdef LIT_CLEARCOAT\n\tfloat clearCoatScaling = 1.0 - ccFresnel * clearcoatSpecularity;\n\tret = ret * clearCoatScaling + (ccSpecularLight + ccReflection.rgb) * clearcoatSpecularity;\n#endif\n\treturn ret;\n}\n",cookiePS:"\nvec4 getCookie2D(sampler2D tex, mat4 transform, float intensity) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\treturn mix(vec4(1.0), texture2D(tex, projPos.xy), intensity);\n}\nvec4 getCookie2DClip(sampler2D tex, mat4 transform, float intensity) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\tif (projPos.x < 0.0 || projPos.x > 1.0 || projPos.y < 0.0 || projPos.y > 1.0 || projPos.z < 0.0) return vec4(0.0);\n\treturn mix(vec4(1.0), texture2D(tex, projPos.xy), intensity);\n}\nvec4 getCookie2DXform(sampler2D tex, mat4 transform, float intensity, vec4 cookieMatrix, vec2 cookieOffset) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\tprojPos.xy += cookieOffset;\n\tvec2 uv = mat2(cookieMatrix) * (projPos.xy-vec2(0.5)) + vec2(0.5);\n\treturn mix(vec4(1.0), texture2D(tex, uv), intensity);\n}\nvec4 getCookie2DClipXform(sampler2D tex, mat4 transform, float intensity, vec4 cookieMatrix, vec2 cookieOffset) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\tprojPos.xy += cookieOffset;\n\tif (projPos.x < 0.0 || projPos.x > 1.0 || projPos.y < 0.0 || projPos.y > 1.0 || projPos.z < 0.0) return vec4(0.0);\n\tvec2 uv = mat2(cookieMatrix) * (projPos.xy-vec2(0.5)) + vec2(0.5);\n\treturn mix(vec4(1.0), texture2D(tex, uv), intensity);\n}\nvec4 getCookieCube(samplerCube tex, mat4 transform, float intensity) {\n\treturn mix(vec4(1.0), textureCube(tex, dLightDirNormW * mat3(transform)), intensity);\n}\n",cubeMapProjectBoxPS:"\nuniform vec3 envBoxMin;\nuniform vec3 envBoxMax;\nvec3 cubeMapProject(vec3 nrdir) {\n\tnrdir = cubeMapRotate(nrdir);\n\tvec3 rbmax = (envBoxMax - vPositionW) / nrdir;\n\tvec3 rbmin = (envBoxMin - vPositionW) / nrdir;\n\tvec3 rbminmax;\n\trbminmax.x = nrdir.x>0.0? rbmax.x : rbmin.x;\n\trbminmax.y = nrdir.y>0.0? rbmax.y : rbmin.y;\n\trbminmax.z = nrdir.z>0.0? rbmax.z : rbmin.z;\n\tfloat fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z);\n\tvec3 posonbox = vPositionW + nrdir * fa;\n\tvec3 envBoxPos = (envBoxMin + envBoxMax) * 0.5;\n\treturn normalize(posonbox - envBoxPos);\n}\n",cubeMapProjectNonePS:"\nvec3 cubeMapProject(vec3 dir) {\n\treturn cubeMapRotate(dir);\n}\n",cubeMapRotatePS:"\n#ifdef CUBEMAP_ROTATION\nuniform mat3 cubeMapRotationMatrix;\n#endif\nvec3 cubeMapRotate(vec3 refDir) {\n#ifdef CUBEMAP_ROTATION\n\treturn refDir * cubeMapRotationMatrix;\n#else\n\treturn refDir;\n#endif\n}\n",debugOutputPS:"\n#ifdef DEBUG_ALBEDO_PASS\ngl_FragColor = vec4(gammaCorrectOutput(dAlbedo), 1.0);\n#endif\n#ifdef DEBUG_UV0_PASS\ngl_FragColor = vec4(litArgs_albedo , 1.0);\n#endif\n#ifdef DEBUG_WORLD_NORMAL_PASS\ngl_FragColor = vec4(litArgs_worldNormal * 0.5 + 0.5, 1.0);\n#endif\n#ifdef DEBUG_OPACITY_PASS\ngl_FragColor = vec4(vec3(litArgs_opacity) , 1.0);\n#endif\n#ifdef DEBUG_SPECULARITY_PASS\ngl_FragColor = vec4(litArgs_specularity, 1.0);\n#endif\n#ifdef DEBUG_GLOSS_PASS\ngl_FragColor = vec4(vec3(litArgs_gloss) , 1.0);\n#endif\n#ifdef DEBUG_METALNESS_PASS\ngl_FragColor = vec4(vec3(litArgs_metalness) , 1.0);\n#endif\n#ifdef DEBUG_AO_PASS\ngl_FragColor = vec4(vec3(litArgs_ao) , 1.0);\n#endif\n#ifdef DEBUG_EMISSION_PASS\ngl_FragColor = vec4(gammaCorrectOutput(litArgs_emission), 1.0);\n#endif\n",debugProcessFrontendPS:"\n#ifdef DEBUG_LIGHTING_PASS\nlitArgs_albedo = vec3(0.5);\n#endif\n#ifdef DEBUG_UV0_PASS\n#ifdef VARYING_VUV0\nlitArgs_albedo = vec3(vUv0, 0);\n#else\nlitArgs_albedo = vec3(0);\n#endif\n#endif\n",detailModesPS:"\nvec3 detailMode_mul(vec3 c1, vec3 c2) {\n\treturn c1 * c2;\n}\nvec3 detailMode_add(vec3 c1, vec3 c2) {\n\treturn c1 + c2;\n}\nvec3 detailMode_screen(vec3 c1, vec3 c2) {\n\treturn 1.0 - (1.0 - c1)*(1.0 - c2);\n}\nvec3 detailMode_overlay(vec3 c1, vec3 c2) {\n\treturn mix(1.0 - 2.0*(1.0 - c1)*(1.0 - c2), 2.0*c1*c2, step(c1, vec3(0.5)));\n}\nvec3 detailMode_min(vec3 c1, vec3 c2) {\n\treturn min(c1, c2);\n}\nvec3 detailMode_max(vec3 c1, vec3 c2) {\n\treturn max(c1, c2);\n}\n",diffusePS:"\n#ifdef MAPCOLOR\nuniform vec3 material_diffuse;\n#endif\nvoid getAlbedo() {\n\tdAlbedo = vec3(1.0);\n#ifdef MAPCOLOR\n\tdAlbedo *= material_diffuse.rgb;\n#endif\n#ifdef MAPTEXTURE\n\tvec3 albedoBase = $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\tdAlbedo *= addAlbedoDetail(albedoBase);\n#endif\n#ifdef MAPVERTEX\n\tdAlbedo *= gammaCorrectInput(saturate(vVertexColor.$VC));\n#endif\n}\n",diffuseDetailMapPS:"\nvec3 addAlbedoDetail(vec3 albedo) {\n#ifdef MAPTEXTURE\n\tvec3 albedoDetail = $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\treturn detailMode_$DETAILMODE(albedo, albedoDetail);\n#else\n\treturn albedo;\n#endif\n}\n",decodePS:Lo,emissivePS:"\n#ifdef MAPCOLOR\nuniform vec3 material_emissive;\n#endif\n#ifdef MAPFLOAT\nuniform float material_emissiveIntensity;\n#endif\nvoid getEmission() {\n\tdEmission = vec3(1.0);\n\t#ifdef MAPFLOAT\n\tdEmission *= material_emissiveIntensity;\n\t#endif\n\t#ifdef MAPCOLOR\n\tdEmission *= material_emissive;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tdEmission *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdEmission *= gammaCorrectInput(saturate(vVertexColor.$VC));\n\t#endif\n}\n",encodePS:ko,endPS:"\n\tgl_FragColor.rgb = combineColor(litArgs_albedo, litArgs_sheen_specularity, litArgs_clearcoat_specularity);\n\tgl_FragColor.rgb += litArgs_emission;\n\tgl_FragColor.rgb = addFog(gl_FragColor.rgb);\n\t#ifndef HDR\n\tgl_FragColor.rgb = toneMap(gl_FragColor.rgb);\n\tgl_FragColor.rgb = gammaCorrectOutput(gl_FragColor.rgb);\n\t#endif\n",endVS:"\n",envAtlasPS:"\nconst float atlasSize = 512.0;\nconst float seamSize = 1.0 / atlasSize;\nvec2 mapUv(vec2 uv, vec4 rect) {\n\treturn vec2(mix(rect.x + seamSize, rect.x + rect.z - seamSize, uv.x),\n\t\t\t\tmix(rect.y + seamSize, rect.y + rect.w - seamSize, uv.y));\n}\nvec2 mapRoughnessUv(vec2 uv, float level) {\n\tfloat t = 1.0 / exp2(level);\n\treturn mapUv(uv, vec4(0, 1.0 - t, t, t * 0.5));\n}\nvec2 mapShinyUv(vec2 uv, float level) {\n\tfloat t = 1.0 / exp2(level);\n\treturn mapUv(uv, vec4(1.0 - t, 1.0 - t, t, t * 0.5));\n}\n",envConstPS:"\nvec3 processEnvironment(vec3 color) {\n\treturn color;\n}\n",envMultiplyPS:"\nuniform float skyboxIntensity;\nvec3 processEnvironment(vec3 color) {\n\treturn color * skyboxIntensity;\n}\n",extensionPS:"\n",extensionVS:"\n",falloffInvSquaredPS:"\nfloat getFalloffWindow(float lightRadius, vec3 lightDir) {\n\tfloat sqrDist = dot(lightDir, lightDir);\n\tfloat invRadius = 1.0 / lightRadius;\n\treturn square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );\n}\nfloat getFalloffInvSquared(float lightRadius, vec3 lightDir) {\n\tfloat sqrDist = dot(lightDir, lightDir);\n\tfloat falloff = 1.0 / (sqrDist + 1.0);\n\tfloat invRadius = 1.0 / lightRadius;\n\tfalloff *= 16.0;\n\tfalloff *= square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );\n\treturn falloff;\n}\n",falloffLinearPS:"\nfloat getFalloffLinear(float lightRadius, vec3 lightDir) {\n\tfloat d = length(lightDir);\n\treturn max(((lightRadius - d) / lightRadius), 0.0);\n}\n",fixCubemapSeamsNonePS:"\nvec3 fixSeams(vec3 vec, float mipmapIndex) {\n\treturn vec;\n}\nvec3 fixSeams(vec3 vec) {\n\treturn vec;\n}\nvec3 fixSeamsStatic(vec3 vec, float invRecMipSize) {\n\treturn vec;\n}\nvec3 calcSeam(vec3 vec) {\n\treturn vec3(0);\n}\nvec3 applySeam(vec3 vec, vec3 seam, float scale) {\n\treturn vec;\n}\n",fixCubemapSeamsStretchPS:"\nvec3 fixSeams(vec3 vec, float mipmapIndex) {\n\tvec3 avec = abs(vec);\n\tfloat scale = 1.0 - exp2(mipmapIndex) / 128.0;\n\tfloat M = max(max(avec.x, avec.y), avec.z);\n\tif (avec.x != M) vec.x *= scale;\n\tif (avec.y != M) vec.y *= scale;\n\tif (avec.z != M) vec.z *= scale;\n\treturn vec;\n}\nvec3 fixSeams(vec3 vec) {\n\tvec3 avec = abs(vec);\n\tfloat scale = 1.0 - 1.0 / 128.0;\n\tfloat M = max(max(avec.x, avec.y), avec.z);\n\tif (avec.x != M) vec.x *= scale;\n\tif (avec.y != M) vec.y *= scale;\n\tif (avec.z != M) vec.z *= scale;\n\treturn vec;\n}\nvec3 fixSeamsStatic(vec3 vec, float invRecMipSize) {\n\tvec3 avec = abs(vec);\n\tfloat scale = invRecMipSize;\n\tfloat M = max(max(avec.x, avec.y), avec.z);\n\tif (avec.x != M) vec.x *= scale;\n\tif (avec.y != M) vec.y *= scale;\n\tif (avec.z != M) vec.z *= scale;\n\treturn vec;\n}\nvec3 calcSeam(vec3 vec) {\n\tvec3 avec = abs(vec);\n\tfloat M = max(avec.x, max(avec.y, avec.z));\n\treturn vec3(avec.x != M ? 1.0 : 0.0,\n\t\t\t\tavec.y != M ? 1.0 : 0.0,\n\t\t\t\tavec.z != M ? 1.0 : 0.0);\n}\nvec3 applySeam(vec3 vec, vec3 seam, float scale) {\n\treturn vec * (seam * -scale + vec3(1.0));\n}\n",floatUnpackingPS:"\nfloat bytes2float2(vec2 data) {\n\treturn dot(data, vec2(1.0, 1.0 / 255.0));\n}\nfloat bytes2float3(vec3 data) {\n\treturn dot(data, vec3(1.0, 1.0 / 255.0, 1.0 / 65025.0));\n}\nfloat bytes2float4(vec4 data) {\n\treturn dot(data, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n}\nfloat bytes2floatRange2(vec2 data, float min, float max) {\n\treturn mix(min, max, bytes2float2(data));\n}\nfloat bytes2floatRange3(vec3 data, float min, float max) {\n\treturn mix(min, max, bytes2float3(data));\n}\nfloat bytes2floatRange4(vec4 data, float min, float max) {\n\treturn mix(min, max, bytes2float4(data));\n}\nfloat mantissaExponent2Float(vec4 pack)\n{\n\tfloat value = bytes2floatRange3(pack.xyz, -1.0, 1.0);\n\tfloat exponent = floor(pack.w * 255.0 - 127.0);\n\treturn value * exp2(exponent);\n}\n",fogExpPS:"\nuniform vec3 fog_color;\nuniform float fog_density;\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\tfloat fogFactor = exp(-depth * fog_density);\n\tfogFactor = clamp(fogFactor, 0.0, 1.0);\n\treturn mix(fog_color * dBlendModeFogFactor, color, fogFactor);\n}\n",fogExp2PS:"\nuniform vec3 fog_color;\nuniform float fog_density;\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\tfloat fogFactor = exp(-depth * depth * fog_density * fog_density);\n\tfogFactor = clamp(fogFactor, 0.0, 1.0);\n\treturn mix(fog_color * dBlendModeFogFactor, color, fogFactor);\n}\n",fogLinearPS:"\nuniform vec3 fog_color;\nuniform float fog_start;\nuniform float fog_end;\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\tfloat fogFactor = (fog_end - depth) / (fog_end - fog_start);\n\tfogFactor = clamp(fogFactor, 0.0, 1.0);\n\treturn mix(fog_color * dBlendModeFogFactor, color, fogFactor);\n}\n",fogNonePS:"\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\treturn color;\n}\n",fresnelSchlickPS:"\nvec3 getFresnel(\n\t\tfloat cosTheta, \n\t\tfloat gloss, \n\t\tvec3 specularity\n#if defined(LIT_IRIDESCENCE)\n\t\t, vec3 iridescenceFresnel, \n\t\tfloat iridescenceIntensity\n#endif\n\t) {\n\tfloat fresnel = pow(1.0 - max(cosTheta, 0.0), 5.0);\n\tfloat glossSq = gloss * gloss;\n\tvec3 ret = specularity + (max(vec3(glossSq), specularity) - specularity) * fresnel;\n#if defined(LIT_IRIDESCENCE)\n\treturn mix(ret, iridescenceFresnel, iridescenceIntensity);\n#else\n\treturn ret;\n#endif\t\n}\nfloat getFresnelCC(float cosTheta) {\n\tfloat fresnel = pow(1.0 - max(cosTheta, 0.0), 5.0);\n\treturn 0.04 + (1.0 - 0.04) * fresnel;\n}\n",fullscreenQuadPS:"\nvarying vec2 vUv0;\nuniform sampler2D source;\nvoid main(void) {\n\tgl_FragColor = texture2D(source, vUv0);\n}\n",fullscreenQuadVS:"\nattribute vec2 vertex_position;\nvarying vec2 vUv0;\nvoid main(void)\n{\n\tgl_Position = vec4(vertex_position, 0.5, 1.0);\n\tvUv0 = vertex_position.xy*0.5+0.5;\n}\n",gamma1_0PS:"\nfloat gammaCorrectInput(float color) {\n\treturn color;\n}\nvec3 gammaCorrectInput(vec3 color) {\n\treturn color;\n}\nvec4 gammaCorrectInput(vec4 color) {\n\treturn color;\n}\nvec3 gammaCorrectOutput(vec3 color) {\n\treturn color;\n}\n",gamma2_2PS:"\nfloat gammaCorrectInput(float color) {\n\treturn decodeGamma(color);\n}\nvec3 gammaCorrectInput(vec3 color) {\n\treturn decodeGamma(color);\n}\nvec4 gammaCorrectInput(vec4 color) {\n\treturn vec4(decodeGamma(color.xyz), color.w);\n}\nvec3 gammaCorrectOutput(vec3 color) {\n#ifdef HDR\n\treturn color;\n#else\n\treturn pow(color + 0.0000001, vec3(1.0 / 2.2));\n#endif\n}\n",gles2PS:Ar,gles2VS:Cr,gles3PS:Mr,gles3VS:Pr,glossPS:"\n#ifdef MAPFLOAT\nuniform float material_gloss;\n#endif\nvoid getGlossiness() {\n\tdGlossiness = 1.0;\n\t#ifdef MAPFLOAT\n\tdGlossiness *= material_gloss;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tdGlossiness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdGlossiness *= saturate(vVertexColor.$VC);\n\t#endif\n\t#ifdef MAPINVERT\n\tdGlossiness = 1.0 - dGlossiness;\n\t#endif\n\tdGlossiness += 0.0000001;\n}\n",iridescenceDiffractionPS:"\nuniform float material_iridescenceRefractionIndex;\n#ifndef PI\n#define PI 3.14159265\n#endif\nfloat iridescence_iorToFresnel(float transmittedIor, float incidentIor) {\n\treturn pow((transmittedIor - incidentIor) / (transmittedIor + incidentIor), 2.0);\n}\nvec3 iridescence_iorToFresnel(vec3 transmittedIor, float incidentIor) {\n\treturn pow((transmittedIor - vec3(incidentIor)) / (transmittedIor + vec3(incidentIor)), vec3(2.0));\n}\nvec3 iridescence_fresnelToIor(vec3 f0) {\n\tvec3 sqrtF0 = sqrt(f0);\n\treturn (vec3(1.0) + sqrtF0) / (vec3(1.0) - sqrtF0);\n}\nvec3 iridescence_sensitivity(float opd, vec3 shift) {\n\tfloat phase = 2.0 * PI * opd * 1.0e-9;\n\tconst vec3 val = vec3(5.4856e-13, 4.4201e-13, 5.2481e-13);\n\tconst vec3 pos = vec3(1.6810e+06, 1.7953e+06, 2.2084e+06);\n\tconst vec3 var = vec3(4.3278e+09, 9.3046e+09, 6.6121e+09);\n\tvec3 xyz = val * sqrt(2.0 * PI * var) * cos(pos * phase + shift) * exp(-pow(phase, 2.0) * var);\n\txyz.x += 9.7470e-14 * sqrt(2.0 * PI * 4.5282e+09) * cos(2.2399e+06 * phase + shift[0]) * exp(-4.5282e+09 * pow(phase, 2.0));\n\txyz /= vec3(1.0685e-07);\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t3.2404542, -0.9692660, 0.0556434,\n\t -1.5371385, 1.8760108, -0.2040259,\n\t -0.4985314, 0.0415560, 1.0572252\n\t);\n\treturn XYZ_TO_REC709 * xyz;\n}\nfloat iridescence_fresnel(float cosTheta, float f0) {\n\tfloat x = clamp(1.0 - cosTheta, 0.0, 1.0);\n\tfloat x2 = x * x;\n\tfloat x5 = x * x2 * x2;\n\treturn f0 + (1.0 - f0) * x5;\n} \nvec3 iridescence_fresnel(float cosTheta, vec3 f0) {\n\tfloat x = clamp(1.0 - cosTheta, 0.0, 1.0);\n\tfloat x2 = x * x;\n\tfloat x5 = x * x2 * x2; \n\treturn f0 + (vec3(1.0) - f0) * x5;\n}\nvec3 calcIridescence(float outsideIor, float cosTheta, vec3 base_f0, float iridescenceThickness) {\n\tfloat iridescenceIor = mix(outsideIor, material_iridescenceRefractionIndex, smoothstep(0.0, 0.03, iridescenceThickness));\n\tfloat sinTheta2Sq = pow(outsideIor / iridescenceIor, 2.0) * (1.0 - pow(cosTheta, 2.0));\n\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\tif (cosTheta2Sq < 0.0) {\n\t\treturn vec3(1.0);\n\t}\n\tfloat cosTheta2 = sqrt(cosTheta2Sq);\n\tfloat r0 = iridescence_iorToFresnel(iridescenceIor, outsideIor);\n\tfloat r12 = iridescence_fresnel(cosTheta, r0);\n\tfloat r21 = r12;\n\tfloat t121 = 1.0 - r12;\n\tfloat phi12 = iridescenceIor < outsideIor ? PI : 0.0;\n\tfloat phi21 = PI - phi12;\n\tvec3 baseIor = iridescence_fresnelToIor(base_f0 + vec3(0.0001));\n\tvec3 r1 = iridescence_iorToFresnel(baseIor, iridescenceIor);\n\tvec3 r23 = iridescence_fresnel(cosTheta2, r1);\n\tvec3 phi23 = vec3(0.0);\n\tif (baseIor[0] < iridescenceIor) phi23[0] = PI;\n\tif (baseIor[1] < iridescenceIor) phi23[1] = PI;\n\tif (baseIor[2] < iridescenceIor) phi23[2] = PI;\n\tfloat opd = 2.0 * iridescenceIor * iridescenceThickness * cosTheta2;\n\tvec3 phi = vec3(phi21) + phi23; \n\tvec3 r123Sq = clamp(r12 * r23, 1e-5, 0.9999);\n\tvec3 r123 = sqrt(r123Sq);\n\tvec3 rs = pow(t121, 2.0) * r23 / (1.0 - r123Sq);\n\tvec3 c0 = r12 + rs;\n\tvec3 i = c0;\n\tvec3 cm = rs - t121;\n\tfor (int m = 1; m <= 2; m++) {\n\t\tcm *= r123;\n\t\tvec3 sm = 2.0 * iridescence_sensitivity(float(m) * opd, float(m) * phi);\n\t\ti += cm * sm;\n\t}\n\treturn max(i, vec3(0.0));\n}\nvec3 getIridescence(float cosTheta, vec3 specularity, float iridescenceThickness) {\n\treturn calcIridescence(1.0, cosTheta, specularity, iridescenceThickness);\n}\n",iridescencePS:"\n#ifdef MAPFLOAT\nuniform float material_iridescence;\n#endif\nvoid getIridescence() {\n\tfloat iridescence = 1.0;\n\t#ifdef MAPFLOAT\n\tiridescence *= material_iridescence;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tiridescence *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\tdIridescence = iridescence; \n}\n",iridescenceThicknessPS:"\nuniform float material_iridescenceThicknessMax;\n#ifdef MAPTEXTURE\nuniform float material_iridescenceThicknessMin;\n#endif\nvoid getIridescenceThickness() {\n\t#ifdef MAPTEXTURE\n\tfloat blend = texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\tfloat iridescenceThickness = mix(material_iridescenceThicknessMin, material_iridescenceThicknessMax, blend);\n\t#else\n\tfloat iridescenceThickness = material_iridescenceThicknessMax;\n\t#endif\n\tdIridescenceThickness = iridescenceThickness; \n}\n",instancingVS:"\nattribute vec4 instance_line1;\nattribute vec4 instance_line2;\nattribute vec4 instance_line3;\nattribute vec4 instance_line4;\n",iorPS:"\n#ifdef MAPFLOAT\nuniform float material_refractionIndex;\n#endif\nvoid getIor() {\n#ifdef MAPFLOAT\n\tdIor = material_refractionIndex;\n#else\n\tdIor = 1.0 / 1.5;\n#endif\n}\n",lightDiffuseLambertPS:"\nfloat getLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\treturn max(dot(worldNormal, -lightDirNorm), 0.0);\n}\n",lightDirPointPS:"\nvoid getLightDirPoint(vec3 lightPosW) {\n\tdLightDirW = vPositionW - lightPosW;\n\tdLightDirNormW = normalize(dLightDirW);\n\tdLightPosW = lightPosW;\n}\n",lightmapAddPS:"\nvoid addLightMap(\n\tvec3 lightmap, \n\tvec3 dir, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 vertexNormal, \n\tmat3 tbn\n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel, \n\tfloat iridescenceIntensity\n#endif\n) {\n\tdDiffuseLight += lightmap;\n}\n",lightmapDirAddPS:"\nvoid addLightMap(\n\tvec3 lightmap, \n\tvec3 dir, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 vertexNormal, \n\tmat3 tbn\n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel, \n\tfloat iridescenceIntensity\n#endif\n) {\n\tif (dot(dir, dir) < 0.0001) {\n\t\tdDiffuseLight += lightmap;\n\t} else {\n\t\tfloat vlight = saturate(dot(dir, -vertexNormal));\n\t\tfloat flight = saturate(dot(dir, -worldNormal));\n\t\tfloat nlight = (flight / max(vlight, 0.01)) * 0.5;\n\t\tdDiffuseLight += lightmap * nlight * 2.0;\n\t\tvec3 halfDir = normalize(-dir + viewDir);\n\t\tvec3 specularLight = lightmap * getLightSpecular(halfDir, reflectionDir, worldNormal, viewDir, dir, gloss, tbn);\n#ifdef LIT_SPECULAR_FRESNEL\n\t\tspecularLight *= \n\t\t\tgetFresnel(dot(viewDir, halfDir), \n\t\t\tgloss, \n\t\t\tspecularity\n\t\t#if defined(LIT_IRIDESCENCE)\n\t\t\t, iridescenceFresnel,\n\t\t\tiridescenceIntensity\n\t\t#endif\n\t\t\t);\n#endif\n\t\tdSpecularLight += specularLight;\n\t}\n}\n",lightmapDirPS:"\nuniform sampler2D texture_lightMap;\nuniform sampler2D texture_dirLightMap;\nvoid getLightMap() {\n\tdLightmap = $DECODE(texture2DBias(texture_lightMap, $UV, textureBias)).$CH;\n\tvec3 dir = texture2DBias(texture_dirLightMap, $UV, textureBias).xyz * 2.0 - 1.0;\n\tfloat dirDot = dot(dir, dir);\n\tdLightmapDir = (dirDot > 0.001) ? dir / sqrt(dirDot) : vec3(0.0);\n}\n",lightmapSinglePS:"\nvoid getLightMap() {\n\tdLightmap = vec3(1.0);\n\t#ifdef MAPTEXTURE\n\tdLightmap *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdLightmap *= saturate(vVertexColor.$VC);\n\t#endif\n}\n",lightSpecularAnisoGGXPS:"\nfloat calcLightSpecular(float gloss, vec3 worldNormal, vec3 viewDir, vec3 h, vec3 lightDirNorm, mat3 tbn) {\n\tfloat PI = 3.141592653589793;\n\tfloat roughness = max((1.0 - gloss) * (1.0 - gloss), 0.001);\n\tfloat anisotropy = material_anisotropy * roughness;\n \n\tfloat at = max((roughness + anisotropy), roughness / 4.0);\n\tfloat ab = max((roughness - anisotropy), roughness / 4.0);\n\tfloat NoH = dot(worldNormal, h);\n\tfloat ToH = dot(tbn[0], h);\n\tfloat BoH = dot(tbn[1], h);\n\tfloat a2 = at * ab;\n\tvec3 v = vec3(ab * ToH, at * BoH, a2 * NoH);\n\tfloat v2 = dot(v, v);\n\tfloat w2 = a2 / v2;\n\tfloat D = a2 * w2 * w2 * (1.0 / PI);\n\tfloat ToV = dot(tbn[0], viewDir);\n\tfloat BoV = dot(tbn[1], viewDir);\n\tfloat ToL = dot(tbn[0], -lightDirNorm);\n\tfloat BoL = dot(tbn[1], -lightDirNorm);\n\tfloat NoV = dot(worldNormal, viewDir);\n\tfloat NoL = dot(worldNormal, -lightDirNorm);\n\tfloat lambdaV = NoL * length(vec3(at * ToV, ab * BoV, NoV));\n\tfloat lambdaL = NoV * length(vec3(at * ToL, ab * BoL, NoL));\n\tfloat G = 0.5 / (lambdaV + lambdaL);\n\treturn D * G;\n}\nfloat getLightSpecular(vec3 h, vec3 reflDir, vec3 worldNormal, vec3 viewDir, vec3 lightDirNorm, float gloss, mat3 tbn) {\n\treturn calcLightSpecular(gloss, worldNormal, viewDir, h, lightDirNorm, tbn);\n}\n",lightSpecularBlinnPS:"\nfloat calcLightSpecular(float gloss, vec3 worldNormal, vec3 h) {\n\tfloat nh = max( dot( h, worldNormal ), 0.0 );\n\tfloat specPow = exp2(gloss * 11.0);\n\tspecPow = max(specPow, 0.0001);\n\treturn pow(nh, specPow) * (specPow + 2.0) / 8.0;\n}\nfloat getLightSpecular(vec3 h, vec3 reflDir, vec3 worldNormal, vec3 viewDir, vec3 lightDirNorm, float gloss, mat3 tbn) {\n\treturn calcLightSpecular(gloss, worldNormal, h);\n}\n",lightSpecularPhongPS:"\nfloat calcLightSpecular(float gloss, vec3 reflDir, vec3 lightDirNorm) {\n\tfloat specPow = gloss;\n\treturn pow(max(dot(reflDir, -lightDirNorm), 0.0), specPow + 0.0001);\n}\nfloat getLightSpecular(vec3 h, vec3 reflDir, vec3 worldNormal, vec3 viewDir, vec3 lightDirNorm, float gloss, mat3 tbn) {\n\treturn calcLightSpecular(gloss, reflDir, lightDirNorm);\n}\n",lightSheenPS:"\nfloat sheenD(vec3 normal, vec3 h, float roughness) {\n\tfloat invR = 1.0 / (roughness * roughness);\n\tfloat cos2h = max(dot(normal, h), 0.0);\n\tcos2h *= cos2h;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\n\treturn (2.0 + invR) * pow(sin2h, invR * 0.5) / (2.0 * PI);\n}\nfloat sheenV(vec3 normal, vec3 viewDir, vec3 light) {\n\tfloat NoV = max(dot(normal, viewDir), 0.000001);\n\tfloat NoL = max(dot(normal, light), 0.000001);\n\treturn 1.0 / (4.0 * (NoL + NoV - NoL * NoV));\n}\nfloat getLightSpecularSheen(vec3 h, vec3 worldNormal, vec3 viewDir, vec3 lightDirNorm, float sheenGloss) {\n\tfloat D = sheenD(worldNormal, h, sheenGloss);\n\tfloat V = sheenV(worldNormal, viewDir, -lightDirNorm);\n\treturn D * V;\n}\n",linearizeDepthPS:"\n#ifndef LINEARIZE_DEPTH\n#define LINEARIZE_DEPTH\nfloat linearizeDepth(float z, vec4 cameraParams) {\n\tif (cameraParams.w == 0.0)\n\t\treturn (cameraParams.z * cameraParams.y) / (cameraParams.y + z * (cameraParams.z - cameraParams.y));\n\telse\n\t\treturn cameraParams.z + z * (cameraParams.y - cameraParams.z);\n}\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\n#ifdef GL2\nfloat linearizeDepth(float z) {\n\treturn linearizeDepth(z, camera_params);\n}\n#else\n#ifndef UNPACKFLOAT\n#define UNPACKFLOAT\nfloat unpackFloat(vec4 rgbaDepth) {\n\tconst vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n\treturn dot(rgbaDepth, bitShift);\n}\n#endif\n#endif\n#endif\n",litShaderArgsPS:"\nvec3 litArgs_albedo;\nfloat litArgs_opacity;\nvec3 litArgs_emission;\nvec3 litArgs_worldNormal;\nfloat litArgs_ao;\nvec3 litArgs_lightmap;\nvec3 litArgs_lightmapDir;\nfloat litArgs_metalness;\nvec3 litArgs_specularity;\nfloat litArgs_specularityFactor;\nfloat litArgs_gloss;\nfloat litArgs_sheen_gloss;\nvec3 litArgs_sheen_specularity;\nfloat litArgs_transmission;\nfloat litArgs_thickness;\nfloat litArgs_ior;\nfloat litArgs_dispersion;\nfloat litArgs_iridescence_intensity;\nfloat litArgs_iridescence_thickness;\nvec3 litArgs_clearcoat_worldNormal;\nfloat litArgs_clearcoat_specularity;\nfloat litArgs_clearcoat_gloss;\n",ltcPS:"\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nstruct Coords {\n\tvec3 coord0;\n\tvec3 coord1;\n\tvec3 coord2;\n\tvec3 coord3;\n};\nfloat LTC_EvaluateRect( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in Coords rectCoords) {\n\tvec3 v1 = rectCoords.coord1 - rectCoords.coord0;\n\tvec3 v2 = rectCoords.coord3 - rectCoords.coord0;\n\t\n\tvec3 lightNormal = cross( v1, v2 );\n\tfloat factor = sign(-dot( lightNormal, P - rectCoords.coord0 ));\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = factor * cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords.coord0 - P );\n\tcoords[ 1 ] = mat * ( rectCoords.coord1 - P );\n\tcoords[ 2 ] = mat * ( rectCoords.coord2 - P );\n\tcoords[ 3 ] = mat * ( rectCoords.coord3 - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn result;\n}\nCoords dLTCCoords;\nCoords getLTCLightCoords(vec3 lightPos, vec3 halfWidth, vec3 halfHeight){\n\tCoords coords;\n\tcoords.coord0 = lightPos + halfWidth - halfHeight;\n\tcoords.coord1 = lightPos - halfWidth - halfHeight;\n\tcoords.coord2 = lightPos - halfWidth + halfHeight;\n\tcoords.coord3 = lightPos + halfWidth + halfHeight;\n\treturn coords;\n}\nfloat dSphereRadius;\nCoords getSphereLightCoords(vec3 lightPos, vec3 halfWidth, vec3 halfHeight){\n\tdSphereRadius = max(length(halfWidth), length(halfHeight));\n\tvec3 f = reflect(normalize(lightPos - view_position), vNormalW);\n\tvec3 w = normalize(cross(f, halfHeight));\n\tvec3 h = normalize(cross(f, w));\n\treturn getLTCLightCoords(lightPos, w * dSphereRadius, h * dSphereRadius);\n}\nvec2 dLTCUV;\n#ifdef LIT_CLEARCOAT\nvec2 ccLTCUV;\n#endif\nvec2 getLTCLightUV(float gloss, vec3 worldNormal, vec3 viewDir)\n{\n\tfloat roughness = max((1.0 - gloss) * (1.0 - gloss), 0.001);\n\treturn LTC_Uv( worldNormal, viewDir, roughness );\n}\nvec3 dLTCSpecFres;\n#ifdef LIT_CLEARCOAT\nvec3 ccLTCSpecFres;\n#endif\nvec3 getLTCLightSpecFres(vec2 uv, vec3 specularity)\n{\n\tvec4 t2 = texture2DLodEXT(areaLightsLutTex2, uv, 0.0);\n\t#ifdef AREA_R8_G8_B8_A8_LUTS\n\tt2 *= vec4(0.693103,1,1,1);\n\tt2 += vec4(0.306897,0,0,0);\n\t#endif\n\treturn specularity * t2.x + ( vec3( 1.0 ) - specularity) * t2.y;\n}\nvoid calcLTCLightValues(float gloss, vec3 worldNormal, vec3 viewDir, vec3 specularity, float clearcoatGloss, vec3 clearcoatWorldNormal, float clearcoatSpecularity)\n{\n\tdLTCUV = getLTCLightUV(gloss, worldNormal, viewDir);\n\tdLTCSpecFres = getLTCLightSpecFres(dLTCUV, specularity); \n#ifdef LIT_CLEARCOAT\n\tccLTCUV = getLTCLightUV(clearcoatGloss, clearcoatWorldNormal, viewDir);\n\tccLTCSpecFres = getLTCLightSpecFres(ccLTCUV, vec3(clearcoatSpecularity));\n#endif\n}\nvoid calcRectLightValues(vec3 lightPos, vec3 halfWidth, vec3 halfHeight)\n{\n\tdLTCCoords = getLTCLightCoords(lightPos, halfWidth, halfHeight);\n}\nvoid calcDiskLightValues(vec3 lightPos, vec3 halfWidth, vec3 halfHeight)\n{\n\tcalcRectLightValues(lightPos, halfWidth, halfHeight);\n}\nvoid calcSphereLightValues(vec3 lightPos, vec3 halfWidth, vec3 halfHeight)\n{\n\tdLTCCoords = getSphereLightCoords(lightPos, halfWidth, halfHeight);\n}\nvec3 SolveCubic(vec4 Coefficient)\n{\n\tfloat pi = 3.14159;\n\tCoefficient.xyz /= Coefficient.w;\n\tCoefficient.yz /= 3.0;\n\tfloat A = Coefficient.w;\n\tfloat B = Coefficient.z;\n\tfloat C = Coefficient.y;\n\tfloat D = Coefficient.x;\n\tvec3 Delta = vec3(\n\t\t-Coefficient.z * Coefficient.z + Coefficient.y,\n\t\t-Coefficient.y * Coefficient.z + Coefficient.x,\n\t\tdot(vec2(Coefficient.z, -Coefficient.y), Coefficient.xy)\n\t);\n\tfloat Discriminant = dot(vec2(4.0 * Delta.x, -Delta.y), Delta.zy);\n\tvec3 RootsA, RootsD;\n\tvec2 xlc, xsc;\n\t{\n\t\tfloat A_a = 1.0;\n\t\tfloat C_a = Delta.x;\n\t\tfloat D_a = -2.0 * B * Delta.x + Delta.y;\n\t\tfloat Theta = atan(sqrt(Discriminant), -D_a) / 3.0;\n\t\tfloat x_1a = 2.0 * sqrt(-C_a) * cos(Theta);\n\t\tfloat x_3a = 2.0 * sqrt(-C_a) * cos(Theta + (2.0 / 3.0) * pi);\n\t\tfloat xl;\n\t\tif ((x_1a + x_3a) > 2.0 * B)\n\t\t\txl = x_1a;\n\t\telse\n\t\t\txl = x_3a;\n\t\txlc = vec2(xl - B, A);\n\t}\n\t{\n\t\tfloat A_d = D;\n\t\tfloat C_d = Delta.z;\n\t\tfloat D_d = -D * Delta.y + 2.0 * C * Delta.z;\n\t\tfloat Theta = atan(D * sqrt(Discriminant), -D_d) / 3.0;\n\t\tfloat x_1d = 2.0 * sqrt(-C_d) * cos(Theta);\n\t\tfloat x_3d = 2.0 * sqrt(-C_d) * cos(Theta + (2.0 / 3.0) * pi);\n\t\tfloat xs;\n\t\tif (x_1d + x_3d < 2.0 * C)\n\t\t\txs = x_1d;\n\t\telse\n\t\t\txs = x_3d;\n\t\txsc = vec2(-D, xs + C);\n\t}\n\tfloat E = xlc.y * xsc.y;\n\tfloat F = -xlc.x * xsc.y - xlc.y * xsc.x;\n\tfloat G = xlc.x * xsc.x;\n\tvec2 xmc = vec2(C * F - B * G, -B * F + C * E);\n\tvec3 Root = vec3(xsc.x / xsc.y, xmc.x / xmc.y, xlc.x / xlc.y);\n\tif (Root.x < Root.y && Root.x < Root.z)\n\t\tRoot.xyz = Root.yxz;\n\telse if (Root.z < Root.x && Root.z < Root.y)\n\t\tRoot.xyz = Root.xzy;\n\treturn Root;\n}\nfloat LTC_EvaluateDisk(vec3 N, vec3 V, vec3 P, mat3 Minv, Coords points)\n{\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot(V, N));\n\tT2 = cross(N, T1);\n\tmat3 R = transposeMat3( mat3( T1, T2, N ) );\n\tvec3 L_[ 3 ];\n\tL_[ 0 ] = R * ( points.coord0 - P );\n\tL_[ 1 ] = R * ( points.coord1 - P );\n\tL_[ 2 ] = R * ( points.coord2 - P );\n\tvec3 Lo_i = vec3(0);\n\tvec3 C = 0.5 * (L_[0] + L_[2]);\n\tvec3 V1 = 0.5 * (L_[1] - L_[2]);\n\tvec3 V2 = 0.5 * (L_[1] - L_[0]);\n\tC = Minv * C;\n\tV1 = Minv * V1;\n\tV2 = Minv * V2;\n\tfloat a, b;\n\tfloat d11 = dot(V1, V1);\n\tfloat d22 = dot(V2, V2);\n\tfloat d12 = dot(V1, V2);\n\tif (abs(d12) / sqrt(d11 * d22) > 0.0001)\n\t{\n\t\tfloat tr = d11 + d22;\n\t\tfloat det = -d12 * d12 + d11 * d22;\n\t\tdet = sqrt(det);\n\t\tfloat u = 0.5 * sqrt(tr - 2.0 * det);\n\t\tfloat v = 0.5 * sqrt(tr + 2.0 * det);\n\t\tfloat e_max = (u + v) * (u + v);\n\t\tfloat e_min = (u - v) * (u - v);\n\t\tvec3 V1_, V2_;\n\t\tif (d11 > d22)\n\t\t{\n\t\t\tV1_ = d12 * V1 + (e_max - d11) * V2;\n\t\t\tV2_ = d12 * V1 + (e_min - d11) * V2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tV1_ = d12*V2 + (e_max - d22)*V1;\n\t\t\tV2_ = d12*V2 + (e_min - d22)*V1;\n\t\t}\n\t\ta = 1.0 / e_max;\n\t\tb = 1.0 / e_min;\n\t\tV1 = normalize(V1_);\n\t\tV2 = normalize(V2_);\n\t}\n\telse\n\t{\n\t\ta = 1.0 / dot(V1, V1);\n\t\tb = 1.0 / dot(V2, V2);\n\t\tV1 *= sqrt(a);\n\t\tV2 *= sqrt(b);\n\t}\n\tvec3 V3 = cross(V1, V2);\n\tif (dot(C, V3) < 0.0)\n\t\tV3 *= -1.0;\n\tfloat L = dot(V3, C);\n\tfloat x0 = dot(V1, C) / L;\n\tfloat y0 = dot(V2, C) / L;\n\tfloat E1 = inversesqrt(a);\n\tfloat E2 = inversesqrt(b);\n\ta *= L * L;\n\tb *= L * L;\n\tfloat c0 = a * b;\n\tfloat c1 = a * b * (1.0 + x0 * x0 + y0 * y0) - a - b;\n\tfloat c2 = 1.0 - a * (1.0 + x0 * x0) - b * (1.0 + y0 * y0);\n\tfloat c3 = 1.0;\n\tvec3 roots = SolveCubic(vec4(c0, c1, c2, c3));\n\tfloat e1 = roots.x;\n\tfloat e2 = roots.y;\n\tfloat e3 = roots.z;\n\tvec3 avgDir = vec3(a * x0 / (a - e2), b * y0 / (b - e2), 1.0);\n\tmat3 rotate = mat3(V1, V2, V3);\n\tavgDir = rotate * avgDir;\n\tavgDir = normalize(avgDir);\n\tfloat L1 = sqrt(-e2 / e3);\n\tfloat L2 = sqrt(-e2 / e1);\n\tfloat formFactor = L1 * L2 * inversesqrt((1.0 + L1 * L1) * (1.0 + L2 * L2));\n\t\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tvec2 uv = vec2(avgDir.z * 0.5 + 0.5, formFactor);\n\tuv = uv*LUT_SCALE + LUT_BIAS;\n\tfloat scale = texture2DLodEXT(areaLightsLutTex2, uv, 0.0).w;\n\treturn formFactor*scale;\n}\nfloat getRectLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\treturn LTC_EvaluateRect( worldNormal, viewDir, vPositionW, mat3( 1.0 ), dLTCCoords );\n}\nfloat getDiskLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\treturn LTC_EvaluateDisk( worldNormal, viewDir, vPositionW, mat3( 1.0 ), dLTCCoords );\n}\nfloat getSphereLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\tfloat falloff = dSphereRadius / (dot(lightDir, lightDir) + dSphereRadius);\n\treturn getLightDiffuse(worldNormal, viewDir, lightDir, lightDirNorm) * falloff;\n}\nmat3 getLTCLightInvMat(vec2 uv)\n{\n\tvec4 t1 = texture2DLodEXT(areaLightsLutTex1, uv, 0.0);\n\t#ifdef AREA_R8_G8_B8_A8_LUTS\n\tt1 *= vec4(1.001, 0.3239, 0.60437568, 1.0);\n\tt1 += vec4(0.0, -0.2976, -0.01381, 0.0);\n\t#endif\n\treturn mat3(\n\t\tvec3( t1.x, 0, t1.y ),\n\t\tvec3(\t0, 1,\t0 ),\n\t\tvec3( t1.z, 0, t1.w )\n\t);\n}\nfloat calcRectLightSpecular(vec3 worldNormal, vec3 viewDir, vec2 uv) {\n\tmat3 mInv = getLTCLightInvMat(uv);\n\treturn LTC_EvaluateRect( worldNormal, viewDir, vPositionW, mInv, dLTCCoords );\n}\nfloat getRectLightSpecular(vec3 worldNormal, vec3 viewDir) {\n\treturn calcRectLightSpecular(worldNormal, viewDir, dLTCUV);\n}\nfloat calcDiskLightSpecular(vec3 worldNormal, vec3 viewDir, vec2 uv) {\n\tmat3 mInv = getLTCLightInvMat(uv);\n\treturn LTC_EvaluateDisk( worldNormal, viewDir, vPositionW, mInv, dLTCCoords );\n}\nfloat getDiskLightSpecular(vec3 worldNormal, vec3 viewDir) {\n\treturn calcDiskLightSpecular(worldNormal, viewDir, dLTCUV);\n}\nfloat getSphereLightSpecular(vec3 worldNormal, vec3 viewDir) {\n\treturn calcDiskLightSpecular(worldNormal, viewDir, dLTCUV);\n}\n",metalnessPS:"\n#ifdef MAPFLOAT\nuniform float material_metalness;\n#endif\nvoid getMetalness() {\n\tfloat metalness = 1.0;\n\t#ifdef MAPFLOAT\n\tmetalness *= material_metalness;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tmetalness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tmetalness *= saturate(vVertexColor.$VC);\n\t#endif\n\tdMetalness = metalness;\n}\n",metalnessModulatePS:"\nvec3 getSpecularModulate(in vec3 specularity, in vec3 albedo, in float metalness, in float f0) {\n\tvec3 dielectricF0 = f0 * specularity;\n\treturn mix(dielectricF0, albedo, metalness);\n}\nvec3 getAlbedoModulate(in vec3 albedo, in float metalness) {\n\treturn albedo * (1.0 - metalness);\n}\n",msdfPS:"\nuniform sampler2D texture_msdfMap;\n#ifdef GL_OES_standard_derivatives\n#define USE_FWIDTH\n#endif\n#ifdef GL2\n#define USE_FWIDTH\n#endif\nfloat median(float r, float g, float b) {\n\treturn max(min(r, g), min(max(r, g), b));\n}\nfloat map (float min, float max, float v) {\n\treturn (v - min) / (max - min);\n}\nuniform float font_sdfIntensity;\nuniform float font_pxrange;\nuniform float font_textureWidth;\n#ifdef UNIFORM_TEXT_PARAMETERS\nuniform vec4 outline_color;\nuniform float outline_thickness;\nuniform vec4 shadow_color;\nuniform vec2 shadow_offset;\n#else\nvarying vec4 outline_color;\nvarying float outline_thickness;\nvarying vec4 shadow_color;\nvarying vec2 shadow_offset;\n#endif\nvec4 applyMsdf(vec4 color) {\n\tvec3 tsample = texture2D(texture_msdfMap, vUv0).rgb;\n\tvec2 uvShdw = vUv0 - shadow_offset;\n\tvec3 ssample = texture2D(texture_msdfMap, uvShdw).rgb;\n\tfloat sigDist = median(tsample.r, tsample.g, tsample.b);\n\tfloat sigDistShdw = median(ssample.r, ssample.g, ssample.b);\n\tfloat smoothingMax = 0.2;\n\t#ifdef USE_FWIDTH\n\tvec2 w = fwidth(vUv0);\n\tfloat smoothing = clamp(w.x * font_textureWidth / font_pxrange, 0.0, smoothingMax);\n\t#else\n\tfloat font_size = 16.0;\n\tfloat smoothing = clamp(font_pxrange / font_size, 0.0, smoothingMax);\n\t#endif\n\tfloat mapMin = 0.05;\n\tfloat mapMax = clamp(1.0 - font_sdfIntensity, mapMin, 1.0);\n\tfloat sigDistInner = map(mapMin, mapMax, sigDist);\n\tfloat sigDistOutline = map(mapMin, mapMax, sigDist + outline_thickness);\n\tsigDistShdw = map(mapMin, mapMax, sigDistShdw + outline_thickness);\n\tfloat center = 0.5;\n\tfloat inside = smoothstep(center-smoothing, center+smoothing, sigDistInner);\n\tfloat outline = smoothstep(center-smoothing, center+smoothing, sigDistOutline);\n\tfloat shadow = smoothstep(center-smoothing, center+smoothing, sigDistShdw);\n\tvec4 tcolor = (outline > inside) ? outline * vec4(outline_color.a * outline_color.rgb, outline_color.a) : vec4(0.0);\n\ttcolor = mix(tcolor, color, inside);\n\tvec4 scolor = (shadow > outline) ? shadow * vec4(shadow_color.a * shadow_color.rgb, shadow_color.a) : tcolor;\n\ttcolor = mix(scolor, tcolor, outline);\n\t\n\treturn tcolor;\n}\n",msdfVS:"\nattribute vec3 vertex_outlineParameters;\nattribute vec3 vertex_shadowParameters;\nvarying vec4 outline_color;\nvarying float outline_thickness;\nvarying vec4 shadow_color;\nvarying vec2 shadow_offset;\nvoid unpackMsdfParams() {\n\tvec3 little = mod(vertex_outlineParameters, 256.);\n\tvec3 big = (vertex_outlineParameters - little) / 256.;\n\toutline_color.rb = little.xy / 255.;\n\toutline_color.ga = big.xy / 255.;\n\toutline_thickness = little.z / 255. * 0.2;\n\tlittle = mod(vertex_shadowParameters, 256.);\n\tbig = (vertex_shadowParameters - little) / 256.;\n\tshadow_color.rb = little.xy / 255.;\n\tshadow_color.ga = big.xy / 255.;\n\tshadow_offset = (vec2(little.z, big.z) / 127. - 1.) * 0.005;\n}\n",normalVS:"\n#ifdef MORPHING_TEXTURE_BASED_NORMAL\nuniform highp sampler2D morphNormalTex;\n#endif\nvec3 getNormal() {\n\t#ifdef SKIN\n\tdNormalMatrix = mat3(dModelMatrix[0].xyz, dModelMatrix[1].xyz, dModelMatrix[2].xyz);\n\t#elif defined(INSTANCING)\n\tdNormalMatrix = mat3(instance_line1.xyz, instance_line2.xyz, instance_line3.xyz);\n\t#else\n\tdNormalMatrix = matrix_normal;\n\t#endif\n\tvec3 tempNormal = vertex_normal;\n\t#ifdef MORPHING\n\t#ifdef MORPHING_NRM03\n\ttempNormal += morph_weights_a[0] * morph_nrm0;\n\ttempNormal += morph_weights_a[1] * morph_nrm1;\n\ttempNormal += morph_weights_a[2] * morph_nrm2;\n\ttempNormal += morph_weights_a[3] * morph_nrm3;\n\t#endif\n\t#ifdef MORPHING_NRM47\n\ttempNormal += morph_weights_b[0] * morph_nrm4;\n\ttempNormal += morph_weights_b[1] * morph_nrm5;\n\ttempNormal += morph_weights_b[2] * morph_nrm6;\n\ttempNormal += morph_weights_b[3] * morph_nrm7;\n\t#endif\n\t#endif\n\t#ifdef MORPHING_TEXTURE_BASED_NORMAL\n\t\t#ifdef WEBGPU\n\t\t\tivec2 morphUV = getTextureMorphCoords();\n\t\t\tvec3 morphNormal = texelFetch(morphNormalTex, ivec2(morphUV), 0).xyz;\n\t\t#else\n\t\t\tvec2 morphUV = getTextureMorphCoords();\n\t\t\tvec3 morphNormal = texture2D(morphNormalTex, morphUV).xyz;\n\t\t#endif\n\ttempNormal += morphNormal;\n\t#endif\n\treturn normalize(dNormalMatrix * tempNormal);\n}\n",normalDetailMapPS:"\n#ifdef MAPTEXTURE\nuniform float material_normalDetailMapBumpiness;\nvec3 blendNormals(vec3 n1, vec3 n2) {\n\tn1 += vec3(0, 0, 1);\n\tn2 *= vec3(-1, -1, 1);\n\treturn n1 * dot(n1, n2) / n1.z - n2;\n}\n#endif\nvec3 addNormalDetail(vec3 normalMap) {\n#ifdef MAPTEXTURE\n\tvec3 normalDetailMap = unpackNormal(texture2DBias($SAMPLER, $UV, textureBias));\n\tnormalDetailMap = mix(vec3(0.0, 0.0, 1.0), normalDetailMap, material_normalDetailMapBumpiness);\n\treturn blendNormals(normalMap, normalDetailMap);\n#else\n\treturn normalMap;\n#endif\n}\n",normalInstancedVS:"\nvec3 getNormal() {\n\tdNormalMatrix = mat3(instance_line1.xyz, instance_line2.xyz, instance_line3.xyz);\n\treturn normalize(dNormalMatrix * vertex_normal);\n}\n",normalMapPS:"\n#ifdef MAPTEXTURE\nuniform float material_bumpiness;\n#endif\nvoid getNormal() {\n#ifdef MAPTEXTURE\n\tvec3 normalMap = unpackNormal(texture2DBias($SAMPLER, $UV, textureBias));\n\tnormalMap = mix(vec3(0.0, 0.0, 1.0), normalMap, material_bumpiness);\n\tdNormalW = normalize(dTBN * addNormalDetail(normalMap));\n#else\n\tdNormalW = dVertexNormalW;\n#endif\n}\n",normalSkinnedVS:"\nvec3 getNormal() {\n\tdNormalMatrix = mat3(dModelMatrix[0].xyz, dModelMatrix[1].xyz, dModelMatrix[2].xyz);\n\treturn normalize(dNormalMatrix * vertex_normal);\n}\n",normalXYPS:"\nvec3 unpackNormal(vec4 nmap) {\n\tvec3 normal;\n\tnormal.xy = nmap.wy * 2.0 - 1.0;\n\tnormal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));\n\treturn normal;\n}\n",normalXYZPS:"\nvec3 unpackNormal(vec4 nmap) {\n\treturn nmap.xyz * 2.0 - 1.0;\n}\n",opacityPS:"\n#ifdef MAPFLOAT\nuniform float material_opacity;\n#endif\nvoid getOpacity() {\n\tdAlpha = 1.0;\n\t#ifdef MAPFLOAT\n\tdAlpha *= material_opacity;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tdAlpha *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdAlpha *= clamp(vVertexColor.$VC, 0.0, 1.0);\n\t#endif\n}\n",opacityDitherPS:"\nuniform vec4 blueNoiseJitter;\n#ifdef DITHER_BLUENOISE\n\tuniform sampler2D blueNoiseTex32;\n#endif\nvoid opacityDither(float alpha, float id) {\n\t#ifdef DITHER_BAYER8\n\t\tfloat noise = bayer8(floor(mod(gl_FragCoord.xy + blueNoiseJitter.xy + id, 8.0))) / 64.0;\n\t#else\n\t\t#ifdef DITHER_BLUENOISE\n\t\t\tvec2 uv = fract(gl_FragCoord.xy / 32.0 + blueNoiseJitter.xy + id);\n\t\t\tfloat noise = texture2DLodEXT(blueNoiseTex32, uv, 0.0).y;\n\t\t#endif\n\t\t#ifdef DITHER_IGNNOISE\n\t\t\tvec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n\t\t\tfloat noise = fract(magic.z * fract(dot(gl_FragCoord.xy + blueNoiseJitter.xy + id, magic.xy)));\n\t\t#endif\n\t#endif\n\tif (alpha < noise)\n\t\tdiscard;\n}\n",outputPS:"\n",outputAlphaPS:"\ngl_FragColor.a = litArgs_opacity;\n",outputAlphaOpaquePS:"\n\tgl_FragColor.a = 1.0;\n",outputAlphaPremulPS:"\ngl_FragColor.rgb *= litArgs_opacity;\ngl_FragColor.a = litArgs_opacity;\n",outputTex2DPS:"\nvarying vec2 vUv0;\nuniform sampler2D source;\nvoid main(void) {\n\tgl_FragColor = texture2D(source, vUv0);\n}\n",packDepthPS:"\nvec4 packFloat(float depth) {\n\tconst vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n\tconst vec4 bit_mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n\tvec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\n",sheenPS:"\n#ifdef MAPCOLOR\nuniform vec3 material_sheen;\n#endif\nvoid getSheen() {\n\tvec3 sheenColor = vec3(1, 1, 1);\n\t#ifdef MAPCOLOR\n\tsheenColor *= material_sheen;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tsheenColor *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tsheenColor *= saturate(vVertexColor.$VC);\n\t#endif\n\tsSpecularity = sheenColor;\n}\n",sheenGlossPS:"\n#ifdef MAPFLOAT\nuniform float material_sheenGloss;\n#endif\nvoid getSheenGlossiness() {\n\tfloat sheenGlossiness = 1.0;\n\t#ifdef MAPFLOAT\n\tsheenGlossiness *= material_sheenGloss;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tsheenGlossiness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tsheenGlossiness *= saturate(vVertexColor.$VC);\n\t#endif\n\t#ifdef MAPINVERT\n\tsheenGlossiness = 1.0 - sheenGlossiness;\n\t#endif\n\tsheenGlossiness += 0.0000001;\n\tsGlossiness = sheenGlossiness;\n}\n",parallaxPS:"\nuniform float material_heightMapFactor;\nvoid getParallax() {\n\tfloat parallaxScale = material_heightMapFactor;\n\tfloat height = texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\theight = height * parallaxScale - parallaxScale*0.5;\n\tvec3 viewDirT = dViewDirW * dTBN;\n\tviewDirT.z += 0.42;\n\tdUvOffset = height * (viewDirT.xy / viewDirT.z);\n}\n",particlePS:"\nvarying vec4 texCoordsAlphaLife;\nuniform sampler2D colorMap;\nuniform sampler2D colorParam;\nuniform float graphSampleSize;\nuniform float graphNumSamples;\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\nuniform float softening;\nuniform float colorMult;\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\n#ifndef UNPACKFLOAT\n#define UNPACKFLOAT\nfloat unpackFloat(vec4 rgbaDepth) {\n\tconst vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n\tfloat depth = dot(rgbaDepth, bitShift);\n\treturn depth;\n}\n#endif\nvoid main(void) {\n\tvec4 tex = gammaCorrectInput(texture2D(colorMap, vec2(texCoordsAlphaLife.x, 1.0 - texCoordsAlphaLife.y)));\n\tvec4 ramp = gammaCorrectInput(texture2D(colorParam, vec2(texCoordsAlphaLife.w, 0.0)));\n\tramp.rgb *= colorMult;\n\tramp.a += texCoordsAlphaLife.z;\n\tvec3 rgb = tex.rgb * ramp.rgb;\n\tfloat a = tex.a * ramp.a;\n",particleVS:"\nvec3 unpack3NFloats(float src) {\n\tfloat r = fract(src);\n\tfloat g = fract(src * 256.0);\n\tfloat b = fract(src * 65536.0);\n\treturn vec3(r, g, b);\n}\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvec4 tex1Dlod_lerp(TEXTURE_ACCEPT_HIGHP(tex), vec2 tc) {\n\treturn mix( texture2D(tex,tc), texture2D(tex,tc + graphSampleSize), fract(tc.x*graphNumSamples) );\n}\nvec4 tex1Dlod_lerp(TEXTURE_ACCEPT_HIGHP(tex), vec2 tc, out vec3 w) {\n\tvec4 a = texture2D(tex,tc);\n\tvec4 b = texture2D(tex,tc + graphSampleSize);\n\tfloat c = fract(tc.x*graphNumSamples);\n\tvec3 unpackedA = unpack3NFloats(a.w);\n\tvec3 unpackedB = unpack3NFloats(b.w);\n\tw = mix(unpackedA, unpackedB, c);\n\treturn mix(a, b, c);\n}\nvec2 rotate(vec2 quadXY, float pRotation, out mat2 rotMatrix) {\n\tfloat c = cos(pRotation);\n\tfloat s = sin(pRotation);\n\tmat2 m = mat2(c, -s, s, c);\n\trotMatrix = m;\n\treturn m * quadXY;\n}\nvec3 billboard(vec3 InstanceCoords, vec2 quadXY) {\n\t#ifdef SCREEN_SPACE\n\t\tvec3 pos = vec3(-1, 0, 0) * quadXY.x + vec3(0, -1, 0) * quadXY.y;\n\t#else\n\t\tvec3 pos = -matrix_viewInverse[0].xyz * quadXY.x + -matrix_viewInverse[1].xyz * quadXY.y;\n\t#endif\n\treturn pos;\n}\nvec3 customFace(vec3 InstanceCoords, vec2 quadXY) {\n\tvec3 pos = faceTangent * quadXY.x + faceBinorm * quadXY.y;\n\treturn pos;\n}\nvec2 safeNormalize(vec2 v) {\n\tfloat l = length(v);\n\treturn (l > 1e-06) ? v / l : v;\n}\nvoid main(void) {\n\tvec3 meshLocalPos = particle_vertexData.xyz;\n\tfloat id = floor(particle_vertexData.w);\n\tfloat rndFactor = fract(sin(id + 1.0 + seed));\n\tvec3 rndFactor3 = vec3(rndFactor, fract(rndFactor*10.0), fract(rndFactor*100.0));\n\tfloat uv = id / numParticlesPot;\n\treadInput(uv);\n#ifdef LOCAL_SPACE\n\tinVel = mat3(matrix_model) * inVel;\n#endif\n\tvec2 velocityV = safeNormalize((mat3(matrix_view) * inVel).xy);\n\tfloat particleLifetime = lifetime;\n\tif (inLife <= 0.0 || inLife > particleLifetime || !inShow) meshLocalPos = vec3(0.0);\n\tvec2 quadXY = meshLocalPos.xy;\n\tfloat nlife = clamp(inLife / particleLifetime, 0.0, 1.0);\n\tvec3 paramDiv;\n\tvec4 params = tex1Dlod_lerp(TEXTURE_PASS(internalTex2), vec2(nlife, 0), paramDiv);\n\tfloat scale = params.y;\n\tfloat scaleDiv = paramDiv.x;\n\tfloat alphaDiv = paramDiv.z;\n\tscale += (scaleDiv * 2.0 - 1.0) * scaleDivMult * fract(rndFactor*10000.0);\n#ifndef USE_MESH\n\ttexCoordsAlphaLife = vec4(quadXY * -0.5 + 0.5, (alphaDiv * 2.0 - 1.0) * alphaDivMult * fract(rndFactor*1000.0), nlife);\n#else\n\ttexCoordsAlphaLife = vec4(particle_uv, (alphaDiv * 2.0 - 1.0) * alphaDivMult * fract(rndFactor*1000.0), nlife);\n#endif\n\tvec3 particlePos = inPos;\n\tvec3 particlePosMoved = vec3(0.0);\n\tmat2 rotMatrix;\n",particleAnimFrameClampVS:"\n\tfloat animFrame = min(floor(texCoordsAlphaLife.w * animTexParams.y) + animTexParams.x, animTexParams.z);\n",particleAnimFrameLoopVS:"\n\tfloat animFrame = floor(mod(texCoordsAlphaLife.w * animTexParams.y + animTexParams.x, animTexParams.z + 1.0));\n",particleAnimTexVS:"\n\tfloat animationIndex;\n\tif (animTexIndexParams.y == 1.0) {\n\t\tanimationIndex = floor((animTexParams.w + 1.0) * rndFactor3.z) * (animTexParams.z + 1.0);\n\t} else {\n\t\tanimationIndex = animTexIndexParams.x * (animTexParams.z + 1.0);\n\t}\n\tfloat atlasX = (animationIndex + animFrame) * animTexTilesParams.x;\n\tfloat atlasY = 1.0 - floor(atlasX + 1.0) * animTexTilesParams.y;\n\tatlasX = fract(atlasX);\n\ttexCoordsAlphaLife.xy *= animTexTilesParams.xy;\n\ttexCoordsAlphaLife.xy += vec2(atlasX, atlasY);\n",particleInputFloatPS:"\nvoid readInput(float uv) {\n\tvec4 tex = texture2D(particleTexIN, vec2(uv, 0.25));\n\tvec4 tex2 = texture2D(particleTexIN, vec2(uv, 0.75));\n\tinPos = tex.xyz;\n\tinVel = tex2.xyz;\n\tinAngle = (tex.w < 0.0? -tex.w : tex.w) - 1000.0;\n\tinShow = tex.w >= 0.0;\n\tinLife = tex2.w;\n}\n",particleInputRgba8PS:"\n#define PI2 6.283185307179586\nuniform vec3 inBoundsSize;\nuniform vec3 inBoundsCenter;\nuniform float maxVel;\nfloat decodeFloatRG(vec2 rg) {\n\treturn rg.y*(1.0/255.0) + rg.x;\n}\nfloat decodeFloatRGBA( vec4 rgba ) {\n return dot( rgba, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/160581375.0) );\n}\nvoid readInput(float uv) {\n\tvec4 tex0 = texture2D(particleTexIN, vec2(uv, 0.125));\n\tvec4 tex1 = texture2D(particleTexIN, vec2(uv, 0.375));\n\tvec4 tex2 = texture2D(particleTexIN, vec2(uv, 0.625));\n\tvec4 tex3 = texture2D(particleTexIN, vec2(uv, 0.875));\n\tinPos = vec3(decodeFloatRG(tex0.rg), decodeFloatRG(tex0.ba), decodeFloatRG(tex1.rg));\n\tinPos = (inPos - vec3(0.5)) * inBoundsSize + inBoundsCenter;\n\tinVel = tex2.xyz;\n\tinVel = (inVel - vec3(0.5)) * maxVel;\n\tinAngle = decodeFloatRG(tex1.ba) * PI2;\n\tinShow = tex2.a > 0.5;\n\tinLife = decodeFloatRGBA(tex3);\n\tfloat maxNegLife = max(lifetime, (numParticles - 1.0) * (rate+rateDiv));\n\tfloat maxPosLife = lifetime+1.0;\n\tinLife = inLife * (maxNegLife + maxPosLife) - maxNegLife;\n}\n",particleOutputFloatPS:"\nvoid writeOutput() {\n\tif (gl_FragCoord.y<1.0) {\n\t\tgl_FragColor = vec4(outPos, (outAngle + 1000.0) * visMode);\n\t} else {\n\t\tgl_FragColor = vec4(outVel, outLife);\n\t}\n}\n",particleOutputRgba8PS:"\nuniform vec3 outBoundsMul;\nuniform vec3 outBoundsAdd;\nvec2 encodeFloatRG( float v ) {\n\tvec2 enc = vec2(1.0, 255.0) * v;\n\tenc = fract(enc);\n\tenc -= enc.yy * vec2(1.0/255.0, 1.0/255.0);\n\treturn enc;\n}\nvec4 encodeFloatRGBA( float v ) {\n\tvec4 enc = vec4(1.0, 255.0, 65025.0, 160581375.0) * v;\n\tenc = fract(enc);\n\tenc -= enc.yzww * vec4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);\n\treturn enc;\n}\nvoid writeOutput() {\n\toutPos = outPos * outBoundsMul + outBoundsAdd;\n\toutAngle = fract(outAngle / PI2);\n\toutVel = (outVel / maxVel) + vec3(0.5);\n\tfloat maxNegLife = max(lifetime, (numParticles - 1.0) * (rate+rateDiv));\n\tfloat maxPosLife = lifetime+1.0;\n\toutLife = (outLife + maxNegLife) / (maxNegLife + maxPosLife);\n\tif (gl_FragCoord.y < 1.0) {\n\t\tgl_FragColor = vec4(encodeFloatRG(outPos.x), encodeFloatRG(outPos.y));\n\t} else if (gl_FragCoord.y < 2.0) {\n\t\tgl_FragColor = vec4(encodeFloatRG(outPos.z), encodeFloatRG(outAngle));\n\t} else if (gl_FragCoord.y < 3.0) {\n\t\tgl_FragColor = vec4(outVel, visMode*0.5+0.5);\n\t} else {\n\t\tgl_FragColor = encodeFloatRGBA(outLife);\n\t}\n}\n",particleUpdaterAABBPS:"\nuniform mat3 spawnBounds;\nuniform vec3 spawnPosInnerRatio;\nvec3 calcSpawnPosition(vec3 inBounds, float rndFactor) {\n\tvec3 pos = inBounds - vec3(0.5);\n\tvec3 posAbs = abs(pos);\n\tvec3 maxPos = vec3(max(posAbs.x, max(posAbs.y, posAbs.z)));\n\tvec3 edge = maxPos + (vec3(0.5) - maxPos) * spawnPosInnerRatio;\n\tpos.x = edge.x * (maxPos.x == posAbs.x ? sign(pos.x) : 2.0 * pos.x);\n\tpos.y = edge.y * (maxPos.y == posAbs.y ? sign(pos.y) : 2.0 * pos.y);\n\tpos.z = edge.z * (maxPos.z == posAbs.z ? sign(pos.z) : 2.0 * pos.z);\n#ifndef LOCAL_SPACE\n\treturn emitterPos + spawnBounds * pos;\n#else\n\treturn spawnBounds * pos;\n#endif\n}\nvoid addInitialVelocity(inout vec3 localVelocity, vec3 inBounds) {\n\tlocalVelocity -= vec3(0, 0, initialVelocity);\n}\n",particleUpdaterEndPS:"\n\twriteOutput();\n}\n",particleUpdaterInitPS:"\nvarying vec2 vUv0;\nuniform highp sampler2D particleTexIN;\nuniform highp sampler2D internalTex0;\nuniform highp sampler2D internalTex1;\nuniform highp sampler2D internalTex2;\nuniform highp sampler2D internalTex3;\nuniform mat3 emitterMatrix;\nuniform mat3 emitterMatrixInv;\nuniform vec3 emitterScale;\nuniform vec3 emitterPos;\nuniform vec3 frameRandom;\nuniform vec3 localVelocityDivMult;\nuniform vec3 velocityDivMult;\nuniform float delta;\nuniform float rate;\nuniform float rateDiv;\nuniform float lifetime;\nuniform float numParticles;\nuniform float rotSpeedDivMult;\nuniform float radialSpeedDivMult;\nuniform float seed;\nuniform float startAngle;\nuniform float startAngle2;\nuniform float initialVelocity;\nuniform float graphSampleSize;\nuniform float graphNumSamples;\nvec3 inPos;\nvec3 inVel;\nfloat inAngle;\nbool inShow;\nfloat inLife;\nfloat visMode;\nvec3 outPos;\nvec3 outVel;\nfloat outAngle;\nbool outShow;\nfloat outLife;\n",particleUpdaterNoRespawnPS:"\n\tif (outLife >= lifetime) {\n\t\toutLife -= max(lifetime, (numParticles - 1.0) * particleRate);\n\t\tvisMode = -1.0;\n\t}\n",particleUpdaterOnStopPS:"\n\tvisMode = outLife < 0.0? -1.0: visMode;\n",particleUpdaterRespawnPS:"\n\tif (outLife >= lifetime) {\n\t\toutLife -= max(lifetime, (numParticles - 1.0) * particleRate);\n\t\tvisMode = 1.0;\n\t}\n\tvisMode = outLife < 0.0? 1.0: visMode;\n",particleUpdaterSpherePS:"\nuniform float spawnBoundsSphere;\nuniform float spawnBoundsSphereInnerRatio;\nvec3 calcSpawnPosition(vec3 inBounds, float rndFactor) {\n\tfloat rnd4 = fract(rndFactor * 1000.0);\n\tvec3 norm = normalize(inBounds.xyz - vec3(0.5));\n\tfloat r = rnd4 * (1.0 - spawnBoundsSphereInnerRatio) + spawnBoundsSphereInnerRatio;\n#ifndef LOCAL_SPACE\n\treturn emitterPos + norm * r * spawnBoundsSphere;\n#else\n\treturn norm * r * spawnBoundsSphere;\n#endif\n}\nvoid addInitialVelocity(inout vec3 localVelocity, vec3 inBounds) {\n\tlocalVelocity += normalize(inBounds - vec3(0.5)) * initialVelocity;\n}\n",particleUpdaterStartPS:"\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvec3 unpack3NFloats(float src) {\n\tfloat r = fract(src);\n\tfloat g = fract(src * 256.0);\n\tfloat b = fract(src * 65536.0);\n\treturn vec3(r, g, b);\n}\nvec3 tex1Dlod_lerp(TEXTURE_ACCEPT_HIGHP(tex), vec2 tc, out vec3 w) {\n\tvec4 a = texture2D(tex, tc);\n\tvec4 b = texture2D(tex, tc + graphSampleSize);\n\tfloat c = fract(tc.x * graphNumSamples);\n\tvec3 unpackedA = unpack3NFloats(a.w);\n\tvec3 unpackedB = unpack3NFloats(b.w);\n\tw = mix(unpackedA, unpackedB, c);\n\treturn mix(a.xyz, b.xyz, c);\n}\n#define HASHSCALE4 vec4(1031, .1030, .0973, .1099)\nvec4 hash41(float p) {\n\tvec4 p4 = fract(vec4(p) * HASHSCALE4);\n\tp4 += dot(p4, p4.wzxy+19.19);\n\treturn fract(vec4((p4.x + p4.y)*p4.z, (p4.x + p4.z)*p4.y, (p4.y + p4.z)*p4.w, (p4.z + p4.w)*p4.x));\n}\nvoid main(void) {\n\tif (gl_FragCoord.x > numParticles) discard;\n\treadInput(vUv0.x);\n\tvisMode = inShow? 1.0 : -1.0;\n\tvec4 rndFactor = hash41(gl_FragCoord.x + seed);\n\tfloat particleRate = rate + rateDiv * rndFactor.x;\n\toutLife = inLife + delta;\n\tfloat nlife = clamp(outLife / lifetime, 0.0, 1.0);\n\tvec3 localVelocityDiv;\n\tvec3 velocityDiv;\n\tvec3 paramDiv;\n\tvec3 localVelocity = tex1Dlod_lerp(TEXTURE_PASS(internalTex0), vec2(nlife, 0), localVelocityDiv);\n\tvec3 velocity =\t tex1Dlod_lerp(TEXTURE_PASS(internalTex1), vec2(nlife, 0), velocityDiv);\n\tvec3 params =\t\ttex1Dlod_lerp(TEXTURE_PASS(internalTex2), vec2(nlife, 0), paramDiv);\n\tfloat rotSpeed = params.x;\n\tfloat rotSpeedDiv = paramDiv.y;\n\tvec3 radialParams = tex1Dlod_lerp(TEXTURE_PASS(internalTex3), vec2(nlife, 0), paramDiv);\n\tfloat radialSpeed = radialParams.x;\n\tfloat radialSpeedDiv = radialParams.y;\n\tbool respawn = inLife <= 0.0 || outLife >= lifetime;\n\tinPos = respawn ? calcSpawnPosition(rndFactor.xyz, rndFactor.x) : inPos;\n\tinAngle = respawn ? mix(startAngle, startAngle2, rndFactor.x) : inAngle;\n#ifndef LOCAL_SPACE\n\tvec3 radialVel = inPos - emitterPos;\n#else\n\tvec3 radialVel = inPos;\n#endif\n\tradialVel = (dot(radialVel, radialVel) > 1.0E-8) ? radialSpeed * normalize(radialVel) : vec3(0.0);\n\tradialVel += (radialSpeedDiv * vec3(2.0) - vec3(1.0)) * radialSpeedDivMult * rndFactor.xyz;\n\tlocalVelocity +=\t(localVelocityDiv * vec3(2.0) - vec3(1.0)) * localVelocityDivMult * rndFactor.xyz;\n\tvelocity +=\t\t (velocityDiv * vec3(2.0) - vec3(1.0)) * velocityDivMult * rndFactor.xyz;\n\trotSpeed +=\t\t (rotSpeedDiv * 2.0 - 1.0) * rotSpeedDivMult * rndFactor.y;\n\taddInitialVelocity(localVelocity, rndFactor.xyz);\n#ifndef LOCAL_SPACE\n\toutVel = emitterMatrix * localVelocity + (radialVel + velocity) * emitterScale;\n#else\n\toutVel = (localVelocity + radialVel) / emitterScale + emitterMatrixInv * velocity;\n#endif\n\toutPos = inPos + outVel * delta;\n\toutAngle = inAngle + rotSpeed * delta;\n",particle_billboardVS:"\n\tquadXY = rotate(quadXY, inAngle, rotMatrix);\n\tvec3 localPos = billboard(particlePos, quadXY);\n",particle_blendAddPS:"\n\tdBlendModeFogFactor = 0.0;\n\trgb *= saturate(gammaCorrectInput(max(a, 0.0)));\n\tif ((rgb.r + rgb.g + rgb.b) < 0.000001) discard;\n",particle_blendMultiplyPS:"\n\trgb = mix(vec3(1.0), rgb, vec3(a));\n\tif (rgb.r + rgb.g + rgb.b > 2.99) discard;\n",particle_blendNormalPS:"\n\tif (a < 0.01) discard;\n",particle_cpuVS:"\nattribute vec4 particle_vertexData;\nattribute vec4 particle_vertexData2;\nattribute vec4 particle_vertexData3;\nattribute float particle_vertexData4;\n#ifndef USE_MESH\nattribute vec2 particle_vertexData5;\n#else\nattribute vec4 particle_vertexData5;\n#endif\nuniform mat4 matrix_viewProjection;\nuniform mat4 matrix_model;\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform mat3 matrix_normal;\nuniform mat4 matrix_viewInverse;\nuniform float numParticles;\nuniform float lifetime;\nuniform float stretch;\nuniform float seed;\nuniform vec3 wrapBounds;\nuniform vec3 emitterScale;\nuniform vec3 faceTangent;\nuniform vec3 faceBinorm;\n#ifdef PARTICLE_GPU\n\tuniform highp sampler2D internalTex0;\n\tuniform highp sampler2D internalTex1;\n\tuniform highp sampler2D internalTex2;\n#endif\nuniform vec3 emitterPos;\nvarying vec4 texCoordsAlphaLife;\nvec2 rotate(vec2 quadXY, float pRotation, out mat2 rotMatrix)\n{\n\tfloat c = cos(pRotation);\n\tfloat s = sin(pRotation);\n\tmat2 m = mat2(c, -s, s, c);\n\trotMatrix = m;\n\treturn m * quadXY;\n}\nvec3 billboard(vec3 InstanceCoords, vec2 quadXY)\n{\n\tvec3 pos = -matrix_viewInverse[0].xyz * quadXY.x + -matrix_viewInverse[1].xyz * quadXY.y;\n\treturn pos;\n}\nvec3 customFace(vec3 InstanceCoords, vec2 quadXY)\n{\n\tvec3 pos = faceTangent * quadXY.x + faceBinorm * quadXY.y;\n\treturn pos;\n}\nvoid main(void)\n{\n\tvec3 particlePos = particle_vertexData.xyz;\n\tvec3 inPos = particlePos;\n\tvec3 vertPos = particle_vertexData3.xyz;\n\tvec3 inVel = vec3(particle_vertexData2.w, particle_vertexData3.w, particle_vertexData5.x);\n\tfloat id = floor(particle_vertexData4);\n\tfloat rndFactor = fract(sin(id + 1.0 + seed));\n\tvec3 rndFactor3 = vec3(rndFactor, fract(rndFactor*10.0), fract(rndFactor*100.0));\n#ifdef LOCAL_SPACE\n\tinVel = mat3(matrix_model) * inVel;\n#endif\n\tvec2 velocityV = normalize((mat3(matrix_view) * inVel).xy);\n\tvec2 quadXY = vertPos.xy;\n#ifdef USE_MESH\n\ttexCoordsAlphaLife = vec4(particle_vertexData5.zw, particle_vertexData2.z, particle_vertexData.w);\n#else\n\ttexCoordsAlphaLife = vec4(quadXY * -0.5 + 0.5, particle_vertexData2.z, particle_vertexData.w);\n#endif\n\tmat2 rotMatrix;\n\tfloat inAngle = particle_vertexData2.x;\n\tvec3 particlePosMoved = vec3(0.0);\n\tvec3 meshLocalPos = particle_vertexData3.xyz;\n",particle_cpu_endVS:"\n\tlocalPos *= particle_vertexData2.y * emitterScale;\n\tlocalPos += particlePos;\n\tgl_Position = matrix_viewProjection * vec4(localPos, 1.0);\n",particle_customFaceVS:"\n\tquadXY = rotate(quadXY, inAngle, rotMatrix);\n\tvec3 localPos = customFace(particlePos, quadXY);\n",particle_endPS:"\n\trgb = addFog(rgb);\n\trgb = toneMap(rgb);\n\trgb = gammaCorrectOutput(rgb);\n\tgl_FragColor = vec4(rgb, a);\n}\n",particle_endVS:"\n\tlocalPos *= scale * emitterScale;\n\tlocalPos += particlePos;\n\t#ifdef SCREEN_SPACE\n\tgl_Position = vec4(localPos.x, localPos.y, 0.0, 1.0);\n\t#else\n\tgl_Position = matrix_viewProjection * vec4(localPos.xyz, 1.0);\n\t#endif\n",particle_halflambertPS:"\n\tvec3 negNormal = normal*0.5+0.5;\n\tvec3 posNormal = -normal*0.5+0.5;\n\tnegNormal *= negNormal;\n\tposNormal *= posNormal;\n",particle_initVS:"\nattribute vec4 particle_vertexData;\n#ifdef USE_MESH\nattribute vec2 particle_uv;\n#endif\nuniform mat4 matrix_viewProjection;\nuniform mat4 matrix_model;\nuniform mat3 matrix_normal;\nuniform mat4 matrix_viewInverse;\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform float numParticles;\nuniform float numParticlesPot;\nuniform float graphSampleSize;\nuniform float graphNumSamples;\nuniform float stretch;\nuniform vec3 wrapBounds;\nuniform vec3 emitterScale;\nuniform vec3 emitterPos;\nuniform vec3 faceTangent;\nuniform vec3 faceBinorm;\nuniform float rate;\nuniform float rateDiv;\nuniform float lifetime;\nuniform float deltaRandomnessStatic;\nuniform float scaleDivMult;\nuniform float alphaDivMult;\nuniform float seed;\nuniform float delta;\nuniform sampler2D particleTexOUT;\nuniform sampler2D particleTexIN;\n#ifdef PARTICLE_GPU\n\tuniform highp sampler2D internalTex0;\n\tuniform highp sampler2D internalTex1;\n\tuniform highp sampler2D internalTex2;\n#endif\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\nvarying vec4 texCoordsAlphaLife;\nvec3 inPos;\nvec3 inVel;\nfloat inAngle;\nbool inShow;\nfloat inLife;\n",particle_lambertPS:"\n\tvec3 negNormal = max(normal, vec3(0.0));\n\tvec3 posNormal = max(-normal, vec3(0.0));\n",particle_lightingPS:"\n\tvec3 light = negNormal.x*lightCube[0] + posNormal.x*lightCube[1] +\n\t\t\t\t\t\tnegNormal.y*lightCube[2] + posNormal.y*lightCube[3] +\n\t\t\t\t\t\tnegNormal.z*lightCube[4] + posNormal.z*lightCube[5];\n\trgb *= light;\n",particle_localShiftVS:"\n\tparticlePos = (matrix_model * vec4(particlePos, 1.0)).xyz;\n",particle_meshVS:"\n\tvec3 localPos = meshLocalPos;\n\tlocalPos.xy = rotate(localPos.xy, inAngle, rotMatrix);\n\tlocalPos.yz = rotate(localPos.yz, inAngle, rotMatrix);\n\tbillboard(particlePos, quadXY);\n",particle_normalVS:"\n\tNormal = normalize(localPos + matrix_viewInverse[2].xyz);\n",particle_normalMapPS:"\n\tvec3 normalMap = normalize(texture2D(normalMap, vec2(texCoordsAlphaLife.x, 1.0 - texCoordsAlphaLife.y)).xyz * 2.0 - 1.0);\n\tvec3 normal = ParticleMat * normalMap;\n",particle_pointAlongVS:"\n\tinAngle = atan(velocityV.x, velocityV.y);\n",particle_softPS:"\n\tfloat depth = getLinearScreenDepth();\n\tfloat particleDepth = vDepth;\n\tfloat depthDiff = saturate(abs(particleDepth - depth) * softening);\n\ta *= depthDiff;\n",particle_softVS:"\n\tvDepth = getLinearDepth(localPos);\n",particle_stretchVS:"\n\tvec3 moveDir = inVel * stretch;\n\tvec3 posPrev = particlePos - moveDir;\n\tposPrev += particlePosMoved;\n\tvec2 centerToVertexV = normalize((mat3(matrix_view) * localPos).xy);\n\tfloat interpolation = dot(-velocityV, centerToVertexV) * 0.5 + 0.5;\n\tparticlePos = mix(particlePos, posPrev, interpolation);\n",particle_TBNVS:"\n\tmat3 rot3 = mat3(rotMatrix[0][0], rotMatrix[0][1], 0.0, rotMatrix[1][0], rotMatrix[1][1], 0.0, 0.0, 0.0, 1.0);\n\tParticleMat = mat3(-matrix_viewInverse[0].xyz, -matrix_viewInverse[1].xyz, matrix_viewInverse[2].xyz) * rot3;\n",particle_wrapVS:"\n\tvec3 origParticlePos = particlePos;\n\tparticlePos -= matrix_model[3].xyz;\n\tparticlePos = mod(particlePos, wrapBounds) - wrapBounds * 0.5;\n\tparticlePos += matrix_model[3].xyz;\n\tparticlePosMoved = particlePos - origParticlePos;\n",reflDirPS:"\nvoid getReflDir(vec3 worldNormal, vec3 viewDir, float gloss, mat3 tbn) {\n\tdReflDirW = normalize(-reflect(viewDir, worldNormal));\n}\n",reflDirAnisoPS:"\nvoid getReflDir(vec3 worldNormal, vec3 viewDir, float gloss, mat3 tbn) {\n\tfloat roughness = sqrt(1.0 - min(gloss, 1.0));\n\tfloat anisotropy = material_anisotropy * roughness;\n\tvec3 anisotropicDirection = anisotropy >= 0.0 ? tbn[1] : tbn[0];\n\tvec3 anisotropicTangent = cross(anisotropicDirection, viewDir);\n\tvec3 anisotropicNormal = cross(anisotropicTangent, anisotropicDirection);\n\tvec3 bentNormal = normalize(mix(normalize(worldNormal), normalize(anisotropicNormal), anisotropy));\n\tdReflDirW = reflect(-viewDir, bentNormal);\n}\n",reflectionCCPS:"\n#ifdef LIT_CLEARCOAT\nvoid addReflectionCC(vec3 reflDir, float gloss) {\n\tccReflection += calcReflection(reflDir, gloss);\n}\n#endif\n",reflectionCubePS:"\nuniform samplerCube texture_cubeMap;\nuniform float material_reflectivity;\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 lookupVec = fixSeams(cubeMapProject(reflDir));\n\tlookupVec.x *= -1.0;\n\treturn $DECODE(textureCube(texture_cubeMap, lookupVec));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionEnvHQPS:"\n#ifndef ENV_ATLAS\n#define ENV_ATLAS\nuniform sampler2D texture_envAtlas;\n#endif\nuniform samplerCube texture_cubeMap;\nuniform float material_reflectivity;\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 dir = cubeMapProject(reflDir) * vec3(-1.0, 1.0, 1.0);\n\tvec2 uv = toSphericalUv(dir);\n\tfloat level = saturate(1.0 - gloss) * 5.0;\n\tfloat ilevel = floor(level);\n\tfloat flevel = level - ilevel;\n\tvec3 sharp = $DECODE_CUBEMAP(textureCube(texture_cubeMap, fixSeams(dir)));\n\tvec3 roughA = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel)));\n\tvec3 roughB = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel + 1.0)));\n\treturn processEnvironment(mix(sharp, mix(roughA, roughB, flevel), min(level, 1.0)));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionEnvPS:"\n#ifndef ENV_ATLAS\n#define ENV_ATLAS\nuniform sampler2D texture_envAtlas;\n#endif\nuniform float material_reflectivity;\nfloat shinyMipLevel(vec2 uv) {\n\tvec2 dx = dFdx(uv);\n\tvec2 dy = dFdy(uv);\n\tvec2 uv2 = vec2(fract(uv.x + 0.5), uv.y);\n\tvec2 dx2 = dFdx(uv2);\n\tvec2 dy2 = dFdy(uv2);\n\tfloat maxd = min(max(dot(dx, dx), dot(dy, dy)), max(dot(dx2, dx2), dot(dy2, dy2)));\n\treturn clamp(0.5 * log2(maxd) - 1.0 + textureBias, 0.0, 5.0);\n}\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 dir = cubeMapProject(reflDir) * vec3(-1.0, 1.0, 1.0);\n\tvec2 uv = toSphericalUv(dir);\n\tfloat level = saturate(1.0 - gloss) * 5.0;\n\tfloat ilevel = floor(level);\n\tfloat level2 = shinyMipLevel(uv * atlasSize);\n\tfloat ilevel2 = floor(level2);\n\tvec2 uv0, uv1;\n\tfloat weight;\n\tif (ilevel == 0.0) {\n\t\tuv0 = mapShinyUv(uv, ilevel2);\n\t\tuv1 = mapShinyUv(uv, ilevel2 + 1.0);\n\t\tweight = level2 - ilevel2;\n\t} else {\n\t\tuv0 = uv1 = mapRoughnessUv(uv, ilevel);\n\t\tweight = 0.0;\n\t}\n\tvec3 linearA = $DECODE(texture2D(texture_envAtlas, uv0));\n\tvec3 linearB = $DECODE(texture2D(texture_envAtlas, uv1));\n\tvec3 linear0 = mix(linearA, linearB, weight);\n\tvec3 linear1 = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel + 1.0)));\n\treturn processEnvironment(mix(linear0, linear1, level - ilevel));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionSpherePS:"\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform sampler2D texture_sphereMap;\nuniform float material_reflectivity;\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 reflDirV = (mat3(matrix_view) * reflDir).xyz;\n\tfloat m = 2.0 * sqrt( dot(reflDirV.xy, reflDirV.xy) + (reflDirV.z+1.0)*(reflDirV.z+1.0) );\n\tvec2 sphereMapUv = reflDirV.xy / m + 0.5;\n\treturn $DECODE(texture2D(texture_sphereMap, sphereMapUv));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionSheenPS:"\nvoid addReflectionSheen(vec3 worldNormal, vec3 viewDir, float gloss) {\n\tfloat NoV = dot(worldNormal, viewDir);\n\tfloat alphaG = gloss * gloss;\n\tfloat a = gloss < 0.25 ? -339.2 * alphaG + 161.4 * gloss - 25.9 : -8.48 * alphaG + 14.3 * gloss - 9.95;\n\tfloat b = gloss < 0.25 ? 44.0 * alphaG - 23.7 * gloss + 3.26 : 1.97 * alphaG - 3.27 * gloss + 0.72;\n\tfloat DG = exp( a * NoV + b ) + ( gloss < 0.25 ? 0.0 : 0.1 * ( gloss - 0.25 ) );\n\tsReflection += calcReflection(worldNormal, 0.0) * saturate(DG);\n}\n",refractionCubePS:"\nvec3 refract2(vec3 viewVec, vec3 normal, float IOR) {\n\tfloat vn = dot(viewVec, normal);\n\tfloat k = 1.0 - IOR * IOR * (1.0 - vn * vn);\n\tvec3 refrVec = IOR * viewVec - (IOR * vn + sqrt(k)) * normal;\n\treturn refrVec;\n}\nvoid addRefraction(\n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tfloat thickness, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 albedo, \n\tfloat transmission,\n\tfloat refractionIndex,\n\tfloat dispersion\n#if defined(LIT_IRIDESCENCE)\n\t, vec3 iridescenceFresnel,\n\tfloat iridescenceIntensity\n#endif \n) {\n\tvec4 tmpRefl = dReflection;\n\tvec3 reflectionDir = refract2(-viewDir, worldNormal, refractionIndex);\n\tdReflection = vec4(0);\n\taddReflection(reflectionDir, gloss);\n\tdDiffuseLight = mix(dDiffuseLight, dReflection.rgb * albedo, transmission);\n\tdReflection = tmpRefl;\n}\n",refractionDynamicPS:"\nuniform float material_invAttenuationDistance;\nuniform vec3 material_attenuation;\nvec3 evalRefractionColor(vec3 refractionVector, float gloss, float refractionIndex) {\n\tvec4 pointOfRefraction = vec4(vPositionW + refractionVector, 1.0);\n\tvec4 projectionPoint = matrix_viewProjection * pointOfRefraction;\n\tvec2 uv = getGrabScreenPos(projectionPoint);\n\t#ifdef SUPPORTS_TEXLOD\n\t\tfloat iorToRoughness = (1.0 - gloss) * clamp((1.0 / refractionIndex) * 2.0 - 2.0, 0.0, 1.0);\n\t\tfloat refractionLod = log2(uScreenSize.x) * iorToRoughness;\n\t\tvec3 refraction = texture2DLodEXT(uSceneColorMap, uv, refractionLod).rgb;\n\t#else\n\t\tvec3 refraction = texture2D(uSceneColorMap, uv).rgb;\n\t#endif\n\treturn refraction;\n}\nvoid addRefraction(\n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tfloat thickness, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 albedo, \n\tfloat transmission,\n\tfloat refractionIndex,\n\tfloat dispersion\n#if defined(LIT_IRIDESCENCE)\n\t, vec3 iridescenceFresnel,\n\tfloat iridescenceIntensity\n#endif\n) {\n\tvec3 modelScale;\n\tmodelScale.x = length(vec3(matrix_model[0].xyz));\n\tmodelScale.y = length(vec3(matrix_model[1].xyz));\n\tmodelScale.z = length(vec3(matrix_model[2].xyz));\n\tvec3 scale = thickness * modelScale;\n\tvec3 refractionVector = normalize(refract(-viewDir, worldNormal, refractionIndex)) * scale;\n\tvec3 refraction = evalRefractionColor(refractionVector, gloss, refractionIndex);\n\t#ifdef DISPERSION\n\t\tfloat halfSpread = (1.0 / refractionIndex - 1.0) * 0.025 * dispersion;\n\t\tfloat refractionIndexR = refractionIndex - halfSpread;\n\t\trefractionVector = normalize(refract(-viewDir, worldNormal, refractionIndexR)) * scale;\n\t\trefraction.r = evalRefractionColor(refractionVector, gloss, refractionIndexR).r;\n\t\tfloat refractionIndexB = refractionIndex + halfSpread;\n\t\trefractionVector = normalize(refract(-viewDir, worldNormal, refractionIndexB)) * scale;\n\t\trefraction.b = evalRefractionColor(refractionVector, gloss, refractionIndexB).b;\n\t#endif\n\tvec3 transmittance;\n\tif (material_invAttenuationDistance != 0.0)\n\t{\n\t\tvec3 attenuation = -log(material_attenuation) * material_invAttenuationDistance;\n\t\ttransmittance = exp(-attenuation * length(refractionVector));\n\t}\n\telse\n\t{\n\t\ttransmittance = refraction;\n\t}\n\tvec3 fresnel = vec3(1.0) - \n\t\tgetFresnel(\n\t\t\tdot(viewDir, worldNormal), \n\t\t\tgloss, \n\t\t\tspecularity\n\t\t#if defined(LIT_IRIDESCENCE)\n\t\t\t, iridescenceFresnel,\n\t\t\tiridescenceIntensity\n\t\t#endif\n\t\t);\n\tdDiffuseLight = mix(dDiffuseLight, refraction * transmittance * fresnel, transmission);\n}\n",reprojectPS:"\nvarying vec2 vUv0;\n#ifdef CUBEMAP_SOURCE\n\tuniform samplerCube sourceCube;\n#else\n\tuniform sampler2D sourceTex;\n#endif\n#ifdef USE_SAMPLES_TEX\n\tuniform sampler2D samplesTex;\n\tuniform vec2 samplesTexInverseSize;\n#endif\nuniform vec3 params;\nfloat targetFace() { return params.x; }\nfloat sourceCubeSeamScale() { return params.y; }\nfloat targetCubeSeamScale() { return params.z; }\nfloat PI = 3.141592653589793;\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\n"+Lo+"\n"+ko+"\nvec3 modifySeams(vec3 dir, float scale) {\n\tvec3 adir = abs(dir);\n\tfloat M = max(max(adir.x, adir.y), adir.z);\n\treturn dir / M * vec3(\n\t\tadir.x == M ? 1.0 : scale,\n\t\tadir.y == M ? 1.0 : scale,\n\t\tadir.z == M ? 1.0 : scale\n\t);\n}\nvec2 toSpherical(vec3 dir) {\n\treturn vec2(dir.xz == vec2(0.0) ? 0.0 : atan(dir.x, dir.z), asin(dir.y));\n}\nvec3 fromSpherical(vec2 uv) {\n\treturn vec3(cos(uv.y) * sin(uv.x),\n\t\t\t\tsin(uv.y),\n\t\t\t\tcos(uv.y) * cos(uv.x));\n}\nvec3 getDirectionEquirect() {\n\treturn fromSpherical((vec2(vUv0.x, 1.0 - vUv0.y) * 2.0 - 1.0) * vec2(PI, PI * 0.5));\n}\nfloat signNotZero(float k){\n\treturn(k >= 0.0) ? 1.0 : -1.0;\n}\nvec2 signNotZero(vec2 v) {\n\treturn vec2(signNotZero(v.x), signNotZero(v.y));\n}\nvec3 octDecode(vec2 o) {\n\tvec3 v = vec3(o.x, 1.0 - abs(o.x) - abs(o.y), o.y);\n\tif (v.y < 0.0) {\n\t\tv.xz = (1.0 - abs(v.zx)) * signNotZero(v.xz);\n\t}\n\treturn normalize(v);\n}\nvec3 getDirectionOctahedral() {\n\treturn octDecode(vec2(vUv0.x, 1.0 - vUv0.y) * 2.0 - 1.0);\n}\nvec2 octEncode(in vec3 v) {\n\tfloat l1norm = abs(v.x) + abs(v.y) + abs(v.z);\n\tvec2 result = v.xz * (1.0 / l1norm);\n\tif (v.y < 0.0) {\n\t\tresult = (1.0 - abs(result.yx)) * signNotZero(result.xy);\n\t}\n\treturn result;\n}\n#ifdef CUBEMAP_SOURCE\n\tvec4 sampleCubemap(vec3 dir) {\n\t\treturn textureCube(sourceCube, modifySeams(dir, 1.0 - sourceCubeSeamScale()));\n\t}\n\tvec4 sampleCubemap(vec2 sph) {\n\treturn sampleCubemap(fromSpherical(sph));\n}\n\tvec4 sampleCubemap(vec3 dir, float mipLevel) {\n\t\treturn textureCubeLodEXT(sourceCube, modifySeams(dir, 1.0 - exp2(mipLevel) * sourceCubeSeamScale()), mipLevel);\n\t}\n\tvec4 sampleCubemap(vec2 sph, float mipLevel) {\n\t\treturn sampleCubemap(fromSpherical(sph), mipLevel);\n\t}\n#else\n\tvec4 sampleEquirect(vec2 sph) {\n\t\tvec2 uv = sph / vec2(PI * 2.0, PI) + 0.5;\n\t\treturn texture2D(sourceTex, vec2(uv.x, 1.0 - uv.y));\n\t}\n\tvec4 sampleEquirect(vec3 dir) {\n\t\treturn sampleEquirect(toSpherical(dir));\n\t}\n\tvec4 sampleEquirect(vec2 sph, float mipLevel) {\n\t\tvec2 uv = sph / vec2(PI * 2.0, PI) + 0.5;\n\t\treturn texture2DLodEXT(sourceTex, vec2(uv.x, 1.0 - uv.y), mipLevel);\n\t}\n\tvec4 sampleEquirect(vec3 dir, float mipLevel) {\n\t\treturn sampleEquirect(toSpherical(dir), mipLevel);\n\t}\n\tvec4 sampleOctahedral(vec3 dir) {\n\t\tvec2 uv = octEncode(dir) * 0.5 + 0.5;\n\t\treturn texture2D(sourceTex, vec2(uv.x, 1.0 - uv.y));\n\t}\n\tvec4 sampleOctahedral(vec2 sph) {\n\t\treturn sampleOctahedral(fromSpherical(sph));\n\t}\n\tvec4 sampleOctahedral(vec3 dir, float mipLevel) {\n\t\tvec2 uv = octEncode(dir) * 0.5 + 0.5;\n\t\treturn texture2DLodEXT(sourceTex, vec2(uv.x, 1.0 - uv.y), mipLevel);\n\t}\n\tvec4 sampleOctahedral(vec2 sph, float mipLevel) {\n\t\treturn sampleOctahedral(fromSpherical(sph), mipLevel);\n\t}\n#endif\nvec3 getDirectionCubemap() {\n\tvec2 st = vUv0 * 2.0 - 1.0;\n\tfloat face = targetFace();\n\tvec3 vec;\n\tif (face == 0.0) {\n\t\tvec = vec3(1, -st.y, -st.x);\n\t} else if (face == 1.0) {\n\t\tvec = vec3(-1, -st.y, st.x);\n\t} else if (face == 2.0) {\n\t\tvec = vec3(st.x, 1, st.y);\n\t} else if (face == 3.0) {\n\t\tvec = vec3(st.x, -1, -st.y);\n\t} else if (face == 4.0) {\n\t\tvec = vec3(st.x, -st.y, 1);\n\t} else {\n\t\tvec = vec3(-st.x, -st.y, -1);\n\t}\n\treturn normalize(modifySeams(vec, 1.0 / (1.0 - targetCubeSeamScale())));\n}\nmat3 matrixFromVector(vec3 n) {\n\tfloat a = 1.0 / (1.0 + n.z);\n\tfloat b = -n.x * n.y * a;\n\tvec3 b1 = vec3(1.0 - n.x * n.x * a, b, -n.x);\n\tvec3 b2 = vec3(b, 1.0 - n.y * n.y * a, -n.y);\n\treturn mat3(b1, b2, n);\n}\nmat3 matrixFromVectorSlow(vec3 n) {\n\tvec3 up = (1.0 - abs(n.y) <= 0.0000001) ? vec3(0.0, 0.0, n.y > 0.0 ? 1.0 : -1.0) : vec3(0.0, 1.0, 0.0);\n\tvec3 x = normalize(cross(up, n));\n\tvec3 y = cross(n, x);\n\treturn mat3(x, y, n);\n}\nvec4 reproject() {\n\tif (NUM_SAMPLES <= 1) {\n\t\treturn ENCODE_FUNC(DECODE_FUNC(SOURCE_FUNC(TARGET_FUNC())));\n\t} else {\n\t\tvec3 t = TARGET_FUNC();\n\t\tvec3 tu = dFdx(t);\n\t\tvec3 tv = dFdy(t);\n\t\tvec3 result = vec3(0.0);\n\t\tfor (float u = 0.0; u < NUM_SAMPLES_SQRT; ++u) {\n\t\t\tfor (float v = 0.0; v < NUM_SAMPLES_SQRT; ++v) {\n\t\t\t\tresult += DECODE_FUNC(SOURCE_FUNC(normalize(t +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttu * (u / NUM_SAMPLES_SQRT - 0.5) +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttv * (v / NUM_SAMPLES_SQRT - 0.5))));\n\t\t\t}\n\t\t}\n\t\treturn ENCODE_FUNC(result / (NUM_SAMPLES_SQRT * NUM_SAMPLES_SQRT));\n\t}\n}\nvec4 unpackFloat = vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0);\n#ifdef USE_SAMPLES_TEX\n\tvoid unpackSample(int i, out vec3 L, out float mipLevel) {\n\t\tfloat u = (float(i * 4) + 0.5) * samplesTexInverseSize.x;\n\t\tfloat v = (floor(u) + 0.5) * samplesTexInverseSize.y;\n\t\tvec4 raw;\n\t\traw.x = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat); u += samplesTexInverseSize.x;\n\t\traw.y = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat); u += samplesTexInverseSize.x;\n\t\traw.z = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat); u += samplesTexInverseSize.x;\n\t\traw.w = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat);\n\t\tL.xyz = raw.xyz * 2.0 - 1.0;\n\t\tmipLevel = raw.w * 8.0;\n\t}\n\tvec4 prefilterSamples() {\n\t\tmat3 vecSpace = matrixFromVectorSlow(TARGET_FUNC());\n\t\tvec3 L;\n\t\tfloat mipLevel;\n\t\tvec3 result = vec3(0.0);\n\t\tfloat totalWeight = 0.0;\n\t\tfor (int i = 0; i < NUM_SAMPLES; ++i) {\n\t\t\tunpackSample(i, L, mipLevel);\n\t\t\tresult += DECODE_FUNC(SOURCE_FUNC(vecSpace * L, mipLevel)) * L.z;\n\t\t\ttotalWeight += L.z;\n\t\t}\n\t\treturn ENCODE_FUNC(result / totalWeight);\n\t}\n\tvec4 prefilterSamplesUnweighted() {\n\t\tmat3 vecSpace = matrixFromVectorSlow(TARGET_FUNC());\n\t\tvec3 L;\n\t\tfloat mipLevel;\n\t\tvec3 result = vec3(0.0);\n\t\tfloat totalWeight = 0.0;\n\t\tfor (int i = 0; i < NUM_SAMPLES; ++i) {\n\t\t\tunpackSample(i, L, mipLevel);\n\t\t\tresult += DECODE_FUNC(SOURCE_FUNC(vecSpace * L, mipLevel));\n\t\t}\n\t\treturn ENCODE_FUNC(result / float(NUM_SAMPLES));\n\t}\n#endif\nvoid main(void) {\n\tgl_FragColor = PROCESS_FUNC();\n}\n",sampleCatmullRomPS:"\nvec4 SampleTextureCatmullRom(TEXTURE_ACCEPT(tex), vec2 uv, vec2 texSize) {\n\tvec2 samplePos = uv * texSize;\n\tvec2 texPos1 = floor(samplePos - 0.5) + 0.5;\n\tvec2 f = samplePos - texPos1;\n\tvec2 w0 = f * (-0.5 + f * (1.0 - 0.5 * f));\n\tvec2 w1 = 1.0 + f * f * (-2.5 + 1.5 * f);\n\tvec2 w2 = f * (0.5 + f * (2.0 - 1.5 * f));\n\tvec2 w3 = f * f * (-0.5 + 0.5 * f);\n\tvec2 w12 = w1 + w2;\n\tvec2 offset12 = w2 / (w1 + w2);\n\tvec2 texPos0 = (texPos1 - 1.0) / texSize;\n\tvec2 texPos3 = (texPos1 + 2.0) / texSize;\n\tvec2 texPos12 = (texPos1 + offset12) / texSize;\n\tvec4 result = vec4(0.0);\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos0.y), 0.0) * w0.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos0.y), 0.0) * w12.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos0.y), 0.0) * w3.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos12.y), 0.0) * w0.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos12.y), 0.0) * w12.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos12.y), 0.0) * w3.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos3.y), 0.0) * w0.x * w3.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos3.y), 0.0) * w12.x * w3.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos3.y), 0.0) * w3.x * w3.y;\n\treturn result;\n}\n",screenDepthPS:"\nuniform highp sampler2D uSceneDepthMap;\n#ifndef SCREENSIZE\n#define SCREENSIZE\nuniform vec4 uScreenSize;\n#endif\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\n#ifndef LINEARIZE_DEPTH\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\n#define LINEARIZE_DEPTH\n#ifdef GL2\nfloat linearizeDepth(float z) {\n\tif (camera_params.w == 0.0)\n\t\treturn (camera_params.z * camera_params.y) / (camera_params.y + z * (camera_params.z - camera_params.y));\n\telse\n\t\treturn camera_params.z + z * (camera_params.y - camera_params.z);\n}\n#else\n#ifndef UNPACKFLOAT\n#define UNPACKFLOAT\nfloat unpackFloat(vec4 rgbaDepth) {\n\tconst vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n\treturn dot(rgbaDepth, bitShift);\n}\n#endif\n#endif\n#endif\nfloat getLinearScreenDepth(vec2 uv) {\n\t#ifdef GL2\n\t\treturn linearizeDepth(texture2D(uSceneDepthMap, uv).r);\n\t#else\n\t\treturn unpackFloat(texture2D(uSceneDepthMap, uv)) * camera_params.y;\n\t#endif\n}\n#ifndef VERTEXSHADER\nfloat getLinearScreenDepth() {\n\tvec2 uv = gl_FragCoord.xy * uScreenSize.zw;\n\treturn getLinearScreenDepth(uv);\n}\n#endif\nfloat getLinearDepth(vec3 pos) {\n\treturn -(matrix_view * vec4(pos, 1.0)).z;\n}\n",shadowCascadesPS:"\nconst float maxCascades = 4.0;\nmat4 cascadeShadowMat;\nvoid getShadowCascadeMatrix(mat4 shadowMatrixPalette[4], float shadowCascadeDistances[4], float shadowCascadeCount) {\n\tfloat depth = 1.0 / gl_FragCoord.w;\n\tfloat cascadeIndex = 0.0;\n\tfor (float i = 0.0; i < maxCascades; i++) {\n\t\tif (depth < shadowCascadeDistances[int(i)]) {\n\t\t\tcascadeIndex = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tcascadeIndex = min(cascadeIndex, shadowCascadeCount - 1.0);\n\t#ifdef GL2\n\t\tcascadeShadowMat = shadowMatrixPalette[int(cascadeIndex)];\n\t#else\n\t\tif (cascadeIndex == 0.0) {\n\t\t\tcascadeShadowMat = shadowMatrixPalette[0];\n\t\t}\n\t\telse if (cascadeIndex == 1.0) {\n\t\t\tcascadeShadowMat = shadowMatrixPalette[1];\n\t\t}\n\t\telse if (cascadeIndex == 2.0) {\n\t\t\tcascadeShadowMat = shadowMatrixPalette[2];\n\t\t}\n\t\telse {\n\t\t\tcascadeShadowMat = shadowMatrixPalette[3];\n\t\t}\n\t#endif\n}\nvoid fadeShadow(float shadowCascadeDistances[4]) {\t\t\t\t \n\tfloat depth = 1.0 / gl_FragCoord.w;\n\tif (depth > shadowCascadeDistances[int(maxCascades - 1.0)]) {\n\t\tdShadowCoord.z = -9999999.0;\n\t}\n}\n",shadowEVSMPS:"\nfloat VSM$(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {\n\tvec3 moments = texture2D(tex, texCoords).xyz;\n\treturn calculateEVSM(moments, Z, vsmBias, exponent);\n}\nfloat getShadowVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, shadowCoord.z, shadowParams.y, exponent);\n}\nfloat getShadowSpotVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, length(lightDir) * shadowParams.w + shadowParams.z, shadowParams.y, exponent);\n}\n",shadowEVSMnPS:"\nfloat VSM$(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {\n\tfloat pixelSize = 1.0 / resolution;\n\ttexCoords -= vec2(pixelSize);\n\tvec3 s00 = texture2D(tex, texCoords).xyz;\n\tvec3 s10 = texture2D(tex, texCoords + vec2(pixelSize, 0)).xyz;\n\tvec3 s01 = texture2D(tex, texCoords + vec2(0, pixelSize)).xyz;\n\tvec3 s11 = texture2D(tex, texCoords + vec2(pixelSize)).xyz;\n\tvec2 fr = fract(texCoords * resolution);\n\tvec3 h0 = mix(s00, s10, fr.x);\n\tvec3 h1 = mix(s01, s11, fr.x);\n\tvec3 moments = mix(h0, h1, fr.y);\n\treturn calculateEVSM(moments, Z, vsmBias, exponent);\n}\nfloat getShadowVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, shadowCoord.z, shadowParams.y, exponent);\n}\nfloat getShadowSpotVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, length(lightDir) * shadowParams.w + shadowParams.z, shadowParams.y, exponent);\n}\n",shadowPCSSPS:"\n#define PCSS_SAMPLE_COUNT 16\nuniform float pcssDiskSamples[PCSS_SAMPLE_COUNT];\nuniform float pcssSphereSamples[PCSS_SAMPLE_COUNT];\nvec2 vogelDisk(int sampleIndex, float count, float phi, float r) {\n\tconst float GoldenAngle = 2.4;\n\tfloat theta = float(sampleIndex) * GoldenAngle + phi;\n\tfloat sine = sin(theta);\n\tfloat cosine = cos(theta);\n\treturn vec2(r * cosine, r * sine);\n}\nvec3 vogelSphere(int sampleIndex, float count, float phi, float r) {\n\tconst float GoldenAngle = 2.4;\n\tfloat theta = float(sampleIndex) * GoldenAngle + phi;\n\tfloat weight = float(sampleIndex) / count;\n\treturn vec3(cos(theta) * r, weight, sin(theta) * r);\n}\nfloat noise(vec2 screenPos) {\n\tconst float PHI = 1.61803398874989484820459;\n\treturn fract(sin(dot(screenPos * PHI, screenPos)) * screenPos.x);\n}\n#ifndef UNPACKFLOAT\n#define UNPACKFLOAT\nfloat unpackFloat(vec4 rgbaDepth) {\n\tconst vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n\treturn dot(rgbaDepth, bitShift);\n}\n#endif\nfloat viewSpaceDepth(float depth, mat4 invProjection) {\n\tfloat z = depth * 2.0 - 1.0;\n\tvec4 clipSpace = vec4(0.0, 0.0, z, 1.0);\n\tvec4 viewSpace = invProjection * clipSpace;\n\treturn viewSpace.z;\n}\nfloat PCSSBlockerDistance(TEXTURE_ACCEPT(shadowMap), vec2 sampleCoords[PCSS_SAMPLE_COUNT], vec2 shadowCoords, vec2 searchSize, float z) {\n\tfloat blockers = 0.0;\n\tfloat averageBlocker = 0.0;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tvec2 offset = sampleCoords[i] * searchSize;\n\t\tvec2 sampleUV = shadowCoords + offset;\n\t#ifdef GL2\n\t\tfloat blocker = textureLod(shadowMap, sampleUV, 0.0).r;\n\t#else\n\t\tfloat blocker = unpackFloat(texture2D(shadowMap, sampleUV));\n\t#endif\t\t\n\t\tfloat isBlocking = step(blocker, z);\n\t\tblockers += isBlocking;\n\t\taverageBlocker += blocker * isBlocking;\n\t}\n\tif (blockers > 0.0)\n\t\treturn averageBlocker /= blockers;\n\treturn -1.0;\n}\nfloat PCSS(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoords, vec4 cameraParams, vec2 shadowSearchArea) {\n\tfloat receiverDepth = shadowCoords.z;\n#ifndef GL2\n\treceiverDepth *= 1.0 / (cameraParams.y - cameraParams.z);\n#endif\n\tvec2 samplePoints[PCSS_SAMPLE_COUNT];\n\tfloat noise = noise( gl_FragCoord.xy ) * 2.0 * PI;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tfloat pcssPresample = pcssDiskSamples[i];\n\t\tsamplePoints[i] = vogelDisk(i, float(PCSS_SAMPLE_COUNT), noise, pcssPresample);\n\t}\n\tfloat averageBlocker = PCSSBlockerDistance(TEXTURE_PASS(shadowMap), samplePoints, shadowCoords.xy, shadowSearchArea, receiverDepth);\n\tif (averageBlocker == -1.0) {\n\t\treturn 1.0;\n\t} else {\n\t\tvec2 filterRadius = ((receiverDepth - averageBlocker) / averageBlocker) * shadowSearchArea * cameraParams.x;\n\t\tfloat shadow = 0.0;\n\t\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i ++)\n\t\t{\n\t\t\tvec2 sampleUV = samplePoints[i] * filterRadius;\n\t\t\tsampleUV = shadowCoords.xy + sampleUV;\n\t\t#ifdef GL2\n\t\t\tfloat depth = textureLod(shadowMap, sampleUV, 0.0).r;\n\t\t#else\n\t\t\tfloat depth = unpackFloat(texture2D(shadowMap, sampleUV));\n\t\t#endif\n\t\t\tshadow += step(receiverDepth, depth);\n\t\t}\n\t\treturn shadow / float(PCSS_SAMPLE_COUNT);\n\t} \n}\nfloat PCSSCubeBlockerDistance(samplerCube shadowMap, vec3 lightDirNorm, vec3 samplePoints[PCSS_SAMPLE_COUNT], float z, float shadowSearchArea) {\n\tfloat blockers = 0.0;\n\tfloat averageBlocker = 0.0;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tvec3 sampleDir = lightDirNorm + samplePoints[i] * shadowSearchArea;\n\t\tsampleDir = normalize(sampleDir);\n\t#ifdef GL2\n\t\tfloat blocker = textureCubeLodEXT(shadowMap, sampleDir, 0.0).r;\n\t#else\n\t\tfloat blocker = unpackFloat(textureCube(shadowMap, sampleDir));\n\t#endif\n\t\tfloat isBlocking = step(blocker, z);\n\t\tblockers += isBlocking;\n\t\taverageBlocker += blocker * isBlocking;\n\t}\n\tif (blockers > 0.0)\n\t\treturn averageBlocker /= float(blockers);\n\treturn -1.0;\n}\nfloat PCSSCube(samplerCube shadowMap, vec4 shadowParams, vec3 shadowCoords, vec4 cameraParams, float shadowSearchArea, vec3 lightDir) {\n\t\n\tvec3 samplePoints[PCSS_SAMPLE_COUNT];\n\tfloat noise = noise( gl_FragCoord.xy ) * 2.0 * PI;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tfloat r = pcssSphereSamples[i];\n\t\tsamplePoints[i] = vogelSphere(i, float(PCSS_SAMPLE_COUNT), noise, r);\n\t}\n\tfloat receiverDepth = length(lightDir) * shadowParams.w + shadowParams.z;\n\tvec3 lightDirNorm = normalize(lightDir);\n\t\n\tfloat averageBlocker = PCSSCubeBlockerDistance(shadowMap, lightDirNorm, samplePoints, receiverDepth, shadowSearchArea);\n\tif (averageBlocker == -1.0) {\n\t\treturn 1.0;\n\t} else {\n\t\tfloat filterRadius = ((receiverDepth - averageBlocker) / averageBlocker) * shadowSearchArea;\n\t\tfloat shadow = 0.0;\n\t\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++)\n\t\t{\n\t\t\tvec3 offset = samplePoints[i] * filterRadius;\n\t\t\tvec3 sampleDir = lightDirNorm + offset;\n\t\t\tsampleDir = normalize(sampleDir);\n\t\t\t#ifdef GL2\n\t\t\t\tfloat depth = textureCubeLodEXT(shadowMap, sampleDir, 0.0).r;\n\t\t\t#else\n\t\t\t\tfloat depth = unpackFloat(textureCube(shadowMap, sampleDir));\n\t\t\t#endif\n\t\t\tshadow += step(receiverDepth, depth);\n\t\t}\n\t\treturn shadow / float(PCSS_SAMPLE_COUNT);\n\t}\n}\nfloat getShadowPointPCSS(samplerCube shadowMap, vec3 shadowCoord, vec4 shadowParams, vec4 cameraParams, vec2 shadowSearchArea, vec3 lightDir) {\n\treturn PCSSCube(shadowMap, shadowParams, shadowCoord, cameraParams, shadowSearchArea.x, lightDir);\n}\nfloat getShadowSpotPCSS(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, vec4 cameraParams, vec2 shadowSearchArea, vec3 lightDir) {\n\treturn PCSS(TEXTURE_PASS(shadowMap), shadowCoord, cameraParams, shadowSearchArea);\n}\nfloat getShadowPCSS(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, vec4 cameraParams, vec2 shadowSearchArea, vec3 lightDir) {\n\treturn PCSS(TEXTURE_PASS(shadowMap), shadowCoord, cameraParams, shadowSearchArea);\n}\n",shadowSampleCoordPS:"\nvec3 getShadowSampleCoord$LIGHT(mat4 shadowTransform, vec4 shadowParams, vec3 worldPosition, vec3 lightPos, inout vec3 lightDir, vec3 lightDirNorm, vec3 normal) {\n\tvec3 surfacePosition = worldPosition;\n#ifdef SHADOW_SAMPLE_POINT\n\t#ifdef SHADOW_SAMPLE_NORMAL_OFFSET\n\t\tfloat distScale = length(lightDir);\n\t\tsurfacePosition = worldPosition + normal * shadowParams.y * clamp(1.0 - dot(normal, -lightDirNorm), 0.0, 1.0) * distScale;\n\t\tlightDir = surfacePosition - lightPos;\n\t\treturn lightDir;\n\t#endif\n#else\n\t#ifdef SHADOW_SAMPLE_SOURCE_ZBUFFER\n\t\t#ifdef SHADOW_SAMPLE_NORMAL_OFFSET\n\t\t\tsurfacePosition = worldPosition + normal * shadowParams.y;\n\t\t#endif\n\t#else\n\t\t#ifdef SHADOW_SAMPLE_NORMAL_OFFSET\n\t\t\t#ifdef SHADOW_SAMPLE_ORTHO\n\t\t\t\tfloat distScale = 1.0;\n\t\t\t#else\n\t\t\t\tfloat distScale = abs(dot(vPositionW - lightPos, lightDirNorm));\n\t\t\t#endif\n\t\t\tsurfacePosition = worldPosition + normal * shadowParams.y * clamp(1.0 - dot(normal, -lightDirNorm), 0.0, 1.0) * distScale;\n\t\t#endif\n\t#endif\n\tvec4 positionInShadowSpace = shadowTransform * vec4(surfacePosition, 1.0);\n\t#ifdef SHADOW_SAMPLE_ORTHO\n\t\tpositionInShadowSpace.z = saturate(positionInShadowSpace.z) - 0.0001;\n\t#else\n\t\t#ifdef SHADOW_SAMPLE_SOURCE_ZBUFFER\n\t\t\tpositionInShadowSpace.xyz /= positionInShadowSpace.w;\n\t\t#else\n\t\t\tpositionInShadowSpace.xy /= positionInShadowSpace.w;\n\t\t\tpositionInShadowSpace.z = length(lightDir) * shadowParams.w;\n\t\t#endif\n\t#endif\n\t#ifdef SHADOW_SAMPLE_Z_BIAS\n\t\tpositionInShadowSpace.z += getShadowBias(shadowParams.x, shadowParams.z);\n\t#endif\n\tsurfacePosition = positionInShadowSpace.xyz;\n#endif\n\treturn surfacePosition;\n}\n",shadowStandardPS:"\nvec3 lessThan2(vec3 a, vec3 b) {\n\treturn clamp((b - a)*1000.0, 0.0, 1.0);\n}\n#ifndef UNPACKFLOAT\n#define UNPACKFLOAT\n\tfloat unpackFloat(vec4 rgbaDepth) {\n\t\tconst vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n\t\treturn dot(rgbaDepth, bitShift);\n\t}\n#endif\n#ifdef GL2\nfloat _getShadowPCF3x3(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec3 shadowParams) {\n\tfloat z = shadowCoord.z;\n\tvec2 uv = shadowCoord.xy * shadowParams.x;\n\tfloat shadowMapSizeInv = 1.0 / shadowParams.x;\n\tvec2 base_uv = floor(uv + 0.5);\n\tfloat s = (uv.x + 0.5 - base_uv.x);\n\tfloat t = (uv.y + 0.5 - base_uv.y);\n\tbase_uv -= vec2(0.5);\n\tbase_uv *= shadowMapSizeInv;\n\tfloat sum = 0.0;\n\tfloat uw0 = (3.0 - 2.0 * s);\n\tfloat uw1 = (1.0 + 2.0 * s);\n\tfloat u0 = (2.0 - s) / uw0 - 1.0;\n\tfloat u1 = s / uw1 + 1.0;\n\tfloat vw0 = (3.0 - 2.0 * t);\n\tfloat vw1 = (1.0 + 2.0 * t);\n\tfloat v0 = (2.0 - t) / vw0 - 1.0;\n\tfloat v1 = t / vw1 + 1.0;\n\tu0 = u0 * shadowMapSizeInv + base_uv.x;\n\tv0 = v0 * shadowMapSizeInv + base_uv.y;\n\tu1 = u1 * shadowMapSizeInv + base_uv.x;\n\tv1 = v1 * shadowMapSizeInv + base_uv.y;\n\tsum += uw0 * vw0 * textureShadow(shadowMap, vec3(u0, v0, z));\n\tsum += uw1 * vw0 * textureShadow(shadowMap, vec3(u1, v0, z));\n\tsum += uw0 * vw1 * textureShadow(shadowMap, vec3(u0, v1, z));\n\tsum += uw1 * vw1 * textureShadow(shadowMap, vec3(u1, v1, z));\n\tsum *= 1.0f / 16.0;\n\treturn sum;\n}\nfloat getShadowPCF3x3(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF3x3(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\nfloat getShadowSpotPCF3x3(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF3x3(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\nfloat getShadowPCF1x1(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn textureShadow(shadowMap, shadowCoord);\n}\nfloat getShadowSpotPCF1x1(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn textureShadow(shadowMap, shadowCoord);\n}\n#else\nfloat _xgetShadowPCF3x3(mat3 depthKernel, vec3 shadowCoord, sampler2D shadowMap, vec3 shadowParams) {\n\tmat3 shadowKernel;\n\tvec3 shadowZ = vec3(shadowCoord.z);\n\tshadowKernel[0] = vec3(greaterThan(depthKernel[0], shadowZ));\n\tshadowKernel[1] = vec3(greaterThan(depthKernel[1], shadowZ));\n\tshadowKernel[2] = vec3(greaterThan(depthKernel[2], shadowZ));\n\tvec2 fractionalCoord = fract( shadowCoord.xy * shadowParams.x );\n\tshadowKernel[0] = mix(shadowKernel[0], shadowKernel[1], fractionalCoord.x);\n\tshadowKernel[1] = mix(shadowKernel[1], shadowKernel[2], fractionalCoord.x);\n\tvec4 shadowValues;\n\tshadowValues.x = mix(shadowKernel[0][0], shadowKernel[0][1], fractionalCoord.y);\n\tshadowValues.y = mix(shadowKernel[0][1], shadowKernel[0][2], fractionalCoord.y);\n\tshadowValues.z = mix(shadowKernel[1][0], shadowKernel[1][1], fractionalCoord.y);\n\tshadowValues.w = mix(shadowKernel[1][1], shadowKernel[1][2], fractionalCoord.y);\n\treturn dot( shadowValues, vec4( 1.0 ) ) * 0.25;\n}\nfloat _getShadowPCF3x3(sampler2D shadowMap, vec3 shadowCoord, vec3 shadowParams) {\n\tfloat xoffset = 1.0 / shadowParams.x;\n\tfloat dx0 = -xoffset;\n\tfloat dx1 = xoffset;\n\tmat3 depthKernel;\n\tdepthKernel[0][0] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(dx0, dx0)));\n\tdepthKernel[0][1] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(dx0, 0.0)));\n\tdepthKernel[0][2] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(dx0, dx1)));\n\tdepthKernel[1][0] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(0.0, dx0)));\n\tdepthKernel[1][1] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy));\n\tdepthKernel[1][2] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(0.0, dx1)));\n\tdepthKernel[2][0] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(dx1, dx0)));\n\tdepthKernel[2][1] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(dx1, 0.0)));\n\tdepthKernel[2][2] = unpackFloat(textureShadow(shadowMap, shadowCoord.xy + vec2(dx1, dx1)));\n\treturn _xgetShadowPCF3x3(depthKernel, shadowCoord, shadowMap, shadowParams);\n}\nfloat getShadowPCF3x3(sampler2D shadowMap, vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF3x3(shadowMap, shadowCoord, shadowParams.xyz);\n}\nfloat getShadowSpotPCF3x3(sampler2D shadowMap, vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF3x3(shadowMap, shadowCoord, shadowParams.xyz);\n}\nfloat _getShadowPCF1x1(sampler2D shadowMap, vec3 shadowCoord) {\n\tfloat shadowSample = unpackFloat(textureShadow(shadowMap, shadowCoord.xy));\n\treturn shadowSample > shadowCoord.z ? 1.0 : 0.0;\n}\nfloat getShadowPCF1x1(sampler2D shadowMap, vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF1x1(shadowMap, shadowCoord);\n}\nfloat getShadowSpotPCF1x1(sampler2D shadowMap, vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF1x1(shadowMap, shadowCoord);\n}\n#endif\n#ifndef WEBGPU\nfloat _getShadowPoint(samplerCube shadowMap, vec4 shadowParams, vec3 dir) {\n\tvec3 tc = normalize(dir);\n\tvec3 tcAbs = abs(tc);\n\tvec4 dirX = vec4(1,0,0, tc.x);\n\tvec4 dirY = vec4(0,1,0, tc.y);\n\tfloat majorAxisLength = tc.z;\n\tif ((tcAbs.x > tcAbs.y) && (tcAbs.x > tcAbs.z)) {\n\t\tdirX = vec4(0,0,1, tc.z);\n\t\tdirY = vec4(0,1,0, tc.y);\n\t\tmajorAxisLength = tc.x;\n\t} else if ((tcAbs.y > tcAbs.x) && (tcAbs.y > tcAbs.z)) {\n\t\tdirX = vec4(1,0,0, tc.x);\n\t\tdirY = vec4(0,0,1, tc.z);\n\t\tmajorAxisLength = tc.y;\n\t}\n\tfloat shadowParamsInFaceSpace = ((1.0/shadowParams.x) * 2.0) * abs(majorAxisLength);\n\tvec3 xoffset = (dirX.xyz * shadowParamsInFaceSpace);\n\tvec3 yoffset = (dirY.xyz * shadowParamsInFaceSpace);\n\tvec3 dx0 = -xoffset;\n\tvec3 dy0 = -yoffset;\n\tvec3 dx1 = xoffset;\n\tvec3 dy1 = yoffset;\n\tmat3 shadowKernel;\n\tmat3 depthKernel;\n\tdepthKernel[0][0] = unpackFloat(textureCube(shadowMap, tc + dx0 + dy0));\n\tdepthKernel[0][1] = unpackFloat(textureCube(shadowMap, tc + dx0));\n\tdepthKernel[0][2] = unpackFloat(textureCube(shadowMap, tc + dx0 + dy1));\n\tdepthKernel[1][0] = unpackFloat(textureCube(shadowMap, tc + dy0));\n\tdepthKernel[1][1] = unpackFloat(textureCube(shadowMap, tc));\n\tdepthKernel[1][2] = unpackFloat(textureCube(shadowMap, tc + dy1));\n\tdepthKernel[2][0] = unpackFloat(textureCube(shadowMap, tc + dx1 + dy0));\n\tdepthKernel[2][1] = unpackFloat(textureCube(shadowMap, tc + dx1));\n\tdepthKernel[2][2] = unpackFloat(textureCube(shadowMap, tc + dx1 + dy1));\n\tvec3 shadowZ = vec3(length(dir) * shadowParams.w + shadowParams.z);\n\tshadowKernel[0] = vec3(lessThan2(depthKernel[0], shadowZ));\n\tshadowKernel[1] = vec3(lessThan2(depthKernel[1], shadowZ));\n\tshadowKernel[2] = vec3(lessThan2(depthKernel[2], shadowZ));\n\tvec2 uv = (vec2(dirX.w, dirY.w) / abs(majorAxisLength)) * 0.5;\n\tvec2 fractionalCoord = fract( uv * shadowParams.x );\n\tshadowKernel[0] = mix(shadowKernel[0], shadowKernel[1], fractionalCoord.x);\n\tshadowKernel[1] = mix(shadowKernel[1], shadowKernel[2], fractionalCoord.x);\n\tvec4 shadowValues;\n\tshadowValues.x = mix(shadowKernel[0][0], shadowKernel[0][1], fractionalCoord.y);\n\tshadowValues.y = mix(shadowKernel[0][1], shadowKernel[0][2], fractionalCoord.y);\n\tshadowValues.z = mix(shadowKernel[1][0], shadowKernel[1][1], fractionalCoord.y);\n\tshadowValues.w = mix(shadowKernel[1][1], shadowKernel[1][2], fractionalCoord.y);\n\treturn 1.0 - dot( shadowValues, vec4( 1.0 ) ) * 0.25;\n}\nfloat getShadowPointPCF3x3(samplerCube shadowMap, vec3 shadowCoord, vec4 shadowParams, vec3 lightDir) {\n\treturn _getShadowPoint(shadowMap, shadowParams, lightDir);\n}\n#endif\n",shadowStandardGL2PS:"\nfloat _getShadowPCF5x5(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec3 shadowParams) {\n\tfloat z = shadowCoord.z;\n\tvec2 uv = shadowCoord.xy * shadowParams.x;\n\tfloat shadowMapSizeInv = 1.0 / shadowParams.x;\n\tvec2 base_uv = floor(uv + 0.5);\n\tfloat s = (uv.x + 0.5 - base_uv.x);\n\tfloat t = (uv.y + 0.5 - base_uv.y);\n\tbase_uv -= vec2(0.5);\n\tbase_uv *= shadowMapSizeInv;\n\tfloat uw0 = (4.0 - 3.0 * s);\n\tfloat uw1 = 7.0;\n\tfloat uw2 = (1.0 + 3.0 * s);\n\tfloat u0 = (3.0 - 2.0 * s) / uw0 - 2.0;\n\tfloat u1 = (3.0 + s) / uw1;\n\tfloat u2 = s / uw2 + 2.0;\n\tfloat vw0 = (4.0 - 3.0 * t);\n\tfloat vw1 = 7.0;\n\tfloat vw2 = (1.0 + 3.0 * t);\n\tfloat v0 = (3.0 - 2.0 * t) / vw0 - 2.0;\n\tfloat v1 = (3.0 + t) / vw1;\n\tfloat v2 = t / vw2 + 2.0;\n\tfloat sum = 0.0;\n\tu0 = u0 * shadowMapSizeInv + base_uv.x;\n\tv0 = v0 * shadowMapSizeInv + base_uv.y;\n\tu1 = u1 * shadowMapSizeInv + base_uv.x;\n\tv1 = v1 * shadowMapSizeInv + base_uv.y;\n\tu2 = u2 * shadowMapSizeInv + base_uv.x;\n\tv2 = v2 * shadowMapSizeInv + base_uv.y;\n\tsum += uw0 * vw0 * textureShadow(shadowMap, vec3(u0, v0, z));\n\tsum += uw1 * vw0 * textureShadow(shadowMap, vec3(u1, v0, z));\n\tsum += uw2 * vw0 * textureShadow(shadowMap, vec3(u2, v0, z));\n\tsum += uw0 * vw1 * textureShadow(shadowMap, vec3(u0, v1, z));\n\tsum += uw1 * vw1 * textureShadow(shadowMap, vec3(u1, v1, z));\n\tsum += uw2 * vw1 * textureShadow(shadowMap, vec3(u2, v1, z));\n\tsum += uw0 * vw2 * textureShadow(shadowMap, vec3(u0, v2, z));\n\tsum += uw1 * vw2 * textureShadow(shadowMap, vec3(u1, v2, z));\n\tsum += uw2 * vw2 * textureShadow(shadowMap, vec3(u2, v2, z));\n\tsum *= 1.0f / 144.0;\n\tsum = saturate(sum);\n\treturn sum;\n}\nfloat getShadowPCF5x5(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF5x5(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\nfloat getShadowSpotPCF5x5(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF5x5(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\n",shadowVSM8PS:"\nfloat calculateVSM8(vec3 moments, float Z, float vsmBias) {\n\tfloat VSMBias = vsmBias;\n\tfloat depthScale = VSMBias * Z;\n\tfloat minVariance1 = depthScale * depthScale;\n\treturn chebyshevUpperBound(moments.xy, Z, minVariance1, 0.1);\n}\nfloat decodeFloatRG(vec2 rg) {\n\treturn rg.y*(1.0/255.0) + rg.x;\n}\nfloat VSM8(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {\n\tvec4 c = texture2D(tex, texCoords);\n\tvec3 moments = vec3(decodeFloatRG(c.xy), decodeFloatRG(c.zw), 0.0);\n\treturn calculateVSM8(moments, Z, vsmBias);\n}\nfloat getShadowVSM8(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM8(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, shadowCoord.z, shadowParams.y, 0.0);\n}\nfloat getShadowSpotVSM8(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM8(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, length(lightDir) * shadowParams.w + shadowParams.z, shadowParams.y, 0.0);\n}\n",shadowVSM_commonPS:"\nfloat linstep(float a, float b, float v) {\n\treturn saturate((v - a) / (b - a));\n}\nfloat reduceLightBleeding(float pMax, float amount) {\n return linstep(amount, 1.0, pMax);\n}\nfloat chebyshevUpperBound(vec2 moments, float mean, float minVariance, float lightBleedingReduction) {\n\tfloat variance = moments.y - (moments.x * moments.x);\n\tvariance = max(variance, minVariance);\n\tfloat d = mean - moments.x;\n\tfloat pMax = variance / (variance + (d * d));\n\tpMax = reduceLightBleeding(pMax, lightBleedingReduction);\n\treturn (mean <= moments.x ? 1.0 : pMax);\n}\nfloat calculateEVSM(vec3 moments, float Z, float vsmBias, float exponent) {\n\tZ = 2.0 * Z - 1.0;\n\tfloat warpedDepth = exp(exponent * Z);\n\tmoments.xy += vec2(warpedDepth, warpedDepth*warpedDepth) * (1.0 - moments.z);\n\tfloat VSMBias = vsmBias;\n\tfloat depthScale = VSMBias * exponent * warpedDepth;\n\tfloat minVariance1 = depthScale * depthScale;\n\treturn chebyshevUpperBound(moments.xy, warpedDepth, minVariance1, 0.1);\n}\n",skinBatchConstVS:"\nattribute float vertex_boneIndices;\nuniform vec4 matrix_pose[BONE_LIMIT * 3];\nmat4 getBoneMatrix(const in float i) {\n\tvec4 v1 = matrix_pose[int(3.0 * i)];\n\tvec4 v2 = matrix_pose[int(3.0 * i + 1.0)];\n\tvec4 v3 = matrix_pose[int(3.0 * i + 2.0)];\n\treturn mat4(\n\t\tv1.x, v2.x, v3.x, 0,\n\t\tv1.y, v2.y, v3.y, 0,\n\t\tv1.z, v2.z, v3.z, 0,\n\t\tv1.w, v2.w, v3.w, 1\n\t);\n}\n",skinBatchTexVS:"\nattribute float vertex_boneIndices;\nuniform highp sampler2D texture_poseMap;\nuniform vec4 texture_poseMapSize;\nmat4 getBoneMatrix(const in float i) {\n\tfloat j = i * 3.0;\n\tfloat dx = texture_poseMapSize.z;\n\tfloat dy = texture_poseMapSize.w;\n\tfloat y = floor(j * dx);\n\tfloat x = j - (y * texture_poseMapSize.x);\n\ty = dy * (y + 0.5);\n\tvec4 v1 = texture2D(texture_poseMap, vec2(dx * (x + 0.5), y));\n\tvec4 v2 = texture2D(texture_poseMap, vec2(dx * (x + 1.5), y));\n\tvec4 v3 = texture2D(texture_poseMap, vec2(dx * (x + 2.5), y));\n\treturn mat4(\n\t\tv1.x, v2.x, v3.x, 0,\n\t\tv1.y, v2.y, v3.y, 0,\n\t\tv1.z, v2.z, v3.z, 0,\n\t\tv1.w, v2.w, v3.w, 1\n\t);\n}\n",skinConstVS:"\nattribute vec4 vertex_boneWeights;\nattribute vec4 vertex_boneIndices;\nuniform vec4 matrix_pose[BONE_LIMIT * 3];\nvoid getBoneMatrix(const in float i, out vec4 v1, out vec4 v2, out vec4 v3) {\n\tv1 = matrix_pose[int(3.0 * i)];\n\tv2 = matrix_pose[int(3.0 * i + 1.0)];\n\tv3 = matrix_pose[int(3.0 * i + 2.0)];\n}\nmat4 getSkinMatrix(const in vec4 indices, const in vec4 weights) {\n\tvec4 a1, a2, a3;\n\tgetBoneMatrix(indices.x, a1, a2, a3);\n\tvec4 b1, b2, b3;\n\tgetBoneMatrix(indices.y, b1, b2, b3);\n\tvec4 c1, c2, c3;\n\tgetBoneMatrix(indices.z, c1, c2, c3);\n\tvec4 d1, d2, d3;\n\tgetBoneMatrix(indices.w, d1, d2, d3);\n\tvec4 v1 = a1 * weights.x + b1 * weights.y + c1 * weights.z + d1 * weights.w;\n\tvec4 v2 = a2 * weights.x + b2 * weights.y + c2 * weights.z + d2 * weights.w;\n\tvec4 v3 = a3 * weights.x + b3 * weights.y + c3 * weights.z + d3 * weights.w;\n\tfloat one = dot(weights, vec4(1.0));\n\treturn mat4(\n\t\tv1.x, v2.x, v3.x, 0,\n\t\tv1.y, v2.y, v3.y, 0,\n\t\tv1.z, v2.z, v3.z, 0,\n\t\tv1.w, v2.w, v3.w, one\n\t);\n}\n",skinTexVS:"\nattribute vec4 vertex_boneWeights;\nattribute vec4 vertex_boneIndices;\nuniform highp sampler2D texture_poseMap;\nuniform vec4 texture_poseMapSize;\nvoid getBoneMatrix(const in float index, out vec4 v1, out vec4 v2, out vec4 v3) {\n\tfloat i = float(index);\n\tfloat j = i * 3.0;\n\tfloat dx = texture_poseMapSize.z;\n\tfloat dy = texture_poseMapSize.w;\n\t\n\tfloat y = floor(j * dx);\n\tfloat x = j - (y * texture_poseMapSize.x);\n\ty = dy * (y + 0.5);\n\tv1 = texture2D(texture_poseMap, vec2(dx * (x + 0.5), y));\n\tv2 = texture2D(texture_poseMap, vec2(dx * (x + 1.5), y));\n\tv3 = texture2D(texture_poseMap, vec2(dx * (x + 2.5), y));\n}\nmat4 getSkinMatrix(const in vec4 indices, const in vec4 weights) {\n\tvec4 a1, a2, a3;\n\tgetBoneMatrix(indices.x, a1, a2, a3);\n\tvec4 b1, b2, b3;\n\tgetBoneMatrix(indices.y, b1, b2, b3);\n\tvec4 c1, c2, c3;\n\tgetBoneMatrix(indices.z, c1, c2, c3);\n\tvec4 d1, d2, d3;\n\tgetBoneMatrix(indices.w, d1, d2, d3);\n\tvec4 v1 = a1 * weights.x + b1 * weights.y + c1 * weights.z + d1 * weights.w;\n\tvec4 v2 = a2 * weights.x + b2 * weights.y + c2 * weights.z + d2 * weights.w;\n\tvec4 v3 = a3 * weights.x + b3 * weights.y + c3 * weights.z + d3 * weights.w;\n\tfloat one = dot(weights, vec4(1.0));\n\treturn mat4(\n\t\tv1.x, v2.x, v3.x, 0,\n\t\tv1.y, v2.y, v3.y, 0,\n\t\tv1.z, v2.z, v3.z, 0,\n\t\tv1.w, v2.w, v3.w, one\n\t);\n}\n",skyboxEnvPS:"\nvarying vec3 vViewDir;\nuniform sampler2D texture_envAtlas;\nuniform float mipLevel;\nvoid main(void) {\n\tvec3 dir = vViewDir * vec3(-1.0, 1.0, 1.0);\n\tvec2 uv = toSphericalUv(normalize(dir));\n\tvec3 linear = SKYBOX_DECODE_FNC(texture2D(texture_envAtlas, mapRoughnessUv(uv, mipLevel)));\n\tgl_FragColor = vec4(gammaCorrectOutput(toneMap(processEnvironment(linear))), 1.0);\n}\n",skyboxHDRPS:"\nvarying vec3 vViewDir;\nuniform samplerCube texture_cubeMap;\n#ifdef SKYMESH\n\tvarying vec3 vWorldPos;\n\tuniform mat3 cubeMapRotationMatrix;\n\tuniform vec3 projectedSkydomeCenter;\n#endif\nvoid main(void) {\n\t#ifdef SKYMESH\n\t\tvec3 envDir = normalize(vWorldPos - projectedSkydomeCenter);\n\t\tvec3 dir = envDir * cubeMapRotationMatrix;\n\t#else\n\t\tvec3 dir = vViewDir;\n\t#endif\n\tdir.x *= -1.0;\n\tvec3 linear = SKYBOX_DECODE_FNC(textureCube(texture_cubeMap, fixSeamsStatic(dir, SKYBOX_MIP)));\n\tgl_FragColor = vec4(gammaCorrectOutput(toneMap(processEnvironment(linear))), 1.0);\n}\n",skyboxVS:"\nattribute vec3 aPosition;\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform mat4 matrix_projectionSkybox;\nuniform mat3 cubeMapRotationMatrix;\nvarying vec3 vViewDir;\n#ifdef SKYMESH\n\tuniform mat4 matrix_model;\n\tvarying vec3 vWorldPos;\n#endif\nvoid main(void) {\n\tmat4 view = matrix_view;\n\t#ifdef SKYMESH\n\t\tvec4 worldPos = matrix_model * vec4(aPosition, 1.0);\n\t\tvWorldPos = worldPos.xyz;\n\t\tgl_Position = matrix_projectionSkybox * view * worldPos;\n\t#else\n\t\tview[3][0] = view[3][1] = view[3][2] = 0.0;\n\t\tgl_Position = matrix_projectionSkybox * view * vec4(aPosition, 1.0);\n\t\tvViewDir = aPosition * cubeMapRotationMatrix;\n\t#endif\n\tgl_Position.z = gl_Position.w - 1.0e-7;\n}\n",specularPS:"\n#ifdef MAPCOLOR\nuniform vec3 material_specular;\n#endif\nvoid getSpecularity() {\n\tvec3 specularColor = vec3(1,1,1);\n\t#ifdef MAPCOLOR\n\tspecularColor *= material_specular;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tspecularColor *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tspecularColor *= saturate(vVertexColor.$VC);\n\t#endif\n\tdSpecularity = specularColor;\n}\n",sphericalPS:"\nconst float PI = 3.141592653589793;\nvec2 toSpherical(vec3 dir) {\n\treturn vec2(dir.xz == vec2(0.0) ? 0.0 : atan(dir.x, dir.z), asin(dir.y));\n}\nvec2 toSphericalUv(vec3 dir) {\n\tvec2 uv = toSpherical(dir) / vec2(PI * 2.0, PI) + 0.5;\n\treturn vec2(uv.x, 1.0 - uv.y);\n}\n",specularityFactorPS:"\n#ifdef MAPFLOAT\nuniform float material_specularityFactor;\n#endif\nvoid getSpecularityFactor() {\n\tfloat specularityFactor = 1.0;\n\t#ifdef MAPFLOAT\n\tspecularityFactor *= material_specularityFactor;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tspecularityFactor *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tspecularityFactor *= saturate(vVertexColor.$VC);\n\t#endif\n\tdSpecularityFactor = specularityFactor;\n}\n",spotPS:"\nfloat getSpotEffect(vec3 lightSpotDir, float lightInnerConeAngle, float lightOuterConeAngle, vec3 lightDirNorm) {\n\tfloat cosAngle = dot(lightDirNorm, lightSpotDir);\n\treturn smoothstep(lightOuterConeAngle, lightInnerConeAngle, cosAngle);\n}\n",startPS:"\nvoid main(void) {\n\tdReflection = vec4(0);\n\t#ifdef LIT_CLEARCOAT\n\tccSpecularLight = vec3(0);\n\tccReflection = vec3(0);\n\t#endif\n",startVS:"\nvoid main(void) {\n\tgl_Position = getPosition();\n",startNineSlicedPS:"\n\tnineSlicedUv = vUv0;\n\tnineSlicedUv.y = 1.0 - nineSlicedUv.y;\n",startNineSlicedTiledPS:"\n\tvec2 tileMask = step(vMask, vec2(0.99999));\n\tvec2 tileSize = 0.5 * (innerOffset.xy + innerOffset.zw);\n\tvec2 tileScale = vec2(1.0) / (vec2(1.0) - tileSize);\n\tvec2 clampedUv = mix(innerOffset.xy * 0.5, vec2(1.0) - innerOffset.zw * 0.5, fract((vTiledUv - tileSize) * tileScale));\n\tclampedUv = clampedUv * atlasRect.zw + atlasRect.xy;\n\tnineSlicedUv = vUv0 * tileMask + clampedUv * (vec2(1.0) - tileMask);\n\tnineSlicedUv.y = 1.0 - nineSlicedUv.y;\n\t\n",storeEVSMPS:"\nfloat exponent = VSM_EXPONENT;\ndepth = 2.0 * depth - 1.0;\ndepth = exp(exponent * depth);\ngl_FragColor = vec4(depth, depth*depth, 1.0, 1.0);\n",tangentBinormalVS:"\nvec3 getTangent() {\n\treturn normalize(dNormalMatrix * vertex_tangent.xyz);\n}\nvec3 getBinormal() {\n\treturn cross(vNormalW, vTangentW) * vertex_tangent.w;\n}\n",TBNPS:"\nvoid getTBN(vec3 tangent, vec3 binormal, vec3 normal) {\n\tdTBN = mat3(normalize(tangent), normalize(binormal), normalize(normal));\n}\n",TBNderivativePS:"\nuniform float tbnBasis;\nvoid getTBN(vec3 tangent, vec3 binormal, vec3 normal) {\n\tvec2 uv = $UV;\n\tvec3 dp1 = dFdx( vPositionW );\n\tvec3 dp2 = dFdy( vPositionW );\n\tvec2 duv1 = dFdx( uv );\n\tvec2 duv2 = dFdy( uv );\n\tvec3 dp2perp = cross( dp2, normal );\n\tvec3 dp1perp = cross( normal, dp1 );\n\tvec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n\tvec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n\tfloat denom = max( dot(T,T), dot(B,B) );\n\tfloat invmax = (denom == 0.0) ? 0.0 : tbnBasis / sqrt( denom );\n\tdTBN = mat3(T * invmax, -B * invmax, normal );\n}\n",TBNfastPS:"\nvoid getTBN(vec3 tangent, vec3 binormal, vec3 normal) {\n\tdTBN = mat3(tangent, binormal, normal);\n}\n",TBNObjectSpacePS:"\nvoid getTBN(vec3 tangent, vec3 binormal, vec3 normal) {\n\tvec3 B = cross(normal, vObjectSpaceUpW);\n\tvec3 T = cross(normal, B);\n\tif (dot(B,B)==0.0)\n\t{\n\t\tfloat major=max(max(normal.x, normal.y), normal.z);\n\t\tif (normal.x == major)\n\t\t{\n\t\t\tB=cross(normal, vec3(0,1,0));\n\t\t\tT=cross(normal, B);\n\t\t}\n\t\telse if (normal.y == major)\n\t\t{\n\t\t\tB=cross(normal, vec3(0,0,1));\n\t\t\tT=cross(normal, B);\n\t\t}\n\t\telse if (normal.z == major)\n\t\t{\n\t\t\tB=cross(normal, vec3(1,0,0));\n\t\t\tT=cross(normal, B);\n\t\t}\n\t}\n\tdTBN = mat3(normalize(T), normalize(B), normalize(normal));\n}\n",textureSamplePS:"\nvec4 texture2DSRGB(sampler2D tex, vec2 uv) {\n\treturn gammaCorrectInput(texture2D(tex, uv));\n}\nvec4 texture2DSRGB(sampler2D tex, vec2 uv, float bias) {\n\treturn gammaCorrectInput(texture2D(tex, uv, bias));\n}\nvec3 texture2DRGBM(sampler2D tex, vec2 uv) {\n\treturn decodeRGBM(texture2D(tex, uv));\n}\nvec3 texture2DRGBM(sampler2D tex, vec2 uv, float bias) {\n\treturn decodeRGBM(texture2D(tex, uv, bias));\n}\nvec3 texture2DRGBE(sampler2D tex, vec2 uv) {\n\treturn decodeRGBM(texture2D(tex, uv));\n}\nvec3 texture2DRGBE(sampler2D tex, vec2 uv, float bias) {\n\treturn decodeRGBM(texture2D(tex, uv, bias));\n}\n",thicknessPS:"\n#ifdef MAPFLOAT\nuniform float material_thickness;\n#endif\nvoid getThickness() {\n\tdThickness = 1.0;\n\t#ifdef MAPFLOAT\n\tdThickness *= material_thickness;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tdThickness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdThickness *= saturate(vVertexColor.$VC);\n\t#endif\n}\n",tonemappingAcesPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\tfloat tA = 2.51;\n\tfloat tB = 0.03;\n\tfloat tC = 2.43;\n\tfloat tD = 0.59;\n\tfloat tE = 0.14;\n\tvec3 x = color * exposure;\n\treturn (x*(tA*x+tB))/(x*(tC*x+tD)+tE);\n}\n",tonemappingAces2PS:"\nuniform float exposure;\nconst mat3 ACESInputMat = mat3(\n\t0.59719, 0.35458, 0.04823,\n\t0.07600, 0.90834, 0.01566,\n\t0.02840, 0.13383, 0.83777\n);\nconst mat3 ACESOutputMat = mat3(\n\t 1.60475, -0.53108, -0.07367,\n\t-0.10208, 1.10813, -0.00605,\n\t-0.00327, -0.07276, 1.07602\n);\nvec3 RRTAndODTFit(vec3 v) {\n\tvec3 a = v * (v + 0.0245786) - 0.000090537;\n\tvec3 b = v * (0.983729 * v + 0.4329510) + 0.238081;\n\treturn a / b;\n}\nvec3 toneMap(vec3 color) {\n\tcolor *= exposure / 0.6;\n\tcolor = color * ACESInputMat;\n\tcolor = RRTAndODTFit(color);\n\tcolor = color * ACESOutputMat;\n\tcolor = clamp(color, 0.0, 1.0);\n\treturn color;\n}\n",tonemappingFilmicPS:"\nconst float A = 0.15;\nconst float B = 0.50;\nconst float C = 0.10;\nconst float D = 0.20;\nconst float E = 0.02;\nconst float F = 0.30;\nconst float W = 11.2;\nuniform float exposure;\nvec3 uncharted2Tonemap(vec3 x) {\n return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\n}\nvec3 toneMap(vec3 color) {\n\tcolor = uncharted2Tonemap(color * exposure);\n\tvec3 whiteScale = 1.0 / uncharted2Tonemap(vec3(W,W,W));\n\tcolor = color * whiteScale;\n\treturn color;\n}\n",tonemappingHejlPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\tcolor *= exposure;\n\tconst float A = 0.22, B = 0.3, C = .1, D = 0.2, E = .01, F = 0.3;\n\tconst float Scl = 1.25;\n\tvec3 h = max( vec3(0.0), color - vec3(0.004) );\n\treturn (h*((Scl*A)*h+Scl*vec3(C*B,C*B,C*B))+Scl*vec3(D*E,D*E,D*E)) / (h*(A*h+vec3(B,B,B))+vec3(D*F,D*F,D*F)) - Scl*vec3(E/F,E/F,E/F);\n}\n",tonemappingLinearPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\treturn color * exposure;\n}\n",tonemappingNeutralPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\tcolor *= exposure;\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, newPeak * vec3(1, 1, 1), g);\n}\n",tonemappingNonePS:"\nvec3 toneMap(vec3 color) {\n\treturn color;\n}\n",transformVS:"\n#ifdef PIXELSNAP\nuniform vec4 uScreenSize;\n#endif\n#ifdef SCREENSPACE\nuniform float projectionFlipY;\n#endif\n#ifdef MORPHING\nuniform vec4 morph_weights_a;\nuniform vec4 morph_weights_b;\n#endif\n#ifdef MORPHING_TEXTURE_BASED\n\tuniform vec4 morph_tex_params;\n\t#ifdef WEBGPU\n\t\tivec2 getTextureMorphCoords() {\n\t\t\tivec2 textureSize = ivec2(morph_tex_params.xy);\n\t\t\tint morphGridV = int(morph_vertex_id / textureSize.x);\n\t\t\tint morphGridU = int(morph_vertex_id - (morphGridV * textureSize.x));\n\t\t\tmorphGridV = textureSize.y - morphGridV - 1;\n\t\t\treturn ivec2(morphGridU, morphGridV);\n\t\t}\n\t#else\n\t\tvec2 getTextureMorphCoords() {\n\t\t\tvec2 textureSize = morph_tex_params.xy;\n\t\t\tvec2 invTextureSize = morph_tex_params.zw;\n\t\t\tfloat morphGridV = floor(morph_vertex_id * invTextureSize.x);\n\t\t\tfloat morphGridU = morph_vertex_id - (morphGridV * textureSize.x);\n\t\t\treturn vec2(morphGridU, morphGridV) * invTextureSize + (0.5 * invTextureSize);\n\t\t}\n\t#endif\n#endif\n#ifdef MORPHING_TEXTURE_BASED_POSITION\nuniform highp sampler2D morphPositionTex;\n#endif\nmat4 getModelMatrix() {\n\t#ifdef DYNAMICBATCH\n\treturn getBoneMatrix(vertex_boneIndices);\n\t#elif defined(SKIN)\n\treturn matrix_model * getSkinMatrix(vertex_boneIndices, vertex_boneWeights);\n\t#elif defined(INSTANCING)\n\treturn mat4(instance_line1, instance_line2, instance_line3, instance_line4);\n\t#else\n\treturn matrix_model;\n\t#endif\n}\nvec4 getPosition() {\n\tdModelMatrix = getModelMatrix();\n\tvec3 localPos = vertex_position;\n\t#ifdef NINESLICED\n\tlocalPos.xz *= outerScale;\n\tvec2 positiveUnitOffset = clamp(vertex_position.xz, vec2(0.0), vec2(1.0));\n\tvec2 negativeUnitOffset = clamp(-vertex_position.xz, vec2(0.0), vec2(1.0));\n\tlocalPos.xz += (-positiveUnitOffset * innerOffset.xy + negativeUnitOffset * innerOffset.zw) * vertex_texCoord0.xy;\n\tvTiledUv = (localPos.xz - outerScale + innerOffset.xy) * -0.5 + 1.0;\n\tlocalPos.xz *= -0.5;\n\tlocalPos = localPos.xzy;\n\t#endif\n\t#ifdef MORPHING\n\t#ifdef MORPHING_POS03\n\tlocalPos.xyz += morph_weights_a[0] * morph_pos0;\n\tlocalPos.xyz += morph_weights_a[1] * morph_pos1;\n\tlocalPos.xyz += morph_weights_a[2] * morph_pos2;\n\tlocalPos.xyz += morph_weights_a[3] * morph_pos3;\n\t#endif\n\t#ifdef MORPHING_POS47\n\tlocalPos.xyz += morph_weights_b[0] * morph_pos4;\n\tlocalPos.xyz += morph_weights_b[1] * morph_pos5;\n\tlocalPos.xyz += morph_weights_b[2] * morph_pos6;\n\tlocalPos.xyz += morph_weights_b[3] * morph_pos7;\n\t#endif\n\t#endif\n\t#ifdef MORPHING_TEXTURE_BASED_POSITION\n\t\t#ifdef WEBGPU\n\t\t\tivec2 morphUV = getTextureMorphCoords();\n\t\t\tvec3 morphPos = texelFetch(morphPositionTex, ivec2(morphUV), 0).xyz;\n\t\t#else\n\t\t\tvec2 morphUV = getTextureMorphCoords();\n\t\t\tvec3 morphPos = texture2D(morphPositionTex, morphUV).xyz;\n\t\t#endif\n\t\tlocalPos += morphPos;\n\t#endif\n\tvec4 posW = dModelMatrix * vec4(localPos, 1.0);\n\t#ifdef SCREENSPACE\n\tposW.zw = vec2(0.0, 1.0);\n\t#endif\n\tdPositionW = posW.xyz;\n\tvec4 screenPos;\n\t#ifdef UV1LAYOUT\n\tscreenPos = vec4(vertex_texCoord1.xy * 2.0 - 1.0, 0.5, 1);\n\t\t#ifdef WEBGPU\n\t\tscreenPos.y *= -1.0;\n\t\t#endif\n\t#else\n\t#ifdef SCREENSPACE\n\tscreenPos = posW;\n\tscreenPos.y *= projectionFlipY;\n\t#else\n\tscreenPos = matrix_viewProjection * posW;\n\t#endif\n\t#ifdef PIXELSNAP\n\tscreenPos.xy = (screenPos.xy * 0.5) + 0.5;\n\tscreenPos.xy *= uScreenSize.xy;\n\tscreenPos.xy = floor(screenPos.xy);\n\tscreenPos.xy *= uScreenSize.zw;\n\tscreenPos.xy = (screenPos.xy * 2.0) - 1.0;\n\t#endif\n\t#endif\n\treturn screenPos;\n}\nvec3 getWorldPosition() {\n\treturn dPositionW;\n}\n",transformDeclVS:"\nattribute vec3 vertex_position;\nuniform mat4 matrix_model;\nuniform mat4 matrix_viewProjection;\nvec3 dPositionW;\nmat4 dModelMatrix;\n",transmissionPS:"\n#ifdef MAPFLOAT\nuniform float material_refraction;\n#endif\nvoid getRefraction() {\n\tfloat refraction = 1.0;\n\t#ifdef MAPFLOAT\n\trefraction = material_refraction;\n\t#endif\n\t#ifdef MAPTEXTURE\n\trefraction *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\trefraction *= saturate(vVertexColor.$VC);\n\t#endif\n\tdTransmission = refraction;\n}\n",twoSidedLightingPS:"\nuniform float twoSidedLightingNegScaleFactor;\nvoid handleTwoSidedLighting() {\n\tdTBN[2] *= gl_FrontFacing ? twoSidedLightingNegScaleFactor : -twoSidedLightingNegScaleFactor;\n}\n",uv0VS:"\n#ifdef NINESLICED\nvec2 getUv0() {\n\tvec2 uv = vertex_position.xz;\n\tvec2 positiveUnitOffset = clamp(vertex_position.xz, vec2(0.0), vec2(1.0));\n\tvec2 negativeUnitOffset = clamp(-vertex_position.xz, vec2(0.0), vec2(1.0));\n\tuv += (-positiveUnitOffset * innerOffset.xy + negativeUnitOffset * innerOffset.zw) * vertex_texCoord0.xy;\n\tuv = uv * -0.5 + 0.5;\n\tuv = uv * atlasRect.zw + atlasRect.xy;\n\tvMask = vertex_texCoord0.xy;\n\treturn uv;\n}\n#else\nvec2 getUv0() {\n\treturn vertex_texCoord0;\n}\n#endif\n",uv1VS:"\nvec2 getUv1() {\n\treturn vertex_texCoord1;\n}\n",viewDirPS:"\nvoid getViewDir() {\n\tdViewDirW = normalize(view_position - vPositionW);\n}\n",viewNormalVS:"\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nvec3 getViewNormal() {\n\treturn mat3(matrix_view) * vNormalW;\n}\n",webgpuPS:Rr,webgpuVS:Ir},Fo=new Tn;function Bo(t){return Fo.get(t)}function No(t,e){Fo.get(t,(function(){return e}))}var Uo=function(){function t(){}return t.begin=function(){return"void main(void)\n{\n"},t.end=function(){return"}\n"},t.skinCode=function(t,e){return void 0===e&&(e=Oo),t.supportsBoneTextures?e.skinTexVS:"#define BONE_LIMIT "+t.getBoneLimit()+"\n"+e.skinConstVS},t.fogCode=function(t,e){return void 0===e&&(e=Oo),"linear"===t?e.fogLinearPS?e.fogLinearPS:Oo.fogLinearPS:"exp"===t?e.fogExpPS?e.fogExpPS:Oo.fogExpPS:"exp2"===t?e.fogExp2PS?e.fogExp2PS:Oo.fogExp2PS:e.fogNonePS?e.fogNonePS:Oo.fogNonePS},t.gammaCode=function(t,e){return void 0===e&&(e=Oo),1===t||2===t?e.gamma2_2PS?e.gamma2_2PS:Oo.gamma2_2PS:3===t?"#define HDR\n"+(e.gamma2_2PS?e.gamma2_2PS:Oo.gamma2_2PS):e.gamma1_0PS?e.gamma1_0PS:Oo.gamma1_0PS},t.tonemapCode=function(t,e){var i,n,s,r,a,o,h;switch(void 0===e&&(e=Oo),t){case 1:return null!=(i=e.tonemappingFilmicPS)?i:Oo.tonemappingFilmicPS;case 0:return null!=(n=e.tonemappingLinearPS)?n:Oo.tonemappingLinearPS;case 2:return null!=(s=e.tonemappingHejlPS)?s:Oo.tonemappingHejlPS;case 3:return null!=(r=e.tonemappingAcesPS)?r:Oo.tonemappingAcesPS;case 4:return null!=(a=e.tonemappingAces2PS)?a:Oo.tonemappingAces2PS;case 5:return null!=(o=e.tonemappingNeutralPS)?o:Oo.tonemappingNeutralPS}return null!=(h=e.tonemapingNonePS)?h:Oo.tonemappingNonePS},t}();function zo(t,e,i,n,s){return void 0===n&&(n=!1),void 0===s&&(s={}),"boolean"==typeof n?s.useTransformFeedback=n:"object"==typeof n&&(s=y({},s,n)),new Xs(t,kr.createDefinition(t,y({},s,{name:e+"_"+i,vertexCode:Oo[e],fragmentCode:Oo[i]})))}function Vo(t,e,i,n,s,r,a){void 0===r&&(r=!1),void 0===a&&(a={}),"boolean"==typeof r?a.useTransformFeedback=r:"object"==typeof r&&(a=y({},a,r));var o=Bo(t),h=o.getCachedShader(n);return h||(h=new Xs(t,kr.createDefinition(t,y({},a,{name:n,vertexCode:e,fragmentCode:i,attributes:s}))),o.setCachedShader(n,h)),h}var Go=function(t){function e(e,i){var n;return(n=t.call(this)||this).key=e,n.shaderDefinition=i,n}x(e,t);var i=e.prototype;return i.generateKey=function(t){return this.key},i.createShaderDefinition=function(t,e){return this.shaderDefinition},e}(Uo);function Ho(t,e){var i,n=t.definition,s=(null!=(i=n.name)?i:"shader")+"-id-"+t.id,r=new Go(s,n),a="shader",o=Bo(t.device);o.register(a,r);var h=o.getProgram(a,{},e);return t.definition.shaderLanguage===Pi&&(h.meshUniformBufferFormat=n.meshUniformBufferFormat,h.meshBindGroupFormat=n.meshBindGroupFormat),o.unregister(a),h}Oo.createShader=zo,Oo.createShaderFromCode=Vo;var Wo={type:Be,base:0,count:4,indexed:!1},Xo=new Lt,jo=new Lt,qo=function(){function t(t){this.uniformBuffer=void 0,this.bindGroup=void 0;var e=t.device;if(this.shader=t,e.supportsUniformBuffers){var i=new ea;this.shader=Ho(t,i);var n=this.shader.meshUniformBufferFormat;n&&(this.uniformBuffer=new Js(e,n,!1));var s=this.shader.meshBindGroupFormat;this.bindGroup=new qs(e,s,this.uniformBuffer)}}var e=t.prototype;return e.destroy=function(){var t,e;null==(t=this.uniformBuffer)||t.destroy(),this.uniformBuffer=null,null==(e=this.bindGroup)||e.destroy(),this.bindGroup=null},e.render=function(t,e){var i,n=this.shader.device;t&&(Xo.set(n.vx,n.vy,n.vw,n.vh),jo.set(n.sx,n.sy,n.sw,n.sh),e=null!=(i=e)?i:t,n.setViewport(t.x,t.y,t.z,t.w),n.setScissor(e.x,e.y,e.z,e.w));n.setVertexBuffer(n.quadVertexBuffer,0);var s=this.shader;if(n.setShader(s),n.supportsUniformBuffers){var r,a=this.bindGroup;null==(r=a.defaultUniformBuffer)||r.update(),a.update(),n.setBindGroup(0,a)}n.draw(Wo),t&&(n.setViewport(Xo.x,Xo.y,Xo.z,Xo.w),n.setScissor(jo.x,jo.y,jo.z,jo.w))},t}(),Yo=function(t){function e(e,i,n,s){var r;return(r=t.call(this,e)||this).quad=i,r.rect=n,r.scissorRect=s,r}return x(e,t),e.prototype.execute=function(){var t=this.device;t.setCullMode(_e),t.setDepthState(dn.NODEPTH),t.setStencilState(null,null),this.quad.render(this.rect,this.scissorRect)},e}(ta),Ko=new Lt;function Zo(t,e,i,n,s){var r=new qo(i);n||((n=Ko).x=0,n.y=0,n.z=e?e.width:t.width,n.w=e?e.height:t.height);var a=new Yo(t,r,n,s);a.init(e),a.colorOps.clear=!1,a.depthStencilOps.clearDepth=!1,t.isWebGPU&&null===e&&t.samples>1&&(a.colorOps.store=!0),a.render(),r.destroy()}var Qo=new Tn,Jo=function(){function t(t,e,i){void 0===i&&(i={}),this.index=void 0,this.name=void 0,this.shaderDefines=void 0,this.name=t,this.index=e,Object.assign(this,i),this.shaderDefines=this.buildShaderDefines()}return t.prototype.buildShaderDefines=function(){var t;return this.isShadow?t="SHADOW":this.isForward?t="FORWARD":2===this.index?t="DEPTH":3===this.index&&(t="PICK"),(t?"#define "+t+"_PASS\n":"")+("#define "+this.name.toUpperCase()+"_PASS\n")},t}(),$o=function(){function t(){var t=this;this.passesNamed=new Map,this.passesIndexed=[],this.nextIndex=0;var e=function(e,i,n){t.allocate(e,n)};e("forward",0,{isForward:!0}),e("forward_hdr",0,{isForward:!0}),e("depth"),e("pick"),e("shadow"),e("prepass")}t.get=function(e){return Qo.get(e,(function(){return new t}))};var e=t.prototype;return e.allocate=function(t,e){var i=this.passesNamed.get(t);return void 0===i&&(i=new Jo(t,this.nextIndex,e),this.passesNamed.set(i.name,i),this.passesIndexed[i.index]=i,this.nextIndex++),i},e.getByIndex=function(t){return this.passesIndexed[t]},e.getByName=function(t){return this.passesNamed.get(t)},t}(),th=function(t){function e(){return t.apply(this,arguments)||this}x(e,t);var i=e.prototype;return i.generateKey=function(t){var e="basic";return t.fog&&(e+="_fog"),t.alphaTest&&(e+="_atst"),t.vertexColors&&(e+="_vcol"),t.diffuseMap&&(e+="_diff"),t.skin&&(e+="_skin"),t.screenSpace&&(e+="_ss"),t.useInstancing&&(e+="_inst"),t.useMorphPosition&&(e+="_morphp"),t.useMorphNormal&&(e+="_morphn"),t.useMorphTextureBased&&(e+="_morpht"),e+="_"+t.pass},i.createAttributesDefinition=function(t,e){var i={vertex_position:Ne};e.skin&&(i.vertex_boneWeights=Ve,i.vertex_boneIndices=Ge),e.vertexColors&&(i.vertex_color=He),e.diffuseMap&&(i.vertex_texCoord0=Xe),t.attributes=i},i.createVertexDefinition=function(t,e,i,n){var s=new Map,r=new Map;s.set("shaderPassDefines",n.shaderDefines),s.set("transformDeclVS",Oo.transformDeclVS),s.set("transformVS",Oo.transformVS),s.set("skinCode",Uo.skinCode(t)),i.skin&&r.set("SKIN",!0),i.vertexColors&&r.set("VERTEX_COLORS",!0),i.diffuseMap&&r.set("DIFFUSE_MAP",!0),e.vertexCode='\n\n #include "shaderPassDefines"\n #include "transformDeclVS"\n\n #ifdef SKIN\n #include "skinCode"\n #endif\n\n #include "transformVS"\n\n #ifdef VERTEX_COLORS\n attribute vec4 vertex_color;\n varying vec4 vColor;\n #endif\n\n #ifdef DIFFUSE_MAP\n attribute vec2 vertex_texCoord0;\n varying vec2 vUv0;\n #endif\n\n #ifdef DEPTH_PASS\n varying float vDepth;\n \n #ifndef VIEWMATRIX\n #define VIEWMATRIX\n uniform mat4 matrix_view;\n #endif\n\n #ifndef CAMERAPLANES\n #define CAMERAPLANES\n uniform vec4 camera_params;\n #endif\n #endif\n\n void main(void) {\n gl_Position = getPosition();\n\n #ifdef DEPTH_PASS\n vDepth = -(matrix_view * vec4(getWorldPosition(),1.0)).z * camera_params.x;\n #endif \n\n #ifdef VERTEX_COLORS\n vColor = vertex_color;\n #endif\n\n #ifdef DIFFUSE_MAP\n vUv0 = vertex_texCoord0;\n #endif\n }\n',e.vertexIncludes=s,e.vertexDefines=r},i.createFragmentDefinition=function(t,e,i){var n=new Map,s=new Map;n.set("shaderPassDefines",i.shaderDefines),n.set("fogCode",Uo.fogCode(e.fog)),n.set("alphaTestPS",Oo.alphaTestPS),n.set("packDepthPS",Oo.packDepthPS),e.vertexColors&&s.set("VERTEX_COLORS",!0),e.diffuseMap&&s.set("DIFFUSE_MAP",!0),e.fog&&s.set("FOG",!0),e.alphaTest&&s.set("ALPHA_TEST",!0),t.fragmentCode='\n\n #include "shaderPassDefines"\n\n #ifdef VERTEX_COLORS\n varying vec4 vColor;\n #else\n uniform vec4 uColor;\n #endif\n\n #ifdef DIFFUSE_MAP\n varying vec2 vUv0;\n uniform sampler2D texture_diffuseMap;\n #endif\n\n #ifdef FOG\n #include "fogCode"\n #endif\n\n #ifdef ALPHA_TEST\n #include "alphaTestPS"\n #endif\n\n #ifdef DEPTH_PASS\n varying float vDepth;\n #include "packDepthPS"\n #endif\n\n void main(void) {\n\n #ifdef VERTEX_COLORS\n gl_FragColor = vColor;\n #else\n gl_FragColor = uColor;\n #endif\n\n #ifdef DIFFUSE_MAP\n gl_FragColor *= texture2D(texture_diffuseMap, vUv0);\n #endif\n\n #ifdef ALPHA_TEST\n alphaTest(gl_FragColor.a);\n #endif\n\n #ifndef PICK_PASS\n\n #ifdef DEPTH_PASS\n gl_FragColor = packFloat(vDepth);\n #else\n #ifdef FOG\n glFragColor.rgb = addFog(gl_FragColor.rgb);\n #endif\n #endif\n #endif\n }\n',t.fragmentIncludes=n,t.fragmentDefines=s},i.createShaderDefinition=function(t,e){var i={name:"BasicShader"},n=$o.get(t).getByIndex(e.pass);return this.createAttributesDefinition(i,e),this.createVertexDefinition(t,i,e,n),this.createFragmentDefinition(i,e,n),kr.createDefinition(t,i)},e}(Uo),eh=new th,ih=new Tn;function nh(t){return ih.get(t)}var sh=[];sh[0]={src:1,dst:1,op:2},sh[3]={src:1,dst:0,op:0},sh[2]={src:6,dst:8,op:0},sh[4]={src:1,dst:8,op:0},sh[1]={src:1,dst:1,op:0},sh[6]={src:6,dst:1,op:0},sh[7]={src:4,dst:2,op:0},sh[8]={src:5,dst:1,op:0},sh[5]={src:4,dst:0,op:0},sh[9]={src:1,dst:1,op:3},sh[10]={src:1,dst:1,op:4};var rh=0,ah=function(){function t(){this._shader=null,this.meshInstances=[],this.name="Untitled",this.userId="",this.id=rh++,this.variants=new Map,this.parameters={},this.alphaTest=0,this.alphaToCoverage=!1,this._blendState=new hn,this._depthState=new dn,this.cull=1,this.stencilFront=null,this.stencilBack=null,this._shaderVersion=0,this._scene=null,this.dirty=!0}var e=t.prototype;return e._updateTransparency=function(){for(var t=this.transparent,e=this.meshInstances,i=0;i0,vertexColors:this.vertexColors,diffuseMap:!!this.colorMap,pass:s},c=new ea(a,o,h),u=Bo(t);return u.register("basic",eh),u.getProgram("basic",l,c,this.userId)},e}(ah),hh=function(){function t(t,e,i){this._aabb=new qt,this.origMeshInstances=void 0,this.meshInstance=null,this.dynamic=void 0,this.batchGroupId=void 0,this.origMeshInstances=t,this.dynamic=e,this.batchGroupId=i}var e=t.prototype;return e.destroy=function(t,e){this.meshInstance&&(this.removeFromLayers(t,e),this.meshInstance.destroy(),this.meshInstance=null)},e.addToLayers=function(t,e){for(var i=0;i=0;i--)this.matrices[i].mulAffine2(ch,this.bones[i].getWorldTransform()),this.matrices[i].mulAffine2(this.matrices[i],this.skin.inverseBindPose[i])}},e.updateMatrices=function(t,e){this._updateBeforeCull&&this._updateMatrices(t,e)},e.updateMatrixPalette=function(t,e){this._updateMatrices(t,e);for(var i=this.matrixPalette,n=this.bones.length,s=0;s0){var S=v.array[v.index+x];if(u[S]=!0,e=m.array[m.index],i=m.array[m.index+1],n=m.array[m.index+2],s=c[S],(r=l[S]).x>e&&(r.x=e),r.y>i&&(r.y=i),r.z>n&&(r.z=n),s.xb&&(r.x=b),r.y>T&&(r.y=T),r.z>w&&(r.z=w),s.x0&&this.indexBuffer[0]&&(this._geometryData.indexCount=this.indexBuffer[0].numIndices,this._geometryData.maxIndices=this.indexBuffer[0].numIndices))},i.clear=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this._initGeometryData(),this._geometryData.initDefaults(),this._geometryData.recreate=!0,this._geometryData.maxVertices=i,this._geometryData.maxIndices=n,this._geometryData.verticesUsage=t?0:1,this._geometryData.indicesUsage=e?0:1},i.setVertexStream=function(t,e,i,n,s,r,a){void 0===s&&(s=6),void 0===r&&(r=!1),void 0===a&&(a=!1),this._initGeometryData();var o=n||e.length/i;this._geometryData._changeVertexCount(o,t),this._geometryData.vertexStreamsUpdated=!0,this._geometryData.vertexStreamDictionary[t]=new _h(e,i,s,r,a)},i.getVertexStream=function(t,e){var i=0,n=!1;if(this._geometryData){var s=this._geometryData.vertexStreamDictionary[t];s&&(n=!0,i=this._geometryData.vertexCount,ArrayBuffer.isView(e)?e.set(s.data):(e.length=0,e.push(s.data)))}n||this.vertexBuffer&&(i=new ga(this.vertexBuffer).readData(t,e));return i},i.setPositions=function(t,e,i){void 0===e&&(e=mh.DEFAULT_COMPONENTS_POSITION),this.setVertexStream(Ne,t,e,i,6,!1)},i.setNormals=function(t,e,i){void 0===e&&(e=mh.DEFAULT_COMPONENTS_NORMAL),this.setVertexStream(Ue,t,e,i,6,!1)},i.setUvs=function(t,e,i,n){void 0===i&&(i=mh.DEFAULT_COMPONENTS_UV),this.setVertexStream(We+t,e,i,n,6,!1)},i.setColors=function(t,e,i){void 0===e&&(e=mh.DEFAULT_COMPONENTS_COLORS),this.setVertexStream(He,t,e,i,6,!1)},i.setColors32=function(t,e){this.setVertexStream(He,t,mh.DEFAULT_COMPONENTS_COLORS,e,1,!0)},i.setIndices=function(t,e){this._initGeometryData(),this._geometryData.indexStreamUpdated=!0,this._geometryData.indices=t,this._geometryData.indexCount=e||t.length},i.getPositions=function(t){return this.getVertexStream(Ne,t)},i.getNormals=function(t){return this.getVertexStream(Ue,t)},i.getUvs=function(t,e){return this.getVertexStream(We+t,e)},i.getColors=function(t){return this.getVertexStream(He,t)},i.getIndices=function(t){var e=0;if(this._geometryData&&this._geometryData.indices){var i=this._geometryData.indices;if(e=this._geometryData.indexCount,ArrayBuffer.isView(t))t.set(i);else{t.length=0;for(var n=0,s=i.length;n0&&this.indexBuffer[0])e=this.indexBuffer[0].readData(t)}return e},i.update=function(t,e){if(void 0===t&&(t=4),void 0===e&&(e=!0),this._geometryData){if(e){var i=this._geometryData.vertexStreamDictionary[Ne];i&&3===i.componentCount&&(this._aabb.compute(i.data,this._geometryData.vertexCount),this._aabbVer++)}var n=this._geometryData.recreate;this._geometryData.vertexCount>this._geometryData.maxVertices&&(n=!0,this._geometryData.maxVertices=this._geometryData.vertexCount),n&&this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBuffer=null);var s=this._geometryData.recreate;this._geometryData.indexCount>this._geometryData.maxIndices&&(s=!0,this._geometryData.maxIndices=this._geometryData.indexCount),s&&this.indexBuffer.length>0&&this.indexBuffer[0]&&(this.indexBuffer[0].destroy(),this.indexBuffer[0]=null),this._geometryData.vertexStreamsUpdated&&this._updateVertexBuffer(),this._geometryData.indexStreamUpdated&&this._updateIndexBuffer(),this.primitive[0].type=t,this.indexBuffer.length>0&&this.indexBuffer[0]?this._geometryData.indexStreamUpdated&&(this.primitive[0].count=this._geometryData.indexCount,this.primitive[0].indexed=!0):this._geometryData.vertexStreamsUpdated&&(this.primitive[0].count=this._geometryData.vertexCount,this.primitive[0].indexed=!1),this._geometryData.vertexCount=0,this._geometryData.indexCount=0,this._geometryData.vertexStreamsUpdated=!1,this._geometryData.indexStreamUpdated=!1,this._geometryData.recreate=!1,this.updateRenderStates()}},i._buildVertexFormat=function(t){var e=[];for(var i in this._geometryData.vertexStreamDictionary){var n=this._geometryData.vertexStreamDictionary[i];e.push({semantic:i,components:n.componentCount,type:n.dataType,normalize:n.dataTypeNormalize,asInt:n.asInt})}return new Cn(this.device,e,t)},i._updateVertexBuffer=function(){if(!this.vertexBuffer){var t=this._geometryData.maxVertices,e=this._buildVertexFormat(t);this.vertexBuffer=new yn(this.device,e,t,{usage:this._geometryData.verticesUsage,storage:this._storageVertex})}var i=new ga(this.vertexBuffer),n=this._geometryData.vertexCount;for(var s in this._geometryData.vertexStreamDictionary){var r=this._geometryData.vertexStreamDictionary[s];i.writeData(s,r.data,n),delete this._geometryData.vertexStreamDictionary[s]}i.end()},i._updateIndexBuffer=function(){if(this.indexBuffer.length<=0||!this.indexBuffer[0]){var t=this._geometryData.maxVertices,e=t>65535||0===t?2:1,i=this._storageIndex?{storage:!0}:void 0;this.indexBuffer[0]=new Qr(this.device,e,this._geometryData.maxIndices,this._geometryData.indicesUsage,void 0,i)}var n=this._geometryData.indices;n&&(this.indexBuffer[0].writeData(n,this._geometryData.indexCount),this._geometryData.indices=null)},i.prepareRenderState=function(t){1===t?this.generateWireframe():2===t&&(this.primitive[2]={type:0,base:0,count:this.vertexBuffer?this.vertexBuffer.numVertices:0,indexed:!1})},i.updateRenderStates=function(){this.primitive[2]&&this.prepareRenderState(2),this.primitive[1]&&this.prepareRenderState(1)},i.generateWireframe=function(){this._destroyIndexBuffer(1);var t,e=this.vertexBuffer.numVertices,i=[];if(this.indexBuffer.length>0&&this.indexBuffer[0]){for(var n=[[0,1],[1,2],[2,0]],s=this.primitive[0].base,r=this.primitive[0].count,a=this.indexBuffer[0],o=new Ji[a.format](a.storage),h=new Set,l=s;ld?d*e+u:u*e+d;h.has(f)||(h.add(f),i.push(u,d))}t=a.format}else{for(var p=0;p65535?2:1}var m=new Qr(this.vertexBuffer.device,t,i.length);new Ji[m.format](m.storage).set(i),m.unlock(),this.primitive[1]={type:1,base:0,count:i.length,indexed:!0},this.indexBuffer[1]=m},v(e,[{key:"morph",get:function(){return this._morph},set:function(t){t!==this._morph&&(this._morph&&this._morph.decRefCount(),this._morph=t,t&&t.incRefCount())}},{key:"aabb",get:function(){return this._aabb},set:function(t){this._aabb=t,this._aabbVer++}}])}(fh),gh=new zt,yh=new Ct,xh=new Vt,Sh=new Vt,bh=new Ct,Th=new Ct,wh=new zt,Eh=new Vt,Ah=new Ct,Ch=new zt,Mh=new Vt,Ph=new Vt,Rh=new zt,Ih=new Ct,Dh=new Ct;function Lh(t,e){return t instanceof Function?t:function(i){var n=i[t];return n instanceof Function&&(n=n()),n===e}}function kh(t,e){if(e(t))return t;for(var i=t._children,n=i.length,s=0;s=0?t.insertChild(this,e):t.addChild(this))},i.setLocalEulerAngles=function(t,e,i){this.localRotation.setFromEulerAngles(t,e,i),this._dirtyLocal||this._dirtifyLocal()},i.setLocalPosition=function(t,e,i){t instanceof Ct?this.localPosition.copy(t):this.localPosition.set(t,e,i),this._dirtyLocal||this._dirtifyLocal()},i.setLocalRotation=function(t,e,i,n){t instanceof Vt?this.localRotation.copy(t):this.localRotation.set(t,e,i,n),this._dirtyLocal||this._dirtifyLocal()},i.setLocalScale=function(t,e,i){t instanceof Ct?this.localScale.copy(t):this.localScale.set(t,e,i),this._dirtyLocal||this._dirtifyLocal()},i._dirtifyLocal=function(){this._dirtyLocal||(this._dirtyLocal=!0,this._dirtyWorld||this._dirtifyWorld())},i._unfreezeParentToRoot=function(){for(var t=this._parent;t;)t._frozen=!1,t=t._parent},i._dirtifyWorld=function(){this._dirtyWorld||this._unfreezeParentToRoot(),this._dirtifyWorldInternal()},i._dirtifyWorldInternal=function(){if(!this._dirtyWorld){this._frozen=!1,this._dirtyWorld=!0;for(var t=0;t>16},set:function(t){var e=65535&this._shaderDefs;this._updateShaderDefs(e|t<<16)}},{key:"instancingCount",get:function(){return this.instancingData?this.instancingData.count:0},set:function(t){this.instancingData&&(this.instancingData.count=t)}}])}();function qh(t,e){if(t&&!e)return!1;if(!t&&e)return!1;if((t=t.data)===(e=e.data))return!0;if(t instanceof Float32Array&&e instanceof Float32Array){if(t.length!==e.length)return!1;for(var i=0;i=0&&(n._obj[t].splice(s,1),this.markGroupDirty(e))}},e._extractRender=function(t,e,i,n){return t.render&&(e=n[t.render.batchGroupId]=e.concat(t.render.meshInstances),t.render.removeFromLayers()),e},e._extractModel=function(t,e,i,n){return t.model&&t.model.model&&(e=n[t.model.batchGroupId]=e.concat(t.model.meshInstances),t.model.removeModelFromLayers()),e},e._extractElement=function(t,e,i){if(t.element){var n=!1;t.element._text&&t.element._text._model.meshInstances.length>0?(e.push(t.element._text._model.meshInstances[0]),t.element.removeModelFromLayers(t.element._text._model),n=!0):t.element._image&&(e.push(t.element._image._renderable.meshInstance),t.element.removeModelFromLayers(t.element._image._renderable.model),t.element._image._renderable.unmaskMeshInstance&&(e.push(t.element._image._renderable.unmaskMeshInstance),t.element._image._renderable.unmaskMeshInstance.stencilFront&&t.element._image._renderable.unmaskMeshInstance.stencilBack||(t.element._dirtifyMask(),t.element._onPrerender())),n=!0),n&&(i._ui=!0)}},e._collectAndRemoveMeshInstances=function(t,e){for(var i=0;i0;){u[d]=[p[0]],f=[];var _=p[0].material,v=p[0].layer,g=p[0]._shaderDefs,y=p[0].parameters,x=p[0].stencilFront,S=p[0].mesh.vertexBuffer.getNumVertices(),b=p[0].drawOrder;h.copy(p[0].aabb);var T=Jh(p[0]),w=p[0].mesh.vertexBuffer.format.batchingHash,E=p[0].mesh.primitive[0].indexed;c=null;for(var A=1;A=a){f=f.concat(p.slice(A));break}_!==C.material||v!==C.layer||w!==C.mesh.vertexBuffer.format.batchingHash||E!==C.mesh.primitive[0].indexed||g!==C._shaderDefs||S+C.mesh.vertexBuffer.getNumVertices()>o?m(C):(l.copy(h),l.add(C.aabb),l.halfExtents.x>r||l.halfExtents.y>r||l.halfExtents.z>r?m(C):(!x||(s=C.stencilFront)&&x.func===s.func&&x.zpass===s.zpass)&&T===Jh(C)&&Yh(y,C.parameters)?n&&c&&c.intersects(C.aabb)&&C.drawOrder!==b?m(C):(h.add(C.aabb),S+=C.mesh.vertexBuffer.getNumVertices(),u[d].push(C)):m(C))}d++,p=f}return u},e.collectBatchedMeshData=function(t,e){for(var i=null,n=0,s=0,r=null,a=0;a=3)if(s===Ne)for(var E=0;E0&&r.setIndices(S),r.update(4,!1),e&&((p=p.clone()).chunks.transformVS=this.transformVS,p.chunks.skinTexVS=this.skinTexVS,p.chunks.skinConstVS=this.skinConstVS,p.update());var I=new jh(r,p,this.rootNode);I.castShadow=h.origMeshInstances[0].castShadow,I.parameters=h.origMeshInstances[0].parameters,I.layer=h.origMeshInstances[0].layer,I._shaderDefs=h.origMeshInstances[0]._shaderDefs,I.cull=h.origMeshInstances[0].cull;var D=this._batchGroups[i];if(D&&D._ui&&(I.cull=!1),e){for(var L=[],k=0;k0&&this.generate(this._dirtyGroups);for(var t=0;t1&&(h=be,o=!1));var l=null!=(e=null==(i=s.renderTarget)?void 0:i.depthBuffer)?e:null==(n=s.renderTarget)?void 0:n.colorBuffer;this.shouldReallocate(this.depthRenderTarget,l)&&(this.releaseRenderTarget(this.depthRenderTarget),this.depthRenderTarget=this.allocateRenderTarget(this.depthRenderTarget,s.renderTarget,r,h,o));var c=o?this.depthRenderTarget.depthBuffer:this.depthRenderTarget.colorBuffer;il.forEach((function(t){return r.scope.resolve(t).setValue(c)}))},i.execute=function(){var t=this.device;if(t.isWebGL2&&t.renderTarget.samples>1){var e=t.renderTarget.impl._glFrameBuffer,i=this.depthRenderTarget;t.renderTarget=i,t.updateBegin(),this.depthRenderTarget.impl.internalResolve(t,e,i.impl._glFrameBuffer,this.depthRenderTarget,t.gl.DEPTH_BUFFER_BIT)}else t.copyRenderTarget(t.renderTarget,this.depthRenderTarget,!1,!0)},e}(ta),sl=new vt(254/255,254/255,254/255,254/255),rl=[],al=[[],[],[]],ol=["uSceneDepthMap","uDepthMap"],hl=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this).renderer=i,s.camera=n,s.setupRenderTarget(),s}x(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this),this.renderTarget&&(this.renderTarget.destroyTextureBuffers(),this.renderTarget.destroy(),this.renderTarget=null)},i.update=function(t){this.scene=t},i.setupRenderTarget=function(){var t=new dr(this.device,{name:ol[0],format:7,width:4,height:4,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1}),e=new Dn({name:ol[0]+"RT}",colorBuffer:t,depth:!0,stencil:!1});this.init(e,{}),this.setClearColor(sl),this.setClearDepth(1)},i.before=function(){var t=this.device,e=this.renderTarget.colorBuffer;ol.forEach((function(i){return t.scope.resolve(i).setValue(e)}))},i.execute=function(){for(var t=this.device,e=this.renderer,i=this.camera,n=this.scene,s=this.renderTarget,r=n.layers.layerList,a=n.layers.subLayerEnabled,o=n.layers.subLayerList,h=0;h0,t.blendType=e.blendType,t.screenSpace=n&&!!(n&To),t.skin=n&&!!(2&n),t.useInstancing=n&&!!(n&So),t.useMorphPosition=n&&!!(n&Eo),t.useMorphNormal=n&&!!(n&Ao),t.useMorphTextureBased=n&&!!(n&Co),t.hasTangents=n&&!!(n&wo),t.nineSlicedMode=e.nineSlicedMode||0,e.useLighting&&i.clusteredLightingEnabled?(t.clusteredLightingEnabled=!0,t.clusteredLightingCookiesEnabled=i.lighting.cookiesEnabled,t.clusteredLightingShadowsEnabled=i.lighting.shadowsEnabled,t.clusteredLightingShadowType=i.lighting.shadowType,t.clusteredLightingAreaLightsEnabled=i.lighting.areaLightsEnabled):(t.clusteredLightingEnabled=!1,t.clusteredLightingCookiesEnabled=!1,t.clusteredLightingShadowsEnabled=!1,t.clusteredLightingAreaLightsEnabled=!1)},t.updateMaterialOptions=function(t,e){t.useAmbientTint=!1,t.separateAmbient=!1,t.customFragmentShader=null,t.pixelSnap=e.pixelSnap,t.shadingModel=e.shadingModel,t.ambientSH=e.ambientSH,t.fastTbn=e.fastTbn,t.twoSidedLighting=e.twoSidedLighting,t.occludeDirect=e.occludeDirect,t.occludeSpecular=e.occludeSpecular,t.occludeSpecularFloat=1!==e.occludeSpecularIntensity,t.useMsdf=!1,t.msdfTextAttribute=!1,t.alphaToCoverage=e.alphaToCoverage,t.opacityFadesSpecular=e.opacityFadesSpecular,t.opacityDither=e.opacityDither,t.cubeMapProjection=0,t.conserveEnergy=e.conserveEnergy&&1===e.shadingModel,t.useSpecular=e.hasSpecular,t.useSpecularityFactor=e.hasSpecularityFactor,t.enableGGXSpecular=e.ggxSpecular,t.fresnelModel=e.fresnelModel,t.useRefraction=e.hasRefraction,t.useClearCoat=e.hasClearCoat,t.useSheen=e.hasSheen,t.useIridescence=e.hasIrridescence,t.useMetalness=e.hasMetalness,t.useDynamicRefraction=e.dynamicRefraction,t.dispersion=e.dispersion>0,t.vertexColors=!1,t.lightMapEnabled=e.hasLighting,t.dirLightMapEnabled=e.dirLightMap,t.useHeights=e.hasHeights,t.useNormals=e.hasNormals,t.useClearCoatNormals=e.hasClearCoatNormals,t.useAo=e.hasAo,t.diffuseMapEnabled=e.hasDiffuseMap},t.updateEnvOptions=function(t,e,i){t.fog=e.useFog?i.fog:"none",t.gamma=e.useGammaTonemap?i.gammaCorrection:0,t.toneMap=e.useGammaTonemap?i.toneMapping:-1,t.fixSeams=!1,e.useSkybox&&i.envAtlas&&i.skybox?(t.reflectionSource="envAtlasHQ",t.reflectionEncoding=i.envAtlas.encoding,t.reflectionCubemapEncoding=i.skybox.encoding):e.useSkybox&&i.envAtlas?(t.reflectionSource="envAtlas",t.reflectionEncoding=i.envAtlas.encoding):e.useSkybox&&i.skybox?(t.reflectionSource="cubeMap",t.reflectionEncoding=i.skybox.encoding):(t.reflectionSource=null,t.reflectionEncoding=null),e.ambientSH?(t.ambientSource="ambientSH",t.ambientEncoding=null):t.reflectionSource&&i.envAtlas?(t.ambientSource="envAtlas",t.ambientEncoding=i.envAtlas.encoding):(t.ambientSource="constant",t.ambientEncoding=null);var n=!!t.reflectionSource;t.skyboxIntensity=n,t.useCubeMapRotation=n&&i._skyboxRotationShaderInclude},t.updateLightingOptions=function(e,i,n,s){if(e.lightMapWithoutAmbient=!1,i.useLighting){var r=[],a=n?n>>16:1;e.lightMaskDynamic=!!(1&a),e.lightMapWithoutAmbient=!1,s&&(t.collectLights(0,s[0],r,a),t.collectLights(1,s[1],r,a),t.collectLights(2,s[2],r,a)),e.lights=r}else e.lights=[];(0===e.lights.length||1&n)&&(e.noShadow=!0)},t.collectLights=function(t,e,i,n){for(var s=0;s8?0:1},t.getShaderDefines=function(e){return Il.get(e,(function(){var i=function(t,e,i,n){return Object.keys(e).map((function(t){return"#define "+i+t+" "+e[t]+n})).join("\n")},n=0===t.getLightTextureFormat(e)?"FLOAT":"8BIT",s=e.supportsTextureFetch?"":".5";return"\n \n#define CLUSTER_TEXTURE_"+n+"\n "+i(0,Pl,"CLUSTER_TEXTURE_8_",s)+"\n "+i(0,Rl,"CLUSTER_TEXTURE_F_",s)+"\n "}))};var e=t.prototype;return e.destroy=function(){this.lightsTexture8&&(this.lightsTexture8.destroy(),this.lightsTexture8=null),this.lightsTextureFloat&&(this.lightsTextureFloat.destroy(),this.lightsTextureFloat=null)},e.createTexture=function(t,e,i,n,s){return new dr(t,{name:s,width:e,height:i,mipmaps:!1,format:n,addressU:1,addressV:1,type:_i,magFilter:0,minFilter:0,anisotropy:1})},e.setCompressionRanges=function(t,e){this.invMaxColorValue=1/e,this.invMaxAttenuation=1/t},e.setBounds=function(t,e){this.boundsMin.copy(t),this.boundsDelta.copy(e)},e.uploadTextures=function(){this.lightsTextureFloat&&(this.lightsTextureFloat.lock().set(this.lightsFloat),this.lightsTextureFloat.unlock()),this.lightsTexture8.lock().set(this.lights8),this.lightsTexture8.unlock()},e.updateUniforms=function(){this._lightsTexture8Id.setValue(this.lightsTexture8),0===this.lightTextureFormat&&this._lightsTextureFloatId.setValue(this.lightsTextureFloat),this._lightsTextureInvSizeId.setValue(this._lightsTextureInvSizeData)},e.getSpotDirection=function(t,e){e._node.getWorldTransform().getY(t).mulScalar(-1),t.normalize()},e.getLightAreaSizes=function(t){var e=t._node.getWorldTransform();return e.transformVector(Cl,El),Al[0]=El.x,Al[1]=El.y,Al[2]=El.z,e.transformVector(Ml,El),Al[3]=El.x,Al[4]=El.y,Al[5]=El.z,Al},e.addLightDataFlags=function(t,e,i,n,s,r){t[e+0]=n?255:0,t[e+1]=64*i._shape,t[e+2]=255*i._falloffMode,t[e+3]=s?255*r:0},e.addLightDataColor=function(t,e,i,n,s){var r=this.invMaxColorValue,a=n?i._linearFinalColor:i._finalColor;At.float2Bytes(a[0]*r,t,e+0,2),At.float2Bytes(a[1]*r,t,e+2,2),At.float2Bytes(a[2]*r,t,e+4,2),t[e+6]=s?255:0;var o=!!(1&i.mask),h=!!(2&i.mask);t[e+7]=o&&h?127:h?255:0},e.addLightDataSpotAngles=function(t,e,i){At.float2Bytes(.499999*i._innerConeAngleCos+.5,t,e+0,2),At.float2Bytes(.499999*i._outerConeAngleCos+.5,t,e+2,2)},e.addLightDataShadowBias=function(t,e,i){var n=i.getRenderData(null,0),s=i._getUniformBiasValues(n);At.float2BytesRange(s.bias,t,e,-1,20,2),At.float2Bytes(s.normalBias,t,e+2,2)},e.addLightDataPositionRange=function(t,e,i,n){var s=El.sub2(n,this.boundsMin).div(this.boundsDelta);At.float2Bytes(s.x,t,e+0,4),At.float2Bytes(s.y,t,e+4,4),At.float2Bytes(s.z,t,e+8,4),At.float2Bytes(i.attenuationEnd*this.invMaxAttenuation,t,e+12,4)},e.addLightDataSpotDirection=function(t,e,i){this.getSpotDirection(El,i),At.float2Bytes(.499999*El.x+.5,t,e+0,4),At.float2Bytes(.499999*El.y+.5,t,e+4,4),At.float2Bytes(.499999*El.z+.5,t,e+8,4)},e.addLightDataLightProjMatrix=function(t,e,i){for(var n=i.data,s=0;s<12;s++)At.float2BytesRange(n[s],t,e+4*s,-2,2,4);for(var r=12;r<16;r++)At.float2MantissaExponent(n[r],t,e+4*r,4)},e.addLightDataCookies=function(t,e,i){var n="rgb"===i._cookieChannel;if(t[e+0]=Math.floor(255*i.cookieIntensity),t[e+1]=n?255:0,!n){var s=i._cookieChannel;t[e+4]="rrr"===s?255:0,t[e+5]="ggg"===s?255:0,t[e+6]="bbb"===s?255:0,t[e+7]="aaa"===s?255:0}},e.addLightAtlasViewport=function(t,e,i){At.float2Bytes(i.x,t,e+0,2),At.float2Bytes(i.y,t,e+2,2),At.float2Bytes(i.z/3,t,e+4,2)},e.addLightAreaSizes=function(t,e,i){for(var n=this.getLightAreaSizes(i),s=0;s<6;s++)At.float2MantissaExponent(n[s],t,e+4*s,4)},e.addLightData=function(t,e,i){var n=2===t._type,s=t.atlasViewportAllocated,r=this.cookiesEnabled&&!!t._cookie&&s,a=this.areaLightsEnabled&&0!==t.shape,o=this.shadowsEnabled&&t.castShadows&&s,h=t._node.getPosition(),l=null,c=null;n?o?l=t.getRenderData(null,0).shadowMatrix:r&&(l=wl.evalSpotCookieMatrix(t)):(o||r)&&(c=t.atlasViewport);var u=this.lights8,d=e*this.lightsTexture8.width*4;if(this.addLightDataFlags(u,d+4*Pl.FLAGS,t,n,o,t.shadowIntensity),this.addLightDataColor(u,d+4*Pl.COLOR_A,t,i,r),n&&this.addLightDataSpotAngles(u,d+4*Pl.SPOT_ANGLES,t),t.castShadows&&this.addLightDataShadowBias(u,d+4*Pl.SHADOW_BIAS,t),r&&this.addLightDataCookies(u,d+4*Pl.COOKIE_A,t),0===this.lightTextureFormat){var f=this.lightsFloat,p=e*this.lightsTextureFloat.width*4;if(f[p+4*Rl.POSITION_RANGE+0]=h.x,f[p+4*Rl.POSITION_RANGE+1]=h.y,f[p+4*Rl.POSITION_RANGE+2]=h.z,f[p+4*Rl.POSITION_RANGE+3]=t.attenuationEnd,n&&(this.getSpotDirection(El,t),f[p+4*Rl.SPOT_DIRECTION+0]=El.x,f[p+4*Rl.SPOT_DIRECTION+1]=El.y,f[p+4*Rl.SPOT_DIRECTION+2]=El.z),l)for(var m=l.data,_=0;_<16;_++)f[p+4*Rl.PROJ_MAT_0+_]=m[_];if(c&&(f[p+4*Rl.ATLAS_VIEWPORT+0]=c.x,f[p+4*Rl.ATLAS_VIEWPORT+1]=c.y,f[p+4*Rl.ATLAS_VIEWPORT+2]=c.z/3),a){var v=this.getLightAreaSizes(t);f[p+4*Rl.AREA_DATA_WIDTH+0]=v[0],f[p+4*Rl.AREA_DATA_WIDTH+1]=v[1],f[p+4*Rl.AREA_DATA_WIDTH+2]=v[2],f[p+4*Rl.AREA_DATA_HEIGHT+0]=v[3],f[p+4*Rl.AREA_DATA_HEIGHT+1]=v[4],f[p+4*Rl.AREA_DATA_HEIGHT+2]=v[5]}}else this.addLightDataPositionRange(u,d+4*Pl.POSITION_X,t,h),n&&this.addLightDataSpotDirection(u,d+4*Pl.SPOT_DIRECTION_X,t),l&&this.addLightDataLightProjMatrix(u,d+4*Pl.PROJ_MAT_00,l),c&&this.addLightAtlasViewport(u,d+4*Pl.ATLAS_VIEWPORT_A,c),a&&this.addLightAreaSizes(u,d+4*Pl.AREA_DATA_WIDTH_X,t)},t}(),Ll={vertex_normal:Ue,vertex_tangent:ze,vertex_texCoord0:Xe,vertex_texCoord1:je,vertex_color:He,vertex_boneWeights:Ve,vertex_boneIndices:Ge},kl={vVertexColor:"vec4",vPositionW:"vec3",vNormalV:"vec3",vNormalW:"vec3",vTangentW:"vec3",vBinormalW:"vec3",vObjectSpaceUpW:"vec3",vUv0:"vec2",vUv1:"vec2"},Ol=function(){function t(t,e){if(this.device=t,this.options=e,this.attributes={vertex_position:Ne},e.userAttributes)for(var i=0,n=Object.entries(e.userAttributes);i=0&&(this.attributes[c]=Ll[c]);this.chunks[h]=l}}else this.chunks=Oo;this.shaderPassInfo=$o.get(this.device).getByIndex(e.pass),this.shadowPass=this.shaderPassInfo.isShadow,this.lighting=e.lights.length>0||e.dirLightMapEnabled||e.clusteredLightingEnabled,this.reflections=!!e.reflectionSource,this.needsNormal=this.lighting||this.reflections||e.useSpecular||e.ambientSH||e.useHeights||e.enableGGXSpecular||e.clusteredLightingEnabled&&!this.shadowPass||e.useClearCoatNormals,this.needsNormal=this.needsNormal&&!this.shadowPass,this.needsSceneColor=e.useDynamicRefraction,this.needsScreenSize=e.useDynamicRefraction,this.needsTransforms=e.useDynamicRefraction,this.varyings="",this.varyingDefines="",this.vshader=null,this.frontendDecl=null,this.frontendCode=null,this.frontendFunc=null,this.lightingUv=null,this.defines=[],this.fshader=null}var e=t.prototype;return e._vsAddBaseCode=function(t,e,i){return t+=e.baseVS,1!==i.nineSlicedMode&&2!==i.nineSlicedMode||(t+=e.baseNineSlicedVS),t},e._vsAddTransformCode=function(t,e,i,n){return t+=this.chunks.transformVS},e._setMapTransform=function(t,e,i,n){var s=i+100*n;if(!t[3][s]){var r="texture_"+e+"MapTransform";t[0]+="uniform vec3 "+r+"0;\n",t[0]+="uniform vec3 "+r+"1;\n",t[1]+="varying vec2 vUV"+n+"_"+i+";\n",t[2]+=" vUV"+n+"_"+i+" = vec2(dot(vec3(uv"+n+", 1), "+r+"0), dot(vec3(uv"+n+", 1), "+r+"1));\n",t[3][s]=!0}return t},e._fsGetBaseCode=function(){var t=this.options,e=this.chunks,i=this.chunks.basePS;return 1===t.nineSlicedMode?i+=e.baseNineSlicedPS:2===t.nineSlicedMode&&(i+=e.baseNineSlicedTiledPS),i},e._fsGetStartCode=function(t,e,i,n){var s=i.startPS;return 1===n.nineSlicedMode?s+=i.startNineSlicedPS:2===n.nineSlicedMode&&(s+=i.startNineSlicedTiledPS),s},e._getLightSourceShapeString=function(t){switch(t){case 1:return"Rect";case 2:return"Disk";case 3:return"Sphere";default:return""}},e.generateVertexShader=function(t,e,i){var n=this,s=this.device,r=this.options,a=this.chunks,o="",h="";o=this._vsAddBaseCode(o,a,r),h+=" vPositionW = getWorldPosition();\n",2!==this.options.pass&&5!==this.options.pass||(o+="varying float vDepth;\n",o+="#ifndef VIEWMATRIX\n",o+="#define VIEWMATRIX\n",o+="uniform mat4 matrix_view;\n",o+="#endif\n",o+="#ifndef CAMERAPLANES\n",o+="#define CAMERAPLANES\n",o+="uniform vec4 camera_params;\n\n",o+="#endif\n",h+=" vDepth = -(matrix_view * vec4(vPositionW,1.0)).z * camera_params.x;\n"),this.options.pass,this.options.useInstancing&&(this.attributes.instance_line1=di,this.attributes.instance_line2=fi,this.attributes.instance_line3=pi,this.attributes.instance_line4=mi,o+=a.instancingVS),this.needsNormal&&(this.attributes.vertex_normal=Ue,h+=" vNormalW = getNormal();\n","sphereMap"===r.reflectionSource&&s.fragmentUniformsCount<=16&&(o+=a.viewNormalVS,h+=" vNormalV = getViewNormal();\n"),r.hasTangents&&(r.useHeights||r.useNormals||r.enableGGXSpecular)?(this.attributes.vertex_tangent=ze,o+=a.tangentBinormalVS,h+=" vTangentW = getTangent();\n",h+=" vBinormalW = getBinormal();\n"):!r.enableGGXSpecular&&s.extStandardDerivatives||(h+=" vObjectSpaceUpW = normalize(dNormalMatrix * vec3(0, 1, 0));\n"));for(var l=0;l<2;l++)t[l]&&(this.attributes["vertex_texCoord"+l]="TEXCOORD"+l,o+=a["uv"+l+"VS"],h+=" vec2 uv"+l+" = getUv"+l+"();\n"),e[l]&&(h+=" vUv"+l+" = uv"+l+";\n");var c=[o,this.varyings,h,[]];if(i.forEach((function(t){n._setMapTransform(c,t.name,t.id,t.uv)})),o=c[0],this.varyings=c[1],h=c[2],r.vertexColors&&(this.attributes.vertex_color=He,h+=" vVertexColor = vertex_color;\n"),r.useMsdf&&r.msdfTextAttribute&&(this.attributes.vertex_outlineParameters=hi,this.attributes.vertex_shadowParameters=li,h+=" unpackMsdfParams();\n",o+=a.msdfVS),r.useMorphPosition||r.useMorphNormal)if(r.useMorphTextureBased){o+="#define MORPHING_TEXTURE_BASED\n",r.useMorphPosition&&(o+="#define MORPHING_TEXTURE_BASED_POSITION\n"),r.useMorphNormal&&(o+="#define MORPHING_TEXTURE_BASED_NORMAL\n"),this.attributes.morph_vertex_id=mi;var u=s.isWebGPU?"uint":"float";o+="attribute "+u+" morph_vertex_id;\n"}else o+="#define MORPHING\n",r.useMorphPosition?(this.attributes.morph_pos0=hi,this.attributes.morph_pos1=li,this.attributes.morph_pos2=ci,this.attributes.morph_pos3=ui,o+="#define MORPHING_POS03\n",o+="attribute vec3 morph_pos0;\n",o+="attribute vec3 morph_pos1;\n",o+="attribute vec3 morph_pos2;\n",o+="attribute vec3 morph_pos3;\n"):r.useMorphNormal&&(this.attributes.morph_nrm0=hi,this.attributes.morph_nrm1=li,this.attributes.morph_nrm2=ci,this.attributes.morph_nrm3=ui,o+="#define MORPHING_NRM03\n",o+="attribute vec3 morph_nrm0;\n",o+="attribute vec3 morph_nrm1;\n",o+="attribute vec3 morph_nrm2;\n",o+="attribute vec3 morph_nrm3;\n"),r.useMorphNormal?(this.attributes.morph_nrm4=di,this.attributes.morph_nrm5=fi,this.attributes.morph_nrm6=pi,this.attributes.morph_nrm7=mi,o+="#define MORPHING_NRM47\n",o+="attribute vec3 morph_nrm4;\n",o+="attribute vec3 morph_nrm5;\n",o+="attribute vec3 morph_nrm6;\n",o+="attribute vec3 morph_nrm7;\n"):(this.attributes.morph_pos4=di,this.attributes.morph_pos5=fi,this.attributes.morph_pos6=pi,this.attributes.morph_pos7=mi,o+="#define MORPHING_POS47\n",o+="attribute vec3 morph_pos4;\n",o+="attribute vec3 morph_pos5;\n",o+="attribute vec3 morph_pos6;\n",o+="attribute vec3 morph_pos7;\n");r.skin?(this.attributes.vertex_boneWeights=Ve,this.attributes.vertex_boneIndices=Ge,o+=Uo.skinCode(s,a),o+="#define SKIN\n"):r.useInstancing&&(o+="#define INSTANCING\n"),r.screenSpace&&(o+="#define SCREENSPACE\n"),r.pixelSnap&&(o+="#define PIXELSNAP\n"),o=this._vsAddTransformCode(o,s,a,r),this.needsNormal&&(o+=a.normalVS),o+="\n",o+=a.startVS,o+=h,o+=a.endVS,o+="}",Object.keys(kl).forEach((function(t){o.indexOf(t)>=0&&(n.varyings+="varying "+kl[t]+" "+t+";\n",n.varyingDefines+="#define VARYING_"+t.toUpperCase()+"\n")}));var d=this.shaderPassInfo.shaderDefines;this.vshader=d+this.varyings+o},e._fsGetBeginCode=function(){for(var t=this.shaderPassInfo.shaderDefines,e=0;e0&&this.defines.push("LIT_SPECULAR_FRESNEL"),e.conserveEnergy&&this.defines.push("LIT_CONSERVE_ENERGY"),e.useSheen&&this.defines.push("LIT_SHEEN"),e.useIridescence&&this.defines.push("LIT_IRIDESCENCE"));var o=[],h=0,l=!1,c=!1,u=!1,d=e.lights.some((function(t){return t._shape&&0!==t._shape}));if(e.clusteredLightingEnabled&&e.clusteredLightingAreaLightsEnabled&&(d=!0),d||e.clusteredLightingEnabled){var f="highp";7===t.areaLightLutFormat&&(n.append("#define AREA_R8_G8_B8_A8_LUTS"),f="lowp"),n.append("#define AREA_LIGHTS"),n.append("uniform "+f+" sampler2D areaLightsLutTex1;"),n.append("uniform "+f+" sampler2D areaLightsLutTex2;")}for(var p=0;p0?i.cubeMapProjectBoxPS:i.cubeMapProjectNonePS),s.append(e.skyboxIntensity?i.envMultiplyPS:i.envConstPS)),(this.lighting&&e.useSpecular||this.reflections)&&(e.useMetalness&&s.append(i.metalnessModulatePS),2===e.fresnelModel&&s.append(i.fresnelSchlickPS),e.useIridescence&&s.append(i.iridescenceDiffractionPS)),e.useAo)switch(s.append(i.aoDiffuseOccPS),e.occludeSpecular){case 1:s.append(e.occludeSpecularFloat?i.aoSpecOccSimplePS:i.aoSpecOccConstSimplePS);break;case 2:s.append(e.occludeSpecularFloat?i.aoSpecOccPS:i.aoSpecOccConstPS)}"envAtlasHQ"===e.reflectionSource?(s.append(e.fixSeams?i.fixCubemapSeamsStretchPS:i.fixCubemapSeamsNonePS),s.append(i.envAtlasPS),s.append(i.reflectionEnvHQPS.replace(/\$DECODE_CUBEMAP/g,xl.decodeFunc(e.reflectionCubemapEncoding)).replace(/\$DECODE/g,xl.decodeFunc(e.reflectionEncoding)))):"envAtlas"===e.reflectionSource?(s.append(i.envAtlasPS),s.append(i.reflectionEnvPS.replace(/\$DECODE/g,xl.decodeFunc(e.reflectionEncoding)))):"cubeMap"===e.reflectionSource?(s.append(e.fixSeams?i.fixCubemapSeamsStretchPS:i.fixCubemapSeamsNonePS),s.append(i.reflectionCubePS.replace(/\$DECODE/g,xl.decodeFunc(e.reflectionEncoding)))):"sphereMap"===e.reflectionSource&&s.append(i.reflectionSpherePS.replace(/\$DECODE/g,xl.decodeFunc(e.reflectionEncoding))),this.reflections&&(e.useClearCoat&&s.append(i.reflectionCCPS),e.useSheen&&s.append(i.reflectionSheenPS)),e.useRefraction&&(e.useDynamicRefraction?(e.dispersion&&(n.append("uniform float material_dispersion;"),n.append("#define DISPERSION\n")),s.append(i.refractionDynamicPS)):this.reflections&&s.append(i.refractionCubePS)),e.useSheen&&s.append(i.lightSheenPS),e.clusteredLightingEnabled&&(s.append(i.clusteredLightUtilsPS),e.clusteredLightingCookiesEnabled&&s.append(i.clusteredLightCookiesPS),e.clusteredLightingShadowsEnabled&&!e.noShadow&&(o[0]=!0,o[4]=!0,o[6]=!0)),(h>0||e.clusteredLightingEnabled)&&(l&&s.append(i.shadowCascadesPS),(o[5]||o[0])&&s.append(i.shadowStandardPS),o[4]&&!t.isWebGL1&&s.append(i.shadowStandardGL2PS),c&&(s.append(i.shadowVSM_commonPS),o[1]&&s.append(i.shadowVSM8PS),o[2]&&s.append(t.extTextureHalfFloatLinear?i.shadowEVSMPS.replace(/\$/g,"16"):i.shadowEVSMnPS.replace(/\$/g,"16")),o[3]&&s.append(t.extTextureFloatLinear?i.shadowEVSMPS.replace(/\$/g,"32"):i.shadowEVSMnPS.replace(/\$/g,"32"))),u&&(s.append(i.linearizeDepthPS),s.append(i.shadowPCSSPS)),t.isWebGL2||t.isWebGPU||t.extStandardDerivatives||s.append(i.biasConstPS)),e.enableGGXSpecular&&s.append("uniform float material_anisotropy;"),this.lighting&&(s.append(i.lightDiffuseLambertPS),(d||e.clusteredLightingAreaLightsEnabled)&&s.append(i.ltcPS));var y=!1;e.useSpecular&&(this.lighting&&s.append(0===e.shadingModel?i.lightSpecularPhongPS:e.enableGGXSpecular?i.lightSpecularAnisoGGXPS:i.lightSpecularBlinnPS),e.fresnelModel||this.reflections||e.diffuseMapEnabled||(n.append("uniform vec3 material_ambient;"),n.append("#define LIT_OLD_AMBIENT"),y=!0)),s.append(i.combinePS),e.lightMapEnabled&&s.append(e.useSpecular&&e.dirLightMapEnabled?i.lightmapDirAddPS:i.lightmapAddPS);var x=!e.lightMapEnabled||e.lightMapWithoutAmbient;x&&("ambientSH"===e.ambientSource?s.append(i.ambientSHPS):"envAtlas"===e.ambientSource?("envAtlas"!==e.reflectionSource&&"envAtlasHQ"!==e.reflectionSource&&s.append(i.envAtlasPS),s.append(i.ambientEnvPS.replace(/\$DECODE/g,xl.decodeFunc(e.ambientEncoding)))):s.append(i.ambientConstantPS)),e.useAmbientTint&&!y&&n.append("uniform vec3 material_ambient;"),e.useMsdf&&(e.msdfTextAttribute||n.append("#define UNIFORM_TEXT_PARAMETERS"),s.append(i.msdfPS)),this.needsNormal&&(s.append(i.viewDirPS),e.useSpecular&&s.append(e.enableGGXSpecular?i.reflDirAnisoPS:i.reflDirPS));var S,b=!1,T=!1,w=!1,E=!1,A=!1;if(e.clusteredLightingEnabled&&this.lighting&&(E=!0,b=!0,T=!0,A=!0,s.append(i.floatUnpackingPS),e.lightMaskDynamic&&n.append("#define CLUSTER_MESH_DYNAMIC_LIGHTS"),e.clusteredLightingCookiesEnabled&&n.append("#define CLUSTER_COOKIES"),e.clusteredLightingShadowsEnabled&&!e.noShadow&&(n.append("#define CLUSTER_SHADOWS"),n.append("#define CLUSTER_SHADOW_TYPE_"+yo[e.clusteredLightingShadowType])),e.clusteredLightingAreaLightsEnabled&&n.append("#define CLUSTER_AREALIGHTS"),n.append(Dl.getShaderDefines(t)),e.clusteredLightingShadowsEnabled&&!e.noShadow&&s.append(i.clusteredLightShadowsPS),s.append(i.clusteredLightPS)),a.append(this._fsGetStartCode(a,t,i,e)),this.needsNormal&&(a.append(" dVertexNormalW = normalize(vNormalW);"),(e.useHeights||e.useNormals)&&e.hasTangents&&(a.append(" dTangentW = vTangentW;"),a.append(" dBinormalW = vBinormalW;")),a.append(" getViewDir();"),g&&(a.append(" getTBN(dTangentW, dBinormalW, dVertexNormalW);"),e.twoSidedLighting&&a.append(" handleTwoSidedLighting();"))),a.append(this.frontendFunc),this.needsNormal&&(e.useSpecular&&r.append(" getReflDir(litArgs_worldNormal, dViewDirW, litArgs_gloss, dTBN);"),e.useClearCoat&&r.append(" ccReflDirW = normalize(-reflect(dViewDirW, litArgs_clearcoat_worldNormal));")),(this.lighting&&e.useSpecular||this.reflections)&&(e.useMetalness&&(r.append(" float f0 = 1.0 / litArgs_ior; f0 = (f0 - 1.0) / (f0 + 1.0); f0 *= f0;"),r.append(" litArgs_specularity = getSpecularModulate(litArgs_specularity, litArgs_albedo, litArgs_metalness, f0);"),r.append(" litArgs_albedo = getAlbedoModulate(litArgs_albedo, litArgs_metalness);")),e.useIridescence&&r.append(" vec3 iridescenceFresnel = getIridescence(saturate(dot(dViewDirW, litArgs_worldNormal)), litArgs_specularity, litArgs_iridescence_thickness);")),x&&(r.append(" addAmbient(litArgs_worldNormal);"),e.conserveEnergy&&e.useSpecular&&r.append(" dDiffuseLight = dDiffuseLight * (1.0 - litArgs_specularity);"),e.separateAmbient&&r.append("\n vec3 dAmbientLight = dDiffuseLight;\n dDiffuseLight = vec3(0);\n ")),e.useAmbientTint&&!y&&r.append(" dDiffuseLight *= material_ambient;"),e.useAo&&!e.occludeDirect&&r.append(" occludeDiffuse(litArgs_ao);"),e.lightMapEnabled&&r.append(" addLightMap(\n litArgs_lightmap, \n litArgs_lightmapDir, \n litArgs_worldNormal, \n dViewDirW, \n dReflDirW, \n litArgs_gloss, \n litArgs_specularity, \n dVertexNormalW,\n dTBN\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel,\n litArgs_iridescence_intensity\n #endif\n );"),this.lighting||this.reflections){this.reflections&&(e.useClearCoat&&(r.append(" addReflectionCC(ccReflDirW, litArgs_clearcoat_gloss);"),e.fresnelModel>0?(r.append(" ccFresnel = getFresnelCC(dot(dViewDirW, litArgs_clearcoat_worldNormal));"),r.append(" ccReflection.rgb *= ccFresnel;")):r.append(" ccFresnel = 0.0;")),e.useSpecularityFactor&&r.append(" ccReflection.rgb *= litArgs_specularityFactor;"),e.useSheen&&r.append(" addReflectionSheen(litArgs_worldNormal, dViewDirW, litArgs_sheen_gloss);"),r.append(" addReflection(dReflDirW, litArgs_gloss);"),e.fresnelModel>0?r.append(" dReflection.rgb *= \n getFresnel(\n dot(dViewDirW, litArgs_worldNormal), \n litArgs_gloss, \n litArgs_specularity\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel,\n litArgs_iridescence_intensity\n #endif\n );"):r.append(" dReflection.rgb *= litArgs_specularity;"),e.useSpecularityFactor&&r.append(" dReflection.rgb *= litArgs_specularityFactor;")),d&&(r.append(" dSpecularLight *= litArgs_specularity;"),e.useSpecular&&r.append(" calcLTCLightValues(litArgs_gloss, litArgs_worldNormal, dViewDirW, litArgs_specularity, litArgs_clearcoat_gloss, litArgs_clearcoat_worldNormal, litArgs_clearcoat_specularity);"));for(var C=0;C 0.00001) {"),2===P&&(S&&!M._cookieFalloff||(r.append(" dAtten *= getSpotEffect(light"+C+"_direction, light"+C+"_innerConeAngle, light"+C+"_outerConeAngle, dLightDirNormW);"),E=!0))),0!==R?0===P?r.append(" dAttenD = getLightDiffuse(litArgs_worldNormal, dViewDirW, dLightDirW, dLightDirNormW);"):r.append(" dAttenD = get"+I+"LightDiffuse(litArgs_worldNormal, dViewDirW, dLightDirW, dLightDirNormW) * 16.0;"):r.append(" dAtten *= getLightDiffuse(litArgs_worldNormal, dViewDirW, dLightDirW, dLightDirNormW);"),M.castShadows&&!e.noShadow){var D=6===M._shadowType,L=1===M._shadowType||2===M._shadowType||3===M._shadowType,k=5===M._shadowType||0===M._shadowType||4===M._shadowType,O=null,F=void 0;switch(M._shadowType){case 1:O="VSM8",F="0.0";break;case 2:O="VSM16",F="5.54";break;case 3:O="VSM32",F=t.textureFloatHighPrecision?"15.0":"5.54";break;case 5:O="PCF1x1";break;case 4:O="PCF5x5";break;case 6:O="PCSS";break;default:O="PCF3x3"}if(null!==O){M._normalOffsetBias&&!M._isVsm&&s.append("#define SHADOW_SAMPLE_NORMAL_OFFSET"),0===P&&s.append("#define SHADOW_SAMPLE_ORTHO"),((k||D)&&t.isWebGL2||t.isWebGPU||t.extStandardDerivatives)&&s.append("#define SHADOW_SAMPLE_SOURCE_ZBUFFER"),1===P&&s.append("#define SHADOW_SAMPLE_POINT");var B=i.shadowSampleCoordPS;s.append(B.replace("$LIGHT",C)),s.append("#undef SHADOW_SAMPLE_NORMAL_OFFSET"),s.append("#undef SHADOW_SAMPLE_ORTHO"),s.append("#undef SHADOW_SAMPLE_SOURCE_ZBUFFER"),s.append("#undef SHADOW_SAMPLE_POINT");var N="light"+C+"_shadowMatrix";0===P&&M.numCascades>1&&(r.append(" getShadowCascadeMatrix(light"+C+"_shadowMatrixPalette, light"+C+"_shadowCascadeDistances, light"+C+"_shadowCascadeCount);"),N="cascadeShadowMat"),r.append(" dShadowCoord = getShadowSampleCoord"+C+"("+N+", light"+C+"_shadowParams, vPositionW, dLightPosW, dLightDirW, dLightDirNormW, dVertexNormalW);"),0===P&&r.append(" fadeShadow(light"+C+"_shadowCascadeDistances);");var U="SHADOWMAP_PASS(light"+C+"_shadowMap), dShadowCoord, light"+C+"_shadowParams";if(L)U=U+", "+F+", dLightDirW";else if(D){var z="vec2(light"+C+"_shadowSearchArea)";0!==R&&(z="vec2(length(light"+C+"_halfWidth), length(light"+C+"_halfHeight)) * light"+C+"_shadowSearchArea"),U=U+", light"+C+"_cameraParams, "+z+", dLightDirW"}1===P?(O="Point"+O,D||(U+=", dLightDirW")):2===P&&(O="Spot"+O),r.append(" float shadow"+C+" = getShadow"+O+"("+U+");"),r.append(" dAtten *= mix(1.0, shadow"+C+", light"+C+"_shadowIntensity);")}}if(0!==R?e.conserveEnergy&&e.useSpecular?r.append(" dDiffuseLight += ((dAttenD * dAtten) * light"+C+"_color"+(S?" * dAtten3":"")+") * (1.0 - dLTCSpecFres);"):r.append(" dDiffuseLight += (dAttenD * dAtten) * light"+C+"_color"+(S?" * dAtten3":"")+";"):d&&e.conserveEnergy&&e.useSpecular?r.append(" dDiffuseLight += (dAtten * light"+C+"_color"+(S?" * dAtten3":"")+") * (1.0 - litArgs_specularity);"):r.append(" dDiffuseLight += dAtten * light"+C+"_color"+(S?" * dAtten3":"")+";"),e.useSpecular&&r.append(" dHalfDirW = normalize(-dLightDirNormW + dViewDirW);"),M.affectSpecularity)if(0!==R)e.useClearCoat&&r.append(" ccSpecularLight += ccLTCSpecFres * get"+I+"LightSpecular(litArgs_clearcoat_worldNormal, dViewDirW) * dAtten * light"+C+"_color"+(S?" * dAtten3":"")+";"),e.useSpecular&&r.append(" dSpecularLight += dLTCSpecFres * get"+I+"LightSpecular(litArgs_worldNormal, dViewDirW) * dAtten * light"+C+"_color"+(S?" * dAtten3":"")+";");else{var V=!1;0===P&&e.fresnelModel>0&&(V=!0),e.useClearCoat&&r.append(" ccSpecularLight += getLightSpecular(dHalfDirW, ccReflDirW, litArgs_clearcoat_worldNormal, dViewDirW, dLightDirNormW, litArgs_clearcoat_gloss, dTBN) * dAtten * light"+C+"_color"+(S?" * dAtten3":"")+(V?" * getFresnelCC(dot(dViewDirW, dHalfDirW));":";")),e.useSheen&&r.append(" sSpecularLight += getLightSpecularSheen(dHalfDirW, litArgs_worldNormal, dViewDirW, dLightDirNormW, litArgs_sheen_gloss) * dAtten * light"+C+"_color"+(S?" * dAtten3;":";")),e.useSpecular&&r.append(" dSpecularLight += getLightSpecular(dHalfDirW, dReflDirW, litArgs_worldNormal, dViewDirW, dLightDirNormW, litArgs_gloss, dTBN) * dAtten * light"+C+"_color"+(S?" * dAtten3":"")+(V?" \n * getFresnel(\n dot(dViewDirW, dHalfDirW), \n litArgs_gloss, \n litArgs_specularity\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel, \n litArgs_iridescence_intensity\n #endif\n );":"* litArgs_specularity;"))}0!==P&&r.append(" }")}}e.clusteredLightingEnabled&&this.lighting&&(T=!0,w=!0,b=!0,r.append(" addClusteredLights(\n litArgs_worldNormal, \n dViewDirW, \n dReflDirW,\n #if defined(LIT_CLEARCOAT)\n ccReflDirW,\n #endif\n litArgs_gloss, \n litArgs_specularity, \n dVertexNormalW, \n dTBN, \n #if defined(LIT_IRIDESCENCE)\n iridescenceFresnel,\n #endif\n litArgs_clearcoat_worldNormal, \n litArgs_clearcoat_gloss,\n litArgs_sheen_gloss,\n litArgs_iridescence_intensity\n );")),d&&(e.useClearCoat&&r.append(" litArgs_clearcoat_specularity = 1.0;"),e.useSpecular&&r.append(" litArgs_specularity = vec3(1);")),e.useRefraction&&r.append(" addRefraction(\n litArgs_worldNormal, \n dViewDirW, \n litArgs_thickness, \n litArgs_gloss, \n litArgs_specularity, \n litArgs_albedo, \n litArgs_transmission,\n litArgs_ior,\n litArgs_dispersion\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel, \n litArgs_iridescence_intensity\n #endif\n );")}e.useAo&&(e.occludeDirect&&r.append(" occludeDiffuse(litArgs_ao);"),1!==e.occludeSpecular&&2!==e.occludeSpecular||r.append(" occludeSpecular(litArgs_gloss, litArgs_ao, litArgs_worldNormal, dViewDirW);")),e.useSpecularityFactor&&r.append(" dSpecularLight *= litArgs_specularityFactor;"),!1===e.opacityFadesSpecular&&(2!==e.blendType&&4!==e.blendType||(r.append("float specLum = dot((dSpecularLight + dReflection.rgb * dReflection.a), vec3( 0.2126, 0.7152, 0.0722 ));"),r.append("#ifdef LIT_CLEARCOAT\n specLum += dot(ccSpecularLight * litArgs_clearcoat_specularity + ccReflection.rgb * litArgs_clearcoat_specularity, vec3( 0.2126, 0.7152, 0.0722 ));\n#endif"),r.append("litArgs_opacity = clamp(litArgs_opacity + gammaCorrectInput(specLum), 0.0, 1.0);")),r.append("litArgs_opacity *= material_alphaFade;")),r.append(i.endPS),2===e.blendType||6===e.blendType||e.alphaToCoverage?r.append(i.outputAlphaPS):4===e.blendType?r.append(i.outputAlphaPremulPS):r.append(i.outputAlphaOpaquePS),e.useMsdf&&r.append(" gl_FragColor = applyMsdf(gl_FragColor);"),r.append(i.outputPS),r.append(i.debugOutputPS),b&&s.prepend(i.lightDirPointPS),T&&s.prepend(i.falloffLinearPS),w&&s.prepend(i.falloffInvSquaredPS),E&&s.prepend(i.spotPS),A&&!e.clusteredLightingEnabled&&s.prepend(i.cookiePS);var G="",H="void evaluateBackend() {\n"+r.code+"\n}";s.append(H),a.append(i.debugProcessFrontendPS),a.append(" evaluateBackend();"),a.append(Uo.end());var W=n.code+s.code+a.code;return W.includes("dTBN")&&(G+="mat3 dTBN;\n"),W.includes("dVertexNormalW")&&(G+="vec3 dVertexNormalW;\n"),W.includes("dTangentW")&&(G+="vec3 dTangentW;\n"),W.includes("dBinormalW")&&(G+="vec3 dBinormalW;\n"),W.includes("dViewDirW")&&(G+="vec3 dViewDirW;\n"),W.includes("dReflDirW")&&(G+="vec3 dReflDirW;\n"),W.includes("dHalfDirW")&&(G+="vec3 dHalfDirW;\n"),W.includes("ccReflDirW")&&(G+="vec3 ccReflDirW;\n"),W.includes("dLightDirNormW")&&(G+="vec3 dLightDirNormW;\n"),W.includes("dLightDirW")&&(G+="vec3 dLightDirW;\n"),W.includes("dLightPosW")&&(G+="vec3 dLightPosW;\n"),W.includes("dShadowCoord")&&(G+="vec3 dShadowCoord;\n"),W.includes("dReflection")&&(G+="vec4 dReflection;\n"),W.includes("dDiffuseLight")&&(G+="vec3 dDiffuseLight;\n"),W.includes("dSpecularLight")&&(G+="vec3 dSpecularLight;\n"),W.includes("dAtten")&&(G+="float dAtten;\n"),W.includes("dAttenD")&&(G+="float dAttenD;\n"),W.includes("dAtten3")&&(G+="vec3 dAtten3;\n"),W.includes("dMsdf")&&(G+="vec4 dMsdf;\n"),W.includes("ccFresnel")&&(G+="float ccFresnel;\n"),W.includes("ccReflection")&&(G+="vec3 ccReflection;\n"),W.includes("ccSpecularLight")&&(G+="vec3 ccSpecularLight;\n"),W.includes("ccSpecularityNoFres")&&(G+="float ccSpecularityNoFres;\n"),W.includes("sSpecularLight")&&(G+="vec3 sSpecularLight;\n"),W.includes("sReflection")&&(G+="vec3 sReflection;\n"),this._fsGetBeginCode()+this.varyings+this.varyingDefines+this._fsGetBaseCode()+G+this.frontendDecl+W},e.generateFragmentShader=function(t,e,i,n){var s,r=this.options;this.frontendDecl=t,this.frontendCode=e,this.frontendFunc=i,this.lightingUv=n,3===r.pass?this.fshader=this._fsGetPickPassCode():2===r.pass?this.fshader=this._fsGetDepthPassCode():5===r.pass?this.fshader=this._fsGetPrePassVelocityCode():this.shadowPass?this.fshader=this._fsGetShadowPassCode():r.customFragmentShader?this.fshader=this._fsGetBeginCode()+r.customFragmentShader:this.fshader=this._fsGetLitPassCode(),null==(s=this.handleCompatibility)||s.call(this)},e.getDefinition=function(){var t=kr.createDefinition(this.device,{name:"LitShader",attributes:this.attributes,vertexCode:this.vshader,fragmentCode:this.fshader});return this.shaderPassInfo.isForward&&(t.tag=1),t},t}(),Fl={generateKey:function(t){return"lit"+Object.keys(t).sort().map((function(e){return"chunks"===e?Fl.generateChunksKey(t):"lights"===e?Fl.generateLightsKey(t):e+t[e]})).join("\n")},generateLightsKey:function(t){return"lights:"+t.lights.map((function(e){return t.clusteredLightingEnabled&&0!==e._type?"":e.key+","})).join("")},generateChunksKey:function(t){var e;return"chunks:\n"+Object.keys(null!=(e=t.chunks)?e:{}).sort().map((function(e){return e+t.chunks[e]})).join("")}},Bl=[0,1,2,3,4,5,6,7],Nl=function(t){function e(){return t.apply(this,arguments)||this}x(e,t);var i=e.prototype;return i.generateKey=function(t){return"lit"+Bl.map((function(e,i){return t.usedUvs[i]?"1":"0"})).join("")+t.shaderChunk+Fl.generateKey(t.litOptions)},i.createShaderDefinition=function(t,e){var i=new Ol(t,e.litOptions),n=new vl,s=new vl,r=new vl;n.append("uniform float textureBias;"),n.append(i.chunks.litShaderArgsPS),s.append(e.shaderChunk),r.code="evaluateFrontend();",r.code="\n"+r.code.split("\n").map((function(t){return" "+t})).join("\n")+"\n\n";var a=e.usedUvs||[!0];return i.generateVertexShader(a,a,[]),i.generateFragmentShader(n.code,s.code,r.code,"vUv0"),i.getDefinition()},e}(Uo),Ul=new Nl,zl=new function(){this.usedUvs=void 0,this.shaderChunk=void 0,this.litOptions=new ml},Vl=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),s=0;s1?0:1),this.lightsBuffer.updateUniforms(),this._clusterWorldTextureId.setValue(this.clusterTexture),this._clusterMaxCellsId.setValue(this.maxCellLightCount);var t=this.boundsDelta;this._clusterCellsCountByBoundsSizeData[0]=this._cells.x/t.x,this._clusterCellsCountByBoundsSizeData[1]=this._cells.y/t.y,this._clusterCellsCountByBoundsSizeData[2]=this._cells.z/t.z,this._clusterCellsCountByBoundsSizeId.setValue(this._clusterCellsCountByBoundsSizeData),this._clusterBoundsMinData[0]=this.boundsMin.x,this._clusterBoundsMinData[1]=this.boundsMin.y,this._clusterBoundsMinData[2]=this.boundsMin.z,this._clusterBoundsDeltaData[0]=t.x,this._clusterBoundsDeltaData[1]=t.y,this._clusterBoundsDeltaData[2]=t.z,this._clusterCompressionLimit0Data[0]=this._maxAttenuation,this._clusterCompressionLimit0Data[1]=this._maxColorValue,this._clusterTextureSizeId.setValue(this._clusterTextureSizeData),this._clusterBoundsMinId.setValue(this._clusterBoundsMinData),this._clusterBoundsDeltaId.setValue(this._clusterBoundsDeltaData),this._clusterCellsDotId.setValue(this._clusterCellsDotData),this._clusterCellsMaxId.setValue(this._clusterCellsMaxData),this._clusterCompressionLimit0Id.setValue(this._clusterCompressionLimit0Data)},e.evalLightCellMinMax=function(t,e,i){e.copy(t.min),e.sub(this.boundsMin),e.div(this.boundsDelta),e.mul2(e,this.cells),e.floor(),i.copy(t.max),i.sub(this.boundsMin),i.div(this.boundsDelta),i.mul2(i,this.cells),i.ceil(),e.max(Ct.ZERO),i.min(this._cellsLimit)},e.collectLights=function(t){var e=this.lightsBuffer.maxLights,i=this._usedLights,n=1;t.forEach((function(t){var s,r=!!(3&t.mask),a=2===t.type&&0===t._outerConeAngle;t.enabled&&0!==t.type&&t.visibleThisFrame&&t.intensity>0&&r&&!a&&(n1){e.copy(t[1].min),i.copy(t[1].max);for(var n=2;n>>16)>>>0;return 2.3283064365386963e-10*(e=((16711935&(e=((252645135&(e=((858993459&(e=((1431655765&e)<<1|(2863311530&e)>>>1)>>>0))<<2|(3435973836&e)>>>2)>>>0))<<4|(4042322160&e)>>>4)>>>0))<<8|(4278255360&e)>>>8)>>>0)},$l=function(t){switch(t){case Ai:return"Cubemap";case Mi:return"Octahedral";default:return"Equirect"}},tc=function(t,e,i){if(t<=0)e[i+0]=0,e[i+1]=0,e[i+2]=0,e[i+3]=0;else if(t>=1)e[i+0]=255,e[i+1]=0,e[i+2]=0,e[i+3]=0;else{var n=1*t%1,s=255*t%1,r=65025*t%1,a=16581375*t%1;n-=s/255,s-=r/255,r-=a/255,e[i+0]=Math.min(255,Math.floor(256*n)),e[i+1]=Math.min(255,Math.floor(256*s)),e[i+2]=Math.min(255,Math.floor(256*r)),e[i+3]=Math.min(255,Math.floor(256*a))}},ec=function(t,e,i,n){var s=2*i*Math.PI,r=Math.pow(1-e,1/(n+1)),a=Math.sqrt(1-r*r);t.set(Math.cos(s)*a,Math.sin(s)*a,r).normalize()},ic=function(t,e,i){var n=2*i*Math.PI,s=Math.sqrt(1-e),r=Math.sqrt(e);t.set(Math.cos(n)*r,Math.sin(n)*r,s).normalize()},nc=function(t,e,i,n){var s=2*i*Math.PI,r=Math.sqrt((1-e)/(1+(n*n-1)*e)),a=Math.sqrt(1-r*r);t.set(Math.cos(s)*a,Math.sin(s)*a,r).normalize()},sc=function(t,e){var i=t*e,n=e/(1-t*t+i*i);return n*n*(1/Math.PI)},rc={16:{2:26,8:20,32:17,128:16,512:16},32:{2:53,8:40,32:34,128:32,512:32},128:{2:214,8:163,32:139,128:130,512:128},1024:{2:1722,8:1310,32:1114,128:1041,512:1025}},ac=function(t,e,i){for(var n=i/t,s=1-Math.log2(e)/11,r=s*s,a=new Ct,o=new Ct,h=new Ct(0,0,1),l=[],c=function(t,e){var i=rc[t];return i&&i[e]||t}(t,e),u=0;u0){var f=sc(Math.min(1,d),r)/4+.001,p=.5*Math.log2(n/f);l.push(o.x,o.y,o.z,p)}}for(;l.length<4*t;)l.push(0,0,0,0);return l},oc=function(t,e,i){var n=function(t){for(var e=t.length,i=Math.min(e,512),n=Math.ceil(e/i),s=new Uint8Array(i*n*4),r=0,a=0;a0?E.setValue([(l+2*h)/l,(c+2*h)/c,-h/l,-h/c]):E.setValue([1,1,0,0]);var A=[0,t.fixCubemapSeams?1/t.width:0,e.fixCubemapSeams?1/e.width:0];if(m){var C=t.width*t.height*(t.cubemap?6:1),M="ggx"===f?function(t,e,i,n){return uc(t,"ggx-samples-"+e+"-"+i+"-"+n,(function(){return ac(e,i,n)}))}(b,x,u,C):"lambert"===f?dc(b,x,C):fc(b,x,u);b.scope.resolve("samplesTex").setValue(M),b.scope.resolve("samplesTexInverseSize").setValue([1/M.width,1/M.height])}for(var P=0;P<(e.cubemap?6:1);P++)if(null===d||P===d){var R,I=new Dn({colorBuffer:e,face:P,depth:!1,flipY:b.isWebGPU});A[0]=P,w.setValue(A),Zo(b,I,T,null==(R=i)?void 0:R.rect),I.destroy()}return!0}var mc=function(t,e){return void 0===e&&(e=0),1+Math.floor(Math.log2(Math.max(t,e)))},_c=function(){function t(){}return t.generateSkyboxCubemap=function(t,e){var i=function(t,e,i,n){return new dr(t,{name:"lighting-"+e,cubemap:!0,width:e,height:e,format:i,type:yi,addressU:1,addressV:1,fixCubemapSeams:!0,mipmaps:!!n})}(t.device,e||(t.cubemap?t.width:t.width/4),7,!1);return pc(t,i,{numSamples:1024}),i},t.generateLightingSource=function(t,e){var i=t.device,n=function(t){return function(t){return t.extTextureHalfFloat&&t.textureHalfFloatRenderable}(t)?ye:function(t){return t.extTextureFloat&&t.textureFloatRenderable}(t)?Se:7}(i),s=(null==e?void 0:e.target)||new dr(i,{name:"lighting-source",cubemap:!0,width:(null==e?void 0:e.size)||128,height:(null==e?void 0:e.size)||128,format:n,type:7===n?yi:_i,addressU:1,addressV:1,fixCubemapSeams:!1,mipmaps:!0});return pc(t,s,{numSamples:t.mipmaps?1:1024}),s},t.generateAtlas=function(t,e){for(var i=t.device,n=(null==e?void 0:e.target)||new dr(i,{name:"envAtlas",width:(null==e?void 0:e.size)||512,height:(null==e?void 0:e.size)||512,format:7,type:yi,projection:Ci,addressU:1,addressV:1,mipmaps:!1}),s=n.width/512,r=new Lt(0,0,512*s,256*s),a=mc(256)-mc(4),o=0;o>2*h),rect:r,seamPixels:s}),r.y+=r.w,r.z=Math.max(1,Math.floor(.5*r.z)),r.w=Math.max(1,Math.floor(.5*r.w));return r.set(128*s,384*s,64*s,32*s),pc(t,n,{numSamples:(null==e?void 0:e.numAmbientSamples)||2048,distribution:"lambert",rect:r,seamPixels:s}),n},t.generatePrefilteredAtlas=function(t,e){for(var i=t[0].device,n=t[0].format,s=t[0].type,r=(null==e?void 0:e.target)||new dr(i,{name:"envPrefilteredAtlas",width:(null==e?void 0:e.size)||512,height:(null==e?void 0:e.size)||512,format:n,type:s,projection:Ci,addressU:1,addressV:1,mipmaps:!1}),a=r.width/512,o=new Lt(0,0,512*a,256*a),h=mc(512),l=0;l0){if(i[t]e.length){for(var n=e,s=n.charAt(n.length-1),r=i[t]-n.length,a=0;a0,t.litOptions.blendType=i.blendType,t.litOptions.screenSpace=n&&!!(n&To),t.litOptions.skin=n&&!!(2&n),t.litOptions.useInstancing=n&&!!(n&So),t.litOptions.useMorphPosition=n&&!!(n&Eo),t.litOptions.useMorphNormal=n&&!!(n&Ao),t.litOptions.useMorphTextureBased=n&&!!(n&Co),t.litOptions.nineSlicedMode=i.nineSlicedMode||0,e.clusteredLightingEnabled&&i.useLighting?(t.litOptions.clusteredLightingEnabled=!0,t.litOptions.clusteredLightingCookiesEnabled=e.lighting.cookiesEnabled,t.litOptions.clusteredLightingShadowsEnabled=e.lighting.shadowsEnabled,t.litOptions.clusteredLightingShadowType=e.lighting.shadowType,t.litOptions.clusteredLightingAreaLightsEnabled=e.lighting.areaLightsEnabled):(t.litOptions.clusteredLightingEnabled=!1,t.litOptions.clusteredLightingCookiesEnabled=!1,t.litOptions.clusteredLightingShadowsEnabled=!1,t.litOptions.clusteredLightingAreaLightsEnabled=!1)},e._updateUVOptions=function(t,e,i,n){var s=!1,r=!1,a=!1;i&&(s=!!(4&i),r=!!(8&i),a=!!(16&i)),t.litOptions.vertexColors=!1,this._mapXForms=[];var o={};for(var h in gc)this._updateTexOptions(t,e,h,s,r,a,n,o);this._mapXForms=null,t.litOptions.lightMapEnabled=t.lightMap,t.litOptions.dirLightMapEnabled=t.dirLightMap,t.litOptions.useHeights=t.heightMap,t.litOptions.useNormals=t.normalMap,t.litOptions.useClearCoatNormals=t.clearCoatNormalMap,t.litOptions.useAo=t.aoMap||t.aoVertexColor,t.litOptions.diffuseMapEnabled=t.diffuseMap},e._updateTexOptions=function(t,e,i,n,s,r,a,o){var h="opacity"===i;if(!a||h){var l=i+"Map",c=i+"VertexColor",u=i+"VertexColorChannel",d=l+"Channel",f=l+"Transform",p=l+"Uv",m=l+"Identifier";if("light"!==i&&(t[l]=!1,t[m]=void 0,t[d]="",t[f]=0,t[p]=0),t[c]=!1,t[u]="",h&&3===e.blendType&&0===e.alphaTest&&!e.alphaToCoverage&&e.opacityDither===Io)return;if("height"!==i&&e[c]&&r&&(t[c]=e[c],t[u]=e[u],t.litOptions.vertexColors=!0),e[l]){var _=!0;if(0!==e[p]||n||(_=!1),1!==e[p]||s||(_=!1),_){var v=e[l].id,g=o[v];void 0===g&&(o[v]=i,g=i),t[l]=!!e[l],t[m]=g,t[f]=this._getMapTransformID(e.getUniform(f),e[p]),t[d]=e[d],t[p]=e[p]}}}},e._updateMinOptions=function(t,e,i){t.opacityTint=3!==e.blendType||e.opacityShadowDither!==Io;var n=5===i;t.litOptions.opacityShadowDither=n?e.opacityDither:e.opacityShadowDither,t.litOptions.lights=[]},e._updateMaterialOptions=function(t,e){var i,n,s,r,a,o=e.diffuseTint||!e.diffuseMap&&!e.diffuseVertexColor,h=!!(e.useMetalness||e.specularMap||e.sphereMap||e.cubeMap||(a=e.specular,0!==a.r||0!==a.g||0!==a.b)||e.specularityFactor>0&&e.useMetalness||e.enableGGXSpecular||e.clearCoat>0),l=!e.useMetalness||e.useMetalnessSpecularColor,c=h&&(e.specularTint||!e.specularMap&&!e.specularVertexColor)&&Tc(e.specular),u=h&&e.useMetalnessSpecularColor&&(e.specularityFactorTint||e.specularityFactor<1&&!e.specularityFactorMap),d=!e.emissiveMap||Tc(e.emissive)&&e.emissiveTint,f=1!==e.emissiveIntensity,p=!!e.normalMap&&(e.normalMap.format===ve||e.normalMap.type===xi);t.opacityTint=3!==e.blendType||e.alphaTest>0||e.opacityDither!==Io?1:0,t.ambientTint=e.ambientTint,t.diffuseTint=o?2:0,t.specularTint=c?2:0,t.specularityFactorTint=u?1:0,t.metalnessTint=e.useMetalness&&e.metalness<1?1:0,t.glossTint=1,t.emissiveTint=(d?2:0)+(f?1:0),t.diffuseEncoding=null==(i=e.diffuseMap)?void 0:i.encoding,t.diffuseDetailEncoding=null==(n=e.diffuseDetailMap)?void 0:n.encoding,t.emissiveEncoding=null==(s=e.emissiveMap)?void 0:s.encoding,t.lightMapEncoding=null==(r=e.lightMap)?void 0:r.encoding,t.packedNormal=p,t.refractionTint=1!==e.refraction?1:0,t.refractionIndexTint=e.refractionIndex!==1/1.5?1:0,t.thicknessTint=e.useDynamicRefraction&&1!==e.thickness?1:0,t.specularEncoding=e.specularEncoding||"linear",t.sheenEncoding=e.sheenEncoding||"linear",t.aoMapUv=e.aoUvSet,t.aoDetail=!!e.aoMap,t.diffuseDetail=!!e.diffuseMap,t.normalDetail=!!e.normalMap,t.diffuseDetailMode=e.diffuseDetailMode,t.aoDetailMode=e.aoDetailMode,t.clearCoatTint=1!==e.clearCoat?1:0,t.clearCoatGloss=!!e.clearCoatGloss,t.clearCoatGlossTint=1!==e.clearCoatGloss?1:0,t.iorTint=e.refractionIndex!==1/1.5?1:0,t.iridescenceTint=1!==e.iridescence?1:0,t.sheenTint=e.useSheen&&Tc(e.sheen)?2:0,t.sheenGlossTint=1,t.glossInvert=e.glossInvert,t.sheenGlossInvert=e.sheenGlossInvert,t.clearCoatGlossInvert=e.clearCoatGlossInvert,t.useSpecularColor=l,t.litOptions.separateAmbient=!1,t.litOptions.useAmbientTint=e.ambientTint,t.litOptions.customFragmentShader=e.customFragmentShader,t.litOptions.pixelSnap=e.pixelSnap,t.litOptions.shadingModel=e.shadingModel,t.litOptions.ambientSH=!!e.ambientSH,t.litOptions.fastTbn=e.fastTbn,t.litOptions.twoSidedLighting=e.twoSidedLighting,t.litOptions.occludeSpecular=e.occludeSpecular,t.litOptions.occludeSpecularFloat=1!==e.occludeSpecularIntensity,t.litOptions.useMsdf=!!e.msdfMap,t.litOptions.msdfTextAttribute=!!e.msdfTextAttribute,t.litOptions.alphaToCoverage=e.alphaToCoverage,t.litOptions.opacityFadesSpecular=e.opacityFadesSpecular,t.litOptions.opacityDither=e.opacityDither,t.litOptions.cubeMapProjection=e.cubeMapProjection,t.litOptions.occludeDirect=e.occludeDirect,t.litOptions.conserveEnergy=e.conserveEnergy&&0!==e.shadingModel,t.litOptions.useSpecular=h,t.litOptions.useSpecularityFactor=(u||!!e.specularityFactorMap)&&e.useMetalnessSpecularColor,t.litOptions.enableGGXSpecular=e.enableGGXSpecular,t.litOptions.fresnelModel=e.fresnelModel,t.litOptions.useRefraction=(e.refraction||!!e.refractionMap)&&(e.useDynamicRefraction||!!t.litOptions.reflectionSource),t.litOptions.useClearCoat=!!e.clearCoat,t.litOptions.useSheen=e.useSheen,t.litOptions.useIridescence=e.useIridescence&&0!==e.iridescence,t.litOptions.useMetalness=e.useMetalness,t.litOptions.useDynamicRefraction=e.useDynamicRefraction,t.litOptions.dispersion=e.dispersion>0},e._updateEnvOptions=function(t,e,i){t.litOptions.fog=e.useFog?i.fog:"none",t.litOptions.gamma=e.useGammaTonemap?i.gammaCorrection:0,t.litOptions.toneMap=e.useGammaTonemap?i.toneMapping:-1,t.litOptions.fixSeams=!!e.cubeMap&&e.cubeMap.fixCubemapSeams;var n=0===e.shadingModel,s=!1;if(e.envAtlas&&e.cubeMap&&!n?(t.litOptions.reflectionSource="envAtlasHQ",t.litOptions.reflectionEncoding=e.envAtlas.encoding,t.litOptions.reflectionCubemapEncoding=e.cubeMap.encoding):e.envAtlas&&!n?(t.litOptions.reflectionSource="envAtlas",t.litOptions.reflectionEncoding=e.envAtlas.encoding):e.cubeMap?(t.litOptions.reflectionSource="cubeMap",t.litOptions.reflectionEncoding=e.cubeMap.encoding):e.sphereMap?(t.litOptions.reflectionSource="sphereMap",t.litOptions.reflectionEncoding=e.sphereMap.encoding):e.useSkybox&&i.envAtlas&&i.skybox&&!n?(t.litOptions.reflectionSource="envAtlasHQ",t.litOptions.reflectionEncoding=i.envAtlas.encoding,t.litOptions.reflectionCubemapEncoding=i.skybox.encoding,s=!0):e.useSkybox&&i.envAtlas&&!n?(t.litOptions.reflectionSource="envAtlas",t.litOptions.reflectionEncoding=i.envAtlas.encoding,s=!0):e.useSkybox&&i.skybox?(t.litOptions.reflectionSource="cubeMap",t.litOptions.reflectionEncoding=i.skybox.encoding,s=!0):(t.litOptions.reflectionSource=null,t.litOptions.reflectionEncoding=null),e.ambientSH&&!n)t.litOptions.ambientSource="ambientSH",t.litOptions.ambientEncoding=null;else{var r=e.envAtlas||(e.useSkybox&&i.envAtlas?i.envAtlas:null);r&&!n?(t.litOptions.ambientSource="envAtlas",t.litOptions.ambientEncoding=r.encoding):(t.litOptions.ambientSource="constant",t.litOptions.ambientEncoding=null)}t.litOptions.skyboxIntensity=s,t.litOptions.useCubeMapRotation=s&&i._skyboxRotationShaderInclude},e._updateLightOptions=function(t,e,i,n,s){if(t.lightMap=!1,t.lightMapChannel="",t.lightMapUv=0,t.lightMapTransform=0,t.litOptions.lightMapWithoutAmbient=!1,t.dirLightMap=!1,n&&(t.litOptions.noShadow=!!(1&n),64&n&&(t.lightMapEncoding=7===e.lightmapPixelFormat?"rgbm":"linear",t.lightMap=!0,t.lightMapChannel="rgb",t.lightMapUv=1,t.lightMapTransform=0,t.litOptions.lightMapWithoutAmbient=!i.lightMap,n&bo&&(t.dirLightMap=!0),n&Mo&&(t.litOptions.lightMapWithoutAmbient=!1))),i.useLighting){var r=[],a=n?n>>16:1;t.litOptions.lightMaskDynamic=!!(1&a),s&&(_l.collectLights(0,s[0],r,a),_l.collectLights(1,s[1],r,a),_l.collectLights(2,s[2],r,a)),t.litOptions.lights=r}else t.litOptions.lights=[];0===t.litOptions.lights.length&&(t.litOptions.noShadow=!0)},e._getMapTransformID=function(t,e){if(!t)return 0;var i=this._mapXForms[e];i||(i=[],this._mapXForms[e]=i);for(var n=0;n0&&(this._setParameter("material_clearCoat",this.clearCoat),this._setParameter("material_clearCoatGloss",this.clearCoatGloss),this._setParameter("material_clearCoatBumpiness",this.clearCoatBumpiness)),this._setParameter("material_gloss",n("gloss")),this.emissiveMap&&!this.emissiveTint||this._setParameter("material_emissive",n("emissive")),1!==this.emissiveIntensity&&this._setParameter("material_emissiveIntensity",this.emissiveIntensity),this.refraction>0&&this._setParameter("material_refraction",this.refraction),this.dispersion>0&&this._setParameter("material_dispersion",this.dispersion),this.useDynamicRefraction&&(this._setParameter("material_thickness",this.thickness),this._setParameter("material_attenuation",n("attenuation")),this._setParameter("material_invAttenuationDistance",0===this.attenuationDistance?0:1/this.attenuationDistance)),this.useIridescence&&(this._setParameter("material_iridescence",this.iridescence),this._setParameter("material_iridescenceRefractionIndex",this.iridescenceRefractionIndex),this._setParameter("material_iridescenceThicknessMin",this.iridescenceThicknessMin),this._setParameter("material_iridescenceThicknessMax",this.iridescenceThicknessMax)),this._setParameter("material_opacity",this.opacity),!1===this.opacityFadesSpecular&&this._setParameter("material_alphaFade",this.alphaFade),this.occludeSpecular&&this._setParameter("material_occludeSpecularIntensity",this.occludeSpecularIntensity),1===this.cubeMapProjection&&this._setParameter(n("cubeMapProjectionBox")),gc)this._updateMap(s);this.ambientSH&&this._setParameter("ambientSH[0]",this.ambientSH),this.normalMap&&this._setParameter("material_bumpiness",this.bumpiness),this.normalMap&&this.normalDetailMap&&this._setParameter("material_normalDetailMapBumpiness",this.normalDetailMapBumpiness),this.heightMap&&this._setParameter("material_heightMapFactor",n("heightMapFactor"));var r=0===this.shadingModel;this.envAtlas&&this.cubeMap&&!r?(this._setParameter("texture_envAtlas",this.envAtlas),this._setParameter("texture_cubeMap",this.cubeMap)):this.envAtlas&&!r?this._setParameter("texture_envAtlas",this.envAtlas):this.cubeMap?this._setParameter("texture_cubeMap",this.cubeMap):this.sphereMap&&this._setParameter("texture_sphereMap",this.sphereMap),this._setParameter("material_reflectivity",this.reflectivity),this._processParameters("_activeParams"),this._dirtyShader&&this.clearVariants()},i.updateEnvUniforms=function(t,e){var i=0===this.shadingModel;!(this.envAtlas&&!i||this.cubeMap||this.sphereMap)&&this.useSkybox&&(e.envAtlas&&e.skybox&&!i?(this._setParameter("texture_envAtlas",e.envAtlas),this._setParameter("texture_cubeMap",e.skybox)):e.envAtlas&&!i?this._setParameter("texture_envAtlas",e.envAtlas):e.skybox&&this._setParameter("texture_cubeMap",e.skybox)),this._processParameters("_activeLightingParams")},i.getShaderVariant=function(t,e,i,n,s,r,a,o,h){this.updateEnvUniforms(t,e);var l=$o.get(t).getByIndex(s),c=2===s||3===s||5===s||l.isShadow,u=c?Sc.optionsContextMin:Sc.optionsContext;c?this.shaderOptBuilder.updateMinRef(u,e,this,i,s,r):this.shaderOptBuilder.updateRef(u,e,this,i,s,r),this.onUpdateShader&&(u=this.onUpdateShader(u));var d=new ea(a,o,h),f=Bo(t);f.register("standard",Sc);var p=f.getProgram("standard",u,d,this.userId);return this._dirtyShader=!1,p},i.destroy=function(){for(var e in this._assetReferences)this._assetReferences[e]._unbind();this._assetReferences=null,t.prototype.destroy.call(this)},v(e,[{key:"shader",get:function(){return null},set:function(t){}},{key:"chunks",get:function(){return this._dirtyShader=!0,this._chunks},set:function(t){this._dirtyShader=!0,this._chunks=t}}])}(ah);Oc.TEXTURE_PARAMETERS=Cc,Oc.CUBEMAP_PARAMETERS=Pc;var Fc=function(t,e){Lc[t]=e},Bc=function(t,e,i,n){Object.defineProperty(Oc.prototype,t,{get:n||function(){return this["_"+t]},set:i}),Dc[t]={value:e}},Nc=function(t){return t.defaultValue&&t.defaultValue.clone?function(t){var e="_"+t.name,i=t.dirtyShaderFunc||function(){return!0};Bc(t.name,(function(){return t.defaultValue.clone()}),(function(t){var n=this[e];n.equals(t)||(this._dirtyShader=this._dirtyShader||i(n,t),this[e]=n.copy(t))}),t.getterFunc)}(t):function(t){var e="_"+t.name,i=t.dirtyShaderFunc||function(){return!0};Bc(t.name,(function(){return t.defaultValue}),(function(t){var n=this[e];n!==t&&(this._dirtyShader=this._dirtyShader||i(n,t),this[e]=t)}),t.getterFunc)}(t)};function Uc(t,e,i,n){void 0===e&&(e="rgb"),void 0===i&&(i=!0),void 0===n&&(n=0),gc[t]=e.length||-1,Nc({name:t+"Map",defaultValue:null,dirtyShaderFunc:function(t,e){return!!t!=!!e||t&&(t.type!==e.type||t.fixCubemapSeams!==e.fixCubemapSeams||t.format!==e.format)}}),Nc({name:t+"MapTiling",defaultValue:new It(1,1)}),Nc({name:t+"MapOffset",defaultValue:new It(0,0)}),Nc({name:t+"MapRotation",defaultValue:0}),Nc({name:t+"MapUv",defaultValue:n}),e&&(Nc({name:t+"MapChannel",defaultValue:e}),i&&(Nc({name:t+"VertexColor",defaultValue:!1}),Nc({name:t+"VertexColorChannel",defaultValue:e})));var s=t+"MapTiling",r=t+"MapOffset",a=t+"MapRotation",o=t+"MapTransform";Fc(o,(function(t,e,i){var n=t[s],h=t[r],l=t[a];if(1===n.x&&1===n.y&&0===h.x&&0===h.y&&0===l)return null;var c=t._allocUniform(o,(function(){return[{name:"texture_"+o+"0",value:new Float32Array(3)},{name:"texture_"+o+"1",value:new Float32Array(3)}]})),u=Math.cos(l*_t.DEG_TO_RAD),d=Math.sin(l*_t.DEG_TO_RAD),f=c[0].value;f[0]=u*n.x,f[1]=-d*n.y,f[2]=h.x;var p=c[1].value;return p[0]=d*n.x,p[1]=u*n.y,p[2]=1-n.y-h.y,c}))}function zc(t,e){Nc({name:t,defaultValue:e,getterFunc:function(){return this._dirtyShader=!0,this["_"+t]}}),Fc(t,(function(e,i,n){var s=e._allocUniform(t,(function(){return new Float32Array(3)})),r=e[t];return e.useGammaTonemap&&n.gammaCorrection?(s[0]=Math.pow(r.r,2.2),s[1]=Math.pow(r.g,2.2),s[2]=Math.pow(r.b,2.2)):(s[0]=r.r,s[1]=r.g,s[2]=r.b),s}))}function Vc(t,e,i){Nc({name:t,defaultValue:e,dirtyShaderFunc:function(t,e){return(0===t||1===t)!=(0===e||1===e)}}),Fc(t,i)}function Gc(t,e){Nc({name:t,defaultValue:null,dirtyShaderFunc:function(t,e){return!!t==!!e}}),Fc(t,e)}function Hc(t,e){Nc({name:t,defaultValue:e})}!function(){zc("ambient",new vt(.7,.7,.7)),zc("diffuse",new vt(1,1,1)),zc("specular",new vt(0,0,0)),zc("emissive",new vt(0,0,0)),zc("sheen",new vt(1,1,1)),zc("attenuation",new vt(1,1,1)),Vc("emissiveIntensity",1),Vc("specularityFactor",1),Vc("sheenGloss",0),Vc("gloss",.25,(function(t,e,i){return 0===t.shadingModel?Math.pow(2,11*t.gloss):t.gloss})),Vc("heightMapFactor",1,(function(t,e,i){return.025*t.heightMapFactor})),Vc("opacity",1),Vc("alphaFade",1),Vc("alphaTest",0),Vc("bumpiness",1),Vc("normalDetailMapBumpiness",1),Vc("reflectivity",1),Vc("occludeSpecularIntensity",1),Vc("refraction",0),Vc("refractionIndex",1/1.5),Vc("dispersion",0),Vc("thickness",0),Vc("attenuationDistance",0),Vc("metalness",1),Vc("anisotropy",0),Vc("clearCoat",0),Vc("clearCoatGloss",1),Vc("clearCoatBumpiness",1),Vc("aoUvSet",0,null),Vc("iridescence",0),Vc("iridescenceRefractionIndex",1/1.5),Vc("iridescenceThicknessMin",0),Vc("iridescenceThicknessMax",0),Gc("ambientSH"),Gc("cubeMapProjectionBox",(function(t,e,i){var n=t._allocUniform("cubeMapProjectionBox",(function(){return[{name:"envBoxMin",value:new Float32Array(3)},{name:"envBoxMax",value:new Float32Array(3)}]})),s=t.cubeMapProjectionBox.getMin(),r=n[0].value;r[0]=s.x,r[1]=s.y,r[2]=s.z;var a=t.cubeMapProjectionBox.getMax(),o=n[1].value;return o[0]=a.x,o[1]=a.y,o[2]=a.z,n})),Hc("ambientTint",!1),Hc("diffuseTint",!1),Hc("sheenTint",!1),Hc("specularTint",!1),Hc("specularityFactorTint",!1),Hc("emissiveTint",!1),Hc("fastTbn",!1),Hc("useMetalness",!1),Hc("useMetalnessSpecularColor",!1),Hc("useSheen",!1),Hc("enableGGXSpecular",!1),Hc("occludeDirect",!1),Hc("normalizeNormalMap",!0),Hc("conserveEnergy",!0),Hc("opacityFadesSpecular",!0),Hc("occludeSpecular",1),Hc("shadingModel",1),Hc("fresnelModel",2),Hc("useDynamicRefraction",!1),Hc("cubeMapProjection",0),Hc("customFragmentShader",null),Hc("useFog",!0),Hc("useLighting",!0),Hc("useGammaTonemap",!0),Hc("useSkybox",!0),Hc("forceUv1",!1),Hc("pixelSnap",!1),Hc("twoSidedLighting",!1),Hc("nineSlicedMode",void 0),Hc("msdfTextAttribute",!1),Hc("useIridescence",!1),Hc("glossInvert",!1),Hc("sheenGlossInvert",!1),Hc("clearCoatGlossInvert",!1),Hc("opacityDither",Io),Hc("opacityShadowDither",Io),Uc("diffuse"),Uc("specular"),Uc("emissive"),Uc("thickness","g"),Uc("specularityFactor","g"),Uc("normal",""),Uc("metalness","g"),Uc("gloss","g"),Uc("opacity","a"),Uc("refraction","g"),Uc("height","g",!1),Uc("ao","g"),Uc("light","rgb",!0,1),Uc("msdf",""),Uc("diffuseDetail","rgb",!1),Uc("normalDetail",""),Uc("aoDetail","g",!1),Uc("clearCoat","g"),Uc("clearCoatGloss","g"),Uc("clearCoatNormal",""),Uc("sheen","rgb"),Uc("sheenGloss","g"),Uc("iridescence","g"),Uc("iridescenceThickness","g"),Hc("diffuseDetailMode",xo),Hc("aoDetailMode",xo),Gc("cubeMap"),Gc("sphereMap"),Gc("envAtlas");var t=[null,null,null,null,null,null];Bc("prefilteredCubemaps",(function(){return t.slice()}),(function(t){var e=this._prefilteredCubemaps;t=t||[];for(var i=!1,n=!0,s=0;s<6;++s){var r=t[s]||null;e[s]!==r&&(e[s]=r,i=!0),n=n&&!!e[s]}i&&(n?this.envAtlas=_c.generatePrefilteredAtlas(e,{target:this.envAtlas}):this.envAtlas&&(this.envAtlas.destroy(),this.envAtlas=null),this._dirtyShader=!0)}),(function(){return this._prefilteredCubemaps}))}();var Wc=function(){function t(t,e){this.texture=t,this.cached=!1,this.renderTargets=e}return t.prototype.destroy=function(){this.texture&&(this.texture.destroy(),this.texture=null);for(var t=this.renderTargets,e=0;e1)for(var h=1/o,l=0;l1)for(var f=0;f0){for(var n=this.slots,s=0;ss&&(s=a)}return ou.min=n,ou.max=s,ou}var lu=function(){function t(t,e){this.renderer=void 0,this.shadowRenderer=void 0,this.device=void 0,this.renderer=t,this.shadowRenderer=e,this.device=t.device}var e=t.prototype;return e.cull=function(t,e,i,n){void 0===n&&(n=null),t.visibleThisFrame=!0,t._shadowMap||(t._shadowMap=Wc.create(this.device,t));var s=i._nearClip;this.generateSplitDistances(t,s,Math.min(i._farClip,t.shadowDistance));for(var r=t.shadowUpdateOverrides,a=0;a_&&(_=g)}var y=l.right,x=l.up,S=l.forward,b=.25*t._shadowResolution/_,T=Math.ceil(su.dot(x)*b)/b,w=Math.ceil(su.dot(y)*b)/b,E=x.mulScalar(T),A=y.mulScalar(w),C=su.dot(S),M=S.mulScalar(C);su.add2(E,A).add(M),l.setPosition(su),l.translateLocal(0,0,1e6),h.nearClip=.01,h.farClip=2e6,h.orthoHeight=_,this.renderer.updateCameraFrustum(h),this.shadowRenderer.cullShadowCasters(e,t,o.visibleCasters,h,n);for(var P=!0,R=o.visibleCasters,I=0;I=1&&e<=3?new vt(0,0,0,0):new vt(1,1,1,1),s.clearDepthBuffer=!0,s.clearStencilBuffer=!1,s},t.setShadowCameraSettings=function(t,e,i,n,s){var r=4===i||(5===i||0===i)&&e.supportsDepthShadow;1!==n||s||(r=!1),t.clearColorBuffer=!r};var e=t.prototype;return e._cullShadowCastersInternal=function(t,e,i){for(var n=t.length,s=0;s1&&(this.renderer.scene.clusteredLightingEnabled&&0!==t._type||this.applyVsmBlur(t,e))},e.getVsmBlurShader=function(t,e,i){var n=(t?this.blurPackedVsmShader:this.blurVsmShader)[e][i];if(!n){this.blurVsmWeights[i]=function(t){for(var e=(t-1)/6,i=.5*(t-1),n=new Array(t),s=0,r=0;r0},i.filter=function(t,e){for(var i=0;i1?this.quadRendererCube:this.quadRenderer2D;a>1&&this.initInvViewProjMatrices(),this.blitTextureId.setValue(r.cookie);for(var h=0;h1){var l=Su.z/3,c=i[h];Su.x+=l*c.x,Su.y+=l*c.y,Su.z=l,Su.w=l,this.invViewProjId.setValue(bu[h].data)}Su.mulScalar(e),o.render(Su)}}n.length=0},v(e,[{key:"quadRenderer2D",get:function(){if(!this._quadRenderer2D){var t=Vo(this.device,xu,"\n\tvarying vec2 uv0;\n\tuniform sampler2D blitTexture;\n\tvoid main(void) {\n\t\tgl_FragColor = texture2D(blitTexture, uv0);\n\t}","cookieRenderer2d");this._quadRenderer2D=new qo(t)}return this._quadRenderer2D}},{key:"quadRendererCube",get:function(){if(!this._quadRendererCube){var t=Vo(this.device,xu,"\n\tvarying vec2 uv0;\n\tuniform samplerCube blitTexture;\n\tuniform mat4 invViewProj;\n\tvoid main(void) {\n\t\tvec4 projPos = vec4(uv0 * 2.0 - 1.0, 0.5, 1.0);\n\t\tvec4 worldPos = invViewProj * projPos;\n\t\tgl_FragColor = textureCube(blitTexture, worldPos.xyz);\n\t}","cookieRendererCube");this._quadRendererCube=new qo(t)}return this._quadRendererCube}}])}(ta),wu=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this).requiresCubemaps=!1,s.shadowRenderer=i,s.shadowRendererLocal=n,s}x(e,t);var i=e.prototype;return i.update=function(t){var e=this.shadowRendererLocal.shadowLights,i=this.shadowRendererLocal.prepareLights(e,t),n=e.length;this.enabled=n>0,n&&this.shadowRenderer.setupRenderPass(this,i,!1)},i.execute=function(){for(var t=this.shadowRendererLocal.shadowLights,e=t.length,i=0;i0){var p=e?e.width:this.device.width,m=e?e.height:this.device.height,_=Gu[this.device.renderVersion%Gu.length];d=u*(2*_.x-1)/p,f=u*(2*_.y-1)/m,(l=qu.copy(l)).data[8]=d,l.data[9]=f,(c=Yu.copy(c)).data[8]=d,c.data[9]=f,this.blueNoiseJitterVersion!==this.device.renderVersion&&(this.blueNoiseJitterVersion=this.device.renderVersion,this.blueNoise.vec4(this.blueNoiseJitterVec))}var v=u>0?this.blueNoiseJitterVec:Lt.ZERO;if(this.blueNoiseJitterData[0]=v.x,this.blueNoiseJitterData[1]=v.y,this.blueNoiseJitterData[2]=v.z,this.blueNoiseJitterData[3]=v.w,this.blueNoiseJitterId.setValue(this.blueNoiseJitterData),this.projId.setValue(l.data),this.projSkyboxId.setValue(c.data),t.calculateTransform)t.calculateTransform(ku,0);else{var g=t._node.getPosition(),y=t._node.getRotation();ku.setTRS(g,y,Ct.ONE)}this.viewInvId.setValue(ku.data),Ou.copy(ku).invert(),this.viewId.setValue(Ou.data),Fu.setFromMat4(Ou),this.viewId3.setValue(Fu.data),Lu.mul2(l,Ou),this.viewProjId.setValue(Lu.data),t._storeShaderMatrices(Lu,d,f,this.device.renderVersion),this.flipYId.setValue(i?-1:1),this.dispatchViewPos(t._node.getPosition()),t.frustum.setFromMat4(Lu)}this.tbnBasis.setValue(i?-1:1);var x=t._nearClip,S=t._farClip;return this.nearClipId.setValue(x),this.farClipId.setValue(S),this.cameraParams[0]=1/S,this.cameraParams[1]=S,this.cameraParams[2]=x,this.cameraParams[3]=1===t.projection?1:0,this.cameraParamsId.setValue(this.cameraParams),this.exposureId.setValue(this.scene.physicalUnits?t.getExposure():this.scene.exposure),n},e.clear=function(t,e,i,n){var s=((null!=e?e:t._clearColorBuffer)?1:0)|((null!=i?i:t._clearDepthBuffer)?2:0)|((null!=n?n:t._clearStencilBuffer)?4:0);s&&this.device.clear({color:[t._clearColor.r,t._clearColor.g,t._clearColor.b,t._clearColor.a],depth:t._clearDepth,stencil:t._clearStencil,flags:s})},e.setCamera=function(t,e,i,n){this.setCameraUniforms(t,e),this.clearView(t,e,i,!1)},e.clearView=function(t,e,i,n){var s=this.device;if(s.setRenderTarget(e),s.updateBegin(),n&&(s.setColorWrite(!0,!0,!0,!0),s.setDepthWrite(!0)),this.setupViewport(t,e),i){var r=t._clearOptions;s.clear(r||{color:[t._clearColor.r,t._clearColor.g,t._clearColor.b,t._clearColor.a],depth:t._clearDepth,flags:(t._clearColorBuffer?1:0)|(t._clearDepthBuffer?2:0)|(t._clearStencilBuffer?4:0),stencil:t._clearStencil})}},e.setupCullMode=function(t,e,i){var n=i.material,s=_e;if(t){var r=1;2!==n.cull&&1!==n.cull||(r=e*i.flipFacesFactor*i.node.worldScaleSign),s=r<0?2===n.cull?1:2:n.cull}this.device.setCullMode(s),s===_e&&n.cull===_e&&this.twoSidedLightingNegScaleFactorId.setValue(i.node.worldScaleSign)},e.updateCameraFrustum=function(t){if(t.xr&&t.xr.views.list.length){var e=t.xr.views.list[0];return Lu.mul2(e.projMat,e.viewOffMat),void t.frustum.setFromMat4(Lu)}var i=t.projectionMatrix;if(t.calculateProjection&&t.calculateProjection(i,0),t.calculateTransform)t.calculateTransform(ku,0);else{var n=t._node.getPosition(),s=t._node.getRotation();ku.setTRS(n,s,Ct.ONE),this.viewInvId.setValue(ku.data)}Ou.copy(ku).invert(),Lu.mul2(i,Ou),t.frustum.setFromMat4(Lu)},e.setBaseConstants=function(t,e){t.setCullMode(e.cull),e.opacityMap&&this.opacityMapId.setValue(e.opacityMap),(e.opacityMap||e.alphaTest>0)&&this.alphaTestId.setValue(e.alphaTest)},e.updateCpuSkinMatrices=function(t){Du++;var e=t.length;if(0!==e)for(var i=0;i0?(this._instancedDrawCalls++,t.setVertexBuffer(a.vertexBuffer),t.draw(i.primitive[n],a.count)):t.clearVertexBuffer():t.draw(i.primitive[n])},e.drawInstance2=function(t,e,i,n){var s=e.instancingData;s?s.count>0?(this._instancedDrawCalls++,t.draw(i.primitive[n],s.count,!0)):t.clearVertexBuffer():t.draw(i.primitive[n],void 0,!0)},e.cull=function(t,e,i){var n=i.opaque;n.length=0;var s=i.transparent;s.length=0;for(var r=t.frustumCulling,a=e.length,o=0;o0){var a=this._shaderVersion;ld.forEach((function(t){a>=0&&t._shaderVersion!==a&&(t.getShaderVariant!==ah.prototype.getShaderVariant&&t.clearVariants(),t._shaderVersion=a)})),ld.clear()}},e.removeMeshInstances=function(t,e){for(var i=this.meshInstances,n=this.meshInstancesSet,s=0;s=0&&i.splice(a,1)}}e||this.removeShadowCasters(t)},e.addShadowCasters=function(t){for(var e=this.shadowCasters,i=this.shadowCastersSet,n=0;n=0&&e.splice(r,1)}}},e.clearMeshInstances=function(t){void 0===t&&(t=!1),this.meshInstances.length=0,this.meshInstancesSet.clear(),t||(this.shadowCasters.length=0,this.shadowCastersSet.clear())},e.markLightsDirty=function(){this._lightHashDirty=!0,this._lightIdHashDirty=!0,this._splitLightsDirty=!0},e.addLight=function(t){var e=t.light;this._lightsSet.has(e)||(this._lightsSet.add(e),this._lights.push(e),this.markLightsDirty()),0!==e.type&&this._clusteredLightsSet.add(e)},e.removeLight=function(t){var e=t.light;this._lightsSet.has(e)&&(this._lightsSet.delete(e),this._lights.splice(this._lights.indexOf(e),1),this.markLightsDirty()),0!==e.type&&this._clusteredLightsSet.delete(e)},e.clearLights=function(){var t=this;this._lightsSet.forEach((function(e){return e.removeLayer(t)})),this._lightsSet.clear(),this._clusteredLightsSet.clear(),this._lights.length=0,this.markLightsDirty()},e.evaluateLightHash=function(t,e,i){for(var n=0,s=this._lights,r=0;r0&&(hd.sort(),n=Sn(hd),hd.length=0),n},e.getLightHash=function(t){return this._lightHashDirty&&(this._lightHashDirty=!1,this._lightHash=this.evaluateLightHash(!t,!0,!1)),this._lightHash},e.getLightIdHash=function(){return this._lightIdHashDirty&&(this._lightIdHashDirty=!1,this._lightIdHash=this.evaluateLightHash(!0,!1,!0)),this._lightIdHash},e.addCamera=function(t){this.camerasSet.has(t.camera)||(this.camerasSet.add(t.camera),this.cameras.push(t),this._dirtyComposition=!0)},e.removeCamera=function(t){if(this.camerasSet.has(t.camera)){this.camerasSet.delete(t.camera);var e=this.cameras.indexOf(t);this.cameras.splice(e,1),this._dirtyComposition=!0}},e.clearCameras=function(){this.cameras.length=0,this.camerasSet.clear(),this._dirtyComposition=!0},e._calculateSortDistances=function(t,e,i,n){for(var s=0;s0}},{key:"clusteredLightsSet",get:function(){return this._clusteredLightsSet}},{key:"splitLights",get:function(){if(this._splitLightsDirty){this._splitLightsDirty=!1;for(var t=this._splitLights,e=0;e1&&fd(this.cameras),this.camerasMap.clear();for(var a=0;a0)this.addDummyRenderAction(h,c),h++;else{for(var u=!0,d=h,f=null,p=!1,m=0;m0&&c.layers.indexOf(_.id)>=0){o.push(_),p||_.id!==c.disablePostEffectsLayer||(p=!0,f&&(f.triggerPostprocess=!0));var v=this.subLayerList[m];f=this.addRenderAction(h,_,v,c,u,p),h++,u=!1}}d=0;l--)if(h[l].camera===n&&h[l].renderTarget===a){o=!0;break}r&&n.postEffectsEnabled&&(a=null);var c=this.getNextRenderAction(t);c.triggerPostprocess=!1,c.layer=e,c.transparent=i,c.camera=n,c.renderTarget=a,c.firstCameraUse=s,c.lastCameraUse=!1;var u=s||!o,d=e.clearColorBuffer||e.clearDepthBuffer||e.clearStencilBuffer;return(u||d)&&c.setupClears(u?n:void 0,e),c},i.propagateRenderTarget=function(t,e){for(var i=t;i>=0;i--){var n=this._renderActions[i],s=n.layer;if(n.renderTarget&&1!==s.id)break;if(1!==s.id){if(n.useCameraPasses)break;var r=null==n?void 0:n.camera.camera;if(r&&(!e.camera.rect.equals(r.rect)||!e.camera.scissorRect.equals(r.scissorRect)))break;n.renderTarget=e.renderTarget}}},i._logRenderActions=function(){},i._isLayerAdded=function(t){return this.layerIdMap.get(t.id)===t},i._isSublayerAdded=function(t,e){return void 0!==(e?this.layerTransparentIndexMap:this.layerOpaqueIndexMap).get(t)},i.push=function(t){this._isLayerAdded(t)||(this.layerList.push(t),this.layerList.push(t),this._opaqueOrder[t.id]=this.subLayerList.push(!1)-1,this._transparentOrder[t.id]=this.subLayerList.push(!0)-1,this.subLayerEnabled.push(!0),this.subLayerEnabled.push(!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t))},i.insert=function(t,e){if(!this._isLayerAdded(t)){this.layerList.splice(e,0,t,t),this.subLayerList.splice(e,0,!1,!0);var i=this.layerList.length;this._updateOpaqueOrder(e,i-1),this._updateTransparentOrder(e,i-1),this.subLayerEnabled.splice(e,0,!0,!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t)}},i.remove=function(t){var e=this.layerList.indexOf(t);for(delete this._opaqueOrder[e],delete this._transparentOrder[e];e>=0;)this.layerList.splice(e,1),this.subLayerList.splice(e,1),this.subLayerEnabled.splice(e,1),e=this.layerList.indexOf(t),this._dirty=!0,this.fire("remove",t);var i=this.layerList.length;this._updateOpaqueOrder(0,i-1),this._updateTransparentOrder(0,i-1),this._updateLayerMaps()},i.pushOpaque=function(t){this._isSublayerAdded(t,!1)||(this.layerList.push(t),this._opaqueOrder[t.id]=this.subLayerList.push(!1)-1,this.subLayerEnabled.push(!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t))},i.insertOpaque=function(t,e){if(!this._isSublayerAdded(t,!1)){this.layerList.splice(e,0,t),this.subLayerList.splice(e,0,!1);var i=this.subLayerList.length;this._updateOpaqueOrder(e,i-1),this.subLayerEnabled.splice(e,0,!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t)}},i.removeOpaque=function(t){for(var e=0,i=this.layerList.length;e45?(t.radius=e*this._outerConeAngleSin,md.mulScalar(-e*n)):(t.radius=e/(2*n),md.mulScalar(-t.radius)),t.center.add2(s.getPosition(),md)}else 1===this._type&&(t.center=this._node.getPosition(),t.radius=this.attenuationEnd)},e.getBoundingBox=function(t){if(2===this._type){var e=this.attenuationEnd,i=this._outerConeAngle,n=this._node,s=Math.abs(Math.sin(i*_t.DEG_TO_RAD)*e);t.center.set(0,.5*-e,0),t.halfExtents.set(s,.5*e,s),t.setFromTransformedAabb(t,n.getWorldTransform(),!0)}else 1===this._type&&(t.center.copy(this._node.getPosition()),t.halfExtents.set(this.attenuationEnd,this.attenuationEnd,this.attenuationEnd))},e._updateShadowBias=function(){var t=this.device;if(t.isWebGL2||t.isWebGPU)if(1!==this._type||this.clusteredLighting){var e=-1e3*this.shadowBias;this.shadowDepthState.depthBias=e,this.shadowDepthState.depthBiasSlope=e}else this.shadowDepthState.depthBias=0,this.shadowDepthState.depthBiasSlope=0},e._updateFinalColor=function(){var e=this._color,i=e.r,n=e.g,s=e.b,r=this._intensity;this._usePhysicalUnits&&(r=this._luminance/t.getLightUnitConversion(this._type,this._outerConeAngle*_t.DEG_TO_RAD,this._innerConeAngle*_t.DEG_TO_RAD));var a=this._finalColor,o=this._linearFinalColor;a[0]=i*r,a[1]=n*r,a[2]=s*r,r>=1?(o[0]=Math.pow(i,2.2)*r,o[1]=Math.pow(n,2.2)*r,o[2]=Math.pow(s,2.2)*r):(o[0]=Math.pow(a[0],2.2),o[1]=Math.pow(a[1],2.2),o[2]=Math.pow(a[2],2.2))},e.setColor=function(){1===arguments.length?this._color.set(arguments[0].r,arguments[0].g,arguments[0].b):3===arguments.length&&this._color.set(arguments[0],arguments[1],arguments[2]),this._updateFinalColor()},e.layersDirty=function(){this.layers.forEach((function(t){t.markLightsDirty()}))},e.updateKey=function(){var t=this._type<<29|(this._castShadows?1:0)<<28|this._shadowType<<25|this._falloffMode<<23|(0!==this._normalOffsetBias?1:0)<<22|(this._cookie?1:0)<<21|(this._cookieFalloff?1:0)<<20|vd[this._cookieChannel.charAt(0)]<<18|(this._cookieTransform?1:0)<<12|this._shape<<10|this.numCascades-1<<8|(this.affectSpecularity?1:0)<<7|this.mask<<6;3===this._cookieChannel.length&&(t|=vd[this._cookieChannel.charAt(1)]<<16,t|=vd[this._cookieChannel.charAt(2)]<<14),t!==this.key&&this.layersDirty(),this.key=t},v(t,[{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias!==t&&(this._shadowBias=t,this._updateShadowBias())}},{key:"numCascades",get:function(){return this.cascades.length},set:function(t){this.cascades&&this.numCascades===t||(this.cascades=yd[t-1],this._shadowMatrixPalette=new Float32Array(64),this._shadowCascadeDistances=new Float32Array(4),this._destroyShadowMap(),this.updateKey())}},{key:"shadowMap",get:function(){return this._shadowMap},set:function(t){this._shadowMap!==t&&(this._destroyShadowMap(),this._shadowMap=t)}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.updateKey())}},{key:"numShadowFaces",get:function(){var t=this._type;return 0===t?this.numCascades:1===t?6:1}},{key:"type",get:function(){return this._type},set:function(t){if(this._type!==t){this._type=t,this._destroyShadowMap(),this._updateShadowBias(),this.updateKey();var e=this._shadowType;this._shadowType=null,this.shadowUpdateOverrides=null,this.shadowType=e}}},{key:"shape",get:function(){return this._shape},set:function(t){if(this._shape!==t){this._shape=t,this._destroyShadowMap(),this.updateKey();var e=this._shadowType;this._shadowType=null,this.shadowType=e}}},{key:"usePhysicalUnits",get:function(){return this._usePhysicalUnits},set:function(t){this._usePhysicalUnits!==t&&(this._usePhysicalUnits=t,this._updateFinalColor())}},{key:"shadowType",get:function(){return this._shadowType},set:function(t){if(this._shadowType!==t){var e=this.device;1===this._type&&0!==t&&6!==t&&(t=0);var i=e.supportsDepthShadow;4!==t||i||(t=0),3!==t||e.textureFloatRenderable&&e.textureFloatFilterable||(t=2),2!==t||e.textureHalfFloatRenderable||(t=1),this._isVsm=t>=1&&t<=3,this._isPcf=5===t||0===t||4===t,this._shadowType=t,this._destroyShadowMap(),this.updateKey()}}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this.layersDirty())}},{key:"castShadows",get:function(){return this._castShadows&&4!==this._mask&&0!==this._mask},set:function(t){this._castShadows!==t&&(this._castShadows=t,this._destroyShadowMap(),this.layersDirty(),this.updateKey())}},{key:"bakeShadows",get:function(){return this._castShadows&&4===this._mask}},{key:"shadowResolution",get:function(){return this._shadowResolution},set:function(t){this._shadowResolution!==t&&(t=1===this._type?Math.min(t,this.device.maxCubeMapSize):Math.min(t,this.device.maxTextureSize),this._shadowResolution=t,this._destroyShadowMap())}},{key:"vsmBlurSize",get:function(){return this._vsmBlurSize},set:function(t){this._vsmBlurSize!==t&&(t%2==0&&t++,this._vsmBlurSize=t)}},{key:"normalOffsetBias",get:function(){return this._normalOffsetBias},set:function(t){this._normalOffsetBias!==t&&((!this._normalOffsetBias&&t||this._normalOffsetBias&&!t)&&this.updateKey(),this._normalOffsetBias=t)}},{key:"falloffMode",get:function(){return this._falloffMode},set:function(t){this._falloffMode!==t&&(this._falloffMode=t,this.updateKey())}},{key:"innerConeAngle",get:function(){return this._innerConeAngle},set:function(t){this._innerConeAngle!==t&&(this._innerConeAngle=t,this._innerConeAngleCos=Math.cos(t*Math.PI/180),this._usePhysicalUnits&&this._updateFinalColor())}},{key:"outerConeAngle",get:function(){return this._outerConeAngle},set:function(t){this._outerConeAngle!==t&&(this._outerConeAngle=t,this._updateOuterAngle(t),this._usePhysicalUnits&&this._updateFinalColor())}},{key:"penumbraSize",get:function(){return this._penumbraSize},set:function(t){this._penumbraSize=t}},{key:"intensity",get:function(){return this._intensity},set:function(t){this._intensity!==t&&(this._intensity=t,this._updateFinalColor())}},{key:"affectSpecularity",get:function(){return this._affectSpecularity},set:function(t){0===this._type&&(this._affectSpecularity=t,this.updateKey())}},{key:"luminance",get:function(){return this._luminance},set:function(t){this._luminance!==t&&(this._luminance=t,this._updateFinalColor())}},{key:"cookieMatrix",get:function(){return this._cookieMatrix||(this._cookieMatrix=new zt),this._cookieMatrix}},{key:"atlasViewport",get:function(){return this._atlasViewport||(this._atlasViewport=new Lt(0,0,1,1)),this._atlasViewport}},{key:"cookie",get:function(){return this._cookie},set:function(t){this._cookie!==t&&(this._cookie=t,this.updateKey())}},{key:"cookieFalloff",get:function(){return this._cookieFalloff},set:function(t){this._cookieFalloff!==t&&(this._cookieFalloff=t,this.updateKey())}},{key:"cookieChannel",get:function(){return this._cookieChannel},set:function(t){if(this._cookieChannel!==t){if(t.length<3)for(var e=t.charAt(t.length-1),i=3-t.length,n=0;n0&&(e+="varying vec2 uv0;\nuniform highp float morphFactor["+t+"];\n");for(var i=0;i=this.maxSubmitCount&&(s(r,a),r=0,a=!0))}(r>0||0===o&&!this.zeroTextures)&&s(r,a)},e._updateTextureMorph=function(){this.device,(this._activeTargets.length>0||!this.zeroTextures)&&(this.rtPositions&&this._updateTextureRenderTarget(this.rtPositions,"texturePositions"),this.rtNormals&&this._updateTextureRenderTarget(this.rtNormals,"textureNormals"),this.zeroTextures=0===this._activeTargets.length)},e._updateVertexMorph=function(){for(var t=this.maxSubmitCount,e=0;e1e-5){this._activeTargets.length<=e&&(this._activeTargets[e]={});var s=this._activeTargets[e++];s.absWeight=n,s.weight=this.getWeight(i),s.target=t[i]}}this._activeTargets.length=e;var r=this.morph.maxActiveTargets;this._activeTargets.length>r&&(this._activeTargets.sort((function(t,e){return t.absWeightl)return!1;this.morphTextureWidth=c,this.morphTextureHeight=u;var d=!1,f=3,p=At.float2Half;this._textureFormat===ye&&(d=!0,f=4);for(var m=[],_=0;_0&&(s+=Oo.screenDepthPS),s+=Oo.particle_cpuVS,e.localSpace&&(s+=Oo.particle_localShiftVS),e.animTex&&(s+=this._animTex(e)),e.alignToMotion&&(s+=Oo.particle_pointAlongVS),s+=e.mesh?Oo.particle_meshVS:r,1===e.normal&&(s+=Oo.particle_normalVS),2===e.normal&&(s+=Oo.particle_TBNVS),e.stretch>0&&(s+=Oo.particle_stretchVS),s+=Oo.particle_cpu_endVS,e.soft>0&&(s+=Oo.particle_softVS)):(s+=Oo.particle_initVS,s+=e.pack8?Oo.particleInputRgba8PS:Oo.particleInputFloatPS,e.soft>0&&(s+=Oo.screenDepthPS),s+=Oo.particleVS,e.localSpace&&(s+=Oo.particle_localShiftVS),e.animTex&&(s+=this._animTex(e)),e.wrap&&(s+=Oo.particle_wrapVS),e.alignToMotion&&(s+=Oo.particle_pointAlongVS),s+=e.mesh?Oo.particle_meshVS:r,1===e.normal&&(s+=Oo.particle_normalVS),2===e.normal&&(s+=Oo.particle_TBNVS),e.stretch>0&&(s+=Oo.particle_stretchVS),s+=Oo.particle_endVS,e.soft>0&&(s+=Oo.particle_softVS)),s+="}\n",e.normal>0&&(1===e.normal?n+="\nvarying vec3 Normal;\n":2===e.normal&&(n+="\nvarying mat3 ParticleMat;\n"),n+="\nuniform vec3 lightCube[6];\n"),e.soft&&(n+="\nvarying float vDepth;\n"),0===e.normal&&"none"===e.fog&&(e.srgb=!1),n+=Oo.decodePS,n+=Uo.gammaCode(e.gamma),n+=Uo.tonemapCode(e.toneMap),"linear"===e.fog?n+=Oo.fogLinearPS:"exp"===e.fog?n+=Oo.fogExpPS:"exp2"===e.fog?n+=Oo.fogExp2PS:n+=Oo.fogNonePS,2===e.normal&&(n+="\nuniform sampler2D normalMap;\n"),e.soft>0&&(n+=Oo.screenDepthPS),n+=Oo.particlePS,e.soft>0&&(n+=Oo.particle_softPS),1===e.normal&&(n+="\nvec3 normal = Normal;\n"),2===e.normal&&(n+=Oo.particle_normalMapPS),e.normal>0&&(n+=e.halflambert?Oo.particle_halflambertPS:Oo.particle_lambertPS),e.normal>0&&(n+=Oo.particle_lightingPS),2===e.blend?n+=Oo.particle_blendNormalPS:1===e.blend?n+=Oo.particle_blendAddPS:5===e.blend&&(n+=Oo.particle_blendMultiplyPS),n+=Oo.particle_endPS,kr.createDefinition(t,{name:"ParticleShader",vertexCode:s,fragmentCode:n})},e}(Uo),Rd=new Pd,Id=1,Dd=new zt,Ld=new zt,kd=new Ct,Od=new Ct,Fd=new Ct,Bd=new Ct,Nd=new Ct,Ud=new Ct,zd=new Ct,Vd=new Ct,Gd=new Ct,Hd=new Ct,Wd=new Ct,Xd=new Ct,jd=new Ct;function qd(t){return t-Math.floor(t)}function Yd(t){return Math.max(Math.min(t,1),0)}function Kd(t,e){return t-e*Math.floor(t/e)}function Zd(t){var e=qd(t),i=qd(255*t);return[e-=i/255,i-=i/255]}var Qd=function(){function t(t){this._emitter=t}var e=t.prototype;return e.calcSpawnPosition=function(t,e,i,n,s){var r=this._emitter,a=Math.random(),o=Math.random(),h=Math.random(),l=Math.random();if(r.useCpu&&(t[4*s+0+2*r.numParticlesPot*4]=a,t[4*s+1+2*r.numParticlesPot*4]=o,t[4*s+2+2*r.numParticlesPot*4]=h),Od.x=a-.5,Od.y=o-.5,Od.z=h-.5,0===r.emitterShape){var c=Math.max(Math.abs(Od.x),Math.max(Math.abs(Od.y),Math.abs(Od.z))),u=c+(.5-c)*i[0],d=c+(.5-c)*i[1],f=c+(.5-c)*i[2];Od.x=u*(c===Math.abs(Od.x)?Math.sign(Od.x):2*Od.x),Od.y=d*(c===Math.abs(Od.y)?Math.sign(Od.y):2*Od.y),Od.z=f*(c===Math.abs(Od.z)?Math.sign(Od.z):2*Od.z),r.localSpace?kd.copy(e.transformPoint(Od)):kd.copy(n).add(e.transformPoint(Od))}else{Od.normalize();var p=0===r.emitterRadius?0:r.emitterRadiusInner/r.emitterRadius,m=l*(1-p)+p;r.localSpace?kd.copy(Od.mulScalar(m*r.emitterRadius)):kd.copy(n).add(Od.mulScalar(m*r.emitterRadius))}var _,v,g,y,x,S=-_t.lerp(r.rate,r.rate2,a)*s;if(r.pack8){var b=(kd.x-r.worldBounds.center.x)/r.worldBoundsSize.x+.5,T=(kd.y-r.worldBounds.center.y)/r.worldBoundsSize.y+.5,w=(kd.z-r.worldBounds.center.z)/r.worldBoundsSize.z+.5,E=_t.lerp(r.startAngle*_t.DEG_TO_RAD,r.startAngle2*_t.DEG_TO_RAD,a);E=E%(2*Math.PI)/(2*Math.PI);var A=Zd(b);t[4*s]=A[0],t[4*s+1]=A[1];var C=Zd(T);t[4*s+2]=C[0],t[4*s+3]=C[1];var M=Zd(w);t[4*s+0+4*r.numParticlesPot]=M[0],t[4*s+1+4*r.numParticlesPot]=M[1];var P=Zd(E);t[4*s+2+4*r.numParticlesPot]=P[0],t[4*s+3+4*r.numParticlesPot]=P[1];t[4*s+3+4*r.numParticlesPot*2]=1;var R=Math.max(r.lifetime,(r.numParticles-1)*Math.max(r.rate,r.rate2)),I=r.lifetime+1,D=(v=qd(_=S=(S+R)/(R+I)),g=qd(255*_),y=qd(65025*_),x=qd(160581375*_),[v-=g/255,g-=y/255,y-=x/255,x-=x/255]);t[4*s+0+4*r.numParticlesPot*3]=D[0],t[4*s+1+4*r.numParticlesPot*3]=D[1],t[4*s+2+4*r.numParticlesPot*3]=D[2],t[4*s+3+4*r.numParticlesPot*3]=D[3]}else t[4*s]=kd.x,t[4*s+1]=kd.y,t[4*s+2]=kd.z,t[4*s+3]=_t.lerp(r.startAngle*_t.DEG_TO_RAD,r.startAngle2*_t.DEG_TO_RAD,a),t[4*s+3+4*r.numParticlesPot]=S},e.update=function(t,e,i,n,s,r,a,o){var h,l,c,u=this._emitter;if(u.meshInstance.node){for(var d=u.meshInstance.node.worldTransform,f=0;f<12;f++)Dd.data[f]=d.data[f];Ld.copy(Dd),Ld.invert(),rd=u.meshInstance.node.localScale,Id=Math.max(Math.max(rd.x,rd.y),rd.z)}r=null===u.meshInstance.node||u.localSpace?Ct.ZERO:u.meshInstance.node.getPosition();for(var p,m,_,v,g,y,x,S,b=u.camera?u.camera._node.getPosition():Ct.ZERO,T=u.useMesh?17:15,w=u.precision-1,E=0;E=P)&&this.calcSpawnPosition(i,n,s,r,A);var k=R>0&&R0&&(1===u.emitterShape?(Od.copy(Fd).mulScalar(2).sub(Ct.ONE).normalize(),Ud.add(Od.mulScalar(u.initialVelocity))):Ud.add(Ct.FORWARD.mulScalar(u.initialVelocity))),Nd.x+=(zd.x-Nd.x)*Fd.x,Nd.y+=(zd.y-Nd.y)*Fd.y,Nd.z+=(zd.z-Nd.z)*Fd.z,_+=(v-_)*Fd.y,D=(D+1e4*C%1*(g-D))*Id,L=1e3*C%1*(x-y),u.meshInstance.node&&(u.localSpace?(Ud.x/=rd.x,Ud.y/=rd.y,Ud.z/=rd.z):Dd.transformPoint(Ud,Ud)),u.localSpace?(Ld.transformPoint(Nd,Nd),Ud.add(Nd).add(Gd)):(Ud.add(Nd.mul(rd)),Ud.add(Gd.mul(rd))),Xd.copy(Ud),Hd.copy(Bd).add(Ud.mulScalar(a)),Wd.copy(Hd),i[4*A]=Wd.x,i[4*A+1]=Wd.y,i[4*A+2]=Wd.z,i[4*A+3]+=_*a,u.wrap&&u.wrapBounds&&(u.localSpace||Wd.sub(r),Wd.x=Kd(Wd.x,u.wrapBounds.x)-.5*u.wrapBounds.x,Wd.y=Kd(Wd.y,u.wrapBounds.y)-.5*u.wrapBounds.y,Wd.z=Kd(Wd.z,u.wrapBounds.z)-.5*u.wrapBounds.z,u.localSpace||Wd.add(r)),u.sort>0&&(1===u.sort?(jd.copy(Wd).sub(b),u.particleDistance[A]=-(jd.x*jd.x+jd.y*jd.y+jd.z*jd.z)):2===u.sort?u.particleDistance[A]=R:3===u.sort&&(u.particleDistance[A]=-R))),o?R<0&&(i[4*A+3+2*u.numParticlesPot*4]=-1):(R>=P&&(R-=Math.max(P,(u.numParticles-1)*M),i[4*A+3+2*u.numParticlesPot*4]=u.loop?1:-1),R<0&&u.loop&&(i[4*A+3+2*u.numParticlesPot*4]=1)),i[4*A+3+2*u.numParticlesPot*4]<0&&(k=!1),i[4*A+3+4*u.numParticlesPot]=R;for(var O=0;O0&&u.camera){for(var V=u.useMesh?6:4,G=u.particleDistance,H=0;Ht.maxTextureSize&&(this.numParticles=t.maxTextureSize),gf("rate",1),gf("rate2",this.rate),gf("lifetime",50),gf("emitterExtents",new Ct(0,0,0)),gf("emitterExtentsInner",new Ct(0,0,0)),gf("emitterRadius",0),gf("emitterRadiusInner",0),gf("emitterShape",0),gf("initialVelocity",1),gf("wrap",!1),gf("localSpace",!1),gf("screenSpace",!1),gf("wrapBounds",null),gf("colorMap",this.defaultParamTexture),gf("normalMap",null),gf("loop",!0),gf("preWarm",!1),gf("sort",0),gf("mode",0),gf("scene",null),gf("lighting",!1),gf("halfLambert",!1),gf("intensity",1),gf("stretch",0),gf("alignToMotion",!1),gf("depthSoftening",0),gf("mesh",null),gf("particleNormal",new Ct(0,1,0)),gf("orientation",0),gf("depthWrite",!1),gf("noFog",!1),gf("blendType",2),gf("node",null),gf("startAngle",0),gf("startAngle2",this.startAngle),gf("animTilesX",1),gf("animTilesY",1),gf("animStartFrame",0),gf("animNumFrames",1),gf("animNumAnimations",1),gf("animIndex",0),gf("randomizeAnimIndex",!1),gf("animSpeed",1),gf("animLoop",!0),this._gpuUpdater=new ef(this,i),this._cpuUpdater=new Qd(this),this.emitterPosUniform=new Float32Array(3),this.wrapBoundsUniform=new Float32Array(3),this.emitterScaleUniform=new Float32Array([1,1,1]),gf("colorGraph",uf),gf("colorGraph2",this.colorGraph),gf("scaleGraph",lf),gf("scaleGraph2",this.scaleGraph),gf("alphaGraph",lf),gf("alphaGraph2",this.alphaGraph),gf("localVelocityGraph",cf),gf("localVelocityGraph2",this.localVelocityGraph),gf("velocityGraph",cf),gf("velocityGraph2",this.velocityGraph),gf("rotationSpeedGraph",hf),gf("rotationSpeedGraph2",this.rotationSpeedGraph),gf("radialSpeedGraph",hf),gf("radialSpeedGraph2",this.radialSpeedGraph),this.animTilesParams=new Float32Array(2),this.animParams=new Float32Array(4),this.animIndexParams=new Float32Array(2),this.internalTex0=null,this.internalTex1=null,this.internalTex2=null,this.colorParam=null,this.vbToSort=null,this.vbOld=null,this.particleDistance=null,this.camera=null,this.swapTex=!1,this.useMesh=!0,this.useCpu=!t.supportsGpuParticles,this.pack8=!0,this.localBounds=new qt,this.worldBoundsNoTrail=new qt,this.worldBoundsTrail=[new qt,new qt],this.worldBounds=new qt,this.worldBoundsSize=new Ct,this.prevWorldBoundsSize=new Ct,this.prevWorldBoundsCenter=new Ct,this.prevEmitterExtents=this.emitterExtents,this.prevEmitterRadius=this.emitterRadius,this.worldBoundsMul=new Ct,this.worldBoundsAdd=new Ct,this.timeToSwitchBounds=0,this.shaderParticleUpdateRespawn=null,this.shaderParticleUpdateNoRespawn=null,this.shaderParticleUpdateOnStop=null,this.numParticleVerts=0,this.numParticleIndices=0,this.material=null,this.meshInstance=null,this.drawOrder=0,this.seed=Math.random(),this.fixedTimeStep=1/60,this.maxSubSteps=10,this.simTime=0,this.simTimeTotal=0,this.beenReset=!1,this._layer=null,this.rebuild()}var e=t.prototype;return e.onChangeCamera=function(){this.regenShader(),this.resetMaterial()},e.calculateBoundsMad=function(){this.worldBoundsMul.x=1/this.worldBoundsSize.x,this.worldBoundsMul.y=1/this.worldBoundsSize.y,this.worldBoundsMul.z=1/this.worldBoundsSize.z,this.worldBoundsAdd.copy(this.worldBounds.center).mul(this.worldBoundsMul).mulScalar(-1),this.worldBoundsAdd.x+=.5,this.worldBoundsAdd.y+=.5,this.worldBoundsAdd.z+=.5},e.calculateWorldBounds=function(){if(this.node){if(this.prevWorldBoundsSize.copy(this.worldBoundsSize),this.prevWorldBoundsCenter.copy(this.worldBounds.center),!this.useCpu){(0===this.emitterShape?!this.emitterExtents.equals(this.prevEmitterExtents):!(this.emitterRadius===this.prevEmitterRadius))&&this.calculateLocalBounds()}var t=this.node.getWorldTransform();this.localSpace?this.worldBoundsNoTrail.copy(this.localBounds):this.worldBoundsNoTrail.setFromTransformedAabb(this.localBounds,t),this.worldBoundsTrail[0].add(this.worldBoundsNoTrail),this.worldBoundsTrail[1].add(this.worldBoundsNoTrail);var e=this.simTimeTotal;e>=this.timeToSwitchBounds&&(this.worldBoundsTrail[0].copy(this.worldBoundsTrail[1]),this.worldBoundsTrail[1].copy(this.worldBoundsNoTrail),this.timeToSwitchBounds=e+this.lifetime),this.worldBounds.copy(this.worldBoundsTrail[0]),this.worldBoundsSize.copy(this.worldBounds.halfExtents).mulScalar(2),this.localSpace?(this.meshInstance.aabb.setFromTransformedAabb(this.worldBounds,t),this.meshInstance.mesh.aabb.setFromTransformedAabb(this.worldBounds,t)):(this.meshInstance.aabb.copy(this.worldBounds),this.meshInstance.mesh.aabb.copy(this.worldBounds)),this.meshInstance._aabbVer=1-this.meshInstance._aabbVer,this.pack8&&this.calculateBoundsMad()}},e.resetWorldBounds=function(){this.node&&(this.worldBoundsNoTrail.setFromTransformedAabb(this.localBounds,this.localSpace?zt.IDENTITY:this.node.getWorldTransform()),this.worldBoundsTrail[0].copy(this.worldBoundsNoTrail),this.worldBoundsTrail[1].copy(this.worldBoundsNoTrail),this.worldBounds.copy(this.worldBoundsTrail[0]),this.worldBoundsSize.copy(this.worldBounds.halfExtents).mulScalar(2),this.prevWorldBoundsSize.copy(this.worldBoundsSize),this.prevWorldBoundsCenter.copy(this.worldBounds.center),this.simTimeTotal=0,this.timeToSwitchBounds=0)},e.calculateLocalBounds=function(){for(var t,e,i,n=Number.MAX_VALUE,s=Number.MAX_VALUE,r=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=-Number.MAX_VALUE,h=-Number.MAX_VALUE,l=0,c=0,u=this.lifetime/this.precision,d=[this.qVelocity,this.qVelocity2],f=[this.qLocalVelocity,this.qLocalVelocity2],p=[0,0],m=[0,0],_=[0,0],v=[0,0],g=[0,0],y=0;y0||t.maxVertexTextures<=1||t.fragmentUniformsCount<64||t.forceCpuParticles||!t.extTextureFloat,this._destroyResources(),this.pack8=(this.pack8||!t.textureFloatRenderable)&&!this.useCpu,df=this.useCpu||this.pack8?4:2,this.useMesh=!1,this.mesh)&&(this.numParticles*this.mesh.vertexBuffer.numVertices>65535||(this.useMesh=!0));this.numParticlesPot=_t.nextPowerOfTwo(this.numParticles),this.rebuildGraphs(),this.calculateLocalBounds(),this.resetWorldBounds(),this.node&&(this.worldBounds.setFromTransformedAabb(this.localBounds,this.localSpace?zt.IDENTITY:this.node.getWorldTransform()),this.worldBoundsTrail[0].copy(this.worldBounds),this.worldBoundsTrail[1].copy(this.worldBounds),this.worldBoundsSize.copy(this.worldBounds.halfExtents).mulScalar(2),this.prevWorldBoundsSize.copy(this.worldBoundsSize),this.prevWorldBoundsCenter.copy(this.worldBounds.center),this.pack8&&this.calculateBoundsMad()),this.vbToSort=new Array(this.numParticles);for(var e=0;e=1&&(this.animTilesX>1||this.animTilesY>1)&&(this.colorMap&&this.colorMap!==this.defaultParamTexture||this.normalMap)},e.rebuildGraphs=function(){var t=this.precision,e=this.graphicsDevice;this.qLocalVelocity=this.localVelocityGraph.quantize(t),this.qVelocity=this.velocityGraph.quantize(t),this.qColor=this.colorGraph.quantizeClamped(t,0,1),this.qRotSpeed=this.rotationSpeedGraph.quantize(t),this.qScale=this.scaleGraph.quantize(t),this.qAlpha=this.alphaGraph.quantize(t),this.qRadialSpeed=this.radialSpeedGraph.quantize(t),this.qLocalVelocity2=this.localVelocityGraph2.quantize(t),this.qVelocity2=this.velocityGraph2.quantize(t),this.qColor2=this.colorGraph2.quantizeClamped(t,0,1),this.qRotSpeed2=this.rotationSpeedGraph2.quantize(t),this.qScale2=this.scaleGraph2.quantize(t),this.qAlpha2=this.alphaGraph2.quantize(t),this.qRadialSpeed2=this.radialSpeedGraph2.quantize(t);for(var i=0;i0&&t.setParameter("softening",1/(this.depthSoftening*this.depthSoftening*100)),this.stretch>0&&(t.cull=_e),this._compParticleFaceParams()},e._compParticleFaceParams=function(){var t,e;if(0===this.orientation)t=new Float32Array([1,0,0]),e=new Float32Array([0,0,1]);else{var i;if(1===this.orientation)i=this.particleNormal.normalize();else i=(null===this.node?zt.IDENTITY:this.node.getWorldTransform()).transformVector(this.particleNormal).normalize();var n=new Ct(1,0,0);1===Math.abs(n.dot(i))&&n.set(0,0,1);var s=(new Ct).cross(i,n).normalize();n.cross(s,i).normalize(),t=new Float32Array([n.x,n.y,n.z]),e=new Float32Array([s.x,s.y,s.z])}this.material.setParameter("faceTangent",t),this.material.setParameter("faceBinorm",e)},e._allocate=function(t){var e=t*this.numParticleVerts,i=t*this.numParticleIndices;if(void 0===this.vertexBuffer||this.vertexBuffer.getNumVertices()!==e){if(this.useCpu){var n=[{semantic:ti,components:4,type:6},{semantic:ei,components:4,type:6},{semantic:ii,components:4,type:6},{semantic:ni,components:1,type:6},{semantic:si,components:this.useMesh?4:2,type:6}],s=new Cn(this.graphicsDevice,n);this.vertexBuffer=new yn(this.graphicsDevice,s,e,{usage:1}),this.indexBuffer=new Qr(this.graphicsDevice,1,i)}else{var r=[{semantic:ti,components:4,type:6}];this.useMesh&&r.push({semantic:ei,components:2,type:6});var a=new Cn(this.graphicsDevice,r);this.vertexBuffer=new yn(this.graphicsDevice,a,e,{usage:1}),this.indexBuffer=new Qr(this.graphicsDevice,1,i)}var o,h,l,c=new Float32Array(this.vertexBuffer.lock());if(this.useMesh){h=(o=new Float32Array(this.mesh.vertexBuffer.lock())).length/this.mesh.vertexBuffer.numVertices;for(var u=0;uthis.endTime&&(this.onFinished&&this.onFinished(),this.meshInstance.visible=!1),this.meshInstance&&(this.meshInstance.drawOrder=this.drawOrder)},e._destroyResources=function(){this.particleTexIN&&(this.particleTexIN.destroy(),this.particleTexIN=null),this.particleTexOUT&&(this.particleTexOUT.destroy(),this.particleTexOUT=null),this.particleTexStart&&this.particleTexStart.destroy&&(this.particleTexStart.destroy(),this.particleTexStart=null),this.rtParticleTexIN&&(this.rtParticleTexIN.destroy(),this.rtParticleTexIN=null),this.rtParticleTexOUT&&(this.rtParticleTexOUT.destroy(),this.rtParticleTexOUT=null),this.internalTex0&&(this.internalTex0.destroy(),this.internalTex0=null),this.internalTex1&&(this.internalTex1.destroy(),this.internalTex1=null),this.internalTex2&&(this.internalTex2.destroy(),this.internalTex2=null),this.internalTex3&&(this.internalTex3.destroy(),this.internalTex3=null),this.colorParam&&(this.colorParam.destroy(),this.colorParam=null),this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBuffer=void 0),this.indexBuffer&&(this.indexBuffer.destroy(),this.indexBuffer=void 0),this.material&&(this.material.destroy(),this.material=null)},e.destroy=function(){this.camera=null,this._destroyResources()},v(t,[{key:"defaultParamTexture",get:function(){var t=this;return Tf.get(this.graphicsDevice,(function(){for(var e=16,i=new Float32Array(1024),n=0;n0&&this.material.transparent===e&&(this.mesh.setPositions(this.positions),this.mesh.setColors(this.colors),this.mesh.update(1,!1),this.meshInstance||(this.meshInstance=new jh(this.mesh,this.material,Nf)),t.push(this.meshInstance))},e.clear=function(){this.positions.length=0,this.colors.length=0},t}(),zf=function(){function t(t){this.device=t,this.map=new Map}var e=t.prototype;return e.getBatch=function(t,e){var i=this.map.get(t);return i||(i=new Uf(this.device,t,e),this.map.set(t,i)),i},e.onPreRender=function(t,e){this.map.forEach((function(i){i.onPreRender(t,e)}))},e.clear=function(){this.map.forEach((function(t){return t.clear()}))},t}(),Vf=[],Gf=new Ct,Hf=function(){function t(t){this.device=t,this.quadMesh=null,this.textureShader=null,this.depthTextureShader=null,this.cubeLocalPos=null,this.cubeWorldPos=null,this.batchesMap=new Map,this.allBatches=new Set,this.updatedLayers=new Set,this._materialDepth=null,this._materialNoDepth=null,this.layerMeshInstances=new Map}var e=t.prototype;return e.createMaterial=function(t){var e=new oh;return e.vertexColors=!0,e.blendType=2,e.depthTest=t,e.update(),e},e.getBatch=function(t,e){var i=this.batchesMap.get(t);i||(i=new zf(this.device),this.batchesMap.set(t,i)),this.allBatches.add(i);var n=e?this.materialDepth:this.materialNoDepth;return i.getBatch(n,t)},e.getShader=function(t,e){if(!this[t]){this[t]=Vo(this.device,"\n\t\t\t\tattribute vec2 vertex_position;\n\t\t\t\tuniform mat4 matrix_model;\n\t\t\t\tvarying vec2 uv0;\n\t\t\t\tvoid main(void) {\n\t\t\t\t\tgl_Position = matrix_model * vec4(vertex_position, 0, 1);\n\t\t\t\t\tuv0 = vertex_position.xy + 0.5;\n\t\t\t\t}\n\t\t\t",e,"DebugShader:"+t)}return this[t]},e.getTextureShader=function(){return this.getShader("textureShader","\n\t\t\tvarying vec2 uv0;\n\t\t\tuniform sampler2D colorMap;\n\t\t\tvoid main (void) {\n\t\t\t\tgl_FragColor = vec4(texture2D(colorMap, uv0).xyz, 1);\n\t\t\t}\n\t\t")},e.getUnfilterableTextureShader=function(){return this.getShader("textureShaderUnfilterable","\n\t\t\tvarying vec2 uv0;\n\t\t\tuniform highp sampler2D colorMap;\n\t\t\tvoid main (void) {\n\t\t\t\tivec2 uv = ivec2(uv0 * textureSize(colorMap, 0));\n\t\t\t\tgl_FragColor = vec4(texelFetch(colorMap, uv, 0).xyz, 1);\n\t\t\t}\n\t\t")},e.getDepthTextureShader=function(){return this.getShader("depthTextureShader","\n\t\t\t"+Oo.screenDepthPS+"\n\t\t\tvarying vec2 uv0;\n\t\t\tvoid main() {\n\t\t\t\tfloat depth = getLinearScreenDepth(getImageEffectUV(uv0)) * camera_params.x;\n\t\t\t\tgl_FragColor = vec4(vec3(depth), 1.0);\n\t\t\t}\n\t\t")},e.getQuadMesh=function(){return this.quadMesh||(this.quadMesh=new vh(this.device),this.quadMesh.setPositions([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),this.quadMesh.update(Be)),this.quadMesh},e.drawMesh=function(t,e,i,n,s){if(!n){var r=this.getGraphNode(e);n=new jh(i,t,r)}var a=this.layerMeshInstances.get(s);a||(a=[],this.layerMeshInstances.set(s,a)),a.push(n)},e.drawWireAlignedBox=function(t,e,i,n,s,r){if(r){var a=function(t,e,i){Gf.set(t,e,i),r.transformPoint(Gf,Gf),Vf.push(Gf.x,Gf.y,Gf.z)};a(t.x,t.y,t.z),a(t.x,e.y,t.z),a(t.x,e.y,t.z),a(e.x,e.y,t.z),a(e.x,e.y,t.z),a(e.x,t.y,t.z),a(e.x,t.y,t.z),a(t.x,t.y,t.z),a(t.x,t.y,e.z),a(t.x,e.y,e.z),a(t.x,e.y,e.z),a(e.x,e.y,e.z),a(e.x,e.y,e.z),a(e.x,t.y,e.z),a(e.x,t.y,e.z),a(t.x,t.y,e.z),a(t.x,t.y,t.z),a(t.x,t.y,e.z),a(t.x,e.y,t.z),a(t.x,e.y,e.z),a(e.x,e.y,t.z),a(e.x,e.y,e.z),a(e.x,t.y,t.z),a(e.x,t.y,e.z)}else Vf.push(t.x,t.y,t.z,t.x,e.y,t.z,t.x,e.y,t.z,e.x,e.y,t.z,e.x,e.y,t.z,e.x,t.y,t.z,e.x,t.y,t.z,t.x,t.y,t.z,t.x,t.y,e.z,t.x,e.y,e.z,t.x,e.y,e.z,e.x,e.y,e.z,e.x,e.y,e.z,e.x,t.y,e.z,e.x,t.y,e.z,t.x,t.y,e.z,t.x,t.y,t.z,t.x,t.y,e.z,t.x,e.y,t.z,t.x,e.y,e.z,e.x,e.y,t.z,e.x,e.y,e.z,e.x,t.y,t.z,e.x,t.y,e.z);this.getBatch(s,n).addLinesArrays(Vf,i),Vf.length=0},e.drawWireSphere=function(t,e,i,n,s,r){for(var a=2*Math.PI/n,o=0,h=0;hi){this._time=this.looping?0:i;for(var n=0;n=0?1:-1,l=0;l=0;m+=h){var _=d[m],v=d[m+1];if(_.time<=this._time&&v.time>=this._time){var g=(this._time-_.time)/(v.time-_.time);f._pos.lerp(_.position,v.position,g),f._quat.slerp(_.rotation,v.rotation,g),f._scale.lerp(_.scale,v.scale,g),f._written=!0,this._currKeyIndices[u]=m,p=!0;break}}(1===d.length||!p&&0===this._time&&this.looping)&&(f._pos.copy(d[0].position),f._quat.copy(d[0].rotation),f._scale.copy(d[0].scale),f._written=!0)}}}},e.blend=function(t,e,i){for(var n=this._interpolatedKeys.length,s=0;s0)for(var x=0;x<=s;x++)for(var S=0;S<=r;S++){var b=S/r*2*Math.PI-Math.PI,T=Math.sin(b),w=Math.cos(b);f.set(T*e,-n/2,w*e),d.set(T*i,n/2,w*i),l.lerp(f,d,x/s),c.sub2(d,f).normalize(),p.set(w,0,-T),u.cross(p,c).normalize(),m.push(l.x,l.y,l.z),_.push(u.x,u.y,u.z);var E=S/r,A=x/s;v.push(E,1-A);var C=A;if(A=E,E=(E=C)*op+ap,A=A*op+ap,E/=3,g.push(E,1-A),x0)for(var ft=0;ft1&&y.push(h,h+ft,h+ft-1)}if(h+=r,i>0)for(var xt=0;xt1&&y.push(h,h+xt-1,h+xt)}}return o.positions=m,o.normals=_,o.uvs=v,o.uvs1=g,o.indices=y,o}return x(e,t),e}(Rf),lp=function(t){function e(e){var i,n,s,r,a;void 0===e&&(e={});var o=null!=(i=e.radius)?i:.3,h=null!=(n=e.height)?n:1,l=null!=(s=e.heightSegments)?s:1,c=null!=(r=e.sides)?r:20;return a=t.call(this,o,o,h-2*o,l,c,!0)||this,e.calculateTangents&&(a.tangents=Pf(a.positions,a.normals,a.uvs,a.indices)),a}return x(e,t),e}(hp),cp=function(t){function e(e){var i,n,s,r,a,o;void 0===e&&(e={});var h=null!=(i=e.baseRadius)?i:.5,l=null!=(n=e.peakRadius)?n:0,c=null!=(s=e.height)?s:1,u=null!=(r=e.heightSegments)?r:5,d=null!=(a=e.capSegments)?a:18;return o=t.call(this,h,l,c,u,d,!1)||this,e.calculateTangents&&(o.tangents=Pf(o.positions,o.normals,o.uvs,o.indices)),o}return x(e,t),e}(hp),up=function(t){function e(e){var i,n,s,r,a;void 0===e&&(e={});var o=null!=(i=e.radius)?i:.5,h=null!=(n=e.height)?n:1,l=null!=(s=e.heightSegments)?s:5,c=null!=(r=e.capSegments)?r:20;return a=t.call(this,o,o,h,l,c,!1)||this,e.calculateTangents&&(a.tangents=Pf(a.positions,a.normals,a.uvs,a.indices)),a}return x(e,t),e}(hp),dp=function(t){function e(e){var i,n,s,r;void 0===e&&(e={}),r=t.call(this)||this;for(var a=null!=(i=e.halfExtents)?i:new It(.5,.5),o=null!=(n=e.widthSegments)?n:5,h=null!=(s=e.lengthSegments)?s:5,l=[],c=[],u=[],d=[],f=0,p=0;p<=o;p++)for(var m=0;m<=h;m++){var _=-a.x+2*a.x*p/o,v=-(-a.y+2*a.y*m/h),g=p/o,y=m/h;l.push(_,0,v),c.push(0,1,0),u.push(g,1-y),p 0.5) {\n\t\tif (dAtten > 0.00001) {\n\t\t\tdirLm.xyz = dirLm.xyz * 2.0 - vec3(1.0);\n\t\t\tdAtten = saturate(dAtten);\n\t\t\tgl_FragColor.rgb = normalize(dLightDirNormW.xyz*dAtten + dirLm.xyz*dirLm.w) * 0.5 + vec3(0.5);\n\t\t\tgl_FragColor.a = dirLm.w + dAtten;\n\t\t\tgl_FragColor.a = max(gl_FragColor.a, 1.0 / 255.0);\n\t\t} else {\n\t\t\tgl_FragColor = dirLm;\n\t\t}\n\t} else {\n\t\tgl_FragColor.rgb = dirLm.xyz;\n\t\tgl_FragColor.a = max(dirLm.w, dAtten > 0.00001? (1.0/255.0) : 0.0);\n\t}\n",bakeLmEndPS:"\n#ifdef LIGHTMAP_RGBM\n\tgl_FragColor.rgb = dDiffuseLight;\n\tgl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(0.5));\n\tgl_FragColor.rgb /= 8.0;\n\tgl_FragColor.a = clamp( max( max( gl_FragColor.r, gl_FragColor.g ), max( gl_FragColor.b, 1.0 / 255.0 ) ), 0.0,1.0 );\n\tgl_FragColor.a = ceil(gl_FragColor.a * 255.0) / 255.0;\n\tgl_FragColor.rgb /= gl_FragColor.a;\n#else\n\tgl_FragColor = vec4(dDiffuseLight, 1.0);\n#endif\n",dilatePS:"\nvarying vec2 vUv0;\nuniform sampler2D source;\nuniform vec2 pixelOffset;\nvoid main(void) {\n\tvec4 c = texture2DLodEXT(source, vUv0, 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 - pixelOffset, 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(0, -pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(pixelOffset.x, -pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(-pixelOffset.x, 0), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(pixelOffset.x, 0), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(-pixelOffset.x, pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(0, pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + pixelOffset, 0.0);\n\tgl_FragColor = c;\n}\n",bilateralDeNoisePS:"\nfloat normpdf3(in vec3 v, in float sigma) {\n\treturn 0.39894 * exp(-0.5 * dot(v, v) / (sigma * sigma)) / sigma;\n}\nvec3 decodeRGBM(vec4 rgbm) {\n\tvec3 color = (8.0 * rgbm.a) * rgbm.rgb;\n\treturn color * color;\n}\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvec4 encodeRGBM(vec3 color) {\n\tvec4 encoded;\n\tencoded.rgb = pow(color.rgb, vec3(0.5));\n\tencoded.rgb *= 1.0 / 8.0;\n\tencoded.a = saturate( max( max( encoded.r, encoded.g ), max( encoded.b, 1.0 / 255.0 ) ) );\n\tencoded.a = ceil(encoded.a * 255.0) / 255.0;\n\tencoded.rgb /= encoded.a;\n\treturn encoded;\n}\n#define MSIZE 15\nvarying vec2 vUv0;\nuniform sampler2D source;\nuniform vec2 pixelOffset;\nuniform vec2 sigmas;\nuniform float bZnorm;\nuniform float kernel[MSIZE];\nvoid main(void) {\n\t\n\tvec4 pixelRgbm = texture2DLodEXT(source, vUv0, 0.0);\n\tif (pixelRgbm.a <= 0.0) {\n\t\tgl_FragColor = pixelRgbm;\n\t\treturn ;\n\t}\n\tfloat sigma = sigmas.x;\n\tfloat bSigma = sigmas.y;\n\tvec3 pixelHdr = decodeRGBM(pixelRgbm);\n\tvec3 accumulatedHdr = vec3(0.0);\n\tfloat accumulatedFactor = 0.0;\n\tconst int kSize = (MSIZE-1)/2;\n\tfor (int i = -kSize; i <= kSize; ++i) {\n\t\tfor (int j = -kSize; j <= kSize; ++j) {\n\t\t\t\n\t\t\tvec2 coord = vUv0 + vec2(float(i), float(j)) * pixelOffset;\n\t\t\tvec4 rgbm = texture2DLodEXT(source, coord, 0.0);\n\t\t\tif (rgbm.a > 0.0) {\n\t\t\t\tvec3 hdr = decodeRGBM(rgbm);\n\t\t\t\tfloat factor = kernel[kSize + j] * kernel[kSize + i];\n\t\t\t\tfactor *= normpdf3(hdr - pixelHdr, bSigma) * bZnorm;\n\t\t\t\taccumulatedHdr += factor * hdr;\n\t\t\t\taccumulatedFactor += factor;\n\t\t\t}\n\t\t}\n\t}\n\tgl_FragColor = encodeRGBM(accumulatedHdr / accumulatedFactor);\n}\n"},_p=new zt,vp=new Vt,gp=new qt,yp=new qt,xp=new vt(1,1,0,.4),Sp=.28209479177387814,bp=function(t,e,i,n,s){var r=t.getProp("x"),a=t.getProp("y"),o=t.getProp("z"),h=t.getProp("rot_1"),l=t.getProp("rot_2"),c=t.getProp("rot_3"),u=t.getProp("rot_0"),d=t.getProp("scale_0"),f=t.getProp("scale_1"),p=t.getProp("scale_2"),m=t.getProp("f_dc_0"),_=t.getProp("f_dc_1"),v=t.getProp("f_dc_2"),g=t.getProp("opacity");this.read=function(t){e&&(e.x=r[t],e.y=a[t],e.z=o[t]),i&&i.set(h[t],l[t],c[t],u[t]),n&&n.set(Math.exp(d[t]),Math.exp(f[t]),Math.exp(p[t])),s&&s.set(.5+m[t]*Sp,.5+_[t]*Sp,.5+v[t]*Sp,function(t){if(t>0)return 1/(1+Math.exp(-t));var e=Math.exp(t);return e/(1+e)}(g[t]))}},Tp=function(t,e,i){vp.set(i.x,i.y,i.z,i.w).normalize(),t.setTRS(e,vp,Ct.ONE)},wp=function(){function t(t){this.elements=void 0,this.numSplats=void 0,this.elements=t,this.numSplats=this.getElement("vertex").count}t.calcSplatAabb=function(t,e,i,n){Tp(_p,e,i),gp.center.set(0,0,0),gp.halfExtents.set(2*n.x,2*n.y,2*n.z),t.setFromTransformedAabb(gp,_p)};var e=t.prototype;return e.getProp=function(t,e){var i;return void 0===e&&(e="vertex"),null==(i=this.getElement(e))||null==(i=i.properties.find((function(e){return e.name===t})))?void 0:i.storage},e.getElement=function(t){return this.elements.find((function(e){return e.name===t}))},e.addProp=function(t,e){this.getElement("vertex").properties.push({type:"float",name:t,storage:e,byteSize:4})},e.createIter=function(t,e,i,n){return new bp(this,t,e,i,n)},e.calcAabb=function(t,e){for(var i,n,s,r,a,o,h=!0,l=this.getProp("x"),c=this.getProp("y"),u=this.getProp("z"),d=this.getProp("scale_0"),f=this.getProp("scale_1"),p=this.getProp("scale_2"),m=0;mi&&(i=t[n]);return{min:e,max:i}},e=function(t,e,i){var n=function(t){return t=153391689&((t=51130563&((t=50393103&((t=4278190335&((t&=1023)^t<<16))^t<<8))^t<<4))^t<<2)};return(n(i)<<2)+(n(e)<<1)+n(t)},i=this.getProp("x"),n=this.getProp("y"),s=this.getProp("z"),r=t(i),a=r.min,o=r.max,h=t(n),l=h.min,c=h.max,u=t(s),d=u.min,f=u.max,p=a===o?0:1024/(o-a),m=l===c?0:1024/(c-l),_=d===f?0:1024/(f-d),v=new Map,g=0;g= numSplats) {\n\t\t\treturn false;\n\t\t}\n\t\tivec2 orderUV = ivec2(\n\t\t\tint(orderId % textureWidth),\n\t\t\tint(orderId / textureWidth)\n\t\t);\n\t\tsplatId = texelFetch(splatOrder, orderUV, 0).r;\n\t\tsplatUV = ivec2(\n\t\t\tint(splatId % textureWidth),\n\t\t\tint(splatId / textureWidth)\n\t\t);\n\t\treturn true;\n\t}\n\tuvec4 tA;\n\tvec3 getCenter() {\n\t\ttA = texelFetch(transformA, splatUV, 0);\n\t\treturn uintBitsToFloat(tA.xyz);\n\t}\n\tvoid getCovariance(out vec3 covA, out vec3 covB) {\n\t\tvec4 tB = texelFetch(transformB, splatUV, 0);\n\t\tvec2 tC = unpackHalf2x16(tA.w);\n\t\tcovA = tB.xyz;\n\t\tcovB = vec3(tC.x, tC.y, tB.w);\n\t}\n\tvec4 calcV1V2(in vec3 splat_cam, in vec3 covA, in vec3 covB, mat3 W) {\n\t\tmat3 Vrk = mat3(\n\t\t\tcovA.x, covA.y, covA.z, \n\t\t\tcovA.y, covB.x, covB.y,\n\t\t\tcovA.z, covB.y, covB.z\n\t\t);\n\t\tfloat focal = viewport.x * matrix_projection[0][0];\n\t\tfloat J1 = focal / splat_cam.z;\n\t\tvec2 J2 = -J1 / splat_cam.z * splat_cam.xy;\n\t\tmat3 J = mat3(\n\t\t\tJ1, 0.0, J2.x, \n\t\t\t0.0, J1, J2.y, \n\t\t\t0.0, 0.0, 0.0\n\t\t);\n\t\tmat3 T = W * J;\n\t\tmat3 cov = transpose(T) * Vrk * T;\n\t\tfloat diagonal1 = cov[0][0] + 0.3;\n\t\tfloat offDiagonal = cov[0][1];\n\t\tfloat diagonal2 = cov[1][1] + 0.3;\n\t\tfloat mid = 0.5 * (diagonal1 + diagonal2);\n\t\tfloat radius = length(vec2((diagonal1 - diagonal2) / 2.0, offDiagonal));\n\t\tfloat lambda1 = mid + radius;\n\t\tfloat lambda2 = max(mid - radius, 0.1);\n\t\tvec2 diagonalVector = normalize(vec2(offDiagonal, lambda1 - diagonal1));\n\t\tvec2 v1 = min(sqrt(2.0 * lambda1), 1024.0) * diagonalVector;\n\t\tvec2 v2 = min(sqrt(2.0 * lambda2), 1024.0) * vec2(diagonalVector.y, -diagonalVector.x);\n\t\treturn vec4(v1, v2);\n\t}\n\tvec3 unpack111011(uint bits) {\n\t\treturn vec3(\n\t\t\tfloat(bits >> 21u) / 2047.0,\n\t\t\tfloat((bits >> 11u) & 0x3ffu) / 1023.0,\n\t\t\tfloat(bits & 0x7ffu) / 2047.0\n\t\t);\n\t}\n\tvoid fetchScale(in highp usampler2D sampler, out float scale, out vec3 a, out vec3 b, out vec3 c) {\n\t\tuvec4 t = texelFetch(sampler, splatUV, 0);\n\t\tscale = uintBitsToFloat(t.x);\n\t\ta = unpack111011(t.y) * 2.0 - 1.0;\n\t\tb = unpack111011(t.z) * 2.0 - 1.0;\n\t\tc = unpack111011(t.w) * 2.0 - 1.0;\n\t}\n\tvoid fetch(in highp usampler2D sampler, out vec3 a, out vec3 b, out vec3 c, out vec3 d) {\n\t\tuvec4 t = texelFetch(sampler, splatUV, 0);\n\t\ta = unpack111011(t.x) * 2.0 - 1.0;\n\t\tb = unpack111011(t.y) * 2.0 - 1.0;\n\t\tc = unpack111011(t.z) * 2.0 - 1.0;\n\t\td = unpack111011(t.w) * 2.0 - 1.0;\n\t}\n\t#if defined(USE_SH1)\n\t\t#define SH_C1 0.4886025119029199f\n\t\tuniform highp usampler2D splatSH_1to3;\n\t#if defined(USE_SH2)\n\t\t#define SH_C2_0 1.0925484305920792f\n\t\t#define SH_C2_1 -1.0925484305920792f\n\t\t#define SH_C2_2 0.31539156525252005f\n\t\t#define SH_C2_3 -1.0925484305920792f\n\t\t#define SH_C2_4 0.5462742152960396f\n\t\tuniform highp usampler2D splatSH_4to7;\n\t\tuniform highp usampler2D splatSH_8to11;\n\t#if defined(USE_SH3)\n\t\t#define SH_C3_0 -0.5900435899266435f\n\t\t#define SH_C3_1 2.890611442640554f\n\t\t#define SH_C3_2 -0.4570457994644658f\n\t\t#define SH_C3_3 0.3731763325901154f\n\t\t#define SH_C3_4 -0.4570457994644658f\n\t\t#define SH_C3_5 1.445305721320277f\n\t\t#define SH_C3_6 -0.5900435899266435f\n\t\tuniform highp usampler2D splatSH_12to15;\n\t#endif\n\t#endif\n\t#endif\n\tvec3 evalSH(in vec3 dir) {\n\t\tvec3 result = vec3(0.0);\n\t#if defined(USE_SH1)\n\t\tfloat x = dir.x;\n\t\tfloat y = dir.y;\n\t\tfloat z = dir.z;\n\t\tfloat scale;\n\t\tvec3 sh1, sh2, sh3;\n\t\tfetchScale(splatSH_1to3, scale, sh1, sh2, sh3);\n\t\tresult += SH_C1 * (-sh1 * y + sh2 * z - sh3 * x);\n\t#if defined(USE_SH2)\n\t\tfloat xx = x * x;\n\t\tfloat yy = y * y;\n\t\tfloat zz = z * z;\n\t\tfloat xy = x * y;\n\t\tfloat yz = y * z;\n\t\tfloat xz = x * z;\n\t\tvec3 sh4, sh5, sh6, sh7;\n\t\tvec3 sh8, sh9, sh10, sh11;\n\t\tfetch(splatSH_4to7, sh4, sh5, sh6, sh7);\n\t\tfetch(splatSH_8to11, sh8, sh9, sh10, sh11);\n\t\tresult +=\n\t\t\tsh4 * (SH_C2_0 * xy) * +\n\t\t\tsh5 * (SH_C2_1 * yz) +\n\t\t\tsh6 * (SH_C2_2 * (2.0 * zz - xx - yy)) +\n\t\t\tsh7 * (SH_C2_3 * xz) +\n\t\t\tsh8 * (SH_C2_4 * (xx - yy));\n\t#if defined(USE_SH3)\n\t\tvec3 sh12, sh13, sh14, sh15;\n\t\tfetch(splatSH_12to15, sh12, sh13, sh14, sh15);\n\t\tresult +=\n\t\t\tsh9 * (SH_C3_0 * y * (3.0 * xx - yy)) +\n\t\t\tsh10 * (SH_C3_1 * xy * z) +\n\t\t\tsh11 * (SH_C3_2 * y * (4.0 * zz - xx - yy)) +\n\t\t\tsh12 * (SH_C3_3 * z * (2.0 * zz - 3.0 * xx - 3.0 * yy)) +\n\t\t\tsh13 * (SH_C3_4 * x * (4.0 * zz - xx - yy)) +\n\t\t\tsh14 * (SH_C3_5 * z * (xx - yy)) +\n\t\t\tsh15 * (SH_C3_6 * x * (xx - 3.0 * yy));\n\t#endif\n\t#endif\n\t\tresult *= scale;\n\t#endif\n\t\treturn result;\n\t}\n"+e.vertex,r=n+Oo.decodePS+(e.dither===Io?"":Oo.bayerPS+Oo.opacityDitherPS)+Uo.tonemapCode(e.toneMapping)+Uo.gammaCode(e.gamma)+"\n\t#ifndef DITHER_NONE\n\t\tvarying float id;\n\t#endif\n\t#ifdef PICK_PASS\n\t\tuniform vec4 uColor;\n\t#endif\n\tvec4 evalSplat(vec2 texCoord, vec4 color) {\n\t\tmediump float A = dot(texCoord, texCoord);\n\t\tif (A > 1.0) {\n\t\t\tdiscard;\n\t\t}\n\t\tmediump float B = exp(-A * 4.0) * color.a;\n\t\tif (B < 1.0 / 255.0) {\n\t\t\tdiscard;\n\t\t}\n\t\t#ifdef PICK_PASS\n\t\t\tif (B < 0.3) {\n\t\t\t\tdiscard;\n\t\t\t}\n\t\t\treturn uColor;\n\t\t#endif\n\t\t#ifndef DITHER_NONE\n\t\t\topacityDither(B, id * 0.013);\n\t\t#endif\n\t\t#ifdef TONEMAP_ENABLED\n\t\t\treturn vec4(gammaCorrectOutput(toneMap(decodeGamma(color.rgb))), B);\n\t\t#else\n\t\t\treturn vec4(color.rgb, B);\n\t\t#endif\n\t}\n"+e.fragment;return kr.createDefinition(t,{name:"SplatShader",attributes:{vertex_position:Ne,vertex_id_attrib:fi},vertexCode:s,fragmentCode:r})},t}(),Ap=new Ep,Cp=function(t){for(var e=[],i=0;i<45;++i)e.push(t.getProp("f_rest_"+i));return e},Mp=function(){function t(t,e){this.device=void 0,this.numSplats=void 0,this.centers=void 0,this.aabb=void 0,this.colorTexture=void 0,this.transformATexture=void 0,this.transformBTexture=void 0,this.hasSH=void 0,this.sh1to3Texture=void 0,this.sh4to7Texture=void 0,this.sh8to11Texture=void 0,this.sh12to15Texture=void 0;var i=e.numSplats;this.device=t,this.numSplats=i,this.centers=new Float32Array(3*e.numSplats),e.getCenters(this.centers),this.aabb=new qt,e.calcAabb(this.aabb);var n=this.evalTextureSize(i);this.colorTexture=this.createTexture("splatColor",7,n),this.transformATexture=this.createTexture("transformA",De,n),this.transformBTexture=this.createTexture("transformB",ye,n),this.updateColorData(e),this.updateTransformData(e),this.hasSH=Cp(e).every((function(t){return t})),this.hasSH&&(this.sh1to3Texture=this.createTexture("splatSH_1to3",De,n),this.sh4to7Texture=this.createTexture("splatSH_4to7",De,n),this.sh8to11Texture=this.createTexture("splatSH_8to11",De,n),this.sh12to15Texture=this.createTexture("splatSH_12to15",De,n),this.updateSHData(e))}var e=t.prototype;return e.destroy=function(){var t,e,i,n,s,r,a;null==(t=this.colorTexture)||t.destroy(),null==(e=this.transformATexture)||e.destroy(),null==(i=this.transformBTexture)||i.destroy(),null==(n=this.sh1to3Texture)||n.destroy(),null==(s=this.sh4to7Texture)||s.destroy(),null==(r=this.sh8to11Texture)||r.destroy(),null==(a=this.sh12to15Texture)||a.destroy()},e.createMaterial=function(t){var e=function(t){var e;void 0===t&&(t={});var i=null!=(e=t.dither)?e:Io,n=i!==Io,s=new ah;return s.name="splatMaterial",s.cull=_e,s.blendType=n?3:2,s.depthWrite=n,s.getShaderVariant=function(e,n,s,r,a,o,h,l){var c,u,d={pass:a,gamma:1===a?n.gammaCorrection?3:0:n.gammaCorrection,toneMapping:1===a?0:n.toneMapping,vertex:null!=(c=t.vertex)?c:"\n\tuniform vec3 view_position;\n\tuniform sampler2D splatColor;\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tmediump vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0);\n\tvoid main(void)\n\t{\n\t\tif (!calcSplatUV()) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tvec3 center = getCenter();\n\t\tmat4 model_view = matrix_view * matrix_model;\n\t\tvec4 splat_cam = model_view * vec4(center, 1.0);\n\t\tvec4 splat_proj = matrix_projection * splat_cam;\n\t\tif (splat_proj.z < -splat_proj.w) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tvec3 covA, covB;\n\t\tgetCovariance(covA, covB);\n\t\tvec4 v1v2 = calcV1V2(splat_cam.xyz, covA, covB, transpose(mat3(model_view)));\n\t\tcolor = texelFetch(splatColor, splatUV, 0);\n\t\tfloat scale = min(1.0, sqrt(-log(1.0 / 255.0 / color.a)) / 2.0);\n\t\tv1v2 *= scale;\n\t\tif (dot(v1v2.xy, v1v2.xy) < 4.0 && dot(v1v2.zw, v1v2.zw) < 4.0) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tgl_Position = splat_proj + vec4((vertex_position.x * v1v2.xy + vertex_position.y * v1v2.zw) / viewport * splat_proj.w, 0, 0);\n\t\ttexCoord = vertex_position.xy * scale / 2.0;\n\t\t#ifdef USE_SH1\n\t\t\tvec4 worldCenter = matrix_model * vec4(center, 1.0);\n\t\t\tvec3 viewDir = normalize((worldCenter.xyz / worldCenter.w - view_position) * mat3(matrix_model));\n\t\t\tcolor.xyz = max(color.xyz + evalSH(viewDir), 0.0);\n\t\t#endif\n\t\t#ifndef DITHER_NONE\n\t\t\tid = float(splatId);\n\t\t#endif\n\t}\n",fragment:null!=(u=t.fragment)?u:"\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tvoid main(void)\n\t{\n\t\tgl_FragColor = evalSplat(texCoord, color);\n\t}\n",dither:i,defines:t.defines},f=new ea(h,l),p=Bo(e);return p.register("splat",Ap),p.getProgram("splat",d,f)},s.update(),s}(y({},this.hasSH?{defines:["USE_SH1","USE_SH2","USE_SH3"]}:{},t));return e.setParameter("splatColor",this.colorTexture),e.setParameter("transformA",this.transformATexture),e.setParameter("transformB",this.transformBTexture),e.setParameter("tex_params",new Float32Array([this.numSplats,this.colorTexture.width,0,0])),this.hasSH&&(e.setParameter("splatSH_1to3",this.sh1to3Texture),e.setParameter("splatSH_4to7",this.sh4to7Texture),e.setParameter("splatSH_8to11",this.sh8to11Texture),e.setParameter("splatSH_12to15",this.sh12to15Texture)),e},e.evalTextureSize=function(t){var e=Math.ceil(Math.sqrt(t)),i=Math.ceil(t/e);return new It(e,i)},e.createTexture=function(t,e,i){return new dr(this.device,{name:t,width:i.x,height:i.y,format:e,cubemap:!1,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1})},e.getTextureFormat=function(t,e){t.isWebGL1&&(e=!1);var i,n=t.extTextureHalfFloat&&t.textureHalfFloatUpdatable,s=t.extTextureFloat;return e?s?i=!1:n&&(i=!0):n?i=!0:s&&(i=!1),i},e.updateColorData=function(t){var e=this.colorTexture;if(e){for(var i=e.lock(),n=t.getProp("f_dc_0"),s=t.getProp("f_dc_1"),r=t.getProp("f_dc_2"),a=t.getProp("opacity"),o=.28209479177387814,h=0;h255?255:l,i[4*h+1]=c<0?0:c>255?255:c,i[4*h+2]=u<0?0:u>255?255:u,i[4*h+3]=d<0?0:d>255?255:d}e.unlock()}},e.updateTransformData=function(t){var e=At.float2Half;if(this.transformATexture){for(var i=this.transformATexture.lock(),n=new Float32Array(i.buffer),s=this.transformBTexture.lock(),r=new Ct,a=new Vt,o=new Ct,h=t.createIter(r,a,o),l=new Pt,c=new Ct,u=new Ct,d=0;da?a:n)<<21|(s<0?0:s>o?o:s)<<11|(r<0?0:r>a?a:r)},l=new Float32Array(1),c=new Uint32Array(l.buffer),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=0;dp&&(p=_)}if(0!==p){for(var v=0;v<45;++v)u[v]=u[v]/p*.5+.5;l[0]=p,e[4*d+0]=c[0],e[4*d+1]=h(u[0],u[15],u[30]),e[4*d+2]=h(u[1],u[16],u[31]),e[4*d+3]=h(u[2],u[17],u[32]),i[4*d+0]=h(u[3],u[18],u[33]),i[4*d+1]=h(u[4],u[19],u[34]),i[4*d+2]=h(u[5],u[20],u[35]),i[4*d+3]=h(u[6],u[21],u[36]),n[4*d+0]=h(u[7],u[22],u[37]),n[4*d+1]=h(u[8],u[23],u[38]),n[4*d+2]=h(u[9],u[24],u[39]),n[4*d+3]=h(u[10],u[25],u[40]),s[4*d+0]=h(u[11],u[26],u[41]),s[4*d+1]=h(u[12],u[27],u[42]),s[4*d+2]=h(u[13],u[28],u[43]),s[4*d+3]=h(u[14],u[29],u[44])}}this.sh1to3Texture.unlock(),this.sh4to7Texture.unlock(),this.sh8to11Texture.unlock(),this.sh12to15Texture.unlock()},t}();function Pp(){var t,e,i,n,s,r,a,o=Math.pow(2,16)+1,h=!1,l={x:0,y:0,z:0},c={x:0,y:0,z:0},u={x:0,y:0,z:0},d={x:0,y:0,z:0};self.onmessage=function(f){if(f.data.order&&(t=new Uint32Array(f.data.order)),f.data.centers){e=new Float32Array(f.data.centers),u.x=d.x=e[0],u.y=d.y=e[1],u.z=d.z=e[2];for(var p=e.length/3,m=1;m=0?function(){var t=function(t,e,i){for(;t<=e;){var n=e+t>>1,s=i(n);if(s>0)t=n+1;else{if(!(s<0))return n;e=n-1}}return~t}(0,T-1,(function(t){return-F(t)}));return Math.min(T,Math.abs(t))}():T;if(i)for(var N=0;N0){var e=this.cameras[0].xr;e&&e.active&&2===e.views.list.length&&(Op[0]/=2)}this.material.setParameter("viewport",Op)},e.sort=function(t){if(this.sorter){var e=t.getWorldTransform();e.getTranslation(Lp),e.getZ(kp);var i=this.meshInstance.node.getWorldTransform(),n=Dp.invert(i);n.transformPoint(Lp,Lp),n.transformVector(kp,kp),Lp.equalsApprox(this.lastCameraPosition)&&kp.equalsApprox(this.lastCameraDirection)||(this.lastCameraPosition.copy(Lp),this.lastCameraDirection.copy(kp),this.sorter.setCamera(Lp,kp))}this.updateViewport()},e.update=function(){if(this.cameras.length>0){var t=this.cameras[0];this.sort(t._node),this.cameras.length=0}},t}(),Bp="FILL_WINDOW",Np="KEEP_ASPECT",Up="AUTO",zp="FIXED";function Vp(){return Rp}function Gp(t){Rp=t}var Hp=function(){function t(){}return t.push=function(e,i){i&&t._types.length>0?console.assert("Script Ordering Error. Contact support@playcanvas.com"):t._types.push(e)},t}();Hp._types=[];var Wp=!1,Xp=!1,jp={app:null,create:function(t,e){if(Wp){var i=e(jp.app);i._pcScriptName=t,Hp.push(i,Wp),this.fire("created",t,e)}},attribute:function(t,e,i,n){},createLoadingScreen:function(t){Xp||(Xp=!0,t(Vp()))}};Object.defineProperty(jp,"legacy",{get:function(){return Wp},set:function(t){Wp=t}}),R.attach(jp);var qp=function(){function t(){this.renderPasses=[],this.renderTargetMap=new Map}var e=t.prototype;return e.addRenderPass=function(t){t.frameUpdate();for(var e=t.beforePasses,i=0;i=0&&t<=1?0:1})),tm(["fr","pt"],(function(t){return t>=0&&t<2?0:1})),tm(["da"],(function(t){return 1===t||!Number.isInteger(t)&&t>=0&&t<=1?0:1})),tm(["de","en","it","el","es","tr","fi","sv","nb","no","ur"],(function(t){return 1===t?0:1})),tm(["ru","uk"],(function(t){if(Number.isInteger(t)){var e=t%10,i=t%100;if(1===e&&11!==i)return 0;if(e>=2&&e<=4&&(i<12||i>14))return 1;if(0===e||e>=5&&e<=9||i>=11&&i<=14)return 2}return 3})),tm(["pl"],(function(t){if(Number.isInteger(t)){if(1===t)return 0;var e=t%10,i=t%100;if(e>=2&&e<=4&&(i<12||i>14))return 1;if(e>=0&&e<=1||e>=5&&e<=9||i>=12&&i<=14)return 2}return 3})),tm(["ar"],(function(t){if(0===t)return 0;if(1===t)return 1;if(2===t)return 2;if(Number.isInteger(t)){var e=t%100;if(e>=3&&e<=10)return 3;if(e>=11&&e<=99)return 4}return 5}));var nm=$p[em(Qp)];function sm(t){return $p[t]||nm}var rm=new RegExp("^\\s*(?:(?:[a-z]+[a-z0-9\\-+.]*:)?//|data:|blob:)","i"),am=function(){function t(t,e,i,n,s,r){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=null),void 0===r&&(r=null),this.url=t,this.filename=e,this.hash=i,this.size=n,this.opt=s,this.contents=r}return t.prototype.equals=function(t){return this.url===t.url&&this.filename===t.filename&&this.hash===t.hash&&this.size===t.size&&this.opt===t.opt&&this.contents===t.contents},t}(),om=-1,hm={pvr:"extCompressedTexturePVRTC",dxt:"extCompressedTextureS3TC",etc2:"extCompressedTextureETC",etc1:"extCompressedTextureETC1",basis:"canvas"},lm=["pvr","dxt","etc2","etc1","basis"],cm=function(t){function e(e,i,n,s,r){var a;return(a=t.call(this)||this)._id=om--,a._name=e||"",a.type=i,a.tags=new ut(a),a._preload=!1,a._file=null,a._data=s||{},a.options=r||{},a._resources=[],a.urlObject=null,a._i18n={},a.loaded=!1,a.loading=!1,a.registry=null,n&&(a.file=n),a}x(e,t);var i=e.prototype;return i.getFileUrl=function(){var t=this.file;if(!t||!t.url)return null;var e=t.url;if(this.registry&&this.registry.prefix&&!rm.test(e)&&(e=this.registry.prefix+e),"script"!==this.type&&t.hash){var i=-1!==e.indexOf("?")?"&":"?";e+=i+"t="+t.hash}return e},i.getAbsoluteUrl=function(t){if(t.startsWith("blob:")||t.startsWith("data:"))return t;var e=D.getDirectory(this.file.url);return D.join(e,t)},i.getLocalizedAssetId=function(t){return t=im(t,this._i18n),this._i18n[t]||null},i.addLocalizedAssetId=function(t,e){this._i18n[t]=e,this.fire("add:localized",t,e)},i.removeLocalizedAssetId=function(t){var e=this._i18n[t];e&&(delete this._i18n[t],this.fire("remove:localized",t,e))},i.ready=function(t,e){e=e||this,this.loaded?t.call(e,this):this.once("load",(function(i){t.call(e,i)}))},i.reload=function(){this.loaded&&(this.loaded=!1,this.registry.load(this))},i.unload=function(){if(this.loaded||0!==this._resources.length){this.fire("unload",this),this.registry.fire("unload:"+this.id,this);var t=this._resources;this.urlObject&&(URL.revokeObjectURL(this.urlObject),this.urlObject=null),this.resources=[],this.loaded=!1,this.file&&this.registry._loader.clearCache(this.getFileUrl(),this.type);for(var e=0;e0,maxRetries:n},e)},v(e,[{key:"id",get:function(){return this._id},set:function(t){this._id=t}},{key:"name",get:function(){return this._name},set:function(t){if(this._name!==t){var e=this._name;this._name=t,this.fire("name",this,this._name,e)}}},{key:"file",get:function(){return this._file},set:function(t){var e=this;if(t&&t.variants&&-1!==["texture","textureatlas","bundle"].indexOf(this.type)){var i,n=(null==(i=this.registry)||null==(i=i._loader)?void 0:i._app)||Vp(),s=null==n?void 0:n.graphicsDevice;if(s)for(var r=function(){var i=lm[a];if(t.variants[i]&&s[hm[i]])return t=t.variants[i],0;if(n.enableBundles){var r=n.bundles.listBundlesForAsset(e);if(r&&r.find((function(t){var e;return null==t||null==(e=t.file)?void 0:e.variants[i]})))return 0}},a=0,o=lm.length;athis.bytesRead+this.headerSize){this.headerRead=!0;var t=new DataView(this.data.buffer,this.bytesRead,this.headerSize);null!=this.decoder||(this.decoder=new TextDecoder("windows-1252"));var e=this.decoder.decode(t);if(this.fileName=e.substring(0,100).replace(/\0/g,""),this.fileSize=parseInt(e.substring(124,136),8),this.fileType=e.substring(156,157),this.ustarFormat=e.substring(257,263),-1!==this.ustarFormat.indexOf("ustar")){var i=e.substring(345,500).replace(/\0/g,"");i.length>0&&(this.fileName=i.trim()+this.fileName.trim())}this.bytesRead+=512}if(this.headerRead){if(this.bytesReceived0&&this.loader.enableRetry(t.maxAssetRetries),t.useDevicePixelRatio||(t.useDevicePixelRatio=t.use_device_pixel_ratio),t.resolutionMode||(t.resolutionMode=t.resolution_mode),t.fillMode||(t.fillMode=t.fill_mode),this._width=t.width,this._height=t.height,t.useDevicePixelRatio&&(this.graphicsDevice.maxPixelRatio=window.devicePixelRatio),this.setCanvasResolution(t.resolutionMode,this._width,this._height),this.setCanvasFillMode(t.fillMode,this._width,this._height),t.layers&&t.layerOrder){var i=new pd("application"),n={};for(var s in t.layers){var r=t.layers[s];r.id=parseInt(s,10),r.enabled=1!==r.id,n[s]=new ud(r)}for(var a=0,o=t.layerOrder.length;a0,d.tags.add(u.tags),u.i18n)for(var f in u.i18n)d.addLocalizedAssetId(f,u.i18n[f]);this.assets.add(d)}},n._getScriptReferences=function(t){var e=[];t.settings.priority_scripts&&(e=t.settings.priority_scripts);for(var i=[],n={},s=0;sn._timeToCountFrames?(n.fps=n._fpsAccum,n._fpsAccum=0,n._timeToCountFrames=t+1e3):n._fpsAccum++,this.stats.drawCalls.total=this.graphicsDevice._drawCallsPerFrame,this.graphicsDevice._drawCallsPerFrame=0},n._fillFrameStats=function(){var t=this.stats.frame;t.cameras=this.renderer._camerasRendered,t.materials=this.renderer._materialSwitches,t.shaders=this.graphicsDevice._shaderSwitchesPerFrame,t.shadowMapUpdates=this.renderer._shadowMapUpdates,t.shadowMapTime=this.renderer._shadowMapTime,t.depthMapTime=this.renderer._depthMapTime,t.forwardTime=this.renderer._forwardTime;var e=this.graphicsDevice._primsPerFrame;t.triangles=e[4]/3+Math.max(e[Be]-2,0)+Math.max(e[6]-2,0),t.cullTime=this.renderer._cullTime,t.sortTime=this.renderer._sortTime,t.skinTime=this.renderer._skinTime,t.morphTime=this.renderer._morphTime,t.lightClusters=this.renderer._lightClusters,t.lightClustersTime=this.renderer._lightClustersTime,t.otherPrimitives=0;for(var i=0;ii/n?e=(t=i)/s:t=(e=n)*s}else this._fillMode===Bp&&(t=i,e=n);return this.graphicsDevice.canvas.style.width=t+"px",this.graphicsDevice.canvas.style.height=e+"px",this.updateCanvasSize(),{width:t,height:e}}},n.updateCanvasSize=function(){var t;if(this._allowResize&&(null==(t=this.xr)||!t.active)&&this._resolutionMode===Up){var e=this.graphicsDevice.canvas;this.graphicsDevice.resizeCanvas(e.clientWidth,e.clientHeight)}},n.onLibrariesLoaded=function(){this._librariesLoaded=!0,this.systems.rigidbody&&this.systems.rigidbody.onLibraryLoaded()},n.applySceneSettings=function(t){var e;if(this.systems.rigidbody&&"undefined"!=typeof Ammo){var i=t.physics.gravity;this.systems.rigidbody.gravity.set(i[0],i[1],i[2])}this.scene.applySettings(t),t.render.hasOwnProperty("skybox")&&(t.render.skybox?(e=this.assets.get(t.render.skybox))?this.setSkybox(e):this.assets.once("add:"+t.render.skybox,this.setSkybox,this):this.setSkybox(null))},n.setAreaLightLuts=function(t,e){t&&e&&Zp.set(this.graphicsDevice,t,e)},n.setSkybox=function(t){var e=this;if(t!==this._skyboxAsset){var i=function(){e.setSkybox(null)},n=function(){e.scene.setSkybox(e._skyboxAsset?e._skyboxAsset.resources:null)};this._skyboxAsset&&(this.assets.off("load:"+this._skyboxAsset.id,n,this),this.assets.off("remove:"+this._skyboxAsset.id,i,this),this._skyboxAsset.off("change",n,this)),this._skyboxAsset=t,this._skyboxAsset&&(this.assets.on("load:"+this._skyboxAsset.id,n,this),this.assets.once("remove:"+this._skyboxAsset.id,i,this),this._skyboxAsset.on("change",n,this),0!==this.scene.skyboxMip||this._skyboxAsset.loadFaces||(this._skyboxAsset.loadFaces=!0),this.assets.load(this._skyboxAsset)),n()}},n._firstBake=function(){var t;null==(t=this.lightmapper)||t.bake(null,this.scene.lightmapMode)},n._firstBatch=function(){var t;null==(t=this.batcher)||t.generate()},n._processTimestamp=function(t){return t},n.drawLine=function(t,e,i,n,s){this.scene.drawLine(t,e,i,n,s)},n.drawLines=function(t,e,i,n){void 0===i&&(i=!0),void 0===n&&(n=this.scene.defaultDrawLayer),this.scene.drawLines(t,e,i,n)},n.drawLineArrays=function(t,e,i,n){void 0===i&&(i=!0),void 0===n&&(n=this.scene.defaultDrawLayer),this.scene.drawLineArrays(t,e,i,n)},n.drawWireSphere=function(t,e,i,n,s,r){void 0===i&&(i=vt.WHITE),void 0===n&&(n=20),void 0===s&&(s=!0),void 0===r&&(r=this.scene.defaultDrawLayer),this.scene.immediate.drawWireSphere(t,e,i,n,s,r)},n.drawWireAlignedBox=function(t,e,i,n,s,r){void 0===i&&(i=vt.WHITE),void 0===n&&(n=!0),void 0===s&&(s=this.scene.defaultDrawLayer),this.scene.immediate.drawWireAlignedBox(t,e,i,n,s,r)},n.drawMeshInstance=function(t,e){void 0===e&&(e=this.scene.defaultDrawLayer),this.scene.immediate.drawMesh(null,null,null,t,e)},n.drawMesh=function(t,e,i,n){void 0===n&&(n=this.scene.defaultDrawLayer),this.scene.immediate.drawMesh(e,i,t,null,n)},n.drawQuad=function(t,e,i){void 0===i&&(i=this.scene.defaultDrawLayer),this.scene.immediate.drawMesh(e,t,this.scene.immediate.getQuadMesh(),null,i)},n.drawTexture=function(t,e,i,n,s,r,a,o){if(void 0===a&&(a=this.scene.defaultDrawLayer),void 0===o&&(o=!0),!1!==o||this.graphicsDevice.isWebGPU){var h=new zt;h.setTRS(new Ct(t,e,0),Vt.IDENTITY,new Ct(i,-n,0)),r||((r=new ah).cull=_e,r.setParameter("colorMap",s),r.shader=o?this.scene.immediate.getTextureShader():this.scene.immediate.getUnfilterableTextureShader(),r.update()),this.drawQuad(h,r,a)}},n.drawDepthTexture=function(t,e,i,n,s){void 0===s&&(s=this.scene.defaultDrawLayer);var r=new ah;r.cull=_e,r.shader=this.scene.immediate.getDepthTextureShader(),r.update(),this.drawTexture(t,e,i,n,null,r,s)},n.destroy=function(){var t,e,n,s;if(this._inFrameUpdate)this._destroyRequested=!0;else{var r=this.graphicsDevice.canvas.id;this.fire("destroy",this),this.off("librariesloaded"),"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this._visibilityChangeHandler,!1),document.removeEventListener("mozvisibilitychange",this._visibilityChangeHandler,!1),document.removeEventListener("msvisibilitychange",this._visibilityChangeHandler,!1),document.removeEventListener("webkitvisibilitychange",this._visibilityChangeHandler,!1)),this._visibilityChangeHandler=null,this.root.destroy(),this.root=null,this.mouse&&(this.mouse.off(),this.mouse.detach(),this.mouse=null),this.keyboard&&(this.keyboard.off(),this.keyboard.detach(),this.keyboard=null),this.touch&&(this.touch.off(),this.touch.detach(),this.touch=null),this.elementInput&&(this.elementInput.detach(),this.elementInput=null),this.gamepads&&(this.gamepads.destroy(),this.gamepads=null),this.controller&&(this.controller=null),this.systems.destroy(),this.scene.layers&&this.scene.layers.destroy();for(var a=this.assets.list(),o=0;o0){var n=i.bakeArea;Zl(Fm,t,e),Fm.mulScalar(.5*n),i._node.rotateLocal(Fm.x,0,Fm.y)}i._node.getWorldTransform();var s=this.scene.gammaCorrection?2.2:1,r=Math.pow(this.intensity,s);i.intensity=Math.pow(r/e,1/s)},v(e,[{key:"numVirtualLights",get:function(){return 0===this.light.type?this.light.bakeNumSamples:1}}])}(Om),Nm=new Ct,Um=function(t){function e(e){var i=e.scene,n=new wm("AmbientLight");return n.addComponent("light",{type:"directional",affectDynamic:!0,affectLightmapped:!1,bake:!0,bakeNumSamples:i.ambientBakeNumSamples,castShadows:!0,normalOffsetBias:.05,shadowBias:.2,shadowDistance:1,shadowResolution:2048,shadowType:0,color:vt.WHITE,intensity:1,bakeDir:!1}),t.call(this,i,n.light.light,e.lightingParams)||this}return x(e,t),e.prototype.prepareVirtualLight=function(t,e){Ql(Nm,t,e,0,this.scene.ambientBakeSpherePart),this.light._node.lookAt(Nm.mulScalar(-1)),this.light._node.rotateLocal(90,0,0);var i=this.scene.gammaCorrection?2.2:1,n=2*Math.PI*this.scene.ambientBakeSpherePart,s=Math.pow(n,i);this.light.intensity=Math.pow(s/e,1/i)},v(e,[{key:"numVirtualLights",get:function(){return this.light.bakeNumSamples}}])}(Om),zm=function(){function t(t,e){void 0===e&&(e=null),this.node=t,this.component=t.render||t.model,e=e||this.component.meshInstances,this.store(),this.meshInstances=e,this.bounds=null,this.renderTargets=[]}var e=t.prototype;return e.store=function(){this.castShadows=this.component.castShadows},e.restore=function(){this.component.castShadows=this.castShadows},t}(),Vm=function(){function t(t){this.device=t,this.shaderDilate=Vo(t,Oo.fullscreenQuadVS,mp.dilatePS,"lmDilate"),this.constantTexSource=t.scope.resolve("source"),this.constantPixelOffset=t.scope.resolve("pixelOffset"),this.pixelOffset=new Float32Array(2),this.shaderDenoise=null,this.sigmas=null,this.constantSigmas=null,this.kernel=null}var e=t.prototype;return e.setSourceTexture=function(t){this.constantTexSource.setValue(t)},e.prepare=function(t,e){this.pixelOffset[0]=1/t,this.pixelOffset[1]=1/e,this.constantPixelOffset.setValue(this.pixelOffset)},e.prepareDenoise=function(t,e){this.shaderDenoise||(this.shaderDenoise=Vo(this.device,Oo.fullscreenQuadVS,mp.bilateralDeNoisePS,"lmBilateralDeNoise"),this.sigmas=new Float32Array(2),this.constantSigmas=this.device.scope.resolve("sigmas"),this.constantKernel=this.device.scope.resolve("kernel[0]"),this.bZnorm=this.device.scope.resolve("bZnorm")),this.sigmas[0]=t,this.sigmas[1]=e,this.constantSigmas.setValue(this.sigmas),this.evaluateDenoiseUniforms(t,e)},e.evaluateDenoiseUniforms=function(t,e){function i(t,e){return.39894*Math.exp(-.5*t*t/(e*e))/e}this.kernel=this.kernel||new Float32Array(15);for(var n=this.kernel,s=Math.floor(7),r=0;r<=s;++r){var a=i(r,t);n[s+r]=a,n[s-r]=a}this.constantKernel.setValue(this.kernel);var o=1/i(0,e);this.bZnorm.setValue(o)},t}(),Gm=function(t){function e(e,i,n,s,r,a){var o;return(o=t.call(this,e)||this).viewBindGroups=[],o.renderer=i,o.camera=n,o.worldClusters=s,o.receivers=r,o.lightArray=a,o}x(e,t);var i=e.prototype;return i.destroy=function(){this.viewBindGroups.forEach((function(t){t.defaultUniformBuffer.destroy(),t.destroy()})),this.viewBindGroups.length=0},i.execute=function(){this.device;var t=this.renderer,e=this.camera,i=this.receivers,n=this.renderTarget,s=this.worldClusters,r=this.lightArray;t.renderForwardLayer(e,n,null,void 0,1,this.viewBindGroups,{meshInstances:i,splitLights:r,lightClusters:s})},e}(ta),Hm=new Ct,Wm=function(){function t(t,e,i,n,s){this.device=t,this.root=e,this.scene=i,this.renderer=n,this.assets=s,this.shadowMapCache=n.shadowMapCache,this._tempSet=new Set,this._initCalled=!1,this.passMaterials=[],this.ambientAOMaterial=null,this.fog="",this.ambientLight=new vt,this.renderTargets=new Map,this.stats={renderPasses:0,lightmapCount:0,totalRenderTime:0,forwardTime:0,fboTime:0,shadowMapTime:0,compileTime:0,shadersLinked:0}}var e=t.prototype;return e.destroy=function(){var t;Bh.decRef(this.blackTex),this.blackTex=null,Bh.destroy(),this.device=null,this.root=null,this.scene=null,this.renderer=null,this.assets=null,null==(t=this.camera)||t.destroy(),this.camera=null},e.initBake=function(t){if(!this._initCalled){this._initCalled=!0,this.lightmapFilters=new Vm(t),this.constantBakeDir=t.scope.resolve("bakeDir"),this.materials=[],this.blackTex=new dr(this.device,{width:4,height:4,format:7,type:vi,name:"lightmapBlack"}),Bh.incRef(this.blackTex);var e=new pl;e.clearColor.set(0,0,0,0),e.clearColorBuffer=!0,e.clearDepthBuffer=!1,e.clearStencilBuffer=!1,e.frustumCulling=!1,e.projection=1,e.aspectRatio=1,e.node=new Oh,this.camera=e}if(this.scene.clusteredLightingEnabled){var i=new Td(t.supportsAreaLights,t.maxTextureSize,(function(){}));this.lightingParams=i;var n=this.scene.lighting;i.shadowsEnabled=n.shadowsEnabled,i.shadowAtlasResolution=n.shadowAtlasResolution,i.cookiesEnabled=n.cookiesEnabled,i.cookieAtlasResolution=n.cookieAtlasResolution,i.areaLightsEnabled=n.areaLightsEnabled,i.cells=new Ct(3,3,3),i.maxLightsPerCell=4,this.worldClusters=new Yl(t),this.worldClusters.name="ClusterLightmapper"}},e.finishBake=function(t){function e(t){Bh.decRef(t.colorBuffer),t.destroy()}this.materials=[],this.renderTargets.forEach((function(t){e(t)})),this.renderTargets.clear(),t.forEach((function(t){t.renderTargets.forEach((function(t){e(t)})),t.renderTargets.length=0})),this.ambientAOMaterial=null,this.worldClusters&&(this.worldClusters.destroy(),this.worldClusters=null)},e.createMaterialForPass=function(t,e,i,n){var s=new Oc;s.name="lmMaterial-pass:"+i+"-ambient:"+n,s.chunks.APIVersion=nn;if(s.chunks.transformVS="#define UV1LAYOUT\n"+Oo.transformVS,0===i){var r=mp.bakeLmEndPS;n?r="\n dDiffuseLight = ((dDiffuseLight - 0.5) * max("+e.ambientBakeOcclusionContrast.toFixed(1)+" + 1.0, 0.0)) + 0.5;\n dDiffuseLight += vec3("+e.ambientBakeOcclusionBrightness.toFixed(1)+");\n dDiffuseLight = saturate(dDiffuseLight);\n dDiffuseLight *= dAmbientLight;\n "+r:(s.ambient=new vt(0,0,0),s.ambientTint=!0),s.chunks.basePS=Oo.basePS+(7===e.lightmapPixelFormat?"\n#define LIGHTMAP_RGBM\n":""),s.chunks.endPS=r,s.lightMap=this.blackTex}else s.chunks.basePS=Oo.basePS+"\nuniform sampler2D texture_dirLightMap;\nuniform float bakeDir;\n",s.chunks.endPS=mp.bakeDirLmEndPS;return s.chunks.outputAlphaPS="\n",s.chunks.outputAlphaOpaquePS="\n",s.chunks.outputAlphaPremulPS="\n",s.cull=_e,s.forceUv1=!0,s.update(),s},e.createMaterials=function(t,e,i){for(var n=0;n0&&e.push(new zm(t,l))}}for(var d=0;d0){this.renderer.shadowRenderer.frameUpdate();var c=1===e?2:1;this.setLightmapping(o,!1,c),this.initBake(i),this.bakeInternal(c,o,h);var u=64;1===e&&(u|=bo),this.scene.ambientBake&&(u|=Mo),this.setLightmapping(o,!0,c,u),this.finishBake(o)}var d=dt();this.stats.totalRenderTime=d-n,this.stats.shadersLinked=i._shaderStats.linked-s,this.stats.compileTime=i._shaderStats.compileTime-a,this.stats.fboTime=i._renderTargetCreationTime-r,this.stats.lightmapCount=o.length},e.allocateTextures=function(t,e){for(var i=0;i0){e.copy(t[0].aabb);for(var i=1;i1&&b>1&&y.light.bakeDir&&(b=1);for(var T=0;T1&&y.prepareVirtualLight(T,b),y.startBake();var w=!1,E=this.lightCameraPrepare(r,y);for(_=0;_0&&T>0)&&!(x&&m>0);m++){var M=A.renderTargets[m],P=A.renderTargets[m].colorBuffer.width,R=this.renderTargets.get(P),I=R.colorBuffer;0===m?g=n.updateShaders:g&&(n.updateShaders=!0);var D=this.passMaterials[m];for(x&&T+1===b&&0===m&&(D=this.ambientAOMaterial),u=0;u=this._right){var i=e.length;if(i)if(t=e[i-1])this._left=e[i-1],this._right=1/0,this._len=0,this._recip=0,this._p0=this._p1=i-1;else{var n=this._findKey(t,e);this._left=e[n],this._right=e[n+1],this._len=this._right-this._left;var s=1/this._len;this._recip=isFinite(s)?s:0,this._p0=n,this._p1=n+1}else this._left=-1/0,this._right=1/0,this._len=0,this._recip=0,this._p0=this._p1=0}this._t=0===this._recip?0:(t-this._left)*this._recip,this._hermite.valid=!1},e._findKey=function(t,e){for(var i=0;t>=e[i+1];)i++;return i},e.eval=function(t,e,i){var n=i._data,s=i._components,r=this._p0*s;if(0===e)for(var a=0;a=t)},e.nextEventBehindTime=function(t){return!!this.nextEvent&&(t===this.track.duration?this.isReverse?this.nextEvent.time>=t:this.nextEvent.time<=t:this.isReverse?this.nextEvent.time>t:this.nextEvent.time=this.track.events.length?this._eventCursor=0:this._eventCursor<0&&(this._eventCursor=this.track.events.length-1)},e.clipFrameTime=function(e){var i=t.eventFrame;i.start=0,i.end=e,i.residual=0,this.isReverse?e<0&&(i.start=this.track.duration,i.end=0,i.residual=e+this.track.duration):e>this.track.duration&&(i.start=0,i.end=this.track.duration,i.residual=e-this.track.duration)},e.alignCursorToCurrentTime=function(){for(this.resetEventCursor();this.nextEventBehindTime(this._time)&&this._eventCursor!==this.eventCursorEnd;)this.moveEventCursor()},e.fireNextEvent=function(){this._eventHandler.fire(this.nextEvent.name,y({track:this.track},this.nextEvent)),this.moveEventCursor()},e.fireNextEventInFrame=function(t,e){return!(!this.nextEventAheadOfTime(t)||!this.nextEventBehindTime(e))&&(this.fireNextEvent(),!0)},e.activeEventsForFrame=function(e,i){var n=t.eventFrame;this.clipFrameTime(i);for(var s=this.eventCursor;this.fireNextEventInFrame(e,n.end)&&s!==this.eventCursor;);this.loop&&Math.abs(n.residual)>0&&this.activeEventsForFrame(n.start,n.residual)},e.progressForTime=function(t){return t*this._speed/this._track.duration},e._update=function(t){if(this._playing){var e=this._time,i=this._track.duration,n=this._speed,s=this._loop;this._track.events.length>0&&i>0&&this.activeEventsForFrame(e,e+n*t),e+=n*t,n>=0?e>i&&(s?e=e%i||0:(e=this._track.duration,this.pause())):e<0&&(s?e=i+(e%i||0):(e=0,this.pause())),this._time=e}this._time!==this._snapshot._time&&this._track.eval(this._time,this._snapshot)},e.play=function(){this._playing=!0,this._time=0},e.stop=function(){this._playing=!1,this._time=0},e.pause=function(){this._playing=!1},e.resume=function(){this._playing=!0},e.reset=function(){this._time=0},v(t,[{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"track",get:function(){return this._track},set:function(t){this._track=t,this._snapshot=new Km(t)}},{key:"snapshot",get:function(){return this._snapshot}},{key:"time",get:function(){return this._time},set:function(t){this._time=t,this.alignCursorToCurrentTime()}},{key:"speed",get:function(){return this._speed},set:function(t){var e=Math.sign(t)!==Math.sign(this._speed);this._speed=t,e&&this.alignCursorToCurrentTime()}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t}},{key:"blendWeight",get:function(){return this._blendWeight},set:function(t){this._blendWeight=t}},{key:"blendOrder",get:function(){return this._blendOrder},set:function(t){this._blendOrder=t}},{key:"eventCursor",get:function(){return this._eventCursor},set:function(t){this._eventCursor=t}},{key:"eventCursorEnd",get:function(){return this.isReverse?0:this._track.events.length-1}},{key:"nextEvent",get:function(){return this._track.events[this._eventCursor]}},{key:"isReverse",get:function(){return this._speed<0}}])}();Zm.eventFrame={start:0,end:0,residual:0};var Qm="NONE",Jm="PREV_STATE",$m="NEXT_STATE",t_="PREV_STATE_NEXT_STATE",e_="NEXT_STATE_PREV_STATE",i_="GREATER_THAN",n_="LESS_THAN",s_="GREATER_THAN_EQUAL_TO",r_="LESS_THAN_EQUAL_TO",a_="EQUAL_TO",o_="NOT_EQUAL_TO",h_="INTEGER",l_="FLOAT",c_="BOOLEAN",u_="TRIGGER",d_="2D_DIRECTIONAL",f_="2D_CARTESIAN",p_="DIRECT",m_="START",__="END",v_="ANY",g_=[m_,__,v_],y_="OVERWRITE",x_="ADDITIVE",S_=function(){function t(){}return t.dot=function(t,e){for(var i=t.length,n=0,s=0;s0){i=1/Math.sqrt(i);for(var n=e.length,s=0;s0&&(r=1/Math.sqrt(r));for(var a=0;a0;)this.removeClip(0)},e.updateClipTrack=function(t,e){this._clips.forEach((function(i){i.name.includes(t)&&(i.track=e)})),this.rebind()},e.findClip=function(t){for(var e=this._clips,i=0;i0&&a._update(t),!e)break;var c=void 0,u=void 0,d=void 0;if(l>=1)for(var f=0;f0)for(var p=0;p0&&i.push(n),i},t.encode=function(t,e,i){return(Array.isArray(t)?t.join("/"):t)+"/"+e+"/"+(Array.isArray(i)?i.join("/"):i)};var e=t.prototype;return e.resolve=function(t){return null},e.unresolve=function(t){},e.update=function(t){},t}(),M_=v((function(t,e,i,n){t.set?(this._set=t.set,this._get=t.get):this._set=t,this._type=e,this._components=i,this._targetPath=n,this._isTransform="localRotation"===this._targetPath.substring(this._targetPath.length-13)||"localPosition"===this._targetPath.substring(this._targetPath.length-13)||"localScale"===this._targetPath.substring(this._targetPath.length-10)}),[{key:"set",get:function(){return this._set}},{key:"get",get:function(){return this._get}},{key:"type",get:function(){return this._type}},{key:"components",get:function(){return this._components}},{key:"targetPath",get:function(){return this._targetPath}},{key:"isTransform",get:function(){return this._isTransform}}]),P_=function(){function t(e){var i=this;if(this._isPathInMask=function(t,e){var n=i._mask[t];return!!n&&!!(n.children||e&&!1!==n.value)},this.graph=e,e){this._mask=null;var n={},s=function(t){n[t.name]=t;for(var e=0;e0&&!!this.prevAnim,this.blending&&(this.blend=0,this.blendSpeed=1/e),this.skeleton&&(this.blending?(this.fromSkel.animation=i,this.fromSkel.addTime(this.skeleton._time),this.toSkel.animation=n):this.skeleton.animation=n),this.animEvaluator){var s=this.animEvaluator;if(this.blending)for(;s.clips.length>1;)s.removeClip(0);else this.animEvaluator.removeClips();var r=new Zm(this.animations[this.currAnim],0,1,!0,this.loop);r.name=this.currAnim,r.blendWeight=this.blending?0:1,r.reset(),this.animEvaluator.addClip(r)}}this.playing=!0}},i.getAnimation=function(t){return this.animations[t]},i.setModel=function(t){t!==this.model&&(this._resetAnimationController(),this.model=t,this.animations&&this.currAnim&&this.animations[this.currAnim]&&this.play(this.currAnim))},i.onSetAnimations=function(){var t=this.entity.model;if(t){var e=t.model;e&&e!==this.model&&this.setModel(e)}if(!this.currAnim&&this.activate&&this.enabled&&this.entity.enabled){var i=Object.keys(this._animations);i.length>0&&this.play(i[0])}},i._resetAnimationController=function(){this.skeleton=null,this.fromSkel=null,this.toSkel=null,this.animEvaluator=null},i._createAnimationController=function(){var t=this.model,e=this.animations,i=!1,n=!1;for(var s in e){if(e.hasOwnProperty(s))e[s].constructor===A_?n=!0:i=!0}var r=t.getGraph();i?(this.fromSkel=new tp(r),this.toSkel=new tp(r),this.skeleton=new tp(r),this.skeleton.looping=this.loop,this.skeleton.setGraph(r)):n&&(this.animEvaluator=new w_(new P_(this.entity)))},i.loadAnimationAssets=function(t){var e=this;if(t&&t.length)for(var i=this.system.app.assets,n=function(t){if(t.resources.length>1)for(var i=0;i1){if(n&&n.length>1)for(var r=0;r1)for(var o=0;o1)for(var h=0;h1)for(var e=0;e0&&this.play(a[0])}},i.onBeforeRemove=function(){for(var t=0;t=1&&(this.blend=1)),this.playing){var e=this.skeleton;if(null!==e&&null!==this.model){if(this.blending)e.blend(this.fromSkel,this.toSkel,this.blend);else{var i=t*this.speed;e.addTime(i),(this.speed>0&&e._time===e.animation.duration&&!this.loop||this.speed<0&&0===e._time&&!this.loop)&&(this.playing=!1)}this.blending&&1===this.blend&&(e.animation=this.toSkel.animation),e.updateGraph()}}var n=this.animEvaluator;if(n){for(var s=0;s1&&(n.clips[1].blendWeight=this.blend),n.update(t)}this.blending&&1===this.blend&&(this.blending=!1)},v(e,[{key:"animations",get:function(){return this._animations},set:function(t){this._animations=t,this.onSetAnimations()}},{key:"assets",get:function(){return this._assets},set:function(t){var e=this._assets;if(e&&e.length)for(var i=0;i0)return t[t.length-1].time}return 0},set:function(t){if(this.skeleton&&(this.skeleton.currentTime=t,this.skeleton.addTime(0),this.skeleton.updateGraph()),this.animEvaluator)for(var e=this.animEvaluator.clips,i=0;i=0)this._animationList[n].animTrack=e;else{var s=this._getNodeFromPath(t);s.animTrack=e,this._animationList.push(s)}this._updateHasAnimations()},e._updateHasAnimations=function(){this._hasAnimations=this._animationList.length>0&&this._animationList.every((function(t){return t.animTrack&&t.animTrack!==A_.EMPTY}))},v(t,[{key:"name",get:function(){return this._name}},{key:"animations",get:function(){return this._animationList},set:function(t){this._animationList=t,this._updateHasAnimations()}},{key:"hasAnimations",get:function(){return this._hasAnimations}},{key:"speed",get:function(){return this._speed},set:function(t){this._speed=t}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t}},{key:"nodeCount",get:function(){return this._blendTree&&this._blendTree.constructor!==k_?this._blendTree.getNodeCount():1}},{key:"playable",get:function(){return-1!==g_.indexOf(this.name)||this.animations.length===this.nodeCount}},{key:"looping",get:function(){if(this.animations.length>0){var t=this.name+"."+this.animations[0].animTrack.name,e=this._controller.animEvaluator.findClip(t);if(e)return e.loop}return!1}},{key:"totalWeight",get:function(){for(var t=0,e=0;et&&(t=i.animTrack.duration)}return t}}])}(),V_=v((function(t){var e=t.from,i=t.to,n=t.time,s=void 0===n?0:n,r=t.priority,a=void 0===r?0:r,o=t.conditions,h=void 0===o?[]:o,l=t.exitTime,c=void 0===l?null:l,u=t.transitionOffset,d=void 0===u?null:u,f=t.interruptionSource,p=void 0===f?Qm:f;this._from=e,this._to=i,this._time=s,this._priority=a,this._conditions=h,this._exitTime=c,this._transitionOffset=d,this._interruptionSource=p}),[{key:"from",get:function(){return this._from}},{key:"to",get:function(){return this._to},set:function(t){this._to=t}},{key:"time",get:function(){return this._time}},{key:"priority",get:function(){return this._priority}},{key:"conditions",get:function(){return this._conditions}},{key:"exitTime",get:function(){return this._exitTime}},{key:"transitionOffset",get:function(){return this._transitionOffset}},{key:"interruptionSource",get:function(){return this._interruptionSource}},{key:"hasExitTime",get:function(){return!!this.exitTime}}]),G_=function(){function t(t,e,i,n,s,r,a){var o=this;this._states={},this._stateNames=[],this._findTransitionsFromStateCache={},this._findTransitionsBetweenStatesCache={},this._previousStateName=null,this._activeStateName=m_,this._activeStateDuration=0,this._activeStateDurationDirty=!0,this._playing=!1,this._activate=void 0,this._transitions=void 0,this._currTransitionTime=1,this._totalTransitionTime=1,this._isTransitioning=!1,this._transitionInterruptionSource=Qm,this._transitionPreviousStates=[],this._timeInState=0,this._timeInStateBefore=0,this.findParameter=function(t){return o._findParameter(t)},this._animEvaluator=t,this._eventHandler=s,this._findParameter=r,this._consumeTrigger=a;for(var h=0;h"+e];return i||(i=this._transitions.filter((function(i){return i.from===t&&i.to===e})),fd(i),this._findTransitionsBetweenStatesCache[t+"->"+e]=i),i},e._transitionHasConditionsMet=function(t){for(var e=t.conditions,i=0;in.value))return!1;break;case n_:if(!(s.value=n.value))return!1;break;case r_:if(!(s.value<=n.value))return!1;break;case a_:if(s.value!==n.value)return!1;break;case o_:if(s.value===n.value)return!1}}return!0},e._findTransition=function(t,e){var i=this,n=[];if(t&&e)n=n.concat(this._findTransitionsBetweenStates(t,e));else if(this._isTransitioning)switch(this._transitionInterruptionSource){case Jm:n=(n=n.concat(this._findTransitionsFromState(this._previousStateName))).concat(this._findTransitionsFromState(v_));break;case $m:n=(n=n.concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(v_));break;case t_:n=(n=(n=n.concat(this._findTransitionsFromState(this._previousStateName))).concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(v_));break;case e_:n=(n=(n=n.concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(this._previousStateName))).concat(this._findTransitionsFromState(v_))}else n=(n=n.concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(v_));if(n=n.filter((function(t){if(t.to===i.activeStateName)return!1;if(t.hasExitTime){var e=i._getActiveStateProgressForTime(i._timeInStateBefore),n=i._getActiveStateProgressForTime(i._timeInState);if(t.exitTime<1&&i.activeState.loop&&(e-=Math.floor(e),n-=Math.floor(n)),n===e){if(n!==t.exitTime)return null}else if(!(t.exitTime>e&&t.exitTime<=n))return null}return i._transitionHasConditionsMet(t)})),n.length>0){var s=n[0];if(s.to===__){var r=this._findTransitionsFromState(m_)[0];s.to=r.to}return s}return null},e.updateStateFromTransition=function(t){var e,i,n;this.previousState=t.from?this.activeStateName:null,this.activeState=t.to,this._activeStateDurationDirty=!0;for(var s=0;s0&&t.transitionOffset<1,u=0,d=0;if(c){var f=l.timelineDuration*t.transitionOffset;u=f,d=f}this._timeInState=u,this._timeInStateBefore=d;for(var p=0;p0?n.blendWeight=0:n.blendWeight=l.animations[p].normalizedWeight,n.play(),c)n.time=l.timelineDuration*t.transitionOffset;else{var _=l.speed>=0?0:this.activeStateDuration;n.time=_}}},e._transitionToState=function(t){if(this._findState(t)){var e=this._findTransition(this._activeStateName,t);e||(this._animEvaluator.removeClips(),e=new V_({from:null,to:t})),this.updateStateFromTransition(e)}},e.assignAnimation=function(t,e,i,n){var s=t.split("."),r=this._findState(s[0]);r||(r=new z_(this,s[0],i),this._states[s[0]]=r,this._stateNames.push(s[0])),r.addAnimation(s,e),this._animEvaluator.updateClipTrack(r.name,e),void 0!==i&&(r.speed=i),void 0!==n&&(r.loop=n),!this._playing&&this._activate&&this.playable&&this.play(),this._activeStateDurationDirty=!0},e.removeNodeAnimations=function(t){if(-1!==g_.indexOf(t))return!1;var e=this._findState(t);return!!e&&(e.animations=[],!0)},e.play=function(t){t&&this._transitionToState(t),this._playing=!0},e.pause=function(){this._playing=!1},e.reset=function(){this._previousStateName=null,this._activeStateName=m_,this._playing=!1,this._currTransitionTime=1,this._totalTransitionTime=1,this._isTransitioning=!1,this._timeInState=0,this._timeInStateBefore=0,this._animEvaluator.removeClips()},e.rebind=function(){this._animEvaluator.rebind()},e.update=function(t){if(this._playing){var e,i,n;(this.activeState.loop||this._timeInStatethis.activeStateDuration&&(this._timeInState=this.activeStateDuration,t=this.activeStateDuration-this._timeInStateBefore));var s=this._findTransition(this._activeStateName);if(s&&this.updateStateFromTransition(s),this._isTransitioning)if(this._currTransitionTime+=t,this._currTransitionTime<=this._totalTransitionTime){for(var r=0!==this._totalTransitionTime?this._currTransitionTime/this._totalTransitionTime:1,a=0;a1){var l=e.length>2?this._resolvePath(t,e.slice(0,-1)):t,c=e[e.length-2];return function(t){n[s]=i(t),l[c]=n}}return function(t){n[s]=i(t)}},i._createAnimTargetForProperty=function(t,i,n){if(this.handlers&&i[0].startsWith("weight."))return this.handlers.weight(t,i[0].replace("weight.",""));if(this.handlers&&"material"===i[0]&&2===i.length){var s=i[1];if(s.endsWith("Map"))return this.handlers.materialTexture(t,s)}var r,a,o,h=this._resolvePath(t,i,!0);if(void 0===h)return null;if("number"==typeof h)r=this._setter(t,i,e._packFloat),a="vector",o=1;else if("boolean"==typeof h)r=this._setter(t,i,e._packBoolean),a="vector",o=1;else if("object"==typeof h)switch(h.constructor){case It:r=this._setter(t,i,e._packVec2),a="vector",o=2;break;case Ct:r=this._setter(t,i,e._packVec3),a="vector",o=3;break;case Lt:r=this._setter(t,i,e._packVec4),a="vector",o=4;break;case vt:r=this._setter(t,i,e._packColor),a="vector",o=4;break;case Vt:r=this._setter(t,i,e._packQuat),a="quaternion",o=4;break;default:return null}return-1!==i.indexOf("material")?new M_((function(e){r(e),t.material.update()}),a,o,n):new M_(r,a,o,n)},i.rebind=function(){this.targetCache={},this.animComponent.rootBone?this.graph=this.animComponent.rootBone:this.graph=this.animComponent.entity;var t={},e=function(i){t[i.name]=i;for(var n=0;n0?this._layers[0]:null}}])}(Xm),J_=function(){this.enabled=!0},$_=["enabled"],tv=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="anim",i.ComponentType=Q_,i.DataType=J_,i.schema=$_,i.on("beforeremove",i.onBeforeRemove,i),i.app.systems.on("animationUpdate",i.onAnimationUpdate,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){var s=this;t.prototype.initializeComponentData.call(this,e,i,$_);var r=["animationAssets","stateGraph","layers","masks"];Object.keys(i).forEach((function(t){r.includes(t)||(e[t]=i[t])})),i.stateGraph&&(e.stateGraph=i.stateGraph,e.loadStateGraph(e.stateGraph)),i.layers&&i.layers.forEach((function(t,i){t._controller.states.forEach((function(n){t._controller._states[n]._animationList.forEach((function(n){if(n.animTrack&&n.animTrack!==A_.EMPTY)e.layers[i].assignAnimation(n.name,n.animTrack);else{var r=s.app.assets.get(t._component._animationAssets[t.name+":"+n.name].asset);r&&!r.loaded&&r.once("load",(function(){e.layers[i].assignAnimation(n.name,r.resource)}))}}))}))})),i.animationAssets&&(e.animationAssets=Object.assign(e.animationAssets,i.animationAssets)),i.masks&&Object.keys(i.masks).forEach((function(t){if(e.layers[t]){var n=i.masks[t].mask,s={};Object.keys(n).forEach((function(t){s[decodeURI(t)]=n[t]})),e.layers[t].mask=s}}))},i.onAnimationUpdate=function(t){var e=this.store;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i].entity.anim;n.data.enabled&&n.entity.enabled&&n.playing&&n.update(t)}},i.cloneComponent=function(t,e){var i;t.anim.rootBone&&t.anim.rootBone!==t||(i={},t.anim.layers.forEach((function(t,n){if(t.mask){var s={};Object.keys(t.mask).forEach((function(i){var n=i.split("/");n.shift();var r=[e.name].concat(n).join("/");s[r]=t.mask[i]})),i[n]={mask:s}}})));var n={stateGraphAsset:t.anim.stateGraphAsset,animationAssets:t.anim.animationAssets,speed:t.anim.speed,activate:t.anim.activate,playing:t.anim.playing,rootBone:t.anim.rootBone,stateGraph:t.anim.stateGraph,layers:t.anim.layers,layerIndices:t.anim.layerIndices,parameters:t.anim.parameters,normalizeWeights:t.anim.normalizeWeights,masks:i};return this.addComponent(e,n)},i.onBeforeRemove=function(t,e){e.onBeforeRemove()},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("animationUpdate",this.onAnimationUpdate,this)},e}(jm);Xm._buildAccessors(Q_.prototype,$_);var ev=function(t){function e(e,i){return t.call(this,e,i)||this}x(e,t);var i=e.prototype;return i.setCurrentListener=function(){if(this.enabled&&this.entity.audiolistener&&this.entity.enabled){this.system.current=this.entity;var t=this.system.current.getPosition();this.system.manager.listener.setPosition(t)}},i.onEnable=function(){this.setCurrentListener()},i.onDisable=function(){this.system.current===this.entity&&(this.system.current=null)},e}(Xm),iv=function(){this.enabled=!0},nv=["enabled"],sv=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="audiolistener",i.ComponentType=ev,i.DataType=iv,i.schema=nv,i.manager=e.soundManager,i.current=null,i.app.systems.on("update",i.onUpdate,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){n=["enabled"],t.prototype.initializeComponentData.call(this,e,i,n)},i.onUpdate=function(t){if(this.current){var e=this.current.getPosition();this.manager.listener.setPosition(e);var i=this.current.getWorldTransform();this.manager.listener.setOrientation(i)}},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this)},e}(jm);Xm._buildAccessors(ev.prototype,nv);var rv=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).on("set_assets",n.onSetAssets,n),n.on("set_loop",n.onSetLoop,n),n.on("set_volume",n.onSetVolume,n),n.on("set_pitch",n.onSetPitch,n),n.on("set_minDistance",n.onSetMinDistance,n),n.on("set_maxDistance",n.onSetMaxDistance,n),n.on("set_rollOffFactor",n.onSetRollOffFactor,n),n.on("set_distanceModel",n.onSetDistanceModel,n),n.on("set_3d",n.onSet3d,n),n}x(e,t);var i=e.prototype;return i.play=function(t){if(this.enabled&&this.entity.enabled){var e;this.channel&&this.stop();var i=this.data;if(i.sources[t])if(i["3d"]){var n=this.entity.getPosition();e=this.system.manager.playSound3d(i.sources[t],n,i),i.currentSource=t,i.channel=e}else e=this.system.manager.playSound(i.sources[t],i),i.currentSource=t,i.channel=e}},i.pause=function(){this.channel&&this.channel.pause()},i.unpause=function(){this.channel&&this.channel.paused&&this.channel.unpause()},i.stop=function(){this.channel&&(this.channel.stop(),this.channel=null)},i.onSetAssets=function(t,e,i){var n=[],s=i.length;if(e&&e.length)for(var r=0;r1e-5){var i=this._tweenInfo.lerpColor;i.lerp(this._tweenInfo.from,this._tweenInfo.to,e),this._applyTintImmediately(new vt(i.r,i.g,i.b,i.a))}else this._applyTintImmediately(this._tweenInfo.to),this._cancelTween()},i._cancelTween=function(){delete this._tweenInfo},i.onUpdate=function(){this._tweenInfo&&this._updateTintTween()},i.onEnable=function(){this._isHovering=!1,this._hoveringCounter=0,this._isPressed=!1,this._imageReference.onParentComponentEnable(),this._toggleHitElementListeners("on"),this._forceReapplyVisualState()},i.onDisable=function(){this._toggleHitElementListeners("off"),this._resetToDefaultVisualState(this.transitionMode)},i.onRemove=function(){this._toggleLifecycleListeners("off",this.system),this.onDisable()},v(e,[{key:"data",get:function(){var t=this.system.store[this.entity.getGuid()];return t?t.data:null}},{key:"enabled",get:function(){return this.data.enabled},set:function(t){this._setValue("enabled",t)}},{key:"active",get:function(){return this.data.active},set:function(t){this._setValue("active",t)}},{key:"imageEntity",get:function(){return this.data.imageEntity},set:function(t){this._setValue("imageEntity",t)}},{key:"hitPadding",get:function(){return this.data.hitPadding},set:function(t){this._setValue("hitPadding",t)}},{key:"transitionMode",get:function(){return this.data.transitionMode},set:function(t){this._setValue("transitionMode",t)}},{key:"hoverTint",get:function(){return this.data.hoverTint},set:function(t){this._setValue("hoverTint",t)}},{key:"pressedTint",get:function(){return this.data.pressedTint},set:function(t){this._setValue("pressedTint",t)}},{key:"inactiveTint",get:function(){return this.data.inactiveTint},set:function(t){this._setValue("inactiveTint",t)}},{key:"fadeDuration",get:function(){return this.data.fadeDuration},set:function(t){this._setValue("fadeDuration",t)}},{key:"hoverSpriteAsset",get:function(){return this.data.hoverSpriteAsset},set:function(t){this._setValue("hoverSpriteAsset",t)}},{key:"hoverSpriteFrame",get:function(){return this.data.hoverSpriteFrame},set:function(t){this._setValue("hoverSpriteFrame",t)}},{key:"pressedSpriteAsset",get:function(){return this.data.pressedSpriteAsset},set:function(t){this._setValue("pressedSpriteAsset",t)}},{key:"pressedSpriteFrame",get:function(){return this.data.pressedSpriteFrame},set:function(t){this._setValue("pressedSpriteFrame",t)}},{key:"inactiveSpriteAsset",get:function(){return this.data.inactiveSpriteAsset},set:function(t){this._setValue("inactiveSpriteAsset",t)}},{key:"inactiveSpriteFrame",get:function(){return this.data.inactiveSpriteFrame},set:function(t){this._setValue("inactiveSpriteFrame",t)}}])}(Xm);function wv(t){return new vt(t.r,t.g,t.b)}Tv.EVENT_MOUSEDOWN="mousedown",Tv.EVENT_MOUSEUP="mouseup",Tv.EVENT_MOUSEENTER="mouseenter",Tv.EVENT_MOUSELEAVE="mouseleave",Tv.EVENT_CLICK="click",Tv.EVENT_TOUCHSTART="touchstart",Tv.EVENT_TOUCHEND="touchend",Tv.EVENT_TOUCHCANCEL="touchcancel",Tv.EVENT_TOUCHLEAVE="touchleave",Tv.EVENT_SELECTSTART="selectstart",Tv.EVENT_SELECTEND="selectend",Tv.EVENT_SELECTENTER="selectenter",Tv.EVENT_SELECTLEAVE="selectleave",Tv.EVENT_HOVERSTART="hoverstart",Tv.EVENT_HOVEREND="hoverend",Tv.EVENT_PRESSEDSTART="pressedstart",Tv.EVENT_PRESSEDEND="pressedend";var Ev=function(){this.enabled=!0,this.active=!0,this.imageEntity=null,this.hitPadding=new Lt,this.transitionMode=0,this.hoverTint=new vt(.75,.75,.75),this.pressedTint=new vt(.5,.5,.5),this.inactiveTint=new vt(.25,.25,.25),this.fadeDuration=0,this.hoverSpriteAsset=null,this.hoverSpriteFrame=0,this.pressedSpriteAsset=null,this.pressedSpriteFrame=0,this.inactiveSpriteAsset=null,this.inactiveSpriteFrame=0},Av=["enabled","active",{name:"imageEntity",type:"entity"},{name:"hitPadding",type:"vec4"},"transitionMode",{name:"hoverTint",type:"rgba"},{name:"pressedTint",type:"rgba"},{name:"inactiveTint",type:"rgba"},"fadeDuration","hoverSpriteAsset","hoverSpriteFrame","pressedSpriteAsset","pressedSpriteFrame","inactiveSpriteAsset","inactiveSpriteFrame"],Cv=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="button",i.ComponentType=Tv,i.DataType=Ev,i.schema=Av,i.on("beforeremove",i._onRemoveComponent,i),i.app.systems.on("update",i.onUpdate,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){t.prototype.initializeComponentData.call(this,e,i,Av)},i.onUpdate=function(t){var e=this.store;for(var i in e){var n=e[i].entity,s=n.button;s.enabled&&n.enabled&&s.onUpdate()}},i._onRemoveComponent=function(t,e){e.onRemove()},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this)},e}(jm),Mv=new Ct,Pv=new Vt,Rv=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._compoundParent=null,n._hasOffset=!1,n.entity.on("insert",n._onInsert,n),n.on("set_type",n.onSetType,n),n.on("set_convexHull",n.onSetModel,n),n.on("set_halfExtents",n.onSetHalfExtents,n),n.on("set_linearOffset",n.onSetOffset,n),n.on("set_angularOffset",n.onSetOffset,n),n.on("set_radius",n.onSetRadius,n),n.on("set_height",n.onSetHeight,n),n.on("set_axis",n.onSetAxis,n),n.on("set_asset",n.onSetAsset,n),n.on("set_renderAsset",n.onSetRenderAsset,n),n.on("set_model",n.onSetModel,n),n.on("set_render",n.onSetRender,n),n}x(e,t);var i=e.prototype;return i._setValue=function(t,e){var i=this.data,n=i[t];i[t]=e,this.fire("set",t,n,e)},i.onSetType=function(t,e,i){e!==i&&this.system.changeType(this,e,i)},i.onSetHalfExtents=function(t,e,i){var n=this.data.type;this.data.initialized&&"box"===n&&this.system.recreatePhysicalShapes(this)},i.onSetOffset=function(t,e,i){this._hasOffset=!this.data.linearOffset.equals(Ct.ZERO)||!this.data.angularOffset.equals(Vt.IDENTITY),this.data.initialized&&this.system.recreatePhysicalShapes(this)},i.onSetRadius=function(t,e,i){var n=this.data.type;!this.data.initialized||"sphere"!==n&&"capsule"!==n&&"cylinder"!==n&&"cone"!==n||this.system.recreatePhysicalShapes(this)},i.onSetHeight=function(t,e,i){var n=this.data.type;!this.data.initialized||"capsule"!==n&&"cylinder"!==n&&"cone"!==n||this.system.recreatePhysicalShapes(this)},i.onSetAxis=function(t,e,i){var n=this.data.type;!this.data.initialized||"capsule"!==n&&"cylinder"!==n&&"cone"!==n||this.system.recreatePhysicalShapes(this)},i.onSetAsset=function(t,e,i){var n=this.system.app.assets;if(e){var s=n.get(e);s&&s.off("remove",this.onAssetRemoved,this)}if(i){i instanceof cm&&(this.data.asset=i.id);var r=n.get(this.data.asset);r&&(r.off("remove",this.onAssetRemoved,this),r.on("remove",this.onAssetRemoved,this))}this.data.initialized&&"mesh"===this.data.type&&(i||(this.data.model=null),this.system.recreatePhysicalShapes(this))},i.onSetRenderAsset=function(t,e,i){var n=this.system.app.assets;if(e){var s=n.get(e);s&&s.off("remove",this.onRenderAssetRemoved,this)}if(i){i instanceof cm&&(this.data.renderAsset=i.id);var r=n.get(this.data.renderAsset);r&&(r.off("remove",this.onRenderAssetRemoved,this),r.on("remove",this.onRenderAssetRemoved,this))}this.data.initialized&&"mesh"===this.data.type&&(i||(this.data.render=null),this.system.recreatePhysicalShapes(this))},i.onSetModel=function(t,e,i){this.data.initialized&&"mesh"===this.data.type&&this.system.implementations.mesh.doRecreatePhysicalShape(this)},i.onSetRender=function(t,e,i){this.onSetModel(t,e,i)},i.onAssetRemoved=function(t){t.off("remove",this.onAssetRemoved,this),this.data.asset===t.id&&(this.asset=null)},i.onRenderAssetRemoved=function(t){t.off("remove",this.onRenderAssetRemoved,this),this.data.renderAsset===t.id&&(this.renderAsset=null)},i._getCompoundChildShapeIndex=function(t){for(var e=this.data.shape,i=e.getNumChildShapes(),n=0;n-1&&e.rigidbody._triggers.splice(i,1),e.rigidbody.removeBody(t),t.forceActivationState(5)}},t}(),Vv=new zt,Gv=new Ct,Hv=new Ct,Wv=new Vt,Xv=new Oh,jv=["enabled","type","halfExtents","linearOffset","angularOffset","radius","axis","height","convexHull","asset","renderAsset","shape","model","render","checkVertexDuplicates"],qv=function(){function t(t){this.system=t}var e=t.prototype;return e.beforeInitialize=function(t,e){e.shape=null,e.model=new Ad,e.model.graph=new Oh},e.afterInitialize=function(t,e){this.recreatePhysicalShapes(t),t.data.initialized=!0},e.reset=function(t,e){this.beforeInitialize(t,e),this.afterInitialize(t,e)},e.recreatePhysicalShapes=function(t){var e=t.entity,i=t.data;if("undefined"!=typeof Ammo){e.trigger&&(e.trigger.destroy(),delete e.trigger),i.shape&&(t._compoundParent&&(this.system._removeCompoundChild(t._compoundParent,i.shape),t._compoundParent.entity.rigidbody&&t._compoundParent.entity.rigidbody.activate()),this.destroyShape(i)),i.shape=this.createPhysicalShape(t.entity,i);var n=!t._compoundParent;if("compound"!==i.type||t._compoundParent&&t!==t._compoundParent){if("compound"!==i.type&&(t._compoundParent&&t===t._compoundParent&&e.forEach(this.system.implementations.compound._updateEachDescendant,t),!t.rigidbody)){t._compoundParent=null;for(var s=e.parent;s;){if(s.collision&&"compound"===s.collision.type){t._compoundParent=s.collision;break}s=s.parent}}}else t._compoundParent=t,e.forEach(this._addEachDescendant,t);t._compoundParent&&t!==t._compoundParent&&(n&&0===t._compoundParent.shape.getNumChildShapes()?this.system.recreatePhysicalShapes(t._compoundParent):(this.system.updateCompoundChildTransform(e),t._compoundParent.entity.rigidbody&&t._compoundParent.entity.rigidbody.activate())),e.rigidbody?(e.rigidbody.disableSimulation(),e.rigidbody.createBody(),e.enabled&&e.rigidbody.enabled&&e.rigidbody.enableSimulation()):t._compoundParent||(e.trigger?e.trigger.initialize(i):e.trigger=new zv(this.system.app,t,i))}},e.createPhysicalShape=function(t,e){},e.updateTransform=function(t,e,i,n){t.entity.trigger&&t.entity.trigger.updateTransform()},e.destroyShape=function(t){t.shape&&(Ammo.destroy(t.shape),t.shape=null)},e.beforeRemove=function(t,e){e.data.shape&&(e._compoundParent&&!e._compoundParent.entity._destroying&&(this.system._removeCompoundChild(e._compoundParent,e.data.shape),e._compoundParent.entity.rigidbody&&e._compoundParent.entity.rigidbody.activate()),e._compoundParent=null,this.destroyShape(e.data))},e.remove=function(t,e){t.rigidbody&&t.rigidbody.body&&t.rigidbody.disableSimulation(),t.trigger&&(t.trigger.destroy(),delete t.trigger)},e.clone=function(t,e){var i=this.system.store[t.getGuid()],n={enabled:i.data.enabled,type:i.data.type,halfExtents:[i.data.halfExtents.x,i.data.halfExtents.y,i.data.halfExtents.z],linearOffset:[i.data.linearOffset.x,i.data.linearOffset.y,i.data.linearOffset.z],angularOffset:[i.data.angularOffset.x,i.data.angularOffset.y,i.data.angularOffset.z,i.data.angularOffset.w],radius:i.data.radius,axis:i.data.axis,height:i.data.height,convexHull:i.data.convexHull,asset:i.data.asset,renderAsset:i.data.renderAsset,model:i.data.model,render:i.data.render,checkVertexDuplicates:i.data.checkVertexDuplicates};return this.system.addComponent(e,n)},t}(),Yv=function(t){function e(){return t.apply(this,arguments)||this}return x(e,t),e.prototype.createPhysicalShape=function(t,e){if("undefined"!=typeof Ammo){var i=e.halfExtents,n=new Ammo.btVector3(i?i.x:.5,i?i.y:.5,i?i.z:.5),s=new Ammo.btBoxShape(n);return Ammo.destroy(n),s}},e}(qv),Kv=function(t){function e(){return t.apply(this,arguments)||this}return x(e,t),e.prototype.createPhysicalShape=function(t,e){if("undefined"!=typeof Ammo)return new Ammo.btSphereShape(e.radius)},e}(qv),Zv=function(t){function e(){return t.apply(this,arguments)||this}return x(e,t),e.prototype.createPhysicalShape=function(t,e){var i,n,s,r=null!=(i=e.axis)?i:1,a=null!=(n=e.radius)?n:.5,o=Math.max((null!=(s=e.height)?s:2)-2*a,0),h=null;if("undefined"!=typeof Ammo)switch(r){case 0:h=new Ammo.btCapsuleShapeX(a,o);break;case 1:h=new Ammo.btCapsuleShape(a,o);break;case 2:h=new Ammo.btCapsuleShapeZ(a,o)}return h},e}(qv),Qv=function(t){function e(){return t.apply(this,arguments)||this}return x(e,t),e.prototype.createPhysicalShape=function(t,e){var i,n,s,r=null!=(i=e.axis)?i:1,a=null!=(n=e.radius)?n:.5,o=null!=(s=e.height)?s:1,h=null,l=null;if("undefined"!=typeof Ammo)switch(r){case 0:h=new Ammo.btVector3(.5*o,a,a),l=new Ammo.btCylinderShapeX(h);break;case 1:h=new Ammo.btVector3(a,.5*o,a),l=new Ammo.btCylinderShape(h);break;case 2:h=new Ammo.btVector3(a,a,.5*o),l=new Ammo.btCylinderShapeZ(h)}return h&&Ammo.destroy(h),l},e}(qv),Jv=function(t){function e(){return t.apply(this,arguments)||this}return x(e,t),e.prototype.createPhysicalShape=function(t,e){var i,n,s,r=null!=(i=e.axis)?i:1,a=null!=(n=e.radius)?n:.5,o=null!=(s=e.height)?s:1,h=null;if("undefined"!=typeof Ammo)switch(r){case 0:h=new Ammo.btConeShapeX(a,o);break;case 1:h=new Ammo.btConeShape(a,o);break;case 2:h=new Ammo.btConeShapeZ(a,o)}return h},e}(qv),$v=function(t){function e(){return t.apply(this,arguments)||this}x(e,t);var i=e.prototype;return i.beforeInitialize=function(t,e){},i.createAmmoHull=function(t,e,i,n){var s=new Ammo.btConvexHullShape,r=new Ammo.btVector3,a=[];t.getPositions(a);for(var o=0;o=0&&this.model.meshInstances.splice(i,1),this.unmaskMeshInstance=null}this._entity.enabled&&this._element.enabled&&(this._element.removeModelFromLayers(this.model),this._element.addModelToLayers(this.model))}},e.setMaterial=function(t){this.meshInstance&&(this.meshInstance.material=t,this.unmaskMeshInstance&&(this.unmaskMeshInstance.material=t))},e.setParameter=function(t,e){this.meshInstance&&(this.meshInstance.setParameter(t,e),this.unmaskMeshInstance&&this.unmaskMeshInstance.setParameter(t,e))},e.deleteParameter=function(t){this.meshInstance&&(this.meshInstance.deleteParameter(t),this.unmaskMeshInstance&&this.unmaskMeshInstance.deleteParameter(t))},e.setUnmaskDrawOrder=function(){if(this.meshInstance){var t=function(e){var i,n=e.children,s=n.length;if(s){for(var r=0;r0){var s=e.calculatedWidth/e.calculatedHeight;e.fitMode===pv&&s>this._targetAspectRatio||e.fitMode===mv&&s0&&(this._targetAspectRatio=i.rect.z/i.rect.w)}this.mesh=t?e:this._defaultMesh,this.refreshMesh()},e.refreshMesh=function(){this.mesh&&(this._element._beingInitialized?this._meshDirty=!0:this._updateMesh(this.mesh))},e._updateAabb=function(t){return t.center.set(0,0,0),t.halfExtents.set(.5*this._outerScale.x,.5*this._outerScale.y,.001),t.setFromTransformedAabb(t,this._renderable.node.getWorldTransform()),t},e._toggleMask=function(){this._element._dirtifyMask();var t=this._element._isScreenSpace();this._updateMaterial(t),this._renderable.setMask(!!this._mask)},e._onMaterialLoad=function(t){this.material=t.resource},e._onMaterialAdded=function(t){this._system.app.assets.off("add:"+t.id,this._onMaterialAdded,this),this._materialAsset===t.id&&this._bindMaterialAsset(t)},e._bindMaterialAsset=function(t){this._entity.enabled&&(t.on("load",this._onMaterialLoad,this),t.on("change",this._onMaterialChange,this),t.on("remove",this._onMaterialRemove,this),t.resource?this._onMaterialLoad(t):this._system.app.assets.load(t))},e._unbindMaterialAsset=function(t){t.off("load",this._onMaterialLoad,this),t.off("change",this._onMaterialChange,this),t.off("remove",this._onMaterialRemove,this)},e._onMaterialChange=function(){},e._onMaterialRemove=function(){},e._onTextureAdded=function(t){this._system.app.assets.off("add:"+t.id,this._onTextureAdded,this),this._textureAsset===t.id&&this._bindTextureAsset(t)},e._bindTextureAsset=function(t){this._entity.enabled&&(t.on("load",this._onTextureLoad,this),t.on("change",this._onTextureChange,this),t.on("remove",this._onTextureRemove,this),t.resource?this._onTextureLoad(t):this._system.app.assets.load(t))},e._unbindTextureAsset=function(t){t.off("load",this._onTextureLoad,this),t.off("change",this._onTextureChange,this),t.off("remove",this._onTextureRemove,this)},e._onTextureLoad=function(t){this.texture=t.resource},e._onTextureChange=function(t){},e._onTextureRemove=function(t){},e._onSpriteAssetAdded=function(t){this._system.app.assets.off("add:"+t.id,this._onSpriteAssetAdded,this),this._spriteAsset===t.id&&this._bindSpriteAsset(t)},e._bindSpriteAsset=function(t){this._entity.enabled&&(t.on("load",this._onSpriteAssetLoad,this),t.on("change",this._onSpriteAssetChange,this),t.on("remove",this._onSpriteAssetRemove,this),t.resource?this._onSpriteAssetLoad(t):this._system.app.assets.load(t))},e._unbindSpriteAsset=function(t){t.off("load",this._onSpriteAssetLoad,this),t.off("change",this._onSpriteAssetChange,this),t.off("remove",this._onSpriteAssetRemove,this),t.data.textureAtlasAsset&&this._system.app.assets.off("load:"+t.data.textureAtlasAsset,this._onTextureAtlasLoad,this)},e._onSpriteAssetLoad=function(t){if(t&&t.resource)if(t.resource.atlas)this.sprite=t.resource;else{var e=t.data.textureAtlasAsset;if(e){var i=this._system.app.assets;i.off("load:"+e,this._onTextureAtlasLoad,this),i.once("load:"+e,this._onTextureAtlasLoad,this)}}else this.sprite=null},e._onSpriteAssetChange=function(t){this._onSpriteAssetLoad(t)},e._onSpriteAssetRemove=function(t){},e._bindSprite=function(t){t.on("set:meshes",this._onSpriteMeshesChange,this),t.on("set:pixelsPerUnit",this._onSpritePpuChange,this),t.on("set:atlas",this._onAtlasTextureChange,this),t.atlas&&t.atlas.on("set:texture",this._onAtlasTextureChange,this)},e._unbindSprite=function(t){t.off("set:meshes",this._onSpriteMeshesChange,this),t.off("set:pixelsPerUnit",this._onSpritePpuChange,this),t.off("set:atlas",this._onAtlasTextureChange,this),t.atlas&&t.atlas.off("set:texture",this._onAtlasTextureChange,this)},e._onSpriteMeshesChange=function(){this._sprite&&(this._spriteFrame=_t.clamp(this._spriteFrame,0,this._sprite.frameKeys.length-1)),this._updateSprite()},e._onSpritePpuChange=function(){0!==this.sprite.renderMode&&null===this._pixelsPerUnit&&this._updateSprite()},e._onAtlasTextureChange=function(){this.sprite&&this.sprite.atlas&&this.sprite.atlas.texture?(this._renderable.setParameter("texture_emissiveMap",this._sprite.atlas.texture),this._renderable.setParameter("texture_opacityMap",this._sprite.atlas.texture)):(this._renderable.deleteParameter("texture_emissiveMap"),this._renderable.deleteParameter("texture_opacityMap"))},e._onTextureAtlasLoad=function(t){var e=this._spriteAsset;e instanceof cm?this._onSpriteAssetLoad(e):this._onSpriteAssetLoad(this._system.app.assets.get(e))},e.onEnable=function(){if(this._materialAsset){var t=this._system.app.assets.get(this._materialAsset);t&&t.resource!==this._material&&this._bindMaterialAsset(t)}if(this._textureAsset){var e=this._system.app.assets.get(this._textureAsset);e&&e.resource!==this._texture&&this._bindTextureAsset(e)}if(this._spriteAsset){var i=this._system.app.assets.get(this._spriteAsset);i&&i.resource!==this._sprite&&this._bindSpriteAsset(i)}this._element.addModelToLayers(this._renderable.model)},e.onDisable=function(){this._element.removeModelFromLayers(this._renderable.model)},e._setStencil=function(t){this._renderable.meshInstance.stencilFront=t,this._renderable.meshInstance.stencilBack=t;var e=0;if(this._element.maskedBy&&(e=this._element.maskedBy.element._image._maskRef),this._renderable.unmaskMeshInstance){var i=new Pn({ref:e+1,func:2,zpass:5});this._renderable.unmaskMeshInstance.stencilFront=i,this._renderable.unmaskMeshInstance.stencilBack=i}},e._removeMaterialAssetEvents=function(){if(this._materialAsset){var t=this._system.app.assets;t.off("add:"+this._materialAsset,this._onMaterialAdded,this);var e=t.get(this._materialAsset);e&&(e.off("load",this._onMaterialLoad,this),e.off("change",this._onMaterialChange,this),e.off("remove",this._onMaterialRemove,this))}},v(t,[{key:"color",get:function(){return this._color},set:function(t){var e=t.r,i=t.g,n=t.b;this._color.r===e&&this._color.g===i&&this._color.b===n||(this._color.r=e,this._color.g=i,this._color.b=n,this._colorUniform[0]=e,this._colorUniform[1]=i,this._colorUniform[2]=n,this._renderable.setParameter("material_emissive",this._colorUniform)),this._element&&this._element.fire("set:color",this._color)}},{key:"opacity",get:function(){return this._color.a},set:function(t){t!==this._color.a&&(this._color.a=t,this._renderable.setParameter("material_opacity",t)),this._element&&this._element.fire("set:opacity",t)}},{key:"rect",get:function(){return this._rect},set:function(t){var e,i,n,s;t instanceof Lt?(e=t.x,i=t.y,n=t.z,s=t.w):(e=t[0],i=t[1],n=t[2],s=t[3]),e===this._rect.x&&i===this._rect.y&&n===this._rect.z&&s===this._rect.w||(this._rect.set(e,i,n,s),this._renderable.mesh&&(this._element._beingInitialized?this._meshDirty=!0:this._updateMesh(this._renderable.mesh)))}},{key:"material",get:function(){return this._material},set:function(t){if(this._material!==t){if(!t){var e=this._element._isScreenSpace();t=this.mask?e?this._system.defaultScreenSpaceImageMaskMaterial:this._system.defaultImageMaskMaterial:e?this._system.defaultScreenSpaceImageMaterial:this._system.defaultImageMaterial}if(this._material=t,this._materialAsset){var i=this._system.app.assets.get(this._materialAsset);i&&i.resource===t||(this._removeMaterialAssetEvents(),this._materialAsset=null)}t&&(this._renderable.setMaterial(t),this._hasUserMaterial()?(this._renderable.deleteParameter("material_opacity"),this._renderable.deleteParameter("material_emissive")):(this._colorUniform[0]=this._color.r,this._colorUniform[1]=this._color.g,this._colorUniform[2]=this._color.b,this._renderable.setParameter("material_emissive",this._colorUniform),this._renderable.setParameter("material_opacity",this._color.a)))}}},{key:"materialAsset",get:function(){return this._materialAsset},set:function(t){var e=this._system.app.assets,i=t;if(t instanceof cm&&(i=t.id),this._materialAsset!==i)if(this._removeMaterialAssetEvents(),this._materialAsset=i,this._materialAsset){var n=e.get(this._materialAsset);n?this._bindMaterialAsset(n):(this._materialAsset=null,this.material=null,this._materialAsset=i,e.on("add:"+this._materialAsset,this._onMaterialAdded,this))}else this._materialAsset=null,this.material=null,this._materialAsset=i}},{key:"texture",get:function(){return this._texture},set:function(t){if(this._texture!==t){if(this._textureAsset){var e=this._system.app.assets.get(this._textureAsset);e&&e.resource!==t&&(this.textureAsset=null)}if(this._texture=t,t){this._spriteAsset&&(this.spriteAsset=null),this._renderable.setParameter("texture_emissiveMap",this._texture),this._renderable.setParameter("texture_opacityMap",this._texture),this._colorUniform[0]=this._color.r,this._colorUniform[1]=this._color.g,this._colorUniform[2]=this._color.b,this._renderable.setParameter("material_emissive",this._colorUniform),this._renderable.setParameter("material_opacity",this._color.a);var i=this._texture.width/this._texture.height;i!==this._targetAspectRatio&&(this._targetAspectRatio=i,this._element.fitMode!==fv&&this.refreshMesh())}else this._renderable.deleteParameter("texture_emissiveMap"),this._renderable.deleteParameter("texture_opacityMap"),this._targetAspectRatio=-1,this._element.fitMode!==fv&&this.refreshMesh()}}},{key:"textureAsset",get:function(){return this._textureAsset},set:function(t){var e=this._system.app.assets,i=t;if(t instanceof cm&&(i=t.id),this._textureAsset!==i){if(this._textureAsset){e.off("add:"+this._textureAsset,this._onTextureAdded,this);var n=e.get(this._textureAsset);n&&(n.off("load",this._onTextureLoad,this),n.off("change",this._onTextureChange,this),n.off("remove",this._onTextureRemove,this))}if(this._textureAsset=i,this._textureAsset){var s=e.get(this._textureAsset);s?this._bindTextureAsset(s):(this.texture=null,e.on("add:"+this._textureAsset,this._onTextureAdded,this))}else this.texture=null}}},{key:"spriteAsset",get:function(){return this._spriteAsset},set:function(t){var e=this._system.app.assets,i=t;if(t instanceof cm&&(i=t.id),this._spriteAsset!==i){if(this._spriteAsset){e.off("add:"+this._spriteAsset,this._onSpriteAssetAdded,this);var n=e.get(this._spriteAsset);n&&this._unbindSpriteAsset(n)}if(this._spriteAsset=i,this._spriteAsset){var s=e.get(this._spriteAsset);s?this._bindSpriteAsset(s):(this.sprite=null,e.on("add:"+this._spriteAsset,this._onSpriteAssetAdded,this))}else this.sprite=null}this._element&&this._element.fire("set:spriteAsset",i)}},{key:"sprite",get:function(){return this._sprite},set:function(t){if(this._sprite!==t){if(this._sprite&&this._unbindSprite(this._sprite),this._spriteAsset){var e=this._system.app.assets.get(this._spriteAsset);e&&e.resource!==t&&(this.spriteAsset=null)}this._sprite=t,this._sprite&&(this._bindSprite(this._sprite),this._textureAsset&&(this.textureAsset=null)),this._sprite&&this._sprite.atlas&&this._sprite.atlas.texture?(this._renderable.setParameter("texture_emissiveMap",this._sprite.atlas.texture),this._renderable.setParameter("texture_opacityMap",this._sprite.atlas.texture)):(this._renderable.deleteParameter("texture_emissiveMap"),this._renderable.deleteParameter("texture_opacityMap")),this._sprite&&(this._spriteFrame=_t.clamp(this._spriteFrame,0,this._sprite.frameKeys.length-1)),this._updateSprite()}}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){var e=this._spriteFrame;this._sprite?this._spriteFrame=_t.clamp(t,0,this._sprite.frameKeys.length-1):this._spriteFrame=t,this._spriteFrame!==e&&this._updateSprite(),this._element&&this._element.fire("set:spriteFrame",t)}},{key:"mesh",get:function(){return this._renderable.mesh},set:function(t){this._renderable.setMesh(t),this._defaultMesh===t?this._renderable.setAabbFunc(null):this._renderable.setAabbFunc(this._updateAabbFunc)}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this._toggleMask())}},{key:"pixelsPerUnit",get:function(){return this._pixelsPerUnit},set:function(t){this._pixelsPerUnit!==t&&(this._pixelsPerUnit=t,!this._sprite||1!==this._sprite.renderMode&&2!==this._sprite.renderMode||this._updateSprite())}},{key:"aabb",get:function(){return this._renderable.meshInstance?this._renderable.meshInstance.aabb:null}}])}(),rg=function(t){function e(e){var i;return(i=t.call(this)||this)._app=e,e.i18n.on("set:locale",i._onSetLocale,i),i._autoLoad=!1,i._disableLocalization=!1,i._defaultAsset=null,i._localizedAsset=null,i}x(e,t);var i=e.prototype;return i._bindDefaultAsset=function(){var t=this._app.assets.get(this._defaultAsset);t?this._onDefaultAssetAdd(t):this._app.assets.once("add:"+this._defaultAsset,this._onDefaultAssetAdd,this)},i._unbindDefaultAsset=function(){if(this._defaultAsset){this._app.assets.off("add:"+this._defaultAsset,this._onDefaultAssetAdd,this);var t=this._app.assets.get(this._defaultAsset);t&&(t.off("add:localized",this._onLocaleAdd,this),t.off("remove:localized",this._onLocaleRemove,this),t.off("remove",this._onDefaultAssetRemove,this))}},i._onDefaultAssetAdd=function(t){this._defaultAsset===t.id&&(t.on("add:localized",this._onLocaleAdd,this),t.on("remove:localized",this._onLocaleRemove,this),t.once("remove",this._onDefaultAssetRemove,this))},i._onDefaultAssetRemove=function(t){this._defaultAsset===t.id&&(t.off("add:localized",this._onLocaleAdd,this),t.off("remove:localized",this._onLocaleAdd,this),this._app.assets.once("add:"+this._defaultAsset,this._onDefaultAssetAdd,this))},i._bindLocalizedAsset=function(){if(this._autoLoad){var t=this._app.assets.get(this._localizedAsset);t&&(t.on("load",this._onLocalizedAssetLoad,this),t.on("change",this._onLocalizedAssetChange,this),t.on("remove",this._onLocalizedAssetRemove,this),t.resource?this._onLocalizedAssetLoad(t):this._app.assets.load(t))}},i._unbindLocalizedAsset=function(){var t=this._app.assets.get(this._localizedAsset);t&&(t.off("load",this._onLocalizedAssetLoad,this),t.off("change",this._onLocalizedAssetChange,this),t.off("remove",this._onLocalizedAssetRemove,this))},i._onLocalizedAssetAdd=function(t){this._localizedAsset===t.id&&this._bindLocalizedAsset()},i._onLocalizedAssetLoad=function(t){this.fire("load",t)},i._onLocalizedAssetChange=function(t,e,i,n){this.fire("change",t,e,i,n)},i._onLocalizedAssetRemove=function(t){this._localizedAsset===t.id&&(this.localizedAsset=this._defaultAsset),this.fire("remove",t)},i._onLocaleAdd=function(t,e){this._app.i18n.locale===t&&this._onSetLocale(t)},i._onLocaleRemove=function(t,e){this._app.i18n.locale===t&&this._onSetLocale(t)},i._onSetLocale=function(t){if(this._defaultAsset){var e=this._app.assets.get(this._defaultAsset);if(e&&!this._disableLocalization){var i=e.getLocalizedAssetId(t);this.localizedAsset=i||this._defaultAsset}else this.localizedAsset=this._defaultAsset}else this.localizedAsset=null},i.destroy=function(){this.defaultAsset=null,this._app.i18n.off("set:locale",this._onSetLocale,this),this.off()},v(e,[{key:"defaultAsset",get:function(){return this._defaultAsset},set:function(t){var e=t instanceof cm?t.id:t;this._defaultAsset!==e&&(this._defaultAsset&&this._unbindDefaultAsset(),this._defaultAsset=e,this._defaultAsset&&this._bindDefaultAsset(),this._onSetLocale(this._app.i18n.locale))}},{key:"localizedAsset",get:function(){return this._localizedAsset},set:function(t){var e=t instanceof cm?t.id:t;this._localizedAsset!==e&&(this._localizedAsset&&(this._app.assets.off("add:"+this._localizedAsset,this._onLocalizedAssetAdd,this),this._unbindLocalizedAsset()),this._localizedAsset=e,this._localizedAsset&&(this._app.assets.get(this._localizedAsset)?this._bindLocalizedAsset():this._app.assets.once("add:"+this._localizedAsset,this._onLocalizedAssetAdd,this)))}},{key:"autoLoad",get:function(){return this._autoLoad},set:function(t){this._autoLoad!==t&&(this._autoLoad=t,this._autoLoad&&this._localizedAsset&&(this._unbindLocalizedAsset(),this._bindLocalizedAsset()))}},{key:"disableLocalization",get:function(){return this._disableLocalization},set:function(t){this._disableLocalization!==t&&(this._disableLocalization=t,this._onSetLocale(this._app.i18n.locale))}}])}(P),ag="msdf",og="bitmap",hg=/[\w|/]/,lg=function(){function t(t){this._symbols=t,this._index=0,this._last=0,this._cur=this._symbols.length>0?this._symbols[0]:null,this._buf=[],this._mode="text",this._error=null}var e=t.prototype;return e.read=function(){for(var t=this._read();8===t;)t=this._read();return 0!==t&&1!==t&&(this._last=this._index),t},e.buf=function(){return this._buf},e.last=function(){return this._last},e.error=function(){return this._error},e.debugPrint=function(){for(var t=["EOF","ERROR","TEXT","OPEN_BRACKET","CLOSE_BRACKET","EQUALS","STRING","IDENTIFIER","WHITESPACE"],e=this.read(),i="";i+=(i.length>0?"\n":"")+t[e]+" '"+this.buf().join("")+"'",0!==e&&1!==e;)e=this.read();return i},e._read=function(){return this._buf=[],this._eof()?0:"text"===this._mode?this._text():this._tag()},e._text=function(){for(;;)switch(this._cur){case null:return this._buf.length>0?2:0;case"[":return this._mode="tag",this._buf.length>0?2:this._tag();case"\\":if(this._next(),"["===this._cur)this._store();else this._output("\\");break;default:this._store()}},e._tag=function(){switch(this._cur){case null:return this._error="unexpected end of input reading tag",1;case"[":return this._store(),3;case"]":return this._store(),this._mode="text",4;case"=":return this._store(),5;case" ":case"\t":case"\n":case"\r":case"\v":case"\f":return this._whitespace();case'"':return this._string();default:return this._isIdentifierSymbol(this._cur)?this._identifier():(this._error="unrecognized character",1)}},e._whitespace=function(){for(this._store();-1!==" \t\n\r\v\f".indexOf(this._cur);)this._store();return 8},e._string=function(){for(this._next();;)switch(this._cur){case null:return this._error="unexpected end of input reading string",1;case'"':return this._next(),6;default:this._store()}},e._identifier=function(){for(this._store();null!==this._cur&&this._isIdentifierSymbol(this._cur);)this._store();return 7},e._isIdentifierSymbol=function(t){return 1===t.length&&null!==t.match(hg)},e._eof=function(){return null===this._cur},e._next=function(){return this._eof()||(this._index++,this._cur=this._index=0;--s)if(n==="/"+e[s].name&&null===e[s].end)return e[s].end=t.length,4===(i=this._scanner.read())||(this._error="expected close bracket",!1);return this._error="failed to find matching tag",!1}var r={name:n,value:null,attributes:{},start:t.length,end:null};if(5===(i=this._scanner.read())){if(6!==(i=this._scanner.read()))return this._error="expected string",!1;r.value=this._scanner.buf().join(""),i=this._scanner.read()}for(;;){switch(i){case 4:return e.push(r),!0;case 7:var a=this._scanner.buf().join("");if(5!==(i=this._scanner.read()))return this._error="expected equals",!1;if(6!==(i=this._scanner.read()))return this._error="expected string",!1;var o=this._scanner.buf().join("");r.attributes[a]=o;break;default:return this._error="expected close bracket or identifier",!1}i=this._scanner.read()}},t}();function ug(t,e){for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];n instanceof Object?(t.hasOwnProperty(i)||(t[i]={}),ug(t[i],e[i])):t[i]=n}}function dg(t){if(0===t.length)return null;for(var e={},i=0;i=1e-4,g=this._element.calculatedWidth;(this.autoWidth&&!v||!this._wrapLines)&&(g=Number.POSITIVE_INFINITY);var y,x,S,b,T=0,w=0;function E(t,i,n){e._lineWidths.push(Math.abs(n));var s=f>i?i+1:f,r=f>i?f+1:i,h=t.slice(s,r);if(_)for(var l=h.length;l--&&_>0;)vg.test(h[l])&&(h.splice(l,1),_--);e._lineContents.push(h.join("")),a=0,o-=e._scaledLineHeight,c++,p=0,m=0,_=0,u=0,f=i}for(var A=!0;A;){A=!1,this._scaledLineHeight=s?this._lineHeight*this._fontSize/(this._maxFontSize||1e-4):this._lineHeight,this.width=0,this.height=0,this._lineWidths=[],this._lineContents=[],a=0,o=0,h=0,l=0,c=1,u=0,d=0,f=0,p=0,m=0,_=0;var C=this._fontSize/32;T=this._fontMinY*C,w=this._fontMaxY*C;for(var M=0;M=r?null:this._symbols[N+1],vg.test(y))_++,(!this._wrapLines||this._maxLines<0||c0){var j=this._font.data.kerning;if(j){var q=j[rt.getCodePoint(this._symbols[N-1])||0];q&&(X=q[rt.getCodePoint(this._symbols[N])||0]||0)}}H=x.scale||1,G=C*((x.width+x.height)/2)/H,V=(x.xadvance+X)*C,U=(x.xoffset-X)*C,z=x.yoffset*C}else console.error("Couldn't substitute missing character: '"+y+"'");var Y=gg.test(y),K=x&&x.map||0,Z=-this._font.data.info.maps[K].width/this._font.data.info.maps[K].height,Q=this._meshInfo[K],J=a+this._spacing*V;if(J>g&&m>0&&!Y&&(this._maxLines<0||cthis._element.calculatedWidth&&(ut=Math.floor(this._element.fontSize*this._element.calculatedWidth/(this.width||1e-4)),(ut=_t.clamp(ut,i,n))!==this._element.fontSize)){this._fontSize=ut,A=!0;break}if(this.height=Math.max(this.height,w-(o+T)),this._shouldAutoFitHeight()&&this.height>this._element.calculatedHeight&&(ut=_t.clamp(this._fontSize-1,i,n))!==this._element.fontSize){this._fontSize=ut,A=!0;break}a+=this._spacing*V,Y||(l=a),(this._isWordBoundary(y)||this._isValidNextChar(b)&&(this._isNextCJKBoundary(y,b)||this._isNextCJKWholeWord(b)))&&(p++,u=l,d=N+1),m++;var dt=this._getUv(y);if(Q.uvs[4*S*2+0]=dt[0],Q.uvs[4*S*2+1]=1-dt[1],Q.uvs[4*S*2+2]=dt[2],Q.uvs[4*S*2+3]=1-dt[1],Q.uvs[4*S*2+4]=dt[2],Q.uvs[4*S*2+5]=1-dt[3],Q.uvs[4*S*2+6]=dt[0],Q.uvs[4*S*2+7]=1-dt[3],this._symbolColors){var ft=3*this._symbolColors[N];P=this._colorPalette[ft],R=this._colorPalette[ft+1],I=this._colorPalette[ft+2]}if(Q.colors[4*S*4+0]=P,Q.colors[4*S*4+1]=R,Q.colors[4*S*4+2]=I,Q.colors[4*S*4+3]=255,Q.colors[4*S*4+4]=P,Q.colors[4*S*4+5]=R,Q.colors[4*S*4+6]=I,Q.colors[4*S*4+7]=255,Q.colors[4*S*4+8]=P,Q.colors[4*S*4+9]=R,Q.colors[4*S*4+10]=I,Q.colors[4*S*4+11]=255,Q.colors[4*S*4+12]=P,Q.colors[4*S*4+13]=R,Q.colors[4*S*4+14]=I,Q.colors[4*S*4+15]=255,this._symbolOutlineParams){var pt=5*this._symbolOutlineParams[N];D=this._outlinePalette[pt]+256*this._outlinePalette[pt+1],L=this._outlinePalette[pt+2]+256*this._outlinePalette[pt+3],k=this._outlinePalette[pt+4]}if(Q.outlines[4*S*3+0]=D,Q.outlines[4*S*3+1]=L,Q.outlines[4*S*3+2]=k,Q.outlines[4*S*3+3]=D,Q.outlines[4*S*3+4]=L,Q.outlines[4*S*3+5]=k,Q.outlines[4*S*3+6]=D,Q.outlines[4*S*3+7]=L,Q.outlines[4*S*3+8]=k,Q.outlines[4*S*3+9]=D,Q.outlines[4*S*3+10]=L,Q.outlines[4*S*3+11]=k,this._symbolShadowParams){var mt=6*this._symbolShadowParams[N];O=this._shadowPalette[mt]+256*this._shadowPalette[mt+1],F=this._shadowPalette[mt+2]+256*this._shadowPalette[mt+3],B=this._shadowPalette[mt+4]+127+256*Math.round(Z*this._shadowPalette[mt+5]+127)}Q.shadows[4*S*3+0]=O,Q.shadows[4*S*3+1]=F,Q.shadows[4*S*3+2]=B,Q.shadows[4*S*3+3]=O,Q.shadows[4*S*3+4]=F,Q.shadows[4*S*3+5]=B,Q.shadows[4*S*3+6]=O,Q.shadows[4*S*3+7]=F,Q.shadows[4*S*3+8]=B,Q.shadows[4*S*3+9]=O,Q.shadows[4*S*3+10]=F,Q.shadows[4*S*3+11]=B,Q.quad++}}A||f=Ot?(Ft.element[Ne].set(0,0,0),Ft.element[Xe].set(0,0),Ft.element[He].set(0,0,0,0),Ft.element[hi].set(0,0,0,0),Ft.element[li].set(0,0,0,0)):(Ft.element[Ne].set(this._meshInfo[St].positions[3*Bt+0],this._meshInfo[St].positions[3*Bt+1],this._meshInfo[St].positions[3*Bt+2]),Ft.element[Xe].set(this._meshInfo[St].uvs[2*Bt+0],this._meshInfo[St].uvs[2*Bt+1]),Ft.element[He].set(this._meshInfo[St].colors[4*Bt+0],this._meshInfo[St].colors[4*Bt+1],this._meshInfo[St].colors[4*Bt+2],this._meshInfo[St].colors[4*Bt+3]),Ft.element[hi].set(this._meshInfo[St].outlines[3*Bt+0],this._meshInfo[St].outlines[3*Bt+1],this._meshInfo[St].outlines[3*Bt+2]),Ft.element[li].set(this._meshInfo[St].shadows[3*Bt+0],this._meshInfo[St].shadows[3*Bt+1],this._meshInfo[St].shadows[3*Bt+2])),Ft.next();Ft.end(),this._meshInfo[St].meshInstance.mesh.aabb.compute(this._meshInfo[St].positions),this._meshInfo[St].meshInstance._aabbVer=-1}this._aabbDirty=!0},e._onFontRender=function(){this.font=this._font},e._onFontLoad=function(t){this.font!==t.resource&&(this.font=t.resource)},e._onFontChange=function(t,e,i,n){if("data"===e){this._font.data=i;for(var s=this._font.data.info.maps.length,r=0;rthis._font.textures.length&&(this._meshInfo.length=this._font.textures.length),this._updateText()}}},{key:"alignment",get:function(){return this._alignment},set:function(t){t instanceof It?this._alignment.set(t.x,t.y):this._alignment.set(t[0],t[1]),this._font&&this._updateText()}},{key:"autoWidth",get:function(){return this._autoWidth},set:function(t){var e=this._autoWidth;if(this._autoWidth=t,t&&Math.abs(this._element.anchor.x-this._element.anchor.z)<1e-4&&(this._element.width=this.width),e!==t){var i=this._shouldAutoFit()?this._maxFontSize:this._originalFontSize;i!==this._fontSize&&(this._fontSize=i,this._font&&this._updateText())}}},{key:"autoHeight",get:function(){return this._autoHeight},set:function(t){var e=this._autoHeight;if(this._autoHeight=t,t&&Math.abs(this._element.anchor.y-this._element.anchor.w)<1e-4&&(this._element.height=this.height),e!==t){var i=this._shouldAutoFit()?this._maxFontSize:this._originalFontSize;i!==this._fontSize&&(this._fontSize=i,this._font&&this._updateText())}}},{key:"rtlReorder",get:function(){return this._rtlReorder},set:function(t){this._rtlReorder!==t&&(this._rtlReorder=t,this._font&&this._updateText())}},{key:"unicodeConverter",get:function(){return this._unicodeConverter},set:function(t){this._unicodeConverter!==t&&(this._unicodeConverter=t,this._setText(this._text))}},{key:"aabb",get:function(){if(this._aabbDirty){for(var t=!1,e=0;e=0&&this.system._prerender.splice(i,1),this.system._prerender.indexOf(t)<0&&this.system._prerender.push(t)}t=e}},i._onPrerender=function(){for(var t=0;t=0)&&(null==(t=this.system.app.batcher)||t.insert(lh.ELEMENT,this.batchGroupId,this.entity));this.fire("enableelement")},i.onDisable=function(){var t;(this.system.app.scene.off("set:layers",this.onLayersChanged,this),this.system.app.scene.layers&&(this.system.app.scene.layers.off("add",this.onLayerAdded,this),this.system.app.scene.layers.off("remove",this.onLayerRemoved,this)),this._image&&this._image.onDisable(),this._text&&this._text.onDisable(),this._group&&this._group.onDisable(),this.system.app.elementInput&&this.useInput&&this.system.app.elementInput.removeElement(this),this._batchGroupId>=0)&&(null==(t=this.system.app.batcher)||t.remove(lh.ELEMENT,this.batchGroupId,this.entity));this.fire("disableelement")},i.onRemove=function(){this.entity.off("insert",this._onInsert,this),this._unpatch(),this._image&&this._image.destroy(),this._text&&this._text.destroy(),this.system.app.elementInput&&this.useInput&&this.system.app.elementInput.removeElement(this),this.screen&&this.screen.screen&&(this._unbindScreen(this.screen.screen),this.screen.screen.syncDrawOrder()),this.off()},i._calculateSize=function(t,e){if(this.entity._parent||this.screen){this._calculateLocalAnchors();var i=this._absRight-this._absLeft,n=this._absTop-this._absBottom;t?this._setWidth(i):this._setCalculatedWidth(i,!1),e?this._setHeight(n):this._setCalculatedHeight(n,!1);var s=this.entity.getLocalPosition();s.x=this._margin.x+this._calculatedWidth*this._pivot.x,s.y=this._margin.y+this._calculatedHeight*this._pivot.y,this.entity.setLocalPosition(s),this._sizeDirty=!1}},i._setWidth=function(t){this._width=t,this._setCalculatedWidth(t,!1),this.fire("set:width",this._width)},i._setHeight=function(t){this._height=t,this._setCalculatedHeight(t,!1),this.fire("set:height",this._height)},i._setCalculatedWidth=function(t,e){if(!(Math.abs(t-this._calculatedWidth)<=1e-4)){if(this._calculatedWidth=t,this.entity._dirtifyLocal(),e){var i=this.entity.getLocalPosition(),n=this._pivot;this._margin.x=i.x-this._calculatedWidth*n.x,this._margin.z=this._localAnchor.z-this._localAnchor.x-this._calculatedWidth-this._margin.x}this._flagChildrenAsDirty(),this.fire("set:calculatedWidth",this._calculatedWidth),this.fire("resize",this._calculatedWidth,this._calculatedHeight)}},i._setCalculatedHeight=function(t,e){if(!(Math.abs(t-this._calculatedHeight)<=1e-4)){if(this._calculatedHeight=t,this.entity._dirtifyLocal(),e){var i=this.entity.getLocalPosition(),n=this._pivot;this._margin.y=i.y-this._calculatedHeight*n.y,this._margin.w=this._localAnchor.w-this._localAnchor.y-this._calculatedHeight-this._margin.y}this._flagChildrenAsDirty(),this.fire("set:calculatedHeight",this._calculatedHeight),this.fire("resize",this._calculatedWidth,this._calculatedHeight)}},i._flagChildrenAsDirty=function(){for(var t=this.entity._children,e=0,i=t.length;e=0&&this._addedModels.splice(e,1);for(var i=0;ii||f>n||p.001}},{key:"_hasSplitAnchorsY",get:function(){return Math.abs(this._anchor.y-this._anchor.w)>.001}},{key:"aabb",get:function(){return this._image?this._image.aabb:this._text?this._text.aabb:null}},{key:"anchor",get:function(){return this._anchor},set:function(t){var e;t instanceof Lt?this._anchor.copy(t):(e=this._anchor).set.apply(e,t);this.entity._parent||this.screen?this._calculateSize(this._hasSplitAnchorsX,this._hasSplitAnchorsY):this._calculateLocalAnchors(),this._anchorDirty=!0,this.entity._dirtyLocal||this.entity._dirtifyLocal(),this.fire("set:anchor",this._anchor)}},{key:"batchGroupId",get:function(){return this._batchGroupId},set:function(t){if(this._batchGroupId!==t){var e,i;if(this.entity.enabled&&this._batchGroupId>=0)null==(e=this.system.app.batcher)||e.remove(lh.ELEMENT,this.batchGroupId,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(lh.ELEMENT,t,this.entity);t<0&&this._batchGroupId>=0&&this.enabled&&this.entity.enabled&&(this._image&&this._image._renderable.model?this.addModelToLayers(this._image._renderable.model):this._text&&this._text._model&&this.addModelToLayers(this._text._model)),this._batchGroupId=t}}},{key:"bottom",get:function(){return this._margin.y},set:function(t){this._margin.y=t;var e=this.entity.getLocalPosition(),i=this._absTop,n=this._localAnchor.y+t;this._setHeight(i-n),e.y=t+this._calculatedHeight*this._pivot.y,this.entity.setLocalPosition(e)}},{key:"calculatedWidth",get:function(){return this._calculatedWidth},set:function(t){this._setCalculatedWidth(t,!0)}},{key:"calculatedHeight",get:function(){return this._calculatedHeight},set:function(t){this._setCalculatedHeight(t,!0)}},{key:"canvasCorners",get:function(){if(!this._canvasCornersDirty||!this.screen||!this.screen.screen.screenSpace)return this._canvasCorners;for(var t=this.system.app.graphicsDevice,e=this.screenCorners,i=t.canvas.clientWidth/t.width,n=t.canvas.clientHeight/t.height,s=0;s<4;s++)this._canvasCorners[s].set(e[s].x*i,(t.height-e[s].y)*n);return this._canvasCornersDirty=!1,this._canvasCorners}},{key:"drawOrder",get:function(){return this._drawOrder},set:function(t){var e=0;this.screen&&(e=this.screen.screen.priority),t>16777215&&(t=16777215),this._drawOrder=(e<<24)+t,this.fire("set:draworder",this._drawOrder)}},{key:"height",get:function(){return this._height},set:function(t){this._height=t,this._hasSplitAnchorsY||this._setCalculatedHeight(t,!0),this.fire("set:height",this._height)}},{key:"layers",get:function(){return this._layers},set:function(t){if(this._addedModels.length)for(var e=0;e.001,a=Math.abs(e.anchor.y-e.anchor.w)>.001,o=!1;void 0!==i.margin&&(i.margin instanceof Lt?e.margin.copy(i.margin):e._margin.set(i.margin[0],i.margin[1],i.margin[2],i.margin[3]),o=!0),void 0!==i.left&&(e._margin.x=i.left,o=!0),void 0!==i.bottom&&(e._margin.y=i.bottom,o=!0),void 0!==i.right&&(e._margin.z=i.right,o=!0),void 0!==i.top&&(e._margin.w=i.top,o=!0),o&&(e.margin=e._margin);var h=!1;void 0===i.width||r?r&&(h=!0):e.width=i.width,void 0===i.height||a?a&&(h=!0):e.height=i.height,h&&(e.anchor=e.anchor),void 0!==i.enabled&&(e.enabled=i.enabled),void 0!==i.useInput&&(e.useInput=i.useInput),void 0!==i.fitMode&&(e.fitMode=i.fitMode),e.batchGroupId=void 0===i.batchGroupId||null===i.batchGroupId?-1:i.batchGroupId,i.layers&&Array.isArray(i.layers)&&(e.layers=i.layers.slice(0)),void 0!==i.type&&(e.type=i.type),e.type===uv?(void 0!==i.rect&&(e.rect=i.rect),void 0!==i.color&&((s=i.color)instanceof vt||(s=new vt(i.color[0],i.color[1],i.color[2])),e.color=s),void 0!==i.opacity&&(e.opacity=i.opacity),void 0!==i.textureAsset&&(e.textureAsset=i.textureAsset),i.texture&&(e.texture=i.texture),void 0!==i.spriteAsset&&(e.spriteAsset=i.spriteAsset),i.sprite&&(e.sprite=i.sprite),void 0!==i.spriteFrame&&(e.spriteFrame=i.spriteFrame),void 0!==i.pixelsPerUnit&&null!==i.pixelsPerUnit&&(e.pixelsPerUnit=i.pixelsPerUnit),void 0!==i.materialAsset&&(e.materialAsset=i.materialAsset),i.material&&(e.material=i.material),void 0!==i.mask&&(e.mask=i.mask)):e.type===dv&&(void 0!==i.autoWidth&&(e.autoWidth=i.autoWidth),void 0!==i.autoHeight&&(e.autoHeight=i.autoHeight),void 0!==i.rtlReorder&&(e.rtlReorder=i.rtlReorder),void 0!==i.unicodeConverter&&(e.unicodeConverter=i.unicodeConverter),null!==i.text&&void 0!==i.text?e.text=i.text:null!==i.key&&void 0!==i.key&&(e.key=i.key),void 0!==i.color&&((s=i.color)instanceof vt||(s=new vt(s[0],s[1],s[2])),e.color=s),void 0!==i.opacity&&(e.opacity=i.opacity),void 0!==i.spacing&&(e.spacing=i.spacing),void 0!==i.fontSize&&(e.fontSize=i.fontSize,i.lineHeight||(e.lineHeight=i.fontSize)),void 0!==i.lineHeight&&(e.lineHeight=i.lineHeight),void 0!==i.maxLines&&(e.maxLines=i.maxLines),void 0!==i.wrapLines&&(e.wrapLines=i.wrapLines),void 0!==i.minFontSize&&(e.minFontSize=i.minFontSize),void 0!==i.maxFontSize&&(e.maxFontSize=i.maxFontSize),i.autoFitWidth&&(e.autoFitWidth=i.autoFitWidth),i.autoFitHeight&&(e.autoFitHeight=i.autoFitHeight),void 0!==i.fontAsset&&(e.fontAsset=i.fontAsset),void 0!==i.font&&(e.font=i.font),void 0!==i.alignment&&(e.alignment=i.alignment),void 0!==i.outlineColor&&(e.outlineColor=i.outlineColor),void 0!==i.outlineThickness&&(e.outlineThickness=i.outlineThickness),void 0!==i.shadowColor&&(e.shadowColor=i.shadowColor),void 0!==i.shadowOffset&&(e.shadowOffset=i.shadowOffset),void 0!==i.enableMarkup&&(e.enableMarkup=i.enableMarkup));var l=e._parseUpToScreen();l.screen&&e._updateScreen(l.screen),t.prototype.initializeComponentData.call(this,e,i,n),e._beingInitialized=!1,e.type===uv&&e._image._meshDirty&&e._image._updateMesh(e._image.mesh)},i.onRemoveComponent=function(t,e){e.onRemove()},i.cloneComponent=function(t,e){var i=t.element,n={enabled:i.enabled,width:i.width,height:i.height,anchor:i.anchor.clone(),pivot:i.pivot.clone(),margin:i.margin.clone(),alignment:i.alignment&&i.alignment.clone()||i.alignment,autoWidth:i.autoWidth,autoHeight:i.autoHeight,type:i.type,rect:i.rect&&i.rect.clone()||i.rect,rtlReorder:i.rtlReorder,unicodeConverter:i.unicodeConverter,materialAsset:i.materialAsset,material:i.material,color:i.color&&i.color.clone()||i.color,opacity:i.opacity,textureAsset:i.textureAsset,texture:i.texture,spriteAsset:i.spriteAsset,sprite:i.sprite,spriteFrame:i.spriteFrame,pixelsPerUnit:i.pixelsPerUnit,spacing:i.spacing,lineHeight:i.lineHeight,wrapLines:i.wrapLines,layers:i.layers,fontSize:i.fontSize,minFontSize:i.minFontSize,maxFontSize:i.maxFontSize,autoFitWidth:i.autoFitWidth,autoFitHeight:i.autoFitHeight,maxLines:i.maxLines,fontAsset:i.fontAsset,font:i.font,useInput:i.useInput,fitMode:i.fitMode,batchGroupId:i.batchGroupId,mask:i.mask,outlineColor:i.outlineColor&&i.outlineColor.clone()||i.outlineColor,outlineThickness:i.outlineThickness,shadowColor:i.shadowColor&&i.shadowColor.clone()||i.shadowColor,shadowOffset:i.shadowOffset&&i.shadowOffset.clone()||i.shadowOffset,enableMarkup:i.enableMarkup};return void 0!==i.key&&null!==i.key?n.key=i.key:n.text=i.text,this.addComponent(e,n)},i.getTextElementMaterial=function(t,e,i){var n=(t&&1)|(e&&2)|(i&&4),s=this._defaultTextMaterials[n];if(s)return s;var r="TextMaterial";return s=new Oc,e?(s.msdfMap=this._defaultTexture,s.msdfTextAttribute=i,s.emissive.set(1,1,1)):(r="Bitmap"+r,s.emissive.set(.5,.5,.5),s.emissiveMap=this._defaultTexture,s.emissiveTint=!0,s.opacityMap=this._defaultTexture,s.opacityMapChannel="a"),t&&(r="ScreenSpace"+r,s.depthTest=!1),s.name="default"+r,s.useLighting=!1,s.useGammaTonemap=!1,s.useFog=!1,s.useSkybox=!1,s.diffuse.set(0,0,0),s.opacity=.5,s.blendType=4,s.depthWrite=!1,s.emissiveVertexColor=!0,s.update(),this._defaultTextMaterials[n]=s,s},i._createBaseImageMaterial=function(){var t=new Oc;return t.diffuse.set(0,0,0),t.emissive.set(.5,.5,.5),t.emissiveMap=this._defaultTexture,t.emissiveTint=!0,t.opacityMap=this._defaultTexture,t.opacityMapChannel="a",t.opacityTint=!0,t.opacity=0,t.useLighting=!1,t.useGammaTonemap=!1,t.useFog=!1,t.useSkybox=!1,t.blendType=4,t.depthWrite=!1,t},i.getImageElementMaterial=function(t,e,i,n){return t?e?i?(this.defaultScreenSpaceImageMask9SlicedMaterial||(this.defaultScreenSpaceImageMask9SlicedMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImageMask9SlicedMaterial.name="defaultScreenSpaceImageMask9SlicedMaterial",this.defaultScreenSpaceImageMask9SlicedMaterial.nineSlicedMode=1,this.defaultScreenSpaceImageMask9SlicedMaterial.depthTest=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.alphaTest=1,this.defaultScreenSpaceImageMask9SlicedMaterial.redWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.greenWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.blueWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.alphaWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMask9SlicedMaterial)),this.defaultScreenSpaceImageMask9SlicedMaterial):n?(this.defaultScreenSpaceImageMask9TiledMaterial||(this.defaultScreenSpaceImageMask9TiledMaterial=this.defaultScreenSpaceImage9TiledMaterial.clone(),this.defaultScreenSpaceImageMask9TiledMaterial.name="defaultScreenSpaceImageMask9TiledMaterial",this.defaultScreenSpaceImageMask9TiledMaterial.nineSlicedMode=2,this.defaultScreenSpaceImageMask9TiledMaterial.depthTest=!1,this.defaultScreenSpaceImageMask9TiledMaterial.alphaTest=1,this.defaultScreenSpaceImageMask9TiledMaterial.redWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.greenWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.blueWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.alphaWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMask9TiledMaterial)),this.defaultScreenSpaceImageMask9TiledMaterial):(this.defaultScreenSpaceImageMaskMaterial||(this.defaultScreenSpaceImageMaskMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImageMaskMaterial.name="defaultScreenSpaceImageMaskMaterial",this.defaultScreenSpaceImageMaskMaterial.depthTest=!1,this.defaultScreenSpaceImageMaskMaterial.alphaTest=1,this.defaultScreenSpaceImageMaskMaterial.redWrite=!1,this.defaultScreenSpaceImageMaskMaterial.greenWrite=!1,this.defaultScreenSpaceImageMaskMaterial.blueWrite=!1,this.defaultScreenSpaceImageMaskMaterial.alphaWrite=!1,this.defaultScreenSpaceImageMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMaskMaterial)),this.defaultScreenSpaceImageMaskMaterial):i?(this.defaultScreenSpaceImage9SlicedMaterial||(this.defaultScreenSpaceImage9SlicedMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImage9SlicedMaterial.name="defaultScreenSpaceImage9SlicedMaterial",this.defaultScreenSpaceImage9SlicedMaterial.nineSlicedMode=1,this.defaultScreenSpaceImage9SlicedMaterial.depthTest=!1,this.defaultScreenSpaceImage9SlicedMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImage9SlicedMaterial)),this.defaultScreenSpaceImage9SlicedMaterial):n?(this.defaultScreenSpaceImage9TiledMaterial||(this.defaultScreenSpaceImage9TiledMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImage9TiledMaterial.name="defaultScreenSpaceImage9TiledMaterial",this.defaultScreenSpaceImage9TiledMaterial.nineSlicedMode=2,this.defaultScreenSpaceImage9TiledMaterial.depthTest=!1,this.defaultScreenSpaceImage9TiledMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImage9TiledMaterial)),this.defaultScreenSpaceImage9TiledMaterial):(this.defaultScreenSpaceImageMaterial||(this.defaultScreenSpaceImageMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImageMaterial.name="defaultScreenSpaceImageMaterial",this.defaultScreenSpaceImageMaterial.depthTest=!1,this.defaultScreenSpaceImageMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMaterial)),this.defaultScreenSpaceImageMaterial):e?i?(this.defaultImage9SlicedMaskMaterial||(this.defaultImage9SlicedMaskMaterial=this._createBaseImageMaterial(),this.defaultImage9SlicedMaskMaterial.name="defaultImage9SlicedMaskMaterial",this.defaultImage9SlicedMaskMaterial.nineSlicedMode=1,this.defaultImage9SlicedMaskMaterial.alphaTest=1,this.defaultImage9SlicedMaskMaterial.redWrite=!1,this.defaultImage9SlicedMaskMaterial.greenWrite=!1,this.defaultImage9SlicedMaskMaterial.blueWrite=!1,this.defaultImage9SlicedMaskMaterial.alphaWrite=!1,this.defaultImage9SlicedMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9SlicedMaskMaterial)),this.defaultImage9SlicedMaskMaterial):n?(this.defaultImage9TiledMaskMaterial||(this.defaultImage9TiledMaskMaterial=this._createBaseImageMaterial(),this.defaultImage9TiledMaskMaterial.name="defaultImage9TiledMaskMaterial",this.defaultImage9TiledMaskMaterial.nineSlicedMode=2,this.defaultImage9TiledMaskMaterial.alphaTest=1,this.defaultImage9TiledMaskMaterial.redWrite=!1,this.defaultImage9TiledMaskMaterial.greenWrite=!1,this.defaultImage9TiledMaskMaterial.blueWrite=!1,this.defaultImage9TiledMaskMaterial.alphaWrite=!1,this.defaultImage9TiledMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9TiledMaskMaterial)),this.defaultImage9TiledMaskMaterial):(this.defaultImageMaskMaterial||(this.defaultImageMaskMaterial=this._createBaseImageMaterial(),this.defaultImageMaskMaterial.name="defaultImageMaskMaterial",this.defaultImageMaskMaterial.alphaTest=1,this.defaultImageMaskMaterial.redWrite=!1,this.defaultImageMaskMaterial.greenWrite=!1,this.defaultImageMaskMaterial.blueWrite=!1,this.defaultImageMaskMaterial.alphaWrite=!1,this.defaultImageMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultImageMaskMaterial)),this.defaultImageMaskMaterial):i?(this.defaultImage9SlicedMaterial||(this.defaultImage9SlicedMaterial=this._createBaseImageMaterial(),this.defaultImage9SlicedMaterial.name="defaultImage9SlicedMaterial",this.defaultImage9SlicedMaterial.nineSlicedMode=1,this.defaultImage9SlicedMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9SlicedMaterial)),this.defaultImage9SlicedMaterial):n?(this.defaultImage9TiledMaterial||(this.defaultImage9TiledMaterial=this._createBaseImageMaterial(),this.defaultImage9TiledMaterial.name="defaultImage9TiledMaterial",this.defaultImage9TiledMaterial.nineSlicedMode=2,this.defaultImage9TiledMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9TiledMaterial)),this.defaultImage9TiledMaterial):(this.defaultImageMaterial||(this.defaultImageMaterial=this._createBaseImageMaterial(),this.defaultImageMaterial.name="defaultImageMaterial",this.defaultImageMaterial.update(),this.defaultImageMaterials.push(this.defaultImageMaterial)),this.defaultImageMaterial)},i.registerUnicodeConverter=function(t){this._unicodeConverter=t},i.registerRtlReorder=function(t){this._rtlReorder=t},i.getUnicodeConverter=function(){return this._unicodeConverter},i.getRtlReorder=function(){return this._rtlReorder},e}(jm),zg="free",Vg="limited",Gg="locked",Hg=["angularDampingX","angularDampingY","angularDampingZ","angularEquilibriumX","angularEquilibriumY","angularEquilibriumZ","angularLimitsX","angularLimitsY","angularLimitsZ","angularMotionX","angularMotionY","angularMotionZ","angularSpringX","angularSpringY","angularSpringZ","angularStiffnessX","angularStiffnessY","angularStiffnessZ","breakForce","enableCollision","enabled","entityA","entityB","linearDampingX","linearDampingY","linearDampingZ","linearEquilibriumX","linearEquilibriumY","linearEquilibriumZ","linearLimitsX","linearLimitsY","linearLimitsZ","linearMotionX","linearMotionY","linearMotionZ","linearSpringX","linearSpringY","linearSpringZ","linearStiffnessX","linearStiffnessY","linearStiffnessZ"],Wg=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._constraint=null,n._entityA=null,n._entityB=null,n._breakForce=34e37,n._enableCollision=!0,n._linearMotionX=Gg,n._linearLimitsX=new It(0,0),n._linearSpringX=!1,n._linearStiffnessX=0,n._linearDampingX=1,n._linearEquilibriumX=0,n._linearMotionY=Gg,n._linearLimitsY=new It(0,0),n._linearSpringY=!1,n._linearStiffnessY=0,n._linearDampingY=1,n._linearEquilibriumY=0,n._linearMotionZ=Gg,n._linearLimitsZ=new It(0,0),n._linearSpringZ=!1,n._linearStiffnessZ=0,n._linearDampingZ=1,n._linearEquilibriumZ=0,n._angularMotionX=Gg,n._angularLimitsX=new It(0,0),n._angularSpringX=!1,n._angularStiffnessX=0,n._angularDampingX=1,n._angularEquilibriumX=0,n._angularMotionY=Gg,n._angularLimitsY=new It(0,0),n._angularSpringY=!1,n._angularStiffnessY=0,n._angularDampingY=1,n._angularEquilibriumY=0,n._angularMotionZ=Gg,n._angularLimitsZ=new It(0,0),n._angularSpringZ=!1,n._angularEquilibriumZ=0,n._angularDampingZ=1,n._angularStiffnessZ=0,n.on("set_enabled",n._onSetEnabled,n),n}x(e,t);var i=e.prototype;return i._convertTransform=function(t,e){var i=t.getTranslation(),n=new Vt;n.setFromMat4(t);var s=new Ammo.btVector3(i.x,i.y,i.z),r=new Ammo.btQuaternion(n.x,n.y,n.z,n.w);e.setOrigin(s),e.setRotation(r),Ammo.destroy(s),Ammo.destroy(r)},i._updateAngularLimits=function(){var t=this._constraint;if(t){var e,i,n,s,r,a;this._angularMotionX===Vg?(e=this._angularLimitsX.x*_t.DEG_TO_RAD,s=this._angularLimitsX.y*_t.DEG_TO_RAD):this._angularMotionX===zg?(e=1,s=0):e=s=0,this._angularMotionY===Vg?(i=this._angularLimitsY.x*_t.DEG_TO_RAD,r=this._angularLimitsY.y*_t.DEG_TO_RAD):this._angularMotionY===zg?(i=1,r=0):i=r=0,this._angularMotionZ===Vg?(n=this._angularLimitsZ.x*_t.DEG_TO_RAD,a=this._angularLimitsZ.y*_t.DEG_TO_RAD):this._angularMotionZ===zg?(n=1,a=0):n=a=0;var o=new Ammo.btVector3(e,i,n);t.setAngularLowerLimit(o),o.setValue(s,r,a),t.setAngularUpperLimit(o),Ammo.destroy(o)}},i._updateLinearLimits=function(){var t=this._constraint;if(t){var e,i,n,s,r,a;this._linearMotionX===Vg?(e=this._linearLimitsX.x,s=this._linearLimitsX.y):this._linearMotionX===zg?(e=1,s=0):e=s=0,this._linearMotionY===Vg?(i=this._linearLimitsY.x,r=this._linearLimitsY.y):this._linearMotionY===zg?(i=1,r=0):i=r=0,this._linearMotionZ===Vg?(n=this._linearLimitsZ.x,a=this._linearLimitsZ.y):this._linearMotionZ===zg?(n=1,a=0):n=a=0;var o=new Ammo.btVector3(e,i,n);t.setLinearLowerLimit(o),o.setValue(s,r,a),t.setLinearUpperLimit(o),Ammo.destroy(o)}},i._createConstraint=function(){if(this._entityA&&this._entityA.rigidbody){this._destroyConstraint();var t=new zt,e=this._entityA.rigidbody.body;e.activate();var i=this.entity.getWorldTransform(),n=this._entityA.getWorldTransform().clone().invert();t.mul2(n,i);var s=new Ammo.btTransform;if(this._convertTransform(t,s),this._entityB&&this._entityB.rigidbody){var r=this._entityB.rigidbody.body;r.activate();var a=this._entityB.getWorldTransform().clone().invert();t.mul2(a,i);var o=new Ammo.btTransform;this._convertTransform(t,o),this._constraint=new Ammo.btGeneric6DofSpringConstraint(e,r,s,o,!this._enableCollision),Ammo.destroy(o)}else this._constraint=new Ammo.btGeneric6DofSpringConstraint(e,s,!this._enableCollision);Ammo.destroy(s);for(var h=["X","Y","Z","X","Y","Z"],l=0;l<6;l++){var c=l<3?"_linear":"_angular";this._constraint.enableSpring(l,this[c+"Spring"+h[l]]),this._constraint.setDamping(l,this[c+"Damping"+h[l]]),this._constraint.setEquilibriumPoint(l,this[c+"Equilibrium"+h[l]]),this._constraint.setStiffness(l,this[c+"Stiffness"+h[l]])}this._constraint.setBreakingImpulseThreshold(this._breakForce),this._updateLinearLimits(),this._updateAngularLimits(),this.system.app.systems.rigidbody.dynamicsWorld.addConstraint(this._constraint,!this._enableCollision)}},i._destroyConstraint=function(){this._constraint&&(this.system.app.systems.rigidbody.dynamicsWorld.removeConstraint(this._constraint),Ammo.destroy(this._constraint),this._constraint=null)},i.initFromData=function(t){for(var e=0,i=Hg;e=i?sy:iy;case 3:return e=0;--n)i[e[n]]=i[e[n+1]]+t[e[n]];return i}return function(t,d){t=t.filter(o),e=d,ry.x=e.containerSize.x-e.padding.x-e.padding.z,ry.y=e.containerSize.y-e.padding.y-e.padding.w,function(t){for(var e=0;e0&&(r+=e.spacing[i.axis]);var h=s[o][i.size];r+=h,!a&&r>ry[i.axis]&&0!==n[n.length-1].length&&(r=h,n.push([])),n[n.length-1].push(t[o]),a&&r>ry[i.axis]&&o!==t.length-1&&(r=0,n.push([]))}return n}(t)),m=function(t,i){for(var s=[],r=[],a=0;ao.largestSize[n.size]&&(o.largestElement=o[d],o.largestSize=f)}s.push(o.largestElement),r.push(o.largestSize)}var p=l(r,n),m=h(e[n.fitting],p,ry[n.axis]);m===ny?c(r,p,n):m===sy&&u(r,p,n);for(var _=0;_0;){var e=this._reflowQueue.slice();this._reflowQueue.length=0,e.sort((function(t,e){return t.entity.graphDepth-e.entity.graphDepth}));for(var i=0;i=100){console.warn("Max reflow iterations limit reached, bailing.");break}}},i._onRemoveComponent=function(t,e){e.onRemove()},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("postUpdate",this._onPostUpdate,this)},e}(jm);Xm._buildAccessors(uy.prototype,fy);var my=[];function _y(t,e){for(var i=null,n=0;n=0&&(null==(n=t.batcher)||n.insert(lh.MODEL,this.batchGroupId,this.entity))},i.onDisable=function(){var t,e=this.system.app,i=e.scene;(i.off("set:layers",this.onLayersChanged,this),i.layers&&(i.layers.off("add",this.onLayerAdded,this),i.layers.off("remove",this.onLayerRemoved,this)),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.remove(lh.MODEL,this.batchGroupId,this.entity));this._model&&this.removeModelFromLayers()},i.hide=function(){if(this._model)for(var t=this._model.meshInstances,e=0,i=t.length;e=0)null==(e=this.system.app.batcher)||e.remove(lh.MODEL,this.batchGroupId,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(lh.MODEL,t,this.entity);t<0&&this._batchGroupId>=0&&this.enabled&&this.entity.enabled&&this.addModelToLayers(),this._batchGroupId=t}}},{key:"materialAsset",get:function(){return this._materialAsset},set:function(t){var e=t;t instanceof cm&&(e=t.id);var i=this.system.app.assets;if(e!==this._materialAsset){if(this._materialAsset){i.off("add:"+this._materialAsset,this._onMaterialAssetAdd,this);var n=i.get(this._materialAsset);n&&this._unbindMaterialAsset(n)}if(this._materialAsset=e,this._materialAsset){var s=i.get(this._materialAsset);s?this._bindMaterialAsset(s):(this._setMaterial(this.system.defaultMaterial),i.on("add:"+this._materialAsset,this._onMaterialAssetAdd,this))}else this._setMaterial(this.system.defaultMaterial)}}},{key:"material",get:function(){return this._material},set:function(t){this._material!==t&&(this.materialAsset=null,this._setMaterial(t))}},{key:"mapping",get:function(){return this._mapping},set:function(t){if("asset"===this._type&&(this._unsetMaterialEvents(),t||(t={}),this._mapping=t,this._model))for(var e=this._model.meshInstances,i=this.asset?this.system.app.assets.get(this.asset):null,n=i?i.data.mapping:null,s=null,r=0,a=e.length;r=0))continue;n=this.system.app.assets.get(n)}n&&!n.resource&&this.system.app.assets.load(n)}}if(!this.system.app.graphicsDevice.disableParticleSystem){if(!this.emitter){var s=t.mesh;s instanceof vh||(s=null),this.emitter=new wf(this.system.app.graphicsDevice,{numParticles:t.numParticles,emitterExtents:t.emitterExtents,emitterExtentsInner:t.emitterExtentsInner,emitterRadius:t.emitterRadius,emitterRadiusInner:t.emitterRadiusInner,emitterShape:t.emitterShape,initialVelocity:t.initialVelocity,wrap:t.wrap,localSpace:t.localSpace,screenSpace:t.screenSpace,wrapBounds:t.wrapBounds,lifetime:t.lifetime,rate:t.rate,rate2:t.rate2,orientation:t.orientation,particleNormal:t.particleNormal,animTilesX:t.animTilesX,animTilesY:t.animTilesY,animStartFrame:t.animStartFrame,animNumFrames:t.animNumFrames,animNumAnimations:t.animNumAnimations,animIndex:t.animIndex,randomizeAnimIndex:t.randomizeAnimIndex,animSpeed:t.animSpeed,animLoop:t.animLoop,startAngle:t.startAngle,startAngle2:t.startAngle2,scaleGraph:t.scaleGraph,scaleGraph2:t.scaleGraph2,colorGraph:t.colorGraph,colorGraph2:t.colorGraph2,alphaGraph:t.alphaGraph,alphaGraph2:t.alphaGraph2,localVelocityGraph:t.localVelocityGraph,localVelocityGraph2:t.localVelocityGraph2,velocityGraph:t.velocityGraph,velocityGraph2:t.velocityGraph2,rotationSpeedGraph:t.rotationSpeedGraph,rotationSpeedGraph2:t.rotationSpeedGraph2,radialSpeedGraph:t.radialSpeedGraph,radialSpeedGraph2:t.radialSpeedGraph2,colorMap:t.colorMap,normalMap:t.normalMap,loop:t.loop,preWarm:t.preWarm,sort:t.sort,stretch:t.stretch,alignToMotion:t.alignToMotion,lighting:t.lighting,halfLambert:t.halfLambert,intensity:t.intensity,depthSoftening:t.depthSoftening,scene:this.system.app.scene,mesh:s,depthWrite:t.depthWrite,noFog:t.noFog,node:this.entity,blendType:t.blendType}),this.emitter.meshInstance.node=this.entity,this.emitter.drawOrder=this.drawOrder,t.autoPlay||(this.pause(),this.emitter.meshInstance.visible=!1)}this.emitter.colorMap&&this.addMeshInstanceToLayers(),this.system.app.scene.on("set:layers",this.onLayersChanged,this),this.system.app.scene.layers&&(this.system.app.scene.layers.on("add",this.onLayerAdded,this),this.system.app.scene.layers.on("remove",this.onLayerRemoved,this)),this.enabled&&this.entity.enabled&&t.depthSoftening&&this._requestDepth()}},i.onDisable=function(){this.system.app.scene.off("set:layers",this.onLayersChanged,this),this.system.app.scene.layers&&(this.system.app.scene.layers.off("add",this.onLayerAdded,this),this.system.app.scene.layers.off("remove",this.onLayerRemoved,this)),this.emitter&&(this.removeMeshInstanceFromLayers(),this.data.depthSoftening&&this._releaseDepth(),this.emitter.camera=null)},i.onBeforeRemove=function(){this.enabled&&(this.enabled=!1),this.emitter&&(this.emitter.destroy(),this.emitter=null);for(var t=0;tc.fixedTimeStep&&(e=Math.floor(c.simTime/c.fixedTimeStep),c.simTime-=e*c.fixedTimeStep),e){e=Math.min(e,c.maxSubSteps);for(var p=0;p=0){var r=n[s];r.decRefCount(),0===r.refCount&&(n.splice(s,1),n.length||t._skinInstanceCache.delete(i),e&&(e.destroy(),r.skinInstance=null))}}}}},t}();Iy._skinInstanceCache=new Map;var Dy=function(){function t(t,e,i,n,s){this.propertyName=t,this.parent=e,this._scope=s,this._registry=i,this.id=null,this.url=null,this.asset=null,this._onAssetLoad=n.load,this._onAssetAdd=n.add,this._onAssetRemove=n.remove,this._onAssetUnload=n.unload}var e=t.prototype;return e._bind=function(){this.id&&(this._onAssetLoad&&this._registry.on("load:"+this.id,this._onLoad,this),this._onAssetAdd&&this._registry.once("add:"+this.id,this._onAdd,this),this._onAssetRemove&&this._registry.on("remove:"+this.id,this._onRemove,this),this._onAssetUnload&&this._registry.on("unload:"+this.id,this._onUnload,this)),this.url&&(this._onAssetLoad&&this._registry.on("load:url:"+this.url,this._onLoad,this),this._onAssetAdd&&this._registry.once("add:url:"+this.url,this._onAdd,this),this._onAssetRemove&&this._registry.on("remove:url:"+this.url,this._onRemove,this))},e._unbind=function(){this.id&&(this._onAssetLoad&&this._registry.off("load:"+this.id,this._onLoad,this),this._onAssetAdd&&this._registry.off("add:"+this.id,this._onAdd,this),this._onAssetRemove&&this._registry.off("remove:"+this.id,this._onRemove,this),this._onAssetUnload&&this._registry.off("unload:"+this.id,this._onUnload,this)),this.url&&(this._onAssetLoad&&this._registry.off("load:"+this.url,this._onLoad,this),this._onAssetAdd&&this._registry.off("add:"+this.url,this._onAdd,this),this._onAssetRemove&&this._registry.off("remove:"+this.url,this._onRemove,this))},e._onLoad=function(t){this._onAssetLoad.call(this._scope,this.propertyName,this.parent,t)},e._onAdd=function(t){this.asset=t,this._onAssetAdd.call(this._scope,this.propertyName,this.parent,t)},e._onRemove=function(t){this._onAssetRemove.call(this._scope,this.propertyName,this.parent,t),this.asset=null},e._onUnload=function(t){this._onAssetUnload.call(this._scope,this.propertyName,this.parent,t)},v(t,[{key:"id",get:function(){return this._id},set:function(t){if(this.url)throw Error("Can't set id and url");this._unbind(),this._id=t,this.asset=this._registry.get(this._id),this._bind()}},{key:"url",get:function(){return this._url},set:function(t){if(this.id)throw Error("Can't set id and url");this._unbind(),this._url=t,this.asset=this._registry.getByUrl(this._url),this._bind()}}])}(),Ly=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._type="asset",n._castShadows=!0,n._receiveShadows=!0,n._castShadowsLightmap=!0,n._lightmapped=!1,n._lightmapSizeMultiplier=1,n.isStatic=!1,n._batchGroupId=-1,n._layers=[0],n._renderStyle=0,n._meshInstances=[],n._customAabb=null,n._area=null,n._assetReference=void 0,n._materialReferences=[],n._material=void 0,n._rootBone=void 0,n._rootBone=new lv(n,"rootBone"),n._rootBone.on("set:entity",n._onSetRootBone,n),n._assetReference=new Dy("asset",n,e.app.assets,{add:n._onRenderAssetAdded,load:n._onRenderAssetLoad,remove:n._onRenderAssetRemove,unload:n._onRenderAssetUnload},n),n._material=e.defaultMaterial,i.on("remove",n.onRemoveChild,n),i.on("removehierarchy",n.onRemoveChild,n),i.on("insert",n.onInsertChild,n),i.on("inserthierarchy",n.onInsertChild,n),n}x(e,t);var i=e.prototype;return i.assignAsset=function(t){var e=t instanceof cm?t.id:t;this._assetReference.id=e},i._onSetRootBone=function(t){t&&this._onRootBoneChanged()},i._onRootBoneChanged=function(){this._clearSkinInstances(),this.enabled&&this.entity.enabled&&this._cloneSkinInstances()},i.destroyMeshInstances=function(){var t=this._meshInstances;if(t){this.removeFromLayers(),this._clearSkinInstances();for(var e=0;e=0&&(null==(i=t.batcher)||i.insert(lh.RENDER,this.batchGroupId,this.entity))},i.onDisable=function(){var t,e=this.system.app,i=e.scene;(i.off("set:layers",this.onLayersChanged,this),i.layers&&(i.layers.off("add",this.onLayerAdded,this),i.layers.off("remove",this.onLayerRemoved,this)),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.remove(lh.RENDER,this.batchGroupId,this.entity));this.removeFromLayers()},i.hide=function(){if(this._meshInstances)for(var t=0;t=0)null==(e=this.system.app.batcher)||e.remove(lh.RENDER,this.batchGroupId,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(lh.RENDER,t,this.entity);t<0&&this._batchGroupId>=0&&this.enabled&&this.entity.enabled&&this.addToLayers(),this._batchGroupId=t}}},{key:"material",get:function(){return this._material},set:function(t){if(this._material!==t&&(this._material=t,this._meshInstances&&"asset"!==this._type))for(var e=0;et.length){for(var e=t.length;ethis._pool.length)for(var e=this._pool.length;e=this._pool.length&&this._resize(2*this._pool.length),this._pool[this._count++]},e.freeAll=function(){this._count=0},t}(),Hy=new Vt,Wy=new Vt,Xy=new Ct,jy=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._angularDamping=0,n._angularFactor=new Ct(1,1,1),n._angularVelocity=new Ct,n._body=null,n._friction=.5,n._group=2,n._linearDamping=0,n._linearFactor=new Ct(1,1,1),n._linearVelocity=new Ct,n._mask=Uv,n._mass=1,n._restitution=0,n._rollingFriction=0,n._simulationEnabled=!1,n._type=Ov,n}x(e,t),e.onLibraryLoaded=function(){"undefined"!=typeof Ammo&&(Ny=new Ammo.btTransform,Uy=new Ammo.btVector3,zy=new Ammo.btVector3,Vy=new Ammo.btQuaternion)};var i=e.prototype;return i.createBody=function(){var t,e=this.entity;if(e.collision&&(t=e.collision.shape,e.trigger&&(e.trigger.destroy(),delete e.trigger)),t){this._body&&(this.system.removeBody(this._body),this.system.destroyBody(this._body),this._body=null);var i=this._type===Fv?this._mass:0;this._getEntityTransform(Ny);var n=this.system.createBody(i,t,Ny);if(n.setRestitution(this._restitution),n.setFriction(this._friction),n.setRollingFriction(this._rollingFriction),n.setDamping(this._linearDamping,this._angularDamping),this._type===Fv){var s=this._linearFactor;Uy.setValue(s.x,s.y,s.z),n.setLinearFactor(Uy);var r=this._angularFactor;Uy.setValue(r.x,r.y,r.z),n.setAngularFactor(Uy)}else this._type===Bv&&(n.setCollisionFlags(2|n.getCollisionFlags()),n.setActivationState(4));n.entity=e,this.body=n,this.enabled&&e.enabled&&this.enableSimulation()}},i.isActive=function(){return!!this._body&&this._body.isActive()},i.activate=function(){this._body&&this._body.activate()},i.enableSimulation=function(){var t=this.entity;if(t.collision&&t.collision.enabled&&!this._simulationEnabled){var e=this._body;if(e){switch(this.system.addBody(e,this._group,this._mask),this._type){case Fv:this.system._dynamic.push(this),e.forceActivationState(1),this.syncEntityToBody();break;case Bv:this.system._kinematic.push(this),e.forceActivationState(4);break;case Ov:e.forceActivationState(1),this.syncEntityToBody()}"compound"===t.collision.type&&this.system._compounds.push(t.collision),e.activate(),this._simulationEnabled=!0}}},i.disableSimulation=function(){var t=this._body;if(t&&this._simulationEnabled){var e=this.system,i=e._compounds.indexOf(this.entity.collision);i>-1&&e._compounds.splice(i,1),(i=e._dynamic.indexOf(this))>-1&&e._dynamic.splice(i,1),(i=e._kinematic.indexOf(this))>-1&&e._kinematic.splice(i,1),e.removeBody(t),t.forceActivationState(5),this._simulationEnabled=!1}},i.applyForce=function(t,e,i,n,s,r){var a=this._body;a&&(a.activate(),t instanceof Ct?Uy.setValue(t.x,t.y,t.z):Uy.setValue(t,e,i),e instanceof Ct?zy.setValue(e.x,e.y,e.z):void 0!==n?zy.setValue(n,s,r):zy.setValue(0,0,0),a.applyForce(Uy,zy))},i.applyTorque=function(t,e,i){var n=this._body;n&&(n.activate(),t instanceof Ct?Uy.setValue(t.x,t.y,t.z):Uy.setValue(t,e,i),n.applyTorque(Uy))},i.applyImpulse=function(t,e,i,n,s,r){var a=this._body;a&&(a.activate(),t instanceof Ct?Uy.setValue(t.x,t.y,t.z):Uy.setValue(t,e,i),e instanceof Ct?zy.setValue(e.x,e.y,e.z):void 0!==n?zy.setValue(n,s,r):zy.setValue(0,0,0),a.applyImpulse(Uy,zy))},i.applyTorqueImpulse=function(t,e,i){var n=this._body;n&&(n.activate(),t instanceof Ct?Uy.setValue(t.x,t.y,t.z):Uy.setValue(t,e,i),n.applyTorqueImpulse(Uy))},i.isStatic=function(){return this._type===Ov},i.isStaticOrKinematic=function(){return this._type===Ov||this._type===Bv},i.isKinematic=function(){return this._type===Bv},i._getEntityTransform=function(t){var e=this.entity,i=e.collision;if(i){var n=i.getShapePosition(),s=i.getShapeRotation();Uy.setValue(n.x,n.y,n.z),Vy.setValue(s.x,s.y,s.z,s.w)}else{var r=e.getPosition(),a=e.getRotation();Uy.setValue(r.x,r.y,r.z),Vy.setValue(a.x,a.y,a.z,a.w)}t.setOrigin(Uy),t.setRotation(Vy)},i.syncEntityToBody=function(){var t=this._body;if(t){if(this._getEntityTransform(Ny),t.setWorldTransform(Ny),this._type===Bv){var e=t.getMotionState();e&&e.setWorldTransform(Ny)}t.activate()}},i._updateDynamic=function(){var t=this._body;if(t.isActive()){var e=t.getMotionState();if(e){var i=this.entity;e.getWorldTransform(Ny);var n=Ny.getOrigin(),s=Ny.getRotation(),r=i.collision;if(r&&r._hasOffset){var a=r.data.linearOffset,o=r.data.angularOffset,h=Wy.copy(o).invert(),l=Hy.set(s.x(),s.y(),s.z(),s.w()).mul(h);l.transformVector(a,Xy),i.setPosition(n.x()-Xy.x,n.y()-Xy.y,n.z()-Xy.z),i.setRotation(l)}else i.setPosition(n.x(),n.y(),n.z()),i.setRotation(s.x(),s.y(),s.z(),s.w())}}},i._updateKinematic=function(){var t=this._body.getMotionState();t&&(this._getEntityTransform(Ny),t.setWorldTransform(Ny))},i.teleport=function(t,e,i,n,s,r){t instanceof Ct?this.entity.setPosition(t):this.entity.setPosition(t,e,i),e instanceof Vt?this.entity.setRotation(e):e instanceof Ct?this.entity.setEulerAngles(e):void 0!==n&&this.entity.setEulerAngles(n,s,r),this.syncEntityToBody()},i.onEnable=function(){this._body||this.createBody(),this.enableSimulation()},i.onDisable=function(){this.disableSimulation()},v(e,[{key:"angularDamping",get:function(){return this._angularDamping},set:function(t){this._angularDamping!==t&&(this._angularDamping=t,this._body&&this._body.setDamping(this._linearDamping,t))}},{key:"angularFactor",get:function(){return this._angularFactor},set:function(t){this._angularFactor.equals(t)||(this._angularFactor.copy(t),this._body&&this._type===Fv&&(Uy.setValue(t.x,t.y,t.z),this._body.setAngularFactor(Uy)))}},{key:"angularVelocity",get:function(){if(this._body&&this._type===Fv){var t=this._body.getAngularVelocity();this._angularVelocity.set(t.x(),t.y(),t.z())}return this._angularVelocity},set:function(t){this._body&&this._type===Fv&&(this._body.activate(),Uy.setValue(t.x,t.y,t.z),this._body.setAngularVelocity(Uy),this._angularVelocity.copy(t))}},{key:"body",get:function(){return this._body},set:function(t){this._body!==t&&(this._body=t,t&&this._simulationEnabled&&t.activate())}},{key:"friction",get:function(){return this._friction},set:function(t){this._friction!==t&&(this._friction=t,this._body&&this._body.setFriction(t))}},{key:"group",get:function(){return this._group},set:function(t){this._group!==t&&(this._group=t,this.enabled&&this.entity.enabled&&(this.disableSimulation(),this.enableSimulation()))}},{key:"linearDamping",get:function(){return this._linearDamping},set:function(t){this._linearDamping!==t&&(this._linearDamping=t,this._body&&this._body.setDamping(t,this._angularDamping))}},{key:"linearFactor",get:function(){return this._linearFactor},set:function(t){this._linearFactor.equals(t)||(this._linearFactor.copy(t),this._body&&this._type===Fv&&(Uy.setValue(t.x,t.y,t.z),this._body.setLinearFactor(Uy)))}},{key:"linearVelocity",get:function(){if(this._body&&this._type===Fv){var t=this._body.getLinearVelocity();this._linearVelocity.set(t.x(),t.y(),t.z())}return this._linearVelocity},set:function(t){this._body&&this._type===Fv&&(this._body.activate(),Uy.setValue(t.x,t.y,t.z),this._body.setLinearVelocity(Uy),this._linearVelocity.copy(t))}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.enabled&&this.entity.enabled&&(this.disableSimulation(),this.enableSimulation()))}},{key:"mass",get:function(){return this._mass},set:function(t){if(this._mass!==t&&(this._mass=t,this._body&&this._type===Fv)){var e=this.enabled&&this.entity.enabled;e&&this.disableSimulation(),this._body.getCollisionShape().calculateLocalInertia(t,Uy),this._body.setMassProps(t,Uy),this._body.updateInertiaTensor(),e&&this.enableSimulation()}}},{key:"restitution",get:function(){return this._restitution},set:function(t){this._restitution!==t&&(this._restitution=t,this._body&&this._body.setRestitution(t))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){this._rollingFriction!==t&&(this._rollingFriction=t,this._body&&this._body.setRollingFriction(t))}},{key:"type",get:function(){return this._type},set:function(t){if(this._type!==t){switch(this._type=t,this.disableSimulation(),t){case Fv:this._group=1,this._mask=Nv;break;case Bv:this._group=4,this._mask=Nv;break;default:this._group=2,this._mask=Uv}this.createBody()}}}])}(Xm);jy.EVENT_CONTACT="contact",jy.EVENT_COLLISIONSTART="collisionstart",jy.EVENT_COLLISIONEND="collisionend",jy.EVENT_TRIGGERENTER="triggerenter",jy.EVENT_TRIGGERLEAVE="triggerleave";var qy,Yy,Ky=function(){this.enabled=!0},Zy=function(t,e,i,n){this.entity=void 0,this.point=void 0,this.normal=void 0,this.hitFraction=void 0,this.entity=t,this.point=e,this.normal=i,this.hitFraction=n},Qy=function(t,e,i){this.a=void 0,this.b=void 0,this.impulse=void 0,this.localPointA=void 0,this.localPointB=void 0,this.pointA=void 0,this.pointB=void 0,this.normal=void 0,0!==arguments.length?(this.a=t,this.b=e,this.impulse=i.impulse,this.localPointA=i.localPoint,this.localPointB=i.localPointOther,this.pointA=i.point,this.pointB=i.pointOther,this.normal=i.normal):(this.a=null,this.b=null,this.impulse=0,this.localPointA=new Ct,this.localPointB=new Ct,this.pointA=new Ct,this.pointB=new Ct,this.normal=new Ct)},Jy=function(t,e,i,n,s,r){void 0===t&&(t=new Ct),void 0===e&&(e=new Ct),void 0===i&&(i=new Ct),void 0===n&&(n=new Ct),void 0===s&&(s=new Ct),void 0===r&&(r=0),this.localPoint=void 0,this.localPointOther=void 0,this.point=void 0,this.pointOther=void 0,this.normal=void 0,this.impulse=void 0,this.localPoint=t,this.localPointOther=e,this.point=i,this.pointOther=n,this.normal=s,this.impulse=r},$y=function(t,e){this.other=void 0,this.contacts=void 0,this.other=t,this.contacts=e},tx=["enabled"],ex=function(t){function e(e){var i;return(i=t.call(this,e)||this).maxSubSteps=10,i.fixedTimeStep=1/60,i.gravity=new Ct(0,-9.81,0),i._gravityFloat32=new Float32Array(3),i._dynamic=[],i._kinematic=[],i._triggers=[],i._compounds=[],i.id="rigidbody",i._stats=e.stats.frame,i.ComponentType=jy,i.DataType=Ky,i.contactPointPool=null,i.contactResultPool=null,i.singleContactResultPool=null,i.schema=tx,i.collisions={},i.frameCollisions={},i.on("beforeremove",i.onBeforeRemove,i),i}x(e,t);var i=e.prototype;return i.onLibraryLoaded=function(){if("undefined"!=typeof Ammo){if(this.collisionConfiguration=new Ammo.btDefaultCollisionConfiguration,this.dispatcher=new Ammo.btCollisionDispatcher(this.collisionConfiguration),this.overlappingPairCache=new Ammo.btDbvtBroadphase,this.solver=new Ammo.btSequentialImpulseConstraintSolver,this.dynamicsWorld=new Ammo.btDiscreteDynamicsWorld(this.dispatcher,this.overlappingPairCache,this.solver,this.collisionConfiguration),this.dynamicsWorld.setInternalTickCallback){var t=Ammo.addFunction(this._checkForCollisions.bind(this),"vif");this.dynamicsWorld.setInternalTickCallback(t)}qy=new Ammo.btVector3,Yy=new Ammo.btVector3,jy.onLibraryLoaded(),this.contactPointPool=new Gy(Jy,1),this.contactResultPool=new Gy($y,1),this.singleContactResultPool=new Gy(Qy,1),this.app.systems.on("update",this.onUpdate,this)}else this.app.systems.off("update",this.onUpdate,this)},i.initializeComponentData=function(e,i,n){for(var s=0,r=["mass","linearDamping","angularDamping","linearFactor","angularFactor","friction","rollingFriction","restitution","type","group","mask"];s0)if(4&d||4&f){var g=c.collision&&(c.collision.hasEvent("triggerenter")||c.collision.hasEvent("triggerleave")),y=u.collision&&(u.collision.hasEvent("triggerenter")||u.collision.hasEvent("triggerleave")),x=c.rigidbody&&(c.rigidbody.hasEvent("triggerenter")||c.rigidbody.hasEvent("triggerleave")),S=u.rigidbody&&(u.rigidbody.hasEvent("triggerenter")||u.rigidbody.hasEvent("triggerleave"));g&&(!(v=this._storeCollision(c,u))||4&f||c.collision.fire("triggerenter",u)),y&&(!(v=this._storeCollision(u,c))||4&d||u.collision.fire("triggerenter",c)),x&&(v||(v=this._storeCollision(u,c)),v&&c.rigidbody.fire("triggerenter",u)),S&&(v||(v=this._storeCollision(c,u)),v&&u.rigidbody.fire("triggerenter",c))}else{var b=this._hasContactEvent(c),T=this._hasContactEvent(u),w=this.hasEvent("contact");if(w||b||T){for(var E=0;E=0&&n!==t.element.drawOrder)null==(i=this.system.app.batcher)||i.markGroupDirty(t.element._batchGroupId)}t.particlesystem&&(t.particlesystem.drawOrder=e++);for(var s=t.children,r=0;r255&&(t=255),this._priority!==t&&(this._priority=t,this.syncDrawOrder())}}])}(Xm),ax=function(){this.enabled=!0},ox=["enabled"],hx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="screen",i.ComponentType=rx,i.DataType=ax,i.schema=ox,i.windowResolution=new It,i._drawOrderSyncQueue=new at,i.app.graphicsDevice.on("resizecanvas",i._onResize,i),i.app.systems.on("update",i._onUpdate,i),i.on("beforeremove",i.onRemoveComponent,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){void 0!==i.priority&&(e.priority=i.priority),void 0!==i.screenSpace&&(e.screenSpace=i.screenSpace),e.cull=e.screenSpace,void 0!==i.scaleMode&&(e.scaleMode=i.scaleMode),void 0!==i.scaleBlend&&(e.scaleBlend=i.scaleBlend),void 0!==i.resolution&&(i.resolution instanceof It?e._resolution.copy(i.resolution):e._resolution.set(i.resolution[0],i.resolution[1]),e.resolution=e._resolution),void 0!==i.referenceResolution&&(i.referenceResolution instanceof It?e._referenceResolution.copy(i.referenceResolution):e._referenceResolution.set(i.referenceResolution[0],i.referenceResolution[1]),e.referenceResolution=e._referenceResolution),e.syncDrawOrder(),t.prototype.initializeComponentData.call(this,e,i,n)},i.destroy=function(){t.prototype.destroy.call(this),this.app.graphicsDevice.off("resizecanvas",this._onResize,this),this.app.systems.off("update",this._onUpdate,this)},i._onUpdate=function(t){var e=this.store;for(var i in e)e[i].entity.screen.update&&e[i].entity.screen.update(t)},i._onResize=function(t,e){this.windowResolution.x=t,this.windowResolution.y=e},i.cloneComponent=function(t,e){var i=t.screen;return this.addComponent(e,{enabled:i.enabled,screenSpace:i.screenSpace,scaleMode:i.scaleMode,resolution:i.resolution.clone(),referenceResolution:i.referenceResolution.clone()})},i.onRemoveComponent=function(t,e){e.onRemove()},i.processDrawOrderSyncQueue=function(){for(var t=this._drawOrderSyncQueue.list(),e=0;e=0&&this.instancesWithUpdate.splice(s,1)}if(n.fixedUpdate){var r=this.instancesWithFixedUpdate.indexOf(n);r>=0&&this.instancesWithFixedUpdate.splice(r,1)}if(n.postUpdate){var a=this.instancesWithPostUpdate.indexOf(n);a>=0&&this.instancesWithPostUpdate.splice(a,1)}if(n.toolsUpdate){var o=this.instancesWithToolsUpdate.indexOf(n);o>=0&&this.instancesWithToolsUpdate.splice(o,1)}t.instances[i].instance===t[i]&&delete t[i],delete t.instances[i]}},i._postInitializeScriptComponent=function(t){this._callInstancesMethod(t,fx),t.data.postInitialized=!0},i._updateInstances=function(t,e,i){for(var n=0,s=e.length;nthis.dragThreshold||Math.abs(i)>this.dragThreshold)&&this._disableContentInput()}},i._onSetContentOrViewportSize=function(){this._syncAll()},i._onSetHorizontalScrollbarValue=function(t){!this._scrollbarUpdateFlags[0]&&this.enabled&&this.entity.enabled&&this._onSetScroll(t,null)},i._onSetVerticalScrollbarValue=function(t){!this._scrollbarUpdateFlags[1]&&this.enabled&&this.entity.enabled&&this._onSetScroll(null,t)},i._onSetHorizontalScrollingEnabled=function(){this._syncScrollbarEnabledState(0)},i._onSetVerticalScrollingEnabled=function(){this._syncScrollbarEnabledState(1)},i._onHorizontalScrollbarGain=function(){this._syncScrollbarEnabledState(0),this._syncScrollbarPosition(0)},i._onVerticalScrollbarGain=function(){this._syncScrollbarEnabledState(1),this._syncScrollbarPosition(1)},i._onSetScroll=function(t,e,i){!1!==i&&this._velocity.set(0,0,0);var n=this._updateAxis(t,"x",0),s=this._updateAxis(e,"y",1);(n||s)&&this.fire("set:scroll",this._scroll)},i._updateAxis=function(t,e,i){var n=null!==t&&Math.abs(t-this._scroll[e])>1e-5;return(n||this._isDragging()||0===t)&&(this._scroll[e]=this._determineNewScrollValue(t,e,i),this._syncContentPosition(i),this._syncScrollbarPosition(i)),n},i._determineNewScrollValue=function(t,e,i){if(!this._getScrollingEnabled(i))return this._scroll[e];switch(this.scrollMode){case 0:return _t.clamp(t,0,this._getMaxScrollValue(i));case 1:return this._setVelocityFromOvershoot(t,e,i),t;case 2:return t;default:return console.warn("Unhandled scroll mode:"+this.scrollMode),t}},i._syncAll=function(){this._syncContentPosition(0),this._syncContentPosition(1),this._syncScrollbarPosition(0),this._syncScrollbarPosition(1),this._syncScrollbarEnabledState(0),this._syncScrollbarEnabledState(1)},i._syncContentPosition=function(t){var e=this._getAxis(t),i=this._getSign(t),n=this._contentReference.entity;if(n){var s=this._prevContentSizes[t],r=this._getContentSize(t);if(null!==s&&Math.abs(s-r)>1e-4){var a=this._getMaxOffset(t,s),o=this._getMaxOffset(t,r);this._scroll[e]=0===o?1:_t.clamp(this._scroll[e]*a/o,0,1)}var h=this._scroll[e]*this._getMaxOffset(t),l=n.getLocalPosition();l[e]=h*i,n.setLocalPosition(l),this._prevContentSizes[t]=r}},i._syncScrollbarPosition=function(t){var e=this._getAxis(t),i=this._scrollbarReferences[t].entity;i&&i.scrollbar&&(this._scrollbarUpdateFlags[t]=!0,i.scrollbar.value=this._scroll[e],i.scrollbar.handleSize=this._getScrollbarHandleSize(e,t),this._scrollbarUpdateFlags[t]=!1)},i._syncScrollbarEnabledState=function(t){var e=this._scrollbarReferences[t].entity;if(e){var i=this._getScrollingEnabled(t),n=this._getScrollbarVisibility(t);switch(n){case 0:return void(e.enabled=i);case 1:return void(e.enabled=i&&this._contentIsLargerThanViewport(t));default:console.warn("Unhandled scrollbar visibility:"+n),e.enabled=i}}},i._contentIsLargerThanViewport=function(t){return this._getContentSize(t)>this._getViewportSize(t)},i._contentPositionToScrollValue=function(t){var e=this._getMaxOffset(0),i=this._getMaxOffset(1);return Mx.x=0===e?0:t.x/e,Mx.y=0===i?0:t.y/-i,Mx},i._getMaxOffset=function(t,e){e=void 0===e?this._getContentSize(t):e;var i=this._getViewportSize(t);return e1e-4||Math.abs(this._velocity.y)>1e-4){var t=this._contentReference.entity.getLocalPosition();t.x+=this._velocity.x,t.y+=this._velocity.y,this._contentReference.entity.setLocalPosition(t),this._setScrollFromContentPosition(t)}this._velocity.x*=1-this.friction,this._velocity.y*=1-this.friction}},i._hasOvershoot=function(t,e){return Math.abs(this._toOvershoot(this.scroll[t],e))>.001},i._toOvershoot=function(t,e){var i=this._getMaxScrollValue(e);return t<0?t:t>i?t-i:0},i._setVelocityFromOvershoot=function(t,e,i){var n=this._toOvershoot(t,i)*this._getMaxOffset(i)*this._getSign(i);Math.abs(n)>0&&(this._velocity[e]=-n/(50*this.bounceAmount+1))},i._setVelocityFromContentPositionDelta=function(t){this._prevContentDragPosition?(this._velocity.sub2(t,this._prevContentDragPosition),this._prevContentDragPosition.copy(t)):(this._velocity.set(0,0,0),this._prevContentDragPosition=t.clone())},i._setScrollFromContentPosition=function(t){var e=this._contentPositionToScrollValue(t);this._isDragging()&&(e=this._applyScrollValueTension(e)),this._onSetScroll(e.x,e.y,!1)},i._applyScrollValueTension=function(t){var e=this._getMaxScrollValue(0),i=this._toOvershoot(t.x,0);return i>0?t.x=e+1*Math.log10(1+i):i<0&&(t.x=-1*Math.log10(1-i)),e=this._getMaxScrollValue(1),(i=this._toOvershoot(t.y,1))>0?t.y=e+1*Math.log10(1+i):i<0&&(t.y=-1*Math.log10(1-i)),t},i._isDragging=function(){return this._contentDragHelper&&this._contentDragHelper.isDragging},i._setScrollbarComponentsEnabled=function(t){this._scrollbarReferences[0].hasComponent("scrollbar")&&(this._scrollbarReferences[0].entity.scrollbar.enabled=t),this._scrollbarReferences[1].hasComponent("scrollbar")&&(this._scrollbarReferences[1].entity.scrollbar.enabled=t)},i._setContentDraggingEnabled=function(t){this._contentDragHelper&&(this._contentDragHelper.enabled=t)},i._onMouseWheel=function(t){if(this.useMouseWheel){var e=t.event,i=e.deltaX/this._contentReference.entity.element.calculatedWidth*this.mouseWheelSensitivity.x,n=e.deltaY/this._contentReference.entity.element.calculatedHeight*this.mouseWheelSensitivity.y,s=_t.clamp(this._scroll.x+i,0,this._getMaxScrollValue(0)),r=_t.clamp(this._scroll.y+n,0,this._getMaxScrollValue(1));this.scroll=new It(s,r)}},i._enableContentInput=function(){for(;this._disabledContentInputEntities.length;){var t=this._disabledContentInputEntities.pop();t.element&&(t.element.useInput=!0)}this._disabledContentInput=!1},i._disableContentInput=function(){var t=this,e=function(i){i.element&&i.element.useInput&&(t._disabledContentInputEntities.push(i),i.element.useInput=!1);for(var n=i.children,s=0,r=n.length;s1e-5&&(this.data.value=_t.clamp(i,0,1),this._updateHandlePositionAndSize(),this.fire("set:value",this.data.value))},i._onSetHandleSize=function(t,e,i){Math.abs(i-e)>1e-5&&(this.data.handleSize=_t.clamp(i,0,1),this._updateHandlePositionAndSize())},i._onSetHandleAlignment=function(){this._updateHandlePositionAndSize()},i._onSetOrientation=function(t,e,i){i!==e&&this._handleReference.hasComponent("element")&&(this._handleReference.entity.element[this._getOppositeDimension()]=0)},i._updateHandlePositionAndSize=function(){var t=this._handleReference.entity,e=t&&t.element;if(t){var i=t.getLocalPosition();i[this._getAxis()]=this._getHandlePosition(),this._handleReference.entity.setLocalPosition(i)}e&&(e[this._getDimension()]=this._getHandleLength())},i._handlePositionToScrollValue=function(t){return t*this._getSign()/this._getUsableTrackLength()},i._scrollValueToHandlePosition=function(t){return t*this._getSign()*this._getUsableTrackLength()},i._getUsableTrackLength=function(){return Math.max(this._getTrackLength()-this._getHandleLength(),.001)},i._getTrackLength=function(){return this.entity.element?0===this.orientation?this.entity.element.calculatedWidth:this.entity.element.calculatedHeight:0},i._getHandleLength=function(){return this._getTrackLength()*this.handleSize},i._getHandlePosition=function(){return this._scrollValueToHandlePosition(this.value)},i._getSign=function(){return 0===this.orientation?1:-1},i._getAxis=function(){return 0===this.orientation?"x":"y"},i._getDimension=function(){return 0===this.orientation?"width":"height"},i._getOppositeDimension=function(){return 0===this.orientation?"height":"width"},i._destroyDragHelper=function(){this._handleDragHelper&&this._handleDragHelper.destroy()},i._setHandleDraggingEnabled=function(t){this._handleDragHelper&&(this._handleDragHelper.enabled=t)},i.onEnable=function(){this._handleReference.onParentComponentEnable(),this._setHandleDraggingEnabled(!0)},i.onDisable=function(){this._setHandleDraggingEnabled(!1)},i.onRemove=function(){this._destroyDragHelper(),this._toggleLifecycleListeners("off")},v(e,[{key:"data",get:function(){var t=this.system.store[this.entity.getGuid()];return t?t.data:null}},{key:"enabled",get:function(){return this.data.enabled},set:function(t){this._setValue("enabled",t)}},{key:"orientation",get:function(){return this.data.orientation},set:function(t){this._setValue("orientation",t)}},{key:"value",get:function(){return this.data.value},set:function(t){this._setValue("value",t)}},{key:"handleSize",get:function(){return this.data.handleSize},set:function(t){this._setValue("handleSize",t)}},{key:"handleEntity",get:function(){return this.data.handleEntity},set:function(t){this._setValue("handleEntity",t)}}])}(Xm);Lx.EVENT_SETVALUE="set:value";var kx=function(){this.enabled=!0,this.orientation=0,this.value=0,this.handleSize=void 0,this.handleEntity=void 0},Ox=[{name:"enabled",type:"boolean"},{name:"orientation",type:"number"},{name:"value",type:"number"},{name:"handleSize",type:"number"},{name:"handleEntity",type:"entity"}],Fx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="scrollbar",i.ComponentType=Lx,i.DataType=kx,i.schema=Ox,i.on("beforeremove",i._onRemoveComponent,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){t.prototype.initializeComponentData.call(this,e,i,Ox)},i._onRemoveComponent=function(t,e){e.onRemove()},e}(jm),Bx={volume:0,pitch:0,loop:!1,startTime:0,duration:0,position:new Ct,maxDistance:0,refDistance:0,rollOffFactor:0,distanceModel:0,onPlay:null,onPause:null,onResume:null,onStop:null,onEnd:null},Nx=function(t){function e(e,i,n){var s;return void 0===i&&(i="Untitled"),void 0===n&&(n={}),(s=t.call(this)||this).name=void 0,s.instances=[],s._component=e,s._assets=e.system.app.assets,s._manager=e.system.manager,s.name=i,s._volume=void 0!==n.volume?_t.clamp(Number(n.volume)||0,0,1):1,s._pitch=void 0!==n.pitch?Math.max(.01,Number(n.pitch)||0):1,s._loop=!(void 0===n.loop||!n.loop),s._duration=n.duration>0?n.duration:null,s._startTime=Math.max(0,Number(n.startTime)||0),s._overlap=!!n.overlap,s._autoPlay=!!n.autoPlay,s._firstNode=null,s._lastNode=null,s._asset=n.asset,s._asset instanceof cm&&(s._asset=s._asset.id),s._onInstancePlayHandler=s._onInstancePlay.bind(s),s._onInstancePauseHandler=s._onInstancePause.bind(s),s._onInstanceResumeHandler=s._onInstanceResume.bind(s),s._onInstanceStopHandler=s._onInstanceStop.bind(s),s._onInstanceEndHandler=s._onInstanceEnd.bind(s),s}x(e,t);var i=e.prototype;return i.play=function(){if(this.overlap||this.stop(),this.isLoaded||this._hasAsset()){var t=this._createInstance();if(this.instances.push(t),this.isLoaded)t.play();else{var e=function(e){var i=t._playWhenLoaded;t.sound=e,i&&t.play()};this.off("load",e),this.once("load",e),this.load()}return t}},i.pause=function(){for(var t=!1,e=this.instances,i=0,n=e.length;i=0;r--){var a=s[r].isPlaying||s[r].isSuspended,o=s[r].currentTime;a&&s[r].stop();var h=n._createInstance();a&&(h.play(),h.currentTime=o),s.push(h)}}}},{key:"slots",get:function(){return this._slots},set:function(t){var e=this._slots;if(e)for(var i in e)e[i].stop();var n={};for(var s in t)t[s]instanceof Nx?n[t[s].name]=t[s]:t[s].name&&(n[t[s].name]=new Nx(this,t[s].name,t[s]));this._slots=n,this.enabled&&this.entity.enabled&&this.onEnable()}}])}(Xm);Ux.EVENT_PLAY="play",Ux.EVENT_PAUSE="pause",Ux.EVENT_RESUME="resume",Ux.EVENT_STOP="stop",Ux.EVENT_END="end";var zx=function(){this.enabled=!0},Vx=["enabled"],Gx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="sound",i.ComponentType=Ux,i.DataType=zx,i.schema=Vx,i.manager=e.soundManager,i.app.systems.on("update",i.onUpdate,i),i.on("beforeremove",i.onBeforeRemove,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){n=["volume","pitch","positional","refDistance","maxDistance","rollOffFactor","distanceModel","slots"];for(var s=0;sn||i<0;this._setTime(i);var r=this.frame;(r=this._sprite?Math.floor(this._sprite.frameKeys.length*this._time/n):0)!==this._frame&&this._setFrame(r),s&&(this.loop?(this.fire("loop"),this._component.fire("loop",this)):(this._playing=!1,this._paused=!1,this.fire("end"),this._component.fire("end",this)))}},i._setTime=function(t){this._time=t;var e=this.duration;this._time<0?this.loop?this._time=this._time%e+e:this._time=0:this._time>e&&(this.loop?this._time%=e:this._time=e)},i._setFrame=function(t){this._sprite?this._frame=_t.clamp(t,0,this._sprite.frameKeys.length-1):this._frame=t,this._component.currentClip===this&&this._component._showFrame(this._frame)},i._destroy=function(){if(this._spriteAsset){var t=this._component.system.app.assets;this._unbindSpriteAsset(t.get(this._spriteAsset))}this._sprite&&(this.sprite=null),this._spriteAsset&&(this.spriteAsset=null)},i.play=function(){this._playing||(this._playing=!0,this._paused=!1,this.frame=0,this.fire("play"),this._component.fire("play",this))},i.pause=function(){this._playing&&!this._paused&&(this._paused=!0,this.fire("pause"),this._component.fire("pause",this))},i.resume=function(){this._paused&&(this._paused=!1,this.fire("resume"),this._component.fire("resume",this))},i.stop=function(){this._playing&&(this._playing=!1,this._paused=!1,this._time=0,this.frame=0,this.fire("stop"),this._component.fire("stop",this))},v(e,[{key:"duration",get:function(){if(this._sprite){var t=this.fps||Number.MIN_VALUE;return this._sprite.frameKeys.length/Math.abs(t)}return 0}},{key:"frame",get:function(){return this._frame},set:function(t){this._setFrame(t);var e=this.fps||Number.MIN_VALUE;this._setTime(this._frame/e)}},{key:"isPaused",get:function(){return this._paused}},{key:"isPlaying",get:function(){return this._playing}},{key:"sprite",get:function(){return this._sprite},set:function(t){var e;(this._sprite&&(this._sprite.off("set:meshes",this._onSpriteMeshesChange,this),this._sprite.off("set:pixelsPerUnit",this._onSpritePpuChanged,this),this._sprite.off("set:atlas",this._onSpriteMeshesChange,this),this._sprite.atlas&&this._sprite.atlas.off("set:texture",this._onSpriteMeshesChange,this)),this._sprite=t,this._sprite&&(this._sprite.on("set:meshes",this._onSpriteMeshesChange,this),this._sprite.on("set:pixelsPerUnit",this._onSpritePpuChanged,this),this._sprite.on("set:atlas",this._onSpriteMeshesChange,this),this._sprite.atlas&&this._sprite.atlas.on("set:texture",this._onSpriteMeshesChange,this)),this._component.currentClip===this)&&(t&&t.atlas?(t.atlas.texture&&((e=this._component._meshInstance)&&(e.setParameter("texture_emissiveMap",t.atlas.texture),e.setParameter("texture_opacityMap",t.atlas.texture)),this._component.enabled&&this._component.entity.enabled&&this._component._showModel()),this.time&&this.fps?this.time=this.time:this.frame=this.frame):((e=this._component._meshInstance)&&(e.deleteParameter("texture_emissiveMap"),e.deleteParameter("texture_opacityMap")),this._component._hideModel()))}},{key:"spriteAsset",get:function(){return this._spriteAsset},set:function(t){var e=this._component.system.app.assets,i=t;if(t instanceof cm&&(i=t.id),this._spriteAsset!==i){if(this._spriteAsset){var n=e.get(this._spriteAsset);n&&this._unbindSpriteAsset(n)}if(this._spriteAsset=i,this._spriteAsset){var s=e.get(this._spriteAsset);s?this._bindSpriteAsset(s):(this.sprite=null,e.on("add:"+this._spriteAsset,this._onSpriteAssetAdded,this))}else this.sprite=null}}},{key:"time",get:function(){return this._time},set:function(t){this._setTime(t),this._sprite?this.frame=Math.min(this._sprite.frameKeys.length-1,Math.floor(this._time*Math.abs(this.fps))):this.frame=0}}])}(P);Xx.EVENT_PLAY="play",Xx.EVENT_PAUSE="pause",Xx.EVENT_RESUME="resume",Xx.EVENT_STOP="stop",Xx.EVENT_END="end",Xx.EVENT_LOOP="loop";var jx="texture_emissiveMap",qx="texture_opacityMap",Yx="material_emissive",Kx="material_opacity",Zx=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._type=Hx,n._material=e.defaultMaterial,n._color=new vt(1,1,1,1),n._colorUniform=new Float32Array(3),n._speed=1,n._flipX=!1,n._flipY=!1,n._width=1,n._height=1,n._drawOrder=0,n._layers=[0],n._outerScale=new It(1,1),n._outerScaleUniform=new Float32Array(2),n._innerOffset=new Lt,n._innerOffsetUniform=new Float32Array(4),n._atlasRect=new Lt,n._atlasRectUniform=new Float32Array(4),n._batchGroupId=-1,n._batchGroup=null,n._node=new Oh,n._model=new Ad,n._model.graph=n._node,n._meshInstance=null,i.addChild(n._model.graph),n._model._entity=i,n._updateAabbFunc=n._updateAabb.bind(n),n._addedModel=!1,n._autoPlayClip=null,n._clips={},n._defaultClip=new Xx(n,{name:n.entity.name,fps:0,loop:!1,spriteAsset:null}),n._currentClip=n._defaultClip,n}x(e,t);var i=e.prototype;return i.onEnable=function(){var t,e=this.system.app,i=e.scene;(i.on("set:layers",this._onLayersChanged,this),i.layers&&(i.layers.on("add",this._onLayerAdded,this),i.layers.on("remove",this._onLayerRemoved,this)),this._showModel(),this._autoPlayClip&&this._tryAutoPlay(),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.insert(lh.SPRITE,this._batchGroupId,this.entity))},i.onDisable=function(){var t,e=this.system.app,i=e.scene;(i.off("set:layers",this._onLayersChanged,this),i.layers&&(i.layers.off("add",this._onLayerAdded,this),i.layers.off("remove",this._onLayerRemoved,this)),this.stop(),this._hideModel(),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.remove(lh.SPRITE,this._batchGroupId,this.entity))},i.onDestroy=function(){var t;for(var e in this._currentClip=null,this._defaultClip&&(this._defaultClip._destroy(),this._defaultClip=null),this._clips)this._clips[e]._destroy();this._clips=null,this._hideModel(),this._model=null,null==(t=this._node)||t.remove(),this._node=null,this._meshInstance&&(this._meshInstance.material=null,this._meshInstance.mesh=null,this._meshInstance=null)},i._showModel=function(){if(!this._addedModel&&this._meshInstance){for(var t=[this._meshInstance],e=0,i=this._layers.length;e=0)null==(e=this.system.app.batcher)||e.remove(lh.SPRITE,n,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(lh.SPRITE,t,this.entity);else n>=0&&this._currentClip&&this._currentClip.sprite&&this.enabled&&this.entity.enabled&&this._showModel()}}},{key:"autoPlayClip",get:function(){return this._autoPlayClip},set:function(t){this._autoPlayClip=t instanceof Xx?t.name:t,this._tryAutoPlay()}},{key:"drawOrder",get:function(){return this._drawOrder},set:function(t){this._drawOrder=t,this._meshInstance&&(this._meshInstance.drawOrder=t)}},{key:"layers",get:function(){return this._layers},set:function(t){this._addedModel&&this._hideModel(),this._layers=t,this._meshInstance&&this.enabled&&this.entity.enabled&&this._showModel()}},{key:"aabb",get:function(){return this._meshInstance?this._meshInstance.aabb:null}}])}(Xm);Zx.EVENT_PLAY="play",Zx.EVENT_PAUSE="pause",Zx.EVENT_RESUME="resume",Zx.EVENT_STOP="stop",Zx.EVENT_END="end",Zx.EVENT_LOOP="loop";var Qx=function(){this.enabled=!0},Jx=["enabled"],$x=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="sprite",i.ComponentType=Zx,i.DataType=Qx,i.schema=Jx,i._defaultTexture=null,i._defaultMaterial=null,i._default9SlicedMaterialSlicedMode=null,i._default9SlicedMaterialTiledMode=null,i.app.systems.on("update",i.onUpdate,i),i.on("beforeremove",i.onBeforeRemove,i),i}x(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this),this._defaultTexture&&(this._defaultTexture.destroy(),this._defaultTexture=null)},i.initializeComponentData=function(e,i,n){if(void 0!==i.enabled&&(e.enabled=i.enabled),e.type=i.type,i.layers&&Array.isArray(i.layers)&&(e.layers=i.layers.slice(0)),void 0!==i.drawOrder&&(e.drawOrder=i.drawOrder),void 0!==i.color){var s,r;if(i.color instanceof vt)e.color.set(i.color.r,i.color.g,i.color.b,null!=(s=i.opacity)?s:1);else e.color.set(i.color[0],i.color[1],i.color[2],null!=(r=i.opacity)?r:1);e.color=e.color}if(void 0!==i.opacity&&(e.opacity=i.opacity),void 0!==i.flipX&&(e.flipX=i.flipX),void 0!==i.flipY&&(e.flipY=i.flipY),void 0!==i.width&&(e.width=i.width),void 0!==i.height&&(e.height=i.height),void 0!==i.spriteAsset&&(e.spriteAsset=i.spriteAsset),i.sprite&&(e.sprite=i.sprite),void 0!==i.frame&&(e.frame=i.frame),i.clips)for(var a in i.clips)e.addClip(i.clips[a]);void 0!==i.speed&&(e.speed=i.speed),i.autoPlayClip&&(e.autoPlayClip=i.autoPlayClip),e.batchGroupId=void 0===i.batchGroupId||null===i.batchGroupId?-1:i.batchGroupId,t.prototype.initializeComponentData.call(this,e,i,n)},i.cloneComponent=function(t,e){var i=t.sprite;return this.addComponent(e,{enabled:i.enabled,type:i.type,spriteAsset:i.spriteAsset,sprite:i.sprite,width:i.width,height:i.height,frame:i.frame,color:i.color.clone(),opacity:i.opacity,flipX:i.flipX,flipY:i.flipY,speed:i.speed,clips:i.clips,autoPlayClip:i.autoPlayClip,batchGroupId:i.batchGroupId,drawOrder:i.drawOrder,layers:i.layers.slice(0)})},i.onUpdate=function(t){var e=this.store;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(n.data.enabled&&n.entity.enabled){var s=n.entity.sprite;s._currentClip&&s._currentClip._update(t)}}},i.onBeforeRemove=function(t,e){e.onDestroy()},v(e,[{key:"defaultMaterial",get:function(){if(!this._defaultMaterial){var t=new dr(this.app.graphicsDevice,{width:1,height:1,format:7,name:"sprite"}),e=new Uint8Array(t.lock());e[0]=e[1]=e[2]=e[3]=255,t.unlock();var i=new Oc;i.diffuse.set(0,0,0),i.emissive.set(.5,.5,.5),i.emissiveMap=t,i.emissiveTint=!0,i.opacityMap=t,i.opacityMapChannel="a",i.opacityTint=!0,i.opacity=0,i.useLighting=!1,i.useGammaTonemap=!1,i.useFog=!1,i.useSkybox=!1,i.blendType=4,i.depthWrite=!1,i.pixelSnap=!1,i.cull=_e,i.update(),this._defaultTexture=t,this._defaultMaterial=i}return this._defaultMaterial},set:function(t){this._defaultMaterial=t}},{key:"default9SlicedMaterialSlicedMode",get:function(){if(!this._default9SlicedMaterialSlicedMode){var t=this.defaultMaterial.clone();t.nineSlicedMode=1,t.update(),this._default9SlicedMaterialSlicedMode=t}return this._default9SlicedMaterialSlicedMode},set:function(t){this._default9SlicedMaterialSlicedMode=t}},{key:"default9SlicedMaterialTiledMode",get:function(){if(!this._default9SlicedMaterialTiledMode){var t=this.defaultMaterial.clone();t.nineSlicedMode=2,t.update(),this._default9SlicedMaterialTiledMode=t}return this._default9SlicedMaterialTiledMode},set:function(t){this._default9SlicedMaterialTiledMode=t}}])}(jm);Xm._buildAccessors(Zx.prototype,Jx);var tS=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._oldState=!0,n._size=new Ct,n.on("set_enabled",n._onSetEnabled,n),n}x(e,t);var i=e.prototype;return i.onEnable=function(){this._checkState()},i.onDisable=function(){this._checkState()},i._onSetEnabled=function(t,e,i){this._checkState()},i._checkState=function(){var t=this.enabled&&this.entity.enabled;t!==this._oldState&&(this._oldState=t,this.fire("enable"),this.fire("state",this.enabled))},i._onBeforeRemove=function(){this.fire("remove")},v(e,[{key:"size",get:function(){return this._size},set:function(t){t instanceof Ct?this._size.copy(t):t instanceof Array&&t.length>=3&&this.size.set(t[0],t[1],t[2])}}])}(Xm);tS.EVENT_ENABLE="enable",tS.EVENT_DISABLE="disable",tS.EVENT_STATE="state",tS.EVENT_REMOVE="remove";var eS=function(){this.enabled=!0},iS=["enabled"],nS=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="zone",i.ComponentType=tS,i.DataType=eS,i.schema=iS,i.on("beforeremove",i._onBeforeRemove,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(t,e,i){t.enabled=!e.hasOwnProperty("enabled")||!!e.enabled,e.size&&(e.size instanceof Ct?t.size.copy(e.size):e.size instanceof Array&&e.size.length>=3&&t.size.set(e.size[0],e.size[1],e.size[2]))},i.cloneComponent=function(t,e){var i={size:t.zone.size};return this.addComponent(e,i)},i._onBeforeRemove=function(t,e){e._onBeforeRemove()},e}(jm);Xm._buildAccessors(tS.prototype,iS);var sS=function(t,e){this.effect=t,this.inputTarget=e,this.outputTarget=null,this.name=t.constructor.name},rS=function(){function t(t,e){this.app=t,this.camera=e,this.destinationRenderTarget=null,this.effects=[],this.enabled=!1,this.depthTarget=null,e.on("set:rect",this.onCameraRectChanged,this)}var e=t.prototype;return e._allocateColorBuffer=function(t,e){var i,n,s=this.camera.rect,r=this.destinationRenderTarget,a=this.app.graphicsDevice,o=Math.floor(s.z*(null!=(i=null==r?void 0:r.width)?i:a.width)),h=Math.floor(s.w*(null!=(n=null==r?void 0:r.height)?n:a.height));return new dr(a,{name:e,format:t,width:o,height:h,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1})},e._createOffscreenTarget=function(t,e){var i=this.app.graphicsDevice,n=e&&i.getRenderableHdrFormat([ye,Se],!0)||7,s=this.camera.entity.name+"-posteffect-"+this.effects.length,r=this._allocateColorBuffer(n,s);return new Dn({colorBuffer:r,depth:t,stencil:t&&this.app.graphicsDevice.supportsStencil,samples:t?i.samples:1})},e._resizeOffscreenTarget=function(t){var e=t.colorBuffer.format,i=t.colorBuffer.name;t.destroyFrameBuffers(),t.destroyTextureBuffers(),t._colorBuffer=this._allocateColorBuffer(e,i),t._colorBuffers=[t._colorBuffer]},e._destroyOffscreenTarget=function(t){t.destroyTextureBuffers(),t.destroy()},e.addEffect=function(t){var e=this.effects,i=0===e.length,n=this._createOffscreenTarget(i,t.hdr),s=new sS(t,n);e.push(s),this._sourceTarget=s.inputTarget,e.length>1&&(e[e.length-2].outputTarget=s.inputTarget),this._newPostEffect=t,t.needsDepthBuffer&&this._requestDepthMap(),this.enable(),this._newPostEffect=void 0},e.removeEffect=function(t){for(var e=-1,i=0,n=this.effects.length;i=0&&(e>0?this.effects[e-1].outputTarget=e+11&&(this.effects[1].inputTarget._depth||(this._destroyOffscreenTarget(this.effects[1].inputTarget),this.effects[1].inputTarget=this._createOffscreenTarget(!0,this.effects[1].hdr),this._sourceTarget=this.effects[1].inputTarget),this.camera.renderTarget=this.effects[1].inputTarget),this._destroyOffscreenTarget(this.effects[e].inputTarget),this.effects.splice(e,1)),this.enabled&&t.needsDepthBuffer&&this._releaseDepthMap(),0===this.effects.length&&this.disable()},e._requestDepthMaps=function(){for(var t=0,e=this.effects.length;t0},set:function(t){t&&!this._sceneColorMapRequested?(this.requestSceneColorMap(!0),this._sceneColorMapRequested=!0):this._sceneColorMapRequested&&(this.requestSceneColorMap(!1),this._sceneColorMapRequested=!1)}},{key:"renderSceneDepthMap",get:function(){return this._renderSceneDepthMap>0},set:function(t){t&&!this._sceneDepthMapRequested?(this.requestSceneDepthMap(!0),this._sceneDepthMapRequested=!0):this._sceneDepthMapRequested&&(this.requestSceneDepthMap(!1),this._sceneDepthMapRequested=!1)}},{key:"renderTarget",get:function(){return this._camera.renderTarget},set:function(t){this._camera.renderTarget=t,this.dirtyLayerCompositionCameras()}},{key:"scissorRect",get:function(){return this._camera.scissorRect},set:function(t){this._camera.scissorRect=t}},{key:"sensitivity",get:function(){return this._camera.sensitivity},set:function(t){this._camera.sensitivity=t}},{key:"shutter",get:function(){return this._camera.shutter},set:function(t){this._camera.shutter=t}},{key:"viewMatrix",get:function(){return this._camera.viewMatrix}}])}(Xm),oS=function(){this.enabled=!0},hS=["enabled"],lS=function(t){function e(e){var i;return(i=t.call(this,e)||this).cameras=[],i.id="camera",i.ComponentType=aS,i.DataType=oS,i.schema=hS,i.on("beforeremove",i.onBeforeRemove,i),i.app.on("prerender",i.onAppPrerender,i),i.app.systems.on("update",i.onUpdate,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){n=["aspectRatio","aspectRatioMode","calculateProjection","calculateTransform","clearColor","clearColorBuffer","clearDepthBuffer","clearStencilBuffer","renderSceneColorMap","renderSceneDepthMap","cullFaces","farClip","flipFaces","fov","frustumCulling","horizontalFov","layers","renderTarget","nearClip","orthoHeight","projection","priority","rect","scissorRect","aperture","shutter","sensitivity"];for(var s=0;s=0&&(this.cameras.splice(e,1),fd(this.cameras))},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this)},e}(jm);Xm._buildAccessors(aS.prototype,hS);var cS=function(){this.enabled=!0,this.light=void 0,this.type="directional",this.color=new vt(1,1,1),this.intensity=1,this.luminance=0,this.shape=0,this.affectSpecularity=!0,this.castShadows=!1,this.shadowDistance=40,this.shadowIntensity=1,this.shadowResolution=1024,this.shadowBias=.05,this.numCascades=1,this.bakeNumSamples=1,this.bakeArea=0,this.cascadeDistribution=.5,this.normalOffsetBias=0,this.range=10,this.innerConeAngle=40,this.outerConeAngle=45,this.falloffMode=0,this.shadowType=0,this.vsmBlurSize=11,this.vsmBlurMode=1,this.vsmBias=.0025,this.cookieAsset=null,this.cookie=null,this.cookieIntensity=1,this.cookieFalloff=!0,this.cookieChannel="rgb",this.cookieAngle=0,this.cookieScale=null,this.cookieOffset=null,this.shadowUpdateMode=2,this.mask=1,this.affectDynamic=!0,this.affectLightmapped=!1,this.bake=!1,this.bakeDir=!0,this.isStatic=!1,this.layers=[0],this.penumbraSize=1},uS=Object.keys(new cS),dS=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._cookieAsset=null,n._cookieAssetId=null,n._cookieAssetAdd=!1,n._cookieMatrix=null,n}x(e,t);var i=e.prototype;return i._setValue=function(t,e,i,n){var s=this.data,r=s[t];(n||r!==e)&&(s[t]=e,i&&i.call(this,e,r))},i.addLightToLayers=function(){for(var t=0;t=0&&this.enabled&&this.entity.enabled&&(t.addLight(this),this.light.addLayer(t))},i.onLayerRemoved=function(t){this.layers.indexOf(t.id)>=0&&(t.removeLight(this),this.light.removeLayer(t))},i.refreshProperties=function(){for(var t=0;t=3&&i.length<=4){for(var u=0;ue.ind&&(l=e.ind),this._insertScriptInstance(o,l,h),this._scriptsIndex[r]={instance:o,onSwap:function(){n.swap(r)}},this[r]=o,e.preloading||this.initializeAttributes(o),this.fire("create",r,o),this.fire("create:"+r,o),this.system.app.scripts.on("swap:"+r,this._scriptsIndex[r].onSwap),e.preloading||(o.enabled&&!o._initialized&&(o._initialized=!0,o.initialize&&this._scriptMethod(o,xS)),o.enabled&&!o._postInitialized&&(o._postInitialized=!0,o.postInitialize&&this._scriptMethod(o,SS))),o}}else this._scriptsIndex[r]={awaiting:!0,ind:this._scripts.length};return null},i.destroy=function(t){var e=t,i=t;"string"==typeof i?i=this.system.app.scripts.get(i):i&&(e=i.__name);var n=this._scriptsIndex[e];if(delete this._scriptsIndex[e],!n)return!1;this._attributeDataMap.delete(e);var s=n.instance;if(s&&!s._destroyed)if(s.enabled=!1,s._destroyed=!0,this._isLoopingThroughScripts)this._destroyedScripts.push(s);else{var r=this._removeScriptInstance(s);r>=0&&this._resetExecutionOrder(r,this._scripts.length)}return this.system.app.scripts.off("swap:"+e,n.onSwap),delete this[e],this.fire("destroy",e,s||null),this.fire("destroy:"+e,s||null),s&&s.fire("destroy"),!0},i.swap=function(t){var e=t,i=t;"string"==typeof i?i=this.system.app.scripts.get(i):i&&(e=i.__name);var n=this._scriptsIndex[e];if(!n||!n.instance)return!1;var s=n.instance,r=this._scripts.indexOf(s),a=new i({app:this.system.app,entity:this.entity,enabled:s.enabled,attributes:s.__attributes});return!!a.swap&&(this.initializeAttributes(a),this._scripts[r]=a,this._scriptsIndex[e].instance=a,this[e]=a,a.__executionOrder=r,s.update&&this._updateList.remove(s),s.postUpdate&&this._postUpdateList.remove(s),a.update&&this._updateList.insert(a),a.postUpdate&&this._postUpdateList.insert(a),this._scriptMethod(a,"swap",s),this.fire("swap",e,a),this.fire("swap:"+e,a),!0)},i.resolveDuplicatedEntityReferenceProperties=function(t,e){var i=this.entity.script;for(var n in t._scriptsIndex){var s=this.system.app.scripts.get(n);if(s){var r=t._scriptsIndex[n];if(r&&r.instance){var a=i[n].__attributesRaw,o=i[n].__attributes;if(a||o){var h=!!a,l=r.instance.__attributes;for(var c in l)if(l[c]){var u=s.attributes.get(c);if(u)if("entity"===u.type)this._resolveEntityScriptAttribute(u,c,l[c],h,a||o,e);else if("json"===u.type&&Array.isArray(u.schema))for(var d=l[c],f=a?a[c]:o[c],p=0;p=i||e<0)return!1;var n=t,s=t;"string"!=typeof s?s=t.__name:n=null;var r=this._scriptsIndex[s];if(!r||!r.instance)return!1;var a=r.instance;if(n&&!(a instanceof n))return!1;var o=this._scripts.indexOf(a);return-1!==o&&o!==e&&(this._scripts.splice(e,0,this._scripts.splice(o,1)[0]),this._resetExecutionOrder(0,i),this._updateList.sort(),this._postUpdateList.sort(),this.fire("move",s,a,e,o),this.fire("move:"+s,a,e,o),!0)},v(e,[{key:"scripts",get:function(){return this._scripts},set:function(t){var e=this;this._scriptsData=t;var i=function(){if(!t.hasOwnProperty(n))return 1;var i=e._scriptsIndex[n];if(i){if("boolean"==typeof t[n].enabled&&(i.once("preInitialize",(function(){e.initializeAttributes(i)})),i.enabled=!!t[n].enabled),"object"==typeof t[n].attributes)for(var s in t[n].attributes)if(!yS.reservedNames.has(s)){if(!i.__attributes.hasOwnProperty(s)){var r=e.system.app.scripts.get(n);r&&r.attributes.add(s,{})}i[s]=t[n].attributes[s]}}else console.log(e.order)};for(var n in t)i()}},{key:"enabled",get:function(){return this._enabled},set:function(t){var e=this._enabled;this._enabled=t,this.fire("set","enabled",e,t)}}])}(Xm);AS.EVENT_CREATE="create",AS.EVENT_DESTROY="destroy",AS.EVENT_ENABLE="enable",AS.EVENT_DISABLE="disable",AS.EVENT_REMOVE="remove",AS.EVENT_STATE="state",AS.EVENT_MOVE="move",AS.EVENT_ERROR="error";var CS=function(){this.enabled=!0},MS=0,PS=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="script",i.ComponentType=AS,i.DataType=CS,i._components=new ct({sortBy:"_executionOrder"}),i._enabledComponents=new ct({sortBy:"_executionOrder"}),i.preloading=!0,i.on("beforeremove",i._onBeforeRemove,i),i.app.systems.on("initialize",i._onInitialize,i),i.app.systems.on("postInitialize",i._onPostInitialize,i),i.app.systems.on("update",i._onUpdate,i),i.app.systems.on("postUpdate",i._onPostUpdate,i),i}x(e,t);var i=e.prototype;return i.initializeComponentData=function(t,e){if(t._executionOrder=MS++,this._components.append(t),MS>Number.MAX_SAFE_INTEGER&&this._resetExecutionOrder(),t.enabled=!e.hasOwnProperty("enabled")||!!e.enabled,t.enabled&&t.entity.enabled&&this._enabledComponents.append(t),e.hasOwnProperty("order")&&e.hasOwnProperty("scripts")){t._scriptsData=e.scripts;for(var i=0;i=0&&e._onBeforeRemove(),this._removeComponentFromEnabled(e),this._components.remove(e)},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("initialize",this._onInitialize,this),this.app.systems.off("postInitialize",this._onPostInitialize,this),this.app.systems.off("update",this._onUpdate,this),this.app.systems.off("postUpdate",this._onPostUpdate,this)},e}(jm),RS=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._layers=[0],n._instance=null,n._customAabb=null,n._assetReference=void 0,n._materialOptions=null,n._assetReference=new Dy("asset",n,e.app.assets,{add:n._onGSplatAssetAdded,load:n._onGSplatAssetLoad,remove:n._onGSplatAssetRemove,unload:n._onGSplatAssetUnload},n),i.on("remove",n.onRemoveChild,n),i.on("removehierarchy",n.onRemoveChild,n),i.on("insert",n.onInsertChild,n),i.on("inserthierarchy",n.onInsertChild,n),n}x(e,t);var i=e.prototype;return i.assignAsset=function(t){var e=t instanceof cm?t.id:t;this._assetReference.id=e},i.destroyInstance=function(){var t;this._instance&&(this.removeFromLayers(),null==(t=this._instance)||t.destroy(),this._instance=null)},i.addToLayers=function(){var t,e=null==(t=this.instance)?void 0:t.meshInstance;if(e)for(var i=this.system.app.scene.layers,n=0;n0){var r=e.jobQueue.shift();e.run(t,r)}else{var a=e.workers[2].indexOf(t);if(-1!==a)e.workers[2].splice(a,1),e.workers[1].push(t);else{var o=e.workers[1].indexOf(t);-1!==o&&(e.workers[1].splice(o,1),e.workers[0].push(t))}}}))})),this.workers[0]=t;this.jobQueue.length&&(this.workers[0].length||this.workers[1].length);){var i=this.jobQueue.shift();if(this.workers[0].length>0){var n=this.workers[0].shift();this.workers[1].push(n),this.run(n,i)}else{var s=this.workers[1].shift();this.workers[2].push(s),this.run(s,i)}}},e.enqueueJob=function(t,e){var i={jobId:this.jobId++,buffer:t};if(this.jobCallbacks.set(i.jobId,e),this.workers[0].length>0){var n=this.workers[0].shift();this.workers[1].push(n),this.run(n,i)}else if(this.workers[1].length>0){var s=this.workers[1].shift();this.workers[2].push(s),this.run(s,i)}else this.jobQueue.push(i)},t}(),qS=function(t){var e=function(){return fetch(t).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.compile(t)}))};return WebAssembly.compileStreaming?WebAssembly.compileStreaming(fetch(t)).catch((function(t){return e()})):e()},YS=function(t){if(HS)return!0;if(!t)if(WS)t=WS;else{var e=ht.getConfig("DracoDecoderModule");t=e?{jsUrl:e.glueUrl,wasmUrl:e.wasmUrl,numWorkers:e.numWorkers}:{jsUrl:"draco.wasm.js",wasmUrl:"draco.wasm.wasm",numWorkers:1}}return!(!t.jsUrl||!t.wasmUrl)&&(HS=new jS,Promise.all([(i=t.jsUrl,new Promise((function(t,e){var n={cache:!0,responseType:"text",retry:!0,maxRetries:3};io.get(i,n,(function(i,n){i?e(i):t(n)}))}))),qS(t.wasmUrl)]).then((function(e){for(var i=e[0],n=e[1],s=["/* draco */",i,"/* worker */","(\n"+GS.toString()+"\n)()\n\n"].join("\n"),r=new Blob([s],{type:"application/javascript"}),a=URL.createObjectURL(r),o=Math.max(1,Math.min(16,t.numWorkers||1)),h=[],l=0;l0&&o(n,Float32Array,1),s.length>0&&o(s,Uint16Array,65535),r.length>0&&o(r,Uint8Array,255)}(y),y.unlock(),y},cb=function(t,e,i,n,s,r,a){var o,h=new vh(t);h.aabb=rb(i[e.attributes.POSITION]);for(var l=[],c=0,u=Object.entries(e.attributes);c0?i.name=t.name:i.name="node_"+e,t.hasOwnProperty("matrix")&&(Eb.data.set(t.matrix),Eb.getTranslation(Ab),i.setLocalPosition(Ab),Eb.getEulerAngles(Ab),i.setLocalEulerAngles(Ab),Eb.getScale(Ab),i.setLocalScale(Ab)),t.hasOwnProperty("rotation")){var n=t.rotation;i.setLocalRotation(n[0],n[1],n[2],n[3])}if(t.hasOwnProperty("translation")){var s=t.translation;i.setLocalPosition(s[0],s[1],s[2])}if(t.hasOwnProperty("scale")){var r=t.scale;i.setLocalScale(r[0],r[1],r[2])}return i},Mb=function(t,e){var i="orthographic"===t.type?1:0,n=1===i?t.orthographic:t.perspective,s={enabled:!1,projection:i,nearClip:n.znear,aspectRatioMode:0};n.zfar&&(s.farClip=n.zfar),1===i?(s.orthoHeight=.5*n.ymag,n.ymag&&(s.aspectRatioMode=1,s.aspectRatio=n.xmag/n.ymag)):(s.fov=n.yfov*_t.RAD_TO_DEG,n.aspectRatio&&(s.aspectRatioMode=1,s.aspectRatio=n.aspectRatio));var r=new wm(t.name);return r.addComponent("camera",s),r},Pb=function(t,e){var i={enabled:!1,type:"point"===t.type?"omni":t.type,color:t.hasOwnProperty("color")?new vt(t.color):vt.WHITE,range:t.hasOwnProperty("range")?t.range:9999,falloffMode:1,intensity:t.hasOwnProperty("intensity")?_t.clamp(t.intensity,0,2):1};t.hasOwnProperty("spot")&&(i.innerConeAngle=t.spot.hasOwnProperty("innerConeAngle")?t.spot.innerConeAngle*_t.RAD_TO_DEG:0,i.outerConeAngle=t.spot.hasOwnProperty("outerConeAngle")?t.spot.outerConeAngle*_t.RAD_TO_DEG:Math.PI/4),t.hasOwnProperty("intensity")&&(i.luminance=t.intensity*bd.getLightUnitConversion(gd[i.type],i.outerConeAngle,i.innerConeAngle));var n=new wm(e.name);return n.rotateLocal(90,0,0),n.addComponent("light",i),n},Rb=function(t,e,i,n){if(!e.hasOwnProperty("skins")||0===e.skins.length)return[];var s=new Map;return e.skins.map((function(r){return function(t,e,i,n,s,r){var a,o,h,l=e.joints,c=l.length,u=[];if(e.hasOwnProperty("inverseBindMatrices")){var d=e.inverseBindMatrices,f=nb(i[d],n,!0),p=[];for(a=0;a0&&"localRotation"===L.paths[0].propertyPath[0]&&2!==L.interpolation&&v.push(P[P.length-1].output))}v.sort();var k,O=null;for(o=0;o0){var s,r,a,o,h=null==i||null==(s=i.camera)?void 0:s.preprocess,l=null!=(r=null==i||null==(a=i.camera)?void 0:a.process)?r:Mb,c=null==i||null==(o=i.camera)?void 0:o.postprocess;t.nodes.forEach((function(i,s){if(i.hasOwnProperty("camera")){var r=t.cameras[i.camera];if(r){h&&h(r);var a=l(r,e[s]);c&&c(r,a),a&&(n||(n=new Map),n.set(i,a))}}}))}return n},Nb=function(t,e,i){var n=null;if(t.hasOwnProperty("nodes")&&t.hasOwnProperty("extensions")&&t.extensions.hasOwnProperty("KHR_lights_punctual")&&t.extensions.KHR_lights_punctual.hasOwnProperty("lights")){var s=t.extensions.KHR_lights_punctual.lights;if(s.length){var r,a,o,h,l=null==i||null==(r=i.light)?void 0:r.preprocess,c=null!=(a=null==i||null==(o=i.light)?void 0:o.process)?a:Pb,u=null==i||null==(h=i.light)?void 0:h.postprocess;t.nodes.forEach((function(t,i){if(t.hasOwnProperty("extensions")&&t.extensions.hasOwnProperty("KHR_lights_punctual")&&t.extensions.KHR_lights_punctual.hasOwnProperty("light")){var r=t.extensions.KHR_lights_punctual.light,a=s[r];if(a){l&&l(a);var o=c(a,e[i]);u&&u(a,o),o&&(n||(n=new Map),n.set(t,o))}}}))}}return n},Ub=function(t,e,i){t.nodes.forEach((function(t){t.hasOwnProperty("mesh")&&t.hasOwnProperty("skin")&&e[t.mesh].meshes.forEach((function(e){e.skin=i[t.skin]}))}))},zb=function(){var t=m(S().mark((function t(e,i,n,s,r){var a,o,h,l,c,u,d,f,p,m,_,v,g,y,x,b,T,w,E,A,C,M,P,R;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=null==r||null==(a=r.global)?void 0:a.preprocess,l=null==r||null==(o=r.global)?void 0:o.postprocess,h&&h(i),c=i.asset&&"PlayCanvas"===i.asset.generator,u=Ob(i,r),d=Fb(i,u),f=Nb(i,u,r),p=Bb(i,u,r),m=Lb(i),t.next=12,Promise.all(n);case 12:return _=t.sent,v=Ib(e,i,_,c,r),g=v.meshes,y=v.meshVariants,x=v.meshDefaultMaterials,b=v.promises,T=kb(i,u,_,r),t.next=17,Promise.all(s);case 17:for(w=t.sent,E=w.map((function(t){return t.resource})),A=Db(i,E,r,c),C=Rb(e,i,u,_),M=[],P=0;Pi.byteLength)e("Invalid length found in glb header. Found "+r);else{for(var a=[],o=12;oi.byteLength&&e("Invalid chunk length found in glb. Found "+h);var l=i.getUint32(o+4,!0),c=new Uint8Array(i.buffer,i.byteOffset+o+8,h);a.push({length:h,type:l,data:c}),o+=h+8}1===a.length||2===a.length?1313821514===a[0].type?a.length>1&&5130562!==a[1].type?e("Invalid chunk type found in glb file. Expected 0x004E4942, found 0x"+a[1].type.toString(16)):e(null,{gltfChunk:a[0].data,binaryChunk:2===a.length?a[1].data:null}):e("Invalid chunk type found in glb file. Expected 0x4E4F534A, found 0x"+a[0].type.toString(16)):e("Invalid number of chunks found in glb file.")}else e("Invalid version number found in glb header. Expected 2, found "+s);else e("Invalid magic number found in glb header. Expected 0x46546C67, found 0x"+n.toString(16))}(e,i):i(null,{gltfChunk:e,binaryChunk:null})},Hb=function(){function t(){}return t.parse=function(t,e,i,n,s,r,a){Gb(t,i,(function(t,i){t?a(t):function(t,e){var i=JSON.parse(function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",i=0;i0,maxRetries:this.maxRetries};(t.load.startsWith("blob:")||t.load.startsWith("data:"))&&(".glb"===D.getExtension(t.original).toLowerCase()?s.responseType=eo.ResponseType.ARRAY_BUFFER:s.responseType=eo.ResponseType.JSON),io.get(t.load,s,(function(s,r){var a;s?e("Error loading animation resource: "+t.original+" ["+s+"]"):".glb"===D.getExtension(t.original).toLowerCase()?Hb.parse("filename.glb","",r,n.device,n.assets,null!=(a=null==i?void 0:i.options)?a:{},(function(t,n){if(t)e(t);else{var s,r=n.animations;if(null!=i&&null!=(s=i.data)&&s.events)for(var a=0;a0,maxRetries:this.maxRetries};t.load.startsWith("blob:")&&(i.responseType=eo.ResponseType.JSON),io.get(t.load,i,(function(i,n){i?e("Error loading animation clip resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.open=function(t,e){var i=e.name,n=e.duration,s=e.inputs.map((function(t){return new VS(1,t)})),r=e.outputs.map((function(t){return new VS(t.components,t.data)})),a=e.curves.map((function(t){return new zS([t.path],t.inputIndex,t.outputIndex,t.interpolation)}));return new A_(i,n,s,r,a)},e}(vm),jb=function(t){function e(e){return t.call(this,e,"animstategraph")||this}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i={retry:this.maxRetries>0,maxRetries:this.maxRetries};t.load.startsWith("blob:")&&(i.responseType=eo.ResponseType.JSON),io.get(t.load,i,(function(i,n){i?e("Error loading animation state graph resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.open=function(t,e){return new Z_(e)},e}(vm),qb=function(){if("undefined"==typeof window)return!1;var t=window.navigator.userAgent,e=t.indexOf("MSIE ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("Trident/")>0){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}return!1}(),Yb=[".ogg",".mp3",".wav",".mp4a",".m4a",".mp4",".aac",".opus"],Kb=function(t){function e(e){var i;return(i=t.call(this,e,"audio")||this).manager=e.soundManager,i}x(e,t);var i=e.prototype;return i._isSupported=function(t){var e=D.getExtension(t);return Yb.indexOf(e)>-1},i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i=function(i){var n="Error loading audio url: "+t.original;i&&(n+=": "+(i.message||i)),console.warn(n),e(n)};if(this._createSound){if(!this._isSupported(t.original))return void i("Audio format for "+t.original+" not supported");this._createSound(t.load,(function(t){e(null,new uo(t))}),i)}else i(null)},i._createSound=function(t,e,i){if(no()){var n=this.manager;if(!n.context)return void i("Audio manager has no audio context");var s={retry:this.maxRetries>0,maxRetries:this.maxRetries};(t.startsWith("blob:")||t.startsWith("data:"))&&(s.responseType=eo.ResponseType.ARRAY_BUFFER),io.get(t,s,(function(t,s){t?i(t):n.context.decodeAudioData(s,e,i)}))}else{var r=null;try{r=new Audio}catch(t){return void i("No support for Audio element")}qb&&document.body.appendChild(r);var a=function(){r.removeEventListener("canplaythrough",a),qb&&document.body.removeChild(r),e(r)};r.onerror=function(){r.onerror=null,qb&&document.body.removeChild(r),i()},r.addEventListener("canplaythrough",a),r.src=t}},e}(vm),Zb=function(t){function e(e){return t.call(this,e,"binary")||this}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),io.get(t.load,{responseType:eo.ResponseType.ARRAY_BUFFER,retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading binary resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return t.buffer},e}(vm),Qb=function(){function t(e,i,n,s){for(var r=function(e,s,r){var a=t.createAsset(i.name,e,s,r);return n.add(a),a},a=[],o=0;o=0?t.split("?")[0]:t},e.load=function(t,e,i){var n=this;cm.fetchArrayBuffer(t.load,(function(s,r){s?e(s):Hb.parse(n._getUrlWithoutParams(t.original),D.extractPath(t.load),r,n._device,i.registry,i.options,(function(t,s){t?e(t):e(null,new Qb(s,i,n._assets,n._defaultMaterial))}))}),i,this.maxRetries)},e.open=function(t,e,i){return e},e.patch=function(t,e){},t}(),$b=function(){function t(){}var e=t.prototype;return e.instantiateModelEntity=function(t){return null},e.instantiateRenderEntity=function(t){return null},e.getMaterialVariants=function(){return null},e.applyMaterialVariant=function(t,e){},e.applyMaterialVariantInstances=function(t,e){},t}(),tT=function(t){function e(e){var i;return(i=t.call(this,e,"container")||this).glbContainerParser=new Jb(e.graphicsDevice,e.assets,0),i.parsers={},i}x(e,t);var i=e.prototype;return i._getUrlWithoutParams=function(t){return t.indexOf("?")>=0?t.split("?")[0]:t},i._getParser=function(t){var e=t?D.getExtension(this._getUrlWithoutParams(t)).toLowerCase().replace(".",""):null;return this.parsers[e]||this.glbContainerParser},i.load=function(t,e,i){"string"==typeof t&&(t={load:t,original:t}),this._getParser(t.original).load(t,e,i)},i.open=function(t,e,i){return this._getParser(t).open(t,e,i)},v(e,[{key:"maxRetries",get:function(){return this.glbContainerParser.maxRetries},set:function(t){for(var e in this.glbContainerParser.maxRetries=t,this.parsers)this.parsers.hasOwnProperty(e)&&(this.parsers[e].maxRetries=t)}}])}(vm),eT=function(t){function e(e){var i;return(i=t.call(this,e,"css")||this).decoder=null,i}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),io.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading css resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(vm),iT=function(t){function e(e){var i;return(i=t.call(this,e,"cubemap")||this)._device=e.graphicsDevice,i._registry=e.assets,i._loader=e.loader,i}x(e,t);var i=e.prototype;return i.load=function(t,e,i){this.loadAssets(i,e)},i.open=function(t,e,i){return i?i.resource:null},i.patch=function(t,e){this.loadAssets(t,(function(i,n){i&&(e.fire("error",t),e.fire("error:"+t.id,i,t),t.fire("error",t))}))},i.getAssetIds=function(t){var e=[];if(e[0]=t.file,(t.loadFaces||!t.file)&&t.data&&t.data.textures)for(var i=0;i<6;++i)e[i+1]=t.data.textures[i];else e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=null;return e},i.compareAssetIds=function(t,e){return t&&e?parseInt(t,10)===t||"string"==typeof t?t===e:t.url===e.url:null!==t==(null!==e)},i.update=function(t,e,i){var n,s,r,a=t.data||{},o=t._handlerState.assets,h=t._resources,l=[null,null,null,null,null,null,null],c=function(){return a.hasOwnProperty("type")?a.type:a.hasOwnProperty("rgbm")?a.rgbm?vi:_i:null};if(t.loaded&&i[0]===o[0])l[1]=h[1]||null,l[2]=h[2]||null,l[3]=h[3]||null,l[4]=h[4]||null,l[5]=h[5]||null,l[6]=h[6]||null;else if(i[0])if((n=i[0].resource).cubemap)for(r=0;r<6;++r)l[r+1]=new dr(this._device,{name:t.name+"_prelitCubemap"+(n.width>>r),cubemap:!0,type:c()||n.type,width:n.width>>r,height:n.height>>r,format:n.format,levels:[n._levels[r]],fixCubemapSeams:!0,addressU:1,addressV:1,mipmaps:0===r});else n.type=yi,n.addressU=1,n.addressV=1,n.mipmaps=!1,l[1]=n;var u=i.slice(1);if(t.loaded&&this.cmpArrays(u,o.slice(1)))l[0]=h[0]||null;else if(-1===u.indexOf(null)){var d,f=u.map((function(t){return t.resource})),p=[];for(s=0;s0,maxRetries:this.maxRetries},(function(i,s){if(i)e("Error loading font resource: "+t.original+" ["+i+"]");else{var r=rT(s);n._loadTextures(t.load.replace(".json",".png"),r,(function(t,i){t?e(t):e(null,{data:r,textures:i})}))}})):(i&&i.data&&(i.data=rT(i.data)),this._loadTextures(t.load,i&&i.data,e))},i._loadTextures=function(t,e,i){for(var n=e.info.maps.length,s=0,r=null,a=new Array(n),o=this._loader,h=function(e){var h=function(t,o){if(!r){if(t)return r=t,void i(t);o.upload(),a[e]=o,++s===n&&i(null,a)}};0===e?o.load(t,"texture",h):o.load(t.replace(".png",e+".png"),"texture",h)},l=0;l>>21,11),t.y=r(e>>>11,10),t.z=r(e,11)},o=function(t,e,i){return t*(1-i)+e*i},h=t.chunkData,l=t.vertexData;this.read=function(t){var c=12*Math.floor(t/256);e&&(a(e,l[4*t+0]),e.x=o(h[c+0],h[c+3],e.x),e.y=o(h[c+1],h[c+4],e.y),e.z=o(h[c+2],h[c+5],e.z)),i&&function(t,e){var i=1/(.5*Math.sqrt(2)),n=(r(e>>>20,10)-.5)*i,s=(r(e>>>10,10)-.5)*i,a=(r(e,10)-.5)*i,o=Math.sqrt(1-(n*n+s*s+a*a));switch(e>>>30){case 0:t.set(n,s,a,o);break;case 1:t.set(o,s,a,n);break;case 2:t.set(s,o,a,n);break;case 3:t.set(s,a,o,n)}}(i,l[4*t+1]),n&&(a(n,l[4*t+2]),n.x=o(h[c+6],h[c+9],n.x),n.y=o(h[c+7],h[c+10],n.y),n.z=o(h[c+8],h[c+11],n.z)),s&&function(t,e){t.x=r(e>>>24,8),t.y=r(e>>>16,8),t.z=r(e>>>8,8),t.w=r(e,8)}(s,l[4*t+3])}},cT=function(){function t(){this.numSplats=void 0,this.chunkData=void 0,this.vertexData=void 0}var e=t.prototype;return e.createIter=function(t,e,i,n){return new lT(this,t,e,i,n)},e.calcAabb=function(t){var e,i,n,s,r,a,o=Math.ceil(this.numSplats/256),h=this.chunkData,l=Math.exp(Math.max(h[9],h[10],h[11]));e=h[0]-l,i=h[1]-l,n=h[2]-l,s=h[3]+l,r=h[4]+l,a=h[5]+l;for(var c=1;c>>21)/2047,m=(f>>>11&1023)/1023,_=(2047&f)/2047;t[3*d+0]=(1-p)*e+p*s,t[3*d+1]=(1-m)*i+m*r,t[3*d+2]=(1-_)*n+_*a}}},e.calcFocalPoint=function(t){var e=this.chunkData,i=Math.ceil(this.numSplats/256);t.x=0,t.y=0,t.z=0;for(var n=0;n=1?40:-Math.log(1/a.w-1);return new wp([{name:"vertex",count:this.numSplats,properties:e.map((function(t){return{name:t,type:"float",byteSize:4,storage:i[t]}}))}])},v(t,[{key:"isCompressed",get:function(){return!0}}])}(),uT=function(){function t(){}var e=t.prototype;return e.generateKey=function(t){var e=xn(t.vertex),i=xn(t.fragment);return"splat-"+t.pass+"-"+t.gamma+"-"+t.toneMapping+"-"+e+"-"+i+"-"+t.dither+"}"},e.createShaderDefinition=function(t,e){var i=$o.get(t).getByIndex(e.pass).shaderDefines+"#define DITHER_"+e.dither.toUpperCase()+"\n#define TONEMAP_"+(0===e.toneMapping?"DISABLED":"ENABLED")+"\n",n=i+"\n\tuniform mat4 matrix_model;\n\tuniform mat4 matrix_view;\n\tuniform mat4 matrix_projection;\n\tuniform vec2 viewport;\n\tuniform vec4 tex_params;\n\tuniform highp usampler2D splatOrder;\n\tuniform highp usampler2D packedTexture;\n\tuniform highp sampler2D chunkTexture;\n\tattribute vec3 vertex_position;\n\tattribute uint vertex_id_attrib;\n\t#ifndef DITHER_NONE\n\t\tvarying float id;\n\t#endif\n\tuint orderId;\n\tuint splatId;\n\tivec2 packedUV;\n\tivec2 chunkUV;\n\tvec4 chunkDataA;\n\tvec4 chunkDataB;\n\tvec4 chunkDataC;\n\tuvec4 packedData;\n\tbool calcSplatUV() {\n\t\tuint numSplats = uint(tex_params.x);\n\t\tuint packedWidth = uint(tex_params.y);\n\t\tuint chunkWidth = uint(tex_params.z);\n\t\torderId = vertex_id_attrib + uint(vertex_position.z);\n\t\tif (orderId >= numSplats) {\n\t\t\treturn false;\n\t\t}\n\t\tivec2 orderUV = ivec2(\n\t\t\tint(orderId % packedWidth),\n\t\t\tint(orderId / packedWidth)\n\t\t);\n\t\tsplatId = texelFetch(splatOrder, orderUV, 0).r;\n\t\tpackedUV = ivec2(\n\t\t\tint(splatId % packedWidth),\n\t\t\tint(splatId / packedWidth)\n\t\t);\n\t\tuint chunkId = splatId / 256u;\n\t\tchunkUV = ivec2(\n\t\t\tint((chunkId % chunkWidth) * 3u),\n\t\t\tint(chunkId / chunkWidth)\n\t\t);\n\t\treturn true;\n\t}\n\tvoid readData() {\n\t\tchunkDataA = texelFetch(chunkTexture, chunkUV, 0);\n\t\tchunkDataB = texelFetch(chunkTexture, ivec2(chunkUV.x + 1, chunkUV.y), 0);\n\t\tchunkDataC = texelFetch(chunkTexture, ivec2(chunkUV.x + 2, chunkUV.y), 0);\n\t\tpackedData = texelFetch(packedTexture, packedUV, 0);\n\t}\n\tvec3 unpack111011(uint bits) {\n\t\treturn vec3(\n\t\t\tfloat(bits >> 21u) / 2047.0,\n\t\t\tfloat((bits >> 11u) & 0x3ffu) / 1023.0,\n\t\t\tfloat(bits & 0x7ffu) / 2047.0\n\t\t);\n\t}\n\tvec4 unpack8888(uint bits) {\n\t\treturn vec4(\n\t\t\tfloat(bits >> 24u) / 255.0,\n\t\t\tfloat((bits >> 16u) & 0xffu) / 255.0,\n\t\t\tfloat((bits >> 8u) & 0xffu) / 255.0,\n\t\t\tfloat(bits & 0xffu) / 255.0\n\t\t);\n\t}\n\tfloat norm = 1.0 / (sqrt(2.0) * 0.5);\n\tvec4 unpackRotation(uint bits) {\n\t\tfloat a = (float((bits >> 20u) & 0x3ffu) / 1023.0 - 0.5) * norm;\n\t\tfloat b = (float((bits >> 10u) & 0x3ffu) / 1023.0 - 0.5) * norm;\n\t\tfloat c = (float(bits & 0x3ffu) / 1023.0 - 0.5) * norm;\n\t\tfloat m = sqrt(1.0 - (a * a + b * b + c * c));\n\t\tuint mode = bits >> 30u;\n\t\tif (mode == 0u) return vec4(m, a, b, c);\n\t\tif (mode == 1u) return vec4(a, m, b, c);\n\t\tif (mode == 2u) return vec4(a, b, m, c);\n\t\treturn vec4(a, b, c, m);\n\t}\n\tvec3 getCenter() {\n\t\treturn mix(chunkDataA.xyz, vec3(chunkDataA.w, chunkDataB.xy), unpack111011(packedData.x));\n\t}\n\tvec4 getRotation() {\n\t\treturn unpackRotation(packedData.y);\n\t}\n\tvec3 getScale() {\n\t\treturn exp(mix(vec3(chunkDataB.zw, chunkDataC.x), chunkDataC.yzw, unpack111011(packedData.z)));\n\t}\n\tvec4 getColor() {\n\t\treturn unpack8888(packedData.w);\n\t}\n\tmat3 quatToMat3(vec4 R) {\n\t\tfloat x = R.x;\n\t\tfloat y = R.y;\n\t\tfloat z = R.z;\n\t\tfloat w = R.w;\n\t\treturn mat3(\n\t\t\t1.0 - 2.0 * (z * z + w * w),\n\t\t\t\t 2.0 * (y * z + x * w),\n\t\t\t\t 2.0 * (y * w - x * z),\n\t\t\t\t 2.0 * (y * z - x * w),\n\t\t\t1.0 - 2.0 * (y * y + w * w),\n\t\t\t\t 2.0 * (z * w + x * y),\n\t\t\t\t 2.0 * (y * w + x * z),\n\t\t\t\t 2.0 * (z * w - x * y),\n\t\t\t1.0 - 2.0 * (y * y + z * z)\n\t\t);\n\t}\n\tvoid getCovariance(out vec3 covA, out vec3 covB) {\n\t\tmat3 rot = quatToMat3(getRotation());\n\t\tvec3 scale = getScale();\n\t\tmat3 M = transpose(mat3(\n\t\t\tscale.x * rot[0],\n\t\t\tscale.y * rot[1],\n\t\t\tscale.z * rot[2]\n\t\t));\n\t\tcovA = vec3(dot(M[0], M[0]), dot(M[0], M[1]), dot(M[0], M[2]));\n\t\tcovB = vec3(dot(M[1], M[1]), dot(M[1], M[2]), dot(M[2], M[2]));\n\t}\n\tvec4 calcV1V2(in vec3 splat_cam, in vec3 covA, in vec3 covB, mat3 W) {\n\t\tmat3 Vrk = mat3(\n\t\t\tcovA.x, covA.y, covA.z, \n\t\t\tcovA.y, covB.x, covB.y,\n\t\t\tcovA.z, covB.y, covB.z\n\t\t);\n\t\tfloat focal = viewport.x * matrix_projection[0][0];\n\t\tfloat J1 = focal / splat_cam.z;\n\t\tvec2 J2 = -J1 / splat_cam.z * splat_cam.xy;\n\t\tmat3 J = mat3(\n\t\t\tJ1, 0.0, J2.x, \n\t\t\t0.0, J1, J2.y, \n\t\t\t0.0, 0.0, 0.0\n\t\t);\n\t\tmat3 T = W * J;\n\t\tmat3 cov = transpose(T) * Vrk * T;\n\t\tfloat diagonal1 = cov[0][0] + 0.3;\n\t\tfloat offDiagonal = cov[0][1];\n\t\tfloat diagonal2 = cov[1][1] + 0.3;\n\t\tfloat mid = 0.5 * (diagonal1 + diagonal2);\n\t\tfloat radius = length(vec2((diagonal1 - diagonal2) / 2.0, offDiagonal));\n\t\tfloat lambda1 = mid + radius;\n\t\tfloat lambda2 = max(mid - radius, 0.1);\n\t\tvec2 diagonalVector = normalize(vec2(offDiagonal, lambda1 - diagonal1));\n\t\tvec2 v1 = min(sqrt(2.0 * lambda1), 1024.0) * diagonalVector;\n\t\tvec2 v2 = min(sqrt(2.0 * lambda2), 1024.0) * vec2(diagonalVector.y, -diagonalVector.x);\n\t\treturn vec4(v1, v2);\n\t}\n"+e.vertex,s=i+Oo.decodePS+(e.dither===Io?"":Oo.bayerPS+Oo.opacityDitherPS)+Uo.tonemapCode(e.toneMapping)+Uo.gammaCode(e.gamma)+"\n\t#ifndef DITHER_NONE\n\t\tvarying float id;\n\t#endif\n\t#ifdef PICK_PASS\n\t\tuniform vec4 uColor;\n\t#endif\n\tvec4 evalSplat(vec2 texCoord, vec4 color) {\n\t\tmediump float A = dot(texCoord, texCoord);\n\t\tif (A > 1.0) {\n\t\t\tdiscard;\n\t\t}\n\t\tmediump float B = exp(-A * 4.0) * color.a;\n\t\tif (B < 1.0 / 255.0) {\n\t\t\tdiscard;\n\t\t}\n\t\t#ifdef PICK_PASS\n\t\t\tif (B < 0.3) {\n\t\t\t\tdiscard;\n\t\t\t}\n\t\t\treturn uColor;\n\t\t#endif\n\t\t#ifndef DITHER_NONE\n\t\t\topacityDither(B, id * 0.013);\n\t\t#endif\n\t\t#ifdef TONEMAP_ENABLED\n\t\t\treturn vec4(gammaCorrectOutput(toneMap(decodeGamma(color.rgb))), B);\n\t\t#else\n\t\t\treturn vec4(color.rgb, B);\n\t\t#endif\n\t}\n"+e.fragment;return kr.createDefinition(t,{name:"SplatShader",attributes:{vertex_position:Ne,vertex_id_attrib:fi},vertexCode:n,fragmentCode:s})},t}(),dT=new uT,fT=function(){function t(t,e){this.device=void 0,this.numSplats=void 0,this.aabb=void 0,this.centers=void 0,this.packedTexture=void 0,this.chunkTexture=void 0;var i=e.numSplats,n=Math.ceil(i/256);this.device=t,this.numSplats=i,this.aabb=new qt,e.calcAabb(this.aabb),this.centers=new Float32Array(3*e.numSplats),e.getCenters(this.centers),this.packedTexture=this.createTexture("packedData",De,this.evalTextureSize(i),e.vertexData);var s=this.evalTextureSize(n);s.x*=3,this.chunkTexture=this.createTexture("chunkData",Se,s,e.chunkData)}var e=t.prototype;return e.destroy=function(){var t,e;null==(t=this.packedTexture)||t.destroy(),null==(e=this.chunkTexture)||e.destroy()},e.createMaterial=function(t){var e=function(t){var e;void 0===t&&(t={});var i=null!=(e=t.dither)?e:Io,n=i!==Io,s=new ah;return s.name="compressedSplatMaterial",s.cull=_e,s.blendType=n?3:2,s.depthWrite=n,s.getShaderVariant=function(e,n,s,r,a,o,h,l){var c,u,d={pass:a,gamma:1===a?n.gammaCorrection?3:0:n.gammaCorrection,toneMapping:1===a?0:n.toneMapping,vertex:null!=(c=t.vertex)?c:"\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tmediump vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0);\n\tvoid main(void)\n\t{\n\t\tif (!calcSplatUV()) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\treadData();\n\t\tvec3 center = getCenter();\n\t\tmat4 model_view = matrix_view * matrix_model;\n\t\tvec4 splat_cam = model_view * vec4(center, 1.0);\n\t\tvec4 splat_proj = matrix_projection * splat_cam;\n\t\tif (splat_proj.z < -splat_proj.w) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tvec3 covA, covB;\n\t\tgetCovariance(covA, covB);\n\t\tvec4 v1v2 = calcV1V2(splat_cam.xyz, covA, covB, transpose(mat3(model_view)));\n\t\tcolor = getColor();\n\t\tfloat scale = min(1.0, sqrt(-log(1.0 / 255.0 / color.a)) / 2.0);\n\t\tv1v2 *= scale;\n\t\tif (dot(v1v2.xy, v1v2.xy) < 4.0 && dot(v1v2.zw, v1v2.zw) < 4.0) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tgl_Position = splat_proj + vec4((vertex_position.x * v1v2.xy + vertex_position.y * v1v2.zw) / viewport * splat_proj.w, 0, 0);\n\t\ttexCoord = vertex_position.xy * scale / 2.0;\n\t\t#ifndef DITHER_NONE\n\t\t\tid = float(splatId);\n\t\t#endif\n\t}\n",fragment:null!=(u=t.fragment)?u:"\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tvoid main(void)\n\t{\n\t\tgl_FragColor = evalSplat(texCoord, color);\n\t}\n",dither:i},f=new ea(h,l),p=Bo(e);return p.register("splat-compressed",dT),p.getProgram("splat-compressed",d,f)},s.update(),s}(t);return e.setParameter("packedTexture",this.packedTexture),e.setParameter("chunkTexture",this.chunkTexture),e.setParameter("tex_params",new Float32Array([this.numSplats,this.packedTexture.width,this.chunkTexture.width/3,0])),e},e.evalTextureSize=function(t){var e=Math.ceil(Math.sqrt(t)),i=Math.ceil(t/e);return new It(e,i)},e.createTexture=function(t,e,i,n){return new dr(this.device,y({name:t,width:i.x,height:i.y,format:e,cubemap:!1,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1},n?{levels:[n]}:{}))},t}(),pT=function(){function t(t,e){this.device=void 0,this.splatData=void 0,this.splat=null,this.device=t,this.splatData=e}var e=t.prototype;return e.destroy=function(){var t;this.device=null,this.splatData=null,null==(t=this.splat)||t.destroy(),this.splat=null},e.createSplat=function(){return this.splat||(this.splat=this.splatData.isCompressed?new fT(this.device,this.splatData):new Mp(this.device,this.splatData)),this.splat},e.instantiate=function(t){void 0===t&&(t={});var e=this.createInstance(t),i=new wm,n=i.addComponent("gsplat",{instance:e});return this.splatData.isCompressed||i.setLocalEulerAngles(0,0,180),n.customAabb=e.splat.aabb.clone(),i},e.createInstance=function(t){void 0===t&&(t={});var e=this.createSplat();return new Fp(e,t)},t}(),mT=new Uint8Array([112,108,121,10]),_T=new Uint8Array([10,101,110,100,95,104,101,97,100,101,114,10]),vT=new Map([["char",Int8Array],["uchar",Uint8Array],["short",Int16Array],["ushort",Uint16Array],["int",Int32Array],["uint",Uint32Array],["float",Float32Array],["double",Float64Array]]),gT=function(){function t(t){this.reader=void 0,this.data=void 0,this.view=void 0,this.head=0,this.tail=0,this.reader=t}var e,i=t.prototype;return i.read=(e=m(S().mark((function t(){var e,i;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.reader.read();case 2:if(e=t.sent,i=e.value,!e.done){t.next=7;break}throw new Error("Stream finished before end of header");case 7:this.push(i);case 8:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)}),i.push=function(t){if(this.data){var e=this.tail-this.head,i=e+t.length;if(this.data.length>=i)this.head>0?(this.data.copyWithin(0,this.head,this.tail),this.data.set(t,e),this.head=0,this.tail=i):(this.data.set(t,this.tail),this.tail+=t.length);else{var n=new Uint8Array(i);this.head>0||this.tail0&&(this.data.copyWithin(0,this.head,this.tail),this.tail-=this.head,this.head=0)},i.getInt8=function(){var t=this.view.getInt8(this.head);return this.head++,t},i.getUint8=function(){var t=this.view.getUint8(this.head);return this.head++,t},i.getInt16=function(){var t=this.view.getInt16(this.head,!0);return this.head+=2,t},i.getUint16=function(){var t=this.view.getUint16(this.head,!0);return this.head+=2,t},i.getInt32=function(){var t=this.view.getInt32(this.head,!0);return this.head+=4,t},i.getUint32=function(){var t=this.view.getUint32(this.head,!0);return this.head+=4,t},i.getFloat32=function(){var t=this.view.getFloat32(this.head,!0);return this.head+=4,t},i.getFloat64=function(){var t=this.view.getFloat64(this.head,!0);return this.head+=8,t},v(t,[{key:"remaining",get:function(){return this.tail-this.head}}])}(),yT=function(t){for(var e,i=[],n=1;n=mT.length)||s(r.data,mT)){t.next=9;break}throw new Error("Invalid ply header");case 9:if(-1===(a=n(r.data,_T))){t.next=12;break}return t.abrupt("break",14);case 12:t.next=4;break;case 14:if(o=new TextDecoder("ascii").decode(r.data.subarray(0,a)).split("\n").filter((function(t){return!t.startsWith("comment ")})),h=yT(o),l=h.elements,"binary_little_endian"===(c=h.format)||"binary_big_endian"===c){t.next=18;break}throw new Error("Unsupported ply format");case 18:if(r.head=a+_T.length,r.compact(),!xT(l)){t.next=24;break}return t.next=23,bT(r,l,"binary_little_endian"===c);case 23:return t.abrupt("return",t.sent);case 24:if(l.forEach((function(t){t.properties.forEach((function(e){var n=vT.get(e.type);if(n){var s=!i||i(e.name)?new n(t.count):null;e.storage=s}}))})),!ST(l)){t.next=29;break}return t.next=28,TT(r,l,"binary_little_endian"===c);case 28:return t.abrupt("return",t.sent);case 29:return t.next=31,wT(r,l,"binary_little_endian"===c);case 31:return t.abrupt("return",t.sent);case 32:case"end":return t.stop()}}),t)}))),function(t,e){return aT.apply(this,arguments)}),AT=function(t){return!0},CT=function(){function t(t,e,i){this.device=void 0,this.assets=void 0,this.maxRetries=void 0,this.device=t,this.assets=e,this.maxRetries=i}var e,i=t.prototype;return i.load=(e=m(S().mark((function t(e,i,n){var s,r,a=this;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e.load);case 2:(s=t.sent)&&s.body?ET(s.body.getReader(),null!=(r=n.data.elementFilter)?r:AT).then((function(t){var e;t.isCompressed||(null==(e=n.data.reorder)||e)&&t.reorderData();var s=new pT(a.device,t.isCompressed&&n.data.decompress?t.decompress():t);i(null,s)})).catch((function(t){i(t,null)})):i("Error loading resource",null);case 4:case"end":return t.stop()}}),t)}))),function(t,i,n){return e.apply(this,arguments)}),i.open=function(t,e){return e},t}(),MT=function(t){function e(e){var i;return(i=t.call(this,e,"gsplat")||this).parser=new CT(e.graphicsDevice,e.assets,3),i}x(e,t);var i=e.prototype;return i.load=function(t,e,i){"string"==typeof t&&(t={load:t,original:t}),this.parser.load(t,e,i)},i.open=function(t,e,i){return this.parser.open(t,e,i)},e}(vm),PT=function(){function t(){}return t.setCompressedPRS=function(t,e,i){var n,s,r=i.singleVecs,a=e.___1;a||(n=i.tripleVecs,s=e.___2);var o=a?a[0]:n[s];t.setLocalPosition(r[o],r[o+1],r[o+2]),o=a?a[1]:n[s+1],t.setLocalEulerAngles(r[o],r[o+1],r[o+2]),o=a?a[2]:n[s+2],t.setLocalScale(r[o],r[o+1],r[o+2])},t.oneCharToKey=function(t,e){var i=t.charCodeAt(0)-e.fieldFirstCode;return e.fieldArray[i]},t.multCharToKey=function(t,e){for(var i=0,n=0;n0,maxRetries:e},(function(e,n){if(e){var s="Error while loading scene JSON "+t.original;e.message?(s+=": "+e.message,e.stack&&(s+="\n"+e.stack)):s+=": "+e,i(s)}else i(e,n)}))},t}(),LT=function(t){function e(e){return t.call(this,e,"hierarchy")||this}x(e,t);var i=e.prototype;return i.load=function(t,e){DT.load(t,this.maxRetries,e)},i.open=function(t,e){this._app.systems.script.preloading=!0;var i=new IT(this._app,!1).parse(e);return this._app.systems.script.preloading=!1,i},e}(vm),kT=function(t){function e(e){var i;return(i=t.call(this,e,"html")||this).decoder=null,i}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),io.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading html resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(vm),OT=function(t){function e(e){var i;return(i=t.call(this,e,"json")||this).decoder=null,i}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i={retry:this.maxRetries>0,maxRetries:this.maxRetries};t.load.startsWith("blob:")&&(i.responseType=eo.ResponseType.JSON),io.get(t.load,i,(function(i,n){i?e("Error loading JSON resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),JSON.parse(this.decoder.decode(t))},e}(vm),FT=function(){function t(){this.removeInvalid=!0,this.valid=!0,this.enumValidators={occludeSpecular:this._createEnumValidator([0,1,2]),cull:this._createEnumValidator([_e,1,2,3]),blendType:this._createEnumValidator([0,1,2,3,4,5,6,7,8,9,10]),depthFunc:this._createEnumValidator([0,1,2,3,4,5,6,7]),shadingModel:this._createEnumValidator([0,1])}}var e=t.prototype;return e.setInvalid=function(t,e){this.valid=!1,this.removeInvalid&&delete e[t]},e.validate=function(t){var e=Ac,i=Ic,n="path"===t.mappingFormat;for(var s in t){var r=e[s];if(r)if(r.startsWith("enum")){var a=r.split(":")[1];this.enumValidators[a]&&(this.enumValidators[a](t[s])||this.setInvalid(s,t))}else if("number"===r)"number"!=typeof t[s]&&this.setInvalid(s,t);else if("boolean"===r)"boolean"!=typeof t[s]&&this.setInvalid(s,t);else if("string"===r)"string"!=typeof t[s]&&this.setInvalid(s,t);else if("vec2"===r)t[s]instanceof Array&&2===t[s].length||this.setInvalid(s,t);else if("rgb"===r)t[s]instanceof Array&&3===t[s].length||this.setInvalid(s,t);else if("texture"===r)n?"string"!=typeof t[s]&&null!==t[s]&&(t[s]instanceof dr||this.setInvalid(s,t)):"number"!=typeof t[s]&&null!==t[s]&&(t[s]instanceof dr||this.setInvalid(s,t));else if("boundingbox"===r)t[s].center&&t[s].center instanceof Array&&3===t[s].center.length||this.setInvalid(s,t),t[s].halfExtents&&t[s].halfExtents instanceof Array&&3===t[s].halfExtents.length||this.setInvalid(s,t);else if("cubemap"===r)"number"!=typeof t[s]&&null!==t[s]&&void 0!==t[s]&&(t[s]instanceof dr&&t[s].cubemap||this.setInvalid(s,t));else if("chunks"===r)for(var o=Object.keys(t[s]),h=0;h=0}},t}(),BT=function(){function t(){this._validator=null}var e=t.prototype;return e.parse=function(t){var e=this.migrate(t),i=this._validate(e),n=new Oc;return this.initialize(n,i),n},e.initialize=function(t,e){for(var i in e.validated||(e=this._validate(e)),e.chunks&&(t.chunks=y({},e.chunks)),e){var n=Ac[i],s=e[i];if("vec2"===n)t[i]=new It(s[0],s[1]);else if("rgb"===n)t[i]=new vt(s[0],s[1],s[2]);else if("texture"===n)s instanceof dr?t[i]=s:t[i]instanceof dr&&"number"==typeof s&&s>0||(t[i]=null);else if("cubemap"===n)s instanceof dr?t[i]=s:t[i]instanceof dr&&"number"==typeof s&&s>0||(t[i]=null),"cubeMap"!==i||s||(t.prefilteredCubemaps=null);else if("boundingbox"===n){var r=new Ct(s.center[0],s.center[1],s.center[2]),a=new Ct(s.halfExtents[0],s.halfExtents[1],s.halfExtents[2]);t[i]=new qt(r,a)}else t[i]=e[i]}t.update()},e.migrate=function(t){var e;void 0===t.shadingModel&&("blinn"===t.shader?t.shadingModel=1:t.shadingModel=0),t.shader&&delete t.shader,t.mapping_format&&(t.mappingFormat=t.mapping_format,delete t.mapping_format);var i=[["bumpMapFactor","bumpiness"],["aoUvSet","aoMapUv"],["aoMapVertexColor","aoVertexColor"],["diffuseMapVertexColor","diffuseVertexColor"],["emissiveMapVertexColor","emissiveVertexColor"],["specularMapVertexColor","specularVertexColor"],["metalnessMapVertexColor","metalnessVertexColor"],["opacityMapVertexColor","opacityVertexColor"],["glossMapVertexColor","glossVertexColor"],["lightMapVertexColor","lightVertexColor"],["diffuseMapTint","diffuseTint"],["specularMapTint","specularTint"],["emissiveMapTint","emissiveTint"],["metalnessMapTint","metalnessTint"],["clearCoatGlossiness","clearCoatGloss"]];for(e=0;e0,maxRetries:this.maxRetries},(function(i,n){i?e&&e("Error loading material: "+t.original+" ["+i+"]"):e&&(n._engine=!0,e(null,n))}))},i.open=function(t,e){var i=this._parser.parse(e);return e._engine&&(i._data=e,delete e._engine),i},i._createPlaceholders=function(){this._placeholderTextures={};var t={white:[255,255,255,255],gray:[128,128,128,255],black:[0,0,0,255],normal:[128,128,255,255]};for(var e in t)if(t.hasOwnProperty(e)){this._placeholderTextures[e]=new dr(this._device,{width:2,height:2,format:7,name:"material_placeholder"});for(var i=this._placeholderTextures[e].lock(),n=0;n<4;n++)for(var s=0;s<4;s++)i[4*n+s]=t[e][s];this._placeholderTextures[e].unlock()}},i.patch=function(t,e){t.resource._data&&(t._data=t.resource._data,delete t.resource._data),t.data.name=t.name,t.resource.name=t.name,this._bindAndAssignAssets(t,e),t.off("unload",this._onAssetUnload,this),t.on("unload",this._onAssetUnload,this)},i._onAssetUnload=function(t){delete t.data.parameters,delete t.data.chunks,delete t.data.name},i._assignTexture=function(t,e,i){e.resource[t]=i},i._getPlaceholderTexture=function(t){this._placeholderTextures||this._createPlaceholders();var e=NT[t];return this._placeholderTextures[e]},i._assignPlaceholderTexture=function(t,e){e.resource[t]=this._getPlaceholderTexture(t)},i._onTextureLoad=function(t,e,i){this._assignTexture(t,e,i.resource),e.resource.update()},i._onTextureAdd=function(t,e,i){this._assets.load(i)},i._onTextureRemoveOrUnload=function(t,e,i){var n=e.resource;n&&e.resource[t]===i.resource&&(this._assignPlaceholderTexture(t,e),n.update())},i._assignCubemap=function(t,e,i){if(e.resource[t]=i[0],"cubeMap"===t){var n=i.slice(1);n.every((function(t){return t}))?e.resource.prefilteredCubemaps=n:n[0]&&(e.resource.envAtlas=n[0])}},i._onCubemapLoad=function(t,e,i){this._assignCubemap(t,e,i.resources),this._parser.initialize(e.resource,e.data)},i._onCubemapAdd=function(t,e,i){0===e.data.shadingModel&&(e.loadFaces=!0),this._assets.load(i)},i._onCubemapRemoveOrUnload=function(t,e,i){var n=e.resource;e.data.prefilteredCubeMap128===i.resources[1]&&(this._assignCubemap(t,e,[null,null,null,null,null,null,null]),n.update())},i._bindAndAssignAssets=function(t,e){var i,n,s,r=this._parser.migrate(t.data),a=t.resource,o="path"===r.mappingFormat,h=Cc;for(i=0;i0&&(h>65535&&this._device.extUintElement?(s=new Qr(this._device,2,a),r=new Uint32Array(s.lock())):(s=new Qr(this._device,1,a),r=new Uint16Array(s.lock()))),{buffer:s,data:r}},e._parseMeshes=function(t,e,i,n,s,r){for(var a=t.model,o=[],h=0,l=0;l0,maxRetries:this.maxRetries};(t.load.startsWith("blob:")||t.load.startsWith("data:"))&&(".glb"===D.getExtension(t.original).toLowerCase()?s.responseType=eo.ResponseType.ARRAY_BUFFER:s.responseType=eo.ResponseType.JSON),io.get(t.load,s,(function(s,r){if(e)if(s)e("Error loading model: "+t.original+" ["+s+"]");else{for(var a=0;a0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading shader resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(vm);function JT(t){this.resource&&(this.resource.atlas=t.resource)}function $T(t){this.registry.load(t)}var tw=function(t){function e(e){var i;return(i=t.call(this,e,"sprite")||this)._assets=e.assets,i._device=e.graphicsDevice,i}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),".json"===D.getExtension(t.original)&&io.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(t,i){t?e(t):e(null,i)}))},i.open=function(t,e){var i=new Yf(this._device);return t&&(i.__data=e),i},i.patch=function(t,e){var i=t.resource;if(i.__data&&(t.data.pixelsPerUnit=i.__data.pixelsPerUnit,t.data.renderMode=i.__data.renderMode,t.data.frameKeys=i.__data.frameKeys,i.__data.textureAtlasAsset)){var n=e.getByUrl(i.__data.textureAtlasAsset);n?t.data.textureAtlasAsset=n.id:console.warn("Could not find textureatlas with url: "+i.__data.textureAtlasAsset)}i.startUpdate(),i.renderMode=t.data.renderMode,i.pixelsPerUnit=t.data.pixelsPerUnit,i.frameKeys=t.data.frameKeys,this._updateAtlas(t),i.endUpdate(),t.off("change",this._onAssetChange,this),t.on("change",this._onAssetChange,this)},i._updateAtlas=function(t){var e=t.resource;if(t.data.textureAtlasAsset){this._assets.off("load:"+t.data.textureAtlasAsset,JT,t),this._assets.on("load:"+t.data.textureAtlasAsset,JT,t);var i=this._assets.get(t.data.textureAtlasAsset);i&&i.resource?e.atlas=i.resource:i?this._assets.load(i):(this._assets.off("add:"+t.data.textureAtlasAsset,$T,t),this._assets.on("add:"+t.data.textureAtlasAsset,$T,t))}else e.atlas=null},i._onAssetChange=function(t,e,i,n){"data"===e&&i&&i.textureAtlasAsset&&n&&i.textureAtlasAsset!==n.textureAtlasAsset&&(this._assets.off("load:"+n.textureAtlasAsset,JT,t),this._assets.off("add:"+n.textureAtlasAsset,$T,t))},e}(vm),ew=function(){function t(t,e){this._app=void 0,this._data=void 0,this._templateRoot=null,this._app=t,this._data=e}var e=t.prototype;return e.instantiate=function(){return this._templateRoot||this._parseTemplate(),this._templateRoot.clone()},e._parseTemplate=function(){var t=new IT(this._app,!0);this._templateRoot=t.parse(this._data)},t}(),iw=function(t){function e(e){var i;return(i=t.call(this,e,"template")||this).decoder=null,i}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i={retry:this.maxRetries>0,maxRetries:this.maxRetries};io.get(t.load,i,(function(i,n){i?e("Error requesting template: "+t.original):e(i,n)}))},i.open=function(t,e){return new ew(this._app,e)},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),new ew(this._app,JSON.parse(this.decoder.decode(t)))},e}(vm),nw=function(t){function e(e){var i;return(i=t.call(this,e,"text")||this).decoder=null,i}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),io.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading text resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(vm),sw={repeat:0,clamp:1,mirror:2},rw={nearest:0,linear:1,nearest_mip_nearest:2,linear_mip_nearest:4,nearest_mip_linear:3,linear_mip_linear:5},aw=/^data\.frames\.(\d+)$/,ow=function(t){function e(e){var i;return(i=t.call(this,e,"textureatlas")||this)._loader=e.loader,i}x(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i=this,n=this._loader.getHandler("texture");".json"===D.getExtension(t.original)?io.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(n,s){if(n)e(n);else{var r=t.original.replace(".json",".png");i._loader.load(r,"texture",(function(t,i){t?e(t):e(null,{data:s,texture:i})}))}})):n.load(t,e)},i.open=function(t,e){var i=new Kf;if(e.texture&&e.data)i.texture=e.texture,i.__data=e.data;else{var n=this._loader.getHandler("texture").open(t,e);if(!n)return null;i.texture=n}return i},i.patch=function(t,e){if(t.resource){t.resource.__data&&(void 0!==t.resource.__data.minfilter&&(t.data.minfilter=t.resource.__data.minfilter),void 0!==t.resource.__data.magfilter&&(t.data.magfilter=t.resource.__data.magfilter),void 0!==t.resource.__data.addressu&&(t.data.addressu=t.resource.__data.addressu),void 0!==t.resource.__data.addressv&&(t.data.addressv=t.resource.__data.addressv),void 0!==t.resource.__data.mipmaps&&(t.data.mipmaps=t.resource.__data.mipmaps),void 0!==t.resource.__data.anisotropy&&(t.data.anisotropy=t.resource.__data.anisotropy),void 0!==t.resource.__data.rgbm&&(t.data.rgbm=!!t.resource.__data.rgbm),t.data.frames=t.resource.__data.frames,delete t.resource.__data);var i=t.resource.texture;if(i&&(i.name=t.name,t.data.hasOwnProperty("minfilter")&&i.minFilter!==rw[t.data.minfilter]&&(i.minFilter=rw[t.data.minfilter]),t.data.hasOwnProperty("magfilter")&&i.magFilter!==rw[t.data.magfilter]&&(i.magFilter=rw[t.data.magfilter]),t.data.hasOwnProperty("addressu")&&i.addressU!==sw[t.data.addressu]&&(i.addressU=sw[t.data.addressu]),t.data.hasOwnProperty("addressv")&&i.addressV!==sw[t.data.addressv]&&(i.addressV=sw[t.data.addressv]),t.data.hasOwnProperty("mipmaps")&&i.mipmaps!==t.data.mipmaps&&(i.mipmaps=t.data.mipmaps),t.data.hasOwnProperty("anisotropy")&&i.anisotropy!==t.data.anisotropy&&(i.anisotropy=t.data.anisotropy),t.data.hasOwnProperty("rgbm"))){var n=t.data.rgbm?vi:_i;i.type!==n&&(i.type=n)}t.resource.texture=i;var s={};for(var r in t.data.frames){var a=t.data.frames[r];s[r]={rect:new Lt(a.rect),pivot:new It(a.pivot),border:new Lt(a.border)}}t.resource.frames=s,t.off("change",this._onAssetChange,this),t.on("change",this._onAssetChange,this)}},i._onAssetChange=function(t,e,i){var n;if("data"===e||"data.frames"===e){var s={};for(var r in i.frames)n=i.frames[r],s[r]={rect:new Lt(n.rect),pivot:new It(n.pivot),border:new Lt(n.border)};t.resource.frames=s}else{var a=e.match(aw);if(a){var o=a[1];i?(t.resource.frames[o]?((n=t.resource.frames[o]).rect.set(i.rect[0],i.rect[1],i.rect[2],i.rect[3]),n.pivot.set(i.pivot[0],i.pivot[1]),n.border.set(i.border[0],i.border[1],i.border[2],i.border[3])):t.resource.frames[o]={rect:new Lt(i.rect),pivot:new It(i.pivot),border:new Lt(i.border)},t.resource.fire("set:frame",o,t.resource.frames[o])):t.resource.frames[o]&&(delete t.resource.frames[o],t.resource.fire("remove:frame",o))}}},e}(vm);function hw(){var t,e,i,n=0,s=1,r=2,a=3,o=8,h=9,l=10,c=11,u=12,d=13,f=14,p=16,m={astc:l,dxt:r,etc1:n,etc2:n,pvr:o,atc:c,none:f},_={astc:l,dxt:a,etc1:p,etc2:s,pvr:h,atc:u,none:p},v=21,g=22,y=23,x=8,S=10,b=26,T=27,w=28,E=29,A=30,C=7,M=3,P=5,R=function(t,e){switch(t){case n:return e.formats.etc1?v:g;case s:return y;case r:return x;case a:return S;case o:return b;case h:return T;case l:return w;case c:return E;case u:return A;case d:return C;case f:return M;case p:return P}},I=function(t){for(var e=function(t,e){var i=t*(2/255)-1,n=e*(2/255)-1,s=Math.sqrt(1-Math.min(1,i*i+n*n));return Math.max(0,Math.min(255,Math.floor(.5*(s+1)*255)))},i=0;i>3}return e},L=function(){return"undefined"!=typeof performance?performance.now():0},k=function(t,n,s){if(s){if(t.formats.astc)return"astc"}else if(n){if(t.formats.etc2)return"etc2"}else if(t.formats.etc1||t.formats.etc2)return"etc1";return function(e){for(var i=0;i0,maxRetries:t.maxRetries};if(t.glueUrl&&t.wasmUrl&&function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1}()){var r=null,a=null;io.get(t.glueUrl,s,(function(t,i){t?e(t):a?n(i,a):r=i}));var o=fetch(t.wasmUrl),h=function(){o.then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.compile(t)})).then((function(t){r?n(r,t):a=t})).catch((function(t){e(t,null)}))};WebAssembly.compileStreaming?WebAssembly.compileStreaming(o).then((function(t){r?n(r,t):a=t})).catch((function(t){h()})):h()}else io.get(t.fallbackUrl,s,(function(t,i){t?e(t,null):n(i,null)}))},uw=function(){function t(){this.callbacks={},this.queue=[],this.clients=[]}var e=t.prototype;return e.enqueueJob=function(t,e,i,n){if(this.callbacks.hasOwnProperty(t))this.callbacks[t].push(i);else{this.callbacks[t]=[i];var s={url:t,data:e,options:n};this.clients.length>0?this.clients.shift().run(s):this.queue.push(s)}},e.enqueueClient=function(t){this.queue.length>0?t.run(this.queue.shift()):this.clients.push(t)},e.handleResponse=function(t,e,i){var n=this.callbacks[t];if(e)for(var s=0;s0&&++a<=o){var i=100*Math.pow(2,a);console.log("Error loading Texture from: '"+e+"' - Retrying in "+i+"ms...");var h=t.indexOf("?")>=0?"&":"?";r=setTimeout((function(){s.src=t+h+"retry="+Date.now(),r=null}),i)}else n("Error loading Texture from: '"+e+"'")},s.src=t},i._loadImageBitmap=function(t,e,i,n){var s=this,r={cache:!0,responseType:"blob",retry:this.maxRetries>0,maxRetries:this.maxRetries};io.get(t,r,(function(t,e){t?n(t):s._loadImageBitmapFromBlob(e,n)}))},i._loadImageBitmapFromBlob=function(t,e){createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(t){return e(null,t)})).catch((function(t){return e(t)}))},e}(Tw),Aw=[1481919403,3140563232,169478669],Cw={33776:8,33778:9,33779:ve,36196:Ae,37492:22,37496:23,35840:Pe,35841:Ce,35842:Re,35843:Me,32849:6,32856:7,35905:19,35907:20,35898:Ee,34843:ge,34842:ye};var Mw=function(t){function e(e){var i;return(i=t.call(this)||this).maxRetries=0,i}x(e,t);var i=e.prototype;return i.load=function(t,e,i){cm.fetchArrayBuffer(t.load,e,i,this.maxRetries)},i.open=function(t,e,i,n){void 0===n&&(n={});var s=this.parse(e);if(!s)return null;var r=new dr(i,y({name:t,addressU:s.cubemap?1:0,addressV:s.cubemap?1:0,width:s.width,height:s.height,format:s.format,cubemap:s.cubemap,levels:s.levels},n));return r.upload(),r},i.parse=function(t){var e=new Uint32Array(t);if(Aw[0]!==e[0]||Aw[1]!==e[1]||Aw[2]!==e[2])return null;var i={endianness:e[3],glType:e[4],glTypeSize:e[5],glFormat:e[6],glInternalFormat:e[7],glBaseInternalFormat:e[8],pixelWidth:e[9],pixelHeight:e[10],pixelDepth:e[11],numberOfArrayElements:e[12],numberOfFaces:e[13],numberOfMipmapLevels:e[14],bytesOfKeyValueData:e[15]};if(i.pixelDepth>1)return null;if(0!==i.numberOfArrayElements)return null;var n=Cw[i.glInternalFormat];if(void 0===n)return null;for(var s,r,a,o=16+i.bytesOfKeyValueData/4,h=i.numberOfFaces>1,l=[],c=0;c<(i.numberOfMipmapLevels||1);c++){var u=e[o++];h&&l.push([]);for(var d=h?l[c]:l,f=0;f<(h?6:1);++f)d.push((s=t,r=4*o,a=u,n===Ee?new Uint32Array(s,r,a/4):new Uint8Array(s,r,a))),o+=u+3>>2}return{format:n,width:i.pixelWidth,height:i.pixelHeight,levels:l,cubemap:h}},e}(Tw),Pw=166,Rw=function(t){function e(e,i){var n;return(n=t.call(this)||this).maxRetries=0,n.device=i,n}x(e,t);var i=e.prototype;return i.load=function(t,e,i){var n=this;cm.fetchArrayBuffer(t.load,(function(s,r){s?e(s,r):n.parse(r,t,e,i)}),i,this.maxRetries)},i.open=function(t,e,i,n){void 0===n&&(n={});var s=new dr(i,y({name:t,addressU:e.cubemap?1:0,addressV:e.cubemap?1:0,width:e.width,height:e.height,format:e.format,cubemap:e.cubemap,levels:e.levels},n));return s.upload(),s},i.parse=function(t,e,i,n){var s=new lt(t),r=[s.readU32be(),s.readU32be(),s.readU32be()];if(2873840728!==r[0]||540160187!==r[1]||218765834!==r[2])return null;for(var a={vkFormat:s.readU32(),typeSize:s.readU32(),pixelWidth:s.readU32(),pixelHeight:s.readU32(),pixelDepth:s.readU32(),layerCount:s.readU32(),faceCount:s.readU32(),levelCount:s.readU32(),supercompressionScheme:s.readU32()},o={dfdByteOffset:s.readU32(),dfdByteLength:s.readU32(),kvdByteOffset:s.readU32(),kvdByteLength:s.readU32(),sgdByteOffset:s.readU64(),sgdByteLength:s.readU64()},h=[],l=0;l1},n));for(var T,w=128,E=d?6:1,A=c===f?8:16,C=0;C32767)return this._readPixelsFlat(t,e,i);var s=[0,0,0,0];if(t.readArray(s),2!==s[0]||2!==s[1]||128&s[2])return t.skip(-4),this._readPixelsFlat(t,e,i);var r,a,o,h,l,c,u=new ArrayBuffer(e*i*4),d=new Uint8Array(u),f=n?0:4*e*(i-1);for(a=0;a128){if(r+(l-=128)>e)return null;for(c=t.readU8(),o=0;oe)return null;for(o=0;o=0?t.split("?")[0]:t},i._getParser=function(t){var e=D.getExtension(this._getUrlWithoutParams(t)).toLowerCase().replace(".","");return this.parsers[e]||this.imgParser},i._getTextureOptions=function(t){var e={};if(t){var i;(null==(i=t.name)?void 0:i.length)>0&&(e.name=t.name);var n=t.data;n.hasOwnProperty("minfilter")&&(e.minFilter=kw[n.minfilter]),n.hasOwnProperty("magfilter")&&(e.magFilter=kw[n.magfilter]),n.hasOwnProperty("addressu")&&(e.addressU=Lw[n.addressu]),n.hasOwnProperty("addressv")&&(e.addressV=Lw[n.addressv]),n.hasOwnProperty("mipmaps")&&(e.mipmaps=n.mipmaps),n.hasOwnProperty("anisotropy")&&(e.anisotropy=n.anisotropy),n.hasOwnProperty("flipY")&&(e.flipY=!!n.flipY),n.hasOwnProperty("type")?e.type=Ow[n.type]:n.hasOwnProperty("rgbm")&&n.rgbm?e.type=vi:t.file&&8&t.file.opt&&(e.type=xi)}return e},i.load=function(t,e,i){"string"==typeof t&&(t={load:t,original:t}),this._getParser(t.original).load(t,e,i)},i.open=function(t,e,i){if(t){var n=this._getTextureOptions(i),s=this._getParser(t).open(t,e,this._device,n);return null===s?s=new dr(this._device,{width:4,height:4,format:6}):(!function(t){var e=Cs.calcMipLevelsCount(t._width,t._height);if(!(7!==t._format&&t._format!==Se||t._volume||t._compressed||1===t._levels.length||t._levels.length===e||(i=t._cubemap?t._levels[0][0]:t._levels[0],i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement))){for(var i,n=function(t,e,i){for(var n=Math.max(1,t>>1),s=Math.max(1,e>>1),r=new i.constructor(n*s*4),a=Math.floor(t/n),o=Math.floor(e/s),h=a*o,l=0;l>s-1),a=Math.max(1,t._height>>s-1);if(t._cubemap){for(var o=[],h=0;h<6;++h)o.push(n(r,a,t._levels[s-1][h]));t._levels.push(o)}else t._levels.push(n(r,a,t._levels[s-1]))}t._levelsUpdated=t._cubemap?[[!0,!0,!0,!0,!0,!0]]:[!0]}}(s),e.unswizzledGGGR&&(i.file.variants.basis.opt&=-9)),s}},i.patch=function(t,e){var i=t.resource;if(i)for(var n=this._getTextureOptions(t),s=0,r=Object.keys(n);s=a||(a=d,o=t[c],h.copy(u.transform.position),l.copy(u.transform.orientation))}this.fire("result",h,l,e||this._inputSource,o),this.manager.hitTest.fire("result",this,h,l,e||this._inputSource,o),Yw.push(r),Yw.push(h),Kw.push(l)}},e}(P);Zw.EVENT_REMOVE="remove",Zw.EVENT_RESULT="result";var Qw=function(t){function e(e){var i;return(i=t.call(this)||this).manager=void 0,i._supported=G.browser&&!(!window.XRSession||!window.XRSession.prototype.requestHitTestSource),i._available=!1,i._checkingAvailability=!1,i.sources=[],i.manager=e,i._supported&&(i.manager.on("start",i._onSessionStart,i),i.manager.on("end",i._onSessionEnd,i)),i}x(e,t);var i=e.prototype;return i._onSessionStart=function(){var t=this;if(this.manager.session.enabledFeatures){var e=-1!==this.manager.session.enabledFeatures.indexOf("hit-test");if(!e)return;this._available=e,this.fire("available")}else this._checkingAvailability||(this._checkingAvailability=!0,this.manager.session.requestReferenceSpace(zw).then((function(e){t.manager.session.requestHitTestSource({space:e}).then((function(e){e.cancel(),t.manager.active&&(t._available=!0,t.fire("available"))})).catch((function(){}))})).catch((function(){})))},i._onSessionEnd=function(){if(this._available){this._available=!1;for(var t=0;t0&&(cE.sub2(this._localPosition,this._localPositionLast).divScalar(s),this._linearVelocity.lerp(this._linearVelocity,cE,.15))}else this._velocitiesAvailable=!1}var r=t.getPose(this._xrInputSource.targetRaySpace,this._manager._referenceSpace);r&&(this._dirtyRay=!0,this._rayLocal.origin.copy(r.transform.position),this._rayLocal.direction.set(0,0,-1),uE.copy(r.transform.orientation),uE.transformVector(this._rayLocal.direction,this._rayLocal.direction))}},i._updateTransforms=function(){this._dirtyLocal&&(this._dirtyLocal=!1,this._localTransform.setTRS(this._localPosition,this._localRotation,Ct.ONE));var t=this._manager.camera.parent;t?this._worldTransform.mul2(t.getWorldTransform(),this._localTransform):this._worldTransform.copy(this._localTransform)},i._updateRayTransforms=function(){var t=this._dirtyRay;if(this._dirtyRay=!1,this._manager.camera.parent){var e=this._manager.camera.parent.getWorldTransform();e.getTranslation(this._position),this._rotation.setFromMat4(e),this._rotation.transformVector(this._rayLocal.origin,this._ray.origin),this._ray.origin.add(this._position),this._rotation.transformVector(this._rayLocal.direction,this._ray.direction)}else t&&(this._ray.origin.copy(this._rayLocal.origin),this._ray.direction.copy(this._rayLocal.direction))},i.getPosition=function(){return this._position?(this._updateTransforms(),this._worldTransform.getTranslation(this._position),this._position):null},i.getLocalPosition=function(){return this._localPosition},i.getRotation=function(){return this._rotation?(this._updateTransforms(),this._rotation.setFromMat4(this._worldTransform),this._rotation):null},i.getLocalRotation=function(){return this._localRotation},i.getLinearVelocity=function(){return this._velocitiesAvailable?this._linearVelocity:null},i.getOrigin=function(){return this._updateRayTransforms(),this._ray.origin},i.getDirection=function(){return this._updateRayTransforms(),this._ray.direction},i.hitTestStart=function(t){var e=this;void 0===t&&(t={}),t.inputSource=this,t.profile=this._xrInputSource.profiles[0];var i=t.callback;t.callback=function(t,n){n&&e.onHitTestSourceAdd(n),i&&i(t,n)},this._manager.hitTest.start(t)},i.onHitTestSourceAdd=function(t){var e=this;this._hitTestSources.push(t),this.fire("hittest:add",t),t.on("result",(function(i,n,s,r){s===e&&e.fire("hittest:result",t,i,n,r)})),t.once("remove",(function(){e.onHitTestSourceRemove(t),e.fire("hittest:remove",t)}))},i.onHitTestSourceRemove=function(t){var e=this._hitTestSources.indexOf(t);-1!==e&&this._hitTestSources.splice(e,1)},v(e,[{key:"id",get:function(){return this._id}},{key:"inputSource",get:function(){return this._xrInputSource}},{key:"targetRayMode",get:function(){return this._xrInputSource.targetRayMode}},{key:"handedness",get:function(){return this._xrInputSource.handedness}},{key:"profiles",get:function(){return this._xrInputSource.profiles}},{key:"grip",get:function(){return this._grip}},{key:"hand",get:function(){return this._hand}},{key:"gamepad",get:function(){return this._xrInputSource.gamepad||null}},{key:"selecting",get:function(){return this._selecting}},{key:"squeezing",get:function(){return this._squeezing}},{key:"elementInput",get:function(){return this._elementInput},set:function(t){this._elementInput!==t&&(this._elementInput=t,this._elementInput||(this._elementEntity=null))}},{key:"elementEntity",get:function(){return this._elementEntity}},{key:"hitTestSources",get:function(){return this._hitTestSources}}])}(P);fE.EVENT_REMOVE="remove",fE.EVENT_SELECT="select",fE.EVENT_SELECTSTART="selectstart",fE.EVENT_SELECTEND="selectend",fE.EVENT_SQUEEZE="squeeze",fE.EVENT_SQUEEZESTART="squeezestart",fE.EVENT_SQUEEZEEND="squeezeend",fE.EVENT_HITTESTADD="hittest:add",fE.EVENT_HITTESTREMOVE="hittest:remove",fE.EVENT_HITTESTRESULT="hittest:result";var pE=function(t){function e(e){var i,n;return(n=t.call(this)||this).manager=void 0,n._inputSources=[],n._onInputSourcesChangeEvt=void 0,n.velocitiesSupported=!1,n.manager=e,n.velocitiesSupported=!(!G.browser||null==(i=window.XRPose)||null==(i=i.prototype)||!i.hasOwnProperty("linearVelocity")),n._onInputSourcesChangeEvt=function(t){n._onInputSourcesChange(t)},n.manager.on("start",n._onSessionStart,n),n.manager.on("end",n._onSessionEnd,n),n}x(e,t);var i=e.prototype;return i._onSessionStart=function(){var t=this,e=this.manager.session;e.addEventListener("inputsourceschange",this._onInputSourcesChangeEvt),e.addEventListener("select",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i.fire("select",e),t.fire("select",i,e)})),e.addEventListener("selectstart",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._selecting=!0,i.fire("selectstart",e),t.fire("selectstart",i,e)})),e.addEventListener("selectend",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._selecting=!1,i.fire("selectend",e),t.fire("selectend",i,e)})),e.addEventListener("squeeze",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i.fire("squeeze",e),t.fire("squeeze",i,e)})),e.addEventListener("squeezestart",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._squeezing=!0,i.fire("squeezestart",e),t.fire("squeezestart",i,e)})),e.addEventListener("squeezeend",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._squeezing=!1,i.fire("squeezeend",e),t.fire("squeezeend",i,e)}));for(var i=e.inputSources,n=0;n0){var o=new zt,h=this.views.list[0];o.copy(h.projMat);var l=o.data,c=2*Math.atan(1/l[5])*180/Math.PI,u=l[5]/l[0],d=l[14]/(l[10]+1),f=l[14]/(l[10]-1);this._camera.camera.setXrProperties({aspectRatio:u,farClip:d,fov:c,horizontalFov:!1,nearClip:f})}return this._camera.camera._node.setLocalPosition(this._localPosition),this._camera.camera._node.setLocalRotation(this._localRotation),this.input.update(t),this._type===Uw&&(this.hitTest.supported&&this.hitTest.update(t),this.lightEstimation.supported&&this.lightEstimation.update(t),this.imageTracking.supported&&this.imageTracking.update(t),this.anchors.supported&&this.anchors.update(t),this.planeDetection.supported&&this.planeDetection.update(t),this.depthSensing.supported&&this.depthSensing.update(),this.meshDetection.supported&&this.meshDetection.update(t)),this.fire("update",t),!0},v(e,[{key:"supported",get:function(){return this._supported}},{key:"active",get:function(){return!!this._session}},{key:"type",get:function(){return this._type}},{key:"spaceType",get:function(){return this._spaceType}},{key:"session",get:function(){return this._session}},{key:"frameRate",get:function(){var t,e;return null!=(t=null==(e=this._session)?void 0:e.frameRate)?t:null}},{key:"supportedFrameRates",get:function(){return this._supportedFrameRates}},{key:"framebufferScaleFactor",get:function(){return this._framebufferScaleFactor}},{key:"fixedFoveation",get:function(){var t,e;return null!=(t=null==(e=this._baseLayer)?void 0:e.fixedFoveation)?t:null},set:function(t){var e,i;null!==(null!=(e=null==(i=this._baseLayer)?void 0:i.fixedFoveation)?e:null)&&(this.app.graphicsDevice.samples,this._baseLayer.fixedFoveation=t)}},{key:"camera",get:function(){return this._camera?this._camera.entity:null}},{key:"visibilityState",get:function(){return this._session?this._session.visibilityState:null}}])}(P);PE.EVENT_AVAILABLE="available",PE.EVENT_START="start",PE.EVENT_END="end",PE.EVENT_UPDATE="update",PE.EVENT_ERROR="error";var RE,IE,DE=function(t){function e(e,i){var n,s;void 0===i&&(i={}),s=t.call(this,e)||this;var r=new Lm;return r.graphicsDevice=null!=(n=i.graphicsDevice)?n:s.createDevice(e,i),s.addComponentSystems(r),s.addResourceHandles(r),r.elementInput=i.elementInput,r.keyboard=i.keyboard,r.mouse=i.mouse,r.touch=i.touch,r.gamepads=i.gamepads,r.scriptPrefix=i.scriptPrefix,r.assetPrefix=i.assetPrefix,r.scriptsOrder=i.scriptsOrder,r.soundManager=new co,r.lightmapper=Wm,r.batchManager=$h,r.xr=PE,s.init(r),s}x(e,t);var i=e.prototype;return i.createDevice=function(t,e){return e.graphicsDeviceOptions||(e.graphicsDeviceOptions={}),G.browser&&navigator.xr&&(e.graphicsDeviceOptions.xrCompatible=!0),e.graphicsDeviceOptions.alpha=e.graphicsDeviceOptions.alpha||!1,new Vr(t,e.graphicsDeviceOptions)},i.addComponentSystems=function(t){t.componentSystems=[ex,eg,Yg,L_,tv,xy,By,lS,fS,jp.legacy?gx:PS,hv,Gx,sv,Py,hx,Ug,Cv,Dx,Fx,$x,py,Jg,nS,kS]},i.addResourceHandles=function(t){t.resourceHandlers=[US,Wb,Xb,jb,WT,UT,Fw,nw,OT,Kb,ZT,XT,iT,kT,eT,QT,LT,nT,oT,Zb,ow,tw,iw,tT,MT]},e}(Rm),LE=function(t){function e(e,i){var n;return(n=t.call(this)||this)._assets=new Set,n._loadingAssets=new Set,n._waitingAssets=new Set,n._registry=i,n._loading=!1,n._loaded=!1,n._failed=[],e.forEach((function(t){if(t instanceof cm)t.registry||(t.registry=i),n._assets.add(t);else{var e=i.get(t);e?n._assets.add(e):n._waitForAsset(t)}})),n}x(e,t);var i=e.prototype;return i.destroy=function(){var t=this;this._registry.off("load",this._onLoad),this._registry.off("error",this._onError),this._waitingAssets.forEach((function(e){t._registry.off("add:"+e,this._onAddAsset)})),this.off("progress"),this.off("load")},i._assetHasDependencies=function(t){var e;return"model"===t.type&&(null==(e=t.file)?void 0:e.url)&&t.file.url&&t.file.url.match(/.json$/g)},i.load=function(t,e){var i=this;if(!this._loading){this._loading=!0,this._callback=t,this._scope=e,this._registry.on("load",this._onLoad,this),this._registry.on("error",this._onError,this);var n=!1;this._assets.forEach((function(t){t.loaded||(n=!0,i._assetHasDependencies(t)&&i._registry.loadFromUrl(t.file.url,t.type,(function(e,n){e?i._onError(e,t):i._onLoad(t)})),i._loadingAssets.add(t),i._registry.add(t))})),this._loadingAssets.forEach((function(t){i._assetHasDependencies(t)||i._registry.load(t)})),n||0!==this._waitingAssets.size||this._loadingComplete()}},i.ready=function(t,e){void 0===e&&(e=this),this._loaded?t.call(e,Array.from(this._assets)):this.once("load",(function(i){t.call(e,i)}))},i._loadingComplete=function(){this._loaded||(this._loaded=!0,this._registry.off("load",this._onLoad,this),this._registry.off("error",this._onError,this),this._failed.length?(this._callback&&this._callback.call(this._scope,"Failed to load some assets",this._failed),this.fire("error",this._failed)):(this._callback&&this._callback.call(this._scope),this.fire("load",Array.from(this._assets))))},i._onLoad=function(t){var e=this;this._loadingAssets.has(t)&&(this.fire("progress",t),this._loadingAssets.delete(t)),0===this._loadingAssets.size&&setTimeout((function(){e._loadingComplete(e._failed)}),0)},i._onError=function(t,e){var i=this;this._loadingAssets.has(e)&&(this._failed.push(e),this._loadingAssets.delete(e)),0===this._loadingAssets.size&&setTimeout((function(){i._loadingComplete(i._failed)}),0)},i._onAddAsset=function(t){this._waitingAssets.delete(t),this._assets.add(t),t.loaded||(this._loadingAssets.add(t),this._registry.load(t))},i._waitForAsset=function(t){this._waitingAssets.add(t),this._registry.once("add:"+t,this._onAddAsset,this)},e}(P),kE=function(){function t(t,e,i,n){this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=i,this.texture=new dr(t,{name:n,format:7,width:e,height:i,mipmaps:!0,minFilter:5,magFilter:1,addressU:1,addressV:1,levels:[this.canvas]}),this.ctx=this.canvas.getContext("2d",{alpha:!0})}var e=t.prototype;return e.destroy=function(){this.texture.destroy()},e.clear=function(t){var e=this.canvas,i=e.width,n=e.height;this.ctx.clearRect(0,0,i,n),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,i,n)},t}(),OE=function(t){function e(e,i){var n;return void 0===i&&(i={}),(n=t.call(this)||this).type="bitmap",n.app=e,n.intensity=0,n.fontWeight=i.fontWeight||"normal",n.fontSize=parseInt(i.fontSize,10),n.glyphSize=n.fontSize,n.fontName=i.fontName||"Arial",n.color=i.color||new vt(1,1,1),n.padding=i.padding||0,n.width=Math.min(4096,i.width||512),n.height=Math.min(4096,i.height||512),n.atlases=[],n.chars="",n.data={},n}x(e,t);var i=e.prototype;return i.createTextures=function(t){var e=this._normalizeCharsSet(t);if(e.length===this.chars.length){for(var i=0;i0&&this._renderAtlas(this.chars.concat(i))},i.destroy=function(){this.atlases.forEach((function(t){return t.destroy()})),this.chars=null,this.color=null,this.data=null,this.fontName=null,this.fontSize=null,this.glyphSize=null,this.intensity=null,this.atlases=null,this.type=null,this.fontWeight=null},i._colorToRgbString=function(t,e){var i=Math.round(255*t.r),n=Math.round(255*t.g),s=Math.round(255*t.b);return e?"rgba("+i+", "+n+", "+s+", "+t.a+")":"rgb("+i+", "+n+", "+s+")"},i.renderCharacter=function(t,e,i,n,s){t.fillStyle=s,t.fillText(e,i,n)},i._getAtlas=function(t){return t>=this.atlases.length&&(this.atlases[t]=new kE(this.app.graphicsDevice,this.width,this.height,"font-atlas-"+this.fontName+"-"+t)),this.atlases[t]},i._renderAtlas=function(t){this.chars=t;var e=this.width,i=this.height,n=this._colorToRgbString(this.color,!1),s=this.color.a;this.color.a=1/255;var r=this._colorToRgbString(this.color,!0);this.color.a=s;var a=0,o=this._getAtlas(a++);o.clear(r),this.data=this._createJson(this.chars,this.fontName,e,i);for(var h=rt.getSymbols(this.chars.join("")),l=0,c=0,u={},d=0;dT&&(T=this.fontSize*this.fontSize/w,o.ctx.font=this.fontWeight+" "+T.toString()+"px "+this.fontName,w=this.fontSize),this.renderCharacter(o.ctx,S,g+_,y+v,n);var E=this.padding+(this.glyphSize-w)/2,A=-this.padding+u[S].descent-c,C=w;this._addChar(this.data,S,b,g,y,p,m,E,A,C,a-1,e,i),(g+=p)+p>e&&(g=0,(y+=m)+m>i&&((o=this._getAtlas(a++)).clear(r),y=0))}this.atlases.splice(a).forEach((function(t){return t.destroy()})),this.atlases.forEach((function(t){return t.texture.upload()})),this.fire("render")},i._createJson=function(t,e,i,n){return{version:3,intensity:this.intensity,info:{face:e,width:i,height:n,maps:[{width:i,height:n}]},chars:{}}},i._addChar=function(t,e,i,n,s,r,a,o,h,l,c,u,d){t.info.maps.length0&&(e.setCameraUniforms(i.camera,a),e.renderForward(i.camera,FE,BE,3,(function(e){var i=e.id;u[0]=(i>>16&255)/255,u[1]=(i>>8&255)/255,u[2]=(255&i)/255,u[3]=(i>>24&255)/255,c.setValue(u),t.setBlendState(hn.NOBLEND)})),FE.length=0)}}},e}(ta),UE=new Set,zE=function(){function t(t,e,i){this.renderTarget=null,this.mapping=new Map,t instanceof Rn&&(t=Vp()),this.renderer=t.renderer,this.device=t.graphicsDevice,this.renderPass=new NE(this.device,t.renderer),this.width=0,this.height=0,this.resize(e,i)}var e=t.prototype;return e.getSelection=function(t,e,i,n){void 0===i&&(i=1),void 0===n&&(n=1);var s=this.device;e=this.renderTarget.height-(e+n),t=Math.floor(t),e=Math.floor(e),i=Math.floor(Math.max(i,1)),n=Math.floor(Math.max(n,1)),s.setRenderTarget(this.renderTarget),s.updateBegin();var r=new Uint8Array(4*i*n);s.readPixels(t,e,i,n,r),s.updateEnd();for(var a=this.mapping,o=0;o0?h.wheelDelta=1:e.deltaY<0&&(h.wheelDelta=-1)),h}return x(e,t),e}(mA),vA=function(t){function e(e,i,n,s,r,a){var o;return(o=t.call(this,e,i,n)||this).touches=e.touches,o.changedTouches=e.changedTouches,o.x=s,o.y=r,o.touch=a,o}return x(e,t),e}(mA),gA=function(t){function e(e,i,n,s){var r;return(r=t.call(this,e,i,n)||this).inputSource=s,r}return x(e,t),e}(mA),yA=function(){function t(t,e){this._app=null,this._attached=!1,this._target=null,this._enabled=!0,this._lastX=0,this._lastY=0,this._upHandler=this._handleUp.bind(this),this._downHandler=this._handleDown.bind(this),this._moveHandler=this._handleMove.bind(this),this._wheelHandler=this._handleWheel.bind(this),this._touchstartHandler=this._handleTouchStart.bind(this),this._touchendHandler=this._handleTouchEnd.bind(this),this._touchcancelHandler=this._touchendHandler,this._touchmoveHandler=this._handleTouchMove.bind(this),this._sortHandler=this._sortElements.bind(this),this._elements=[],this._hoveredElement=null,this._pressedElement=null,this._touchedElements={},this._touchesForWhichTouchLeaveHasFired={},this._selectedElements={},this._selectedPressedElements={},this._useMouse=!e||!1!==e.useMouse,this._useTouch=!e||!1!==e.useTouch,this._useXr=!e||!1!==e.useXr,this._selectEventsAttached=!1,G.touch&&(this._clickedEntities={}),this.attach(t)}var e=t.prototype;return e.attach=function(t){this._attached&&(this._attached=!1,this.detach()),this._target=t,this._attached=!0;var e=!!G.passiveEvents&&{passive:!0};this._useMouse&&(window.addEventListener("mouseup",this._upHandler,e),window.addEventListener("mousedown",this._downHandler,e),window.addEventListener("mousemove",this._moveHandler,e),window.addEventListener("wheel",this._wheelHandler,e)),this._useTouch&&G.touch&&(this._target.addEventListener("touchstart",this._touchstartHandler,e),this._target.addEventListener("touchend",this._touchendHandler,!1),this._target.addEventListener("touchmove",this._touchmoveHandler,!1),this._target.addEventListener("touchcancel",this._touchcancelHandler,!1)),this.attachSelectEvents()},e.attachSelectEvents=function(){!this._selectEventsAttached&&this._useXr&&this.app&&this.app.xr&&this.app.xr.supported&&(this._clickedEntities||(this._clickedEntities={}),this._selectEventsAttached=!0,this.app.xr.on("start",this._onXrStart,this))},e.detach=function(){if(this._attached){this._attached=!1;var t=!!G.passiveEvents&&{passive:!0};this._useMouse&&(window.removeEventListener("mouseup",this._upHandler,t),window.removeEventListener("mousedown",this._downHandler,t),window.removeEventListener("mousemove",this._moveHandler,t),window.removeEventListener("wheel",this._wheelHandler,t)),this._useTouch&&(this._target.removeEventListener("touchstart",this._touchstartHandler,t),this._target.removeEventListener("touchend",this._touchendHandler,!1),this._target.removeEventListener("touchmove",this._touchmoveHandler,!1),this._target.removeEventListener("touchcancel",this._touchcancelHandler,!1)),this._selectEventsAttached&&(this._selectEventsAttached=!1,this.app.xr.off("start",this._onXrStart,this),this.app.xr.off("end",this._onXrEnd,this),this.app.xr.off("update",this._onXrUpdate,this),this.app.xr.input.off("selectstart",this._onSelectStart,this),this.app.xr.input.off("selectend",this._onSelectEnd,this),this.app.xr.input.off("remove",this._onXrInputRemove,this)),this._target=null}},e.addElement=function(t){-1===this._elements.indexOf(t)&&this._elements.push(t)},e.removeElement=function(t){var e=this._elements.indexOf(t);-1!==e&&this._elements.splice(e,1)},e._handleUp=function(t){this._enabled&&(Fa.isPointerLocked()||(this._calcMouseCoords(t),this._onElementMouseEvent("mouseup",t)))},e._handleDown=function(t){this._enabled&&(Fa.isPointerLocked()||(this._calcMouseCoords(t),this._onElementMouseEvent("mousedown",t)))},e._handleMove=function(t){this._enabled&&(this._calcMouseCoords(t),this._onElementMouseEvent("mousemove",t),this._lastX=RE,this._lastY=IE)},e._handleWheel=function(t){this._enabled&&(this._calcMouseCoords(t),this._onElementMouseEvent("mousewheel",t))},e._determineTouchedElements=function(t){for(var e={},i=this.app.systems.camera.cameras,n=i.length-1;n>=0;n--){for(var s=i[n],r=0,a=t.changedTouches.length,o=0;o=0;d--){this._getTargetElementByCoords(e[d],u.x,u.y)===o&&(this._clickedEntities[o.entity.getGuid()]||(this._fireEvent("click",new vA(t,o,h,l,c,r)),this._clickedEntities[o.entity.getGuid()]=Date.now()))}this._fireEvent(t.type,new vA(t,o,h,l,c,r))}}}},e._handleTouchMove=function(t){if(t.preventDefault(),this._enabled)for(var e=this._determineTouchedElements(t),i=0,n=t.changedTouches.length;i=0&&(s=r[a],!(i=this._getTargetElementByCoords(s,RE,IE)));a--);if(this._hoveredElement=i,"mousemove"!==t&&"mouseup"!==t||!this._pressedElement?i&&(this._fireEvent(t,new _A(e,i,s,RE,IE,this._lastX,this._lastY)),"mousedown"===t&&(this._pressedElement=i)):this._fireEvent(t,new _A(e,this._pressedElement,s,RE,IE,this._lastX,this._lastY)),n!==this._hoveredElement&&(n&&this._fireEvent("mouseleave",new _A(e,n,s,RE,IE,this._lastX,this._lastY)),this._hoveredElement&&this._fireEvent("mouseenter",new _A(e,this._hoveredElement,s,RE,IE,this._lastX,this._lastY))),"mouseup"===t&&this._pressedElement){if(this._pressedElement===this._hoveredElement){var o=this._hoveredElement.entity.getGuid(),h=!this._clickedEntities;if(this._clickedEntities){var l=this._clickedEntities[o]||0;h=Date.now()-l>300,delete this._clickedEntities[o]}h&&this._fireEvent("click",new _A(e,this._hoveredElement,s,RE,IE,this._lastX,this._lastY))}this._pressedElement=null}},e._onXrStart=function(){this.app.xr.on("end",this._onXrEnd,this),this.app.xr.on("update",this._onXrUpdate,this),this.app.xr.input.on("selectstart",this._onSelectStart,this),this.app.xr.input.on("selectend",this._onSelectEnd,this),this.app.xr.input.on("remove",this._onXrInputRemove,this)},e._onXrEnd=function(){this.app.xr.off("update",this._onXrUpdate,this),this.app.xr.input.off("selectstart",this._onSelectStart,this),this.app.xr.input.off("selectend",this._onSelectEnd,this),this.app.xr.input.off("remove",this._onXrInputRemove,this)},e._onXrUpdate=function(){if(this._enabled)for(var t=this.app.xr.input.inputSources,e=0;e=0&&(r=o[h],!(n=this._getTargetElementByRay(jE,r)));h--);}e._elementEntity=n||null,n?(this._selectedElements[e.id]=n,s=n):delete this._selectedElements[e.id],a!==s&&(a&&this._fireEvent("selectleave",new gA(i,a,r,e)),s&&this._fireEvent("selectenter",new gA(i,s,r,e)));var l=this._selectedPressedElements[e.id];"selectmove"===t&&l&&this._fireEvent("selectmove",new gA(i,l,r,e)),"selectstart"===t&&(this._selectedPressedElements[e.id]=s,s&&this._fireEvent("selectstart",new gA(i,s,r,e))),!e.elementInput&&l&&(delete this._selectedPressedElements[e.id],a&&this._fireEvent("selectend",new gA(i,l,r,e))),"selectend"===t&&e.elementInput&&(delete this._selectedPressedElements[e.id],l&&this._fireEvent("selectend",new gA(i,l,r,e)),l&&l===a&&this._fireEvent("click",new gA(i,l,r,e)))},e._fireEvent=function(t,e){for(var i=e.element;i.fire(t,e),!e._stopPropagation&&i.entity.parent&&(i=i.entity.parent.element););},e._calcMouseCoords=function(t){var e=this._target.getBoundingClientRect(),i=Math.floor(e.left),n=Math.floor(e.top);RE=t.clientX-i,IE=t.clientY-n},e._sortElements=function(t,e){var i=this.app.scene.layers.sortTransparentLayers(t.layers,e.layers);return 0!==i?i:t.screen&&!e.screen?-1:!t.screen&&e.screen?1:t.screen||e.screen?t.screen.screen.screenSpace&&!e.screen.screen.screenSpace?-1:e.screen.screen.screenSpace&&!t.screen.screen.screenSpace?1:e.drawOrder-t.drawOrder:0},e._getTargetElementByCoords=function(t,e,i){var n=this._calculateRayScreen(e,i,t,WE)?WE:null,s=this._calculateRay3d(e,i,t,XE)?XE:null;return this._getTargetElement(t,n,s)},e._getTargetElementByRay=function(t,e){WE.origin.copy(t.origin),WE.direction.copy(t.direction),WE.end.copy(WE.direction).mulScalar(2*e.farClip).add(WE.origin);var i=WE,n=e.worldToScreen(i.origin,GE),s=this._calculateRayScreen(n.x,n.y,e,XE)?XE:null;return this._getTargetElement(e,s,i)},e._getTargetElement=function(t,e,i){var n=null,s=1/0;this._elements.sort(this._sortHandler);for(var r=0,a=this._elements.length;r=0){n=o;break}}else{if(!i)continue;var h=this._checkElement(i,o,!1);if(h>=0&&(h=h&&d<=l&&f<=c&&f>=u&&(d=s*(d-h)/a,f=r-(f=r*(f-u)/o),n.origin.set(d,f,1),n.direction.set(0,0,-1),n.end.copy(n.direction).mulScalar(2).add(n.origin),!0)},e._calculateRay3d=function(t,e,i,n){var s=this._target.clientWidth,r=this._target.clientHeight,a=i.rect.z*s,o=i.rect.w*r,h=i.rect.x*s,l=h+a,c=(1-i.rect.y)*r,u=c-o,d=t,f=e;return t>=h&&t<=l&&e<=c&&f>=u&&(d=s*(d-h)/a,f=r*(f-u)/o,i.screenToWorld(d,f,i.nearClip,GE),i.screenToWorld(d,f,i.farClip,HE),n.origin.copy(GE),n.direction.set(0,0,-1),n.end.copy(HE),!0)},e._checkElement=function(e,i,n){if(i.maskedBy&&this._checkElement(e,i.maskedBy.element,n)<0)return-1;var s;s=n?t.calculateScaleToScreen(i):t.calculateScaleToWorld(i);var r=t.buildHitCorners(i,n?i.screenCorners:i.worldCorners,s);return function(t,e,i){qE.sub2(e,t),YE.sub2(i[0],t),KE.sub2(i[1],t),ZE.sub2(i[2],t),JE.cross(ZE,qE);var n,s,r=YE.dot(JE);if(r>=0){if((n=-KE.dot(JE))<0)return-1;if((s=pA(qE,KE,YE))<0)return-1;var a=1/(n+r+s);$E.copy(i[0]).mulScalar(n*a),tA.copy(i[1]).mulScalar(r*a),eA.copy(i[2]).mulScalar(s*a),iA.copy($E).add(tA).add(eA)}else{if(QE.sub2(i[3],t),(n=QE.dot(JE))<0)return-1;if((s=pA(qE,YE,QE))<0)return-1;var o=1/(n+(r=-r)+s);$E.copy(i[0]).mulScalar(n*o),tA.copy(i[3]).mulScalar(r*o),eA.copy(i[2]).mulScalar(s*o),iA.copy($E).add(tA).add(eA)}return qE.sub2(i[0],i[2]).lengthSq()<1e-8||qE.sub2(i[1],i[3]).lengthSq()<1e-8?-1:iA.sub(t).lengthSq()}(e.origin,e.end,r)},t.buildHitCorners=function(t,e,i){var n=e;if(t.entity&&t.entity.button){var s=t.entity.button.hitPadding||fA;rA.copy(t.entity.up),aA.copy(rA).mulScalar(-1),hA.copy(t.entity.right),oA.copy(hA).mulScalar(-1),rA.mulScalar(s.w*i.y),aA.mulScalar(s.y*i.y),hA.mulScalar(s.z*i.x),oA.mulScalar(s.x*i.x),lA.copy(n[0]).add(aA).add(oA),cA.copy(n[1]).add(aA).add(hA),uA.copy(n[2]).add(rA).add(hA),dA.copy(n[3]).add(rA).add(oA),n=[lA,cA,uA,dA]}if(i.x<0){var r=n[2].x,a=n[0].x;n[0].x=r,n[1].x=a,n[2].x=a,n[3].x=r}if(i.y<0){var o=n[2].y,h=n[0].y;n[0].y=o,n[1].y=o,n[2].y=h,n[3].y=h}if(i.z<0){var l=n[2].x,c=n[2].y,u=n[2].z;n[2].x=n[0].x,n[2].y=n[0].y,n[2].z=n[0].z,n[0].x=l,n[0].y=c,n[0].z=u}return n},t.calculateScaleToScreen=function(t){var e=t.entity,i=t.screen.screen.scale;for(sA.set(i,i,i);e&&!e.screen;)sA.mul(e.getLocalScale()),e=e.parent;return sA},t.calculateScaleToWorld=function(t){var e=t.entity;for(sA.set(1,1,1);e;)sA.mul(e.getLocalScale()),e=e.parent;return sA},v(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"app",get:function(){return this._app||Vp()},set:function(t){this._app=t}}])}(),xA={write:function(t){console.log(t)},open:function(){xA.write("Powered by PlayCanvas "+o+" "+h)},info:function(t){console.info("INFO: "+t)},debug:function(t){console.debug("DEBUG: "+t)},error:function(t){console.error("ERROR: "+t)},warning:function(t){console.warn("WARNING: "+t)},alert:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){xA.write("ALERT: "+t),alert(t)})),assert:function(t,e){!1===t&&xA.write("ASSERT: "+e)}};rt.endsWith=function(t,e){return t.endsWith(e)},rt.startsWith=function(t,e){return t.startsWith(e)};var SA=function(){function t(){this._isRunning=!1,this._a=0,this._b=0}var e=t.prototype;return e.start=function(){this._isRunning=!0,this._a=dt()},e.stop=function(){this._isRunning=!1,this._b=dt()},e.getMilliseconds=function(){return this._b-this._a},t}(),bA={now:dt,Timer:SA};Object.defineProperty(vt.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(4)),this._data[0]=this.r,this._data[1]=this.g,this._data[2]=this.b,this._data[3]=this.a,this._data}}),Object.defineProperty(vt.prototype,"data3",{get:function(){return this._data3||(this._data3=new Float32Array(3)),this._data3[0]=this.r,this._data3[1]=this.g,this._data3[2]=this.b,this._data3}}),_t.INV_LOG2=Math.LOG2E,_t.intToBytes=_t.intToBytes32,_t.bytesToInt=_t.bytesToInt32,Object.defineProperty(It.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(2)),this._data[0]=this.x,this._data[1]=this.y,this._data}}),It.prototype.scale=It.prototype.mulScalar,Object.defineProperty(Ct.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(3)),this._data[0]=this.x,this._data[1]=this.y,this._data[2]=this.z,this._data}}),Ct.prototype.scale=Ct.prototype.mulScalar,Object.defineProperty(Lt.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(4)),this._data[0]=this.x,this._data[1]=this.y,this._data[2]=this.z,this._data[3]=this.w,this._data}}),Lt.prototype.scale=Lt.prototype.mulScalar;var TA={Aabb:qt,Sphere:Zt,Plane:se};Zt.prototype.intersectRay=Zt.prototype.intersectsRay,Qt.prototype.update=function(t,e){var i=new zt;i.mul2(t,e),this.setFromMat4(i)};function wA(t){this.name="UnsupportedBrowserError",this.message=t||""}function EA(t){this.name="ContextCreationError",this.message=t||""}wA.prototype=Error.prototype,EA.prototype=Error.prototype;var AA={begin:Uo.begin,dummyFragmentCode:kr.dummyFragmentCode,end:Uo.end,fogCode:Uo.fogCode,gammaCode:Uo.gammaCode,precisionCode:kr.precisionCode,skinCode:Uo.skinCode,tonemapCode:Uo.tonemapCode,versionCode:kr.versionCode},CA={ADDRESS_CLAMP_TO_EDGE:1,ADDRESS_MIRRORED_REPEAT:2,ADDRESS_REPEAT:0,BLENDMODE_ZERO:0,BLENDMODE_ONE:1,BLENDMODE_SRC_COLOR:2,BLENDMODE_ONE_MINUS_SRC_COLOR:3,BLENDMODE_DST_COLOR:4,BLENDMODE_ONE_MINUS_DST_COLOR:5,BLENDMODE_SRC_ALPHA:6,BLENDMODE_SRC_ALPHA_SATURATE:7,BLENDMODE_ONE_MINUS_SRC_ALPHA:8,BLENDMODE_DST_ALPHA:9,BLENDMODE_ONE_MINUS_DST_ALPHA:10,BUFFER_STATIC:0,BUFFER_DYNAMIC:1,BUFFER_STREAM:2,CULLFACE_NONE:_e,CULLFACE_BACK:1,CULLFACE_FRONT:2,CULLFACE_FRONTANDBACK:3,ELEMENTTYPE_INT8:0,ELEMENTTYPE_UINT8:1,ELEMENTTYPE_INT16:2,ELEMENTTYPE_UINT16:3,ELEMENTTYPE_INT32:4,ELEMENTTYPE_UINT32:5,ELEMENTTYPE_FLOAT32:6,FILTER_NEAREST:0,FILTER_LINEAR:1,FILTER_NEAREST_MIPMAP_NEAREST:2,FILTER_NEAREST_MIPMAP_LINEAR:3,FILTER_LINEAR_MIPMAP_NEAREST:4,FILTER_LINEAR_MIPMAP_LINEAR:5,INDEXFORMAT_UINT8:0,INDEXFORMAT_UINT16:1,INDEXFORMAT_UINT32:2,PIXELFORMAT_RGB565:3,PIXELFORMAT_RGB8:6,PIXELFORMAT_RGBA8:7,PRIMITIVE_POINTS:0,PRIMITIVE_LINES:1,PRIMITIVE_LINELOOP:2,PRIMITIVE_LINESTRIP:3,PRIMITIVE_TRIANGLES:4,PRIMITIVE_TRISTRIP:Be,PRIMITIVE_TRIFAN:6,SEMANTIC_POSITION:Ne,SEMANTIC_NORMAL:Ue,SEMANTIC_COLOR:He,SEMANTIC_TEXCOORD:We,SEMANTIC_TEXCOORD0:Xe,SEMANTIC_TEXCOORD1:je,SEMANTIC_ATTR0:ti,SEMANTIC_ATTR1:ei,SEMANTIC_ATTR2:ii,SEMANTIC_ATTR3:ni,TEXTURELOCK_READ:1,TEXTURELOCK_WRITE:2,drawQuadWithShader:Zo,programlib:AA,shaderChunks:Oo,ContextCreationError:EA,Device:Rn,IndexBuffer:Qr,ProgramLibrary:pp,RenderTarget:Dn,ScopeId:_n,Shader:Xs,ShaderInput:_r,Texture:dr,UnsupportedBrowserError:wA,VertexBuffer:yn,VertexFormat:Cn,VertexIterator:ga},MA=new Lt;function PA(t,e){return vh.fromGeometry(t,new Lf(e))}function RA(t,e){return vh.fromGeometry(t,new dp(e))}function IA(t,e){return vh.fromGeometry(t,new Df(e))}function DA(t,e){return vh.fromGeometry(t,new fp(e))}function LA(t,e){return vh.fromGeometry(t,new lp(e))}function kA(t,e){return vh.fromGeometry(t,new cp(e))}function OA(t,e){return vh.fromGeometry(t,new up(e))}function FA(t,e,i){void 0===i&&(i={});var n=new Rf;return n.positions=e,n.normals=i.normals,n.tangents=i.tangents,n.colors=i.colors,n.uvs=i.uvs,n.uvs1=i.uvs1,n.blendIndices=i.blendIndices,n.blendWeights=i.blendWeights,n.indices=i.indices,vh.fromGeometry(t,n,i)}function BA(t,e,i,n,s){var r;if(s){var a=e?e.width:t.width,o=e?e.height:t.height;r=MA.set(s.x*a,s.y*o,s.z*a,s.w*o)}Zo(t,e,n,r)}var NA={createFullscreenQuad:function(t){return t.quadVertexBuffer},drawFullscreenQuad:BA,PostEffect:ip,PostEffectQueue:rS};Object.defineProperty(Oo,"transformSkinnedVS",{get:function(){return"#define SKIN\n"+Oo.transformVS}});Object.keys({"ambientPrefilteredCube.frag":"ambientEnv.frag","ambientPrefilteredCubeLod.frag":"ambientEnv.frag","dpAtlasQuad.frag":null,"genParaboloid.frag":null,"prefilterCubemap.frag":null,"reflectionDpAtlas.frag":"reflectionEnv.frag","reflectionPrefilteredCube.frag":"reflectionEnv.frag","reflectionPrefilteredCubeLod.frag":"reflectionEnv.frag"}).forEach((function(t){Object.defineProperty(Oo,t,{get:function(){return null},set:function(){}})})),Object.defineProperties(Dn.prototype,{_glFrameBuffer:{get:function(){return this.impl._glFrameBuffer},set:function(t){}}}),Object.defineProperty(Cn,"defaultInstancingFormat",{get:function(){return null}}),Object.defineProperties(dr.prototype,{rgbm:{get:function(){return this.type===vi},set:function(t){this.type=t?vi:_i}},swizzleGGGR:{get:function(){return this.type===xi},set:function(t){this.type=t?xi:_i}},_glTexture:{get:function(){return this.impl._glTexture}},autoMipmap:{get:function(){return this._mipmaps},set:function(t){this._mipmaps=t}}}),Object.defineProperty(Rn.prototype,"webgl2",{get:function(){return this.isWebGL2}}),Rn.prototype.getProgramLibrary=function(){return Bo(this)},Rn.prototype.setProgramLibrary=function(t){No(this,t)},Rn.prototype.removeShaderFromCache=function(t){Bo(this).removeFromCache(t)},hn.DEFAULT=Object.freeze(new hn);var UA=new hn,zA=new dn;Rn.prototype.setBlendFunction=function(t,e){var i=this.blendState;UA.copy(i),UA.setColorBlend(i.colorOp,t,e),UA.setAlphaBlend(i.alphaOp,t,e),this.setBlendState(UA)},Rn.prototype.setBlendFunctionSeparate=function(t,e,i,n){var s=this.blendState;UA.copy(s),UA.setColorBlend(s.colorOp,t,e),UA.setAlphaBlend(s.alphaOp,i,n),this.setBlendState(UA)},Rn.prototype.setBlendEquation=function(t){var e=this.blendState;UA.copy(e),UA.setColorBlend(t,e.colorSrcFactor,e.colorDstFactor),UA.setAlphaBlend(t,e.alphaSrcFactor,e.alphaDstFactor),this.setBlendState(UA)},Rn.prototype.setBlendEquationSeparate=function(t,e){var i=this.blendState;UA.copy(i),UA.setColorBlend(t,i.colorSrcFactor,i.colorDstFactor),UA.setAlphaBlend(e,i.alphaSrcFactor,i.alphaDstFactor),this.setBlendState(UA)},Rn.prototype.setColorWrite=function(t,e,i,n){var s=this.blendState;UA.copy(s),UA.setColorWrite(t,e,i,n),this.setBlendState(UA)},Rn.prototype.getBlending=function(){return this.blendState.blend},Rn.prototype.setBlending=function(t){UA.copy(this.blendState),UA.blend=t,this.setBlendState(UA)},Rn.prototype.setDepthWrite=function(t){zA.copy(this.depthState),zA.write=t,this.setDepthState(zA)},Rn.prototype.setDepthFunc=function(t){zA.copy(this.depthState),zA.func=t,this.setDepthState(zA)},Rn.prototype.setDepthTest=function(t){zA.copy(this.depthState),zA.test=t,this.setDepthState(zA)},Rn.prototype.getCullMode=function(){return this.cullMode};var VA=Oc,GA=ml,HA={procedural:{calculateTangents:Pf,createMesh:FA,createTorus:DA,createCylinder:OA,createCapsule:LA,createCone:kA,createSphere:PA,createPlane:RA,createBox:IA},BasicMaterial:oh,ForwardRenderer:sd,GraphNode:Oh,Material:ah,Mesh:vh,MeshInstance:jh,Model:Ad,ParticleEmitter:wf,PhongMaterial:Oc,Picker:zE,Projection:{ORTHOGRAPHIC:1,PERSPECTIVE:0},Scene:Wf,Skin:Xf,SkinInstance:uh};function WA(t,e){Object.defineProperty(Oc.prototype,e,{get:function(){return this[t]},set:function(e){this[t]=e}})}function XA(t,e){"pass"!==t&&Object.defineProperty(vc.prototype,t,{get:function(){return this.litOptions[e||t]},set:function(i){this.litOptions[e||t]=i}})}Object.defineProperty(Wf.prototype,"defaultMaterial",{get:function(){return nh(Vp().graphicsDevice)}}),Object.defineProperty(pd.prototype,"_meshInstances",{get:function(){return null}}),Object.defineProperty(Wf.prototype,"drawCalls",{get:function(){return null}}),["128","64","32","16","8","4"].forEach((function(t,e){Object.defineProperty(Wf.prototype,"skyboxPrefiltered"+t,{get:function(){return this._prefilteredCubemaps[e]},set:function(t){this._prefilteredCubemaps[e]=t,this.updateShaders=!0}})})),Object.defineProperty(Wf.prototype,"models",{get:function(){return this._models||(this._models=[]),this._models}}),Object.defineProperty(ud.prototype,"renderTarget",{set:function(t){this._renderTarget=t,this._dirtyComposition=!0},get:function(){return this._renderTarget}}),Wf.prototype.addModel=function(t){if(!this.containsModel(t)){var e=this.layers.getLayerById(0);e&&(e.addMeshInstances(t.meshInstances),this.models.push(t))}},Wf.prototype.addShadowCaster=function(t){var e=this.layers.getLayerById(0);e&&e.addShadowCasters(t.meshInstances)},Wf.prototype.removeModel=function(t){var e=this.models.indexOf(t);if(-1!==e){var i=this.layers.getLayerById(0);if(!i)return;i.removeMeshInstances(t.meshInstances),this.models.splice(e,1)}},Wf.prototype.removeShadowCasters=function(t){var e=this.layers.getLayerById(0);e&&e.removeShadowCasters(t.meshInstances)},Wf.prototype.containsModel=function(t){return this.models.indexOf(t)>=0},Wf.prototype.getModels=function(t){return this.models},Object.defineProperty(hh.prototype,"model",{get:function(){return null}}),sd.prototype.renderComposition=function(t){Vp().renderComposition(t)},jh.prototype.syncAabb=function(){},Cd.prototype.getTarget=function(t){return this.targets[t]},Oh.prototype._dirtify=function(t){t?this._dirtifyLocal():this._dirtifyWorld()},Oh.prototype.addLabel=function(t){this._labels[t]=!0},Oh.prototype.getLabels=function(){return Object.keys(this._labels)},Oh.prototype.hasLabel=function(t){return!!this._labels[t]},Oh.prototype.removeLabel=function(t){delete this._labels[t]},Oh.prototype.findByLabel=function(t,e){void 0===e&&(e=[]),this.hasLabel(t)&&e.push(this);for(var i=0;i0){var i=this._frameTimings[this._frameIndex-1];i[1]=e-i[1]}else if(this._timings.length>0){var n=this._timings[this._timings.length-1];n[1]=e-n[1]}if(this._frameIndex>=this._frameTimings.length)this._frameTimings.push([t,e]);else{var s=this._frameTimings[this._frameIndex];s[0]=t,s[1]=e}this._frameIndex++}},v(t,[{key:"timings",get:function(){return this._timings.slice(0,-1).map((function(t){return t[1]}))}}])}(),iC=v((function(t){this.device=t,t.gpuProfiler.enabled=!0,this.enabled=!0,this.unitsName="ms",this.decimalPlaces=1,this._timings=[]}),[{key:"timings",get:function(){return this._timings[0]=this.device.gpuProfiler._frameTime,this._timings}}]),nC=v((function(t,e,i,n,s){var r=this;this.app=t,this.values=[],this.statNames=e,this.statNames.length>3&&(this.statNames.length=3),this.unitsName=n,this.decimalPlaces=i,this.multiplier=s||1;var a=function(t,e){return t.split(".").reduce((function(t,e){return t?t[e]:null}),e||r)};t.on("frameupdate",(function(t){for(var e=0;ethis.textRefreshRate&&(this.timingText=(this.avgTotal/this.avgCount).toFixed(this.timer.decimalPlaces),this.avgTimer=0,this.avgTotal=0,this.avgCount=0),this.enabled){for(var n=0,s=1.5*this.watermark,r=0;r=512&&(a=5,o+=16),r.set(t,{l:i,r:n,a:h,d:l,w:c,h:u,x:a,y:o}),a+=c+5})),n.width=512,n.height=_t.nextPowerOfTwo(o+16+5),i(s),s.fillStyle="rgb(0, 0, 0)",s.fillRect(0,0,n.width,n.height),r.forEach((function(t,e){s.fillStyle=function(t){return"."===t||1===t.length&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57}(e)?"rgb(255, 255, 255)":"rgb(170, 170, 170)",s.fillText(e,t.x-t.l,t.y+t.a)})),this.placements=r;for(var h=s.getImageData(0,0,n.width,n.height).data,l=0;lt?e.width:t}),0);this.texture=new dr(e,{name:"mini-stats-graph-texture",width:_t.nextPowerOfTwo(h),height:_t.nextPowerOfTwo(this.graphs.length),mipmaps:!1,minFilter:0,magFilter:0,addressU:0,addressV:0}),this.graphs.forEach((function(t,e){t.texture=n.texture,t.yOffset=e}))},e.render=function(){var t=this.graphs,e=this.wordAtlas,i=this.render2d,n=this.width,s=this.height,r=this.gspacing;i.startFrame();for(var a=0;a>1|(21845&SC)<<1;bC=(61680&(bC=(52428&bC)>>2|(13107&bC)<<2))>>4|(3855&bC)<<4,xC[SC]=((65280&bC)>>8|(255&bC)<<8)>>1}var TC=function(t,e,i){for(var n=t.length,s=0,r=new cC(e);s>h]=l}else for(a=new cC(n),s=0;s>15-t[s]);return a},wC=new lC(288);for(SC=0;SC<144;++SC)wC[SC]=8;for(SC=144;SC<256;++SC)wC[SC]=9;for(SC=256;SC<280;++SC)wC[SC]=7;for(SC=280;SC<288;++SC)wC[SC]=8;var EC=new lC(32);for(SC=0;SC<32;++SC)EC[SC]=5;var AC=TC(wC,9,0);TC(wC,9,1);var CC=TC(EC,5,0);TC(EC,5,1);var MC=function(t){return(t+7)/8|0},PC=function(t,e,i){return(null==i||i>t.length)&&(i=t.length),new lC(t.subarray(e,i))},RC=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],IC=function(t,e,i){var n=new Error(e||RC[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,IC),!i)throw n;return n},DC=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8},LC=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8,t[n+2]|=i>>16},kC=function(t,e){for(var i=[],n=0;nd&&(d=r[n].s);var f=new cC(d+1),p=OC(i[c-1],f,0);if(p>e){n=0;var m=0,_=p-e,v=1<<_;for(r.sort((function(t,e){return f[e.s]-f[t.s]||t.f-e.f}));ne))break;m+=v-(1<>=_;m>0;){var y=r[n].s;f[y]=0&&m;--n){var x=r[n].s;f[x]==e&&(--f[x],++m)}p=e}return{t:new lC(f),l:p}},OC=function(t,e,i){return-1==t.s?Math.max(OC(t.l,e,i+1),OC(t.r,e,i+1)):e[t.s]=i},FC=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new cC(++e),n=0,s=t[0],r=1,a=function(t){i[n++]=t},o=1;o<=e;++o)if(t[o]==s&&o!=e)++r;else{if(!s&&r>2){for(;r>138;r-=138)a(32754);r>2&&(a(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(a(s),--r;r>6;r-=6)a(8304);r>2&&(a(r-3<<5|8208),r=0)}for(;r--;)a(s);r=1,s=t[o]}return{c:i.subarray(0,n),n:e}},BC=function(t,e){for(var i=0,n=0;n>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;r4&&!A[pC[M-1]];--M);var P,R,I,D,L=l+5<<3,k=BC(s,wC)+BC(r,EC)+a,O=BC(s,d)+BC(r,m)+a+14+3*M+BC(T,A)+2*T[16]+3*T[17]+7*T[18];if(h>=0&&L<=k&&L<=O)return NC(e,c,t.subarray(h,h+l));if(DC(e,c,1+(O15&&(DC(e,c,U[w]>>5&127),c+=U[w]>>12)}}}else P=AC,R=wC,I=CC,D=EC;for(w=0;w255){LC(e,c,P[(z=V>>18&31)+257]),c+=R[z+257],z>7&&(DC(e,c,V>>23&31),c+=dC[z]);var G=31&V;LC(e,c,I[G]),c+=D[G],G>3&&(LC(e,c,V>>5&8191),c+=fC[G])}else LC(e,c,P[V]),c+=R[V]}return LC(e,c,P[256]),c+R[256]},zC=new uC([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),VC=new lC(0),GC=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var i=e,n=9;--n;)i=(1&i&&-306674912)^i>>>1;t[e]=i}return t}(),HC=function(){var t=-1;return{p:function(e){for(var i=t,n=0;n>>8;t=i},d:function(){return~t}}},WC=function(t,e,i,n,s){if(!s&&(s={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),a=new lC(r.length+t.length);a.set(r),a.set(t,r.length),t=a,s.w=r.length}return function(t,e,i,n,s,r){var a=r.z||t.length,o=new lC(n+a+5*(1+Math.ceil(a/7e3))+s),h=o.subarray(n,o.length-s),l=r.l,c=7&(r.r||0);if(e){c&&(h[0]=r.r>>3);for(var u=zC[e-1],d=u>>13,f=8191&u,p=(1<7e3||A>24576)&&(D>423||!l)){c=UC(t,h,0,x,S,b,w,A,M,E-M,c),A=T=w=0,M=E;for(var L=0;L<286;++L)S[L]=0;for(L=0;L<30;++L)b[L]=0}var k=2,O=0,F=f,B=R-I&32767;if(D>2&&P==y(E-B))for(var N=Math.min(d,D)-1,U=Math.min(32767,E),z=Math.min(258,D);B<=U&&--F&&R!=I;){if(t[E+k]==t[E+k-B]){for(var V=0;Vk){if(k=V,O=B,V>N)break;var G=Math.min(B,V-2),H=0;for(L=0;LH&&(H=X,I=W)}}}B+=(R=I)-(I=m[R])&32767}if(O){x[A++]=268435456|gC[k]<<18|yC[O];var j=31&gC[k],q=31&yC[O];w+=dC[j]+fC[q],++S[257+j],++b[q],C=E+k,++T}else x[A++]=t[E],++S[t[E]]}}for(E=Math.max(E,C);E=a&&(h[c/8|0]=l,Y=a),c=NC(h,c+1,t.subarray(E,Y))}r.i=a}return PC(o,0,n+MC(c)+s)}(t,null==e.level?6:e.level,null==e.mem?s.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+e.mem,i,n,s)},XC=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i},jC=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function qC(t,e){return WC(t,e||{},0,0)}var YC=function(t,e,i,n){for(var s in t){var r=t[s],a=e+s,o=n;Array.isArray(r)&&(o=XC(n,r[1]),r=r[0]),r instanceof lC?i[a]=[r,o]:(i[a+="/"]=[new lC(0),o],YC(r,a,i,n))}},KC="undefined"!=typeof TextEncoder&&new TextEncoder,ZC="undefined"!=typeof TextDecoder&&new TextDecoder;try{ZC.decode(VC,{stream:!0}),1}catch(t){}function QC(t,e){if(KC)return KC.encode(t);for(var i=t.length,n=new lC(t.length+(t.length>>1)),s=0,r=function(t){n[s++]=t},a=0;an.length){var o=new lC(s+8+(i-a<<1));o.set(n),n=o}var h=t.charCodeAt(a);h<128||e?r(h):h<2048?(r(192|h>>6),r(128|63&h)):h>55295&&h<57344?(r(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++a))>>18),r(128|h>>12&63),r(128|h>>6&63),r(128|63&h)):(r(224|h>>12),r(128|h>>6&63),r(128|63&h))}return PC(n,0,s)}var JC=function(t){var e=0;if(t)for(var i in t){var n=t[i].length;n>65535&&IC(9),e+=n+4}return e},$C=function(t,e,i,n,s,r,a,o){var h=n.length,l=i.extra,c=o&&o.length,u=JC(l);jC(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=i.os),t[e]=20,e+=2,t[e++]=i.flag<<1|(r<0&&8),t[e++]=s&&8,t[e++]=255&i.compression,t[e++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),f=d.getFullYear()-1980;if((f<0||f>119)&&IC(10),jC(t,e,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),e+=4,-1!=r&&(jC(t,e,i.crc),jC(t,e+4,r<0?-r-2:r),jC(t,e+8,i.size)),jC(t,e+12,h),jC(t,e+14,u),e+=16,null!=a&&(jC(t,e,c),jC(t,e+6,i.attrs),jC(t,e+10,a),e+=14),t.set(n,e),e+=h,u)for(var p in l){var m=l[p],_=m.length;jC(t,e,+p),jC(t,e+2,_),t.set(m,e+4),e+=4+_}return c&&(t.set(o,e),e+=c),e};function tM(t,e){e||(e={});var i={},n=[];YC(t,"",i,e);var s=0,r=0;for(var a in i){var o=i[a],h=o[0],l=o[1],c=0==l.level?0:8,u=(T=QC(a)).length,d=l.comment,f=d&&QC(d),p=f&&f.length,m=JC(l.extra);u>65535&&IC(11);var _=c?qC(h,l):h,v=_.length,g=HC();g.p(h),n.push(XC(l,{size:h.length,crc:g.d(),c:_,f:T,m:f,u:u!=a.length||f&&d.length!=p,o:s,compression:c})),s+=30+u+m+v,r+=76+2*(u+m)+(p||0)+v}for(var y=new lC(r+22),x=s,S=r-s,b=0;b"}},i.getTextureFileIds=function(t){return this.getFileIds("texture","Texture_"+t.id,"Texture","png")},i.addFile=function(t,e,i,n){void 0===i&&(i=""),void 0===n&&(n="");var s=null;n&&(s=QC(n='#usda 1.0\n(\n customLayerData = {\n string creator = "PlayCanvas UsdzExporter"\n }\n metersPerUnit = 1\n upAxis = "Y"\n)\n\n'+n));var r=this.getFileIds(t,e,i);return this.files[r.fileName]=s,r.refName},i.getMaterialRef=function(t){var e=this.materialMap.get(t);return e||(e=this.buildMaterial(t),this.materialMap.set(t,e)),e},i.getMeshRef=function(t){var e=this.meshMap.get(t);return e||(e=this.buildMesh(t),this.meshMap.set(t,e)),e},i.buildArray2=function(t){for(var e=[],i=t.length,n=0;n"},r=[],a=[],o=function(i,n,o,h,l,c,u){void 0===c&&(c=!1),void 0===u&&(u=!1);var d=t[i];if(d){var f=e.getTextureFileIds(d);e.textureMap.set(d,f.refName);var p=t[i+"Channel"]||"rgb",m=s("/"+f.name+"_"+l+".outputs:"+p);r.push(iM(o,h+".connect",m)),c&&t.alphaTest;var _=t[i+"Tiling"],v=t[i+"Offset"],g=t[i+"Rotation"],y=1===t[i+"Uv"]?"st1":"st",x=u&&n?n:vt.WHITE;a.push(function(t,e,i,n,r,a,o,h){return'\n def Shader "Transform2d_'+i+'" (\n sdrMetadata = {\n string role = "math"\n }\n )\n {\n uniform token info:id = "UsdTransform2d"\n float2 inputs:in.connect = '+s("/uvReader_"+n+".outputs:result")+"\n float inputs:rotation = "+o+"\n float2 inputs:scale = ("+r.x+", "+r.y+")\n float2 inputs:translation = ("+a.x+", "+a.y+')\n float2 outputs:result\n }\n\n def Shader "Texture_'+t.id+"_"+i+'"\n {\n uniform token info:id = "UsdUVTexture"\n asset inputs:file = @'+e.fileName+"@\n float2 inputs:st.connect = "+s("/Transform2d_"+i+".outputs:result")+'\n token inputs:wrapS = "repeat"\n token inputs:wrapT = "repeat"\n float4 inputs:scale = ('+h.r+", "+h.g+", "+h.b+", "+h.a+")\n float outputs:r\n float outputs:g\n float outputs:b\n float3 outputs:rgb\n float outputs:a\n }\n "}(d,f,l,y,_,v,g,x))}else if(n){var S="float"===o?""+n:"("+n.r+", "+n.g+", "+n.b+")";r.push(iM(o,h,S))}};o("diffuseMap",t.diffuse,"color3f","diffuseColor","diffuse",!1,!0),(t.transparent||t.alphaTest>0)&&o("opacityMap",t.opacity,"float","opacity","opacity",!0),o("normalMap",null,"normal3f","normal","normal"),o("emissiveMap",t.emissive,"color3f","emissiveColor","emissive",!1,!0),o("aoMap",null,"float","occlusion","occlusion"),o("metalnessMap",t.metalness,"float","metallic","metallic"),o("glossMap",t.gloss,"float","roughness","roughness");var h='\n def Material "'+i+'"\n {\n def Shader "PreviewSurface"\n {\n uniform token info:id = "UsdPreviewSurface"\n'+r.join("\n")+"\n int inputs:useSpecularWorkflow = 0\n token outputs:surface\n }\n\n token outputs:surface.connect = "+s("/PreviewSurface.outputs:surface")+'\n\n def Shader "uvReader_st"\n {\n uniform token info:id = "UsdPrimvarReader_float2"\n token inputs:varname = "st"\n float2 inputs:fallback = (0.0, 0.0)\n float2 outputs:result\n }\n\n def Shader "uvReader_st1"\n {\n uniform token info:id = "UsdPrimvarReader_float2"\n token inputs:varname = "st1"\n float2 inputs:fallback = (0.0, 0.0)\n float2 outputs:result\n }\n\n '+a.join("\n")+"\n }\n ";return this.materials.push(h),s("")},i.buildMesh=function(t){var e=[],i=[],n=[],s=[],r=[];t.getVertexStream(Ne,e),t.getVertexStream(Ue,n),t.getVertexStream(Xe,s),t.getVertexStream(je,r),t.getIndices(i);var a=i.length||e.length,o=Array(a/3).fill(3).join(", ");if(!i.length)for(var h=0;h0&&(e.materials=t.materials.map((function(n){var s=n.name,r=n.blendType,a=n.cull,o=n.alphaTest,h={pbrMetallicRoughness:{}};return s&&s.length>0&&(h.name=s),n instanceof Oc&&i.writeStandardMaterial(t,n,h,e),n instanceof oh&&i.writeBasicMaterial(t,n,h,e),2===r?h.alphaMode="BLEND":3===r&&0!==o&&(h.alphaMode="MASK",h.alphaCutoff=o),a===_e&&(h.doubleSided=!0),i.attachTexture(t,n,h,"normalTexture","normalMap",e),i.attachTexture(t,n,h,"occlusionTexture","aoMap",e),i.attachTexture(t,n,h,"emissiveTexture","emissiveMap",e),h})))},i.writeNodes=function(t,e){t.entities.length>0&&(e.nodes=t.entities.map((function(e){var i=e.name,n=e.getLocalPosition(),s=e.getLocalRotation(),r=e.getLocalScale(),a={};i&&i.length>0&&(a.name=i),n.equals(Ct.ZERO)||(a.translation=[n.x,n.y,n.z]),s.equals(Vt.IDENTITY)||(a.rotation=[s.x,s.y,s.z,s.w]),r.equals(Ct.ONE)||(a.scale=[r.x,r.y,r.z]),e.camera&&e.camera.enabled&&(a.camera=t.cameras.indexOf(e.camera));var o=t.entityMeshInstances.find((function(t){return t.node===e}));return o&&(a.mesh=t.entityMeshInstances.indexOf(o)),e.children.length>0&&(a.children=[],e.children.forEach((function(e){a.children.push(t.entities.indexOf(e))}))),a})))},i.writeMeshes=function(t,i){t.entityMeshInstances.length>0&&(i.accessors=[],i.meshes=[],t.entityMeshInstances.forEach((function(n){var s={primitives:[]};n.meshInstances.forEach((function(n){var r=e.createPrimitive(t,i,n.mesh);r.material=t.materials.indexOf(n.material),s.primitives.push(r)})),i.meshes.push(s)})))},e.createPrimitive=function(t,i,n){var s={attributes:{}},r=n.vertexBuffer,a=r.format,o=a.interleaved,h=a.elements,l=r.getNumVertices();h.forEach((function(a,h){var c=t.bufferViewMap.get(r);c||(e.writeBufferView(t,i,r),t.buffers.push(r),c=t.bufferViewMap.get(r));var u={bufferView:c[o?0:h],byteOffset:o?a.offset:0,componentType:aM(a.dataType),type:oM(a.numComponents),count:l},d=i.accessors.push(u)-1;if(s.attributes[function(t){switch(t){case Ne:return"POSITION";case Ue:return"NORMAL";case ze:return"TANGENT";case He:return"COLOR_0";case Ge:return"JOINTS_0";case Ve:return"WEIGHTS_0";case Xe:return"TEXCOORD_0";case je:return"TEXCOORD_1";case qe:return"TEXCOORD_2";case Ye:return"TEXCOORD_3";case Ke:return"TEXCOORD_4";case Ze:return"TEXCOORD_5";case Qe:return"TEXCOORD_6";case Je:return"TEXCOORD_7"}return""}(a.name)]=d,a.name===Ne){var f=[];n.getPositions(f);var p=new Ct,m=new Ct;qt.computeMinMax(f,p,m),u.min=[p.x,p.y,p.z],u.max=[m.x,m.y,m.z]}}));var c=n.indexBuffer[0];if(c){var u=t.bufferViewMap.get(c);u||(e.writeBufferView(t,i,c),t.buffers.push(c),u=t.bufferViewMap.get(c));var d={bufferView:u[0],componentType:rM(c.getFormat()),count:c.getNumIndices(),type:"SCALAR"},f=i.accessors.push(d)-1;s.indices=f}return s},i.convertTextures=function(t,e){var i=this,n={maxTextureSize:e.maxTextureSize},s=[];return t.forEach((function(t){var e=i.textureToCanvas(t,n);e.then((function(t){return new Promise((function(e){return e(t)}))})),s.push(e)})),s},i.writeTextures=function(t,i,n,s){for(var r=this,a=t.textures,o=[],h=function(s){var h=a[s],l=i[s],c=function(t){for(var e=t.getContext("2d").getImageData(0,0,t.width,t.height).data,i=3;i0&&(a+=8+r);var o=new ArrayBuffer(a),h=new DataView(o);h.setUint32(0,1179937895,!0),h.setUint32(4,2,!0),h.setUint32(8,a,!0),h.setUint32(12,n+s,!0),h.setUint32(16,1313821514,!0);for(var l=20,c=0;c0&&(h.setUint32(l,r,!0),h.setUint32(l+4,5130562,!0),l+=8,i.buffers.forEach((function(e){var n,s=i.bufferViewMap.get(e)[0],r=t.bufferViews[s].byteOffset;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{var a=e.lock();n=a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}new Uint8Array(o,l+r,n.byteLength).set(n)}))),Promise.resolve(o)}))},e}(hC),dM=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).sourceTexture=i,n.shader=n.createQuadShader("DownSampleShader","\n\t\t\tuniform sampler2D sourceTexture;\n\t\t\tuniform vec2 sourceInvResolution;\n\t\t\tvarying vec2 uv0;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tfloat x = sourceInvResolution.x;\n\t\t\t\tfloat y = sourceInvResolution.y;\n\t\t\t\tvec3 a = texture2D (sourceTexture, vec2 (uv0.x - 2.0 * x, uv0.y + 2.0 * y)).rgb;\n\t\t\t\tvec3 b = texture2D (sourceTexture, vec2 (uv0.x,\t\t uv0.y + 2.0 * y)).rgb;\n\t\t\t\tvec3 c = texture2D (sourceTexture, vec2 (uv0.x + 2.0 * x, uv0.y + 2.0 * y)).rgb;\n\t\t\t\tvec3 d = texture2D (sourceTexture, vec2 (uv0.x - 2.0 * x, uv0.y)).rgb;\n\t\t\t\tvec3 e = texture2D (sourceTexture, vec2 (uv0.x,\t\t uv0.y)).rgb;\n\t\t\t\tvec3 f = texture2D (sourceTexture, vec2 (uv0.x + 2.0 * x, uv0.y)).rgb;\n\t\t\t\tvec3 g = texture2D (sourceTexture, vec2 (uv0.x - 2.0 * x, uv0.y - 2.0 * y)).rgb;\n\t\t\t\tvec3 h = texture2D (sourceTexture, vec2 (uv0.x,\t\t uv0.y - 2.0 * y)).rgb;\n\t\t\t\tvec3 i = texture2D (sourceTexture, vec2 (uv0.x + 2.0 * x, uv0.y - 2.0 * y)).rgb;\n\t\t\t\tvec3 j = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y + y)).rgb;\n\t\t\t\tvec3 k = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y + y)).rgb;\n\t\t\t\tvec3 l = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y - y)).rgb;\n\t\t\t\tvec3 m = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y - y)).rgb;\n\t\t\t\tvec3 value = e * 0.125;\n\t\t\t\tvalue += (a + c + g + i) * 0.03125;\n\t\t\t\tvalue += (b + d + f + h) * 0.0625;\n\t\t\t\tvalue += (j + k + l + m) * 0.125;\n\t\t\t\tgl_FragColor = vec4(value, 1.0);\n\t\t\t}"),n.sourceTextureId=e.scope.resolve("sourceTexture"),n.sourceInvResolutionId=e.scope.resolve("sourceInvResolution"),n.sourceInvResolutionValue=new Float32Array(2),n}return x(e,t),e.prototype.execute=function(){this.sourceTextureId.setValue(this.sourceTexture),this.sourceInvResolutionValue[0]=1/this.sourceTexture.width,this.sourceInvResolutionValue[1]=1/this.sourceTexture.height,this.sourceInvResolutionId.setValue(this.sourceInvResolutionValue),t.prototype.execute.call(this)},e}(np),fM=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).sourceTexture=i,n.shader=n.createQuadShader("UpSampleShader","\n\t\t\tuniform sampler2D sourceTexture;\n\t\t\tuniform vec2 sourceInvResolution;\n\t\t\tvarying vec2 uv0;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tfloat x = sourceInvResolution.x;\n\t\t\t\tfloat y = sourceInvResolution.y;\n\t\t\t\tvec3 a = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y + y)).rgb;\n\t\t\t\tvec3 b = texture2D (sourceTexture, vec2 (uv0.x,\t uv0.y + y)).rgb;\n\t\t\t\tvec3 c = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y + y)).rgb;\n\t\t\t\tvec3 d = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y)).rgb;\n\t\t\t\tvec3 e = texture2D (sourceTexture, vec2 (uv0.x,\t uv0.y)).rgb;\n\t\t\t\tvec3 f = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y)).rgb;\n\t\t\t\tvec3 g = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y - y)).rgb;\n\t\t\t\tvec3 h = texture2D (sourceTexture, vec2 (uv0.x,\t uv0.y - y)).rgb;\n\t\t\t\tvec3 i = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y - y)).rgb;\n\t\t\t\tvec3 value = e * 4.0;\n\t\t\t\tvalue += (b + d + f + h) * 2.0;\n\t\t\t\tvalue += (a + c + g + i);\n\t\t\t\tvalue *= 1.0 / 16.0;\n\t\t\t\tgl_FragColor = vec4(value, 1.0);\n\t\t\t}"),n.sourceTextureId=e.scope.resolve("sourceTexture"),n.sourceInvResolutionId=e.scope.resolve("sourceInvResolution"),n.sourceInvResolutionValue=new Float32Array(2),n}return x(e,t),e.prototype.execute=function(){this.sourceTextureId.setValue(this.sourceTexture),this.sourceInvResolutionValue[0]=1/this.sourceTexture.width,this.sourceInvResolutionValue[1]=1/this.sourceTexture.height,this.sourceInvResolutionId.setValue(this.sourceInvResolutionValue),t.prototype.execute.call(this)},e}(np),pM=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this).bloomTexture=void 0,s.lastMipLevel=1,s.bloomRenderTarget=void 0,s.textureFormat=void 0,s.renderTargets=[],s._sourceTexture=i,s.textureFormat=n,s.bloomRenderTarget=s.createRenderTarget(0),s.bloomTexture=s.bloomRenderTarget.colorBuffer,s}x(e,t);var i=e.prototype;return i.destroy=function(){this.destroyRenderPasses(),this.destroyRenderTargets()},i.destroyRenderTargets=function(t){void 0===t&&(t=0);for(var e=t;e=0;a--){var o=new fM(e,i),h=this.renderTargets[a];o.init(h),o.blendState=hn.ADDBLEND,this.beforePasses.push(o),i=h.colorBuffer}},i.onDisable=function(){var t;null==(t=this.renderTargets[0])||t.resize(1,1),this.destroyRenderPasses(),this.destroyRenderTargets(1)},i.frameUpdate=function(){t.prototype.frameUpdate.call(this);var e=this.calcMipLevels(this._sourceTexture.width,this._sourceTexture.height,Math.pow(2,this.lastMipLevel));e=Math.max(1,e),this.renderTargets.length!==e&&(this.destroyRenderPasses(),this.destroyRenderTargets(1),this.createRenderTargets(e),this.createRenderPasses(e))},v(e,[{key:"sourceTexture",get:function(){return this._sourceTexture},set:function(t){if(this._sourceTexture=t,this.beforePasses.length>0){var e=this.beforePasses[0];e.options.resizeSource=t,e.sourceTexture=t}}}])}(ta),mM=function(t){function e(e){var i;(i=t.call(this,e)||this).sceneTexture=null,i.bloomIntensity=.01,i._bloomTexture=null,i._toneMapping=4,i._gradingEnabled=!1,i.gradingSaturation=1,i.gradingContrast=1,i.gradingBrightness=1,i._shaderDirty=!0,i._vignetteEnabled=!1,i.vignetteInner=.5,i.vignetteOuter=1,i.vignetteCurvature=.5,i.vignetteIntensity=.3,i._fringingEnabled=!1,i.fringingIntensity=10,i._taaEnabled=!1,i._sharpness=.5,i._key="";var n=e.scope;return i.sceneTextureId=n.resolve("sceneTexture"),i.bloomTextureId=n.resolve("bloomTexture"),i.bloomIntensityId=n.resolve("bloomIntensity"),i.bcsId=n.resolve("brightnessContrastSaturation"),i.vignetterParamsId=n.resolve("vignetterParams"),i.fringingIntensityId=n.resolve("fringingIntensity"),i.sceneTextureInvResId=n.resolve("sceneTextureInvRes"),i.sceneTextureInvResValue=new Float32Array(2),i.sharpnessId=n.resolve("sharpness"),i}x(e,t);var i=e.prototype;return i.postInit=function(){this.setClearColor(vt.BLACK),this.setClearDepth(1),this.setClearStencil(0)},i.frameUpdate=function(){if(this._shaderDirty){this._shaderDirty=!1;var t=this.toneMapping+("-"+(this.bloomTexture?"bloom":"nobloom"))+"-"+(this.gradingEnabled?"grading":"nograding")+"-"+(this.vignetteEnabled?"vignette":"novignette")+"-"+(this.fringingEnabled?"fringing":"nofringing")+"-"+(this.taaEnabled?"taa":"notaa")+"-"+(this.isSharpnessEnabled?"cas":"nocas");if(this._key!==t){this._key=t;var e=(this.bloomTexture?"#define BLOOM\n":"")+(this.gradingEnabled?"#define GRADING\n":"")+(this.vignetteEnabled?"#define VIGNETTE\n":"")+(this.fringingEnabled?"#define FRINGING\n":"")+(this.taaEnabled?"#define TAA\n":"")+(this.isSharpnessEnabled?"#define CAS\n":""),i=Oo.decodePS+Oo.gamma2_2PS+this.toneMapChunk;this.shader=this.createQuadShader("ComposeShader-"+t,e+i+"\n\tvarying vec2 uv0;\n\tuniform sampler2D sceneTexture;\n\tuniform vec2 sceneTextureInvRes;\n\t#ifdef BLOOM\n\t\tuniform sampler2D bloomTexture;\n\t\tuniform float bloomIntensity;\n\t#endif\n\t#ifdef GRADING\n\t\tuniform vec3 brightnessContrastSaturation;\n\t\tvec3 contrastSaturationBrightness(vec3 color, float brt, float sat, float con)\n\t\t{\n\t\t\tcolor = color * brt;\n\t\t\tfloat grey = dot(color, vec3(0.3, 0.59, 0.11));\n\t\t\tcolor = mix(vec3(grey), color, sat);\n\t\t\treturn max(mix(vec3(0.5), color, con), 0.0);\n\t\t}\n\t\n\t#endif\n\t#ifdef VIGNETTE\n\t\tuniform vec4 vignetterParams;\n\t\tfloat vignette(vec2 uv) {\n\t\t\tfloat inner = vignetterParams.x;\n\t\t\tfloat outer = vignetterParams.y;\n\t\t\tfloat curvature = vignetterParams.z;\n\t\t\tfloat intensity = vignetterParams.w;\n\t\t\tvec2 curve = pow(abs(uv * 2.0 -1.0), vec2(1.0 / curvature));\n\t\t\tfloat edge = pow(length(curve), curvature);\n\t\t\treturn 1.0 - intensity * smoothstep(inner, outer, edge);\n\t\t}\t\t\n\t#endif\n\t#ifdef FRINGING\n\t\tuniform float fringingIntensity;\n\t\tvec3 fringing(vec2 uv, vec3 color) {\n\t\t\tvec2 centerDistance = uv0 - 0.5;\n\t\t\tvec2 offset = fringingIntensity * pow(centerDistance, vec2(2.0, 2.0));\n\t\t\tcolor.r = texture2D(sceneTexture, uv0 - offset).r;\n\t\t\tcolor.b = texture2D(sceneTexture, uv0 + offset).b;\n\t\t\treturn color;\n\t\t}\n\t#endif\n\t#ifdef CAS\n\t\tuniform float sharpness;\n\t\tfloat maxComponent(float x, float y, float z) { return max(x, max(y, z)); }\n\t\tvec3 toSDR(vec3 c) { return c / (1.0 + maxComponent(c.r, c.g, c.b)); }\n\t\tvec3 toHDR(vec3 c) { return c / (1.0 - maxComponent(c.r, c.g, c.b)); }\n\t\tvec3 cas(vec3 color, vec2 uv, float sharpness) {\n\t\t\tfloat x = sceneTextureInvRes.x;\n\t\t\tfloat y = sceneTextureInvRes.y;\n\t\t\tvec3 a = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(0.0, -y), 0.0).rgb);\n\t\t\tvec3 b = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(-x, 0.0), 0.0).rgb);\n\t\t\tvec3 c = toSDR(color.rgb);\n\t\t\tvec3 d = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(x, 0.0), 0.0).rgb);\n\t\t\tvec3 e = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(0.0, y), 0.0).rgb);\n\t\t\tfloat min_g = min(a.g, min(b.g, min(c.g, min(d.g, e.g))));\n\t\t\tfloat max_g = max(a.g, max(b.g, max(c.g, max(d.g, e.g))));\n\t\t\tfloat sharpening_amount = sqrt(min(1.0 - max_g, min_g) / max_g);\n\t\t\tfloat w = sharpening_amount * sharpness;\n\t\t\tvec3 res = (w * (a + b + d + e) + c) / (4.0 * w + 1.0);\n\t\t\treturn toHDR(res);\n\t\t}\n\t#endif\n\tvoid main() {\n\t\tvec2 uv = uv0;\n\t\t#ifdef TAA\n\t\t#ifdef WEBGPU\n\t\t\tuv.y = 1.0 - uv.y;\n\t\t#endif\n\t\t#endif\n\t\tvec4 scene = texture2DLodEXT(sceneTexture, uv, 0.0);\n\t\tvec3 result = scene.rgb;\n\t\t#ifdef CAS\n\t\t\tresult = cas(result, uv, sharpness);\n\t\t#endif\n\t\t#ifdef FRINGING\n\t\t\tresult = fringing(uv, result);\n\t\t#endif\n\t\t#ifdef BLOOM\n\t\t\tvec3 bloom = texture2DLodEXT(bloomTexture, uv, 0.0).rgb;\n\t\t\tresult += bloom * bloomIntensity;\n\t\t#endif\n\t\t#ifdef GRADING\n\t\t\tresult = contrastSaturationBrightness(result, brightnessContrastSaturation.x, brightnessContrastSaturation.z, brightnessContrastSaturation.y);\n\t\t#endif\n\t\tresult = toneMap(result);\n\t\t#ifdef VIGNETTE\n\t\t\tresult *= vignette(uv);\n\t\t#endif\n\t\tresult = gammaCorrectOutput(result);\n\t\tgl_FragColor = vec4(result, scene.a);\n\t}\n")}}},i.execute=function(){this.sceneTextureId.setValue(this.sceneTexture),this.sceneTextureInvResValue[0]=1/this.sceneTexture.width,this.sceneTextureInvResValue[1]=1/this.sceneTexture.height,this.sceneTextureInvResId.setValue(this.sceneTextureInvResValue),this._bloomTexture&&(this.bloomTextureId.setValue(this._bloomTexture),this.bloomIntensityId.setValue(this.bloomIntensity)),this._gradingEnabled&&this.bcsId.setValue([this.gradingBrightness,this.gradingContrast,this.gradingSaturation]),this._vignetteEnabled&&this.vignetterParamsId.setValue([this.vignetteInner,this.vignetteOuter,this.vignetteCurvature,this.vignetteIntensity]),this._fringingEnabled&&this.fringingIntensityId.setValue(this.fringingIntensity/1024),this.isSharpnessEnabled&&this.sharpnessId.setValue(_t.lerp(-.125,-.2,this.sharpness)),t.prototype.execute.call(this)},v(e,[{key:"bloomTexture",get:function(){return this._bloomTexture},set:function(t){this._bloomTexture!==t&&(this._bloomTexture=t,this._shaderDirty=!0)}},{key:"taaEnabled",get:function(){return this._taaEnabled},set:function(t){this._taaEnabled!==t&&(this._taaEnabled=t,this._shaderDirty=!0)}},{key:"gradingEnabled",get:function(){return this._gradingEnabled},set:function(t){this._gradingEnabled!==t&&(this._gradingEnabled=t,this._shaderDirty=!0)}},{key:"vignetteEnabled",get:function(){return this._vignetteEnabled},set:function(t){this._vignetteEnabled!==t&&(this._vignetteEnabled=t,this._shaderDirty=!0)}},{key:"fringingEnabled",get:function(){return this._fringingEnabled},set:function(t){this._fringingEnabled!==t&&(this._fringingEnabled=t,this._shaderDirty=!0)}},{key:"toneMapping",get:function(){return this._toneMapping},set:function(t){this._toneMapping!==t&&(this._toneMapping=t,this._shaderDirty=!0)}},{key:"toneMapChunk",get:function(){switch(this.toneMapping){case 0:return Oo.tonemappingLinearPS;case 1:return Oo.tonemappingFilmicPS;case 2:return Oo.tonemappingHejlPS;case 3:return Oo.tonemappingAcesPS;case 4:return Oo.tonemappingAces2PS;case 5:return Oo.tonemappingNeutralPS}return Oo.tonemappingNonePS}},{key:"sharpness",get:function(){return this._sharpness},set:function(t){this._sharpness!==t&&(this._sharpness=t,this._shaderDirty=!0)}},{key:"isSharpnessEnabled",get:function(){return this._sharpness>0}}])}(np),_M=function(t){function e(e,i,n){var s;(s=t.call(this,e)||this).historyIndex=0,s.historyTexture=null,s.historyTextures=[],s.historyRenderTargets=[],s.sourceTexture=i,s.cameraComponent=n;var r=Oo.sampleCatmullRomPS;s.shader=s.createQuadShader("TaaResolveShader","\n\t\t\t#define QUALITY_HIGH\n\t\t"+r+"\n\tuniform highp sampler2D uSceneDepthMap;\n\tuniform sampler2D sourceTexture;\n\tuniform sampler2D historyTexture;\n\tuniform mat4 matrix_viewProjectionPrevious;\n\tuniform mat4 matrix_viewProjectionInverse;\n\tuniform vec4 jitters;\n\tuniform vec2 textureSize;\n\tvarying vec2 uv0;\n\tvec2 reproject(vec2 uv, float depth) {\n\t\t#ifndef WEBGPU\n\t\t\tdepth = depth * 2.0 - 1.0;\n\t\t#endif\n\t\tvec4 ndc = vec4(uv * 2.0 - 1.0, depth, 1.0);\n\t\tndc.xy -= jitters.xy;\n\t\tvec4 worldPosition = matrix_viewProjectionInverse * ndc;\n\t\tworldPosition /= worldPosition.w;\n\t\n\t\tvec4 screenPrevious = matrix_viewProjectionPrevious * worldPosition;\n\t\treturn (screenPrevious.xy / screenPrevious.w) * 0.5 + 0.5;\n\t}\n\tvec4 colorClamp(vec2 uv, vec4 historyColor) {\n\t\tvec3 minColor = vec3(9999.0);\n\t\tvec3 maxColor = vec3(-9999.0);\n \n\t\tfor(float x = -1.0; x <= 1.0; ++x)\n\t\t{\n\t\t\tfor(float y = -1.0; y <= 1.0; ++y)\n\t\t\t{\n\t\t\t\tvec3 color = texture2D(sourceTexture, uv + vec2(x, y) / textureSize).rgb;\n\t\t\t\tminColor = min(minColor, color);\n\t\t\t\tmaxColor = max(maxColor, color);\n\t\t\t}\n\t\t}\n \n\t\tvec3 clamped = clamp(historyColor.rgb, minColor, maxColor);\n\t\treturn vec4(clamped, historyColor.a);\n\t}\n\tvoid main()\n\t{\n\t\tvec2 uv = uv0;\n\t\t#ifdef WEBGPU\n\t\t\tuv.y = 1.0 - uv.y;\n\t\t#endif\n\t\tvec4 srcColor = texture2D(sourceTexture, uv);\n\t\tfloat depth = texture2DLodEXT(uSceneDepthMap, uv, 0.0).r;\n\t\tvec2 historyUv = reproject(uv0, depth);\n\t\t#ifdef QUALITY_HIGH\n\t\t\tvec4 historyColor = SampleTextureCatmullRom(TEXTURE_PASS(historyTexture), historyUv, textureSize);\n\t\t#else\n\t\t\tvec4 historyColor = texture2D(historyTexture, historyUv);\n\t\t#endif\n\t\tvec4 historyColorClamped = colorClamp(uv, historyColor);\n\t\tfloat mixFactor = (historyUv.x < 0.0 || historyUv.x > 1.0 || historyUv.y < 0.0 || historyUv.y > 1.0) ?\n\t\t\t1.0 : 0.05;\n\t\tgl_FragColor = mix(historyColorClamped, srcColor, mixFactor);\n\t}\n");var a=e.scope;return s.sourceTextureId=a.resolve("sourceTexture"),s.textureSizeId=a.resolve("textureSize"),s.textureSize=new Float32Array(2),s.historyTextureId=a.resolve("historyTexture"),s.viewProjPrevId=a.resolve("matrix_viewProjectionPrevious"),s.viewProjInvId=a.resolve("matrix_viewProjectionInverse"),s.jittersId=a.resolve("jitters"),s.setup(),s}x(e,t);var i=e.prototype;return i.destroy=function(){this.renderTarget&&(this.renderTarget.destroyTextureBuffers(),this.renderTarget.destroy(),this.renderTarget=null)},i.setup=function(){for(var t=0;t<2;++t)this.historyTextures[t]=new dr(this.device,{name:"TAA-History-"+t,width:4,height:4,format:this.sourceTexture.format,mipmaps:!1,minFilter:1,magFilter:1,addressU:1,addressV:1}),this.historyRenderTargets[t]=new Dn({colorBuffer:this.historyTextures[t],depth:!1});this.historyTexture=this.historyTextures[0],this.init(this.historyRenderTargets[0],{resizeSource:this.sourceTexture})},i.before=function(){this.sourceTextureId.setValue(this.sourceTexture),this.historyTextureId.setValue(this.historyTextures[1-this.historyIndex]),this.textureSize[0]=this.sourceTexture.width,this.textureSize[1]=this.sourceTexture.height,this.textureSizeId.setValue(this.textureSize);var t=this.cameraComponent.camera;this.viewProjPrevId.setValue(t._viewProjPrevious.data),this.viewProjInvId.setValue(t._viewProjInverse.data),this.jittersId.setValue(t._jitters)},i.update=function(){return this.historyIndex=1-this.historyIndex,this.historyTexture=this.historyTextures[this.historyIndex],this.renderTarget=this.historyRenderTargets[this.historyIndex],this.historyTexture},e}(np),vM=[],gM=function(t){function e(e,i,n,s,r,a){var o;return(o=t.call(this,e)||this).viewBindGroups=[],o.velocityTexture=void 0,o.scene=i,o.renderer=n,o.camera=s,o.setupRenderTarget(r,a),o}x(e,t);var i=e.prototype;return i.destroy=function(){var e,i;t.prototype.destroy.call(this),null==(e=this.renderTarget)||e.destroy(),this.renderTarget=null,null==(i=this.velocityTexture)||i.destroy(),this.velocityTexture=null,this.viewBindGroups.forEach((function(t){t.defaultUniformBuffer.destroy(),t.destroy()})),this.viewBindGroups.length=0},i.setupRenderTarget=function(t,e){var i=this.device,n=i.getRenderableHdrFormat([Se,ye]);this.velocityTexture=new dr(i,{name:"VelocityTexture",width:4,height:4,format:n,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1});var s=new Dn({name:"PrepassRT",depthBuffer:t});this.init(s,e),this.depthStencilOps.storeDepth=!0},i.after=function(){this.device.scope.resolve("uSceneDepthMap").setValue(this.renderTarget.depthBuffer),this.device.scope.resolve("uSceneVelocityMap").setValue(this.velocityTexture)},i.execute=function(){for(var t=this.renderer,e=this.scene,i=this.renderTarget,n=this.camera.camera,s=e.layers.layerList,r=e.layers.subLayerEnabled,a=e.layers.subLayerList,o=0;o.9?(mP.copy(this._camera.entity.getRotation()).invert(),dP.sub2(o,i),mP.transformVector(dP,dP),h=Math.sign(c)*Math.atan2(dP.y,dP.x)*_t.RAD_TO_DEG):(dP.cross(a.normal,l).normalize(),h=900*n.dot(dP),1===this._camera.projection&&(h/=this._camera.orthoHeight||1)),{point:o,angle:h}},v(e,[{key:"xyzTubeRadius",get:function(){return this._shapes.x.tubeRadius},set:function(t){this._setDiskProp("tubeRadius",t)}},{key:"xyzRingRadius",get:function(){return this._shapes.x.ringRadius},set:function(t){this._setDiskProp("ringRadius",t)}},{key:"faceTubeRadius",get:function(){return this._shapes.face.tubeRadius},set:function(t){this._shapes.face.tubeRadius=t}},{key:"faceRingRadius",get:function(){return this._shapes.face.ringRadius},set:function(t){this._shapes.face.ringRadius=t}},{key:"ringTolerance",get:function(){return this._shapes.x.tolerance},set:function(t){this._setDiskProp("tolerance",t),this._shapes.face.tolerance=t}}])}(UM),gP=new Ct,yP=new Ct,xP=new Vt,SP=function(t){function e(e,i,n){var s;return(s=t.call(this,e,i,n)||this)._shapes={xyz:new sP(s._device,{axis:"xyz",layers:[s._layer.id],defaultColor:s._meshColors.axis.xyz,hoverColor:s._meshColors.hover.xyz}),yz:new oP(s._device,{axis:"x",flipAxis:"y",layers:[s._layer.id],rotation:new Ct(0,0,-90),defaultColor:s._meshColors.axis.x,hoverColor:s._meshColors.hover.x}),xz:new oP(s._device,{axis:"y",flipAxis:"z",layers:[s._layer.id],rotation:new Ct(0,0,0),defaultColor:s._meshColors.axis.y,hoverColor:s._meshColors.hover.y}),xy:new oP(s._device,{axis:"z",flipAxis:"x",layers:[s._layer.id],rotation:new Ct(90,0,0),defaultColor:s._meshColors.axis.z,hoverColor:s._meshColors.hover.z}),x:new rP(s._device,{axis:"x",layers:[s._layer.id],rotation:new Ct(0,0,-90),defaultColor:s._meshColors.axis.x,hoverColor:s._meshColors.hover.x}),y:new rP(s._device,{axis:"y",layers:[s._layer.id],rotation:new Ct(0,0,0),defaultColor:s._meshColors.axis.y,hoverColor:s._meshColors.hover.y}),z:new rP(s._device,{axis:"z",layers:[s._layer.id],rotation:new Ct(90,0,0),defaultColor:s._meshColors.axis.z,hoverColor:s._meshColors.hover.z})},s._coordSpace=wM,s._nodeScales=new Map,s._useUniformScaling=!1,s.snapIncrement=1,s._createTransform(),s.on("transform:start",(function(){s._selectionStartPoint.sub(Ct.ONE),s._storeNodeScales()})),s.on("transform:move",(function(t){s.snap&&(t.mulScalar(1/s.snapIncrement),t.round(),t.mulScalar(s.snapIncrement)),s._setNodeScales(t)})),s.on("nodes:detach",(function(){s._nodeScales.clear()})),s}x(e,t);var i=e.prototype;return i._setArrowProp=function(t,e){this._shapes.x[t]=e,this._shapes.y[t]=e,this._shapes.z[t]=e},i._setPlaneProp=function(t,e){this._shapes.yz[t]=e,this._shapes.xz[t]=e,this._shapes.xy[t]=e},i._storeNodeScales=function(){for(var t=0;t=r.length?e(new Error("Failed to create a graphics device")):Promise.resolve(r[i++]()).then((function(e){e?t(e):n()})).catch((function(t){console.log(t),n()}))};n()}))},t.createMesh=FA,t.createPlane=RA,t.createScript=qT,t.createShader=zo,t.createShaderFromCode=Vo,t.createSphere=PA,t.createStyle=function(t){var e=document.createElement("style");return e.type="text/css",e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),e},t.createTorus=DA,t.createURI=function(t){var e="";if((t.authority||t.scheme)&&(t.host||t.hostpath))throw new Error("Can't have 'scheme' or 'authority' and 'host' or 'hostpath' option");if(t.host&&t.hostpath)throw new Error("Can't have 'host' and 'hostpath' option");if(t.path&&t.hostpath)throw new Error("Can't have 'path' and 'hostpath' option");return t.scheme&&(e+=t.scheme+":"),t.authority&&(e+="//"+t.authority),t.host&&(e+=t.host),t.path&&(e+=t.path),t.hostpath&&(e+=t.hostpath),t.query&&(e+="?"+t.query),t.fragment&&(e+="#"+t.fragment),e},t.data={},t.dracoInitialize=function(t){null!=t&&t.lazyInit?WS=t:YS(t)},t.drawFullscreenQuad=BA,t.drawQuadWithShader=Zo,t.drawTexture=function(t,e,i,n,s,r){n=n||t.getCopyShader(),t.constantTexSource.setValue(e),Zo(t,i,n,s,r)},t.events=R,t.extend=d,t.getPixelFormatArrayType=Fe,t.getProgramLibrary=Bo,t.getReservedScriptNames=function(){return jT},t.getTouchTargetCoords=Qa,t.gfx=CA,t.guid=I,t.http=io,t.inherits=function(t,e){var i=function(){},n=function(i,n,s,r,a,o,h,l){e.call(this,i,n,s,r,a,o,h,l),t.call(this,i,n,s,r,a,o,h,l)};return n._super=e.prototype,i.prototype=e.prototype,n.prototype=new i,n},t.input=QA,t.isCompressedPixelFormat=ke,t.isIntegerPixelFormat=Oe,t.log=xA,t.makeArray=function(t){return Array.prototype.slice.call(t)},t.math=_t,t.now=dt,t.path=D,t.pixelFormatInfo=Le,t.platform=G,t.posteffect=NA,t.prefilterCubemap=function(t){},t.programlib=AA,t.registerScript=KT,t.reprojectTexture=pc,t.revision=h,t.scene=HA,t.script=jp,t.semanticToLocation=tn,t.shFromCubemap=function(t,e,i){if(7!==e.format)return null;if(!e._levels[0]||!e._levels[0][0])return null;var n=e.width;if(!e._levels[0][0].length){if(!(e._levels[0][0]instanceof HTMLImageElement))return null;for(var s=Vo(t,Oo.fullscreenQuadVS,Oo.fullscreenQuadPS,"fsQuadSimple"),r=t.scope.resolve("source"),a=0;a<6;a++){var o=e._levels[0][a],h=new dr(t,{name:"prefiltered-cube",cubemap:!1,type:_i,format:e.format,width:n,height:n,mipmaps:!1});h._levels[0]=o,h.upload();var l=new dr(t,{name:"prefiltered-cube",cubemap:!1,type:_i,format:e.format,width:n,height:n,mipmaps:!1}),c=new Dn({colorBuffer:l,depth:!1});r.setValue(h),t.setBlendState(hn.NOBLEND),Zo(t,c,s);var u=t.gl;u.bindFramebuffer(u.FRAMEBUFFER,c.impl._glFrameBuffer);var d=new Uint8Array(n*n*4);u.readPixels(0,0,h.width,h.height,u.RGBA,u.UNSIGNED_BYTE,d),e._levels[0][a]=d}}for(var f=[],p=0;p = { + default: '4a9417393c890dc8498e1a3a93a92424' +} + +/** + * Default Amplitude configuration options. Contains tracking plan information. + */ +export const DefaultConfiguration: BrowserOptions = { + plan: { + version: '1', + branch: 'main', + source: 'web', + versionId: '84e8930d-d0e7-4c92-b6c6-629ff838c9a6' + }, + ...{ + ingestionMetadata: { + sourceName: 'browser-typescript-ampli', + sourceVersion: '2.0.0' + } + } +} + +export interface LoadOptionsBase { + disabled?: boolean +} + +export type LoadOptionsWithEnvironment = LoadOptionsBase & { + environment: Environment + client?: { configuration?: BrowserOptions } +} +export type LoadOptionsWithApiKey = LoadOptionsBase & { + client: { apiKey: string; configuration?: BrowserOptions } +} +export type LoadOptionsWithClientInstance = LoadOptionsBase & { + client: { instance: BrowserClient } +} + +export type LoadOptions = + | LoadOptionsWithEnvironment + | LoadOptionsWithApiKey + | LoadOptionsWithClientInstance + +export type PromiseResult = { promise: Promise } + +const getVoidPromiseResult = () => ({ promise: Promise.resolve() }) + +// prettier-ignore +export class Ampli { + private disabled: boolean = false; + private amplitude?: BrowserClient; + + get client(): BrowserClient { + this.isInitializedAndEnabled(); + return this.amplitude!; + } + + get isLoaded(): boolean { + return this.amplitude != null; + } + + private isInitializedAndEnabled(): boolean { + if (!this.amplitude) { + console.error('ERROR: Ampli is not yet initialized. Have you called ampli.load() on app start?'); + return false; + } + return !this.disabled; + } + + /** + * Initialize the Ampli SDK. Call once when your application starts. + * + * @param options Configuration options to initialize the Ampli SDK with. + */ + load(options: LoadOptions): PromiseResult { + this.disabled = options.disabled ?? false; + + if (this.amplitude) { + console.warn('WARNING: Ampli is already intialized. Ampli.load() should be called once at application startup.'); + return getVoidPromiseResult(); + } + + let apiKey: string | null = null; + if (options.client && 'apiKey' in options.client) { + apiKey = options.client.apiKey; + } else if ('environment' in options) { + apiKey = ApiKey[options.environment]; + } + + if (options.client && 'instance' in options.client) { + this.amplitude = options.client.instance; + } else if (apiKey) { + this.amplitude = amplitude.createInstance(); + const configuration = (options.client && 'configuration' in options.client) ? options.client.configuration : {}; + return this.amplitude.init(apiKey, undefined, { ...DefaultConfiguration, ...configuration }); + } else { + console.error("ERROR: ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'"); + } + + return getVoidPromiseResult(); + } + + /** + * Identify a user and set user properties. + * + * @param userId The user's id. + * @param options Optional event options. + */ + identify( + userId: string | undefined, + options?: EventOptions, + ): PromiseResult { + if (!this.isInitializedAndEnabled()) { + return getVoidPromiseResult(); + } + + if (userId) { + options = {...options, user_id: userId}; + } + + const amplitudeIdentify = new amplitude.Identify(); + return this.amplitude!.identify( + amplitudeIdentify, + options, + ); + } + + /** + * Flush the event. + */ + flush() : PromiseResult { + if (!this.isInitializedAndEnabled()) { + return getVoidPromiseResult(); + } + + return this.amplitude!.flush(); + } + + /** + * Track event + * + * @param event The event to track. + * @param options Optional event options. + */ + track(event: Event, options?: EventOptions): PromiseResult { + if (!this.isInitializedAndEnabled()) { + return getVoidPromiseResult(); + } + + return this.amplitude!.track(event, undefined, options); + } + +} + +export const ampli = new Ampli() + +// BASE TYPES +type BrowserOptions = amplitude.Types.BrowserOptions + +export type BrowserClient = amplitude.Types.BrowserClient +export type BaseEvent = amplitude.Types.BaseEvent +export type IdentifyEvent = amplitude.Types.IdentifyEvent +export type GroupEvent = amplitude.Types.GroupIdentifyEvent +export type Event = amplitude.Types.Event +export type EventOptions = amplitude.Types.EventOptions +export type Result = amplitude.Types.Result diff --git a/mirror-2/state/api/assets.tsx b/mirror-2/state/api/assets.tsx new file mode 100644 index 00000000..1cfa7f03 --- /dev/null +++ b/mirror-2/state/api/assets.tsx @@ -0,0 +1,260 @@ +import { + createSlice, + createEntityAdapter, + createAsyncThunk +} from '@reduxjs/toolkit' +import { createApi, fakeBaseQuery } from '@reduxjs/toolkit/query/react' +import { createSupabaseBrowserClient } from '@/utils/supabase/client' +import { Database } from '@/utils/database.types' + +export type DatabaseAsset = Database['public']['Tables']['assets']['Row'] +export type DatabaseAssetInsert = + Database['public']['Tables']['assets']['Insert'] +export type DatabaseAssetUpdate = + Database['public']['Tables']['assets']['Update'] +export type AssetId = number & { __brand: 'AssetId' } + +export const ASSETS_BUCKET_USERS_FOLDER = 'users' // used for the assets bucket +export const ASSETS_BUCKET_VERSIONED_ASSETS_FOLDER = 'versioned' // generally immutable, used for space_packs (published Spaces/games) +const TABLE_NAME = 'assets' + +export interface CreateAssetMutation { + name: string +} +export const TAG_NAME_FOR_GENERAL_ENTITY = 'Assets' + +// Supabase API for spaces +export const assetsApi = createApi({ + reducerPath: 'assetsApi', + baseQuery: fakeBaseQuery(), + tagTypes: [TAG_NAME_FOR_GENERAL_ENTITY, 'LIST'], + endpoints: (builder) => ({ + createAsset: builder.mutation< + any, + { assetData: CreateAssetMutation; file?: File } + >({ + queryFn: async ({ assetData, file }) => { + const supabase = createSupabaseBrowserClient() + + // Get the authenticated user + const { + data: { user }, + error: authError + } = await supabase.auth.getUser() + if (!user) { + return { error: 'User not found' } + } + + // Prepare the data to insert, without file_url and thumbnail_url yet + const assetInsertData: Database['public']['Tables']['assets']['Insert'] = + { + ...assetData, + creator_user_id: user.id, + owner_user_id: user.id, + file_url: '', // Placeholder, will update after file upload + thumbnail_url: '' // Placeholder, will update after file upload + } + + // Insert the asset (without file URL and thumbnail URL for now) + const { + data: insertedAsset, + error: insertError + }: { + data: Database['public']['Tables']['assets']['Row'] | null + error: any + } = await supabase + .from(TABLE_NAME) + .insert([assetInsertData]) + .select('*') + .single() + + if (insertError || !insertedAsset) { + return { error: insertError.message } + } + + // Variable to store the file path (if file exists) + let filePath = '' + + // Check if a file is passed for upload + if (file) { + // Generate a unique file name for Supabase Storage + filePath = `${ASSETS_BUCKET_USERS_FOLDER}/${insertedAsset.id}` + + // Upload the file to Supabase Storage + const { error: uploadError } = await supabase.storage + .from('assets') // Replace with your bucket name + .upload(filePath, file) + + // Handle file upload error + if (uploadError) { + return { error: uploadError.message } + } + + // Get the public URL of the uploaded file + const { data: fileUrlData } = supabase.storage + .from('assets') + .getPublicUrl(filePath) + const fileUrl = fileUrlData?.publicUrl + + // Create a thumbnail URL using Supabase transform (resize) + const { data: thumbnailUrlData } = supabase.storage + .from('assets') + .getPublicUrl(filePath, { + transform: { + width: 150, + height: 150 + } + }) + const thumbnailUrl = thumbnailUrlData?.publicUrl + + // Update the asset with the file URL and thumbnail URL + const { error: updateError } = await supabase + .from(TABLE_NAME) + .update({ + file_url: fileUrl, + thumbnail_url: thumbnailUrl + }) + .eq('id', insertedAsset.id) // Use the inserted asset's ID for the update + .single() + + if (updateError) { + return { error: updateError.message } + } + } + + return { data: insertedAsset } + }, + invalidatesTags: [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] + }), + + getSingleAsset: builder.query({ + queryFn: async (assetId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from(TABLE_NAME) + .select('*') + .eq('id', assetId) + .single() + + if (error) { + return { error: error.message } + } + return { data } + }, + providesTags: (result, error, id) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id } + ] + }), + + getUserMostRecentlyUpdatedAssets: builder.query({ + queryFn: async () => { + const supabase = createSupabaseBrowserClient() + const { + data: { user } + } = await supabase.auth.getUser() + if (!user) { + throw new Error('User not found') + } + const { data, error } = await supabase + .from(TABLE_NAME) + .select('*') + .eq('owner_user_id', user.id) + .order('updated_at', { ascending: false }) + + if (error) { + return { error: error.message } + } + return { data } + }, + providesTags: (result) => + result + ? [ + ...result.map(({ id }) => ({ + type: TAG_NAME_FOR_GENERAL_ENTITY, + id + })), + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' } + ] + : [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] + }), + + searchAssets: builder.query({ + queryFn: async ({ text }) => { + const supabase = createSupabaseBrowserClient() + + // replace spaces with + + const friendlyText = text?.trim().replaceAll(' ', '&') + const { data, error } = await supabase.rpc( + 'search_assets_by_name_prefix', + { prefix: friendlyText } + ) + + if (error) { + return { error: error.message } + } + return { data } + }, + providesTags: (result) => + result + ? [ + ...result.map(({ id }) => ({ + type: TAG_NAME_FOR_GENERAL_ENTITY, + id + })), + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' } + ] + : [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] + }), + + updateAsset: builder.mutation< + any, + { id: string; updateData: Record } + >({ + queryFn: async ({ id: assetId, updateData }) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from(TABLE_NAME) + .update(updateData) + .eq('id', assetId) + .single() + + if (error) { + return { error: error.message } + } + return { data } + }, + invalidatesTags: (result, error, { id: assetId }) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: assetId } + ] + }), + + downloadAsset: builder.query({ + queryFn: async ({ assetId }) => { + const supabase = createSupabaseBrowserClient() + + // Return the public URL for the file to allow download + const { data, error } = await supabase.storage + .from('assets') // Use your actual bucket name + .download(`users/${assetId}`) + + if (error) { + return { error: error.message } + } + return { data } + } + }) + }) +}) + +// Export the API hooks +export const { + useCreateAssetMutation, + useSearchAssetsQuery, + useLazySearchAssetsQuery, + useGetSingleAssetQuery, + useLazyGetUserMostRecentlyUpdatedAssetsQuery, + useUpdateAssetMutation, + useLazyDownloadAssetQuery +} = assetsApi diff --git a/mirror-2/state/api/entities.tsx b/mirror-2/state/api/entities.tsx new file mode 100644 index 00000000..f8e91e64 --- /dev/null +++ b/mirror-2/state/api/entities.tsx @@ -0,0 +1,704 @@ +import { + createSlice, + createEntityAdapter, + createAsyncThunk, + createListenerMiddleware, + isAnyOf, + createSelector +} from '@reduxjs/toolkit' +import { createApi, fakeBaseQuery } from '@reduxjs/toolkit/query/react' +import { createSupabaseBrowserClient } from '@/utils/supabase/client' +import { TAG_NAME_FOR_BUILD_MODE_SPACE_QUERY } from '@/state/shared-cache-tags' + +import { Database } from '@/utils/database.types' +import { SceneId } from '@/state/api/scenes' +import { updateEngineApp } from '@/state/engine/engine-old' +import { RootState } from '@/state/store' + +// Define types for the entities table +export type DatabaseEntity = Database['public']['Tables']['entities']['Row'] +export type DatabaseEntityInsert = + Database['public']['Tables']['entities']['Insert'] +export type DatabaseEntityUpdate = + Database['public']['Tables']['entities']['Update'] +export const TAG_NAME_FOR_GENERAL_ENTITY = 'Entities' +export type EntityId = string + +// Supabase API for spaces +export const entitiesApi = createApi({ + reducerPath: 'entitiesApi', + baseQuery: fakeBaseQuery(), + tagTypes: [ + TAG_NAME_FOR_GENERAL_ENTITY, + 'LIST', + TAG_NAME_FOR_BUILD_MODE_SPACE_QUERY + ], + endpoints: (builder) => ({ + createEntity: builder.mutation< + any, + { + name: string + scene_id: number + parent_id?: string + order_under_parent?: number + isRootEntity?: boolean + } + >({ + queryFn: async ({ + name, + scene_id, + parent_id, + order_under_parent, + isRootEntity + }) => { + const supabase = createSupabaseBrowserClient() + const { + data: { user }, + error: authError + } = await supabase.auth.getUser() + + if (!user) { + return { error: 'User not found' } + } + + // if no parent_id and not the root entity upon creation, find the root entity + if (!parent_id && !isRootEntity) { + const { data: rootEntity, error: rootEntityError } = await supabase + .from('entities') + .select('*') + .eq('scene_id', scene_id) + .is('parent_id', null) + .single() + + if (rootEntityError) { + return { error: rootEntityError.message } + } + + parent_id = rootEntity.id + } + + if ( + parent_id && + (order_under_parent === undefined || order_under_parent === null) + ) { + // need to find the order_under_parent to use for the new entity + const { data: entitiesWithSameParent, error: parentEntityError } = + await supabase + .from('entities') + .select('*') + .eq('parent_id', parent_id) + + if (parentEntityError) { + return { error: parentEntityError.message } + } + // find the highest order_under_parent + if (entitiesWithSameParent) { + const highestOrderUnderParent = entitiesWithSameParent.reduce( + (max, entity) => { + const entityOrderUnderParent = entity.order_under_parent ?? -1 // If null or undefined, default to -1 + return entityOrderUnderParent > max + ? entityOrderUnderParent + : max + }, + -1 + ) + order_under_parent = highestOrderUnderParent + 1 + } + } + + const { data, error } = await supabase + .from('entities') + .insert({ + name: name, + scene_id, + parent_id, + order_under_parent, + created_at: new Date().toISOString(), + updated_at: new Date().toISOString() + }) + .select('*') + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] + }), + + getAllEntities: builder.query({ + queryFn: async (sceneId) => { + const supabase = createSupabaseBrowserClient() + + if (!sceneId) { + return { error: 'No scene_id provided' } + } + + const { data, error } = await supabase + .from('entities') + .select('*') + .eq('scene_id', sceneId) + + if (error) { + return { error: error.message } + } + return { data } + }, + providesTags: (result: any) => + result + ? [ + ...result.map(({ id }) => ({ + type: TAG_NAME_FOR_GENERAL_ENTITY, + id + })), + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' } + ] + : [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] + }), + + getSingleEntity: builder.query({ + queryFn: async (entityId: EntityId) => { + if (!entityId) { + return { error: 'No entityId (string) provided' } + } + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('entities') + .select('*') + .eq('id', entityId) + .single() + + if (error) { + return { error: error.message } + } + return { data } + }, + providesTags: (result, error, entityId) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: entityId } + ] // Provide the entity tag based on entityId + }), + + updateEntity: builder.mutation< + any, + { + id: EntityId + name?: string + enabled?: boolean + parent_id?: string + order_under_parent?: number + scene_id?: number + local_position?: [number, number, number] // Using array for vector3 + local_scale?: [number, number, number] // Using array for scale + local_rotation?: [number, number, number] // Using array for rotation (Euler angles or quaternion) + } + >({ + queryFn: async ({ + id, + name, + enabled, + parent_id, + order_under_parent, + scene_id, + local_position, + local_scale, + local_rotation + }) => { + const supabase = createSupabaseBrowserClient() + + // If no parent_id, find the root entity + if (!parent_id) { + if (!scene_id) { + return { error: 'No scene_id provided' } + } + const { data: rootEntity, error: rootEntityError } = await supabase + .from('entities') + .select('*') + .eq('scene_id', scene_id) + .is('parent_id', null) + .single() + + if (rootEntityError) { + return { error: rootEntityError.message } + } + + if (rootEntity.id !== id) { + // ensure not self (the Root) + parent_id = rootEntity.id + } + } + + // If parent_id exists but no order_under_parent + if ( + (parent_id && order_under_parent === undefined) || + (parent_id && order_under_parent === null) + ) { + const { data: entitiesWithSameParent, error: parentEntityError } = + await supabase + .from('entities') + .select('*') + .eq('parent_id', parent_id) + + if (parentEntityError) { + return { error: parentEntityError.message } + } + + // Find the highest order_under_parent + const highestOrderUnderParent = entitiesWithSameParent.reduce( + (max, entity: any) => { + return entity.order_under_parent > max + ? entity.order_under_parent + : max + }, + -1 + ) + order_under_parent = highestOrderUnderParent + 1 + } + + // Prepare the update payload + const updatePayload: any = { + name, + enabled, + parent_id, + order_under_parent, + scene_id + } + + // Add position, scale, rotation updates if provided + if (local_position) updatePayload.local_position = local_position + if (local_rotation) updatePayload.local_rotation = local_rotation + if (local_scale) updatePayload.local_scale = local_scale + + const { data, error } = await supabase + .from('entities') + .update(updatePayload) + .eq('id', id) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + + // Optimistic update + async onQueryStarted({ id, ...patch }, { dispatch, queryFulfilled }) { + const patchResult = dispatch( + entitiesApi.util.updateQueryData('getSingleEntity', id, (draft) => { + Object.assign(draft, patch) + }) + ) + try { + await queryFulfilled + } catch { + patchResult.undo() + } + }, + + invalidatesTags: (result, error, { id: entityId }) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: entityId }, + TAG_NAME_FOR_BUILD_MODE_SPACE_QUERY + ] + }), + + batchUpdateEntities: builder.mutation< + any, + { + entities: { + id: EntityId + name?: string + scene_id?: number + parent_id?: string + order_under_parent?: number + }[] + enabled?: boolean + } + >({ + queryFn: async ({ entities }) => { + const supabase = createSupabaseBrowserClient() + const entityIds = entities.map((entity) => entity.id) + + // Fetch all current entities by the provided IDs. This is needed since supabase batch upsert requires ALL properties to be passed in or else it overwrites the existing data. + const { data: existingEntities, error: fetchError } = await supabase + .from('entities') + .select('*') + .in('id', entityIds) + + if (fetchError) { + return { error: fetchError.message } + } + + // Merge each entity's new properties with existing data + const entitiesToUpsert = entities.map((newEntity) => { + const existingEntity = existingEntities.find( + (e) => e.id === newEntity.id + ) + + if (existingEntity === undefined) { + throw new Error( + `Entity with ID ${(existingEntity as any).id} doesn't exist` + ) + } + + // Merge existing entity fields with new updates + const data = { + ...existingEntity, // Existing entity data + ...newEntity, // New updates, this will override fields like name, scene_id, etc. + updated_at: new Date().toISOString() // Update timestamp + } + + if (!existingEntity?.name) { + throw new Error( + `Entity with ID ${existingEntity?.id} is missing a name` + ) + } + + return data + }) + + // Perform the batch upsert + const { data: upsertData, error: upsertError } = await supabase + .from('entities') + .upsert(entitiesToUpsert) + .select('*') // You can select specific fields if you want + + if (upsertError) { + return { error: upsertError.message } + } + + return { data: upsertData } + }, + invalidatesTags: [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] // Invalidates the cache + }), + + deleteEntity: builder.mutation({ + queryFn: async (entityId: EntityId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('entities') + .delete() + .eq('id', entityId) + .single() + + if (error) { + return { error: error.message } + } + return { data } + }, + invalidatesTags: (result, error, entityId) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: entityId } + ] + }), + + /** + * Components + */ + addComponentToEntity: builder.mutation< + any, + { + id: EntityId + componentKey: string // The key for the component (e.g., 'render') + componentData: any // The new component data to be added + } + >({ + queryFn: async ({ id, componentKey, componentData }) => { + const supabase = createSupabaseBrowserClient() + + // Fetch the existing components + const { data: existingEntity, error: fetchError } = await supabase + .from('entities') + .select('components') + .eq('id', id) + .single() + + if (fetchError) { + return { error: fetchError.message } + } + + // Merge the new component data under the specified key (componentKey) + const updatedComponents = { + ...(typeof existingEntity.components === 'object' + ? existingEntity.components + : {}), + [componentKey]: componentData // Add or overwrite the specific component + } + + const { data, error } = await supabase + .from('entities') + .update({ components: updatedComponents }) + .eq('id', id) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, { id }) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id } + ] + }), + + getComponentsOfEntity: builder.query({ + queryFn: async (id: EntityId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('entities') + .select('components') + .eq('id', id) + .single() + + if (error) { + return { error: error.message } + } + + return { data: data.components } + }, + providesTags: (result, error, id) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id } + ] + }), + + updateComponentOnEntity: builder.mutation< + any, + { + id: EntityId + componentKey: string // The key for the component (e.g., 'render') + updatedComponentData: any // The new data for the component + } + >({ + queryFn: async ({ id, componentKey, updatedComponentData }) => { + const supabase = createSupabaseBrowserClient() + + // Fetch the existing components + const { data: existingEntity, error: fetchError } = await supabase + .from('entities') + .select('components') + .eq('id', id) + .single() + + if (fetchError) { + return { error: fetchError.message } + } + + // Update the specific component in the JSONB object + const updatedComponents = { + ...(typeof existingEntity.components === 'object' + ? existingEntity.components + : {}), + [componentKey]: updatedComponentData // Update only the specific component + } + + const { data, error } = await supabase + .from('entities') + .update({ components: updatedComponents }) + .eq('id', id) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, { id }) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id } + ] + }), + + deleteComponentFromEntity: builder.mutation< + any, + { + id: EntityId + componentKey: string // The key of the component to be deleted + } + >({ + queryFn: async ({ id, componentKey }) => { + const supabase = createSupabaseBrowserClient() + + // Fetch the existing components + const { data: existingEntity, error: fetchError } = await supabase + .from('entities') + .select('components') + .eq('id', id) + .single() + + if (fetchError) { + return { error: fetchError.message } + } + + // Ensure existingEntity.components is typed correctly + const components = existingEntity.components as Record + + // Remove the specific component from the JSONB object + const { [componentKey]: _, ...remainingComponents } = components + + const { data, error } = await supabase + .from('entities') + .update({ components: remainingComponents }) + .eq('id', id) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, { id }) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id } + ] + }) + /** + * End Components + */ + }) +}) + +/** + * Middleware to react to state/entity updates and update the Space app + */ +export const listenerMiddlewareEntities = createListenerMiddleware() + +// **Pending Actions Listener** +listenerMiddlewareEntities.startListening({ + predicate: (action) => + entitiesApi.endpoints.createEntity.matchPending(action) || + entitiesApi.endpoints.updateEntity.matchPending(action) || + entitiesApi.endpoints.batchUpdateEntities.matchPending(action) || + entitiesApi.endpoints.deleteEntity.matchPending(action), + effect: async (action, listenerApi) => { + const state = listenerApi.getState() as RootState + + // Access all queries from the entitiesApi cache + const queries = state[entitiesApi.reducerPath]?.queries || {} + + // Extract all entities from each cached query + const allEntities: DatabaseEntity[] = [] + + try { + Object.keys(queries).forEach((queryKey) => { + const query = queries[queryKey] + + // Ensure query.data exists and is an array + if (query?.data && Array.isArray(query.data)) { + // Type assertion: Now we can safely assume query.data is an array of DatabaseEntity[] + const entitiesArray = query.data as DatabaseEntity[] + + allEntities.push(...entitiesArray) + } + }) + } catch (error) { + console.error('Error while extracting entities from cache:', error) + } + + // Pass the optimistic changes to PlayCanvas or your engine + console.log('Optimistically updating entities', allEntities) + updateEngineApp(allEntities, { isOptimistic: true }) + } +}) + +listenerMiddlewareEntities.startListening({ + predicate: (action) => + entitiesApi.endpoints.createEntity.matchFulfilled(action) || + entitiesApi.endpoints.updateEntity.matchFulfilled(action) || + entitiesApi.endpoints.batchUpdateEntities.matchFulfilled(action) || + entitiesApi.endpoints.deleteEntity.matchFulfilled(action), + effect: async (action, listenerApi) => { + const state = listenerApi.getState() as RootState + + // Access all queries from the entitiesApi cache + const queries = state[entitiesApi.reducerPath]?.queries || {} + + // Extract all entities from each cached query + const allEntities: DatabaseEntity[] = [] + + try { + Object.keys(queries).forEach((queryKey) => { + const query = queries[queryKey] + + // Ensure query.data exists and is an array + if (query?.data && Array.isArray(query.data)) { + // Type assertion: Now we can safely assume query.data is an array of DatabaseEntity[] + const entitiesArray = query.data as DatabaseEntity[] + + allEntities.push(...entitiesArray) + } + }) + } catch (error) { + console.error('Error while extracting entities from cache:', error) + } + + // Apply confirmed changes to PlayCanvas or your engine + console.log('Applying confirmed updates to entities', allEntities) + updateEngineApp(allEntities, { isOptimistic: false }) + } +}) + +listenerMiddlewareEntities.startListening({ + predicate: (action) => + entitiesApi.endpoints.createEntity.matchRejected(action) || + entitiesApi.endpoints.updateEntity.matchRejected(action) || + entitiesApi.endpoints.batchUpdateEntities.matchRejected(action) || + entitiesApi.endpoints.deleteEntity.matchRejected(action), + effect: async (action, listenerApi) => { + const state = listenerApi.getState() as RootState + + // Access all queries from the entitiesApi cache + const queries = state[entitiesApi.reducerPath]?.queries || {} + + // Extract all entities from each cached query + const allEntities: DatabaseEntity[] = [] + + try { + Object.keys(queries).forEach((queryKey) => { + const query = queries[queryKey] + + // Ensure query.data exists and is an array + if (query?.data && Array.isArray(query.data)) { + // Type assertion: Now we can safely assume query.data is an array of DatabaseEntity[] + const entitiesArray = query.data as DatabaseEntity[] + + allEntities.push(...entitiesArray) + } + }) + } catch (error) { + console.error('Error while extracting entities from cache:', error) + } + + // Revert the changes in PlayCanvas or your engine + console.log('Reverting updates to entities', allEntities) + updateEngineApp(allEntities, { isReverted: true }) + } +}) + +export const selectEntitiesResult = entitiesApi.endpoints.getAllEntities.select + +const selectEntitiesBySceneId = createSelector( + (state) => state.entities.data, + (_, sceneId: SceneId) => sceneId, + (entities: DatabaseEntity[], sceneId: SceneId) => + entities.filter((entity) => entity.scene_id === sceneId) +) + +// Export the API hooks +export const { + useCreateEntityMutation, + useBatchUpdateEntitiesMutation, + useGetAllEntitiesQuery, + useUpdateEntityMutation, + useGetSingleEntityQuery, + useLazyGetAllEntitiesQuery, + useDeleteEntityMutation, + + useAddComponentToEntityMutation, + useGetComponentsOfEntityQuery, + useUpdateComponentOnEntityMutation, + useDeleteComponentFromEntityMutation +} = entitiesApi diff --git a/mirror-2/state/api/scenes.tsx b/mirror-2/state/api/scenes.tsx new file mode 100644 index 00000000..db86dd31 --- /dev/null +++ b/mirror-2/state/api/scenes.tsx @@ -0,0 +1,230 @@ +import { entitiesApi } from '@/state/api/entities' +import { AnalyticsEvent, sendAnalyticsEvent } from '@/utils/analytics/analytics' +import { Database } from '@/utils/database.types' +import { createSupabaseBrowserClient } from '@/utils/supabase/client' +import { createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit' +import { createApi, fakeBaseQuery } from '@reduxjs/toolkit/query/react' + +export const TAG_NAME_FOR_GENERAL_ENTITY = 'Scenes' +// Define types for the scenes table +export type DatabaseScene = Database['public']['Tables']['scenes']['Row'] +export type DatabaseSceneInsert = + Database['public']['Tables']['scenes']['Insert'] +export type DatabaseSceneUpdate = + Database['public']['Tables']['scenes']['Update'] + +export type SceneId = number + +// Supabase API for spaces +export const scenesApi = createApi({ + reducerPath: 'scenesApi', + baseQuery: fakeBaseQuery(), + tagTypes: [TAG_NAME_FOR_GENERAL_ENTITY, 'LIST'], + endpoints: (builder) => ({ + /** + * Create a new Scene + */ + createScene: builder.mutation< + DatabaseScene, + { name: string; space_id: number } + >({ + queryFn: async ({ name, space_id }, { dispatch }) => { + const supabase = createSupabaseBrowserClient() + const { + data: { user }, + error: authError + } = await supabase.auth.getUser() + + if (!user) { + return { error: 'User not found' } + } + + if (!space_id) { + return { error: 'No spaceId provided' } + } + + const { data, error } = await supabase + .from('scenes') + .insert({ + name, + space_id, + settings: {} + }) + .select('*') + .single() + + if (error) { + return { error: error.message } + } + + // Root entity creation + const result = await dispatch( + entitiesApi.endpoints.createEntity.initiate({ + name: 'Root', + scene_id: data.id, + isRootEntity: true + }) + ).unwrap() // Unwrap the result for promise handling + + if (result.error) { + return { error: result.error } + } + + return { data } + }, + invalidatesTags: [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] + }), + + /** + * Get a single Scene by its ID + */ + getSingleScene: builder.query({ + queryFn: async (sceneId: SceneId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('scenes') + .select('*') + .eq('id', sceneId) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + providesTags: (result, error, sceneId) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: sceneId } + ] + }), + + /** + * Get all Scenes for a given space + */ + getAllScenes: builder.query({ + queryFn: async (spaceId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('scenes') + .select('*') + .eq('space_id', spaceId) + + if (error) { + return { error: error.message } + } + + return { data } + }, + providesTags: (result) => + result + ? [ + ...result.map(({ id }) => ({ + type: 'Scenes' as const, // Directly assign the type as "Scenes" + id + })), + { type: 'LIST' as const, id: 'LIST' } // Ensure the type is "LIST" + ] + : [{ type: 'LIST' as const, id: 'LIST' }] + }), + + /** + * Update a Scene by its ID + */ + updateScene: builder.mutation< + DatabaseScene, + { id: SceneId; name?: string } + >({ + queryFn: async ({ id: sceneId, name }) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('scenes') + .update({ name } as DatabaseSceneUpdate) + .eq('id', sceneId) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, { id: sceneId }) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: sceneId } + ] + }), + + /** + * Delete a Scene by its ID + */ + deleteScene: builder.mutation({ + queryFn: async (sceneId: SceneId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('scenes') + .delete() + .eq('id', sceneId) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, sceneId) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: sceneId } + ] + }) + }) +}) + +// Middleware +export const listenerMiddlewarePcImports = createListenerMiddleware() + +listenerMiddlewarePcImports.startListening({ + matcher: isAnyOf( + scenesApi.endpoints.createScene.matchFulfilled, + scenesApi.endpoints.createScene.matchRejected, + scenesApi.endpoints.updateScene.matchFulfilled, + scenesApi.endpoints.updateScene.matchRejected, + scenesApi.endpoints.deleteScene.matchFulfilled, + scenesApi.endpoints.deleteScene.matchRejected + ), + effect: async (action, listenerApi) => { + // Handle create scene success or failure + if (scenesApi.endpoints.createScene.matchFulfilled(action)) { + sendAnalyticsEvent(AnalyticsEvent.CreateSceneAPISuccess) + } else if (scenesApi.endpoints.createScene.matchRejected(action)) { + sendAnalyticsEvent(AnalyticsEvent.CreateSceneAPIFailure) + } + + // Handle update scene success or failure + else if (scenesApi.endpoints.updateScene.matchFulfilled(action)) { + sendAnalyticsEvent(AnalyticsEvent.UpdateSceneAPISuccess) + } else if (scenesApi.endpoints.updateScene.matchRejected(action)) { + sendAnalyticsEvent(AnalyticsEvent.UpdateSceneAPIFailure) + } + + // Handle delete scene success or failure + else if (scenesApi.endpoints.deleteScene.matchFulfilled(action)) { + sendAnalyticsEvent(AnalyticsEvent.DeleteSceneAPISuccess) + } else if (scenesApi.endpoints.deleteScene.matchRejected(action)) { + sendAnalyticsEvent(AnalyticsEvent.DeleteSceneAPIFailure) + } + } +}) + +// Export the API hooks +export const { + useCreateSceneMutation, + useGetAllScenesQuery, + useLazyGetAllScenesQuery, + useUpdateSceneMutation, + useGetSingleSceneQuery, + useLazyGetSingleSceneQuery, + useDeleteSceneMutation +} = scenesApi diff --git a/mirror-2/state/api/space-packs.tsx b/mirror-2/state/api/space-packs.tsx new file mode 100644 index 00000000..61917552 --- /dev/null +++ b/mirror-2/state/api/space-packs.tsx @@ -0,0 +1,178 @@ +import { createApi, fakeBaseQuery } from '@reduxjs/toolkit/query/react' +import { createSupabaseBrowserClient } from '@/utils/supabase/client' + +import { Database } from '@/utils/database.types' +import { createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit' +import { sendAnalyticsEvent, AnalyticsEvent } from '@/utils/analytics/analytics' +// Define types for the space_packs table +export type DatabaseSpacePack = + Database['public']['Tables']['space_packs']['Row'] +export type DatabaseSpacePackInsert = + Database['public']['Tables']['space_packs']['Insert'] +export type DatabaseSpacePackUpdate = + Database['public']['Tables']['space_packs']['Update'] + +export const TAG_NAME_FOR_SPACE_PACK: string = 'SpacePacks' +export const SPACE_PACKS_BUCKET_NAME: string = 'space-packs' + +export const spacePacksApi = createApi({ + reducerPath: 'spacePacksApi', + baseQuery: fakeBaseQuery(), + tagTypes: [TAG_NAME_FOR_SPACE_PACK, 'LIST'], + endpoints: (builder) => ({ + /** + * Create a new Space Pack + */ + createSpacePack: builder.mutation< + DatabaseSpacePack, + DatabaseSpacePackInsert + >({ + queryFn: async ({ space_id, display_name, data }) => { + const supabase = createSupabaseBrowserClient() + + const { data: insertedData, error } = await supabase + .from('space_packs') + .insert({ + space_id, + display_name, + data + } as DatabaseSpacePackInsert) + .select('*') + .single() + + if (error) { + return { error: error.message } + } + + return { data: insertedData } + }, + invalidatesTags: [{ type: TAG_NAME_FOR_SPACE_PACK, id: 'LIST' }] + }), + + /** + * Get a single Space Pack by its ID + */ + getSingleSpacePack: builder.query({ + queryFn: async (spacePackId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('space_packs') + .select('*') + .eq('id', spacePackId) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + providesTags: (result, error, spacePackId) => [ + { type: TAG_NAME_FOR_SPACE_PACK, id: spacePackId } + ] + }), + + /** + * Get all Space Packs for a given space + */ + getAllSpacePacks: builder.query({ + queryFn: async (spaceId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('space_packs') + .select('*') + .eq('space_id', spaceId) + + if (error) { + return { error: error.message } + } + + return { data } + }, + providesTags: (result) => + result + ? [ + ...result.map(({ id }) => ({ + type: TAG_NAME_FOR_SPACE_PACK, + id + })), + { type: 'LIST' as const, id: 'LIST' } + ] + : [{ type: 'LIST' as const, id: 'LIST' }] + }), + + /** + * Update a Space Pack by its ID + */ + updateSpacePack: builder.mutation< + DatabaseSpacePack, + { id: number; data: any } + >({ + queryFn: async ({ id: spacePackId, data }) => { + const supabase = createSupabaseBrowserClient() + + const { data: updatedData, error } = await supabase + .from('space_packs') + .update({ data } as DatabaseSpacePackUpdate) + .eq('id', spacePackId) + .select('*') + .single() + + if (error) { + return { error: error.message } + } + + return { data: updatedData } + }, + invalidatesTags: (result, error, { id: spacePackId }) => [ + { type: TAG_NAME_FOR_SPACE_PACK, id: spacePackId } + ] + }), + + /** + * Delete a Space Pack by its ID + */ + deleteSpacePack: builder.mutation({ + queryFn: async (spacePackId) => { + const supabase = createSupabaseBrowserClient() + + const { data, error } = await supabase + .from('space_packs') + .delete() + .eq('id', spacePackId) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, spacePackId) => [ + { type: TAG_NAME_FOR_SPACE_PACK, id: spacePackId } + ] + }) + }) +}) + +// Middleware for analytics or other side-effects +export const listenerMiddlewarePcImports = createListenerMiddleware() +listenerMiddlewarePcImports.startListening({ + matcher: isAnyOf( + spacePacksApi.endpoints.createSpacePack.matchFulfilled // Match fulfilled action of the mutation + ), + effect: async (action, listenerApi) => { + sendAnalyticsEvent(AnalyticsEvent.CreateSpacePackAPISuccess) + } +}) + +// Export the API hooks +export const { + useCreateSpacePackMutation, + useGetSingleSpacePackQuery, + useGetAllSpacePacksQuery, + useUpdateSpacePackMutation, + useDeleteSpacePackMutation +} = spacePacksApi diff --git a/mirror-2/state/api/spaces.tsx b/mirror-2/state/api/spaces.tsx new file mode 100644 index 00000000..5c9afe86 --- /dev/null +++ b/mirror-2/state/api/spaces.tsx @@ -0,0 +1,178 @@ +import { createApi, fakeBaseQuery } from '@reduxjs/toolkit/query/react' +import { createSupabaseBrowserClient } from '@/utils/supabase/client' +import { Database } from '@/utils/database.types' +import { generateSpaceName } from '@/actions/name-generator' +import { + scenesApi, + TAG_NAME_FOR_GENERAL_ENTITY as SCENES_TAG_NAME_FOR_GENERAL_ENTITY +} from '@/state/api/scenes' +import { + TAG_NAME_FOR_GENERAL_ENTITY as ENTITIES_TAG_NAME_FOR_GENERAL_ENTITY, + entitiesApi +} from '@/state/api/entities' +import { TAG_NAME_FOR_BUILD_MODE_SPACE_QUERY } from '@/state/shared-cache-tags' +import { createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit' +import { AnalyticsEvent, sendAnalyticsEvent } from '@/utils/analytics/analytics' + +export type DatabaseSpace = Database['public']['Tables']['spaces']['Row'] +export type DatabaseSpaceInsert = + Database['public']['Tables']['spaces']['Insert'] +export type DatabaseSpaceUpdate = + Database['public']['Tables']['spaces']['Update'] + +export const TAG_NAME_FOR_GENERAL_ENTITY = 'Spaces' + +// Supabase API for spaces +export const spacesApi = createApi({ + reducerPath: 'spacesApi', + baseQuery: fakeBaseQuery(), + tagTypes: [ + TAG_NAME_FOR_GENERAL_ENTITY, + SCENES_TAG_NAME_FOR_GENERAL_ENTITY, + ENTITIES_TAG_NAME_FOR_GENERAL_ENTITY, + TAG_NAME_FOR_BUILD_MODE_SPACE_QUERY, + 'LIST' + ], + endpoints: (builder) => ({ + createSpace: builder.mutation({ + queryFn: async (_, { dispatch }) => { + const supabase = createSupabaseBrowserClient() + const { + data: { user } + } = await supabase.auth.getUser() + if (!user) { + throw new Error('User not found') + } + const name = await generateSpaceName() + const { data, error } = await supabase + .from('spaces') + .insert([ + { + name, + creator_user_id: user?.id, + owner_user_id: user.id + } + ]) + .select('*') + .single() + + if (error) { + return { error: error.message } + } + + // Now that the space is created, dispatch the `createScene` mutation + const { data: createSceneData, error: createSceneError } = + await dispatch( + scenesApi.endpoints.createScene.initiate({ + name: 'Main', + space_id: data.id + }) + ) + + if (createSceneError) { + return { error: createSceneError } + } + // create root entity is managed by create Scene + + // if (createEntityError) { + // return { error: createEntityError }; + // } + return { data } + }, + invalidatesTags: [{ type: TAG_NAME_FOR_GENERAL_ENTITY, id: 'LIST' }] + }), + + getSingleSpace: builder.query({ + queryFn: async (spaceId) => { + const supabase = createSupabaseBrowserClient() + + if (spaceId === null || spaceId === undefined) { + return { error: 'SpaceID undefined' } + } + + const { data, error } = await supabase + .from('spaces') + .select('*') + .eq('id', spaceId) + .single() + + if (error) { + return { error: error.message } + } + return { data } + }, + providesTags: (result, error, id) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id } + ] + }), + + updateSpace: builder.mutation< + Database['public']['Tables']['spaces']['Row'], + { + id: number + updateData: Partial + } + >({ + queryFn: async ({ id: spaceId, updateData }) => { + const supabase = createSupabaseBrowserClient() + const { data, error } = await supabase + .from('spaces') + .update(updateData) + .eq('id', spaceId) + .select('*') + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, { id: spaceId }) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: spaceId } + ] + }), + + deleteSpace: builder.mutation< + Database['public']['Tables']['spaces']['Row'], + number + >({ + queryFn: async (spaceId) => { + const supabase = createSupabaseBrowserClient() + const { data, error } = await supabase + .from('spaces') + .delete() + .eq('id', spaceId) + .single() + + if (error) { + return { error: error.message } + } + + return { data } + }, + invalidatesTags: (result, error, spaceId) => [ + { type: TAG_NAME_FOR_GENERAL_ENTITY, id: spaceId } + ] + }) + }) +}) + +// Middleware +export const listenerMiddlewareSpaces = createListenerMiddleware() +listenerMiddlewareSpaces.startListening({ + matcher: isAnyOf( + spacesApi.endpoints.createSpace.matchFulfilled // Match fulfilled action of the createSpace mutation + ), + effect: async (action, listenerApi) => { + sendAnalyticsEvent(AnalyticsEvent.CreateSpaceAPISuccess) + } +}) + +// Export the API hooks +export const { + useGetSingleSpaceQuery, + useCreateSpaceMutation, + useUpdateSpaceMutation, + useDeleteSpaceMutation +} = spacesApi diff --git a/mirror-2/state/engine/__loading__.js b/mirror-2/state/engine/__loading__.js new file mode 100644 index 00000000..ad36d301 --- /dev/null +++ b/mirror-2/state/engine/__loading__.js @@ -0,0 +1,113 @@ +// Boilerplate from PC; it's recommended on docs to modify this, so ts-nocheck since it comes as JS file for initial boilerplate. https://developer.playcanvas.com/user-manual/publishing/web/communicating-webpage/ +pc.script.createLoadingScreen(function (app) { + var showSplash = function () { + // splash wrapper + var wrapper = document.createElement('div'); + wrapper.id = 'application-splash-wrapper'; + document.body.appendChild(wrapper); + + // splash + var splash = document.createElement('div'); + splash.id = 'application-splash'; + wrapper.appendChild(splash); + splash.style.display = 'none'; + + var logo = document.createElement('img'); + logo.src = ASSET_PREFIX + 'logo.png'; + splash.appendChild(logo); + logo.onload = function () { + splash.style.display = 'block'; + }; + + var container = document.createElement('div'); + container.id = 'progress-bar-container'; + splash.appendChild(container); + + var bar = document.createElement('div'); + bar.id = 'progress-bar'; + container.appendChild(bar); + + }; + + var hideSplash = function () { + var splash = document.getElementById('application-splash-wrapper'); + splash.parentElement.removeChild(splash); + }; + + var setProgress = function (value) { + var bar = document.getElementById('progress-bar'); + if (bar) { + value = Math.min(1, Math.max(0, value)); + bar.style.width = value * 100 + '%'; + } + }; + + var createCss = function () { + var css = [ + 'body {', + ' background-color: #283538;', + '}', + + '#application-splash-wrapper {', + ' position: absolute;', + ' top: 0;', + ' left: 0;', + ' height: 100%;', + ' width: 100%;', + ' background-color: #283538;', + '}', + + '#application-splash {', + ' position: absolute;', + ' top: calc(50% - 28px);', + ' width: 264px;', + ' left: calc(50% - 132px);', + '}', + + '#application-splash img {', + ' width: 100%;', + '}', + + '#progress-bar-container {', + ' margin: 20px auto 0 auto;', + ' height: 2px;', + ' width: 100%;', + ' background-color: #1d292c;', + '}', + + '#progress-bar {', + ' width: 0%;', + ' height: 100%;', + ' background-color: #f60;', + '}', + '@media (max-width: 480px) {', + ' #application-splash {', + ' width: 170px;', + ' left: calc(50% - 85px);', + ' }', + '}' + + ].join('\n'); + + var style = document.createElement('style'); + style.type = 'text/css'; + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } + + document.head.appendChild(style); + }; + + + createCss(); + + showSplash(); + + app.on('preload:end', function () { + app.off('preload:progress'); + }); + app.on('preload:progress', setProgress); + app.on('start', hideSplash); +}); diff --git a/mirror-2/state/engine/__modules__.js b/mirror-2/state/engine/__modules__.js new file mode 100644 index 00000000..bd6ddf23 --- /dev/null +++ b/mirror-2/state/engine/__modules__.js @@ -0,0 +1,50 @@ +// Boilerplate from PC; it's recommended on docs to modify this, so ts-nocheck since it comes as JS file for initial boilerplate. https://developer.playcanvas.com/user-manual/publishing/web/communicating-webpage/ +import * as pc from 'playcanvas' + +var loadModules = function (modules, urlPrefix, doneCallback) { // eslint-disable-line no-unused-vars + + if (typeof modules === "undefined" || modules.length === 0) { + // caller may depend on callback behaviour being async + setTimeout(doneCallback); + } else { + let remaining = modules.length; + const moduleLoaded = () => { + if (--remaining === 0) { + doneCallback(); + } + }; + + modules.forEach(function (m) { + pc.WasmModule.setConfig(m.moduleName, { + glueUrl: urlPrefix + m.glueUrl, + wasmUrl: urlPrefix + m.wasmUrl, + fallbackUrl: urlPrefix + m.fallbackUrl + }); + + if (!m.hasOwnProperty('preload') || m.preload) { + if (m.moduleName === 'BASIS') { + // preload basis transcoder + pc.basisInitialize(); + moduleLoaded(); + } else if (m.moduleName === 'DracoDecoderModule') { + // preload draco decoder + if (pc.dracoInitialize) { + // 1.63 onwards + pc.dracoInitialize(); + moduleLoaded(); + } else { + // 1.62 and earlier + pc.WasmModule.getInstance(m.moduleName, () => { moduleLoaded(); }); + } + } else { + // load remaining modules in global scope + pc.WasmModule.getInstance(m.moduleName, () => { moduleLoaded(); }); + } + } else { + moduleLoaded(); + } + }); + } +}; +window.loadModules = loadModules; +export default loadModules diff --git a/mirror-2/state/engine/__settings__.js b/mirror-2/state/engine/__settings__.js new file mode 100644 index 00000000..94af1e54 --- /dev/null +++ b/mirror-2/state/engine/__settings__.js @@ -0,0 +1,28 @@ +// Boilerplate from PC; it's recommended on docs to modify this, so ts-nocheck since it comes as JS file for initial boilerplate. https://developer.playcanvas.com/user-manual/publishing/web/communicating-webpage/ +import * as pc from 'playcanvas' + +function initSettings() { + window.ASSET_PREFIX = ""; + window.SCRIPT_PREFIX = ""; + window.SCENE_PATH = "2090341.json"; + window.CONTEXT_OPTIONS = { + 'antialias': true, + 'alpha': false, + 'preserveDrawingBuffer': false, + 'deviceTypes': [`webgl2`, `webgl1`], + 'powerPreference': "high-performance" + }; + window.SCRIPTS = []; + window.CONFIG_FILENAME = "config.json"; + window.INPUT_SETTINGS = { + useKeyboard: true, + useMouse: true, + useGamepads: false, + useTouch: true + }; + pc.script.legacy = false; + window.PRELOAD_MODULES = [ + ]; +} + +export default initSettings diff --git a/mirror-2/state/engine/__start__.js b/mirror-2/state/engine/__start__.js new file mode 100644 index 00000000..64307370 --- /dev/null +++ b/mirror-2/state/engine/__start__.js @@ -0,0 +1,381 @@ +// Boilerplate from PC; it's recommended on docs to modify this, so ts-nocheck since it comes as JS file for initial boilerplate. https://developer.playcanvas.com/user-manual/publishing/web/communicating-webpage/ +import * as pc from 'playcanvas' +// import initSettings from './__settings__' +// import loadModules from './__modules__' + +initSettings() + +// (function () { +// Shared Lib +export var CANVAS_ID = 'application-canvas'; + +// Needed as we will have edge cases for particular versions of iOS +// returns null if not iOS +var getIosVersion = function () { + if (/iP(hone|od|ad)/.test(navigator.platform)) { + var v = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/); + var version = [ + parseInt(v[1], 10), + parseInt(v[2], 10), + parseInt(v[3] || 0, 10), + ]; + return version; + } + + return null; +}; + +var lastWindowHeight = window.innerHeight; +var lastWindowWidth = window.innerWidth; +var windowSizeChangeIntervalHandler = null; + +var pcBootstrap = { + reflowHandler: null, + iosVersion: getIosVersion(), + + createCanvas: function () { + var canvas = document.createElement('canvas'); + canvas.setAttribute('id', CANVAS_ID); + canvas.setAttribute('tabindex', 0); + + // Disable I-bar cursor on click+drag + canvas.onselectstart = function () { + return false; + }; + + // Disable long-touch select on iOS devices + canvas.style['-webkit-user-select'] = 'none'; + + document.body.appendChild(canvas); + + return canvas; + }, + + resizeCanvas: function (app, canvas) { + canvas.style.width = ''; + canvas.style.height = ''; + app.resizeCanvas(canvas.width, canvas.height); + + var fillMode = app._fillMode; + + if (fillMode === pc.FILLMODE_NONE || fillMode === pc.FILLMODE_KEEP_ASPECT) { + if ( + (fillMode === pc.FILLMODE_NONE && + canvas.clientHeight < window.innerHeight) || + canvas.clientWidth / canvas.clientHeight >= + window.innerWidth / window.innerHeight + ) { + canvas.style.marginTop = + Math.floor((window.innerHeight - canvas.clientHeight) / 2) + 'px'; + } else { + canvas.style.marginTop = ''; + } + } + + lastWindowHeight = window.innerHeight; + lastWindowWidth = window.innerWidth; + + // Work around when in landscape to work on iOS 12 otherwise + // the content is under the URL bar at the top + if (this.iosVersion && this.iosVersion[0] <= 12) { + window.scrollTo(0, 0); + } + }, + + reflow: function (app, canvas) { + this.resizeCanvas(app, canvas); + + // Poll for size changes as the window inner height can change after the resize event for iOS + // Have one tab only, and rotate from portrait -> landscape -> portrait + if (windowSizeChangeIntervalHandler === null) { + windowSizeChangeIntervalHandler = setInterval( + function () { + if ( + lastWindowHeight !== window.innerHeight || + lastWindowWidth !== window.innerWidth + ) { + this.resizeCanvas(app, canvas); + } + }.bind(this), + 100 + ); + + // Don't want to do this all the time so stop polling after some short time + setTimeout(function () { + if (!!windowSizeChangeIntervalHandler) { + clearInterval(windowSizeChangeIntervalHandler); + windowSizeChangeIntervalHandler = null; + } + }, 2000); + } + }, +}; + +// Expose the reflow to users so that they can override the existing +// reflow logic if need be +window.pcBootstrap = pcBootstrap; +// })(); + +// (function () { +// template varants +var LTC_MAT_1 = []; +var LTC_MAT_2 = []; + +// varants +var canvas = pcBootstrap.createCanvas(); +export var app = new pc.AppBase(canvas); + +function initCSS() { + if (document.head.querySelector) { + // css media query for aspect ratio changes + // TODO: Change these from private properties + var css = `@media screen and (min-aspect-ratio: ${app._width}/${app._height}) { + #application-canvas.fill-mode-KEEP_ASPECT { + width: auto; + height: 100%; + margin: 0 auto; + } + }`; + document.head.querySelector('style').innerHTML += css; + } + + // Configure resolution and resize event + if (canvas.classList) { + canvas.classList.add(`fill-mode-${app.fillMode}`); + } +} + +function displayError(html) { + var div = document.createElement('div'); + div.innerHTML = ` + + + +
+
+
${html}
+
+
`; + document.body.appendChild(div); +} + +function createGraphicsDevice(callback) { + var deviceOptions = window.CONTEXT_OPTIONS ? window.CONTEXT_OPTIONS : {}; + + if (typeof window.Promise === 'function') { + var LEGACY_WEBGL = 'webgl'; + var deviceTypes = + deviceOptions.preferWebGl2 === false + ? [pc.DEVICETYPE_WEBGL1, pc.DEVICETYPE_WEBGL2] + : deviceOptions.deviceTypes; + deviceTypes.push(LEGACY_WEBGL); + + var gpuLibPath = window.ASSET_PREFIX + ? window.ASSET_PREFIX.replace(/\/$/g, '') + '/' + : ''; + + // new graphics device creation function with promises + var gfxOptions = { + deviceTypes: deviceTypes, + glslangUrl: gpuLibPath + 'glslang.js', + twgslUrl: gpuLibPath + 'twgsl.js', + powerPreference: deviceOptions.powerPreference, + antialias: deviceOptions.antialias !== false, + alpha: deviceOptions.alpha === true, + preserveDrawingBuffer: !!deviceOptions.preserveDrawingBuffer, + }; + + pc.createGraphicsDevice(canvas, gfxOptions) + .then((device) => { + callback(device); + }) + .catch((e) => { + console.error('Device creation error:', e); + callback(null); + }); + } else { + var igl1 = deviceOptions.deviceTypes.indexOf('webgl1'); + var igl2 = deviceOptions.deviceTypes.indexOf('webgl2'); + + // old webgl graphics device creation + var options = { + powerPreference: deviceOptions.powerPreference, + antialias: deviceOptions.antialias !== false, + alpha: deviceOptions.transparentCanvas !== false, + preserveDrawingBuffer: !!deviceOptions.preserveDrawingBuffer, + preferWebGl2: igl2 > igl1, + }; + + if (pc.platform.browser && !!navigator.xr) { + options.xrCompatible = true; + } + + callback(new pc.WebglGraphicsDevice(canvas, options)); + } +} + +function initApp(device) { + try { + var createOptions = new pc.AppOptions(); + createOptions.graphicsDevice = device; + + createOptions.componentSystems = [ + pc.RigidBodyComponentSystem, + pc.CollisionComponentSystem, + pc.JointComponentSystem, + pc.AnimationComponentSystem, + pc.AnimComponentSystem, + pc.ModelComponentSystem, + pc.RenderComponentSystem, + pc.CameraComponentSystem, + pc.LightComponentSystem, + pc.script.legacy + ? pc.ScriptLegacyComponentSystem + : pc.ScriptComponentSystem, + pc.AudioSourceComponentSystem, + pc.SoundComponentSystem, + pc.AudioListenerComponentSystem, + pc.ParticleSystemComponentSystem, + pc.ScreenComponentSystem, + pc.ElementComponentSystem, + pc.ButtonComponentSystem, + pc.ScrollViewComponentSystem, + pc.ScrollbarComponentSystem, + pc.SpriteComponentSystem, + pc.LayoutGroupComponentSystem, + pc.LayoutChildComponentSystem, + pc.ZoneComponentSystem, + pc.GSplatComponentSystem, + ].filter(Boolean); + + createOptions.resourceHandlers = [ + pc.RenderHandler, + pc.AnimationHandler, + pc.AnimClipHandler, + pc.AnimStateGraphHandler, + pc.ModelHandler, + pc.MaterialHandler, + pc.TextureHandler, + pc.TextHandler, + pc.JsonHandler, + pc.AudioHandler, + pc.ScriptHandler, + pc.SceneHandler, + pc.CubemapHandler, + pc.HtmlHandler, + pc.CssHandler, + pc.ShaderHandler, + pc.HierarchyHandler, + pc.FolderHandler, + pc.FontHandler, + pc.BinaryHandler, + pc.TextureAtlasHandler, + pc.SpriteHandler, + pc.TemplateHandler, + pc.ContainerHandler, + pc.GSplatHandler, + ].filter(Boolean); + + createOptions.elementInput = new pc.ElementInput(canvas, { + useMouse: INPUT_SETTINGS.useMouse, + useTouch: INPUT_SETTINGS.useTouch, + }); + createOptions.keyboard = INPUT_SETTINGS.useKeyboard + ? new pc.Keyboard(window) + : null; + createOptions.mouse = INPUT_SETTINGS.useMouse ? new pc.Mouse(canvas) : null; + createOptions.gamepads = INPUT_SETTINGS.useGamepads + ? new pc.GamePads() + : null; + createOptions.touch = + INPUT_SETTINGS.useTouch && pc.platform.touch + ? new pc.TouchDevice(canvas) + : null; + createOptions.assetPrefix = window.ASSET_PREFIX || ''; + createOptions.scriptPrefix = window.SCRIPT_PREFIX || ''; + createOptions.scriptsOrder = window.SCRIPTS || []; + createOptions.soundManager = new pc.SoundManager(); + createOptions.lightmapper = pc.Lightmapper; + createOptions.batchManager = pc.BatchManager; + createOptions.xr = pc.XrManager; + + app.init(createOptions); + return true; + } catch (e) { + displayError('Could not initialize application. Error: ' + e); + console.error(e); + return false; + } +} + +function configure() { + app.configure(window.CONFIG_FILENAME, (err) => { + if (err) { + console.error(err); + return; + } + + initCSS(canvas, app._fillMode, app._width, app._height); + + if ( + LTC_MAT_1.length && + LTC_MAT_2.length && + app.setAreaLightLuts.length === 2 + ) { + app.setAreaLightLuts(LTC_MAT_1, LTC_MAT_2); + } + + // do the first reflow after a timeout because of + // iOS showing a squished iframe sometimes + setTimeout(() => { + pcBootstrap.reflow(app, canvas); + pcBootstrap.reflowHandler = function () { + pcBootstrap.reflow(app, canvas); + }; + + window.addEventListener('resize', pcBootstrap.reflowHandler, false); + window.addEventListener( + 'orientationchange', + pcBootstrap.reflowHandler, + false + ); + + app.preload(() => { + app.scenes.loadScene(window.SCENE_PATH, (err) => { + if (err) { + console.error(err); + return; + } + + app.start(); + }); + }); + }); + }); +} + +export default function mainInit() { + createGraphicsDevice((device) => { + if (!device) { + return; + } + + if (!initApp(device)) { + return; + } + + if (window.PRELOAD_MODULES.length) { + loadModules(window.PRELOAD_MODULES, window.ASSET_PREFIX, () => { + configure(() => { + console.timeEnd('start'); + }); + }); + } else { + configure(); + } + }); + console.log('Completed engine mainInit()') + return app +} +mainInit(); +// })(); // Add scope to avoid polluting window scope diff --git a/mirror-2/state/engine/engine-old.tsx b/mirror-2/state/engine/engine-old.tsx new file mode 100644 index 00000000..4a54dc0b --- /dev/null +++ b/mirror-2/state/engine/engine-old.tsx @@ -0,0 +1,115 @@ +// engine.ts +import { getApp } from '@/components/engine/__start-custom__' +import * as pc from 'playcanvas' +import { Entity } from 'playcanvas' + +// Singleton PlayCanvas instance manager +let playCanvasApp: pc.Application | null = null + +export function setApp(app: pc.Application) { + playCanvasApp = app +} + +const optimisticEntities = new Map() + +export function updateEngineApp( + entities: T[], + options: { isOptimistic?: boolean; isReverted?: boolean } = {} +) { + const app = getApp() + + if (!app) { + console.warn('PlayCanvas app is not initialized.') + return + } + + if (options.isOptimistic) { + console.log('Applying optimistic updates to PlayCanvas', entities) + + entities.forEach((entityData) => { + let pcEntity = app.root.findByName(entityData.id) + + if (!pcEntity) { + // Create a new PlayCanvas entity + pcEntity = new pc.Entity(entityData.id) + app.root.addChild(pcEntity) + + // Store the entity for potential reverts + optimisticEntities.set(entityData.id, pcEntity as Entity) + } + + // Ensure pcEntity is of type Entity + const entity: Entity = pcEntity as Entity // Cast to Entity if safe + updatePlayCanvasEntity(entity, entityData) + + // Remove from optimisticEntities if it was added optimistically + }) + } else if (options.isReverted) { + console.log('Reverting PlayCanvas state', entities) + + entities.forEach((entityData) => { + const pcEntity = optimisticEntities.get(entityData.id) + if (pcEntity) { + // Remove the entity from the scene + pcEntity.destroy() + optimisticEntities.delete(entityData.id) + } + }) + } else { + console.log('Applying confirmed updates to PlayCanvas', entities) + + entities.forEach((entityData) => { + let pcEntity = app.root.findByName(entityData.id) + + if (!pcEntity) { + pcEntity = new pc.Entity(entityData.id) + app.root.addChild(pcEntity) + } + + // Ensure pcEntity is of type Entity + const entity: Entity = pcEntity as Entity // Cast to Entity if safe + updatePlayCanvasEntity(entity, entityData) + + // Remove from optimisticEntities if it was added optimistically + if (optimisticEntities.has(entityData.id)) { + optimisticEntities.delete(entityData.id) + } + }) + + // Optionally remove entities not present in the confirmed data + removeStaleEntities(app, entities) + } +} + +function updatePlayCanvasEntity(pcEntity: pc.Entity, entityData: any) { + if ('position' in entityData && Array.isArray(entityData.position)) { + const [x, y, z] = entityData.position + pcEntity.setPosition(x, y, z) + } + + if ('rotation' in entityData && Array.isArray(entityData.rotation)) { + const [x, y, z] = entityData.rotation + pcEntity.setEulerAngles(x, y, z) + } + + if ('scale' in entityData && Array.isArray(entityData.scale)) { + const [x, y, z] = entityData.scale + pcEntity.setLocalScale(x, y, z) + } + + // Add or update other properties as needed based on your entity schema +} + +function removeStaleEntities( + app: pc.Application, + entities: T[] +) { + const currentEntityIds = new Set(entities.map((e) => e.id)) + + app.root.children.forEach((child) => { + if (!currentEntityIds.has(child.name)) { + // Remove entities not present in the current data + child.destroy() + } + }) +} diff --git a/mirror-2/state/local.slice.tsx b/mirror-2/state/local.slice.tsx new file mode 100644 index 00000000..34867694 --- /dev/null +++ b/mirror-2/state/local.slice.tsx @@ -0,0 +1,177 @@ +'use client' +import { DatabaseEntity } from '@/state/api/entities' +import { DatabaseScene } from '@/state/api/scenes' +import { RootState } from '@/state/store' +import { setAnalyticsUserId } from '@/utils/analytics/analytics' +import type { PayloadAction } from '@reduxjs/toolkit' +import { createListenerMiddleware, createSlice } from '@reduxjs/toolkit' + +export type ControlBarView = + | 'assets' + | 'hierarchy' + | 'scenes' + | 'code' + | 'database' + | 'versions' + | 'settings' + +interface LocalUserState { + id: string + email?: string + is_anonymous?: boolean +} + +interface LocalSlice { + uiSoundsCanPlay: boolean + controlBarCurrentView: ControlBarView + user?: LocalUserState + + // Viewport et al. + currentScene?: DatabaseScene + currentEntity?: DatabaseEntity + + // Property to track the entire tree for each scene + expandedEntityIds: string[] + automaticallyExpandedSceneIds: number[] // used for checking whether we auto expanded or not for a scene's entity hierarchy +} + +// Define the initial state using that type +const initialState: LocalSlice = { + uiSoundsCanPlay: true, + controlBarCurrentView: 'hierarchy', + user: { + email: '', + id: '', + is_anonymous: false + }, + currentScene: { + created_at: '', + id: 0, + name: '', + space_id: 0, + updated_at: '', + settings: {} + }, + expandedEntityIds: [], + automaticallyExpandedSceneIds: [] +} + +export const localSlice = createSlice({ + name: 'local', + initialState, + reducers: { + turnOffUiSounds: (state) => { + state.uiSoundsCanPlay = false + }, + turnOnUiSounds: (state) => { + state.uiSoundsCanPlay = true + }, + setControlBarCurrentView: ( + state, + action: PayloadAction + ) => { + state.controlBarCurrentView = action.payload + }, + updateLocalUserState: (state, action: PayloadAction) => { + state.user = action.payload + }, + clearLocalUserState: (state) => { + state.user = undefined + }, + setCurrentScene: (state, action: PayloadAction) => { + state.currentScene = action.payload + }, + setCurrentEntity: (state, action: PayloadAction) => { + state.currentEntity = action.payload + }, + clearCurrentEntity: (state) => { + state.currentScene = undefined + }, + setExpandedEntityIds: ( + state, + action: PayloadAction<{ entityIds: string[] }> + ) => { + const { entityIds } = action.payload + + // update, ensuring no duplicate IDs + state.expandedEntityIds = entityIds.filter(function (x, i, a) { + return a.indexOf(x) == i + }) + }, + + addExpandedEntityIds: ( + state, + action: PayloadAction<{ entityIds: string[] }> + ) => { + const { entityIds } = action.payload + + // add new IDs, ensuring no duplicate IDs + state.expandedEntityIds = [ + ...state.expandedEntityIds, + ...entityIds + ].filter(function (x, i, a) { + return a.indexOf(x) == i + }) + }, + + insertAutomaticallyExpandedSceneIds: ( + state, + action: PayloadAction<{ sceneId: number }> + ) => { + const { sceneId } = action.payload + + state.automaticallyExpandedSceneIds.push(sceneId) + // update, ensuring no duplicate IDs + state.automaticallyExpandedSceneIds = + state.automaticallyExpandedSceneIds.filter(function (x, i, a) { + return a.indexOf(x) == i + }) + } + } +}) + +export const { + turnOffUiSounds, + turnOnUiSounds, + setControlBarCurrentView, + updateLocalUserState, + clearLocalUserState, + setCurrentScene, + setCurrentEntity, + clearCurrentEntity, + setExpandedEntityIds, + addExpandedEntityIds, + insertAutomaticallyExpandedSceneIds +} = localSlice.actions + +// Middleware +export const listenerMiddlewareLocal = createListenerMiddleware() +listenerMiddlewareLocal.startListening({ + actionCreator: updateLocalUserState, + effect: async (action, listenerApi) => { + setAnalyticsUserId(action.payload.id) + } +}) + +// Selectors +export const selectUiSoundsCanPlay = (state: RootState) => + state.local.uiSoundsCanPlay +export const selectControlBarCurrentView = (state: RootState) => + state.local.controlBarCurrentView +export const selectLocalUser = (state: RootState) => state.local.user +export const selectCurrentScene = ( + state: RootState +): DatabaseScene | undefined => { + return state.local.currentScene +} +export const selectCurrentEntity = ( + state: RootState +): DatabaseEntity | undefined => { + return state.local.currentEntity +} +export const selectExpandedEntityIds = (state: RootState) => + state.local.expandedEntityIds +export const selectAutomaticallyExpandedSceneIds = (state: RootState) => + state.local.automaticallyExpandedSceneIds + +export default localSlice.reducer diff --git a/mirror-2/state/shared-cache-tags.tsx b/mirror-2/state/shared-cache-tags.tsx new file mode 100644 index 00000000..e65a769c --- /dev/null +++ b/mirror-2/state/shared-cache-tags.tsx @@ -0,0 +1 @@ +export const TAG_NAME_FOR_BUILD_MODE_SPACE_QUERY = 'BUILD_MODE_SPACE_QUERY' diff --git a/mirror-2/state/space-pack.slice.tsx b/mirror-2/state/space-pack.slice.tsx new file mode 100644 index 00000000..2fa2df7e --- /dev/null +++ b/mirror-2/state/space-pack.slice.tsx @@ -0,0 +1,253 @@ +'use client' +import * as pc from 'playcanvas' +import { AssetId, DatabaseAsset } from '@/state/api/assets' +import { setCurrentScene } from '@/state/local.slice' +import { RootState } from '@/state/store' +import { createListenerMiddleware, createSlice } from '@reduxjs/toolkit' +import { DatabaseScene, scenesApi } from '@/state/api/scenes' + +/** + * The Space Pack reducer creates the computed state from scenes, entities, assets, etc. Redux is the source of truth and engine state is computed from that. + */ + +// interface SpacePackState { +// configFile: { +// application_properties: {} +// scenes: { +// name: string +// url: string +// }[] +// assets: { +// [assetId: AssetId]: DatabaseAsset +// } +// } +// sceneFiles: { +// name: string +// created: string +// settings: { +// priority_scripts?: any[] +// physics: { +// gravity: [number, number, number] +// } +// render: { +// fog_end: number +// fog_start: number +// global_ambient: [number, number, number] +// tonemapping: number +// fog_color: [number, number, number] +// fog: string +// skybox: null | string +// fog_density: number +// gamma_correction: number +// exposure: number +// lightmapSizeMultiplier: number +// lightmapMaxResolution: number +// lightmapMode: number +// skyboxIntensity: number +// skyboxMip: number +// skyboxRotation: [number, number, number] +// lightmapFilterEnabled: boolean +// lightmapFilterRange: number +// lightmapFilterSmoothness: number +// ambientBake: boolean +// ambientBakeNumSamples: number +// ambientBakeSpherePart: number +// ambientBakeOcclusionBrightness: number +// ambientBakeOcclusionContrast: number +// clusteredLightingEnabled: boolean +// lightingCells: [number, number, number] +// lightingMaxLightsPerCell: number +// lightingCookieAtlasResolution: number +// lightingShadowAtlasResolution: number +// lightingShadowType: number +// lightingCookiesEnabled: boolean +// lightingAreaLightsEnabled: boolean +// lightingShadowsEnabled: boolean +// skyType: string +// skyMeshPosition: [number, number, number] +// skyMeshRotation: [number, number, number] +// skyMeshScale: [number, number, number] +// skyCenter: [number, number, number] +// } +// } +// entities: { +// [entityId: string]: { +// scale: [number, number, number] +// name: string +// parent: null | string +// resource_id: string +// labels: string[] +// enabled: boolean +// components: { +// pack: any +// } +// position: [number, number, number] +// rotation: [number, number, number] +// children: string[] +// template: null | string +// tags: string[] +// } +// } +// checkpoint_id: string +// branch_id: string +// id: number +// }[] +// manifestFile: { +// short_name: string +// name: string +// start_url: string +// display: string +// icons: { +// src: string +// sizes: string +// type: string +// }[] +// } +// } + +// Define the initial state using that type +// const initialState: SpacePackState = { +// configFile: { +// application_properties: {}, +// scenes: [ +// { +// name: '', +// url: '' +// } +// ], +// assets: {} +// }, +// sceneFiles: [ +// { +// name: '', +// created: '', +// settings: { +// priority_scripts: [], +// physics: { +// gravity: [0, -9.8, 0] +// }, +// render: { +// fog_end: 1000, +// fog_start: 1, +// global_ambient: [0.156, 0.235, 0.314], +// tonemapping: 0, +// fog_color: [0, 0, 0], +// fog: 'none', +// skybox: null, +// fog_density: 0.01, +// gamma_correction: 1, +// exposure: 1.5, +// lightmapSizeMultiplier: 16, +// lightmapMaxResolution: 2048, +// lightmapMode: 0, +// skyboxIntensity: 1, +// skyboxMip: 0, +// skyboxRotation: [0, 0, 0], +// lightmapFilterEnabled: false, +// lightmapFilterRange: 10, +// lightmapFilterSmoothness: 0.2, +// ambientBake: false, +// ambientBakeNumSamples: 1, +// ambientBakeSpherePart: 0.4, +// ambientBakeOcclusionBrightness: 0, +// ambientBakeOcclusionContrast: 0, +// clusteredLightingEnabled: true, +// lightingCells: [10, 3, 10], +// lightingMaxLightsPerCell: 255, +// lightingCookieAtlasResolution: 2048, +// lightingShadowAtlasResolution: 2048, +// lightingShadowType: 0, +// lightingCookiesEnabled: false, +// lightingAreaLightsEnabled: false, +// lightingShadowsEnabled: true, +// skyType: 'infinite', +// skyMeshPosition: [0, 0, 0], +// skyMeshRotation: [0, 0, 0], +// skyMeshScale: [100, 100, 100], +// skyCenter: [0, 0.1, 0] +// } +// }, +// entities: {}, +// checkpoint_id: '', +// branch_id: '', +// id: 0 +// } +// ], +// manifestFile: { +// short_name: '', +// name: '', +// start_url: '', +// display: '', +// icons: [] +// } +// } + +interface SpacePackState { + mode: 'build' | 'play' + scenes: DatabaseScene[] +} + +const initialState: SpacePackState = { + mode: 'build', + scenes: [] as DatabaseScene[] // List of all scenes +} + +export const spacePackSlice = createSlice({ + name: 'spacePack', + initialState, + reducers: {} + // extraReducers: (builder) => { + // // When getAllScenes or getSingleScene succeeds, update scenes + // builder + // .addMatcher( + // scenesApi.endpoints.getAllScenes.matchFulfilled, + // (state, { payload }) => { + // state.scenes = mergeScenes(state.scenes, payload) + // } + // ) + // .addMatcher( + // scenesApi.endpoints.getSingleScene.matchFulfilled, + // (state, { payload }) => { + // state.scenes = mergeScenes(state.scenes, [payload]) + // } + // ) + // .addMatcher( + // scenesApi.endpoints.createScene.matchFulfilled, + // (state, { payload }) => { + // state.scenes = mergeScenes(state.scenes, [payload]) + // } + // ) + // .addMatcher( + // scenesApi.endpoints.updateScene.matchFulfilled, + // (state, { payload }) => { + // state.scenes = mergeScenes(state.scenes, [payload]) + // } + // ) + // .addMatcher( + // scenesApi.endpoints.deleteScene.matchFulfilled, + // (state, { meta }) => { + // const sceneId = meta.arg.originalArgs // Extract the scene ID + // state.scenes = state.scenes.filter((scene) => scene.id !== sceneId) + // } + // ) + // } +}) + +// Helper function to merge and deduplicate scenes +function mergeScenes(existingScenes, newScenes): any[] { + const scenesMap = new Map(existingScenes.map((scene) => [scene.id, scene])) + + // Add new scenes or update existing ones + newScenes.forEach((scene) => { + scenesMap.set(scene.id, scene) + }) + + // Convert the map back to an array + return Array.from(scenesMap.values()) +} + +// Selectors +export const selectUiSoundsCanPlay = (state: RootState) => + state.local.uiSoundsCanPlay + +export default spacePackSlice.reducer diff --git a/mirror-2/state/store.tsx b/mirror-2/state/store.tsx new file mode 100644 index 00000000..e2b8337e --- /dev/null +++ b/mirror-2/state/store.tsx @@ -0,0 +1,44 @@ +'use client' +import { configureStore } from '@reduxjs/toolkit' +import { setupListeners } from '@reduxjs/toolkit/query/react' +import { listenerMiddlewareLocal, localSlice } from '@/state/local.slice' +import { listenerMiddlewareSpaces, spacesApi } from '@/state/api/spaces' +import { scenesApi } from '@/state/api/scenes' +import { entitiesApi, listenerMiddlewareEntities } from '@/state/api/entities' +import { assetsApi } from '@/state/api/assets' +import { spacePacksApi } from '@/state/api/space-packs' +import { spacePackSlice } from '@/state/space-pack.slice' + +export const store = configureStore({ + reducer: { + // Add the generated reducer as a specific top-level slice + [localSlice.reducerPath]: localSlice.reducer, + [spacePackSlice.reducerPath]: spacePackSlice.reducer, + [assetsApi.reducerPath]: assetsApi.reducer, + [spacesApi.reducerPath]: spacesApi.reducer, + [scenesApi.reducerPath]: scenesApi.reducer, + [entitiesApi.reducerPath]: entitiesApi.reducer, + [spacePacksApi.reducerPath]: spacePacksApi.reducer + }, + // Adding the api middleware enables caching, invalidation, polling, + // and other useful features of `rtk-query`. + middleware: (getDefaultMiddleware) => + getDefaultMiddleware() + .concat(assetsApi.middleware) + .concat(spacesApi.middleware) + .concat(scenesApi.middleware) + .concat(entitiesApi.middleware) + .concat(spacePacksApi.middleware) + .concat(listenerMiddlewareLocal.middleware) + .concat(listenerMiddlewareSpaces.middleware) + .concat(listenerMiddlewareEntities.middleware) +}) + +// optional, but required for refetchOnFocus/refetchOnReconnect behaviors +// see `setupListeners` docs - takes an optional callback as the 2nd arg for customization +setupListeners(store.dispatch) + +// Infer the `RootState` and `AppDispatch` types from the store itself +export type RootState = ReturnType +// Inferred type +export type AppDispatch = typeof store.dispatch diff --git a/mirror-2/supabase/.gitignore b/mirror-2/supabase/.gitignore new file mode 100644 index 00000000..bd5e3e72 --- /dev/null +++ b/mirror-2/supabase/.gitignore @@ -0,0 +1,5 @@ +# Supabase +.branches +.temp +.env +config.toml diff --git a/mirror-2/supabase/migrations/20240929034647_create_user_profiles.sql b/mirror-2/supabase/migrations/20240929034647_create_user_profiles.sql new file mode 100644 index 00000000..cfeb3eff --- /dev/null +++ b/mirror-2/supabase/migrations/20240929034647_create_user_profiles.sql @@ -0,0 +1,40 @@ +-- create enum for avatar type +create type avatar_type as enum ( +'ready_player_me' +); + +-- Create a table for public user_profiles +create table user_profiles ( + id uuid references auth.users on delete cascade not null primary key default uuid_generate_v4(), + display_name text unique not null, + public_bio text, + ready_player_me_url_glb text, + avatar_type public.avatar_type null default 'ready_player_me'::avatar_type, + created_at timestamp with time zone not null default now(), + updated_at timestamp with time zone not null default now(), + constraint display_name_length check (char_length(display_name) >= 3) +); +-- Set up Row Level Security (RLS) +alter table user_profiles + enable row level security; + +create policy "Public user_profiles are viewable by everyone." on user_profiles + for select using (true); + +create policy "Users can create their own profile." on user_profiles + for insert with check ((select auth.uid()) = id); + +create policy "Users can update own profile." on user_profiles + for update using ((select auth.uid()) = id); + +-- Set up Storage! +insert into storage.buckets (id, name) + values ('user_profile_images', 'user_profile_images'); + +-- Set up access controls for storage. +-- See https://supabase.com/docs/guides/storage#policy-examples for more details. +create policy "User profiles images are publicly accessible." on storage.objects + for select using (bucket_id = 'user_profile_images'); + +create policy "Authed users can upload a profile image." on storage.objects + for insert to authenticated with check (bucket_id = 'user_profile_images'); diff --git a/mirror-2/supabase/migrations/20240929043655_spaces.sql b/mirror-2/supabase/migrations/20240929043655_spaces.sql new file mode 100644 index 00000000..b3031561 --- /dev/null +++ b/mirror-2/supabase/migrations/20240929043655_spaces.sql @@ -0,0 +1,70 @@ +CREATE OR REPLACE FUNCTION generate_unique_id_spaces() +RETURNS TRIGGER AS $$ +DECLARE + new_id BIGINT; +BEGIN + LOOP + new_id := floor(random() * 9007198754740991 + 500000000)::BIGINT; + -- Check if the generated id already exists + IF NOT EXISTS (SELECT 1 FROM spaces WHERE id = new_id) THEN + NEW.id := new_id; + EXIT; + END IF; + END LOOP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create table spaces ( + id BIGINT PRIMARY KEY DEFAULT (floor(random() * 9007198754740991 + 500000000)::BIGINT), -- unique number instead of uuid since the game engine wants a number for this. set a floor above 500000000. 9007198754740991 is below the MAX_SAFE_INTEGER for js + name text not null, + description text, + public_page_image_urls text[] default '{}', + owner_user_id uuid references auth.users(id) not null, -- owner is different from creator. Spaces can be transferred and we want to retain the creator + creator_user_id uuid references auth.users(id) not null, + created_at timestamp with time zone not null default now(), + updated_at timestamp with time zone not null default now(), + constraint name_length check (char_length(name) >= 3) + ); + +-- Create the trigger to generate a unique id +CREATE TRIGGER ensure_unique_id +BEFORE INSERT ON spaces +FOR EACH ROW +WHEN (NEW.id IS NULL) +EXECUTE FUNCTION generate_unique_id_spaces(); + + + -- add RLS +alter table spaces + enable row level security; + + +-- Policy for creating spaces +create policy "Users can create their own spaces" +on spaces +for insert +with check ( + owner_user_id = auth.uid() + and creator_user_id = auth.uid() +); + +-- Policy for selecting spaces +create policy "Users can view their own spaces" +on spaces +for select +using ( + owner_user_id = auth.uid() +); + +-- Policy for updating spaces +create policy "Users can update their own spaces" +on spaces +for update +using (owner_user_id = auth.uid()); + +-- Policy for deleting spaces +create policy "Users can delete their own spaces" +on spaces +for delete +using (owner_user_id = auth.uid()); diff --git a/mirror-2/supabase/migrations/20240929043656_assets.sql b/mirror-2/supabase/migrations/20240929043656_assets.sql new file mode 100644 index 00000000..70dd44e5 --- /dev/null +++ b/mirror-2/supabase/migrations/20240929043656_assets.sql @@ -0,0 +1,114 @@ +CREATE OR REPLACE FUNCTION generate_unique_id_assets() +RETURNS TRIGGER AS $$ +DECLARE + new_id BIGINT; +BEGIN + LOOP + new_id := floor(random() * 9007198754740991 + 500000000)::BIGINT; + -- Check if the generated id already exists + IF NOT EXISTS (SELECT 1 FROM assets WHERE id = new_id) THEN + NEW.id := new_id; + EXIT; + END IF; + END LOOP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +-- assets +create table assets ( + id bigint primary key default (floor(random() * 9007198754740991 + 500000000)::BIGINT), -- unique number instead of uuid since the game engine wants a number for this. set a floor above 500000000. 9007198754740991 is below the MAX_SAFE_INTEGER for js + owner_user_id uuid references auth.users(id) not null, -- owner is different from creator. Assets can be transferred and we want to retain the creator + creator_user_id uuid references auth.users(id) not null, + name text not null, + description text, + file_url text not null, + thumbnail_url text not null, + data jsonb not null default '{}'::jsonb, -- TODO add jsonb validation once this is hardened + created_at timestamp with time zone not null default now(), + updated_at timestamp with time zone not null default now() + ); + + +-- Create the trigger to generate a unique id +CREATE TRIGGER ensure_unique_id +BEFORE INSERT ON assets +FOR EACH ROW +WHEN (NEW.id IS NULL) +EXECUTE FUNCTION generate_unique_id_assets(); + +-- add RLS +alter table assets + enable row level security; + + -- Policy for creating assets +create policy "Users can create their own assets" +on assets +for insert +with check ( + owner_user_id = auth.uid() + and creator_user_id = auth.uid() +); + +-- Policy for selecting assets +create policy "Users can view their own assets" +on assets +for select +using ( + owner_user_id = auth.uid() +); + +-- Policy for updating assets +create policy "Users can update their own assets" +on assets +for update +using (owner_user_id = auth.uid()); + +-- Policy for deleting assets +create policy "Users can delete their own assets" +on assets +for delete +using (owner_user_id = auth.uid()); + + +-- set up storage for assets +insert into + storage.buckets (id, name, public) +values + ('assets', 'assets', true); + + +create policy "User can insert their own assets" +on storage.objects +for insert +to authenticated +with check ( + bucket_id = 'assets' and + owner_id = (select auth.uid()::text) -- Ensure the owner is the current authenticated user +); + +create policy "Anyone can read assets" +on storage.objects +for select +to authenticated +using ( + bucket_id = 'assets' +); + +create policy "User can update their own assets" +on storage.objects +for update +to authenticated +using ( + bucket_id = 'assets' and + owner_id = (select auth.uid()::text) -- Ensure the user owns the object they want to update +); + +create policy "User can delete their own assets" +on storage.objects +for delete +to authenticated +using ( + bucket_id = 'assets' and + owner_id = (select auth.uid()::text) -- Ensure the user owns the object they want to delete +); diff --git a/mirror-2/supabase/migrations/20240929062844_collaborators.sql b/mirror-2/supabase/migrations/20240929062844_collaborators.sql new file mode 100644 index 00000000..e33845e9 --- /dev/null +++ b/mirror-2/supabase/migrations/20240929062844_collaborators.sql @@ -0,0 +1,44 @@ + +-- Create the space_user_collaborators table +create table space_user_collaborators ( + id uuid not null primary key default uuid_generate_v4(), + space_id BIGINT references spaces(id) on delete cascade not null, + user_id uuid references auth.users(id) on delete cascade not null, + created_at timestamp with time zone not null default now(), + constraint unique_space_user unique(space_id, user_id) +); + +-- Enable RLS for space_user_collaborators +alter table space_user_collaborators + enable row level security; + +-- Only space owners can add collaborators +create policy "Only space owners can add collaborators" +on space_user_collaborators +for insert +with check ( + exists ( + select 1 from spaces + where spaces.id = space_id + and spaces.creator_user_id = auth.uid() + ) +); + +-- Policy for selecting space_user_collaborators +create policy "Users can view where they are a collaborator" +on space_user_collaborators +for select +using (user_id = auth.uid()); + + +-- Policy for collaborators to view spaces +create policy "Collaborators can view spaces" +on spaces +for select +using ( + exists ( + select 1 from space_user_collaborators + where space_user_collaborators.space_id = spaces.id + and space_user_collaborators.user_id = auth.uid() + ) +); diff --git a/mirror-2/supabase/migrations/20241001224639_scenes.sql b/mirror-2/supabase/migrations/20241001224639_scenes.sql new file mode 100644 index 00000000..1e76bb11 --- /dev/null +++ b/mirror-2/supabase/migrations/20241001224639_scenes.sql @@ -0,0 +1,211 @@ +CREATE OR REPLACE FUNCTION generate_unique_id_scenes() +RETURNS TRIGGER AS $$ +DECLARE + new_id BIGINT; +BEGIN + LOOP + new_id := floor(random() * 9007198754740991 + 500000000)::BIGINT; + -- Check if the generated id already exists + IF NOT EXISTS (SELECT 1 FROM scenes WHERE id = new_id) THEN + NEW.id := new_id; + EXIT; + END IF; + END LOOP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + + +CREATE EXTENSION IF NOT EXISTS pg_jsonschema WITH SCHEMA extensions; + +CREATE TABLE scenes ( + id BIGINT PRIMARY KEY DEFAULT (floor(random() * 9007198754740991 + 500000000)::BIGINT), -- unique number instead of uuid since the game engine wants a number for this. set a floor above 500000000. 9007198754740991 is below the MAX_SAFE_INTEGER for js + space_id BIGINT REFERENCES spaces ON DELETE CASCADE NOT NULL, -- delete the scene if space is deleted + name TEXT NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + settings JSONB NOT NULL, + CONSTRAINT name_length CHECK (char_length(name) >= 0) + -- TODO implement jsonb schema validation once hardened + -- CHECK ( + -- jsonb_matches_schema( + -- '{ + -- "type": "object", + -- "properties": { + -- "priority_scripts": { "type": "array", "items": {} }, + -- "physics": { + -- "type": "object", + -- "properties": { + -- "gravity": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- } + -- }, + -- "required": ["gravity"] + -- }, + -- "render": { + -- "type": "object", + -- "properties": { + -- "fog_end": { "type": "number" }, + -- "fog_start": { "type": "number" }, + -- "global_ambient": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- }, + -- "tonemapping": { "type": "number" }, + -- "fog_color": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- }, + -- "fog": { "type": "string" }, + -- "skybox": { "type": ["string", "null"] }, + -- "fog_density": { "type": "number" }, + -- "gamma_correction": { "type": "number" }, + -- "exposure": { "type": "number" }, + -- "lightmapSizeMultiplier": { "type": "number" }, + -- "lightmapMaxResolution": { "type": "number" }, + -- "lightmapMode": { "type": "number" }, + -- "skyboxIntensity": { "type": "number" }, + -- "skyboxMip": { "type": "number" }, + -- "skyboxRotation": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- }, + -- "lightmapFilterEnabled": { "type": "boolean" }, + -- "lightmapFilterRange": { "type": "number" }, + -- "lightmapFilterSmoothness": { "type": "number" }, + -- "ambientBake": { "type": "boolean" }, + -- "ambientBakeNumSamples": { "type": "number" }, + -- "ambientBakeSpherePart": { "type": "number" }, + -- "ambientBakeOcclusionBrightness": { "type": "number" }, + -- "ambientBakeOcclusionContrast": { "type": "number" }, + -- "clusteredLightingEnabled": { "type": "boolean" }, + -- "lightingCells": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- }, + -- "lightingMaxLightsPerCell": { "type": "number" }, + -- "lightingCookieAtlasResolution": { "type": "number" }, + -- "lightingShadowAtlasResolution": { "type": "number" }, + -- "lightingShadowType": { "type": "number" }, + -- "lightingCookiesEnabled": { "type": "boolean" }, + -- "lightingAreaLightsEnabled": { "type": "boolean" }, + -- "lightingShadowsEnabled": { "type": "boolean" }, + -- "skyType": { "type": "string" }, + -- "skyMeshPosition": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- }, + -- "skyMeshRotation": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- }, + -- "skyMeshScale": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- }, + -- "skyCenter": { + -- "type": "array", + -- "items": { "type": "number" }, + -- "minItems": 3, + -- "maxItems": 3 + -- } + -- }, + -- "required": [ + -- "fog_end", "fog_start", "global_ambient", "tonemapping", + -- "fog_color", "fog", "skybox", "fog_density", "gamma_correction", + -- "exposure", "lightmapSizeMultiplier", "lightmapMaxResolution", + -- "lightmapMode", "skyboxIntensity", "skyboxMip", "skyboxRotation", + -- "lightmapFilterEnabled", "lightmapFilterRange", "lightmapFilterSmoothness", + -- "ambientBake", "ambientBakeNumSamples", "ambientBakeSpherePart", + -- "ambientBakeOcclusionBrightness", "ambientBakeOcclusionContrast", + -- "clusteredLightingEnabled", "lightingCells", "lightingMaxLightsPerCell", + -- "lightingCookieAtlasResolution", "lightingShadowAtlasResolution", + -- "lightingShadowType", "lightingCookiesEnabled", "lightingAreaLightsEnabled", + -- "lightingShadowsEnabled", "skyType", "skyMeshPosition", "skyMeshRotation", + -- "skyMeshScale", "skyCenter" + -- ] + -- } + -- }, + -- "required": ["priority_scripts", "physics", "render"] + -- }', + -- settings + -- ) + -- ) +); + + +-- Create the trigger to generate a unique id +CREATE TRIGGER ensure_unique_id +BEFORE INSERT ON scenes +FOR EACH ROW +WHEN (NEW.id IS NULL) +EXECUTE FUNCTION generate_unique_id_scenes(); + + -- add RLS +alter table scenes + enable row level security; + +-- Policy for space owners +create policy "Owners can view their own scenes" +on scenes +for select +using ( + exists ( + select 1 from spaces + where spaces.id = scenes.space_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for selecting scenes +create policy "Users can create their own scenes" +on scenes +for insert +with check ( + exists ( + select 1 from spaces + where spaces.id = scenes.space_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for updating scenes +create policy "Users can update their own scenes" +on scenes +for update +using ( + exists ( + select 1 from spaces + where spaces.id = scenes.space_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for deleting scenes +create policy "Users can delete their own scenes" +on scenes +for delete +using ( + exists ( + select 1 from spaces + where spaces.id = scenes.space_id + and spaces.owner_user_id = auth.uid() + ) +); diff --git a/mirror-2/supabase/migrations/20241001231149_entities.sql b/mirror-2/supabase/migrations/20241001231149_entities.sql new file mode 100644 index 00000000..4400807e --- /dev/null +++ b/mirror-2/supabase/migrations/20241001231149_entities.sql @@ -0,0 +1,156 @@ +create table entities ( + id uuid not null primary key default uuid_generate_v4(), + name text not null, + enabled boolean not null default true, + parent_id uuid references entities(id) on delete cascade, + order_under_parent int, + scene_id bigint references scenes on delete cascade not null, -- delete entity if scene is deleted + local_position float8[] not null default array[0, 0, 0], -- storing position as an array of 3 floats + -- Future: store position (global as PointZ for large querying) + local_scale float8[] not null default array[1.0, 1.0, 1.0], -- storing scale as an array of 3 floats + local_rotation float8[] not null default array[0.0, 0.0, 0.0, 1.0], -- store rotation as a quaternion (x, y, z, w). NOT euler, though euler is mostly used user-facing + tags text[] default array[]::text[], -- storing tags as an empty array of text + components jsonb not null default '{}'::jsonb, -- TODO add jsonb validation once this is hardened + created_at timestamp with time zone not null default now(), + updated_at timestamp with time zone not null default now(), + constraint name_length check (char_length(name) >= 0), + constraint order_not_null_if_parent_id_exists check ( + (parent_id is not null and order_under_parent is not null) or parent_id is null + ), + constraint parent_id_not_self check (parent_id is distinct from id) -- ensures parent_id is not the same as id +); + +create or replace function check_circular_reference() +returns trigger as $$ +declare + current_parent uuid; +begin + -- Set the current parent to the newly inserted/updated parent_id + current_parent := new.parent_id; + + -- Traverse up the hierarchy + while current_parent is not null loop + -- If at any point, the current parent is the same as the entity's id, we have a cycle + if current_parent = new.id then + raise exception 'Circular reference detected: Entity % is an ancestor of itself.', new.id; + end if; + + -- Move to the next parent in the hierarchy + select parent_id into current_parent from entities where id = current_parent; + end loop; + + -- If no circular reference is found, return and allow the insert/update + return new; +end; +$$ language plpgsql; + +create trigger prevent_circular_reference +before insert or update on entities +for each row +execute function check_circular_reference(); + + -- add RLS +alter table entities + enable row level security; + +-- Policy for space owners +create policy "Owners can view their own entities" +on entities +for select +using ( + exists ( + select 1 from spaces + join scenes on scenes.space_id = spaces.id + where scenes.id = entities.scene_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for selecting entities +create policy "Users can create their own entities" +on entities +for insert +with check ( + exists ( + select 1 from spaces + join scenes on scenes.space_id = spaces.id + where scenes.id = entities.scene_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for updating entities +create policy "Users can update their own entities" +on entities +for update +using ( + exists ( + select 1 from spaces + join scenes on scenes.space_id = spaces.id + where scenes.id = entities.scene_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for deleting entities +create policy "Users can delete their own entities" +on entities +for delete +using ( + exists ( + select 1 from spaces + join scenes on scenes.space_id = spaces.id + where scenes.id = entities.scene_id + and spaces.owner_user_id = auth.uid() + ) +); + +CREATE POLICY "Disallow Root entity deletion" +ON entities +FOR DELETE +USING ( + parent_id = null +); + + +CREATE OR REPLACE FUNCTION increment_and_resequence_order_under_parent(p_scene_id uuid, p_entity_id uuid) +RETURNS void AS $$ +DECLARE + target_order int; + target_parent_id uuid; +BEGIN + -- 1. Find the target entity by entity_id + SELECT order_under_parent, parent_id + INTO target_order, target_parent_id + FROM entities + WHERE id = p_entity_id; + + -- Check if the entity exists + IF target_order IS NULL THEN + RAISE EXCEPTION 'Entity with id % does not exist.', p_entity_id; + END IF; + + -- 2. Increment order_under_parent for entities with greater order + UPDATE entities + SET order_under_parent = order_under_parent + 1 + WHERE scene_id = p_scene_id + AND parent_id IS NOT DISTINCT FROM target_parent_id + AND order_under_parent > target_order; + + -- 3. Resequence order_under_parent to eliminate gaps + WITH ordered_entities AS ( + SELECT id, + ROW_NUMBER() OVER (ORDER BY order_under_parent) AS new_order + FROM entities + WHERE scene_id = p_scene_id + AND parent_id IS NOT DISTINCT FROM target_parent_id + ) + UPDATE entities e + SET order_under_parent = oe.new_order + FROM ordered_entities oe + WHERE e.id = oe.id; + + -- Optionally, update the updated_at timestamp + -- UPDATE entities SET updated_at = NOW() WHERE id = ANY(SELECT id FROM ordered_entities); +END; +$$ LANGUAGE plpgsql; diff --git a/mirror-2/supabase/migrations/20241001232532_space_packs.sql b/mirror-2/supabase/migrations/20241001232532_space_packs.sql new file mode 100644 index 00000000..344706f2 --- /dev/null +++ b/mirror-2/supabase/migrations/20241001232532_space_packs.sql @@ -0,0 +1,132 @@ +-- space_packs are an IMMUTABLE version of a space, used for exporting/importing, publishing a Space, etc. + +CREATE EXTENSION IF NOT EXISTS pg_jsonschema WITH SCHEMA extensions; + +CREATE OR REPLACE FUNCTION generate_unique_id_space_packs() +RETURNS TRIGGER AS $$ +DECLARE + new_id BIGINT; +BEGIN + LOOP + new_id := floor(random() * 9007198754740991 + 500000000)::BIGINT; + -- Check if the generated id already exists + IF NOT EXISTS (SELECT 1 FROM space_packs WHERE id = new_id) THEN + NEW.id := new_id; + EXIT; + END IF; + END LOOP; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create table space_packs ( + id BIGINT PRIMARY KEY DEFAULT (floor(random() * 9007198754740991 + 500000000)::BIGINT), -- unique number instead of uuid since spaces also use a number id. set a floor above 500000000. 9007198754740991 is below the MAX_SAFE_INTEGER for js + space_id BIGINT references spaces not null, + display_name text, + -- TODO add JSON schema validation + data jsonb not null, + created_at timestamp with time zone not null default now(), + updated_at timestamp with time zone not null default now() + ); + +-- Create the trigger to generate a unique id +CREATE TRIGGER ensure_unique_id +BEFORE INSERT ON space_packs +FOR EACH ROW +WHEN (NEW.id IS NULL) +EXECUTE FUNCTION generate_unique_id_space_packs(); + + -- add RLS +alter table space_packs + enable row level security; + +-- Policy for space owners +create policy "Owners can view their own space_packs" +on space_packs +for select +using ( + exists ( + select 1 from spaces + where spaces.id = space_packs.space_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for selecting space_packs +create policy "Users can create their own space_packs" +on space_packs +for insert +with check ( + exists ( + select 1 from spaces + where spaces.id = space_packs.space_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for updating space_packs +create policy "Users can update their own space_packs" +on space_packs +for update +using ( + exists ( + select 1 from spaces + where spaces.id = space_packs.space_id + and spaces.owner_user_id = auth.uid() + ) +); + +-- Policy for deleting space_packs +create policy "Users can delete their own space_packs" +on space_packs +for delete +using ( + exists ( + select 1 from spaces + where spaces.id = space_packs.space_id + and spaces.owner_user_id = auth.uid() + ) +); + + +-- Storage +insert into + storage.buckets (id, name, public) +values + ('space-packs', 'space-packs', true); + + +create policy "User can insert their own space-packs" +on storage.objects +for insert +to authenticated +with check ( + bucket_id = 'space-packs' and + owner_id = (select auth.uid()::text) -- Ensure the owner is the current authenticated user +); + +create policy "Anyone can read space-packs" +on storage.objects +for select +to authenticated +using ( + bucket_id = 'space-packs' +); + +create policy "User can update their own space-packs" +on storage.objects +for update +to authenticated +using ( + bucket_id = 'space-packs' and + owner_id = (select auth.uid()::text) -- Ensure the user owns the object they want to update +); + +create policy "User can delete their own space-packs" +on storage.objects +for delete +to authenticated +using ( + bucket_id = 'space-packs' and + owner_id = (select auth.uid()::text) -- Ensure the user owns the object they want to delete +); diff --git a/mirror-2/supabase/migrations/20241001233046_scripts.sql b/mirror-2/supabase/migrations/20241001233046_scripts.sql new file mode 100644 index 00000000..e69de29b diff --git a/mirror-2/supabase/migrations/20241005025417_searches_assets_spaces.sql b/mirror-2/supabase/migrations/20241005025417_searches_assets_spaces.sql new file mode 100644 index 00000000..6de4c564 --- /dev/null +++ b/mirror-2/supabase/migrations/20241005025417_searches_assets_spaces.sql @@ -0,0 +1,15 @@ +create or replace function search_assets_by_name_prefix(prefix text) +returns setof assets AS $$ +begin + return query + select * from assets where to_tsvector('english', name) @@ to_tsquery(prefix || ':*'); +end; +$$ language plpgsql; + +create or replace function search_spaces_by_name_prefix(prefix text) +returns setof spaces AS $$ +begin + return query + select * from spaces where to_tsvector('english', name) @@ to_tsquery(prefix || ':*'); +end; +$$ language plpgsql; diff --git a/mirror-2/supabase/migrations/20241007195537_get_space_all.sql b/mirror-2/supabase/migrations/20241007195537_get_space_all.sql new file mode 100644 index 00000000..34dcd2e7 --- /dev/null +++ b/mirror-2/supabase/migrations/20241007195537_get_space_all.sql @@ -0,0 +1,52 @@ +CREATE OR REPLACE FUNCTION get_space_with_children(space_id UUID) +RETURNS JSONB +LANGUAGE plpgsql +AS $$ +BEGIN + RETURN ( + SELECT jsonb_build_object( + 'id', s.id, + 'name', s.name, + 'scenes', ( + SELECT COALESCE(jsonb_agg( + jsonb_build_object( + 'id', sc.id, + 'name', sc.name, + 'entities', ( + SELECT COALESCE(jsonb_agg( + jsonb_build_object( + 'id', e.id, + 'name', e.name, + 'parent_id', e.parent_id, + 'children', ( + SELECT COALESCE(jsonb_agg(child.id), '[]'::jsonb) + FROM entities AS child + WHERE child.parent_id = e.id + ), + 'components', ( + SELECT COALESCE(jsonb_agg( + jsonb_build_object( + 'id', c.id, + 'component_key', c.component_key, + 'attributes', c.attributes + ) + ), '[]'::jsonb) + FROM components c + WHERE c.entity_id = e.id + ) + ) + ), '[]'::jsonb) + FROM entities e + WHERE e.scene_id = sc.id + ) + ) + ), '[]'::jsonb) + FROM scenes sc + WHERE sc.space_id = s.id + ) + ) + FROM spaces s + WHERE s.id = space_id + ); +END; +$$; diff --git a/mirror-2/supabase/migrations/20241012113142_import_bucket.sql b/mirror-2/supabase/migrations/20241012113142_import_bucket.sql new file mode 100644 index 00000000..24fd0b21 --- /dev/null +++ b/mirror-2/supabase/migrations/20241012113142_import_bucket.sql @@ -0,0 +1,97 @@ +-- Create the pc_imports table +create table pc_imports ( + id uuid primary key default uuid_generate_v4(), + owner_user_id uuid references auth.users(id), + display_name text not null, + created_at timestamp with time zone not null default now(), + updated_at timestamp with time zone not null default now() +); + +-- Policy to allow users to create their own pc-imports +-- create policy "Allow user to create pc-imports" +-- on pc_imports +-- for insert +-- to authenticated +-- with check ( +-- auth.uid()::uuid = owner_user_id -- Ensure the project is created with the correct owner_user_id +-- ); + +-- -- Policy to allow users to select (view) their own pc-imports +-- create policy "Allow user to select own pc-imports" +-- on pc_imports +-- for select +-- to authenticated +-- using ( +-- auth.uid()::uuid = owner_user_id -- Ensure the user can only select their own pc_imports +-- ); + +-- -- Policy to allow users to update their own pc-imports +-- create policy "Allow user to update own pc-imports" +-- on pc_imports +-- for update +-- to authenticated +-- using ( +-- auth.uid()::uuid = owner_user_id -- Ensure the user can only update their own pc_imports +-- ); + +-- -- Policy to allow users to delete their own pc-imports +-- create policy "Allow user to delete own pc-imports" +-- on pc_imports +-- for delete +-- to authenticated +-- using ( +-- auth.uid()::uuid = owner_user_id -- Ensure the user can only delete their own pc_imports +-- ); + +-- Set up storage bucket for pc-imports +insert into + storage.buckets (id, name, public) +values + ('pc-imports', 'pc-imports', true); + + +create policy "User can insert their own pc-imports" +on storage.objects +for insert +to authenticated +with check ( + bucket_id = 'pc-imports' and + owner_id = (select auth.uid()::text) -- Ensure the owner is the current authenticated user +); + +create policy "Anyone can read pc-imports" +on storage.objects +for select +to authenticated +using ( + bucket_id = 'pc-imports' +); + +create policy "User can update their own pc-imports" +on storage.objects +for update +to authenticated +using ( + bucket_id = 'pc-imports' and + owner_id = (select auth.uid()::text) -- Ensure the user owns the object they want to update +); + +create policy "User can delete their own pc-imports" +on storage.objects +for delete +to authenticated +using ( + bucket_id = 'pc-imports' and + owner_id = (select auth.uid()::text) -- Ensure the user owns the object they want to delete +); + + +-- Policy to allow authenticated uploads to the /pc-imports// folder +-- create policy "Allow authenticated uploads for /pc-imports// folder" +-- on storage.objects +-- for insert +-- to authenticated +-- with check ( +-- bucket_id = 'pc-imports' +-- AND (storage.foldername(name))[1] = auth.uid()::text -- Ensure userId matches auth.uid() +-- ); diff --git a/mirror-2/supabase/seed.sql b/mirror-2/supabase/seed.sql new file mode 100644 index 00000000..a120734a --- /dev/null +++ b/mirror-2/supabase/seed.sql @@ -0,0 +1,123 @@ +CREATE OR REPLACE FUNCTION public.create_user( + email text, + password text +) RETURNS uuid AS $$ + declare + user_id uuid; + encrypted_pw text; +BEGIN + -- Generate a new user uuid and encrypt the password + user_id := gen_random_uuid(); + encrypted_pw := crypt(password, gen_salt('bf')); + + -- Insert into auth.users table + INSERT INTO auth.users + (instance_id, id, aud, role, email, encrypted_password, email_confirmed_at, recovery_sent_at, last_sign_in_at, raw_app_meta_data, raw_user_meta_data, created_at, updated_at, confirmation_token, email_change, email_change_token_new, recovery_token) + VALUES + ('00000000-0000-0000-0000-000000000000', user_id, 'authenticated', 'authenticated', email, encrypted_pw, '2023-05-03 19:41:43.585805+00', '2023-04-22 13:10:03.275387+00', '2023-04-22 13:10:31.458239+00', '{"provider":"email","providers":["email"]}', '{}', '2023-05-03 19:41:43.580424+00', '2023-05-03 19:41:43.585948+00', '', '', '', ''); + + -- Insert into auth.identities table + INSERT INTO auth.identities + (id, user_id, identity_data, provider, last_sign_in_at, created_at, updated_at, provider_id) + VALUES + (gen_random_uuid(), user_id, format('{"sub":"%s","email":"%s"}', user_id::text, email)::jsonb, 'email', '2023-05-03 19:41:43.582456+00', '2023-05-03 19:41:43.582497+00', '2023-05-03 19:41:43.582497+00', user_id); -- Providing the user_id as provider_id or a different unique value + + RETURN user_id; +END; +$$ LANGUAGE plpgsql; + +DO $$ +DECLARE + i INTEGER; + email TEXT; + password TEXT := 'password'; -- Default password for all users + user_ids uuid[] := ARRAY[]::uuid[]; -- Array to store user IDs + user_id uuid; + profile_url TEXT; + file_url TEXT; + thumbnail_url TEXT; + space_id bigint; + scene_id bigint; + entity_name TEXT; + entity_id uuid; + component_name TEXT; + public_page_image_urls text[]; +BEGIN + -- Loop to insert 15 users + FOR i IN 1..15 LOOP + -- Construct the email dynamically + email := format('user%s@example.com', i); + + -- Call the create_user function with the constructed email and capture user_id + user_id := public.create_user(email, password); + user_ids := array_append(user_ids, user_id); + + -- Optionally, print each email for verification during execution + RAISE NOTICE 'Created user with email: %, ID: %', email, user_id; + + -- Insert a user profile for the created user + INSERT INTO public.user_profiles + (id, display_name, public_bio, ready_player_me_url_glb) + VALUES + (user_id, format('User %s', i), format('This is the bio of user %s.', i), format('https://picsum.photos/seed/picsum/300/300', i)); + + -- Insert 30 assets for each user + FOR j IN 1..30 LOOP + file_url := format('https://picsum.photos/seed/picsum/800/600', i, j); + thumbnail_url := format('https://picsum.photos/seed/picsum/200/150', i, j); + + INSERT INTO public.assets + (id, name, description, file_url, thumbnail_url, creator_user_id, owner_user_id, created_at, updated_at) + VALUES + (floor(random() * 9007199254740991 + 500000000)::BIGINT, format('Asset %s', j), 'This is a placeholder description for the asset.', file_url, thumbnail_url, user_id, user_id, now(), now()); + END LOOP; + + END LOOP; + + -- Insert spaces + FOR i IN 1..45 LOOP + public_page_image_urls := ARRAY[ + format('https://picsum.photos/seed/picsum/%s/800', i), + format('https://picsum.photos/seed/picsum/%s/801', i), + format('https://picsum.photos/seed/picsum/%s/802', i) + ]; + + INSERT INTO public.spaces + (id, name, description, public_page_image_urls, creator_user_id, owner_user_id, created_at, updated_at) + VALUES + (floor(random() * 9007199254740991 + 500000000)::BIGINT, format('Space %s', i), 'This is a placeholder description for the space.', public_page_image_urls, user_ids[((i - 1) % 15) + 1], user_ids[((i - 1) % 15) + 1], now(), now()) + RETURNING id INTO space_id; + + -- Insert 3 space_packs for each space + FOR v IN 1..3 LOOP + INSERT INTO public.space_packs + (id, space_id, data, created_at, updated_at) + VALUES + (floor(random() * 9007199254740991 + 500000000)::BIGINT,space_id, '{}'::jsonb, now(), now()); + END LOOP; + + -- Insert 3 scenes for each space + FOR j IN 1..3 LOOP + INSERT INTO public.scenes + (id, space_id, name, created_at, updated_at, settings) + VALUES + (floor(random() * 9007199254740991 + 500000000)::BIGINT, space_id, format('Scene %s-%s', i, j), now(), now(), '{}'::jsonb) + RETURNING id INTO scene_id; + + -- Insert 20 entities for each scene + FOR k IN 1..20 LOOP + entity_name := format('Entity %s-%s-%s', i, j, k); + + -- Insert entity + INSERT INTO public.entities + (id, name, scene_id, created_at, updated_at) + VALUES + (gen_random_uuid(), entity_name, scene_id, now(), now()) + RETURNING id INTO entity_id; -- Capture the newly created entity ID + + END LOOP; + + END LOOP; + + END LOOP; +END $$; diff --git a/mirror-2/tailwind.config.ts b/mirror-2/tailwind.config.ts new file mode 100644 index 00000000..ee51135d --- /dev/null +++ b/mirror-2/tailwind.config.ts @@ -0,0 +1,101 @@ +import type { Config } from 'tailwindcss' + +const config = { + darkMode: ['class'], + content: [ + './pages/**/*.{ts,tsx}', + './components/**/*.{ts,tsx}', + './app/**/*.{ts,tsx}', + './src/**/*.{ts,tsx}' + ], + prefix: '', + theme: { + container: { + center: true, + padding: '2rem', + screens: { + '2xl': '1400px' + } + }, + extend: { + fontFamily: { + sans: ['Montserrat', 'sans-serif'] // Add Montserrat as the default font + }, + colors: { + border: 'hsl(var(--border))', + input: 'hsl(var(--input))', + ring: 'hsl(var(--ring))', + background: 'hsl(var(--background))', + foreground: 'hsl(var(--foreground))', + primary: { + DEFAULT: 'hsl(var(--primary))', + foreground: 'hsl(var(--primary-foreground))' + }, + secondary: { + DEFAULT: 'hsl(var(--secondary))', + foreground: 'hsl(var(--secondary-foreground))' + }, + destructive: { + DEFAULT: 'hsl(var(--destructive))', + foreground: 'hsl(var(--destructive-foreground))' + }, + muted: { + DEFAULT: 'hsl(var(--muted))', + foreground: 'hsl(var(--muted-foreground))' + }, + accent: { + DEFAULT: 'hsl(var(--accent))', + foreground: 'hsl(var(--accent-foreground))' + }, + popover: { + DEFAULT: 'hsl(var(--popover))', + foreground: 'hsl(var(--popover-foreground))' + }, + card: { + DEFAULT: 'hsl(var(--card))', + foreground: 'hsl(var(--card-foreground))' + } + }, + borderRadius: { + lg: 'var(--radius)', + md: 'calc(var(--radius) - 2px)', + sm: 'calc(var(--radius) - 4px)', + xs: 'calc(var(--radius) - 6px)' + }, + keyframes: { + 'accordion-down': { + from: { + height: '0' + }, + to: { + height: 'var(--radix-accordion-content-height)' + } + }, + 'accordion-up': { + from: { + height: 'var(--radix-accordion-content-height)' + }, + to: { + height: '0' + } + }, + progress: { + '0%': { transform: ' translateX(0) scaleX(0)' }, + '40%': { transform: 'translateX(0) scaleX(0.4)' }, + '100%': { transform: 'translateX(100%) scaleX(0.5)' } + } + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out', + progress: 'progress 0.65s infinite linear' + }, + transformOrigin: { + 'left-right': '0% 50%' + } + } + }, + plugins: [require('tailwindcss-animate')] +} satisfies Config + +export default config diff --git a/mirror-2/tsconfig.json b/mirror-2/tsconfig.json new file mode 100644 index 00000000..af4b5680 --- /dev/null +++ b/mirror-2/tsconfig.json @@ -0,0 +1,43 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noImplicitAny": false, + "jsx": "preserve", + "incremental": true, + "plugins": [ + { + "name": "next" + }, + { + "name": "ts-plugin-sort-import-suggestions", + "moveUpPatterns": ["@/", "\\.{1,2}/"], + "moveDownPatterns": ["dist", "antd"] + } + ], + "paths": { + "@/*": ["./*"] + } + }, + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + "state/engine/__settings__.js", + "state/engine/__loading__.js", + "state/engine/__modules__.js", + "state/engine/__start__.js" + ], + "exclude": ["node_modules"] +} diff --git a/mirror-2/utils/analytics/analytics.tsx b/mirror-2/utils/analytics/analytics.tsx new file mode 100644 index 00000000..7c94972e --- /dev/null +++ b/mirror-2/utils/analytics/analytics.tsx @@ -0,0 +1,83 @@ +'use client' +import packageJson from '../../package.json' +import { ampli } from '@/src/ampli' +import { sessionReplayPlugin } from '@amplitude/plugin-session-replay-browser' +import { useEffect } from 'react' + +export enum AnalyticsEvent { + /** + * Spaces + */ + CreateSpaceAPISuccess = 'Create Space API Success', + DeleteSpaceAPISuccess = 'Delete Space API Success', + + /** + * Scenes + */ + CreateSceneAPISuccess = 'Create Scene API Success', + CreateSceneAPIFailure = 'Create Scene API Failure', + UpdateSceneAPISuccess = 'Update Scene API Success', + UpdateSceneAPIFailure = 'Update Scene API Failure', + DeleteSceneAPISuccess = 'Delete Scene API Success', + DeleteSceneAPIFailure = 'Delete Scene API Failure', + + /** + * Entity + */ + CreateEntityAPISuccess = 'Create Entity API Success', + DeleteEntityAPISuccess = 'Delete Entity API Success', + + /** + * Space Packs + */ + CreateSpacePackAPISuccess = 'Create Space Pack API Success', + DeleteSpacePackAPISuccess = 'Delete Space Pack API Success', + + /** + * User + */ + UserLogin = 'User Login', + UserLogout = 'User Logout' +} + +if (typeof window !== 'undefined') { + window['analyticsInitialized'] = false +} + +export function sendAnalyticsEvent(event: AnalyticsEvent) { + // don't track if we're not client-side since NextJS renders the HTML on server + if (typeof window !== 'undefined' && window['analyticsInitialized']) { + ampli.track({ + event_type: event, + app_version: packageJson.version + }) + } +} + +export function setAnalyticsUserId(userId: string) { + if (typeof window !== 'undefined' && !window['analyticsInitialized']) { + ampli.client.setUserId(userId) + } +} + +export default function AnalyticsInitializer() { + useEffect(() => { + // Ensure we are in the browser and analytics has not been initialized + if (typeof window !== 'undefined' && !window['analyticsInitialized']) { + if (!process.env.NEXT_PUBLIC_AMPLITUDE_PUBLIC_KEY) { + throw new Error('Missing analytics key') + } + + ampli.load({ + client: { apiKey: process.env.NEXT_PUBLIC_AMPLITUDE_PUBLIC_KEY } + }) + ampli.client.add(sessionReplayPlugin()) + + console.log('Analytics: Initializing') + + window['analyticsInitialized'] = true + } + }, []) + + return null // No UI component to render +} diff --git a/mirror-2/utils/cn.ts b/mirror-2/utils/cn.ts new file mode 100644 index 00000000..fed2fe91 --- /dev/null +++ b/mirror-2/utils/cn.ts @@ -0,0 +1,6 @@ +import { clsx, type ClassValue } from 'clsx' +import { twMerge } from 'tailwind-merge' + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} diff --git a/mirror-2/utils/database.types.ts b/mirror-2/utils/database.types.ts new file mode 100644 index 00000000..28630497 --- /dev/null +++ b/mirror-2/utils/database.types.ts @@ -0,0 +1,526 @@ +export type Json = + | string + | number + | boolean + | null + | { [key: string]: Json | undefined } + | Json[] + +export type Database = { + graphql_public: { + Tables: { + [_ in never]: never + } + Views: { + [_ in never]: never + } + Functions: { + graphql: { + Args: { + operationName?: string + query?: string + variables?: Json + extensions?: Json + } + Returns: Json + } + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } + public: { + Tables: { + assets: { + Row: { + created_at: string + creator_user_id: string + data: Json + description: string | null + file_url: string + id: number + name: string + owner_user_id: string + thumbnail_url: string + updated_at: string + } + Insert: { + created_at?: string + creator_user_id: string + data?: Json + description?: string | null + file_url: string + id?: number + name: string + owner_user_id: string + thumbnail_url: string + updated_at?: string + } + Update: { + created_at?: string + creator_user_id?: string + data?: Json + description?: string | null + file_url?: string + id?: number + name?: string + owner_user_id?: string + thumbnail_url?: string + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "assets_creator_user_id_fkey" + columns: ["creator_user_id"] + isOneToOne: false + referencedRelation: "users" + referencedColumns: ["id"] + }, + { + foreignKeyName: "assets_owner_user_id_fkey" + columns: ["owner_user_id"] + isOneToOne: false + referencedRelation: "users" + referencedColumns: ["id"] + }, + ] + } + entities: { + Row: { + components: Json + created_at: string + enabled: boolean + id: string + local_position: number[] + local_rotation: number[] + local_scale: number[] + name: string + order_under_parent: number | null + parent_id: string | null + scene_id: number + tags: string[] | null + updated_at: string + } + Insert: { + components?: Json + created_at?: string + enabled?: boolean + id?: string + local_position?: number[] + local_rotation?: number[] + local_scale?: number[] + name: string + order_under_parent?: number | null + parent_id?: string | null + scene_id: number + tags?: string[] | null + updated_at?: string + } + Update: { + components?: Json + created_at?: string + enabled?: boolean + id?: string + local_position?: number[] + local_rotation?: number[] + local_scale?: number[] + name?: string + order_under_parent?: number | null + parent_id?: string | null + scene_id?: number + tags?: string[] | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "entities_parent_id_fkey" + columns: ["parent_id"] + isOneToOne: false + referencedRelation: "entities" + referencedColumns: ["id"] + }, + { + foreignKeyName: "entities_scene_id_fkey" + columns: ["scene_id"] + isOneToOne: false + referencedRelation: "scenes" + referencedColumns: ["id"] + }, + ] + } + pc_imports: { + Row: { + created_at: string + display_name: string + id: string + owner_user_id: string | null + updated_at: string + } + Insert: { + created_at?: string + display_name: string + id?: string + owner_user_id?: string | null + updated_at?: string + } + Update: { + created_at?: string + display_name?: string + id?: string + owner_user_id?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "pc_imports_owner_user_id_fkey" + columns: ["owner_user_id"] + isOneToOne: false + referencedRelation: "users" + referencedColumns: ["id"] + }, + ] + } + scenes: { + Row: { + created_at: string + id: number + name: string + settings: Json + space_id: number + updated_at: string + } + Insert: { + created_at?: string + id?: number + name: string + settings: Json + space_id: number + updated_at?: string + } + Update: { + created_at?: string + id?: number + name?: string + settings?: Json + space_id?: number + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "scenes_space_id_fkey" + columns: ["space_id"] + isOneToOne: false + referencedRelation: "spaces" + referencedColumns: ["id"] + }, + ] + } + space_packs: { + Row: { + created_at: string + data: Json + display_name: string | null + id: number + space_id: number + updated_at: string + } + Insert: { + created_at?: string + data: Json + display_name?: string | null + id?: number + space_id: number + updated_at?: string + } + Update: { + created_at?: string + data?: Json + display_name?: string | null + id?: number + space_id?: number + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "space_packs_space_id_fkey" + columns: ["space_id"] + isOneToOne: false + referencedRelation: "spaces" + referencedColumns: ["id"] + }, + ] + } + space_user_collaborators: { + Row: { + created_at: string + id: string + space_id: number + user_id: string + } + Insert: { + created_at?: string + id?: string + space_id: number + user_id: string + } + Update: { + created_at?: string + id?: string + space_id?: number + user_id?: string + } + Relationships: [ + { + foreignKeyName: "space_user_collaborators_space_id_fkey" + columns: ["space_id"] + isOneToOne: false + referencedRelation: "spaces" + referencedColumns: ["id"] + }, + { + foreignKeyName: "space_user_collaborators_user_id_fkey" + columns: ["user_id"] + isOneToOne: false + referencedRelation: "users" + referencedColumns: ["id"] + }, + ] + } + spaces: { + Row: { + created_at: string + creator_user_id: string + description: string | null + id: number + name: string + owner_user_id: string + public_page_image_urls: string[] | null + updated_at: string + } + Insert: { + created_at?: string + creator_user_id: string + description?: string | null + id?: number + name: string + owner_user_id: string + public_page_image_urls?: string[] | null + updated_at?: string + } + Update: { + created_at?: string + creator_user_id?: string + description?: string | null + id?: number + name?: string + owner_user_id?: string + public_page_image_urls?: string[] | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "spaces_creator_user_id_fkey" + columns: ["creator_user_id"] + isOneToOne: false + referencedRelation: "users" + referencedColumns: ["id"] + }, + { + foreignKeyName: "spaces_owner_user_id_fkey" + columns: ["owner_user_id"] + isOneToOne: false + referencedRelation: "users" + referencedColumns: ["id"] + }, + ] + } + user_profiles: { + Row: { + avatar_type: Database["public"]["Enums"]["avatar_type"] | null + created_at: string + display_name: string + id: string + public_bio: string | null + ready_player_me_url_glb: string | null + updated_at: string + } + Insert: { + avatar_type?: Database["public"]["Enums"]["avatar_type"] | null + created_at?: string + display_name: string + id?: string + public_bio?: string | null + ready_player_me_url_glb?: string | null + updated_at?: string + } + Update: { + avatar_type?: Database["public"]["Enums"]["avatar_type"] | null + created_at?: string + display_name?: string + id?: string + public_bio?: string | null + ready_player_me_url_glb?: string | null + updated_at?: string + } + Relationships: [ + { + foreignKeyName: "user_profiles_id_fkey" + columns: ["id"] + isOneToOne: true + referencedRelation: "users" + referencedColumns: ["id"] + }, + ] + } + } + Views: { + [_ in never]: never + } + Functions: { + create_user: { + Args: { + email: string + password: string + } + Returns: string + } + get_space_with_children: { + Args: { + space_id: string + } + Returns: Json + } + increment_and_resequence_order_under_parent: { + Args: { + p_scene_id: string + p_entity_id: string + } + Returns: undefined + } + search_assets_by_name_prefix: { + Args: { + prefix: string + } + Returns: { + created_at: string + creator_user_id: string + data: Json + description: string | null + file_url: string + id: number + name: string + owner_user_id: string + thumbnail_url: string + updated_at: string + }[] + } + search_spaces_by_name_prefix: { + Args: { + prefix: string + } + Returns: { + created_at: string + creator_user_id: string + description: string | null + id: number + name: string + owner_user_id: string + public_page_image_urls: string[] | null + updated_at: string + }[] + } + } + Enums: { + avatar_type: "ready_player_me" + } + CompositeTypes: { + [_ in never]: never + } + } +} + +type PublicSchema = Database[Extract] + +export type Tables< + PublicTableNameOrOptions extends + | keyof (PublicSchema["Tables"] & PublicSchema["Views"]) + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"]) + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R + } + ? R + : never + : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & + PublicSchema["Views"]) + ? (PublicSchema["Tables"] & + PublicSchema["Views"])[PublicTableNameOrOptions] extends { + Row: infer R + } + ? R + : never + : never + +export type TablesInsert< + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I + } + ? I + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never + : never + +export type TablesUpdate< + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U + } + ? U + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Update: infer U + } + ? U + : never + : never + +export type Enums< + PublicEnumNameOrOptions extends + | keyof PublicSchema["Enums"] + | { schema: keyof Database }, + EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] + : never = never, +> = PublicEnumNameOrOptions extends { schema: keyof Database } + ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] + : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] + ? PublicSchema["Enums"][PublicEnumNameOrOptions] + : never + diff --git a/mirror-2/utils/download-file.ts b/mirror-2/utils/download-file.ts new file mode 100644 index 00000000..dfa97502 --- /dev/null +++ b/mirror-2/utils/download-file.ts @@ -0,0 +1,12 @@ +export default function downloadFile(data: Blob, filename: string) { + const url = window.URL.createObjectURL(data) // Create a Blob URL + const link = document.createElement('a') // Create an anchor element + link.href = url // Set the Blob URL as the href attribute + link.setAttribute('download', filename) // Set the filename for download + + document.body.appendChild(link) // Append the anchor to the DOM + link.click() // Simulate a click event + + document.body.removeChild(link) // Clean up the anchor + window.URL.revokeObjectURL(url) // Release the Blob URL +} diff --git a/mirror-2/utils/pc-import.server.ts b/mirror-2/utils/pc-import.server.ts new file mode 100644 index 00000000..77497ad2 --- /dev/null +++ b/mirror-2/utils/pc-import.server.ts @@ -0,0 +1,21 @@ +import replaceInFile from 'replace-in-file' + +export async function modifySettings(filePath: string) { + const options = { + files: filePath, + from: [ + /window\.ASSET_PREFIX\s*=\s*".*?"/g, + /window\.SCRIPT_PREFIX\s*=\s*".*?"/g, + /window\.SCENE_PATH\s*=\s*"(?:.*\/)?(\d+\.json)"/g, + /'powerPreference'\s*:\s*".*?"/g + ], + to: [ + 'window.ASSET_PREFIX = "../../sample/"', + 'window.SCRIPT_PREFIX = "../../sample"', + 'window.SCENE_PATH = "../../sample/$1"', + '\'powerPreference\': "high-performance"' + ] + } + + await replaceInFile(options) +} diff --git a/mirror-2/utils/space-pack.ts b/mirror-2/utils/space-pack.ts new file mode 100644 index 00000000..71783aba --- /dev/null +++ b/mirror-2/utils/space-pack.ts @@ -0,0 +1,179 @@ +'use client' +import JSZip from 'jszip' +import { useState } from 'react' +import { createSupabaseBrowserClient } from '@/utils/supabase/client' +import { snakeCase } from 'change-case' +import { useAppSelector } from '@/hooks/hooks' +import { selectLocalUser } from '@/state/local.slice' +import { + SPACE_PACKS_BUCKET_NAME, + useCreateSpacePackMutation +} from '@/state/api/space-packs' + +/** + * Important: When we importing an app, it's stored in an IMMUTABLE form intentionally; with different engine versions and settings, we'll need to patch our __start-custom__.js to handle different cases depending on what the importing app was built on. We don't want to modify the imported files; that's done at runtime for future compatability and not having to run migrations. + * Further, we can still optimize this with running the imports server-side with NextJS, but not a priority right now since it's fast. + */ + +// Create the Supabase client +const supabase = createSupabaseBrowserClient() + +export const useSpacePackZipFileUpload = (spaceId: number) => { + const [uploading, setUploading] = useState(false) // State to manage the upload progress + const [createSpacePack, { data: createdSpacePack }] = + useCreateSpacePackMutation() // Mutation for creating spacePack + const localUser = useAppSelector(selectLocalUser) + + const handleSpacePackZipFileUpload = async (file: File) => { + try { + if (!localUser) { + throw new Error('User not logged in') + } + + setUploading(true) + + // Step 1: Create a spacePack in the database + const spacePackData = await createSpacePack({ + display_name: file.name, + data: {}, + space_id: spaceId + }).unwrap() + + if (!spacePackData?.id) { + throw new Error('Failed to retrieve spacePack ID') + } + + const spacePackId = spacePackData.id // Get the newly created spacePack ID + + // Step 2: Read the file as an ArrayBuffer + const arrayBuffer = await file.arrayBuffer() + + // Step 3: Proceed with unzipping and processing the file using the spacePackId + // await processZipFile(arrayBuffer, spacePackId, assetPrefix, scriptPrefix); + const zip = await JSZip.loadAsync(arrayBuffer) + + // Modify the files in the ZIP + // await modifyZipFiles(zip, assetPrefix, scriptPrefix); + + // Upload the files to Supabase Storage + await uploadZipToSupabase(zip, spacePackId) + + setUploading(false) + } catch (error) { + console.error('Error uploading and modifying file:', error) + setUploading(false) + } + } + + return { uploading, handlePCZipFileUpload: handleSpacePackZipFileUpload } +} + +// Function to modify files +export const modifySettingsFileFromSupabase = async ( + settingsFileUrl: string, + assetPrefix: string, + scriptPrefix: string, + configFilenameUrl: string +) => { + try { + // Fetch the settings file from the Supabase public URL + const response = await fetch(settingsFileUrl) + + if (!response.ok) { + throw new Error( + `Failed to fetch settings file from Supabase: ${response.statusText}` + ) + } + + const content = await response.text() + + // Perform replacements + const modifiedContent = content + .replace( + /window\.ASSET_PREFIX\s*=\s*".*?"/g, + `window.ASSET_PREFIX = "${assetPrefix}"` + ) + .replace( + /window\.SCRIPT_PREFIX\s*=\s*".*?"/g, + `window.SCRIPT_PREFIX = "${scriptPrefix}"` + ) + .replace( + /window\.SCENE_PATH\s*=\s*"(?:.*\/)?(\d+\.json)"/g, + 'window.SCENE_PATH = "$1"' + ) + .replace( + /'powerPreference'\s*:\s*".*?"/g, + '\'powerPreference\': "high-performance"' + ) + .replace( + /window\.CONFIG_FILENAME\s*=\s*".*?"/g, + `window.CONFIG_FILENAME = "${configFilenameUrl}"` + ) + + // Use or return the modified content (you can upload it back to Supabase or serve it as needed) + console.log('Modified content:', modifiedContent) + + // If you need to save the modified file back to Supabase or another location, you can use the appropriate API. + return modifiedContent + } catch (error) { + console.error('Error modifying settings file:', error) + throw error + } +} + +// Function to upload files to Supabase Storage +const uploadZipToSupabase = async (zip: JSZip, spacePackId: number) => { + // Get the authenticated user + const { + data: { user } + } = await supabase.auth.getUser() + + if (!user) { + throw new Error('User not authenticated') + } + + // Generate a list of files to upload + const files: any[] = [] + zip.forEach((relativePath, file) => { + files.push({ relativePath, file }) + }) + + // Upload each file to Supabase Storage + for (const { relativePath, file } of files) { + if (!file.dir) { + const fileData = await file.async('blob') + const path = `${user.id}/${spacePackId}/${relativePath}` + const { error } = await supabase.storage + .from(SPACE_PACKS_BUCKET_NAME) + .upload(path, fileData, { + upsert: true + }) + + if (error) { + console.error(`Failed to upload ${relativePath}:`, error) + throw new Error(error.message) + } + } + } +} + +export function getASSET_PREFIXForLoadingEngineApp( + userId: string, + spacePackId: string +) { + return `${userId}/${spacePackId}` +} + +export function getSCRIPT_PREFIXForLoadingEngineApp( + userId: string, + spacePackId: string +) { + return `${userId}/${spacePackId}/` +} + +export function getBrowserScriptTagUrlForLoadingScriptsFromStorage( + userId: string, + spacePackId: string +) { + return `/${userId}/${spacePackId}` +} diff --git a/mirror-2/utils/supabase/check-env-vars.ts b/mirror-2/utils/supabase/check-env-vars.ts new file mode 100644 index 00000000..d2a83c54 --- /dev/null +++ b/mirror-2/utils/supabase/check-env-vars.ts @@ -0,0 +1,6 @@ +// This check can be removed +// it is just for tutorial purposes + +export const hasEnvVars = + process.env.NEXT_PUBLIC_SUPABASE_URL && + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY diff --git a/mirror-2/utils/supabase/client.ts b/mirror-2/utils/supabase/client.ts new file mode 100644 index 00000000..2ed06482 --- /dev/null +++ b/mirror-2/utils/supabase/client.ts @@ -0,0 +1,9 @@ +'use client' +import { Database } from '@/utils/database.types' +import { createBrowserClient } from '@supabase/ssr' + +export const createSupabaseBrowserClient = () => + createBrowserClient( + process.env.NEXT_PUBLIC_SUPABASE_URL!, + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! + ) diff --git a/mirror-2/utils/supabase/middleware.ts b/mirror-2/utils/supabase/middleware.ts new file mode 100644 index 00000000..004025cd --- /dev/null +++ b/mirror-2/utils/supabase/middleware.ts @@ -0,0 +1,62 @@ +import { createServerClient } from '@supabase/ssr' +import { type NextRequest, NextResponse } from 'next/server' + +export const updateSession = async (request: NextRequest) => { + // This `try/catch` block is only here for the interactive tutorial. + // Feel free to remove once you have Supabase connected. + try { + // Create an unmodified response + let response = NextResponse.next({ + request: { + headers: request.headers + } + }) + + const supabase = createServerClient( + process.env.NEXT_PUBLIC_SUPABASE_URL!, + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + { + cookies: { + getAll() { + return request.cookies.getAll() + }, + setAll(cookiesToSet) { + cookiesToSet.forEach(({ name, value }) => + request.cookies.set(name, value) + ) + response = NextResponse.next({ + request + }) + cookiesToSet.forEach(({ name, value, options }) => + response.cookies.set(name, value, options) + ) + } + } + } + ) + + // This will refresh session if expired - required for Server Components + // https://supabase.com/docs/guides/auth/server-side/nextjs + const user = await supabase.auth.getUser() + + // protected routes + if (request.nextUrl.pathname.startsWith('/protected') && user.error) { + return NextResponse.redirect(new URL('/login', request.url)) + } + + if (request.nextUrl.pathname === '/' && !user.error) { + return NextResponse.redirect(new URL('/protected', request.url)) + } + + return response + } catch (e) { + // If you are here, a Supabase client could not be created! + // This is likely because you have not set up environment variables. + // Check out http://localhost:3000 for Next Steps. + return NextResponse.next({ + request: { + headers: request.headers + } + }) + } +} diff --git a/mirror-2/utils/supabase/server.ts b/mirror-2/utils/supabase/server.ts new file mode 100644 index 00000000..5d4f6737 --- /dev/null +++ b/mirror-2/utils/supabase/server.ts @@ -0,0 +1,29 @@ +import { createServerClient as createSupabaseServerClient } from '@supabase/ssr' +import { cookies } from 'next/headers' + +export const createServerClient = () => { + const cookieStore = cookies() + + return createSupabaseServerClient( + process.env.NEXT_PUBLIC_SUPABASE_URL!, + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, + { + cookies: { + getAll() { + return cookieStore.getAll() + }, + setAll(cookiesToSet) { + try { + cookiesToSet.forEach(({ name, value, options }) => { + cookieStore.set(name, value, options) + }) + } catch (error) { + // The `set` method was called from a Server Component. + // This can be ignored if you have middleware refreshing + // user sessions. + } + } + } + } + ) +} diff --git a/mirror-2/utils/utils.ts b/mirror-2/utils/utils.ts new file mode 100644 index 00000000..c08a79ee --- /dev/null +++ b/mirror-2/utils/utils.ts @@ -0,0 +1,16 @@ +import { redirect } from 'next/navigation' + +/** + * Redirects to a specified path with an encoded message as a query parameter. + * @param {('error' | 'success')} type - The type of message, either 'error' or 'success'. + * @param {string} path - The path to redirect to. + * @param {string} message - The message to be encoded and added as a query parameter. + * @returns {never} This function doesn't return as it triggers a redirect. + */ +export function encodedRedirect( + type: 'error' | 'success', + path: string, + message: string +) { + return redirect(`${path}?${type}=${encodeURIComponent(message)}`) +} diff --git a/mirror-2/yarn.lock b/mirror-2/yarn.lock new file mode 100644 index 00000000..be5ee412 --- /dev/null +++ b/mirror-2/yarn.lock @@ -0,0 +1,4509 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@alloc/quick-lru@^5.2.0": + version "5.2.0" + resolved "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz" + integrity sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw== + +"@amplitude/analytics-browser@^2.11.7": + version "2.11.7" + resolved "https://registry.npmjs.org/@amplitude/analytics-browser/-/analytics-browser-2.11.7.tgz" + integrity sha512-tbBeMA2n1JQJlHGEa1LQ7XrSGPM4YKrNdFKV+gDCzqOixx4wBwwYCxN33lVwCpJvCPAjtYonkAO2dq9d78U7Pw== + dependencies: + "@amplitude/analytics-client-common" "^2.3.3" + "@amplitude/analytics-core" "^2.5.2" + "@amplitude/analytics-remote-config" "^0.4.0" + "@amplitude/analytics-types" "^2.8.2" + "@amplitude/plugin-autocapture-browser" "^1.0.2" + "@amplitude/plugin-page-view-tracking-browser" "^2.3.3" + tslib "^2.4.1" + +"@amplitude/analytics-client-common@>=1 <3", "@amplitude/analytics-client-common@^2.3.3": + version "2.3.3" + resolved "https://registry.npmjs.org/@amplitude/analytics-client-common/-/analytics-client-common-2.3.3.tgz" + integrity sha512-HOvD2A8DH0y2LATrQ0AhFSOCk6yZayebu4+UsEBT76Q7EEYtnc59WMCRRIi5Zv6OqHpOvABumF7g3HmL6ehTYA== + dependencies: + "@amplitude/analytics-connector" "^1.4.8" + "@amplitude/analytics-core" "^2.5.2" + "@amplitude/analytics-types" "^2.8.2" + tslib "^2.4.1" + +"@amplitude/analytics-connector@^1.4.8": + version "1.5.0" + resolved "https://registry.npmjs.org/@amplitude/analytics-connector/-/analytics-connector-1.5.0.tgz" + integrity sha512-T8mOYzB9RRxckzhL0NTHwdge9xuFxXEOplC8B1Y3UX3NHa3BLh7DlBUZlCOwQgMc2nxDfnSweDL5S3bhC+W90g== + +"@amplitude/analytics-core@>=1 <3", "@amplitude/analytics-core@^2.5.2": + version "2.5.2" + resolved "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-2.5.2.tgz" + integrity sha512-4ojYUL7LA+qrlaz1n1nxpsbpgS1k6DOrQ3fBiQOuDJE8Av0aZfylDksFPnZvD1+MMdIm/ONkVAYfEaW3x/uH3Q== + dependencies: + "@amplitude/analytics-types" "^2.8.2" + tslib "^2.4.1" + +"@amplitude/analytics-remote-config@^0.4.0", "@amplitude/analytics-remote-config@^0.4.1": + version "0.4.1" + resolved "https://registry.npmjs.org/@amplitude/analytics-remote-config/-/analytics-remote-config-0.4.1.tgz" + integrity sha512-BYl6kQ9qjztrCACsugpxO+foLaQIC0aSEzoXEAb/gwOzInmqkyyI+Ub+aWTBih4xgB/lhWlOcidWHAmNiTJTNw== + dependencies: + "@amplitude/analytics-client-common" ">=1 <3" + "@amplitude/analytics-core" ">=1 <3" + "@amplitude/analytics-types" ">=1 <3" + tslib "^2.4.1" + +"@amplitude/analytics-types@>=1 <3", "@amplitude/analytics-types@^2.8.2": + version "2.8.2" + resolved "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-2.8.2.tgz" + integrity sha512-SWFXIMxhFm1/k3PUvxvYLY1iwzS28yd9A6pa5pEnrbaAZwM+E/24ucxs59VGp1N5qlIsvF0aVGSoKzN4ydh4eA== + +"@amplitude/plugin-autocapture-browser@^1.0.2": + version "1.0.3" + resolved "https://registry.npmjs.org/@amplitude/plugin-autocapture-browser/-/plugin-autocapture-browser-1.0.3.tgz" + integrity sha512-XUQWUAw9VqtJPlmOyWjnhsEspyVakd9LuSjVNtLjhwlWv+f/yZM1AAQVUdq/Os1+b5OptSgJQ2pPfRJJHZDXTw== + dependencies: + "@amplitude/analytics-client-common" ">=1 <3" + "@amplitude/analytics-types" "^2.8.2" + rxjs "^7.8.1" + tslib "^2.4.1" + +"@amplitude/plugin-page-view-tracking-browser@^2.3.3": + version "2.3.3" + resolved "https://registry.npmjs.org/@amplitude/plugin-page-view-tracking-browser/-/plugin-page-view-tracking-browser-2.3.3.tgz" + integrity sha512-tGDt7aU/okGHH38sxZvBckRXBw2btkw+wJz/PmIFIQdD7/7EMVnTtXgZJTokE+fqfxCx79F2ojEHp37xgVSxpg== + dependencies: + "@amplitude/analytics-client-common" "^2.3.3" + "@amplitude/analytics-types" "^2.8.2" + tslib "^2.4.1" + +"@amplitude/plugin-session-replay-browser@^1.8.0": + version "1.8.0" + resolved "https://registry.npmjs.org/@amplitude/plugin-session-replay-browser/-/plugin-session-replay-browser-1.8.0.tgz" + integrity sha512-MYqVSP9y9Sx14Qn5mzOiko7y8t0v0uDFbtREWDIh2JEpuj+VZnqRnsNCkpuKyoycbOEeO8DCdehTtuNrl0nqoA== + dependencies: + "@amplitude/analytics-client-common" ">=1 <3" + "@amplitude/analytics-core" ">=1 <3" + "@amplitude/analytics-types" ">=1 <3" + "@amplitude/session-replay-browser" "^1.15.0" + idb-keyval "^6.2.1" + tslib "^2.4.1" + +"@amplitude/rrdom@^2.0.0-alpha.21": + version "2.0.0-alpha.21" + resolved "https://registry.npmjs.org/@amplitude/rrdom/-/rrdom-2.0.0-alpha.21.tgz" + integrity sha512-o6mPzNd8BgmiRDFaKB4fz4E2v3TL5+CzioD9mjrA167vurgFD9kak6d9s9DDxy+gVvRXoQ8bf3myyZLzPNVg4Q== + dependencies: + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.21" + +"@amplitude/rrweb-snapshot@^2.0.0-alpha.21": + version "2.0.0-alpha.21" + resolved "https://registry.npmjs.org/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.21.tgz" + integrity sha512-7zVdfdItDk6cFeYr3sMn1JypAAFDbEjb26G7PgoJHqWE6avMhtYdW3gxAlvRX4DTR3cLw/8rd31jHIZpDKFOgg== + +"@amplitude/rrweb-types@^2.0.0-alpha.21": + version "2.0.0-alpha.21" + resolved "https://registry.npmjs.org/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.21.tgz" + integrity sha512-y6iuwJBdtTPgcrsf7T13LVhpWtuJp8yscXGU/FXyHMpGzXLRjKxos/3hNVZ6hKAYV3kiVInED4JIViqmaXOdcQ== + dependencies: + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.21" + +"@amplitude/rrweb@2.0.0-alpha.21": + version "2.0.0-alpha.21" + resolved "https://registry.npmjs.org/@amplitude/rrweb/-/rrweb-2.0.0-alpha.21.tgz" + integrity sha512-Ry5J4U7jBcqG2i7cXwo9v1JSQqh0wh4nTRKOgIxM3vXvNti1hzS88I4nsCjrytm8aaCTNB6SCVa3n+yrGE3b8A== + dependencies: + "@amplitude/rrdom" "^2.0.0-alpha.21" + "@amplitude/rrweb-snapshot" "^2.0.0-alpha.21" + "@amplitude/rrweb-types" "^2.0.0-alpha.21" + "@types/css-font-loading-module" "0.0.7" + "@xstate/fsm" "^1.4.0" + base64-arraybuffer "^1.0.1" + fflate "^0.4.4" + mitt "^3.0.0" + +"@amplitude/session-replay-browser@^1.15.0": + version "1.15.0" + resolved "https://registry.npmjs.org/@amplitude/session-replay-browser/-/session-replay-browser-1.15.0.tgz" + integrity sha512-66Y7iDu03NM3xYzzV2PAzG4TR3qU23hP1JJB/yJENXkLCVxrFQQ+32+8ZQJxokfso3lpN/COnYlv2qtTGJNB3Q== + dependencies: + "@amplitude/analytics-client-common" ">=1 <3" + "@amplitude/analytics-core" ">=1 <3" + "@amplitude/analytics-remote-config" "^0.4.1" + "@amplitude/analytics-types" ">=1 <3" + "@amplitude/rrweb" "2.0.0-alpha.21" + idb "^8.0.0" + tslib "^2.4.1" + +"@ant-design/colors@^7.0.0", "@ant-design/colors@^7.1.0": + version "7.1.0" + resolved "https://registry.npmjs.org/@ant-design/colors/-/colors-7.1.0.tgz" + integrity sha512-MMoDGWn1y9LdQJQSHiCC20x3uZ3CwQnv9QMz6pCmJOrqdgM9YxsoVVY0wtrdXbmfSgnV0KNk6zi09NAhMR2jvg== + dependencies: + "@ctrl/tinycolor" "^3.6.1" + +"@ant-design/cssinjs-utils@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@ant-design/cssinjs-utils/-/cssinjs-utils-1.1.0.tgz" + integrity sha512-E9nOWObXx7Dy7hdyuYlOFaer/LtPO7oyZVxZphh0CYEslr5EmhJPM3WI0Q2RBHRtYg6dSNqeSK73kvZjPN3IMQ== + dependencies: + "@ant-design/cssinjs" "^1.21.0" + "@babel/runtime" "^7.23.2" + rc-util "^5.38.0" + +"@ant-design/cssinjs@^1.21.0", "@ant-design/cssinjs@^1.21.1": + version "1.21.1" + resolved "https://registry.npmjs.org/@ant-design/cssinjs/-/cssinjs-1.21.1.tgz" + integrity sha512-tyWnlK+XH7Bumd0byfbCiZNK43HEubMoCcu9VxwsAwiHdHTgWa+tMN0/yvxa+e8EzuFP1WdUNNPclRpVtD33lg== + dependencies: + "@babel/runtime" "^7.11.1" + "@emotion/hash" "^0.8.0" + "@emotion/unitless" "^0.7.5" + classnames "^2.3.1" + csstype "^3.1.3" + rc-util "^5.35.0" + stylis "^4.3.3" + +"@ant-design/fast-color@^2.0.6": + version "2.0.6" + resolved "https://registry.npmjs.org/@ant-design/fast-color/-/fast-color-2.0.6.tgz" + integrity sha512-y2217gk4NqL35giHl72o6Zzqji9O7vHh9YmhUVkPtAOpoTCH4uWxo/pr4VE8t0+ChEPs0qo4eJRC5Q1eXWo3vA== + dependencies: + "@babel/runtime" "^7.24.7" + +"@ant-design/icons-svg@^4.4.0": + version "4.4.2" + resolved "https://registry.npmjs.org/@ant-design/icons-svg/-/icons-svg-4.4.2.tgz" + integrity sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA== + +"@ant-design/icons@^5.5.1": + version "5.5.1" + resolved "https://registry.npmjs.org/@ant-design/icons/-/icons-5.5.1.tgz" + integrity sha512-0UrM02MA2iDIgvLatWrj6YTCYe0F/cwXvVE0E2SqGrL7PZireQwgEKTKBisWpZyal5eXZLvuM98kju6YtYne8w== + dependencies: + "@ant-design/colors" "^7.0.0" + "@ant-design/icons-svg" "^4.4.0" + "@babel/runtime" "^7.24.8" + classnames "^2.2.6" + rc-util "^5.31.1" + +"@ant-design/react-slick@~1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@ant-design/react-slick/-/react-slick-1.1.2.tgz" + integrity sha512-EzlvzE6xQUBrZuuhSAFTdsr4P2bBBHGZwKFemEfq8gIGyIQCxalYfZW/T2ORbtQx5rU69o+WycP3exY/7T1hGA== + dependencies: + "@babel/runtime" "^7.10.4" + classnames "^2.2.5" + json2mq "^0.2.0" + resize-observer-polyfill "^1.5.1" + throttle-debounce "^5.0.0" + +"@aws-crypto/crc32@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/crc32/-/crc32-5.2.0.tgz#cfcc22570949c98c6689cfcbd2d693d36cdae2e1" + integrity sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg== + dependencies: + "@aws-crypto/util" "^5.2.0" + "@aws-sdk/types" "^3.222.0" + tslib "^2.6.2" + +"@aws-crypto/crc32c@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/crc32c/-/crc32c-5.2.0.tgz#4e34aab7f419307821509a98b9b08e84e0c1917e" + integrity sha512-+iWb8qaHLYKrNvGRbiYRHSdKRWhto5XlZUEBwDjYNf+ly5SVYG6zEoYIdxvf5R3zyeP16w4PLBn3rH1xc74Rag== + dependencies: + "@aws-crypto/util" "^5.2.0" + "@aws-sdk/types" "^3.222.0" + tslib "^2.6.2" + +"@aws-crypto/sha1-browser@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/sha1-browser/-/sha1-browser-5.2.0.tgz#b0ee2d2821d3861f017e965ef3b4cb38e3b6a0f4" + integrity sha512-OH6lveCFfcDjX4dbAvCFSYUjJZjDr/3XJ3xHtjn3Oj5b9RjojQo8npoLeA/bNwkOkrSQ0wgrHzXk4tDRxGKJeg== + dependencies: + "@aws-crypto/supports-web-crypto" "^5.2.0" + "@aws-crypto/util" "^5.2.0" + "@aws-sdk/types" "^3.222.0" + "@aws-sdk/util-locate-window" "^3.0.0" + "@smithy/util-utf8" "^2.0.0" + tslib "^2.6.2" + +"@aws-crypto/sha256-browser@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz#153895ef1dba6f9fce38af550e0ef58988eb649e" + integrity sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw== + dependencies: + "@aws-crypto/sha256-js" "^5.2.0" + "@aws-crypto/supports-web-crypto" "^5.2.0" + "@aws-crypto/util" "^5.2.0" + "@aws-sdk/types" "^3.222.0" + "@aws-sdk/util-locate-window" "^3.0.0" + "@smithy/util-utf8" "^2.0.0" + tslib "^2.6.2" + +"@aws-crypto/sha256-js@5.2.0", "@aws-crypto/sha256-js@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz#c4fdb773fdbed9a664fc1a95724e206cf3860042" + integrity sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA== + dependencies: + "@aws-crypto/util" "^5.2.0" + "@aws-sdk/types" "^3.222.0" + tslib "^2.6.2" + +"@aws-crypto/supports-web-crypto@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz#a1e399af29269be08e695109aa15da0a07b5b5fb" + integrity sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg== + dependencies: + tslib "^2.6.2" + +"@aws-crypto/util@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/util/-/util-5.2.0.tgz#71284c9cffe7927ddadac793c14f14886d3876da" + integrity sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ== + dependencies: + "@aws-sdk/types" "^3.222.0" + "@smithy/util-utf8" "^2.0.0" + tslib "^2.6.2" + +"@aws-sdk/client-s3@^3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-s3/-/client-s3-3.670.0.tgz#53e9ba24ee2dacb94bed9dfab50521108d3b6fa0" + integrity sha512-8Pwu1K+PgbYpXDaGKNy5hEbRH5FXHlfXJOhtV4oEDroL7ngix3ZUVWN9oIVVSDK02y1oQS1jCSEGUiUiauzb0g== + dependencies: + "@aws-crypto/sha1-browser" "5.2.0" + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/client-sso-oidc" "3.670.0" + "@aws-sdk/client-sts" "3.670.0" + "@aws-sdk/core" "3.667.0" + "@aws-sdk/credential-provider-node" "3.670.0" + "@aws-sdk/middleware-bucket-endpoint" "3.667.0" + "@aws-sdk/middleware-expect-continue" "3.667.0" + "@aws-sdk/middleware-flexible-checksums" "3.669.0" + "@aws-sdk/middleware-host-header" "3.667.0" + "@aws-sdk/middleware-location-constraint" "3.667.0" + "@aws-sdk/middleware-logger" "3.667.0" + "@aws-sdk/middleware-recursion-detection" "3.667.0" + "@aws-sdk/middleware-sdk-s3" "3.669.0" + "@aws-sdk/middleware-ssec" "3.667.0" + "@aws-sdk/middleware-user-agent" "3.669.0" + "@aws-sdk/region-config-resolver" "3.667.0" + "@aws-sdk/signature-v4-multi-region" "3.669.0" + "@aws-sdk/types" "3.667.0" + "@aws-sdk/util-endpoints" "3.667.0" + "@aws-sdk/util-user-agent-browser" "3.670.0" + "@aws-sdk/util-user-agent-node" "3.669.0" + "@aws-sdk/xml-builder" "3.662.0" + "@smithy/config-resolver" "^3.0.9" + "@smithy/core" "^2.4.8" + "@smithy/eventstream-serde-browser" "^3.0.10" + "@smithy/eventstream-serde-config-resolver" "^3.0.7" + "@smithy/eventstream-serde-node" "^3.0.9" + "@smithy/fetch-http-handler" "^3.2.9" + "@smithy/hash-blob-browser" "^3.1.6" + "@smithy/hash-node" "^3.0.7" + "@smithy/hash-stream-node" "^3.1.6" + "@smithy/invalid-dependency" "^3.0.7" + "@smithy/md5-js" "^3.0.7" + "@smithy/middleware-content-length" "^3.0.9" + "@smithy/middleware-endpoint" "^3.1.4" + "@smithy/middleware-retry" "^3.0.23" + "@smithy/middleware-serde" "^3.0.7" + "@smithy/middleware-stack" "^3.0.7" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/node-http-handler" "^3.2.4" + "@smithy/protocol-http" "^4.1.4" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/url-parser" "^3.0.7" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.23" + "@smithy/util-defaults-mode-node" "^3.0.23" + "@smithy/util-endpoints" "^2.1.3" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-retry" "^3.0.7" + "@smithy/util-stream" "^3.1.9" + "@smithy/util-utf8" "^3.0.0" + "@smithy/util-waiter" "^3.1.6" + tslib "^2.6.2" + +"@aws-sdk/client-sso-oidc@3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.670.0.tgz#9696dd19d6c0018fa398a6efd4aabbc97b22e1a7" + integrity sha512-4qDK2L36Q4J1lfemaHHd9ZxqKRaos3STp44qPAHf/8QyX6Uk5sXgZNVO2yWM7SIEtVKwwBh/fZAsdBkGPBfZcw== + dependencies: + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/core" "3.667.0" + "@aws-sdk/credential-provider-node" "3.670.0" + "@aws-sdk/middleware-host-header" "3.667.0" + "@aws-sdk/middleware-logger" "3.667.0" + "@aws-sdk/middleware-recursion-detection" "3.667.0" + "@aws-sdk/middleware-user-agent" "3.669.0" + "@aws-sdk/region-config-resolver" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@aws-sdk/util-endpoints" "3.667.0" + "@aws-sdk/util-user-agent-browser" "3.670.0" + "@aws-sdk/util-user-agent-node" "3.669.0" + "@smithy/config-resolver" "^3.0.9" + "@smithy/core" "^2.4.8" + "@smithy/fetch-http-handler" "^3.2.9" + "@smithy/hash-node" "^3.0.7" + "@smithy/invalid-dependency" "^3.0.7" + "@smithy/middleware-content-length" "^3.0.9" + "@smithy/middleware-endpoint" "^3.1.4" + "@smithy/middleware-retry" "^3.0.23" + "@smithy/middleware-serde" "^3.0.7" + "@smithy/middleware-stack" "^3.0.7" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/node-http-handler" "^3.2.4" + "@smithy/protocol-http" "^4.1.4" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/url-parser" "^3.0.7" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.23" + "@smithy/util-defaults-mode-node" "^3.0.23" + "@smithy/util-endpoints" "^2.1.3" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-retry" "^3.0.7" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/client-sso@3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.670.0.tgz#5e4cdaa60ace04fe3f4df0618d7ed558ce40abc3" + integrity sha512-J+oz6uSsDvk4pimMDnKJb1wsV216zTrejvMTIL4RhUD1QPIVVOpteTdUShcjZUIZnkcJZGI+cym/SFK0kuzTpg== + dependencies: + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/core" "3.667.0" + "@aws-sdk/middleware-host-header" "3.667.0" + "@aws-sdk/middleware-logger" "3.667.0" + "@aws-sdk/middleware-recursion-detection" "3.667.0" + "@aws-sdk/middleware-user-agent" "3.669.0" + "@aws-sdk/region-config-resolver" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@aws-sdk/util-endpoints" "3.667.0" + "@aws-sdk/util-user-agent-browser" "3.670.0" + "@aws-sdk/util-user-agent-node" "3.669.0" + "@smithy/config-resolver" "^3.0.9" + "@smithy/core" "^2.4.8" + "@smithy/fetch-http-handler" "^3.2.9" + "@smithy/hash-node" "^3.0.7" + "@smithy/invalid-dependency" "^3.0.7" + "@smithy/middleware-content-length" "^3.0.9" + "@smithy/middleware-endpoint" "^3.1.4" + "@smithy/middleware-retry" "^3.0.23" + "@smithy/middleware-serde" "^3.0.7" + "@smithy/middleware-stack" "^3.0.7" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/node-http-handler" "^3.2.4" + "@smithy/protocol-http" "^4.1.4" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/url-parser" "^3.0.7" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.23" + "@smithy/util-defaults-mode-node" "^3.0.23" + "@smithy/util-endpoints" "^2.1.3" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-retry" "^3.0.7" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/client-sts@3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sts/-/client-sts-3.670.0.tgz#fa90f49dafcd9e350f74b8eb22768f4e23814da7" + integrity sha512-bExrNo8ZVWorS3cjMZKQnA2HWqDmAzcZoSN/cPVoPFNkHwdl1lzPxvcLzmhpIr48JHgKfybBjrbluDZfIYeEog== + dependencies: + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/client-sso-oidc" "3.670.0" + "@aws-sdk/core" "3.667.0" + "@aws-sdk/credential-provider-node" "3.670.0" + "@aws-sdk/middleware-host-header" "3.667.0" + "@aws-sdk/middleware-logger" "3.667.0" + "@aws-sdk/middleware-recursion-detection" "3.667.0" + "@aws-sdk/middleware-user-agent" "3.669.0" + "@aws-sdk/region-config-resolver" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@aws-sdk/util-endpoints" "3.667.0" + "@aws-sdk/util-user-agent-browser" "3.670.0" + "@aws-sdk/util-user-agent-node" "3.669.0" + "@smithy/config-resolver" "^3.0.9" + "@smithy/core" "^2.4.8" + "@smithy/fetch-http-handler" "^3.2.9" + "@smithy/hash-node" "^3.0.7" + "@smithy/invalid-dependency" "^3.0.7" + "@smithy/middleware-content-length" "^3.0.9" + "@smithy/middleware-endpoint" "^3.1.4" + "@smithy/middleware-retry" "^3.0.23" + "@smithy/middleware-serde" "^3.0.7" + "@smithy/middleware-stack" "^3.0.7" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/node-http-handler" "^3.2.4" + "@smithy/protocol-http" "^4.1.4" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/url-parser" "^3.0.7" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.23" + "@smithy/util-defaults-mode-node" "^3.0.23" + "@smithy/util-endpoints" "^2.1.3" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-retry" "^3.0.7" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/core@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.667.0.tgz#ecf93bf8e3ebea3bd972576a67b87dd291d7a90a" + integrity sha512-pMcDVI7Tmdsc8R3sDv0Omj/4iRParGY+uJtAfF669WnZfDfaBQaix2Mq7+Mu08vdjqO9K3gicFvjk9S1VLmOKA== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/core" "^2.4.8" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/property-provider" "^3.1.7" + "@smithy/protocol-http" "^4.1.4" + "@smithy/signature-v4" "^4.2.0" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/util-middleware" "^3.0.7" + fast-xml-parser "4.4.1" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-env@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.667.0.tgz#1b3a4b049fc164a3a3eb3617f7448fed3cb3a2db" + integrity sha512-zZbrkkaPc54WXm+QAnpuv0LPNfsts0HPPd+oCECGs7IQRaFsGj187cwvPg9RMWDFZqpm64MdBDoA8OQHsqzYCw== + dependencies: + "@aws-sdk/core" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/property-provider" "^3.1.7" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-http@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.667.0.tgz#ff78b7f76715a7456976930bff6221dfac70afbc" + integrity sha512-sjtybFfERZWiqTY7fswBxKQLvUkiCucOWyqh3IaPo/4nE1PXRnaZCVG0+kRBPrYIxWqiVwytvZzMJy8sVZcG0A== + dependencies: + "@aws-sdk/core" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/fetch-http-handler" "^3.2.9" + "@smithy/node-http-handler" "^3.2.4" + "@smithy/property-provider" "^3.1.7" + "@smithy/protocol-http" "^4.1.4" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/util-stream" "^3.1.9" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-ini@3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.670.0.tgz#2157bc5fc0014ef3da72ac30b26df259a8443c83" + integrity sha512-TB1gacUj75leaTt2JsCTzygDSIk4ksv9uZoR7VenlgFPRktyOeT+fapwIVBeB2Qg7b9uxAY2K5XkKstDZyBEEw== + dependencies: + "@aws-sdk/core" "3.667.0" + "@aws-sdk/credential-provider-env" "3.667.0" + "@aws-sdk/credential-provider-http" "3.667.0" + "@aws-sdk/credential-provider-process" "3.667.0" + "@aws-sdk/credential-provider-sso" "3.670.0" + "@aws-sdk/credential-provider-web-identity" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/credential-provider-imds" "^3.2.4" + "@smithy/property-provider" "^3.1.7" + "@smithy/shared-ini-file-loader" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-node@3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.670.0.tgz#bf64e00d29db5ae758c518aa26c5f05e39b1d4e4" + integrity sha512-zwNrRYzubk4CaZ7zebeDhxsm8QtNWkbGKopZPOaZSnd5uqUGRcmx4ccVRngWUK68XDP44aEUWC8iU5Pc7btpHQ== + dependencies: + "@aws-sdk/credential-provider-env" "3.667.0" + "@aws-sdk/credential-provider-http" "3.667.0" + "@aws-sdk/credential-provider-ini" "3.670.0" + "@aws-sdk/credential-provider-process" "3.667.0" + "@aws-sdk/credential-provider-sso" "3.670.0" + "@aws-sdk/credential-provider-web-identity" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/credential-provider-imds" "^3.2.4" + "@smithy/property-provider" "^3.1.7" + "@smithy/shared-ini-file-loader" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-process@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.667.0.tgz#fa721b1b5b0024156c3852a9fc92c0ed9935959f" + integrity sha512-HZHnvop32fKgsNHkdhVaul7UzQ25sEc0j9yqA4bjhtbk0ECl42kj3f1pJ+ZU/YD9ut8lMJs/vVqiOdNThVdeBw== + dependencies: + "@aws-sdk/core" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/property-provider" "^3.1.7" + "@smithy/shared-ini-file-loader" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-sso@3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.670.0.tgz#04186708752f211592cbb5dd0ae674aac12799f1" + integrity sha512-5PkA8BOy4q57Vhe9AESoHKZ7vjRbElNPKjXA4qC01xY+DitClRFz4O3B9sMzFp0PHlz9nDVSXXKgq0yzF/nAag== + dependencies: + "@aws-sdk/client-sso" "3.670.0" + "@aws-sdk/core" "3.667.0" + "@aws-sdk/token-providers" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/property-provider" "^3.1.7" + "@smithy/shared-ini-file-loader" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-web-identity@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.667.0.tgz#439e3aa2fc9a081de53186f6d8aa78a8a6913769" + integrity sha512-t8CFlZMD/1p/8Cli3rvRiTJpjr/8BO64gw166AHgFZYSN2h95L2l1tcW0jpsc3PprA32nLg1iQVKYt4WGM4ugw== + dependencies: + "@aws-sdk/core" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/property-provider" "^3.1.7" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-bucket-endpoint@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.667.0.tgz#bd0a0a24f71d3709debf6e48f4e503547398e7eb" + integrity sha512-XGz4jMAkDoTyFdtLz7ZF+C05IAhCTC1PllpvTBaj821z/L0ilhbqVhrT/f2Buw8Id/K5A390csGXgusXyrFFjA== + dependencies: + "@aws-sdk/types" "3.667.0" + "@aws-sdk/util-arn-parser" "3.568.0" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + "@smithy/util-config-provider" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-expect-continue@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-expect-continue/-/middleware-expect-continue-3.667.0.tgz#d1b9e4871c8bde3402bdd0f73e740f5f5bf190d7" + integrity sha512-0TiSL9S5DSG95NHGIz6qTMuV7GDKVn8tvvGSrSSZu/wXO3JaYSH0AElVpYfc4PtPRqVpEyNA7nnc7W56mMCLWQ== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-flexible-checksums@3.669.0": + version "3.669.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.669.0.tgz#00566b4981a6b35d007815d05a5d0d3ee4f9e265" + integrity sha512-01UQLoUzVwWMf+b+AEuwJ2lluBD+Cp8AcbyEHqvEaPdjGKHIS4BCvnY70mZYnAfRtL8R2h9tt7iI61oWU3Gjkg== + dependencies: + "@aws-crypto/crc32" "5.2.0" + "@aws-crypto/crc32c" "5.2.0" + "@aws-sdk/core" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@smithy/is-array-buffer" "^3.0.0" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-host-header@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-host-header/-/middleware-host-header-3.667.0.tgz#d255aa6e73aec9a2d1a241de737679b6d2723c3f" + integrity sha512-Z7fIAMQnPegs7JjAQvlOeWXwpMRfegh5eCoIP6VLJIeR6DLfYKbP35JBtt98R6DXslrN2RsbTogjbxPEDQfw1w== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-location-constraint@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-location-constraint/-/middleware-location-constraint-3.667.0.tgz#e5da0580656a1a385fd5783bb93ea320b4baeb1b" + integrity sha512-ob85H3HhT3/u5O+x0o557xGZ78vSNeSSwMaSitxdsfs2hOuoUl1uk+OeLpi1hkuJnL41FPpokV7TVII2XrFfmg== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-logger@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-logger/-/middleware-logger-3.667.0.tgz#bf072a1aa5b03239e20d75f9b525d8a990caf29f" + integrity sha512-PtTRNpNm/5c746jRgZCNg4X9xEJIwggkGJrF0GP9AB1ANg4pc/sF2Fvn1NtqPe9wtQ2stunJprnm5WkCHN7QiA== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-recursion-detection@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.667.0.tgz#e3f158d5b5ea1b1d73ab280c0cbe5ef077ed3fdc" + integrity sha512-U5glWD3ehFohzpUpopLtmqAlDurGWo2wRGPNgi4SwhWU7UDt6LS7E/UvJjqC0CUrjlzOw+my2A+Ncf+fisMhxQ== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-sdk-s3@3.669.0": + version "3.669.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.669.0.tgz#421d89c19c513bb8c130cf8f0f40b68838a17a95" + integrity sha512-b2QUQ7DcIcVCUFhvmFEDI90BemvQhO0ntIajllLqQSy88PSNdLDCVx5mIzfxaaK/1tdY/UsEDRRm1kMQHJDQpg== + dependencies: + "@aws-sdk/core" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@aws-sdk/util-arn-parser" "3.568.0" + "@smithy/core" "^2.4.8" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/protocol-http" "^4.1.4" + "@smithy/signature-v4" "^4.2.0" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/util-config-provider" "^3.0.0" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-stream" "^3.1.9" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-ssec@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-ssec/-/middleware-ssec-3.667.0.tgz#19d510e4882c170eff33a5ced558781eee0ee716" + integrity sha512-1wuAUZIkmZIvOmGg5qNQU821CGFHhkuKioxXgNh0DpUxZ9+AeiV7yorJr+bqkb2KBFv1i1TnzGRecvKf/KvZIQ== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-user-agent@3.669.0": + version "3.669.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.669.0.tgz#a313a4f1fcc9cc77eef3e04573ce0edade931a26" + integrity sha512-K8ScPi45zjJrj5Y2gRqVsvKKQCQbvQBfYGcBw9ZOx9TTavH80bOCBjWg/GFnvs4f37tqVc1wMN2oGvcTF6HveQ== + dependencies: + "@aws-sdk/core" "3.667.0" + "@aws-sdk/types" "3.667.0" + "@aws-sdk/util-endpoints" "3.667.0" + "@smithy/core" "^2.4.8" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/region-config-resolver@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/region-config-resolver/-/region-config-resolver-3.667.0.tgz#1804103246e6b6c7586edc57d26801647d2972d8" + integrity sha512-iNr+JhhA902JMKHG9IwT9YdaEx6KGl6vjAL5BRNeOjfj4cZYMog6Lz/IlfOAltMtT0w88DAHDEFrBd2uO0l2eg== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/types" "^3.5.0" + "@smithy/util-config-provider" "^3.0.0" + "@smithy/util-middleware" "^3.0.7" + tslib "^2.6.2" + +"@aws-sdk/signature-v4-multi-region@3.669.0": + version "3.669.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.669.0.tgz#d5ed320cf39143af8f85462295975dab3b4bc285" + integrity sha512-TVwlWAxfBHnFjnfTBQWUhzVJzjwVhkq1+KR0JZV7JrfqeyBOdZjAaV9ie3VNY9HUouecq1fDuKaSwe4JiWQsHg== + dependencies: + "@aws-sdk/middleware-sdk-s3" "3.669.0" + "@aws-sdk/types" "3.667.0" + "@smithy/protocol-http" "^4.1.4" + "@smithy/signature-v4" "^4.2.0" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/token-providers@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.667.0.tgz#ea990ef364d6bd75f0ebcf19a22f9ccd0edb3c41" + integrity sha512-ZecJlG8p6D4UTYlBHwOWX6nknVtw/OBJ3yPXTSajBjhUlj9lE2xvejI8gl4rqkyLXk7z3bki+KR4tATbMaM9yg== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/property-provider" "^3.1.7" + "@smithy/shared-ini-file-loader" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/types@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.667.0.tgz#1b307c5af5a029ea1893f799fcfa122988f9d025" + integrity sha512-gYq0xCsqFfQaSL/yT1Gl1vIUjtsg7d7RhnUfsXaHt8xTxOKRTdH9GjbesBjXOzgOvB0W0vfssfreSNGFlOOMJg== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/types@^3.222.0": + version "3.664.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.664.0.tgz#e6de1c0a2cdfe4f1e43271223dc0b55e613ced58" + integrity sha512-+GtXktvVgpreM2b+NJL9OqZGsOzHwlCUrO8jgQUvH/yA6Kd8QO2YFhQCp0C9sSzTteZJVqGBu8E0CQurxJHPbw== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/util-arn-parser@3.568.0": + version "3.568.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-arn-parser/-/util-arn-parser-3.568.0.tgz#6a19a8c6bbaa520b6be1c278b2b8c17875b91527" + integrity sha512-XUKJWWo+KOB7fbnPP0+g/o5Ulku/X53t7i/h+sPHr5xxYTJJ9CYnbToo95mzxe7xWvkLrsNtJ8L+MnNn9INs2w== + dependencies: + tslib "^2.6.2" + +"@aws-sdk/util-endpoints@3.667.0": + version "3.667.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-endpoints/-/util-endpoints-3.667.0.tgz#c880fbc3bda5a11eec81e4ac5f95a256f8dbb24e" + integrity sha512-X22SYDAuQJWnkF1/q17pkX3nGw5XMD9YEUbmt87vUnRq7iyJ3JOpl6UKOBeUBaL838wA5yzdbinmCITJ/VZ1QA== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/types" "^3.5.0" + "@smithy/util-endpoints" "^2.1.3" + tslib "^2.6.2" + +"@aws-sdk/util-locate-window@^3.0.0": + version "3.568.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-locate-window/-/util-locate-window-3.568.0.tgz#2acc4b2236af0d7494f7e517401ba6b3c4af11ff" + integrity sha512-3nh4TINkXYr+H41QaPelCceEB2FXP3fxp93YZXB/kqJvX0U9j0N0Uk45gvsjmEPzG8XxkPEeLIfT2I1M7A6Lig== + dependencies: + tslib "^2.6.2" + +"@aws-sdk/util-user-agent-browser@3.670.0": + version "3.670.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.670.0.tgz#44504d56d035beace4688db5b7e0c02230290f0e" + integrity sha512-iRynWWazqEcCKwGMcQcywKTDLdLvqts1Yx474U64I9OKQXXwhOwhXbF5CAPSRta86lkVNAVYJa/0Bsv45pNn1A== + dependencies: + "@aws-sdk/types" "3.667.0" + "@smithy/types" "^3.5.0" + bowser "^2.11.0" + tslib "^2.6.2" + +"@aws-sdk/util-user-agent-node@3.669.0": + version "3.669.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.669.0.tgz#e83e17d04c65fa2bec942c239b5ad9b02c22ebc1" + integrity sha512-9jxCYrgggy2xd44ZASqI7AMiRVaSiFp+06Kg8BQSU0ijKpBJlwcsqIS8pDT/n6LxuOw2eV5ipvM2C0r1iKzrGA== + dependencies: + "@aws-sdk/middleware-user-agent" "3.669.0" + "@aws-sdk/types" "3.667.0" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@aws-sdk/xml-builder@3.662.0": + version "3.662.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/xml-builder/-/xml-builder-3.662.0.tgz#6cbe5aea6205fd2280ec043189985240628d1cb2" + integrity sha512-ikLkXn0igUpnJu2mCZjklvmcDGWT9OaLRv3JyC/cRkTaaSrblPjPM7KKsltxdMTLQ+v7fjCN0TsJpxphMfaOPA== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@babel/runtime@^7.10.1", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.22.5", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.6", "@babel/runtime@^7.23.9", "@babel/runtime@^7.24.4", "@babel/runtime@^7.24.7", "@babel/runtime@^7.24.8", "@babel/runtime@^7.25.6", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7": + version "7.25.7" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz" + integrity sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w== + dependencies: + regenerator-runtime "^0.14.0" + +"@ctrl/tinycolor@^3.6.1": + version "3.6.1" + resolved "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz" + integrity sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA== + +"@discoveryjs/json-ext@0.5.7": + version "0.5.7" + resolved "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz" + integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== + +"@emotion/hash@^0.8.0": + version "0.8.0" + resolved "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz" + integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow== + +"@emotion/unitless@^0.7.5": + version "0.7.5" + resolved "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz" + integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== + +"@floating-ui/core@^1.6.0": + version "1.6.8" + resolved "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.8.tgz" + integrity sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA== + dependencies: + "@floating-ui/utils" "^0.2.8" + +"@floating-ui/dom@^1.0.0": + version "1.6.11" + resolved "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.11.tgz" + integrity sha512-qkMCxSR24v2vGkhYDo/UzxfJN3D4syqSjyuTFz6C7XcpU1pASPRieNI0Kj5VP3/503mOfYiGY891ugBX1GlABQ== + dependencies: + "@floating-ui/core" "^1.6.0" + "@floating-ui/utils" "^0.2.8" + +"@floating-ui/react-dom@^2.0.0": + version "2.1.2" + resolved "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.2.tgz" + integrity sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A== + dependencies: + "@floating-ui/dom" "^1.0.0" + +"@floating-ui/utils@^0.2.8": + version "0.2.8" + resolved "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.8.tgz" + integrity sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig== + +"@hookform/resolvers@^3.9.0": + version "3.9.0" + resolved "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.9.0.tgz" + integrity sha512-bU0Gr4EepJ/EQsH/IwEzYLsT/PEj5C0ynLQ4m+GSHS+xKH4TfSelhluTgOaoc4kA5s7eCsQbM4wvZLzELmWzUg== + +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + +"@jridgewell/gen-mapping@^0.3.2": + version "0.3.5" + resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.5.0" + resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@^0.3.24": + version "0.3.25" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@next/bundle-analyzer@^14.2.13": + version "14.2.15" + resolved "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-14.2.15.tgz" + integrity sha512-W6iyrp/3G7WbIztDcNt+owYX1iv37m9f4RJs0fa/Ayw4EDdjNPX6qKQrC7gBrESHV3FuchED+8R+CNiw1i78eQ== + dependencies: + webpack-bundle-analyzer "4.10.1" + +"@next/env@14.2.15": + version "14.2.15" + resolved "https://registry.npmjs.org/@next/env/-/env-14.2.15.tgz" + integrity sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ== + +"@next/swc-darwin-arm64@14.2.15": + version "14.2.15" + resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.15.tgz" + integrity sha512-Rvh7KU9hOUBnZ9TJ28n2Oa7dD9cvDBKua9IKx7cfQQ0GoYUwg9ig31O2oMwH3wm+pE3IkAQ67ZobPfEgurPZIA== + +"@next/swc-darwin-x64@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.15.tgz#b7baeedc6a28f7545ad2bc55adbab25f7b45cb89" + integrity sha512-5TGyjFcf8ampZP3e+FyCax5zFVHi+Oe7sZyaKOngsqyaNEpOgkKB3sqmymkZfowy3ufGA/tUgDPPxpQx931lHg== + +"@next/swc-linux-arm64-gnu@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.15.tgz#fa13c59d3222f70fb4cb3544ac750db2c6e34d02" + integrity sha512-3Bwv4oc08ONiQ3FiOLKT72Q+ndEMyLNsc/D3qnLMbtUYTQAmkx9E/JRu0DBpHxNddBmNT5hxz1mYBphJ3mfrrw== + +"@next/swc-linux-arm64-musl@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.15.tgz#30e45b71831d9a6d6d18d7ac7d611a8d646a17f9" + integrity sha512-k5xf/tg1FBv/M4CMd8S+JL3uV9BnnRmoe7F+GWC3DxkTCD9aewFRH1s5rJ1zkzDa+Do4zyN8qD0N8c84Hu96FQ== + +"@next/swc-linux-x64-gnu@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.15.tgz#5065db17fc86f935ad117483f21f812dc1b39254" + integrity sha512-kE6q38hbrRbKEkkVn62reLXhThLRh6/TvgSP56GkFNhU22TbIrQDEMrO7j0IcQHcew2wfykq8lZyHFabz0oBrA== + +"@next/swc-linux-x64-musl@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.15.tgz#3c4a4568d8be7373a820f7576cf33388b5dab47e" + integrity sha512-PZ5YE9ouy/IdO7QVJeIcyLn/Rc4ml9M2G4y3kCM9MNf1YKvFY4heg3pVa/jQbMro+tP6yc4G2o9LjAz1zxD7tQ== + +"@next/swc-win32-arm64-msvc@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.15.tgz#fb812cc4ca0042868e32a6a021da91943bb08b98" + integrity sha512-2raR16703kBvYEQD9HNLyb0/394yfqzmIeyp2nDzcPV4yPjqNUG3ohX6jX00WryXz6s1FXpVhsCo3i+g4RUX+g== + +"@next/swc-win32-ia32-msvc@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.15.tgz#ec26e6169354f8ced240c1427be7fd485c5df898" + integrity sha512-fyTE8cklgkyR1p03kJa5zXEaZ9El+kDNM5A+66+8evQS5e/6v0Gk28LqA0Jet8gKSOyP+OTm/tJHzMlGdQerdQ== + +"@next/swc-win32-x64-msvc@14.2.15": + version "14.2.15" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.15.tgz#18d68697002b282006771f8d92d79ade9efd35c4" + integrity sha512-SzqGbsLsP9OwKNUG9nekShTwhj6JSB9ZLMWQ8g1gG6hdE5gQLncbnbymrwy2yVmH9nikSLYRYxYMFu78Ggp7/g== + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + +"@polka/url@^1.0.0-next.24": + version "1.0.0-next.28" + resolved "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz" + integrity sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw== + +"@radix-ui/number@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.0.tgz" + integrity sha512-V3gRzhVNU1ldS5XhAPTom1fOIo4ccrjjJgmE+LI2h/WaFpHmx0MQApT+KZHnx8abG6Avtfcz4WoEciMnpFT3HQ== + +"@radix-ui/primitive@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.0.1.tgz" + integrity sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw== + dependencies: + "@babel/runtime" "^7.13.10" + +"@radix-ui/primitive@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz" + integrity sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA== + +"@radix-ui/react-arrow@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz" + integrity sha512-FmlW1rCg7hBpEBwFbjHwCW6AmWLQM6g/v0Sn8XbP9NvmSZ2San1FpQeyPtufzOMSIx7Y4dzjlHoifhp+7NkZhw== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + +"@radix-ui/react-checkbox@^1.1.1": + version "1.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.1.2.tgz" + integrity sha512-/i0fl686zaJbDQLNKrkCbMyDm6FQMt4jg323k7HuqitoANm9sE23Ql8yOK3Wusk34HSLKDChhMux05FnP6KUkw== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-presence" "1.1.1" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + "@radix-ui/react-use-previous" "1.1.0" + "@radix-ui/react-use-size" "1.1.0" + +"@radix-ui/react-collection@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.0.tgz" + integrity sha512-GZsZslMJEyo1VKm5L1ZJY8tGDxZNPAoUeQUIbKeJfoi7Q4kmig5AsgLMYYuyYbfjd8fBmFORAIwYAkXMnXZgZw== + dependencies: + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-slot" "1.1.0" + +"@radix-ui/react-compose-refs@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.0.1.tgz" + integrity sha512-fDSBgd44FKHa1FRMU59qBMPFcl2PZE+2nmqunj+BWFyYYjnhIDWL2ItDs3rrbJDQOtzt5nIebLCQc4QRfz6LJw== + dependencies: + "@babel/runtime" "^7.13.10" + +"@radix-ui/react-compose-refs@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz" + integrity sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw== + +"@radix-ui/react-context-menu@^2.2.2": + version "2.2.2" + resolved "https://registry.npmjs.org/@radix-ui/react-context-menu/-/react-context-menu-2.2.2.tgz" + integrity sha512-99EatSTpW+hRYHt7m8wdDlLtkmTovEe8Z/hnxUPV+SKuuNL5HWNhQI4QSdjZqNSgXHay2z4M3Dym73j9p2Gx5Q== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-menu" "2.1.2" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + +"@radix-ui/react-context@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.0.1.tgz" + integrity sha512-ebbrdFoYTcuZ0v4wG5tedGnp9tzcV8awzsxYph7gXUyvnNLuTIcCk1q17JEbnVhXAKG9oX3KtchwiMIAYp9NLg== + dependencies: + "@babel/runtime" "^7.13.10" + +"@radix-ui/react-context@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz" + integrity sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A== + +"@radix-ui/react-context@1.1.1": + version "1.1.1" + resolved "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz" + integrity sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q== + +"@radix-ui/react-dialog@1.0.5": + version "1.0.5" + resolved "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.5.tgz" + integrity sha512-GjWJX/AUpB703eEBanuBnIWdIXg6NvJFCXcNlSZk4xdszCdhrJgBoUd1cGk67vFO+WdA2pfI/plOpqz/5GUP6Q== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/primitive" "1.0.1" + "@radix-ui/react-compose-refs" "1.0.1" + "@radix-ui/react-context" "1.0.1" + "@radix-ui/react-dismissable-layer" "1.0.5" + "@radix-ui/react-focus-guards" "1.0.1" + "@radix-ui/react-focus-scope" "1.0.4" + "@radix-ui/react-id" "1.0.1" + "@radix-ui/react-portal" "1.0.4" + "@radix-ui/react-presence" "1.0.1" + "@radix-ui/react-primitive" "1.0.3" + "@radix-ui/react-slot" "1.0.2" + "@radix-ui/react-use-controllable-state" "1.0.1" + aria-hidden "^1.1.1" + react-remove-scroll "2.5.5" + +"@radix-ui/react-dialog@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.2.tgz" + integrity sha512-Yj4dZtqa2o+kG61fzB0H2qUvmwBA2oyQroGLyNtBj1beo1khoQ3q1a2AO8rrQYjd8256CO9+N8L9tvsS+bnIyA== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-dismissable-layer" "1.1.1" + "@radix-ui/react-focus-guards" "1.1.1" + "@radix-ui/react-focus-scope" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-portal" "1.1.2" + "@radix-ui/react-presence" "1.1.1" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-slot" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + aria-hidden "^1.1.1" + react-remove-scroll "2.6.0" + +"@radix-ui/react-direction@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.0.tgz" + integrity sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg== + +"@radix-ui/react-dismissable-layer@1.0.5": + version "1.0.5" + resolved "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.5.tgz" + integrity sha512-aJeDjQhywg9LBu2t/At58hCvr7pEm0o2Ke1x33B+MhjNmmZ17sy4KImo0KPLgsnc/zN7GPdce8Cnn0SWvwZO7g== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/primitive" "1.0.1" + "@radix-ui/react-compose-refs" "1.0.1" + "@radix-ui/react-primitive" "1.0.3" + "@radix-ui/react-use-callback-ref" "1.0.1" + "@radix-ui/react-use-escape-keydown" "1.0.3" + +"@radix-ui/react-dismissable-layer@1.1.1": + version "1.1.1" + resolved "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.1.tgz" + integrity sha512-QSxg29lfr/xcev6kSz7MAlmDnzbP1eI/Dwn3Tp1ip0KT5CUELsxkekFEMVBEoykI3oV39hKT4TKZzBNMbcTZYQ== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-escape-keydown" "1.1.0" + +"@radix-ui/react-dropdown-menu@^2.1.1": + version "2.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.2.tgz" + integrity sha512-GVZMR+eqK8/Kes0a36Qrv+i20bAPXSn8rCBTHx30w+3ECnR5o3xixAlqcVaYvLeyKUsm0aqyhWfmUcqufM8nYA== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-menu" "2.1.2" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + +"@radix-ui/react-focus-guards@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.0.1.tgz" + integrity sha512-Rect2dWbQ8waGzhMavsIbmSVCgYxkXLxxR3ZvCX79JOglzdEy4JXMb98lq4hPxUbLr77nP0UOGf4rcMU+s1pUA== + dependencies: + "@babel/runtime" "^7.13.10" + +"@radix-ui/react-focus-guards@1.1.1": + version "1.1.1" + resolved "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.1.tgz" + integrity sha512-pSIwfrT1a6sIoDASCSpFwOasEwKTZWDw/iBdtnqKO7v6FeOzYJ7U53cPzYFVR3geGGXgVHaH+CdngrrAzqUGxg== + +"@radix-ui/react-focus-scope@1.0.4": + version "1.0.4" + resolved "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.4.tgz" + integrity sha512-sL04Mgvf+FmyvZeYfNu1EPAaaxD+aw7cYeIB9L9Fvq8+urhltTRaEo5ysKOpHuKPclsZcSUMKlN05x4u+CINpA== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-compose-refs" "1.0.1" + "@radix-ui/react-primitive" "1.0.3" + "@radix-ui/react-use-callback-ref" "1.0.1" + +"@radix-ui/react-focus-scope@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.0.tgz" + integrity sha512-200UD8zylvEyL8Bx+z76RJnASR2gRMuxlgFCPAe/Q/679a/r0eK3MBVYMb7vZODZcffZBdob1EGnky78xmVvcA== + dependencies: + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + +"@radix-ui/react-id@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.0.1.tgz" + integrity sha512-tI7sT/kqYp8p96yGWY1OAnLHrqDgzHefRBKQ2YAkBS5ja7QLcZ9Z/uY7bEjPUatf8RomoXM8/1sMj1IJaE5UzQ== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-use-layout-effect" "1.0.1" + +"@radix-ui/react-id@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz" + integrity sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA== + dependencies: + "@radix-ui/react-use-layout-effect" "1.1.0" + +"@radix-ui/react-label@^2.1.0": + version "2.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.1.0.tgz" + integrity sha512-peLblDlFw/ngk3UWq0VnYaOLy6agTZZ+MUO/WhVfm14vJGML+xH4FAl2XQGLqdefjNb7ApRg6Yn7U42ZhmYXdw== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + +"@radix-ui/react-menu@2.1.2": + version "2.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.2.tgz" + integrity sha512-lZ0R4qR2Al6fZ4yCCZzu/ReTFrylHFxIqy7OezIpWF4bL0o9biKo0pFIvkaew3TyZ9Fy5gYVrR5zCGZBVbO1zg== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-collection" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-direction" "1.1.0" + "@radix-ui/react-dismissable-layer" "1.1.1" + "@radix-ui/react-focus-guards" "1.1.1" + "@radix-ui/react-focus-scope" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-popper" "1.2.0" + "@radix-ui/react-portal" "1.1.2" + "@radix-ui/react-presence" "1.1.1" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-roving-focus" "1.1.0" + "@radix-ui/react-slot" "1.1.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + aria-hidden "^1.1.1" + react-remove-scroll "2.6.0" + +"@radix-ui/react-menubar@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-menubar/-/react-menubar-1.1.2.tgz" + integrity sha512-cKmj5Gte7LVyuz+8gXinxZAZECQU+N7aq5pw7kUPpx3xjnDXDbsdzHtCCD2W72bwzy74AvrqdYnKYS42ueskUQ== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-collection" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-direction" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-menu" "2.1.2" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-roving-focus" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + +"@radix-ui/react-popover@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.1.2.tgz" + integrity sha512-u2HRUyWW+lOiA2g0Le0tMmT55FGOEWHwPFt1EPfbLly7uXQExFo5duNKqG2DzmFXIdqOeNd+TpE8baHWJCyP9w== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-dismissable-layer" "1.1.1" + "@radix-ui/react-focus-guards" "1.1.1" + "@radix-ui/react-focus-scope" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-popper" "1.2.0" + "@radix-ui/react-portal" "1.1.2" + "@radix-ui/react-presence" "1.1.1" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-slot" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + aria-hidden "^1.1.1" + react-remove-scroll "2.6.0" + +"@radix-ui/react-popper@1.2.0": + version "1.2.0" + resolved "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.0.tgz" + integrity sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg== + dependencies: + "@floating-ui/react-dom" "^2.0.0" + "@radix-ui/react-arrow" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + "@radix-ui/react-use-rect" "1.1.0" + "@radix-ui/react-use-size" "1.1.0" + "@radix-ui/rect" "1.1.0" + +"@radix-ui/react-portal@1.0.4": + version "1.0.4" + resolved "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.4.tgz" + integrity sha512-Qki+C/EuGUVCQTOTD5vzJzJuMUlewbzuKyUy+/iHM2uwGiru9gZeBJtHAPKAEkB5KWGi9mP/CHKcY0wt1aW45Q== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-primitive" "1.0.3" + +"@radix-ui/react-portal@1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.2.tgz" + integrity sha512-WeDYLGPxJb/5EGBoedyJbT0MpoULmwnIPMJMSldkuiMsBAv7N1cRdsTWZWht9vpPOiN3qyiGAtbK2is47/uMFg== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + +"@radix-ui/react-presence@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.0.1.tgz" + integrity sha512-UXLW4UAbIY5ZjcvzjfRFo5gxva8QirC9hF7wRE4U5gz+TP0DbRk+//qyuAQ1McDxBt1xNMBTaciFGvEmJvAZCg== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-compose-refs" "1.0.1" + "@radix-ui/react-use-layout-effect" "1.0.1" + +"@radix-ui/react-presence@1.1.1": + version "1.1.1" + resolved "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.1.tgz" + integrity sha512-IeFXVi4YS1K0wVZzXNrbaaUvIJ3qdY+/Ih4eHFhWA9SwGR9UDX7Ck8abvL57C4cv3wwMvUE0OG69Qc3NCcTe/A== + dependencies: + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + +"@radix-ui/react-primitive@1.0.3": + version "1.0.3" + resolved "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-1.0.3.tgz" + integrity sha512-yi58uVyoAcK/Nq1inRY56ZSjKypBNKTa/1mcL8qdl6oJeEaDbOldlzrGn7P6Q3Id5d+SYNGc5AJgc4vGhjs5+g== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-slot" "1.0.2" + +"@radix-ui/react-primitive@2.0.0": + version "2.0.0" + resolved "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz" + integrity sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw== + dependencies: + "@radix-ui/react-slot" "1.1.0" + +"@radix-ui/react-progress@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-progress/-/react-progress-1.1.0.tgz" + integrity sha512-aSzvnYpP725CROcxAOEBVZZSIQVQdHgBr2QQFKySsaD14u8dNT0batuXI+AAGDdAHfXH8rbnHmjYFqVJ21KkRg== + dependencies: + "@radix-ui/react-context" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + +"@radix-ui/react-roving-focus@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.0.tgz" + integrity sha512-EA6AMGeq9AEeQDeSH0aZgG198qkfHSbvWTf1HvoDmOB5bBG/qTxjYMWUKMnYiV6J/iP/J8MEFSuB2zRU2n7ODA== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-collection" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.0" + "@radix-ui/react-direction" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + +"@radix-ui/react-scroll-area@^1.2.0": + version "1.2.0" + resolved "https://registry.npmjs.org/@radix-ui/react-scroll-area/-/react-scroll-area-1.2.0.tgz" + integrity sha512-q2jMBdsJ9zB7QG6ngQNzNwlvxLQqONyL58QbEGwuyRZZb/ARQwk3uQVbCF7GvQVOtV6EU/pDxAw3zRzJZI3rpQ== + dependencies: + "@radix-ui/number" "1.1.0" + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-direction" "1.1.0" + "@radix-ui/react-presence" "1.1.1" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + +"@radix-ui/react-select@^2.1.2": + version "2.1.2" + resolved "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.1.2.tgz" + integrity sha512-rZJtWmorC7dFRi0owDmoijm6nSJH1tVw64QGiNIZ9PNLyBDtG+iAq+XGsya052At4BfarzY/Dhv9wrrUr6IMZA== + dependencies: + "@radix-ui/number" "1.1.0" + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-collection" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-direction" "1.1.0" + "@radix-ui/react-dismissable-layer" "1.1.1" + "@radix-ui/react-focus-guards" "1.1.1" + "@radix-ui/react-focus-scope" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-popper" "1.2.0" + "@radix-ui/react-portal" "1.1.2" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-slot" "1.1.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + "@radix-ui/react-use-previous" "1.1.0" + "@radix-ui/react-visually-hidden" "1.1.0" + aria-hidden "^1.1.1" + react-remove-scroll "2.6.0" + +"@radix-ui/react-separator@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.0.tgz" + integrity sha512-3uBAs+egzvJBDZAzvb/n4NxxOYpnspmWxO2u5NbZ8Y6FM/NdrGSF9bop3Cf6F6C71z1rTSn8KV0Fo2ZVd79lGA== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + +"@radix-ui/react-slot@1.0.2": + version "1.0.2" + resolved "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz" + integrity sha512-YeTpuq4deV+6DusvVUW4ivBgnkHwECUu0BiN43L5UCDFgdhsRUWAghhTF5MbvNTPzmiFOx90asDSUjWuCNapwg== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-compose-refs" "1.0.1" + +"@radix-ui/react-slot@1.1.0", "@radix-ui/react-slot@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz" + integrity sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw== + dependencies: + "@radix-ui/react-compose-refs" "1.1.0" + +"@radix-ui/react-tabs@^1.1.1": + version "1.1.1" + resolved "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.1.1.tgz" + integrity sha512-3GBUDmP2DvzmtYLMsHmpA1GtR46ZDZ+OreXM/N+kkQJOPIgytFWWTfDQmBQKBvaFS0Vno0FktdbVzN28KGrMdw== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-direction" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-presence" "1.1.1" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-roving-focus" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + +"@radix-ui/react-tooltip@^1.1.2": + version "1.1.3" + resolved "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.1.3.tgz" + integrity sha512-Z4w1FIS0BqVFI2c1jZvb/uDVJijJjJ2ZMuPV81oVgTZ7g3BZxobplnMVvXtFWgtozdvYJ+MFWtwkM5S2HnAong== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-dismissable-layer" "1.1.1" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-popper" "1.2.0" + "@radix-ui/react-portal" "1.1.2" + "@radix-ui/react-presence" "1.1.1" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-slot" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + "@radix-ui/react-visually-hidden" "1.1.0" + +"@radix-ui/react-use-callback-ref@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.0.1.tgz" + integrity sha512-D94LjX4Sp0xJFVaoQOd3OO9k7tpBYNOXdVhkltUbGv2Qb9OXdrg/CpsjlZv7ia14Sylv398LswWBVVu5nqKzAQ== + dependencies: + "@babel/runtime" "^7.13.10" + +"@radix-ui/react-use-callback-ref@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.0.tgz" + integrity sha512-CasTfvsy+frcFkbXtSJ2Zu9JHpN8TYKxkgJGWbjiZhFivxaeW7rMeZt7QELGVLaYVfFMsKHjb7Ak0nMEe+2Vfw== + +"@radix-ui/react-use-controllable-state@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.0.1.tgz" + integrity sha512-Svl5GY5FQeN758fWKrjM6Qb7asvXeiZltlT4U2gVfl8Gx5UAv2sMR0LWo8yhsIZh2oQ0eFdZ59aoOOMV7b47VA== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-use-callback-ref" "1.0.1" + +"@radix-ui/react-use-controllable-state@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz" + integrity sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw== + dependencies: + "@radix-ui/react-use-callback-ref" "1.1.0" + +"@radix-ui/react-use-escape-keydown@1.0.3": + version "1.0.3" + resolved "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.0.3.tgz" + integrity sha512-vyL82j40hcFicA+M4Ex7hVkB9vHgSse1ZWomAqV2Je3RleKGO5iM8KMOEtfoSB0PnIelMd2lATjTGMYqN5ylTg== + dependencies: + "@babel/runtime" "^7.13.10" + "@radix-ui/react-use-callback-ref" "1.0.1" + +"@radix-ui/react-use-escape-keydown@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz" + integrity sha512-L7vwWlR1kTTQ3oh7g1O0CBF3YCyyTj8NmhLR+phShpyA50HCfBFKVJTpshm9PzLiKmehsrQzTYTpX9HvmC9rhw== + dependencies: + "@radix-ui/react-use-callback-ref" "1.1.0" + +"@radix-ui/react-use-layout-effect@1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.0.1.tgz" + integrity sha512-v/5RegiJWYdoCvMnITBkNNx6bCj20fiaJnWtRkU18yITptraXjffz5Qbn05uOiQnOvi+dbkznkoaMltz1GnszQ== + dependencies: + "@babel/runtime" "^7.13.10" + +"@radix-ui/react-use-layout-effect@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.0.tgz" + integrity sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w== + +"@radix-ui/react-use-previous@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.0.tgz" + integrity sha512-Z/e78qg2YFnnXcW88A4JmTtm4ADckLno6F7OXotmkQfeuCVaKuYzqAATPhVzl3delXE7CxIV8shofPn3jPc5Og== + +"@radix-ui/react-use-rect@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.0.tgz" + integrity sha512-0Fmkebhr6PiseyZlYAOtLS+nb7jLmpqTrJyv61Pe68MKYW6OWdRE2kI70TaYY27u7H0lajqM3hSMMLFq18Z7nQ== + dependencies: + "@radix-ui/rect" "1.1.0" + +"@radix-ui/react-use-size@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.0.tgz" + integrity sha512-XW3/vWuIXHa+2Uwcc2ABSfcCledmXhhQPlGbfcRXbiUQI5Icjcg19BGCZVKKInYbvUCut/ufbbLLPFC5cbb1hw== + dependencies: + "@radix-ui/react-use-layout-effect" "1.1.0" + +"@radix-ui/react-visually-hidden@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.1.0.tgz" + integrity sha512-N8MDZqtgCgG5S3aV60INAB475osJousYpZ4cTJ2cFbMpdHS5Y6loLTH8LPtkj2QN0x93J30HT/M3qJXM0+lyeQ== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + +"@radix-ui/rect@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.0.tgz" + integrity sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg== + +"@rc-component/async-validator@^5.0.3": + version "5.0.4" + resolved "https://registry.npmjs.org/@rc-component/async-validator/-/async-validator-5.0.4.tgz" + integrity sha512-qgGdcVIF604M9EqjNF0hbUTz42bz/RDtxWdWuU5EQe3hi7M8ob54B6B35rOsvX5eSvIHIzT9iH1R3n+hk3CGfg== + dependencies: + "@babel/runtime" "^7.24.4" + +"@rc-component/color-picker@~2.0.1": + version "2.0.1" + resolved "https://registry.npmjs.org/@rc-component/color-picker/-/color-picker-2.0.1.tgz" + integrity sha512-WcZYwAThV/b2GISQ8F+7650r5ZZJ043E57aVBFkQ+kSY4C6wdofXgB0hBx+GPGpIU0Z81eETNoDUJMr7oy/P8Q== + dependencies: + "@ant-design/fast-color" "^2.0.6" + "@babel/runtime" "^7.23.6" + classnames "^2.2.6" + rc-util "^5.38.1" + +"@rc-component/context@^1.4.0": + version "1.4.0" + resolved "https://registry.npmjs.org/@rc-component/context/-/context-1.4.0.tgz" + integrity sha512-kFcNxg9oLRMoL3qki0OMxK+7g5mypjgaaJp/pkOis/6rVxma9nJBF/8kCIuTYHUQNr0ii7MxqE33wirPZLJQ2w== + dependencies: + "@babel/runtime" "^7.10.1" + rc-util "^5.27.0" + +"@rc-component/mini-decimal@^1.0.1": + version "1.1.0" + resolved "https://registry.npmjs.org/@rc-component/mini-decimal/-/mini-decimal-1.1.0.tgz" + integrity sha512-jS4E7T9Li2GuYwI6PyiVXmxTiM6b07rlD9Ge8uGZSCz3WlzcG5ZK7g5bbuKNeZ9pgUuPK/5guV781ujdVpm4HQ== + dependencies: + "@babel/runtime" "^7.18.0" + +"@rc-component/mutate-observer@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@rc-component/mutate-observer/-/mutate-observer-1.1.0.tgz" + integrity sha512-QjrOsDXQusNwGZPf4/qRQasg7UFEj06XiCJ8iuiq/Io7CrHrgVi6Uuetw60WAMG1799v+aM8kyc+1L/GBbHSlw== + dependencies: + "@babel/runtime" "^7.18.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/portal@^1.0.0-8", "@rc-component/portal@^1.0.0-9", "@rc-component/portal@^1.0.2", "@rc-component/portal@^1.1.0", "@rc-component/portal@^1.1.1": + version "1.1.2" + resolved "https://registry.npmjs.org/@rc-component/portal/-/portal-1.1.2.tgz" + integrity sha512-6f813C0IsasTZms08kfA8kPAGxbbkYToa8ALaiDIGGECU4i9hj8Plgbx0sNJDrey3EtHO30hmdaxtT0138xZcg== + dependencies: + "@babel/runtime" "^7.18.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/qrcode@~1.0.0": + version "1.0.0" + resolved "https://registry.npmjs.org/@rc-component/qrcode/-/qrcode-1.0.0.tgz" + integrity sha512-L+rZ4HXP2sJ1gHMGHjsg9jlYBX/SLN2D6OxP9Zn3qgtpMWtO2vUfxVFwiogHpAIqs54FnALxraUy/BCO1yRIgg== + dependencies: + "@babel/runtime" "^7.24.7" + classnames "^2.3.2" + rc-util "^5.38.0" + +"@rc-component/tour@~1.15.1": + version "1.15.1" + resolved "https://registry.npmjs.org/@rc-component/tour/-/tour-1.15.1.tgz" + integrity sha512-Tr2t7J1DKZUpfJuDZWHxyxWpfmj8EZrqSgyMZ+BCdvKZ6r1UDsfU46M/iWAAFBy961Ssfom2kv5f3UcjIL2CmQ== + dependencies: + "@babel/runtime" "^7.18.0" + "@rc-component/portal" "^1.0.0-9" + "@rc-component/trigger" "^2.0.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/trigger@^2.0.0", "@rc-component/trigger@^2.1.1", "@rc-component/trigger@^2.2.3": + version "2.2.3" + resolved "https://registry.npmjs.org/@rc-component/trigger/-/trigger-2.2.3.tgz" + integrity sha512-X1oFIpKoXAMXNDYCviOmTfuNuYxE4h5laBsyCqVAVMjNHxoF3/uiyA7XdegK1XbCvBbCZ6P6byWrEoDRpKL8+A== + dependencies: + "@babel/runtime" "^7.23.2" + "@rc-component/portal" "^1.1.0" + classnames "^2.3.2" + rc-motion "^2.0.0" + rc-resize-observer "^1.3.1" + rc-util "^5.38.0" + +"@react-hook/latest@^1.0.2": + version "1.0.3" + resolved "https://registry.npmjs.org/@react-hook/latest/-/latest-1.0.3.tgz" + integrity sha512-dy6duzl+JnAZcDbNTfmaP3xHiKtbXYOaz3G51MGVljh548Y8MWzTr+PHLOfvpypEVW9zwvl+VyKjbWKEVbV1Rg== + +"@react-hook/throttle@^2.2.0": + version "2.2.0" + resolved "https://registry.npmjs.org/@react-hook/throttle/-/throttle-2.2.0.tgz" + integrity sha512-LJ5eg+yMV8lXtqK3lR+OtOZ2WH/EfWvuiEEu0M3bhR7dZRfTyEJKxH1oK9uyBxiXPtWXiQggWbZirMCXam51tg== + dependencies: + "@react-hook/latest" "^1.0.2" + +"@reduxjs/toolkit@^2.2.7": + version "2.2.8" + resolved "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.8.tgz" + integrity sha512-eK/ieXftPRQfaBSmzsamXEyDwkntMTY0e9SG5ETsEOv5JIPKhu3mj992t6B8FJjlnSrZBAAqdT8oMkPe4j+P9g== + dependencies: + immer "^10.0.3" + redux "^5.0.1" + redux-thunk "^3.1.0" + reselect "^5.1.0" + +"@smithy/abort-controller@^3.1.5": + version "3.1.5" + resolved "https://registry.yarnpkg.com/@smithy/abort-controller/-/abort-controller-3.1.5.tgz#ca7a86a3c6b20fabe59667143f58d9e198616d14" + integrity sha512-DhNPnqTqPoG8aZ5dWkFOgsuY+i0GQ3CI6hMmvCoduNsnU9gUZWZBwGfDQsTTB7NvFPkom1df7jMIJWU90kuXXg== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/chunked-blob-reader-native@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/chunked-blob-reader-native/-/chunked-blob-reader-native-3.0.0.tgz#f1104b30030f76f9aadcbd3cdca4377bd1ba2695" + integrity sha512-VDkpCYW+peSuM4zJip5WDfqvg2Mo/e8yxOv3VF1m11y7B8KKMKVFtmZWDe36Fvk8rGuWrPZHHXZ7rR7uM5yWyg== + dependencies: + "@smithy/util-base64" "^3.0.0" + tslib "^2.6.2" + +"@smithy/chunked-blob-reader@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/chunked-blob-reader/-/chunked-blob-reader-3.0.0.tgz#e5d3b04e9b273ba8b7ede47461e2aa96c8aa49e0" + integrity sha512-sbnURCwjF0gSToGlsBiAmd1lRCmSn72nu9axfJu5lIx6RUEgHu6GwTMbqCdhQSi0Pumcm5vFxsi9XWXb2mTaoA== + dependencies: + tslib "^2.6.2" + +"@smithy/config-resolver@^3.0.9": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@smithy/config-resolver/-/config-resolver-3.0.9.tgz#dcf4b7747ca481866f9bfac21469ebe2031a599e" + integrity sha512-5d9oBf40qC7n2xUoHmntKLdqsyTMMo/r49+eqSIjJ73eDfEtljAxEhzIQ3bkgXJtR3xiv7YzMT/3FF3ORkjWdg== + dependencies: + "@smithy/node-config-provider" "^3.1.8" + "@smithy/types" "^3.5.0" + "@smithy/util-config-provider" "^3.0.0" + "@smithy/util-middleware" "^3.0.7" + tslib "^2.6.2" + +"@smithy/core@^2.4.8": + version "2.4.8" + resolved "https://registry.yarnpkg.com/@smithy/core/-/core-2.4.8.tgz#397ac17dfa8ad658b77f96f19484f0eeaf22d397" + integrity sha512-x4qWk7p/a4dcf7Vxb2MODIf4OIcqNbK182WxRvZ/3oKPrf/6Fdic5sSElhO1UtXpWKBazWfqg0ZEK9xN1DsuHA== + dependencies: + "@smithy/middleware-endpoint" "^3.1.4" + "@smithy/middleware-retry" "^3.0.23" + "@smithy/middleware-serde" "^3.0.7" + "@smithy/protocol-http" "^4.1.4" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/credential-provider-imds@^3.2.4": + version "3.2.4" + resolved "https://registry.yarnpkg.com/@smithy/credential-provider-imds/-/credential-provider-imds-3.2.4.tgz#e1a2bfc8a0066f673756ad8735247cf284b9735c" + integrity sha512-S9bb0EIokfYEuar4kEbLta+ivlKCWOCFsLZuilkNy9i0uEUEHSi47IFLPaxqqCl+0ftKmcOTHayY5nQhAuq7+w== + dependencies: + "@smithy/node-config-provider" "^3.1.8" + "@smithy/property-provider" "^3.1.7" + "@smithy/types" "^3.5.0" + "@smithy/url-parser" "^3.0.7" + tslib "^2.6.2" + +"@smithy/eventstream-codec@^3.1.6": + version "3.1.6" + resolved "https://registry.yarnpkg.com/@smithy/eventstream-codec/-/eventstream-codec-3.1.6.tgz#70ca95aad82d5140522eb883fbc140f1f22dcb27" + integrity sha512-SBiOYPBH+5wOyPS7lfI150ePfGLhnp/eTu5RnV9xvhGvRiKfnl6HzRK9wehBph+il8FxS9KTeadx7Rcmf1GLPQ== + dependencies: + "@aws-crypto/crc32" "5.2.0" + "@smithy/types" "^3.5.0" + "@smithy/util-hex-encoding" "^3.0.0" + tslib "^2.6.2" + +"@smithy/eventstream-serde-browser@^3.0.10": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.10.tgz#ffca366a4edee5097be5a710f87627a5b2da5dec" + integrity sha512-1i9aMY6Pl/SmA6NjvidxnfBLHMPzhKu2BP148pEt5VwhMdmXn36PE2kWKGa9Hj8b0XGtCTRucpCncylevCtI7g== + dependencies: + "@smithy/eventstream-serde-universal" "^3.0.9" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/eventstream-serde-config-resolver@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.0.7.tgz#1f352f384665f322e024a1396a7a2cca52fce9e3" + integrity sha512-eVzhGQBPEqXXYHvIUku0jMTxd4gDvenRzUQPTmKVWdRvp9JUCKrbAXGQRYiGxUYq9+cqQckRm0wq3kTWnNtDhw== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/eventstream-serde-node@^3.0.9": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.9.tgz#e985340093c2ca6587ae2fdd0663e6845fbe9463" + integrity sha512-JE0Guqvt0xsmfQ5y1EI342/qtJqznBv8cJqkHZV10PwC8GWGU5KNgFbQnsVCcX+xF+qIqwwfRmeWoJCjuOLmng== + dependencies: + "@smithy/eventstream-serde-universal" "^3.0.9" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/eventstream-serde-universal@^3.0.9": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.9.tgz#1832b190a3018204e33487ba1f7f0f6e2fb0da34" + integrity sha512-bydfgSisfepCufw9kCEnWRxqxJFzX/o8ysXWv+W9F2FIyiaEwZ/D8bBKINbh4ONz3i05QJ1xE7A5OKYvgJsXaw== + dependencies: + "@smithy/eventstream-codec" "^3.1.6" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/fetch-http-handler@^3.2.9": + version "3.2.9" + resolved "https://registry.yarnpkg.com/@smithy/fetch-http-handler/-/fetch-http-handler-3.2.9.tgz#8d5199c162a37caa37a8b6848eefa9ca58221a0b" + integrity sha512-hYNVQOqhFQ6vOpenifFME546f0GfJn2OiQ3M0FDmuUu8V/Uiwy2wej7ZXxFBNqdx0R5DZAqWM1l6VRhGz8oE6A== + dependencies: + "@smithy/protocol-http" "^4.1.4" + "@smithy/querystring-builder" "^3.0.7" + "@smithy/types" "^3.5.0" + "@smithy/util-base64" "^3.0.0" + tslib "^2.6.2" + +"@smithy/hash-blob-browser@^3.1.6": + version "3.1.6" + resolved "https://registry.yarnpkg.com/@smithy/hash-blob-browser/-/hash-blob-browser-3.1.6.tgz#d61de344aa3cef0bc83e3ab8166558256262dfcd" + integrity sha512-BKNcMIaeZ9lB67sgo88iCF4YB35KT8X2dNJ8DqrtZNTgN6tUDYBKThzfGtos/mnZkGkW91AYHisESHmSiYQmKw== + dependencies: + "@smithy/chunked-blob-reader" "^3.0.0" + "@smithy/chunked-blob-reader-native" "^3.0.0" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/hash-node@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/hash-node/-/hash-node-3.0.7.tgz#03b5a382fb588b8c2bac11b4fe7300aaf1661c88" + integrity sha512-SAGHN+QkrwcHFjfWzs/czX94ZEjPJ0CrWJS3M43WswDXVEuP4AVy9gJ3+AF6JQHZD13bojmuf/Ap/ItDeZ+Qfw== + dependencies: + "@smithy/types" "^3.5.0" + "@smithy/util-buffer-from" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/hash-stream-node@^3.1.6": + version "3.1.6" + resolved "https://registry.yarnpkg.com/@smithy/hash-stream-node/-/hash-stream-node-3.1.6.tgz#854ad354a865a1334baa2abc2f2247f2723de688" + integrity sha512-sFSSt7cmCpFWZPfVx7k80Bgb1K2VJ27VmMxH8X+dDhp7Wv8IBgID4K2VK5ehMJROF8hQgcj4WywnkHIwX/xlwQ== + dependencies: + "@smithy/types" "^3.5.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/invalid-dependency@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/invalid-dependency/-/invalid-dependency-3.0.7.tgz#b36f258d94498f3c72ab6020091a66fc7cc16eda" + integrity sha512-Bq00GsAhHeYSuZX8Kpu4sbI9agH2BNYnqUmmbTGWOhki9NVsWn2jFr896vvoTMH8KAjNX/ErC/8t5QHuEXG+IA== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/is-array-buffer@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz#f84f0d9f9a36601a9ca9381688bd1b726fd39111" + integrity sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA== + dependencies: + tslib "^2.6.2" + +"@smithy/is-array-buffer@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-3.0.0.tgz#9a95c2d46b8768946a9eec7f935feaddcffa5e7a" + integrity sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ== + dependencies: + tslib "^2.6.2" + +"@smithy/md5-js@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/md5-js/-/md5-js-3.0.7.tgz#0a645dd9c139254353fd6e6a6b65154baeab7d2e" + integrity sha512-+wco9IN9uOW4tNGkZIqTR6IXyfO7Z8A+IOq82QCRn/f/xcmt7H1fXwmQVbfDSvbeFwfNnhv7s+u0G9PzPG6o2w== + dependencies: + "@smithy/types" "^3.5.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/middleware-content-length@^3.0.9": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@smithy/middleware-content-length/-/middleware-content-length-3.0.9.tgz#fb613d1a6b8c91e828d11c0d7a0a8576dba89b8b" + integrity sha512-t97PidoGElF9hTtLCrof32wfWMqC5g2SEJNxaVH3NjlatuNGsdxXRYO/t+RPnxA15RpYiS0f+zG7FuE2DeGgjA== + dependencies: + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/middleware-endpoint@^3.1.4": + version "3.1.4" + resolved "https://registry.yarnpkg.com/@smithy/middleware-endpoint/-/middleware-endpoint-3.1.4.tgz#222c9fa49c8af6ebf8bea8ab220d92d9b8c90d3d" + integrity sha512-/ChcVHekAyzUbyPRI8CzPPLj6y8QRAfJngWcLMgsWxKVzw/RzBV69mSOzJYDD3pRwushA1+5tHtPF8fjmzBnrQ== + dependencies: + "@smithy/middleware-serde" "^3.0.7" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/shared-ini-file-loader" "^3.1.8" + "@smithy/types" "^3.5.0" + "@smithy/url-parser" "^3.0.7" + "@smithy/util-middleware" "^3.0.7" + tslib "^2.6.2" + +"@smithy/middleware-retry@^3.0.23": + version "3.0.23" + resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-3.0.23.tgz#ce5574e278dd14a7995afd5a4ed2a6c9891da8ed" + integrity sha512-x9PbGXxkcXIpm6L26qRSCC+eaYcHwybRmqU8LO/WM2RRlW0g8lz6FIiKbKgGvHuoK3dLZRiQVSQJveiCzwnA5A== + dependencies: + "@smithy/node-config-provider" "^3.1.8" + "@smithy/protocol-http" "^4.1.4" + "@smithy/service-error-classification" "^3.0.7" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-retry" "^3.0.7" + tslib "^2.6.2" + uuid "^9.0.1" + +"@smithy/middleware-serde@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/middleware-serde/-/middleware-serde-3.0.7.tgz#03f0dda75edffc4cc90ea422349cbfb82368efa7" + integrity sha512-VytaagsQqtH2OugzVTq4qvjkLNbWehHfGcGr0JLJmlDRrNCeZoWkWsSOw1nhS/4hyUUWF/TLGGml4X/OnEep5g== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/middleware-stack@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/middleware-stack/-/middleware-stack-3.0.7.tgz#813fa7b47895ce0d085eac89c056d21b1e46e771" + integrity sha512-EyTbMCdqS1DoeQsO4gI7z2Gzq1MoRFAeS8GkFYIwbedB7Lp5zlLHJdg+56tllIIG5Hnf9ZWX48YKSHlsKvugGA== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/node-config-provider@^3.1.8": + version "3.1.8" + resolved "https://registry.yarnpkg.com/@smithy/node-config-provider/-/node-config-provider-3.1.8.tgz#2c1092040b4062eae0f7c9e121cc00ac6a77efee" + integrity sha512-E0rU0DglpeJn5ge64mk8wTGEXcQwmpUTY5Zr7IzTpDLmHKiIamINERNZYrPQjg58Ck236sEKSwRSHA4CwshU6Q== + dependencies: + "@smithy/property-provider" "^3.1.7" + "@smithy/shared-ini-file-loader" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/node-http-handler@^3.2.4": + version "3.2.4" + resolved "https://registry.yarnpkg.com/@smithy/node-http-handler/-/node-http-handler-3.2.4.tgz#3c57c40d082c3bacac1e49955bd1240e8ccc40b2" + integrity sha512-49reY3+JgLMFNm7uTAKBWiKCA6XSvkNp9FqhVmusm2jpVnHORYFeFZ704LShtqWfjZW/nhX+7Iexyb6zQfXYIQ== + dependencies: + "@smithy/abort-controller" "^3.1.5" + "@smithy/protocol-http" "^4.1.4" + "@smithy/querystring-builder" "^3.0.7" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/property-provider@^3.1.7": + version "3.1.7" + resolved "https://registry.yarnpkg.com/@smithy/property-provider/-/property-provider-3.1.7.tgz#8a304a4b9110a067a93c784e4c11e175f82da379" + integrity sha512-QfzLi1GPMisY7bAM5hOUqBdGYnY5S2JAlr201pghksrQv139f8iiiMalXtjczIP5f6owxFn3MINLNUNvUkgtPw== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/protocol-http@^4.1.4": + version "4.1.4" + resolved "https://registry.yarnpkg.com/@smithy/protocol-http/-/protocol-http-4.1.4.tgz#6940d652b1825bda2422163ec9baab552669a338" + integrity sha512-MlWK8eqj0JlpZBnWmjQLqmFp71Ug00P+m72/1xQB3YByXD4zZ+y9N4hYrR0EDmrUCZIkyATWHOXFgtavwGDTzQ== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/querystring-builder@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/querystring-builder/-/querystring-builder-3.0.7.tgz#8c443c65f4249ff1637088db1166d18411d41555" + integrity sha512-65RXGZZ20rzqqxTsChdqSpbhA6tdt5IFNgG6o7e1lnPVLCe6TNWQq4rTl4N87hTDD8mV4IxJJnvyE7brbnRkQw== + dependencies: + "@smithy/types" "^3.5.0" + "@smithy/util-uri-escape" "^3.0.0" + tslib "^2.6.2" + +"@smithy/querystring-parser@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/querystring-parser/-/querystring-parser-3.0.7.tgz#936206d1e6da9d862384dae730b4bad042d6a948" + integrity sha512-Fouw4KJVWqqUVIu1gZW8BH2HakwLz6dvdrAhXeXfeymOBrZw+hcqaWs+cS1AZPVp4nlbeIujYrKA921ZW2WMPA== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/service-error-classification@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/service-error-classification/-/service-error-classification-3.0.7.tgz#5bab4ad802d30bd3fa52b8134f6c171582358226" + integrity sha512-91PRkTfiBf9hxkIchhRKJfl1rsplRDyBnmyFca3y0Z3x/q0JJN480S83LBd8R6sBCkm2bBbqw2FHp0Mbh+ecSA== + dependencies: + "@smithy/types" "^3.5.0" + +"@smithy/shared-ini-file-loader@^3.1.8": + version "3.1.8" + resolved "https://registry.yarnpkg.com/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-3.1.8.tgz#7a0bf5f20cfe8e0c4a36d8dcab8194d0d2ee958e" + integrity sha512-0NHdQiSkeGl0ICQKcJQ2lCOKH23Nb0EaAa7RDRId6ZqwXkw4LJyIyZ0t3iusD4bnKYDPLGy2/5e2rfUhrt0Acw== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/signature-v4@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-4.2.0.tgz#291f5a0e756cc251377e1e8af2a1f494e6173029" + integrity sha512-LafbclHNKnsorMgUkKm7Tk7oJ7xizsZ1VwqhGKqoCIrXh4fqDDp73fK99HOEEgcsQbtemmeY/BPv0vTVYYUNEQ== + dependencies: + "@smithy/is-array-buffer" "^3.0.0" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + "@smithy/util-hex-encoding" "^3.0.0" + "@smithy/util-middleware" "^3.0.7" + "@smithy/util-uri-escape" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/smithy-client@^3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-3.4.0.tgz#ceffb92108a4ad60cbede3baf44ed224dc70b333" + integrity sha512-nOfJ1nVQsxiP6srKt43r2My0Gp5PLWCW2ASqUioxIiGmu6d32v4Nekidiv5qOmmtzIrmaD+ADX5SKHUuhReeBQ== + dependencies: + "@smithy/middleware-endpoint" "^3.1.4" + "@smithy/middleware-stack" "^3.0.7" + "@smithy/protocol-http" "^4.1.4" + "@smithy/types" "^3.5.0" + "@smithy/util-stream" "^3.1.9" + tslib "^2.6.2" + +"@smithy/types@^3.5.0": + version "3.5.0" + resolved "https://registry.yarnpkg.com/@smithy/types/-/types-3.5.0.tgz#9589e154c50d9c5d00feb7d818112ef8fc285d6e" + integrity sha512-QN0twHNfe8mNJdH9unwsCK13GURU7oEAZqkBI+rsvpv1jrmserO+WnLE7jidR9W/1dxwZ0u/CB01mV2Gms/K2Q== + dependencies: + tslib "^2.6.2" + +"@smithy/url-parser@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/url-parser/-/url-parser-3.0.7.tgz#9d7d7e4e38514bf75ade6e8a30d2300f3db17d1b" + integrity sha512-70UbSSR8J97c1rHZOWhl+VKiZDqHWxs/iW8ZHrHp5fCCPLSBE7GcUlUvKSle3Ca+J9LLbYCj/A79BxztBvAfpA== + dependencies: + "@smithy/querystring-parser" "^3.0.7" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/util-base64@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-base64/-/util-base64-3.0.0.tgz#f7a9a82adf34e27a72d0719395713edf0e493017" + integrity sha512-Kxvoh5Qtt0CDsfajiZOCpJxgtPHXOKwmM+Zy4waD43UoEMA+qPxxa98aE/7ZhdnBFZFXMOiBR5xbcaMhLtznQQ== + dependencies: + "@smithy/util-buffer-from" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/util-body-length-browser@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-body-length-browser/-/util-body-length-browser-3.0.0.tgz#86ec2f6256310b4845a2f064e2f571c1ca164ded" + integrity sha512-cbjJs2A1mLYmqmyVl80uoLTJhAcfzMOyPgjwAYusWKMdLeNtzmMz9YxNl3/jRLoxSS3wkqkf0jwNdtXWtyEBaQ== + dependencies: + tslib "^2.6.2" + +"@smithy/util-body-length-node@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-body-length-node/-/util-body-length-node-3.0.0.tgz#99a291bae40d8932166907fe981d6a1f54298a6d" + integrity sha512-Tj7pZ4bUloNUP6PzwhN7K386tmSmEET9QtQg0TgdNOnxhZvCssHji+oZTUIuzxECRfG8rdm2PMw2WCFs6eIYkA== + dependencies: + tslib "^2.6.2" + +"@smithy/util-buffer-from@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz#6fc88585165ec73f8681d426d96de5d402021e4b" + integrity sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA== + dependencies: + "@smithy/is-array-buffer" "^2.2.0" + tslib "^2.6.2" + +"@smithy/util-buffer-from@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-3.0.0.tgz#559fc1c86138a89b2edaefc1e6677780c24594e3" + integrity sha512-aEOHCgq5RWFbP+UDPvPot26EJHjOC+bRgse5A8V3FSShqd5E5UN4qc7zkwsvJPPAVsf73QwYcHN1/gt/rtLwQA== + dependencies: + "@smithy/is-array-buffer" "^3.0.0" + tslib "^2.6.2" + +"@smithy/util-config-provider@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-config-provider/-/util-config-provider-3.0.0.tgz#62c6b73b22a430e84888a8f8da4b6029dd5b8efe" + integrity sha512-pbjk4s0fwq3Di/ANL+rCvJMKM5bzAQdE5S/6RL5NXgMExFAi6UgQMPOm5yPaIWPpr+EOXKXRonJ3FoxKf4mCJQ== + dependencies: + tslib "^2.6.2" + +"@smithy/util-defaults-mode-browser@^3.0.23": + version "3.0.23" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.23.tgz#6920b473126ae8857a04dd6941793bbda12adc8b" + integrity sha512-Y07qslyRtXDP/C5aWKqxTPBl4YxplEELG3xRrz2dnAQ6Lq/FgNrcKWmV561nNaZmFH+EzeGOX3ZRMbU8p1T6Nw== + dependencies: + "@smithy/property-provider" "^3.1.7" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + bowser "^2.11.0" + tslib "^2.6.2" + +"@smithy/util-defaults-mode-node@^3.0.23": + version "3.0.23" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.23.tgz#d03d21816e8b2f586ccf4a87cd0b1cc55b4d75e0" + integrity sha512-9Y4WH7f0vnDGuHUa4lGX9e2p+sMwODibsceSV6rfkZOvMC+BY3StB2LdO1NHafpsyHJLpwAgChxQ38tFyd6vkg== + dependencies: + "@smithy/config-resolver" "^3.0.9" + "@smithy/credential-provider-imds" "^3.2.4" + "@smithy/node-config-provider" "^3.1.8" + "@smithy/property-provider" "^3.1.7" + "@smithy/smithy-client" "^3.4.0" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/util-endpoints@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@smithy/util-endpoints/-/util-endpoints-2.1.3.tgz#7498151e9dc714bdd0c6339314dd2350fa4d250a" + integrity sha512-34eACeKov6jZdHqS5hxBMJ4KyWKztTMulhuQ2UdOoP6vVxMLrOKUqIXAwJe/wiWMhXhydLW664B02CNpQBQ4Aw== + dependencies: + "@smithy/node-config-provider" "^3.1.8" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/util-hex-encoding@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-hex-encoding/-/util-hex-encoding-3.0.0.tgz#32938b33d5bf2a15796cd3f178a55b4155c535e6" + integrity sha512-eFndh1WEK5YMUYvy3lPlVmYY/fZcQE1D8oSf41Id2vCeIkKJXPcYDCZD+4+xViI6b1XSd7tE+s5AmXzz5ilabQ== + dependencies: + tslib "^2.6.2" + +"@smithy/util-middleware@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/util-middleware/-/util-middleware-3.0.7.tgz#770d09749b6d170a1641384a2e961487447446fa" + integrity sha512-OVA6fv/3o7TMJTpTgOi1H5OTwnuUa8hzRzhSFDtZyNxi6OZ70L/FHattSmhE212I7b6WSOJAAmbYnvcjTHOJCA== + dependencies: + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/util-retry@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/util-retry/-/util-retry-3.0.7.tgz#694e0667574ffe9772f620b35d3c7286aced35e9" + integrity sha512-nh1ZO1vTeo2YX1plFPSe/OXaHkLAHza5jpokNiiKX2M5YpNUv6RxGJZhpfmiR4jSvVHCjIDmILjrxKmP+/Ghug== + dependencies: + "@smithy/service-error-classification" "^3.0.7" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@smithy/util-stream@^3.1.9": + version "3.1.9" + resolved "https://registry.yarnpkg.com/@smithy/util-stream/-/util-stream-3.1.9.tgz#d39656eae27696bdc5a3ec7c2f6b89c32dccd1ca" + integrity sha512-7YAR0Ub3MwTMjDfjnup4qa6W8gygZMxikBhFMPESi6ASsl/rZJhwLpF/0k9TuezScCojsM0FryGdz4LZtjKPPQ== + dependencies: + "@smithy/fetch-http-handler" "^3.2.9" + "@smithy/node-http-handler" "^3.2.4" + "@smithy/types" "^3.5.0" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-buffer-from" "^3.0.0" + "@smithy/util-hex-encoding" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/util-uri-escape@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-uri-escape/-/util-uri-escape-3.0.0.tgz#e43358a78bf45d50bb736770077f0f09195b6f54" + integrity sha512-LqR7qYLgZTD7nWLBecUi4aqolw8Mhza9ArpNEQ881MJJIU2sE5iHCK6TdyqqzcDLy0OPe10IY4T8ctVdtynubg== + dependencies: + tslib "^2.6.2" + +"@smithy/util-utf8@^2.0.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-2.3.0.tgz#dd96d7640363259924a214313c3cf16e7dd329c5" + integrity sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A== + dependencies: + "@smithy/util-buffer-from" "^2.2.0" + tslib "^2.6.2" + +"@smithy/util-utf8@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-3.0.0.tgz#1a6a823d47cbec1fd6933e5fc87df975286d9d6a" + integrity sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA== + dependencies: + "@smithy/util-buffer-from" "^3.0.0" + tslib "^2.6.2" + +"@smithy/util-waiter@^3.1.6": + version "3.1.6" + resolved "https://registry.yarnpkg.com/@smithy/util-waiter/-/util-waiter-3.1.6.tgz#c65870d0c802e33b96112fac5c4471b3bf2eeecb" + integrity sha512-xs/KAwWOeCklq8aMlnpk25LgxEYHKOEodfjfKclDMLcBJEVEKzDLxZxBQyztcuPJ7F54213NJS8PxoiHNMdItQ== + dependencies: + "@smithy/abort-controller" "^3.1.5" + "@smithy/types" "^3.5.0" + tslib "^2.6.2" + +"@supabase/auth-js@2.65.0": + version "2.65.0" + resolved "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.65.0.tgz" + integrity sha512-+wboHfZufAE2Y612OsKeVP4rVOeGZzzMLD/Ac3HrTQkkY4qXNjI6Af9gtmxwccE5nFvTiF114FEbIQ1hRq5uUw== + dependencies: + "@supabase/node-fetch" "^2.6.14" + +"@supabase/functions-js@2.4.1": + version "2.4.1" + resolved "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.4.1.tgz" + integrity sha512-8sZ2ibwHlf+WkHDUZJUXqqmPvWQ3UHN0W30behOJngVh/qHHekhJLCFbh0AjkE9/FqqXtf9eoVvmYgfCLk5tNA== + dependencies: + "@supabase/node-fetch" "^2.6.14" + +"@supabase/node-fetch@2.6.15", "@supabase/node-fetch@^2.6.14": + version "2.6.15" + resolved "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.15.tgz" + integrity sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ== + dependencies: + whatwg-url "^5.0.0" + +"@supabase/postgrest-js@1.16.1": + version "1.16.1" + resolved "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.16.1.tgz" + integrity sha512-EOSEZFm5pPuCPGCmLF1VOCS78DfkSz600PBuvBND/IZmMciJ1pmsS3ss6TkB6UkuvTybYiBh7gKOYyxoEO3USA== + dependencies: + "@supabase/node-fetch" "^2.6.14" + +"@supabase/realtime-js@2.10.2": + version "2.10.2" + resolved "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.10.2.tgz" + integrity sha512-qyCQaNg90HmJstsvr2aJNxK2zgoKh9ZZA8oqb7UT2LCh3mj9zpa3Iwu167AuyNxsxrUE8eEJ2yH6wLCij4EApA== + dependencies: + "@supabase/node-fetch" "^2.6.14" + "@types/phoenix" "^1.5.4" + "@types/ws" "^8.5.10" + ws "^8.14.2" + +"@supabase/ssr@latest": + version "0.5.1" + resolved "https://registry.npmjs.org/@supabase/ssr/-/ssr-0.5.1.tgz" + integrity sha512-+G94H/GZG0nErZ3FQV9yJmsC5Rj7dmcfCAwOt37hxeR1La+QTl8cE9whzYwPUrTJjMLGNXoO+1BMvVxwBAbz4g== + dependencies: + cookie "^0.6.0" + +"@supabase/storage-js@2.7.0": + version "2.7.0" + resolved "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.7.0.tgz" + integrity sha512-iZenEdO6Mx9iTR6T7wC7sk6KKsoDPLq8rdu5VRy7+JiT1i8fnqfcOr6mfF2Eaqky9VQzhP8zZKQYjzozB65Rig== + dependencies: + "@supabase/node-fetch" "^2.6.14" + +"@supabase/supabase-js@latest": + version "2.45.4" + resolved "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.45.4.tgz" + integrity sha512-E5p8/zOLaQ3a462MZnmnz03CrduA5ySH9hZyL03Y+QZLIOO4/Gs8Rdy4ZCKDHsN7x0xdanVEWWFN3pJFQr9/hg== + dependencies: + "@supabase/auth-js" "2.65.0" + "@supabase/functions-js" "2.4.1" + "@supabase/node-fetch" "2.6.15" + "@supabase/postgrest-js" "1.16.1" + "@supabase/realtime-js" "2.10.2" + "@supabase/storage-js" "2.7.0" + +"@swc/counter@^0.1.3": + version "0.1.3" + resolved "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz" + integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== + +"@swc/helpers@0.5.5": + version "0.5.5" + resolved "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz" + integrity sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A== + dependencies: + "@swc/counter" "^0.1.3" + tslib "^2.4.0" + +"@types/css-font-loading-module@0.0.7": + version "0.0.7" + resolved "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz" + integrity sha512-nl09VhutdjINdWyXxHWN/w9zlNCfr60JUqJbd24YXUuCwgeL0TpFSdElCwb6cxfB6ybE19Gjj4g0jsgkXxKv1Q== + +"@types/node@*": + version "22.7.5" + resolved "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== + dependencies: + undici-types "~6.19.2" + +"@types/node@20.10.6": + version "20.10.6" + resolved "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz" + integrity sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw== + dependencies: + undici-types "~5.26.4" + +"@types/phoenix@^1.5.4": + version "1.6.5" + resolved "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.6.5.tgz" + integrity sha512-xegpDuR+z0UqG9fwHqNoy3rI7JDlvaPh2TY47Fl80oq6g+hXT+c/LEuE43X48clZ6lOfANl5WrPur9fYO1RJ/w== + +"@types/prop-types@*": + version "15.7.13" + resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz" + integrity sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA== + +"@types/react-dom@18.2.18": + version "18.2.18" + resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.18.tgz" + integrity sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw== + dependencies: + "@types/react" "*" + +"@types/react-transition-group@^4.4.1": + version "4.4.11" + resolved "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.11.tgz" + integrity sha512-RM05tAniPZ5DZPzzNFP+DmrcOdD0efDUxMy3145oljWSl3x9ZV5vhme98gTxFrj2lhXvmGNnUiuDyJgY9IKkNA== + dependencies: + "@types/react" "*" + +"@types/react@*", "@types/react@18.2.46": + version "18.2.46" + resolved "https://registry.npmjs.org/@types/react/-/react-18.2.46.tgz" + integrity sha512-nNCvVBcZlvX4NU1nRRNV/mFl1nNRuTuslAJglQsq+8ldXe5Xv0Wd2f7WTE3jOxhLH2BFfiZGC6GCp+kHQbgG+w== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + +"@types/scheduler@*": + version "0.23.0" + resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.23.0.tgz" + integrity sha512-YIoDCTH3Af6XM5VuwGG/QL/CJqga1Zm3NkU3HZ4ZHK2fRMPYP1VczsTUqtsf43PH/iJNVlPHAo2oWX7BSdB2Hw== + +"@types/use-sync-external-store@^0.0.3": + version "0.0.3" + resolved "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz" + integrity sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA== + +"@types/webxr@^0.5.16": + version "0.5.20" + resolved "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.20.tgz" + integrity sha512-JGpU6qiIJQKUuVSKx1GtQnHJGxRjtfGIhzO2ilq43VZZS//f1h1Sgexbdk+Lq+7569a6EYhOWrUpIruR/1Enmg== + +"@types/ws@^8.5.10": + version "8.5.12" + resolved "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz" + integrity sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ== + dependencies: + "@types/node" "*" + +"@webgpu/types@^0.1.40": + version "0.1.48" + resolved "https://registry.npmjs.org/@webgpu/types/-/types-0.1.48.tgz" + integrity sha512-e3zmDEPih4Rle+JrP5cT8nCCtDizoUpEaN72OuD1clbhXGERtn0wwuMdxOrBymu3kMLWKDd8hd+ERhSheLuLTg== + +"@xstate/fsm@^1.4.0": + version "1.6.5" + resolved "https://registry.npmjs.org/@xstate/fsm/-/fsm-1.6.5.tgz" + integrity sha512-b5o1I6aLNeYlU/3CPlj/Z91ybk1gUsKT+5NAJI+2W4UjvS5KLG28K9v5UvNoFVjHV8PajVZ00RH3vnjyQO7ZAw== + +acorn-walk@^8.0.0: + version "8.3.4" + resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz" + integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + dependencies: + acorn "^8.11.0" + +acorn@^8.0.4, acorn@^8.11.0: + version "8.12.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + +ahooks@^3.8.1: + version "3.8.1" + resolved "https://registry.npmjs.org/ahooks/-/ahooks-3.8.1.tgz" + integrity sha512-JoP9+/RWO7MnI/uSKdvQ8WB10Y3oo1PjLv+4Sv4Vpm19Z86VUMdXh+RhWvMGxZZs06sq2p0xVtFk8Oh5ZObsoA== + dependencies: + "@babel/runtime" "^7.21.0" + dayjs "^1.9.1" + intersection-observer "^0.12.0" + js-cookie "^3.0.5" + lodash "^4.17.21" + react-fast-compare "^3.2.2" + resize-observer-polyfill "^1.5.1" + screenfull "^5.0.0" + tslib "^2.4.1" + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-regex@^6.0.1: + version "6.1.0" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz" + integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== + +ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^6.1.0: + version "6.2.1" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + +antd@^5.21.2: + version "5.21.3" + resolved "https://registry.npmjs.org/antd/-/antd-5.21.3.tgz" + integrity sha512-Yby3gU6jfuvhNFRPsrHB4Yc/G3LHLNHHy0kShwNmmZf1QTCiW5TmqP3DT5m/NHbJsTgEwJpwo3AaOWo+KQyEjw== + dependencies: + "@ant-design/colors" "^7.1.0" + "@ant-design/cssinjs" "^1.21.1" + "@ant-design/cssinjs-utils" "^1.1.0" + "@ant-design/icons" "^5.5.1" + "@ant-design/react-slick" "~1.1.2" + "@babel/runtime" "^7.25.6" + "@ctrl/tinycolor" "^3.6.1" + "@rc-component/color-picker" "~2.0.1" + "@rc-component/mutate-observer" "^1.1.0" + "@rc-component/qrcode" "~1.0.0" + "@rc-component/tour" "~1.15.1" + "@rc-component/trigger" "^2.2.3" + classnames "^2.5.1" + copy-to-clipboard "^3.3.3" + dayjs "^1.11.11" + rc-cascader "~3.28.1" + rc-checkbox "~3.3.0" + rc-collapse "~3.8.0" + rc-dialog "~9.6.0" + rc-drawer "~7.2.0" + rc-dropdown "~4.2.0" + rc-field-form "~2.4.0" + rc-image "~7.11.0" + rc-input "~1.6.3" + rc-input-number "~9.2.0" + rc-mentions "~2.16.1" + rc-menu "~9.15.1" + rc-motion "^2.9.3" + rc-notification "~5.6.2" + rc-pagination "~4.3.0" + rc-picker "~4.6.15" + rc-progress "~4.0.0" + rc-rate "~2.13.0" + rc-resize-observer "^1.4.0" + rc-segmented "~2.5.0" + rc-select "~14.15.2" + rc-slider "~11.1.7" + rc-steps "~6.0.1" + rc-switch "~4.1.0" + rc-table "~7.47.5" + rc-tabs "~15.3.0" + rc-textarea "~1.8.2" + rc-tooltip "~6.2.1" + rc-tree "~5.9.0" + rc-tree-select "~5.23.0" + rc-upload "~4.8.1" + rc-util "^5.43.0" + scroll-into-view-if-needed "^3.1.0" + throttle-debounce "^5.0.2" + +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz" + integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== + +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +arg@^5.0.2: + version "5.0.2" + resolved "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz" + integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg== + +aria-hidden@^1.1.1: + version "1.2.4" + resolved "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.4.tgz" + integrity sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A== + dependencies: + tslib "^2.0.0" + +array-tree-filter@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/array-tree-filter/-/array-tree-filter-2.1.0.tgz" + integrity sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw== + +asap@^2.0.0: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== + +attr-accept@^2.2.2: + version "2.2.4" + resolved "https://registry.npmjs.org/attr-accept/-/attr-accept-2.2.4.tgz" + integrity sha512-2pA6xFIbdTUDCAwjN8nQwI+842VwzbDUXO2IYlpPXQIORgKnavorcr4Ce3rwh+zsNg9zK7QPsdvDj3Lum4WX4w== + +autoprefixer@10.4.17: + version "10.4.17" + resolved "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.17.tgz" + integrity sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg== + dependencies: + browserslist "^4.22.2" + caniuse-lite "^1.0.30001578" + fraction.js "^4.3.7" + normalize-range "^0.1.2" + picocolors "^1.0.0" + postcss-value-parser "^4.2.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +base64-arraybuffer@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz" + integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ== + +binary-extensions@^2.0.0: + version "2.3.0" + resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz" + integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== + +bluebird@~3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + +bowser@^2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f" + integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA== + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.3, braces@~3.0.2: + version "3.0.3" + resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + +browserslist@^4.22.2: + version "4.24.0" + resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz" + integrity sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A== + dependencies: + caniuse-lite "^1.0.30001663" + electron-to-chromium "^1.5.28" + node-releases "^2.0.18" + update-browserslist-db "^1.1.0" + +busboy@1.6.0: + version "1.6.0" + resolved "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz" + integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== + dependencies: + streamsearch "^1.1.0" + +camelcase-css@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz" + integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== + +caniuse-lite@^1.0.30001578, caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001663: + version "1.0.30001668" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz" + integrity sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw== + +chalk@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" + integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== + +change-case@^5.4.4: + version "5.4.4" + resolved "https://registry.yarnpkg.com/change-case/-/change-case-5.4.4.tgz#0d52b507d8fb8f204343432381d1a6d7bff97a02" + integrity sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w== + +chokidar@^3.5.3: + version "3.6.0" + resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +class-variance-authority@^0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.0.tgz" + integrity sha512-jFI8IQw4hczaL4ALINxqLEXQbWcNjoSkloa4IaufXCJr6QawJyw7tuRysRsrE8w2p/4gGaxKIt/hX3qz/IbD1A== + dependencies: + clsx "2.0.0" + +classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2, classnames@^2.5.1: + version "2.5.1" + resolved "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz" + integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== + +client-only@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz" + integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== + +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + +clsx@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/clsx/-/clsx-2.0.0.tgz" + integrity sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q== + +clsx@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz" + integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA== + +cmdk@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/cmdk/-/cmdk-1.0.0.tgz" + integrity sha512-gDzVf0a09TvoJ5jnuPvygTB77+XdOSwEmJ88L6XPFPlv7T3RxbP9jgenfylrAMD0+Le1aO0nVjQUzl2g+vjz5Q== + dependencies: + "@radix-ui/react-dialog" "1.0.5" + "@radix-ui/react-primitive" "1.0.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +commander@^4.0.0: + version "4.1.1" + resolved "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + +commander@^7.2.0: + version "7.2.0" + resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" + integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== + +compute-scroll-into-view@^3.0.2: + version "3.1.0" + resolved "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-3.1.0.tgz" + integrity sha512-rj8l8pD4bJ1nx+dAkMhV1xB5RuZEyVysfxJqB1pRchh1KVvwOv9b7CGB8ZfjTImVv2oF+sYMUkMZq6Na5Ftmbg== + +cookie@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== + +copy-to-clipboard@^3.3.3: + version "3.3.3" + resolved "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz" + integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA== + dependencies: + toggle-selection "^1.0.6" + +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + +cross-spawn@^7.0.0, cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +cssesc@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz" + integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== + +csstype@^3.0.2, csstype@^3.1.3: + version "3.1.3" + resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz" + integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== + +dayjs@^1.11.11, dayjs@^1.9.1: + version "1.11.13" + resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz" + integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg== + +debounce@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz" + integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== + +detect-node-es@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz" + integrity sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ== + +dezalgo@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.4.tgz#751235260469084c132157dfa857f386d4c33d81" + integrity sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig== + dependencies: + asap "^2.0.0" + wrappy "1" + +didyoumean@^1.2.2: + version "1.2.2" + resolved "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz" + integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== + +dlv@^1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz" + integrity sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA== + +dom-helpers@^5.0.1: + version "5.2.1" + resolved "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz" + integrity sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA== + dependencies: + "@babel/runtime" "^7.8.7" + csstype "^3.0.2" + +duplexer2@~0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" + integrity sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA== + dependencies: + readable-stream "^2.0.2" + +duplexer@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz" + integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg== + +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + +electron-to-chromium@^1.5.28: + version "1.5.36" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.36.tgz" + integrity sha512-HYTX8tKge/VNp6FGO+f/uVDmUkq+cEfcxYhKf15Akc4M5yxt5YmorwlAitKWjWhWQnKcDRBAQKXkhqqXMqcrjw== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + +escalade@^3.1.1, escalade@^3.2.0: + version "3.2.0" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +execa@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +fast-glob@^3.3.0: + version "3.3.2" + resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-xml-parser@4.4.1: + version "4.4.1" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz#86dbf3f18edf8739326447bcaac31b4ae7f6514f" + integrity sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw== + dependencies: + strnum "^1.0.5" + +fastq@^1.6.0: + version "1.17.1" + resolved "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz" + integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== + dependencies: + reusify "^1.0.4" + +fflate@^0.4.4: + version "0.4.8" + resolved "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz" + integrity sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA== + +file-selector@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/file-selector/-/file-selector-0.6.0.tgz" + integrity sha512-QlZ5yJC0VxHxQQsQhXvBaC7VRJ2uaxTf+Tfpu4Z/OcVQJVpZO+DGU0rkoVW5ce2SccxugvpBJoMvUs59iILYdw== + dependencies: + tslib "^2.4.0" + +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +foreground-child@^3.1.0: + version "3.3.0" + resolved "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz" + integrity sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + +formidable@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/formidable/-/formidable-3.5.1.tgz#9360a23a656f261207868b1484624c4c8d06ee1a" + integrity sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og== + dependencies: + dezalgo "^1.0.4" + hexoid "^1.0.0" + once "^1.4.0" + +fraction.js@^4.3.7: + version "4.3.7" + resolved "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz" + integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew== + +fs-extra@^11.2.0: + version "11.2.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" + integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +geist@^1.2.1: + version "1.3.1" + resolved "https://registry.npmjs.org/geist/-/geist-1.3.1.tgz" + integrity sha512-Q4gC1pBVPN+D579pBaz0TRRnGA4p9UK6elDY/xizXdFk/g4EKR5g0I+4p/Kj6gM0SajDBZ/0FvDV9ey9ud7BWw== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-nonce@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz" + integrity sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q== + +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@^10.3.10, glob@^10.4.2: + version "10.4.5" + resolved "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" + +graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.2: + version "4.2.11" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +gzip-size@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz" + integrity sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q== + dependencies: + duplexer "^0.1.2" + +hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +hexoid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-1.0.0.tgz#ad10c6573fb907de23d9ec63a711267d9dc9bc18" + integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g== + +howler@^2.1.3: + version "2.2.4" + resolved "https://registry.npmjs.org/howler/-/howler-2.2.4.tgz" + integrity sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w== + +html-escaper@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +idb-keyval@^6.2.1: + version "6.2.1" + resolved "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.1.tgz" + integrity sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg== + +idb@^8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/idb/-/idb-8.0.0.tgz" + integrity sha512-l//qvlAKGmQO31Qn7xdzagVPPaHTxXx199MhrAFuVBTPqydcPYBWjkrbv4Y0ktB+GmWOiwHl237UUOrLmQxLvw== + +ignore@^5.3.0: + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== + +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== + +immer@^10.0.3: + version "10.1.1" + resolved "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz" + integrity sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw== + +inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +intersection-observer@^0.12.0: + version "0.12.2" + resolved "https://registry.npmjs.org/intersection-observer/-/intersection-observer-0.12.2.tgz" + integrity sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg== + +invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-core-module@^2.13.0: + version "2.15.1" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz" + integrity sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ== + dependencies: + hasown "^2.0.2" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-plain-object@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz" + integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + +jiti@^1.19.1: + version "1.21.6" + resolved "https://registry.npmjs.org/jiti/-/jiti-1.21.6.tgz" + integrity sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w== + +js-cookie@^3.0.5: + version "3.0.5" + resolved "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz" + integrity sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw== + +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +json2mq@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz" + integrity sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA== + dependencies: + string-convert "^0.2.0" + +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jszip@^3.10.1: + version "3.10.1" + resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2" + integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g== + dependencies: + lie "~3.3.0" + pako "~1.0.2" + readable-stream "~2.3.6" + setimmediate "^1.0.5" + +lie@~3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a" + integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ== + dependencies: + immediate "~3.0.5" + +lilconfig@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz" + integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== + +lilconfig@^3.0.0: + version "3.1.2" + resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz" + integrity sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow== + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + +lucide-react@^0.446.0: + version "0.446.0" + resolved "https://registry.npmjs.org/lucide-react/-/lucide-react-0.446.0.tgz" + integrity sha512-BU7gy8MfBMqvEdDPH79VhOXSEgyG8TSPOKWaExWGCQVqnGH7wGgDngPbofu+KdtVjPQBWbEmnfMTq90CTiiDRg== + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4, micromatch@^4.0.5: + version "4.0.8" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + +mitt@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz" + integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw== + +mri@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + +mrmime@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz" + integrity sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw== + +mz@^2.7.0: + version "2.7.0" + resolved "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + +nanoid@^3.3.6, nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + +next-themes@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/next-themes/-/next-themes-0.3.0.tgz" + integrity sha512-/QHIrsYpd6Kfk7xakK4svpDI5mmXP0gfvCoJdGpZQ2TOrQZmsW0QxjaiLn8wbIKjtm4BTSqLoix4lxYYOnLJ/w== + +next@latest: + version "14.2.15" + resolved "https://registry.npmjs.org/next/-/next-14.2.15.tgz" + integrity sha512-h9ctmOokpoDphRvMGnwOJAedT6zKhwqyZML9mDtspgf4Rh3Pn7UTYKqePNoDvhsWBAO5GoPNYshnAUGIazVGmw== + dependencies: + "@next/env" "14.2.15" + "@swc/helpers" "0.5.5" + busboy "1.6.0" + caniuse-lite "^1.0.30001579" + graceful-fs "^4.2.11" + postcss "8.4.31" + styled-jsx "5.1.1" + optionalDependencies: + "@next/swc-darwin-arm64" "14.2.15" + "@next/swc-darwin-x64" "14.2.15" + "@next/swc-linux-arm64-gnu" "14.2.15" + "@next/swc-linux-arm64-musl" "14.2.15" + "@next/swc-linux-x64-gnu" "14.2.15" + "@next/swc-linux-x64-musl" "14.2.15" + "@next/swc-win32-arm64-msvc" "14.2.15" + "@next/swc-win32-ia32-msvc" "14.2.15" + "@next/swc-win32-x64-msvc" "14.2.15" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== + +node-releases@^2.0.18: + version "2.0.18" + resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +normalize-range@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz" + integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA== + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +object-assign@^4.0.1, object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + +object-hash@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz" + integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== + +once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +opener@^1.5.2: + version "1.5.2" + resolved "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz" + integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== + +pako@~1.0.2: + version "1.0.11" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" + integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== + dependencies: + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + +picocolors@^1.0.0, picocolors@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz" + integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +picomatch@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-3.0.1.tgz#817033161def55ec9638567a2f3bbc876b3e7516" + integrity sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag== + +pify@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz" + integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== + +pirates@^4.0.1: + version "4.0.6" + resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz" + integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== + +playcanvas@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/playcanvas/-/playcanvas-2.1.0.tgz" + integrity sha512-o8Oat/+edEffVG09oUQnQlEVKYu47S15yDLz9/bkbE5ur9q5JsmPbOiCn7ds7kud60opvPb7CkQnKuS+8tlN+w== + dependencies: + "@types/webxr" "^0.5.16" + "@webgpu/types" "^0.1.40" + +postcss-import@^15.1.0: + version "15.1.0" + resolved "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz" + integrity sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew== + dependencies: + postcss-value-parser "^4.0.0" + read-cache "^1.0.0" + resolve "^1.1.7" + +postcss-js@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz" + integrity sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw== + dependencies: + camelcase-css "^2.0.1" + +postcss-load-config@^4.0.1: + version "4.0.2" + resolved "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz" + integrity sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ== + dependencies: + lilconfig "^3.0.0" + yaml "^2.3.4" + +postcss-nested@^6.0.1: + version "6.2.0" + resolved "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz" + integrity sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ== + dependencies: + postcss-selector-parser "^6.1.1" + +postcss-selector-parser@^6.0.11, postcss-selector-parser@^6.1.1: + version "6.1.2" + resolved "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz" + integrity sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg== + dependencies: + cssesc "^3.0.0" + util-deprecate "^1.0.2" + +postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: + version "4.2.0" + resolved "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz" + integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== + +postcss@8.4.31: + version "8.4.31" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz" + integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== + dependencies: + nanoid "^3.3.6" + picocolors "^1.0.0" + source-map-js "^1.0.2" + +postcss@8.4.33: + version "8.4.33" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz" + integrity sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg== + dependencies: + nanoid "^3.3.7" + picocolors "^1.0.0" + source-map-js "^1.0.2" + +postcss@^8.4.23: + version "8.4.47" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz" + integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== + dependencies: + nanoid "^3.3.7" + picocolors "^1.1.0" + source-map-js "^1.2.1" + +prettier@^3.3.3: + version "3.3.3" + resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== + +pretty-quick@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-4.0.0.tgz#ea5cce85a5804bfbec7327b0e064509155d03f39" + integrity sha512-M+2MmeufXb/M7Xw3Afh1gxcYpj+sK0AxEfnfF958ktFeAyi5MsKY5brymVURQLgPLV1QaF5P4pb2oFJ54H3yzQ== + dependencies: + execa "^5.1.1" + find-up "^5.0.0" + ignore "^5.3.0" + mri "^1.2.0" + picocolors "^1.0.0" + picomatch "^3.0.1" + tslib "^2.6.2" + +primereact@^10.8.3: + version "10.8.4" + resolved "https://registry.npmjs.org/primereact/-/primereact-10.8.4.tgz" + integrity sha512-jwkSzq6pOHayzEh+9dgk2M71gEZtoQakwPKVo3FUJO3eEX3SoAOchON+Xm1tGCNqtd66ca8RgOWQcpv3AQoMvg== + dependencies: + "@types/react-transition-group" "^4.4.1" + react-transition-group "^4.4.1" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +prop-types@^15.6.2, prop-types@^15.8.1: + version "15.8.1" + resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" + integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.13.1" + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +rc-cascader@~3.28.1: + version "3.28.1" + resolved "https://registry.npmjs.org/rc-cascader/-/rc-cascader-3.28.1.tgz" + integrity sha512-9+8oHIMWVLHxuaapDiqFNmD9KSyKN/P4bo9x/MBuDbyTqP8f2/POmmZxdXWBO3yq/uE3pKyQCXYNUxrNfHRv2A== + dependencies: + "@babel/runtime" "^7.12.5" + array-tree-filter "^2.1.0" + classnames "^2.3.1" + rc-select "~14.15.0" + rc-tree "~5.9.0" + rc-util "^5.37.0" + +rc-checkbox@~3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/rc-checkbox/-/rc-checkbox-3.3.0.tgz" + integrity sha512-Ih3ZaAcoAiFKJjifzwsGiT/f/quIkxJoklW4yKGho14Olulwn8gN7hOBve0/WGDg5o/l/5mL0w7ff7/YGvefVw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.3.2" + rc-util "^5.25.2" + +rc-collapse@~3.8.0: + version "3.8.0" + resolved "https://registry.npmjs.org/rc-collapse/-/rc-collapse-3.8.0.tgz" + integrity sha512-YVBkssrKPBG09TGfcWWGj8zJBYD9G3XuTy89t5iUmSXrIXEAnO1M+qjUxRW6b4Qi0+wNWG6MHJF/+US+nmIlzA== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.3.4" + rc-util "^5.27.0" + +rc-dialog@~9.6.0: + version "9.6.0" + resolved "https://registry.npmjs.org/rc-dialog/-/rc-dialog-9.6.0.tgz" + integrity sha512-ApoVi9Z8PaCQg6FsUzS8yvBEQy0ZL2PkuvAgrmohPkN3okps5WZ5WQWPc1RNuiOKaAYv8B97ACdsFU5LizzCqg== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/portal" "^1.0.0-8" + classnames "^2.2.6" + rc-motion "^2.3.0" + rc-util "^5.21.0" + +rc-drawer@~7.2.0: + version "7.2.0" + resolved "https://registry.npmjs.org/rc-drawer/-/rc-drawer-7.2.0.tgz" + integrity sha512-9lOQ7kBekEJRdEpScHvtmEtXnAsy+NGDXiRWc2ZVC7QXAazNVbeT4EraQKYwCME8BJLa8Bxqxvs5swwyOepRwg== + dependencies: + "@babel/runtime" "^7.23.9" + "@rc-component/portal" "^1.1.1" + classnames "^2.2.6" + rc-motion "^2.6.1" + rc-util "^5.38.1" + +rc-dropdown@~4.2.0: + version "4.2.0" + resolved "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-4.2.0.tgz" + integrity sha512-odM8Ove+gSh0zU27DUj5cG1gNKg7mLWBYzB5E4nNLrLwBmYEgYP43vHKDGOVZcJSVElQBI0+jTQgjnq0NfLjng== + dependencies: + "@babel/runtime" "^7.18.3" + "@rc-component/trigger" "^2.0.0" + classnames "^2.2.6" + rc-util "^5.17.0" + +rc-field-form@~2.4.0: + version "2.4.0" + resolved "https://registry.npmjs.org/rc-field-form/-/rc-field-form-2.4.0.tgz" + integrity sha512-XZ/lF9iqf9HXApIHQHqzJK5v2w4mkUMsVqAzOyWVzoiwwXEavY6Tpuw7HavgzIoD+huVff4JghSGcgEfX6eycg== + dependencies: + "@babel/runtime" "^7.18.0" + "@rc-component/async-validator" "^5.0.3" + rc-util "^5.32.2" + +rc-image@~7.11.0: + version "7.11.0" + resolved "https://registry.npmjs.org/rc-image/-/rc-image-7.11.0.tgz" + integrity sha512-aZkTEZXqeqfPZtnSdNUnKQA0N/3MbgR7nUnZ+/4MfSFWPFHZau4p5r5ShaI0KPEMnNjv4kijSCFq/9wtJpwykw== + dependencies: + "@babel/runtime" "^7.11.2" + "@rc-component/portal" "^1.0.2" + classnames "^2.2.6" + rc-dialog "~9.6.0" + rc-motion "^2.6.2" + rc-util "^5.34.1" + +rc-input-number@~9.2.0: + version "9.2.0" + resolved "https://registry.npmjs.org/rc-input-number/-/rc-input-number-9.2.0.tgz" + integrity sha512-5XZFhBCV5f9UQ62AZ2hFbEY8iZT/dm23Q1kAg0H8EvOgD3UDbYYJAayoVIkM3lQaCqYAW5gV0yV3vjw1XtzWHg== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/mini-decimal" "^1.0.1" + classnames "^2.2.5" + rc-input "~1.6.0" + rc-util "^5.40.1" + +rc-input@~1.6.0, rc-input@~1.6.3: + version "1.6.3" + resolved "https://registry.npmjs.org/rc-input/-/rc-input-1.6.3.tgz" + integrity sha512-wI4NzuqBS8vvKr8cljsvnTUqItMfG1QbJoxovCgL+DX4eVUcHIjVwharwevIxyy7H/jbLryh+K7ysnJr23aWIA== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.18.1" + +rc-mentions@~2.16.1: + version "2.16.1" + resolved "https://registry.npmjs.org/rc-mentions/-/rc-mentions-2.16.1.tgz" + integrity sha512-GnhSTGP9Mtv6pqFFGQze44LlrtWOjHNrUUAcsdo9DnNAhN4pwVPEWy4z+2jpjkiGlJ3VoXdvMHcNDQdfI9fEaw== + dependencies: + "@babel/runtime" "^7.22.5" + "@rc-component/trigger" "^2.0.0" + classnames "^2.2.6" + rc-input "~1.6.0" + rc-menu "~9.15.1" + rc-textarea "~1.8.0" + rc-util "^5.34.1" + +rc-menu@~9.15.1: + version "9.15.1" + resolved "https://registry.npmjs.org/rc-menu/-/rc-menu-9.15.1.tgz" + integrity sha512-UKporqU6LPfHnpPmtP6hdEK4iO5Q+b7BRv/uRpxdIyDGplZy9jwUjsnpev5bs3PQKB0H0n34WAPDfjAfn3kAPA== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^2.0.0" + classnames "2.x" + rc-motion "^2.4.3" + rc-overflow "^1.3.1" + rc-util "^5.27.0" + +rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.1, rc-motion@^2.6.2, rc-motion@^2.9.0, rc-motion@^2.9.3: + version "2.9.3" + resolved "https://registry.npmjs.org/rc-motion/-/rc-motion-2.9.3.tgz" + integrity sha512-rkW47ABVkic7WEB0EKJqzySpvDqwl60/tdkY7hWP7dYnh5pm0SzJpo54oW3TDUGXV5wfxXFmMkxrzRRbotQ0+w== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.43.0" + +rc-notification@~5.6.2: + version "5.6.2" + resolved "https://registry.npmjs.org/rc-notification/-/rc-notification-5.6.2.tgz" + integrity sha512-Id4IYMoii3zzrG0lB0gD6dPgJx4Iu95Xu0BQrhHIbp7ZnAZbLqdqQ73aIWH0d0UFcElxwaKjnzNovTjo7kXz7g== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.9.0" + rc-util "^5.20.1" + +rc-overflow@^1.3.1, rc-overflow@^1.3.2: + version "1.3.2" + resolved "https://registry.npmjs.org/rc-overflow/-/rc-overflow-1.3.2.tgz" + integrity sha512-nsUm78jkYAoPygDAcGZeC2VwIg/IBGSodtOY3pMof4W3M9qRJgqaDYm03ZayHlde3I6ipliAxbN0RUcGf5KOzw== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-resize-observer "^1.0.0" + rc-util "^5.37.0" + +rc-pagination@~4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/rc-pagination/-/rc-pagination-4.3.0.tgz" + integrity sha512-UubEWA0ShnroQ1tDa291Fzw6kj0iOeF26IsUObxYTpimgj4/qPCWVFl18RLZE+0Up1IZg0IK4pMn6nB3mjvB7g== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.3.2" + rc-util "^5.38.0" + +rc-picker@~4.6.15: + version "4.6.15" + resolved "https://registry.npmjs.org/rc-picker/-/rc-picker-4.6.15.tgz" + integrity sha512-OWZ1yrMie+KN2uEUfYCfS4b2Vu6RC1FWwNI0s+qypsc3wRt7g+peuZKVIzXCTaJwyyZruo80+akPg2+GmyiJjw== + dependencies: + "@babel/runtime" "^7.24.7" + "@rc-component/trigger" "^2.0.0" + classnames "^2.2.1" + rc-overflow "^1.3.2" + rc-resize-observer "^1.4.0" + rc-util "^5.43.0" + +rc-progress@~4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/rc-progress/-/rc-progress-4.0.0.tgz" + integrity sha512-oofVMMafOCokIUIBnZLNcOZFsABaUw8PPrf1/y0ZBvKZNpOiu5h4AO9vv11Sw0p4Hb3D0yGWuEattcQGtNJ/aw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + rc-util "^5.16.1" + +rc-rate@~2.13.0: + version "2.13.0" + resolved "https://registry.npmjs.org/rc-rate/-/rc-rate-2.13.0.tgz" + integrity sha512-oxvx1Q5k5wD30sjN5tqAyWTvJfLNNJn7Oq3IeS4HxWfAiC4BOXMITNAsw7u/fzdtO4MS8Ki8uRLOzcnEuoQiAw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-util "^5.0.1" + +rc-resize-observer@^1.0.0, rc-resize-observer@^1.1.0, rc-resize-observer@^1.3.1, rc-resize-observer@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/rc-resize-observer/-/rc-resize-observer-1.4.0.tgz" + integrity sha512-PnMVyRid9JLxFavTjeDXEXo65HCRqbmLBw9xX9gfC4BZiSzbLXKzW3jPz+J0P71pLbD5tBMTT+mkstV5gD0c9Q== + dependencies: + "@babel/runtime" "^7.20.7" + classnames "^2.2.1" + rc-util "^5.38.0" + resize-observer-polyfill "^1.5.1" + +rc-segmented@~2.5.0: + version "2.5.0" + resolved "https://registry.npmjs.org/rc-segmented/-/rc-segmented-2.5.0.tgz" + integrity sha512-B28Fe3J9iUFOhFJET3RoXAPFJ2u47QvLSYcZWC4tFYNGPEjug5LAxEasZlA/PpAxhdOPqGWsGbSj7ftneukJnw== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-motion "^2.4.4" + rc-util "^5.17.0" + +rc-select@~14.15.0, rc-select@~14.15.2: + version "14.15.2" + resolved "https://registry.npmjs.org/rc-select/-/rc-select-14.15.2.tgz" + integrity sha512-oNoXlaFmpqXYcQDzcPVLrEqS2J9c+/+oJuGrlXeVVX/gVgrbHa5YcyiRUXRydFjyuA7GP3elRuLF7Y3Tfwltlw== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^2.1.1" + classnames "2.x" + rc-motion "^2.0.1" + rc-overflow "^1.3.1" + rc-util "^5.16.1" + rc-virtual-list "^3.5.2" + +rc-slider@~11.1.7: + version "11.1.7" + resolved "https://registry.npmjs.org/rc-slider/-/rc-slider-11.1.7.tgz" + integrity sha512-ytYbZei81TX7otdC0QvoYD72XSlxvTihNth5OeZ6PMXyEDq/vHdWFulQmfDGyXK1NwKwSlKgpvINOa88uT5g2A== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-util "^5.36.0" + +rc-steps@~6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/rc-steps/-/rc-steps-6.0.1.tgz" + integrity sha512-lKHL+Sny0SeHkQKKDJlAjV5oZ8DwCdS2hFhAkIjuQt1/pB81M0cA0ErVFdHq9+jmPmFw1vJB2F5NBzFXLJxV+g== + dependencies: + "@babel/runtime" "^7.16.7" + classnames "^2.2.3" + rc-util "^5.16.1" + +rc-switch@~4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/rc-switch/-/rc-switch-4.1.0.tgz" + integrity sha512-TI8ufP2Az9oEbvyCeVE4+90PDSljGyuwix3fV58p7HV2o4wBnVToEyomJRVyTaZeqNPAp+vqeo4Wnj5u0ZZQBg== + dependencies: + "@babel/runtime" "^7.21.0" + classnames "^2.2.1" + rc-util "^5.30.0" + +rc-table@~7.47.5: + version "7.47.5" + resolved "https://registry.npmjs.org/rc-table/-/rc-table-7.47.5.tgz" + integrity sha512-fzq+V9j/atbPIcvs3emuclaEoXulwQpIiJA6/7ey52j8+9cJ4P8DGmp4YzfUVDrb3qhgedcVeD6eRgUrokwVEQ== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/context" "^1.4.0" + classnames "^2.2.5" + rc-resize-observer "^1.1.0" + rc-util "^5.41.0" + rc-virtual-list "^3.14.2" + +rc-tabs@~15.3.0: + version "15.3.0" + resolved "https://registry.npmjs.org/rc-tabs/-/rc-tabs-15.3.0.tgz" + integrity sha512-lzE18r+zppT/jZWOAWS6ntdkDUKHOLJzqMi5UAij1LeKwOaQaupupAoI9Srn73GRzVpmGznkECMRrzkRusC40A== + dependencies: + "@babel/runtime" "^7.11.2" + classnames "2.x" + rc-dropdown "~4.2.0" + rc-menu "~9.15.1" + rc-motion "^2.6.2" + rc-resize-observer "^1.0.0" + rc-util "^5.34.1" + +rc-textarea@~1.8.0, rc-textarea@~1.8.2: + version "1.8.2" + resolved "https://registry.npmjs.org/rc-textarea/-/rc-textarea-1.8.2.tgz" + integrity sha512-UFAezAqltyR00a8Lf0IPAyTd29Jj9ee8wt8DqXyDMal7r/Cg/nDt3e1OOv3Th4W6mKaZijjgwuPXhAfVNTN8sw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + rc-input "~1.6.0" + rc-resize-observer "^1.0.0" + rc-util "^5.27.0" + +rc-tooltip@~6.2.1: + version "6.2.1" + resolved "https://registry.npmjs.org/rc-tooltip/-/rc-tooltip-6.2.1.tgz" + integrity sha512-rws0duD/3sHHsD905Nex7FvoUGy2UBQRhTkKxeEvr2FB+r21HsOxcDJI0TzyO8NHhnAA8ILr8pfbSBg5Jj5KBg== + dependencies: + "@babel/runtime" "^7.11.2" + "@rc-component/trigger" "^2.0.0" + classnames "^2.3.1" + +rc-tree-select@~5.23.0: + version "5.23.0" + resolved "https://registry.npmjs.org/rc-tree-select/-/rc-tree-select-5.23.0.tgz" + integrity sha512-aQGi2tFSRw1WbXv0UVXPzHm09E0cSvUVZMLxQtMv3rnZZpNmdRXWrnd9QkLNlVH31F+X5rgghmdSFF3yZW0N9A== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-select "~14.15.0" + rc-tree "~5.9.0" + rc-util "^5.16.1" + +rc-tree@~5.9.0: + version "5.9.0" + resolved "https://registry.npmjs.org/rc-tree/-/rc-tree-5.9.0.tgz" + integrity sha512-CPrgOvm9d/9E+izTONKSngNzQdIEjMox2PBufWjS1wf7vxtvmCWzK1SlpHbRY6IaBfJIeZ+88RkcIevf729cRg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.0.1" + rc-util "^5.16.1" + rc-virtual-list "^3.5.1" + +rc-upload@~4.8.1: + version "4.8.1" + resolved "https://registry.npmjs.org/rc-upload/-/rc-upload-4.8.1.tgz" + integrity sha512-toEAhwl4hjLAI1u8/CgKWt30BR06ulPa4iGQSMvSXoHzO88gPCslxqV/mnn4gJU7PDoltGIC9Eh+wkeudqgHyw== + dependencies: + "@babel/runtime" "^7.18.3" + classnames "^2.2.5" + rc-util "^5.2.0" + +rc-util@^5.0.1, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.2.0, rc-util@^5.20.1, rc-util@^5.21.0, rc-util@^5.24.4, rc-util@^5.25.2, rc-util@^5.27.0, rc-util@^5.30.0, rc-util@^5.31.1, rc-util@^5.32.2, rc-util@^5.34.1, rc-util@^5.35.0, rc-util@^5.36.0, rc-util@^5.37.0, rc-util@^5.38.0, rc-util@^5.38.1, rc-util@^5.40.1, rc-util@^5.41.0, rc-util@^5.43.0: + version "5.43.0" + resolved "https://registry.npmjs.org/rc-util/-/rc-util-5.43.0.tgz" + integrity sha512-AzC7KKOXFqAdIBqdGWepL9Xn7cm3vnAmjlHqUnoQaTMZYhM4VlXGLkkHHxj/BZ7Td0+SOPKB4RGPboBVKT9htw== + dependencies: + "@babel/runtime" "^7.18.3" + react-is "^18.2.0" + +rc-virtual-list@^3.14.2, rc-virtual-list@^3.5.1, rc-virtual-list@^3.5.2: + version "3.14.8" + resolved "https://registry.npmjs.org/rc-virtual-list/-/rc-virtual-list-3.14.8.tgz" + integrity sha512-8D0KfzpRYi6YZvlOWIxiOm9BGt4Wf2hQyEaM6RXlDDiY2NhLheuYI+RA+7ZaZj1lq+XQqy3KHlaeeXQfzI5fGg== + dependencies: + "@babel/runtime" "^7.20.0" + classnames "^2.2.6" + rc-resize-observer "^1.0.0" + rc-util "^5.36.0" + +react-dom@18.2.0: + version "18.2.0" + resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" + integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== + dependencies: + loose-envify "^1.1.0" + scheduler "^0.23.0" + +react-dropzone@^14.2.9: + version "14.2.9" + resolved "https://registry.npmjs.org/react-dropzone/-/react-dropzone-14.2.9.tgz" + integrity sha512-jRZsMC7h48WONsOLHcmhyn3cRWJoIPQjPApvt/sJVfnYaB3Qltn025AoRTTJaj4WdmmgmLl6tUQg1s0wOhpodQ== + dependencies: + attr-accept "^2.2.2" + file-selector "^0.6.0" + prop-types "^15.8.1" + +react-fast-compare@^3.2.2: + version "3.2.2" + resolved "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz" + integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ== + +react-hook-form@^7.53.0: + version "7.53.0" + resolved "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.53.0.tgz" + integrity sha512-M1n3HhqCww6S2hxLxciEXy2oISPnAzxY7gvwVPrtlczTM/1dDadXgUxDpHMrMTblDOcm/AXtXxHwZ3jpg1mqKQ== + +react-is@^16.13.1: + version "16.13.1" + resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + +react-is@^18.2.0: + version "18.3.1" + resolved "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== + +react-redux@^9.1.2: + version "9.1.2" + resolved "https://registry.npmjs.org/react-redux/-/react-redux-9.1.2.tgz" + integrity sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w== + dependencies: + "@types/use-sync-external-store" "^0.0.3" + use-sync-external-store "^1.0.0" + +react-remove-scroll-bar@^2.3.3, react-remove-scroll-bar@^2.3.6: + version "2.3.6" + resolved "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.6.tgz" + integrity sha512-DtSYaao4mBmX+HDo5YWYdBWQwYIQQshUV/dVxFxK+KM26Wjwp1gZ6rv6OC3oujI6Bfu6Xyg3TwK533AQutsn/g== + dependencies: + react-style-singleton "^2.2.1" + tslib "^2.0.0" + +react-remove-scroll@2.5.5: + version "2.5.5" + resolved "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz" + integrity sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw== + dependencies: + react-remove-scroll-bar "^2.3.3" + react-style-singleton "^2.2.1" + tslib "^2.1.0" + use-callback-ref "^1.3.0" + use-sidecar "^1.1.2" + +react-remove-scroll@2.6.0: + version "2.6.0" + resolved "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.6.0.tgz" + integrity sha512-I2U4JVEsQenxDAKaVa3VZ/JeJZe0/2DxPWL8Tj8yLKctQJQiZM52pn/GWFpSp8dftjM3pSAHVJZscAnC/y+ySQ== + dependencies: + react-remove-scroll-bar "^2.3.6" + react-style-singleton "^2.2.1" + tslib "^2.1.0" + use-callback-ref "^1.3.0" + use-sidecar "^1.1.2" + +react-resizable-panels@^2.1.4: + version "2.1.4" + resolved "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-2.1.4.tgz" + integrity sha512-kzue8lsoSBdyyd2IfXLQMMhNujOxRoGVus+63K95fQqleGxTfvgYLTzbwYMOODeAHqnkjb3WV/Ks7f5+gDYZuQ== + +react-style-singleton@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.1.tgz" + integrity sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g== + dependencies: + get-nonce "^1.0.0" + invariant "^2.2.4" + tslib "^2.0.0" + +react-transition-group@^4.4.1: + version "4.4.5" + resolved "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz" + integrity sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g== + dependencies: + "@babel/runtime" "^7.5.5" + dom-helpers "^5.0.1" + loose-envify "^1.4.0" + prop-types "^15.6.2" + +react@18.2.0: + version "18.2.0" + resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" + integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== + dependencies: + loose-envify "^1.1.0" + +read-cache@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz" + integrity sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA== + dependencies: + pify "^2.3.0" + +readable-stream@^2.0.2, readable-stream@~2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +redux-thunk@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz" + integrity sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw== + +redux-undo@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/redux-undo/-/redux-undo-1.1.0.tgz" + integrity sha512-zzLFh2qeF0MTIlzDhDLm9NtkfBqCllQJ3OCuIl5RKlG/ayHw6GUdIFdMhzMS9NnrnWdBX5u//ExMOHpfudGGOg== + +redux@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz" + integrity sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w== + +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== + +replace-in-file@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-8.2.0.tgz#5284a5ce0f1a04f3118b9afd4e2dfc15250c7ba8" + integrity sha512-hMsQtdYHwWviQT5ZbNsgfu0WuCiNlcUSnnD+aHAL081kbU9dPkPocDaHlDvAHKydTWWpx1apfcEcmvIyQk3CpQ== + dependencies: + chalk "^5.3.0" + glob "^10.4.2" + yargs "^17.7.2" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +reselect@^5.1.0: + version "5.1.1" + resolved "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz" + integrity sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w== + +resize-observer-polyfill@^1.5.1: + version "1.5.1" + resolved "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + +resolve@^1.1.7, resolve@^1.22.2: + version "1.22.8" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +rxjs@^7.8.1: + version "7.8.1" + resolved "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +scheduler@^0.23.0: + version "0.23.2" + resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz" + integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== + dependencies: + loose-envify "^1.1.0" + +screenfull@^5.0.0: + version "5.2.0" + resolved "https://registry.npmjs.org/screenfull/-/screenfull-5.2.0.tgz" + integrity sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA== + +scroll-into-view-if-needed@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.1.0.tgz" + integrity sha512-49oNpRjWRvnU8NyGVmUaYG4jtTkNonFZI86MmGRDqBphEK2EXT9gdEUoQPZhuBM8yWHxCWbobltqYO5M4XrUvQ== + dependencies: + compute-scroll-into-view "^3.0.2" + +server-only@^0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/server-only/-/server-only-0.0.1.tgz" + integrity sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA== + +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^3.0.3: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + +sirv@^2.0.3: + version "2.0.4" + resolved "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz" + integrity sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ== + dependencies: + "@polka/url" "^1.0.0-next.24" + mrmime "^2.0.0" + totalist "^3.0.0" + +source-map-js@^1.0.2, source-map-js@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== + +streamsearch@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz" + integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== + +string-convert@^0.2.0: + version "0.2.1" + resolved "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz" + integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== + +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^7.0.1: + version "7.1.0" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz" + integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== + dependencies: + ansi-regex "^6.0.1" + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strnum@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" + integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== + +styled-jsx@5.1.1: + version "5.1.1" + resolved "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz" + integrity sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw== + dependencies: + client-only "0.0.1" + +stylis@^4.3.3: + version "4.3.4" + resolved "https://registry.npmjs.org/stylis/-/stylis-4.3.4.tgz" + integrity sha512-osIBl6BGUmSfDkyH2mB7EFvCJntXDrLhKjHTRj/rK6xLH0yuPrHULDRQzKokSOD4VoorhtKpfcfW1GAntu8now== + +sucrase@^3.32.0: + version "3.35.0" + resolved "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz" + integrity sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA== + dependencies: + "@jridgewell/gen-mapping" "^0.3.2" + commander "^4.0.0" + glob "^10.3.10" + lines-and-columns "^1.1.6" + mz "^2.7.0" + pirates "^4.0.1" + ts-interface-checker "^0.1.9" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +tailwind-merge@^2.5.2: + version "2.5.3" + resolved "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.5.3.tgz" + integrity sha512-d9ZolCAIzom1nf/5p4LdD5zvjmgSxY0BGgdSvmXIoMYAiPdAW/dSpP7joCDYFY7r/HkEa2qmPtkgsu0xjQeQtw== + +tailwindcss-animate@^1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/tailwindcss-animate/-/tailwindcss-animate-1.0.7.tgz" + integrity sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA== + +tailwindcss@3.4.1: + version "3.4.1" + resolved "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz" + integrity sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA== + dependencies: + "@alloc/quick-lru" "^5.2.0" + arg "^5.0.2" + chokidar "^3.5.3" + didyoumean "^1.2.2" + dlv "^1.1.3" + fast-glob "^3.3.0" + glob-parent "^6.0.2" + is-glob "^4.0.3" + jiti "^1.19.1" + lilconfig "^2.1.0" + micromatch "^4.0.5" + normalize-path "^3.0.0" + object-hash "^3.0.0" + picocolors "^1.0.0" + postcss "^8.4.23" + postcss-import "^15.1.0" + postcss-js "^4.0.1" + postcss-load-config "^4.0.1" + postcss-nested "^6.0.1" + postcss-selector-parser "^6.0.11" + resolve "^1.22.2" + sucrase "^3.32.0" + +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + +throttle-debounce@^5.0.0, throttle-debounce@^5.0.2: + version "5.0.2" + resolved "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-5.0.2.tgz" + integrity sha512-B71/4oyj61iNH0KeCamLuE2rmKuTO5byTOSVwECM5FA7TiAiAW+UqTKZ9ERueC4qvgSttUhdmq1mXC3kJqGX7A== + +tiny-invariant@^1.3.3: + version "1.3.3" + resolved "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz" + integrity sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz" + integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ== + +totalist@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz" + integrity sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ== + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + +ts-interface-checker@^0.1.9: + version "0.1.13" + resolved "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz" + integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== + +ts-plugin-sort-import-suggestions@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/ts-plugin-sort-import-suggestions/-/ts-plugin-sort-import-suggestions-1.0.4.tgz" + integrity sha512-85n5lm2OQQ+b7aRNK9omU1gmjMNXRsgeLwojm5u4OSY5sVBkAHTcgMQPEeHMNlyyfFW0uXnwgqAU0pNfhD96Bw== + +tslib@^2.0.0, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.6.2: + version "2.7.0" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + +typescript@5.3.3: + version "5.3.3" + resolved "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz" + integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +unique-names-generator@^4.7.1: + version "4.7.1" + resolved "https://registry.npmjs.org/unique-names-generator/-/unique-names-generator-4.7.1.tgz" + integrity sha512-lMx9dX+KRmG8sq6gulYYpKWZc9RlGsgBR6aoO8Qsm3qvkSJ+3rAymr+TnV8EDMrIrwuFJ4kruzMWM/OpYzPoow== + +universalify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" + integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== + +unzipper@^0.12.3: + version "0.12.3" + resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.12.3.tgz#31958f5eed7368ed8f57deae547e5a673e984f87" + integrity sha512-PZ8hTS+AqcGxsaQntl3IRBw65QrBI6lxzqDEL7IAo/XCEqRTKGfOX56Vea5TH9SZczRVxuzk1re04z/YjuYCJA== + dependencies: + bluebird "~3.7.2" + duplexer2 "~0.1.4" + fs-extra "^11.2.0" + graceful-fs "^4.2.2" + node-int64 "^0.4.0" + +update-browserslist-db@^1.1.0: + version "1.1.1" + resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz" + integrity sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A== + dependencies: + escalade "^3.2.0" + picocolors "^1.1.0" + +use-callback-ref@^1.3.0: + version "1.3.2" + resolved "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.2.tgz" + integrity sha512-elOQwe6Q8gqZgDA8mrh44qRTQqpIHDcZ3hXTLjBe1i4ph8XpNJnO+aQf3NaG+lriLopI4HMx9VjQLfPQ6vhnoA== + dependencies: + tslib "^2.0.0" + +use-sidecar@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz" + integrity sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw== + dependencies: + detect-node-es "^1.1.0" + tslib "^2.0.0" + +use-sound@^4.0.3: + version "4.0.3" + resolved "https://registry.npmjs.org/use-sound/-/use-sound-4.0.3.tgz" + integrity sha512-L205pEUFIrLsGYsCUKHQVCt0ajs//YQOFbEQeNwaWaqQj3y3st4SuR+rvpMHLmv8hgTcfUFlvMQawZNI3OE18w== + dependencies: + howler "^2.1.3" + +use-sync-external-store@^1.0.0: + version "1.2.2" + resolved "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz" + integrity sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw== + +util-deprecate@^1.0.2, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +uuid@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +webpack-bundle-analyzer@4.10.1: + version "4.10.1" + resolved "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.1.tgz" + integrity sha512-s3P7pgexgT/HTUSYgxJyn28A+99mmLq4HsJepMPzu0R8ImJc52QNqaFYW1Z2z2uIb1/J3eYgaAWVpaC+v/1aAQ== + dependencies: + "@discoveryjs/json-ext" "0.5.7" + acorn "^8.0.4" + acorn-walk "^8.0.0" + commander "^7.2.0" + debounce "^1.2.1" + escape-string-regexp "^4.0.0" + gzip-size "^6.0.0" + html-escaper "^2.0.2" + is-plain-object "^5.0.0" + opener "^1.5.2" + picocolors "^1.0.0" + sirv "^2.0.3" + ws "^7.3.1" + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +ws@^7.3.1: + version "7.5.10" + resolved "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz" + integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== + +ws@^8.14.2: + version "8.18.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yaml@^2.3.4: + version "2.5.1" + resolved "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz" + integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q== + +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs@^17.7.2: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +zod@^3.23.8: + version "3.23.8" + resolved "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz" + integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==