typegpu 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/chunk-3K53YJSU.cjs +10 -0
  2. package/chunk-3K53YJSU.cjs.map +1 -0
  3. package/chunk-BF35NEOX.cjs +43 -0
  4. package/chunk-BF35NEOX.cjs.map +1 -0
  5. package/chunk-IH2QU6TV.js +43 -0
  6. package/chunk-IH2QU6TV.js.map +1 -0
  7. package/chunk-S27MYQ6U.js +10 -0
  8. package/chunk-S27MYQ6U.js.map +1 -0
  9. package/data/index.cjs +1 -1
  10. package/data/index.cjs.map +1 -1
  11. package/data/index.d.cts +3 -3
  12. package/data/index.d.ts +3 -3
  13. package/data/index.js +1 -1
  14. package/index.cjs +18 -29
  15. package/index.cjs.map +1 -1
  16. package/index.d.cts +38 -3
  17. package/index.d.ts +38 -3
  18. package/index.js +18 -29
  19. package/index.js.map +1 -1
  20. package/{matrix-S8W4dk8I.d.ts → matrix-BXuR-7-A.d.ts} +1 -1
  21. package/{matrix-BN6ObiMv.d.cts → matrix-DzXuhOr3.d.cts} +1 -1
  22. package/package.json +1 -1
  23. package/std/index.cjs +1 -1
  24. package/std/index.cjs.map +1 -1
  25. package/std/index.d.cts +22 -9
  26. package/std/index.d.ts +22 -9
  27. package/std/index.js +1 -1
  28. package/std/index.js.map +1 -1
  29. package/{tgpuComputeFn-DOUjhQua.d.ts → tgpuConstant-BAmV6caN.d.cts} +3171 -2970
  30. package/{tgpuComputeFn-DOUjhQua.d.cts → tgpuConstant-BAmV6caN.d.ts} +3171 -2970
  31. package/chunk-APTRHY5Y.js +0 -41
  32. package/chunk-APTRHY5Y.js.map +0 -1
  33. package/chunk-RC26P3MP.cjs +0 -2
  34. package/chunk-RC26P3MP.cjs.map +0 -1
  35. package/chunk-RK6TMFVW.js +0 -2
  36. package/chunk-RK6TMFVW.js.map +0 -1
  37. package/chunk-S62QJDM6.js +0 -2
  38. package/chunk-S62QJDM6.js.map +0 -1
  39. package/chunk-TG4A6AM3.cjs +0 -2
  40. package/chunk-TG4A6AM3.cjs.map +0 -1
  41. package/chunk-UMHCZDPA.cjs +0 -41
  42. package/chunk-UMHCZDPA.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/shared/symbols.ts","../src/shared/env.ts","../src/shared/meta.ts","../src/errors.ts","../src/data/matrix.ts","../src/data/vectorOps.ts"],"names":["version","$internal","$wgslDataType","$gpuValueOf","$getNameForward","$providing","$repr","$gpuRepr","$reprPartial","$memIdent","$validStorageSchema","$validUniformSchema","$validVertexSchema","$invalidSchemaReason","DEV","TEST","exp","label","isNamable","getName","globalWithMeta","PERF","name","data","records","entries","isForwarded","value","definition","getMetaData","setName","setMetaData","metaData","map","prefix","invariant","condition","message","provided","_IllegalBufferAccessError","op"],"mappings":"AAGE,uzBAAAA,CAAAA,CAAW,OAAA,CCEN,IAAMC,CAAAA,CAAY,MAAA,CAAO,CAAA,QAAA,EAAWD,CAAO,CAAA,UAAA,CAAY,CAAA,CAIjDE,EAAAA,aAAgB,MAAA,CAAO,CAAA,QAAA,EAAWF,CAAO,CAAA,cAAA,CAAgB,CAAA,CAIzDG,EAAAA,aAAc,MAAA,CAAO,CAAA,QAAA,EAAWH,CAAO,CAAA,YAAA,CAAc,CAAA,CACrDI,EAAAA,aAAkB,MAAA,CAAO,CAAA,QAAA,EAAWJ,CAAO,CAAA,gBAAA,CAAkB,CAAA,CAI7DK,EAAAA,aAAa,MAAA,CAAO,CAAA,QAAA,EAAWL,CAAO,CAAA,WAAA,CAAa,CAAA,CASnDM,EAAAA,aAAQ,MAAA,CAAO,CAAA,QAAA,EAAWN,CAAO,CAAA,MAAA,CAAQ,CAAA,CAKzCO,EAAAA,aAAW,MAAA,CAAO,CAAA,QAAA,EAAWP,CAAO,CAAA,SAAA,CAAW,CAAA,CAK/CQ,EAAAA,CAAe,MAAA,CAAO,CAAA,QAAA,EAAWR,CAAO,CAAA,aAAA,CAAe,CAAA,CAIvDS,EAAAA,CAAY,MAAA,CAAO,CAAA,QAAA,EAAWT,CAAO,CAAA,UAAA,CAAY,CAAA,CAKjDU,EAAAA,CAAsB,MAAA,CACjC,CAAA,QAAA,EAAWV,CAAO,CAAA,sBAAA,CACpB,CAAA,CAIaW,EAAAA,CAAsB,MAAA,CACjC,CAAA,QAAA,EAAWX,CAAO,CAAA,oBAAA,CACpB,CAAA,CAIaY,EAAAA,CAAqB,MAAA,CAChC,CAAA,QAAA,EAAWZ,CAAO,CAAA,mBAAA,CACpB,CAAA,CAIaa,EAAAA,CAAuB,MAAA,CAClC,CAAA,QAAA,EAAWb,CAAO,CAAA,qBAAA,CACpB,CAAA,CC3DO,IAAMc,EAAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,aAAA,CAE1CC,EAAAA,CAAO,UAAA,CAAW,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,MAAA,CCsBxD,MAAA,CAAO,MAAA,CAAO,UAAA,CAAY,CACxB,oBAAA,CAAwB,CAAIC,CAAAA,CAAQC,CAAAA,CAAAA,EAClCC,EAAAA,CAAUF,CAAG,CAAA,kBACVA,CAAAA,4BAAAA,CAA8Cf,CAAS,GAAA,EAAK,CAACkB,EAAAA,CAAQH,CAAG,CAAA,CACvEA,CAAAA,CAAI,KAAA,CAAMC,CAAK,CAAA,CACfD,CACR,CAAC,CAAA,CAED,IAAMI,EAAAA,CAAiB,UAAA,CAKVC,EAAAA,aAAAA,CAAQP,EAAAA,EAAOC,EAAAA,CAAAA,EAAU,CAChC,IAAI,OAAA,CAAA,CAAU,CACZ,MAAO,CAAC,CAACK,EAAAA,CAAe,wBAC1B,CAAA,CACA,MAAA,CAAOE,CAAAA,CAAcC,CAAAA,CAAe,CAElC,IAAMC,CAAAA,CAAWJ,EAAAA,CAAe,wBAAA,GAA6B,IAAI,GAAA,CAC7DK,CAAAA,CAAUD,CAAAA,CAAQ,GAAA,CAAIF,CAAI,CAAA,CACzBG,CAAAA,EAAAA,CACHA,CAAAA,CAAU,CAAC,CAAA,CACXD,CAAAA,CAAQ,GAAA,CAAIF,CAAAA,CAAMG,CAAO,CAAA,CAAA,CAE3BA,CAAAA,CAAQ,IAAA,CAAKF,CAAI,CACnB,CACF,CAAA,EAAM,KAAA,CAAA,CAEV,SAASG,EAAAA,CAAYC,CAAAA,CAAyD,CAC5E,MAAO,CAAC,iBAAEA,CAAAA,4BAAAA,CAA4CvB,EAAe,GACvE,CAEO,SAASe,EAAAA,CAAQS,CAAAA,CAAyC,CAC/D,OAAIF,EAAAA,CAAYE,CAAU,CAAA,CACjBT,EAAAA,CAAQS,CAAAA,CAAWxB,EAAe,CAAC,CAAA,iBAErCyB,EAAAA,mBAAYD,CAAU,CAAA,6BAAG,MAClC,CAEO,SAASE,EAAAA,CAAQF,CAAAA,CAAoBN,CAAAA,CAAoB,CAC9DS,EAAAA,CAAYH,CAAAA,CAAY,CAAE,IAAA,CAAAN,CAAK,CAAC,CAClC,CAYO,SAASJ,EAAAA,CAAUS,CAAAA,CAAsC,CAC9D,MAAO,CAAC,iBAAEA,CAAAA,6BAAuB,OACnC,CAEO,SAASE,EAAAA,CACdD,CAAAA,CACsB,CACtB,OAAOR,EAAAA,CAAe,gBAAA,CAAiB,GAAA,CAErCQ,CACF,CACF,CAEO,SAASG,EAAAA,CAAYH,CAAAA,CAAoBI,CAAAA,CAAkB,CAChEZ,EAAAA,CAAe,gBAAA,GAAqB,IAAI,OAAA,CACxC,IAAMa,CAAAA,CAAMb,EAAAA,CAAe,gBAAA,CAC3Ba,CAAAA,CAAI,GAAA,CAAIL,CAAAA,CAAY,CAAE,GAAGK,CAAAA,CAAI,GAAA,CAAIL,CAAU,CAAA,CAAG,GAAGI,CAAS,CAAC,CAC7D,CC7FA,IAAME,EAAAA,CAAS,kBAAA,CAKR,SAASC,EAAAA,CACdC,CAAAA,CACAC,CAAAA,CACmB,CACnB,EAAA,CAAID,CAAAA,CAEF,MAAA,CAIF,EAAA,CAAI,CAACtB,EAAAA,CACH,MAAM,IAAI,KAAA,CAAMoB,EAAM,CAAA,CAMxB,IAAMI,CAAAA,CAAW,OAAOD,CAAAA,EAAY,UAAA,CAAaA,CAAAA,CAAQ,CAAA,CAAIA,CAAAA,CAKvDV,CAAAA,CAAQW,CAAAA,CAAW,CAAA,EAAA;AAwBqC;AAqC1D;AAAyD;AAmG/BC;ACsVrB;AAAA;AAkBA,KAAA;AAAA;AAAA;AAAA;AAmBA,KAAA;AAAA;AAAA;AAAA;AAAA;AAkCA,KAAA;AAAA;AAAA;AAAA;AAIiD,QAAA;AAwBjD,OAAA;AACW,QAAA;AACG,WAAA;AACG,cAAA;AAAA;AA0BtB,OAAA;AAAA;AAEmC,eAAA;AACC,gBAAA;AAAA;AA0BpC,OAAA;AACoC,YAAA;AAAA;AAED,YAAA;AAAA;AA0BnC,OAAA;AACgC,YAAA;AACC,aAAA;AAAA;AAAA;ACrnB/BC,OAAAA","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-BF35NEOX.cjs","sourcesContent":["{\n \"name\": \"typegpu\",\n \"private\": true,\n \"version\": \"0.7.0\",\n \"description\": \"A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.\",\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"exports\": {\n \"./package.json\": \"./package.json\",\n \".\": \"./src/index.ts\",\n \"./data\": \"./src/data/index.ts\",\n \"./std\": \"./src/std/index.ts\"\n },\n \"publishConfig\": {\n \"directory\": \"dist\",\n \"linkDirectory\": false,\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \"./package.json\": \"./dist/package.json\",\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"module\": \"./dist/index.js\",\n \"import\": \"./dist/index.js\",\n \"default\": \"./dist/index.cjs\"\n },\n \"./data\": {\n \"types\": \"./dist/data/index.d.ts\",\n \"module\": \"./dist/data/index.js\",\n \"import\": \"./dist/data/index.js\",\n \"default\": \"./dist/data/index.cjs\"\n },\n \"./std\": {\n \"types\": \"./dist/std/index.d.ts\",\n \"module\": \"./dist/std/index.js\",\n \"import\": \"./dist/std/index.js\",\n \"default\": \"./dist/std/index.cjs\"\n }\n }\n },\n \"sideEffects\": false,\n \"scripts\": {\n \"build\": \"tsup\",\n \"test:types\": \"pnpm tsc --p ./tsconfig.test.json --noEmit\",\n \"prepublishOnly\": \"tgpu-dev-cli prepack\"\n },\n \"engines\": {\n \"node\": \">=12.20.0\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/software-mansion/TypeGPU.git\"\n },\n \"keywords\": [\n \"webgpu\",\n \"wgpu\",\n \"wgsl\",\n \"typescript\",\n \"compute\",\n \"shader\",\n \"shaders\",\n \"gpgpu\"\n ],\n \"bugs\": {\n \"url\": \"https://github.com/software-mansion/TypeGPU/issues\"\n },\n \"homepage\": \"https://typegpu.com\",\n \"devDependencies\": {\n \"@ark/attest\": \"^0.46.0\",\n \"@typegpu/tgpu-dev-cli\": \"workspace:*\",\n \"@webgpu/types\": \"catalog:types\",\n \"arktype\": \"catalog:\",\n \"jiti\": \"catalog:build\",\n \"tsup\": \"catalog:build\",\n \"typescript\": \"catalog:types\",\n \"unplugin-typegpu\": \"workspace:*\",\n \"wesl\": \"0.6.7\",\n \"wgpu-matrix\": \"catalog:example\"\n },\n \"packageManager\": \"pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af\",\n \"dependencies\": {\n \"tinyest\": \"workspace:~0.1.1\",\n \"typed-binary\": \"^4.3.1\"\n }\n}\n","// The version is inlined during build-time 🎉\n// It helps us identify problems when two versions of\n// TypeGPU are used at the same time.\nimport { version } from '../../package.json';\n\nexport const $internal = Symbol(`typegpu:${version}:$internal`);\n/**\n * A value's data type as seen by the WGSL generator\n */\nexport const $wgslDataType = Symbol(`typegpu:${version}:$wgslDataType`);\n/**\n * The getter to the value of this resource, accessible on the GPU\n */\nexport const $gpuValueOf = Symbol(`typegpu:${version}:$gpuValueOf`);\nexport const $getNameForward = Symbol(`typegpu:${version}:$getNameForward`);\n/**\n * Marks an object with slot-value bindings\n */\nexport const $providing = Symbol(`typegpu:${version}:$providing`);\n\n//\n// Type tokens\n//\n\n/**\n * Type token for the inferred (CPU & GPU) representation of a resource\n */\nexport const $repr = Symbol(`typegpu:${version}:$repr`);\n/**\n * Type token for the inferred (GPU-side) representation of a resource\n * If present, it shadows the value of `$repr` for GPU-side inference.\n */\nexport const $gpuRepr = Symbol(`typegpu:${version}:$gpuRepr`);\n/**\n * Type token for the inferred partial representation of a resource.\n * If present, it shadows the value of `$repr` for use in partial IO.\n */\nexport const $reprPartial = Symbol(`typegpu:${version}:$reprPartial`);\n/**\n * Type token holding schemas that are identical in memory layout.\n */\nexport const $memIdent = Symbol(`typegpu:${version}:$memIdent`);\n\n/**\n * Type token, signaling that a schema can be used in a storage buffer.\n */\nexport const $validStorageSchema = Symbol(\n `typegpu:${version}:$invalidStorageSchema`,\n);\n/**\n * Type token, signaling that a schema can be used in a uniform buffer.\n */\nexport const $validUniformSchema = Symbol(\n `typegpu:${version}:$validUniformSchema`,\n);\n/**\n * Type token, signaling that a schema can be used in a vertex buffer.\n */\nexport const $validVertexSchema = Symbol(\n `typegpu:${version}:$validVertexSchema`,\n);\n/**\n * Type token, containing a reason for why the schema is invalid (if it is).\n */\nexport const $invalidSchemaReason = Symbol(\n `typegpu:${version}:$invalidSchemaReason`,\n);\n","/**\n * This can be used to branch functionality between \"dev\" and \"prod\" modes, so that our\n * library can omit doing unnecessary work once it's out in the wild\n *\n * Even though the value of this constant uses Node.js specific APIs, pretty much every\n * bundler replaces the expression below with either `development` or `production`\n */\nexport const DEV = globalThis.process.env.NODE_ENV === 'development';\n\nexport const TEST = globalThis.process.env.NODE_ENV === 'test';\n","import type { Block, FuncParameter } from 'tinyest';\nimport { $getNameForward, $internal } from './symbols.ts';\nimport { DEV, TEST } from './env.ts';\n\nexport interface MetaData {\n name?: string | undefined;\n ast?: {\n v: number;\n params: FuncParameter[];\n body: Block;\n externalNames: string[];\n } | undefined;\n externals?: Record<string, unknown> | undefined;\n}\n\n/**\n * Don't use or you WILL get fired from your job.\n *\n * The information that this type describes is additional\n * properties that we add onto `globalThis`, used by tools\n * like `unplugin-typegpu` or our test suite.\n *\n * @internal\n */\nexport type INTERNAL_GlobalExt = typeof globalThis & {\n __TYPEGPU_META__: WeakMap<object, MetaData>;\n __TYPEGPU_AUTONAME__: <T>(exp: T, label: string) => T;\n __TYPEGPU_MEASURE_PERF__?: boolean | undefined;\n __TYPEGPU_PERF_RECORDS__?: Map<string, unknown[]> | undefined;\n};\n\nObject.assign(globalThis, {\n '__TYPEGPU_AUTONAME__': <T>(exp: T, label: string): T =>\n isNamable(exp) &&\n (exp as unknown as { [$internal]: unknown })?.[$internal] && !getName(exp)\n ? exp.$name(label)\n : exp,\n});\n\nconst globalWithMeta = globalThis as INTERNAL_GlobalExt;\n\n/**\n * Performance measurements are only enabled in dev & test environments for now\n */\nexport const PERF = (DEV || TEST) && ({\n get enabled() {\n return !!globalWithMeta.__TYPEGPU_MEASURE_PERF__;\n },\n record(name: string, data: unknown) {\n // biome-ignore lint/suspicious/noAssignInExpressions: it's fine\n const records = (globalWithMeta.__TYPEGPU_PERF_RECORDS__ ??= new Map());\n let entries = records.get(name);\n if (!entries) {\n entries = [];\n records.set(name, entries);\n }\n entries.push(data);\n },\n }) || undefined;\n\nfunction isForwarded(value: unknown): value is { [$getNameForward]: unknown } {\n return !!(value as { [$getNameForward]?: unknown })?.[$getNameForward];\n}\n\nexport function getName(definition: unknown): string | undefined {\n if (isForwarded(definition)) {\n return getName(definition[$getNameForward]);\n }\n return getMetaData(definition)?.name;\n}\n\nexport function setName(definition: object, name: string): void {\n setMetaData(definition, { name });\n}\n\n/**\n * Can be assigned a name. Not to be confused with\n * being able to HAVE a name.\n * The `$name` function should use `setName` to rename the object itself,\n * or rename the object `$getNameForward` symbol points to instead if applicable.\n */\nexport interface TgpuNamable {\n $name(label: string): this;\n}\n\nexport function isNamable(value: unknown): value is TgpuNamable {\n return !!(value as TgpuNamable)?.$name;\n}\n\nexport function getMetaData(\n definition: unknown,\n): MetaData | undefined {\n return globalWithMeta.__TYPEGPU_META__.get(\n // it's fine, if it's not an object, the get will return undefined\n definition as object,\n );\n}\n\nexport function setMetaData(definition: object, metaData: object) {\n globalWithMeta.__TYPEGPU_META__ ??= new WeakMap();\n const map = globalWithMeta.__TYPEGPU_META__;\n map.set(definition, { ...map.get(definition), ...metaData });\n}\n","import type { TgpuBuffer } from './core/buffer/buffer.ts';\nimport type { TgpuSlot } from './core/slot/slotTypes.ts';\nimport type { TgpuVertexLayout } from './core/vertexLayout/vertexLayout.ts';\nimport type { AnyData, Disarray } from './data/dataTypes.ts';\nimport type { WgslArray } from './data/wgslTypes.ts';\nimport { getName } from './shared/meta.ts';\nimport { DEV } from './shared/env.ts';\nimport type { TgpuBindGroupLayout } from './tgpuBindGroupLayout.ts';\n\nconst prefix = 'Invariant failed';\n\n/**\n * Inspired by: https://github.com/alexreardon/tiny-invariant/blob/master/src/tiny-invariant.ts\n */\nexport function invariant(\n condition: unknown,\n message?: string | (() => string),\n): asserts condition {\n if (condition) {\n // Condition passed\n return;\n }\n\n // In production we strip the message but still throw\n if (!DEV) {\n throw new Error(prefix);\n }\n\n // When not in production we allow the message to pass through\n // *This block will be removed in production builds*\n\n const provided = typeof message === 'function' ? message() : message;\n\n // Options:\n // 1. message provided: `${prefix}: ${provided}`\n // 2. message not provided: prefix\n const value = provided ? `${prefix}: ${provided}` : prefix;\n throw new Error(value);\n}\n\n/**\n * An error that happens during resolution of WGSL code.\n * Contains a trace of all ancestor resolvables in\n * which this error originated.\n *\n * @category Errors\n */\nexport class ResolutionError extends Error {\n constructor(\n public readonly cause: unknown,\n public readonly trace: unknown[],\n ) {\n let entries = trace.map((ancestor) => `- ${ancestor}`);\n\n // Showing only the root and leaf nodes.\n if (entries.length > 20) {\n entries = [...entries.slice(0, 11), '...', ...entries.slice(-10)];\n }\n\n super(\n `Resolution of the following tree failed:\\n${entries.join('\\n')}: ${\n cause && typeof cause === 'object' && 'message' in cause\n ? cause.message\n : cause\n }`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, ResolutionError.prototype);\n }\n\n appendToTrace(ancestor: unknown): ResolutionError {\n const newTrace = [ancestor, ...this.trace];\n\n return new ResolutionError(this.cause, newTrace);\n }\n}\n\n/**\n * An error that happens during execution of TypeGPU functions.\n * Contains a trace of all TypeGPU functions called along the way.\n *\n * @category Errors\n */\nexport class ExecutionError extends Error {\n constructor(\n public readonly cause: unknown,\n public readonly trace: unknown[],\n ) {\n let entries = trace.map((ancestor) => `- ${ancestor}`);\n\n // Showing only the root and leaf nodes.\n if (entries.length > 20) {\n entries = [...entries.slice(0, 11), '...', ...entries.slice(-10)];\n }\n\n super(\n `Execution of the following tree failed:\\n${entries.join('\\n')}: ${\n cause && typeof cause === 'object' && 'message' in cause\n ? cause.message\n : cause\n }`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, ExecutionError.prototype);\n }\n\n appendToTrace(ancestor: unknown): ExecutionError {\n const newTrace = [ancestor, ...this.trace];\n\n return new ExecutionError(this.cause, newTrace);\n }\n}\n\n/**\n * @category Errors\n */\nexport class MissingSlotValueError extends Error {\n constructor(public readonly slot: TgpuSlot<unknown>) {\n super(`Missing value for '${slot}'`);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingSlotValueError.prototype);\n }\n}\n\n/**\n * @category Errors\n */\nexport class NotUniformError extends Error {\n constructor(value: TgpuBuffer<AnyData>) {\n super(\n `Buffer '${\n getName(value) ?? '<unnamed>'\n }' is not bindable as a uniform. Use .$usage('uniform') to allow it.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, NotUniformError.prototype);\n }\n}\n\nexport class MissingLinksError extends Error {\n constructor(fnLabel: string | undefined, externalNames: string[]) {\n super(\n `The function '${\n fnLabel ?? '<unnamed>'\n }' is missing links to the following external values: ${externalNames}.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingLinksError.prototype);\n }\n}\n\nexport class MissingBindGroupsError extends Error {\n constructor(layouts: Iterable<TgpuBindGroupLayout>) {\n super(\n `Missing bind groups for layouts: '${\n [...layouts].map((layout) => getName(layout) ?? '<unnamed>').join(', ')\n }'. Please provide it using pipeline.with(layout, bindGroup).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingBindGroupsError.prototype);\n }\n}\n\nexport class MissingVertexBuffersError extends Error {\n constructor(layouts: Iterable<TgpuVertexLayout<WgslArray | Disarray>>) {\n super(\n `Missing vertex buffers for layouts: '${\n [...layouts].map((layout) => getName(layout) ?? '<unnamed>').join(', ')\n }'. Please provide it using pipeline.with(layout, buffer).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingVertexBuffersError.prototype);\n }\n}\n\nexport class IllegalVarAccessError extends Error {\n constructor(msg: string) {\n super(msg);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, IllegalVarAccessError.prototype);\n }\n}\n\nexport class IllegalBufferAccessError extends Error {\n constructor(msg: string) {\n super(msg);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, IllegalBufferAccessError.prototype);\n }\n}\n\nexport class WgslTypeError extends Error {\n constructor(msg: string) {\n super(msg);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, WgslTypeError.prototype);\n }\n}\n","import { createDualImpl } from '../core/function/dualImpl.ts';\nimport type { $repr } from '../shared/symbols.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { SelfResolvable } from '../types.ts';\nimport { snip } from './snippet.ts';\nimport { vec2f, vec3f, vec4f } from './vector.ts';\nimport type {\n AnyWgslData,\n m2x2f,\n m3x3f,\n m4x4f,\n mat2x2,\n Mat2x2f,\n mat3x3,\n Mat3x3f,\n mat4x4,\n Mat4x4f,\n NumberArrayView,\n v2f,\n v3f,\n v4f,\n VecKind,\n} from './wgslTypes.ts';\n\n// --------------\n// Implementation\n// --------------\n\ntype vBase = {\n kind: VecKind;\n length: number;\n [n: number]: number;\n};\n\nexport abstract class MatBase<TColumn> implements NumberArrayView {\n abstract readonly [$internal]: true;\n abstract readonly columns: readonly TColumn[];\n\n abstract readonly length: number;\n abstract [Symbol.iterator](): Iterator<number>;\n [n: number]: number;\n}\n\ninterface MatSchemaOptions<TType extends string, ColumnType> {\n type: TType;\n rows: 2 | 3 | 4;\n columns: 2 | 3 | 4;\n MatImpl: new (...args: number[]) => MatBase<ColumnType>;\n}\n\ntype MatConstructor<\n ValueType extends MatBase<ColumnType>,\n ColumnType extends vBase,\n> = (...args: (number | ColumnType)[]) => ValueType;\n\nfunction createMatSchema<\n TType extends string,\n ValueType extends MatBase<ColumnType>,\n ColumnType extends vBase,\n>(\n options: MatSchemaOptions<TType, ColumnType>,\n): { type: TType; [$repr]: ValueType } & MatConstructor<ValueType, ColumnType> {\n const MatSchema = {\n [$internal]: true,\n type: options.type,\n identity: identityFunctions[options.columns],\n translation: options.columns === 4 ? translation4 : undefined,\n scaling: options.columns === 4 ? scaling4 : undefined,\n rotationX: options.columns === 4 ? rotationX4 : undefined,\n rotationY: options.columns === 4 ? rotationY4 : undefined,\n rotationZ: options.columns === 4 ? rotationZ4 : undefined,\n } as unknown as AnyWgslData;\n\n const construct = createDualImpl(\n // CPU implementation\n (...args: (number | ColumnType)[]): ValueType => {\n const elements: number[] = [];\n\n for (const arg of args) {\n if (typeof arg === 'number') {\n elements.push(arg);\n } else {\n for (let i = 0; i < arg.length; ++i) {\n elements.push(arg[i] as number);\n }\n }\n }\n\n if (\n elements.length !== 0 &&\n elements.length !== options.columns * options.rows\n ) {\n throw new Error(\n `'${options.type}' constructor called with invalid number of arguments.`,\n );\n }\n\n for (let i = elements.length; i < options.columns * options.rows; ++i) {\n elements.push(0);\n }\n\n return new options.MatImpl(...elements) as ValueType;\n },\n // GPU implementation\n (...args) =>\n snip(\n `${MatSchema.type}(${args.map((v) => v.value).join(', ')})`,\n MatSchema,\n ),\n MatSchema.type,\n );\n\n return Object.assign(construct, MatSchema) as unknown as {\n type: TType;\n [$repr]: ValueType;\n } & MatConstructor<ValueType, ColumnType>;\n}\n\nabstract class mat2x2Impl<TColumn extends v2f> extends MatBase<TColumn>\n implements mat2x2<TColumn>, SelfResolvable {\n public readonly [$internal] = true;\n public readonly columns: readonly [TColumn, TColumn];\n public readonly length = 4;\n public abstract readonly kind: string;\n [n: number]: number;\n\n constructor(...elements: number[]) {\n super();\n this.columns = [\n this.makeColumn(elements[0] as number, elements[1] as number),\n this.makeColumn(elements[2] as number, elements[3] as number),\n ];\n }\n\n abstract makeColumn(e0: number, e1: number): TColumn;\n\n get [0]() {\n return this.columns[0].x;\n }\n\n get [1]() {\n return this.columns[0].y;\n }\n\n get [2]() {\n return this.columns[1].x;\n }\n\n get [3]() {\n return this.columns[1].y;\n }\n\n set [0](value: number) {\n this.columns[0].x = value;\n }\n\n set [1](value: number) {\n this.columns[0].y = value;\n }\n\n set [2](value: number) {\n this.columns[1].x = value;\n }\n\n set [3](value: number) {\n this.columns[1].y = value;\n }\n\n *[Symbol.iterator]() {\n yield this[0];\n yield this[1];\n yield this[2];\n yield this[3];\n }\n\n '~resolve'(): string {\n return `${this.kind}(${\n Array.from({ length: this.length })\n .map((_, i) => this[i])\n .join(', ')\n })`;\n }\n}\n\nclass mat2x2fImpl extends mat2x2Impl<v2f> {\n public readonly kind = 'mat2x2f';\n\n makeColumn(e0: number, e1: number): v2f {\n return vec2f(e0, e1);\n }\n}\n\nabstract class mat3x3Impl<TColumn extends v3f> extends MatBase<TColumn>\n implements mat3x3<TColumn>, SelfResolvable {\n public readonly [$internal] = true;\n public readonly columns: readonly [TColumn, TColumn, TColumn];\n public readonly length = 12;\n public abstract readonly kind: string;\n [n: number]: number;\n\n constructor(...elements: number[]) {\n super();\n this.columns = [\n this.makeColumn(\n elements[0] as number,\n elements[1] as number,\n elements[2] as number,\n ),\n this.makeColumn(\n elements[3] as number,\n elements[4] as number,\n elements[5] as number,\n ),\n this.makeColumn(\n elements[6] as number,\n elements[7] as number,\n elements[8] as number,\n ),\n ];\n }\n\n abstract makeColumn(x: number, y: number, z: number): TColumn;\n\n get [0]() {\n return this.columns[0].x;\n }\n\n get [1]() {\n return this.columns[0].y;\n }\n\n get [2]() {\n return this.columns[0].z;\n }\n\n get [3]() {\n return 0;\n }\n\n get [4]() {\n return this.columns[1].x;\n }\n\n get [5]() {\n return this.columns[1].y;\n }\n\n get [6]() {\n return this.columns[1].z;\n }\n\n get [7]() {\n return 0;\n }\n\n get [8]() {\n return this.columns[2].x;\n }\n\n get [9]() {\n return this.columns[2].y;\n }\n\n get [10]() {\n return this.columns[2].z;\n }\n\n get [11]() {\n return 0;\n }\n\n set [0](value: number) {\n this.columns[0].x = value;\n }\n\n set [1](value: number) {\n this.columns[0].y = value;\n }\n\n set [2](value: number) {\n this.columns[0].z = value;\n }\n\n set [3](_: number) {}\n\n set [4](value: number) {\n this.columns[1].x = value;\n }\n\n set [5](value: number) {\n this.columns[1].y = value;\n }\n\n set [6](value: number) {\n this.columns[1].z = value;\n }\n\n set [7](_: number) {}\n\n set [8](value: number) {\n this.columns[2].x = value;\n }\n\n set [9](value: number) {\n this.columns[2].y = value;\n }\n\n set [10](value: number) {\n this.columns[2].z = value;\n }\n\n set [11](_: number) {}\n\n *[Symbol.iterator]() {\n for (let i = 0; i < 12; i++) {\n yield this[i] as number;\n }\n }\n\n '~resolve'(): string {\n return `${this.kind}(${this[0]}, ${this[1]}, ${this[2]}, ${this[4]}, ${\n this[5]\n }, ${this[6]}, ${this[8]}, ${this[9]}, ${this[10]})`;\n }\n}\n\nclass mat3x3fImpl extends mat3x3Impl<v3f> {\n public readonly kind = 'mat3x3f';\n makeColumn(x: number, y: number, z: number): v3f {\n return vec3f(x, y, z);\n }\n}\n\nabstract class mat4x4Impl<TColumn extends v4f> extends MatBase<TColumn>\n implements mat4x4<TColumn>, SelfResolvable {\n public readonly [$internal] = true;\n public readonly columns: readonly [TColumn, TColumn, TColumn, TColumn];\n public abstract readonly kind: string;\n\n constructor(...elements: number[]) {\n super();\n this.columns = [\n this.makeColumn(\n elements[0] as number,\n elements[1] as number,\n elements[2] as number,\n elements[3] as number,\n ),\n this.makeColumn(\n elements[4] as number,\n elements[5] as number,\n elements[6] as number,\n elements[7] as number,\n ),\n this.makeColumn(\n elements[8] as number,\n elements[9] as number,\n elements[10] as number,\n elements[11] as number,\n ),\n this.makeColumn(\n elements[12] as number,\n elements[13] as number,\n elements[14] as number,\n elements[15] as number,\n ),\n ];\n }\n\n abstract makeColumn(x: number, y: number, z: number, w: number): TColumn;\n\n public readonly length = 16;\n [n: number]: number;\n\n get [0]() {\n return this.columns[0].x;\n }\n\n get [1]() {\n return this.columns[0].y;\n }\n\n get [2]() {\n return this.columns[0].z;\n }\n\n get [3]() {\n return this.columns[0].w;\n }\n\n get [4]() {\n return this.columns[1].x;\n }\n\n get [5]() {\n return this.columns[1].y;\n }\n\n get [6]() {\n return this.columns[1].z;\n }\n\n get [7]() {\n return this.columns[1].w;\n }\n\n get [8]() {\n return this.columns[2].x;\n }\n\n get [9]() {\n return this.columns[2].y;\n }\n\n get [10]() {\n return this.columns[2].z;\n }\n\n get [11]() {\n return this.columns[2].w;\n }\n\n get [12]() {\n return this.columns[3].x;\n }\n\n get [13]() {\n return this.columns[3].y;\n }\n\n get [14]() {\n return this.columns[3].z;\n }\n\n get [15]() {\n return this.columns[3].w;\n }\n\n set [0](value: number) {\n this.columns[0].x = value;\n }\n\n set [1](value: number) {\n this.columns[0].y = value;\n }\n\n set [2](value: number) {\n this.columns[0].z = value;\n }\n\n set [3](value: number) {\n this.columns[0].w = value;\n }\n\n set [4](value: number) {\n this.columns[1].x = value;\n }\n\n set [5](value: number) {\n this.columns[1].y = value;\n }\n\n set [6](value: number) {\n this.columns[1].z = value;\n }\n\n set [7](value: number) {\n this.columns[1].w = value;\n }\n\n set [8](value: number) {\n this.columns[2].x = value;\n }\n\n set [9](value: number) {\n this.columns[2].y = value;\n }\n\n set [10](value: number) {\n this.columns[2].z = value;\n }\n\n set [11](value: number) {\n this.columns[2].w = value;\n }\n\n set [12](value: number) {\n this.columns[3].x = value;\n }\n\n set [13](value: number) {\n this.columns[3].y = value;\n }\n\n set [14](value: number) {\n this.columns[3].z = value;\n }\n\n set [15](value: number) {\n this.columns[3].w = value;\n }\n\n *[Symbol.iterator]() {\n for (let i = 0; i < 16; i++) {\n yield this[i] as number;\n }\n }\n\n '~resolve'(): string {\n return `${this.kind}(${\n Array.from({ length: this.length })\n .map((_, i) => this[i])\n .join(', ')\n })`;\n }\n}\n\nclass mat4x4fImpl extends mat4x4Impl<v4f> {\n public readonly kind = 'mat4x4f';\n\n makeColumn(x: number, y: number, z: number, w: number): v4f {\n return vec4f(x, y, z, w);\n }\n}\n\n// ----------\n// Matrix ops\n// ----------\n\n/**\n * Returns a 2-by-2 identity matrix.\n * @returns {m2x2f} The result matrix.\n */\nexport const identity2 = createDualImpl(\n // CPU implementation\n () => mat2x2f(1, 0, 0, 1),\n // GPU implementation\n () => ({\n value: `mat4x4f(\n 1.0, 0.0,\n 0.0, 1.0\n )`,\n dataType: mat2x2f,\n }),\n 'identity2',\n);\n\n/**\n * Returns a 3-by-3 identity matrix.\n * @returns {m3x3f} The result matrix.\n */\nexport const identity3 = createDualImpl(\n // CPU implementation\n () => mat3x3f(1, 0, 0, 0, 1, 0, 0, 0, 1),\n // GPU implementation\n () => ({\n value: `mat4x4f(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0,\n )`,\n dataType: mat3x3f,\n }),\n 'identity3',\n);\n\n/**\n * Returns a 4-by-4 identity matrix.\n * @returns {m4x4f} The result matrix.\n */\nexport const identity4 = createDualImpl(\n // CPU implementation\n () => mat4x4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),\n // GPU implementation\n () => ({\n value: `mat4x4f(\n 1.0, 0.0, 0.0, 0.0,\n 0.0, 1.0, 0.0, 0.0,\n 0.0, 0.0, 1.0, 0.0,\n 0.0, 0.0, 0.0, 1.0\n )`,\n dataType: mat4x4f,\n }),\n 'identity4',\n);\n\nconst identityFunctions = {\n 2: identity2,\n 3: identity3,\n 4: identity4,\n};\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param {v3f} vector - The vector by which to translate.\n * @returns {m4x4f} The translation matrix.\n */\nexport const translation4 = createDualImpl(\n // CPU implementation\n (vector: v3f) =>\n // deno-fmt-ignore\n mat4x4f(\n 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n vector.x, vector.y, vector.z, 1,\n ),\n // GPU implementation\n (vector) => ({\n value: `mat4x4f(\n 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n ${vector.value}.x, ${vector.value}.y, ${vector.value}.z, 1\n )`,\n dataType: mat4x4f,\n }),\n 'translation4',\n);\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by the corresponding entry in the given vector.\n * @param {v3f} vector - A vector of three entries specifying the factor by which to scale in each dimension.\n * @returns {m4x4f} The scaling matrix.\n */\nexport const scaling4 = createDualImpl(\n // CPU implementation\n (vector: v3f) =>\n // deno-fmt-ignore\n mat4x4f(\n vector.x, 0, 0, 0,\n 0, vector.y, 0, 0,\n 0, 0, vector.z, 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (vector) => ({\n value: `mat4x4f(\n ${vector.value}.x, 0, 0, 0,\n 0, ${vector.value}.y, 0, 0,\n 0, 0, ${vector.value}.z, 0,\n 0, 0, 0, 1\n )`,\n dataType: mat4x4f,\n }),\n 'scaling4',\n);\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotation matrix.\n */\nexport const rotationX4 = createDualImpl(\n // CPU implementation\n (a: number) =>\n // deno-fmt-ignore\n mat4x4f(\n 1, 0, 0, 0,\n 0, Math.cos(a), Math.sin(a), 0,\n 0, -Math.sin(a), Math.cos(a), 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (a) =>\n snip(\n `mat4x4f(\n 1, 0, 0, 0,\n 0, cos(${a.value}), sin(${a.value}), 0,\n 0, -sin(${a.value}), cos(${a.value}), 0,\n 0, 0, 0, 1\n )`,\n mat4x4f,\n ),\n 'rotationX4',\n);\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotation matrix.\n */\nexport const rotationY4 = createDualImpl(\n // CPU implementation\n (a: number) =>\n // deno-fmt-ignore\n mat4x4f(\n Math.cos(a), 0, -Math.sin(a), 0,\n 0, 1, 0, 0,\n Math.sin(a), 0, Math.cos(a), 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (a) =>\n snip(\n `mat4x4f(\n cos(${a.value}), 0, -sin(${a.value}), 0,\n 0, 1, 0, 0,\n sin(${a.value}), 0, cos(${a.value}), 0,\n 0, 0, 0, 1\n )`,\n mat4x4f,\n ),\n 'rotationY4',\n);\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotation matrix.\n */\nexport const rotationZ4 = createDualImpl(\n // CPU implementation\n (a: number) =>\n // deno-fmt-ignore\n mat4x4f(\n Math.cos(a), Math.sin(a), 0, 0,\n -Math.sin(a), Math.cos(a), 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1,\n ),\n // GPU implementation\n (a) =>\n snip(\n `mat4x4f(\n cos(${a.value}), sin(${a.value}), 0, 0,\n -sin(${a.value}), cos(${a.value}), 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1\n )`,\n mat4x4f,\n ),\n 'rotationZ4',\n);\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Schema representing mat2x2f - a matrix with 2 rows and 2 columns, with elements of type f32.\n * Also a constructor function for this matrix type.\n *\n * @example\n * const zero2x2 = mat2x2f(); // filled with zeros\n *\n * @example\n * const mat = mat2x2f(0, 1, 2, 3);\n * mat.columns[0] // vec2f(0, 1)\n * mat.columns[1] // vec2f(2, 3)\n *\n * @example\n * const mat = mat2x2f(\n * vec2f(0, 1), // column 0\n * vec2f(1, 2), // column 1\n * );\n *\n * @example\n * const buffer = root.createBuffer(d.mat2x2f, d.mat2x2f(0, 1, 2, 3)); // buffer holding a d.mat2x2f value, with an initial value of ((0, 1), (2, 3))\n */\nexport const mat2x2f = createMatSchema<'mat2x2f', m2x2f, v2f>({\n type: 'mat2x2f',\n rows: 2,\n columns: 2,\n MatImpl: mat2x2fImpl,\n}) as Mat2x2f;\n\n/**\n * Schema representing mat3x3f - a matrix with 3 rows and 3 columns, with elements of type f32.\n * Also a constructor function for this matrix type.\n *\n * @example\n * const zero3x3 = mat3x3f(); // filled with zeros\n *\n * @example\n * const mat = mat3x3f(0, 1, 2, 3, 4, 5, 6, 7, 8);\n * mat.columns[0] // vec3f(0, 1, 2)\n * mat.columns[1] // vec3f(3, 4, 5)\n * mat.columns[2] // vec3f(6, 7, 8)\n *\n * @example\n * const mat = mat3x3f(\n * vec3f(0, 1, 2), // column 0\n * vec3f(2, 3, 4), // column 1\n * vec3f(5, 6, 7), // column 2\n * );\n *\n * @example\n * const buffer = root.createBuffer(d.mat3x3f, d.mat3x3f()); // buffer holding a d.mat3x3f value, with an initial value of mat3x3f filled with zeros\n */\nexport const mat3x3f = createMatSchema<'mat3x3f', m3x3f, v3f>({\n type: 'mat3x3f',\n rows: 3,\n columns: 3,\n MatImpl: mat3x3fImpl,\n}) as Mat3x3f;\n\n/**\n * Schema representing mat4x4f - a matrix with 4 rows and 4 columns, with elements of type f32.\n * Also a constructor function for this matrix type.\n *\n * @example\n * const zero4x4 = mat4x4f(); // filled with zeros\n *\n * @example\n * const mat = mat4x4f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);\n * mat.columns[0] // vec4f(0, 1, 2, 3)\n * mat.columns[1] // vec4f(4, 5, 6, 7)\n * mat.columns[2] // vec4f(8, 9, 10, 11)\n * mat.columns[3] // vec4f(12, 13, 14, 15)\n *\n * @example\n * const mat = mat4x4f(\n * vec4f(0, 1, 2, 3), // column 0\n * vec4f(4, 5, 6, 7), // column 1\n * vec4f(8, 9, 10, 11), // column 2\n * vec4f(12, 13, 14, 15), // column 3\n * );\n *\n * @example\n * const buffer = root.createBuffer(d.mat4x4f, d.mat4x4f()); // buffer holding a d.mat4x4f value, with an initial value of mat4x4f filled with zeros\n */\nexport const mat4x4f = createMatSchema<'mat4x4f', m4x4f, v4f>({\n type: 'mat4x4f',\n rows: 4,\n columns: 4,\n MatImpl: mat4x4fImpl,\n}) as Mat4x4f;\n\nexport function matToArray(mat: m2x2f | m3x3f | m4x4f): number[] {\n if (mat.kind === 'mat3x3f') {\n return [\n mat[0],\n mat[1],\n mat[2],\n mat[4],\n mat[5],\n mat[6],\n mat[8],\n mat[9],\n mat[10],\n ] as number[];\n }\n\n return Array.from({ length: mat.length }).map((_, idx) => mat[idx] as number);\n}\n","import { mat2x2f, mat3x3f, mat4x4f } from './matrix.ts';\nimport { clamp, divInteger, smoothstepScalar } from './numberOps.ts';\nimport {\n vec2b,\n vec2f,\n vec2h,\n vec2i,\n vec2u,\n vec3b,\n vec3f,\n vec3h,\n vec3i,\n vec3u,\n vec4b,\n vec4f,\n vec4h,\n vec4i,\n vec4u,\n} from './vector.ts';\nimport type * as wgsl from './wgslTypes.ts';\nimport type { VecKind } from './wgslTypes.ts';\n\ntype vBase = { kind: VecKind };\ntype mBase = { kind: MatKind };\ntype v2 = wgsl.v2f | wgsl.v2h | wgsl.v2i | wgsl.v2u;\ntype v3 = wgsl.v3f | wgsl.v3h | wgsl.v3i | wgsl.v3u;\ntype v4 = wgsl.v4f | wgsl.v4h | wgsl.v4i | wgsl.v4u;\n\ntype MatKind = 'mat2x2f' | 'mat3x3f' | 'mat4x4f';\n\nconst lengthVec2 = (v: v2) => Math.sqrt(v.x ** 2 + v.y ** 2);\nconst lengthVec3 = (v: v3) => Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);\nconst lengthVec4 = (v: v4) =>\n Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2 + v.w ** 2);\n\nconst dotVec2 = (lhs: v2, rhs: v2) => lhs.x * rhs.x + lhs.y * rhs.y;\nconst dotVec3 = (lhs: v3, rhs: v3) =>\n lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z;\nconst dotVec4 = (lhs: v4, rhs: v4) =>\n lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z + lhs.w * rhs.w;\n\ntype UnaryOp = (a: number) => number;\ntype BinaryOp = (a: number, b: number) => number;\n\nconst unary2f = (op: UnaryOp) => (a: wgsl.v2f) => vec2f(op(a.x), op(a.y));\nconst unary2h = (op: UnaryOp) => (a: wgsl.v2h) => vec2h(op(a.x), op(a.y));\nconst unary2i = (op: UnaryOp) => (a: wgsl.v2i) => vec2i(op(a.x), op(a.y));\nconst unary2u = (op: UnaryOp) => (a: wgsl.v2u) => vec2u(op(a.x), op(a.y));\n\nconst unary3f = (op: UnaryOp) => (a: wgsl.v3f) =>\n vec3f(op(a.x), op(a.y), op(a.z));\n\nconst unary3h = (op: UnaryOp) => (a: wgsl.v3h) =>\n vec3h(op(a.x), op(a.y), op(a.z));\n\nconst unary3i = (op: UnaryOp) => (a: wgsl.v3i) =>\n vec3i(op(a.x), op(a.y), op(a.z));\n\nconst unary3u = (op: UnaryOp) => (a: wgsl.v3u) =>\n vec3u(op(a.x), op(a.y), op(a.z));\n\nconst unary4f = (op: UnaryOp) => (a: wgsl.v4f) =>\n vec4f(op(a.x), op(a.y), op(a.z), op(a.w));\n\nconst unary4h = (op: UnaryOp) => (a: wgsl.v4h) =>\n vec4h(op(a.x), op(a.y), op(a.z), op(a.w));\n\nconst unary4i = (op: UnaryOp) => (a: wgsl.v4i) =>\n vec4i(op(a.x), op(a.y), op(a.z), op(a.w));\n\nconst unary4u = (op: UnaryOp) => (a: wgsl.v4u) =>\n vec4u(op(a.x), op(a.y), op(a.z), op(a.w));\n\nconst unary2x2f = (op: UnaryOp) => (a: wgsl.m2x2f) => {\n const a_ = a.columns as [wgsl.v2f, wgsl.v2f];\n return mat2x2f(unary2f(op)(a_[0]), unary2f(op)(a_[1]));\n};\n\nconst unary3x3f = (op: UnaryOp) => (a: wgsl.m3x3f) => {\n const a_ = a.columns as [wgsl.v3f, wgsl.v3f, wgsl.v3f];\n return mat3x3f(unary3f(op)(a_[0]), unary3f(op)(a_[1]), unary3f(op)(a_[2]));\n};\n\nconst unary4x4f = (op: UnaryOp) => (a: wgsl.m4x4f) => {\n const a_ = a.columns as [wgsl.v4f, wgsl.v4f, wgsl.v4f, wgsl.v4f];\n return mat4x4f(\n unary4f(op)(a_[0]),\n unary4f(op)(a_[1]),\n unary4f(op)(a_[2]),\n unary4f(op)(a_[3]),\n );\n};\n\nconst binaryComponentWise2f = (op: BinaryOp) => (a: wgsl.v2f, b: wgsl.v2f) =>\n vec2f(op(a.x, b.x), op(a.y, b.y));\n\nconst binaryComponentWise2h = (op: BinaryOp) => (a: wgsl.v2h, b: wgsl.v2h) =>\n vec2h(op(a.x, b.x), op(a.y, b.y));\n\nconst binaryComponentWise2i = (op: BinaryOp) => (a: wgsl.v2i, b: wgsl.v2i) =>\n vec2i(op(a.x, b.x), op(a.y, b.y));\n\nconst binaryComponentWise2u = (op: BinaryOp) => (a: wgsl.v2u, b: wgsl.v2u) =>\n vec2u(op(a.x, b.x), op(a.y, b.y));\n\nconst binaryComponentWise3f = (op: BinaryOp) => (a: wgsl.v3f, b: wgsl.v3f) =>\n vec3f(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));\n\nconst binaryComponentWise3h = (op: BinaryOp) => (a: wgsl.v3h, b: wgsl.v3h) =>\n vec3h(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));\n\nconst binaryComponentWise3i = (op: BinaryOp) => (a: wgsl.v3i, b: wgsl.v3i) =>\n vec3i(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));\n\nconst binaryComponentWise3u = (op: BinaryOp) => (a: wgsl.v3u, b: wgsl.v3u) =>\n vec3u(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z));\n\nconst binaryComponentWise4f = (op: BinaryOp) => (a: wgsl.v4f, b: wgsl.v4f) =>\n vec4f(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));\n\nconst binaryComponentWise4h = (op: BinaryOp) => (a: wgsl.v4h, b: wgsl.v4h) =>\n vec4h(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));\n\nconst binaryComponentWise4i = (op: BinaryOp) => (a: wgsl.v4i, b: wgsl.v4i) =>\n vec4i(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));\n\nconst binaryComponentWise4u = (op: BinaryOp) => (a: wgsl.v4u, b: wgsl.v4u) =>\n vec4u(op(a.x, b.x), op(a.y, b.y), op(a.z, b.z), op(a.w, b.w));\n\nconst binaryComponentWise2x2f =\n (op: BinaryOp) => (a: wgsl.m2x2f, b: wgsl.m2x2f) => {\n const a_ = a.columns as [wgsl.v2f, wgsl.v2f];\n const b_ = b.columns as [wgsl.v2f, wgsl.v2f];\n return mat2x2f(\n binaryComponentWise2f(op)(a_[0], b_[0]),\n binaryComponentWise2f(op)(a_[1], b_[1]),\n );\n };\n\nconst binaryComponentWise3x3f =\n (op: BinaryOp) => (a: wgsl.m3x3f, b: wgsl.m3x3f) => {\n const a_ = a.columns as [wgsl.v3f, wgsl.v3f, wgsl.v3f];\n const b_ = b.columns as [wgsl.v3f, wgsl.v3f, wgsl.v3f];\n return mat3x3f(\n binaryComponentWise3f(op)(a_[0], b_[0]),\n binaryComponentWise3f(op)(a_[1], b_[1]),\n binaryComponentWise3f(op)(a_[2], b_[2]),\n );\n };\n\nconst binaryComponentWise4x4f =\n (op: BinaryOp) => (a: wgsl.m4x4f, b: wgsl.m4x4f) => {\n const a_ = a.columns as [wgsl.v4f, wgsl.v4f, wgsl.v4f, wgsl.v4f];\n const b_ = b.columns as [wgsl.v4f, wgsl.v4f, wgsl.v4f, wgsl.v4f];\n return mat4x4f(\n binaryComponentWise4f(op)(a_[0], b_[0]),\n binaryComponentWise4f(op)(a_[1], b_[1]),\n binaryComponentWise4f(op)(a_[2], b_[2]),\n binaryComponentWise4f(op)(a_[3], b_[3]),\n );\n };\n\ntype TernaryOp = (a: number, b: number, c: number) => number;\n\nconst ternaryComponentWise2f =\n (op: TernaryOp) => (a: wgsl.v2f, b: wgsl.v2f, c: wgsl.v2f) =>\n vec2f(op(a.x, b.x, c.x), op(a.y, b.y, c.y));\n\nconst ternaryComponentWise2h =\n (op: TernaryOp) => (a: wgsl.v2h, b: wgsl.v2h, c: wgsl.v2h) =>\n vec2h(op(a.x, b.x, c.x), op(a.y, b.y, c.y));\n\nconst ternaryComponentWise3f =\n (op: TernaryOp) => (a: wgsl.v3f, b: wgsl.v3f, c: wgsl.v3f) =>\n vec3f(op(a.x, b.x, c.x), op(a.y, b.y, c.y), op(a.z, b.z, c.z));\n\nconst ternaryComponentWise3h =\n (op: TernaryOp) => (a: wgsl.v3h, b: wgsl.v3h, c: wgsl.v3h) =>\n vec3h(op(a.x, b.x, c.x), op(a.y, b.y, c.y), op(a.z, b.z, c.z));\n\nconst ternaryComponentWise4f =\n (op: TernaryOp) => (a: wgsl.v4f, b: wgsl.v4f, c: wgsl.v4f) =>\n vec4f(\n op(a.x, b.x, c.x),\n op(a.y, b.y, c.y),\n op(a.z, b.z, c.z),\n op(a.w, b.w, c.w),\n );\n\nconst ternaryComponentWise4h =\n (op: TernaryOp) => (a: wgsl.v4h, b: wgsl.v4h, c: wgsl.v4h) =>\n vec4h(\n op(a.x, b.x, c.x),\n op(a.y, b.y, c.y),\n op(a.z, b.z, c.z),\n op(a.w, b.w, c.w),\n );\n\nexport const VectorOps = {\n eq: {\n vec2f: (e1: wgsl.v2f, e2: wgsl.v2f) => vec2b(e1.x === e2.x, e1.y === e2.y),\n vec2h: (e1: wgsl.v2h, e2: wgsl.v2h) => vec2b(e1.x === e2.x, e1.y === e2.y),\n vec2i: (e1: wgsl.v2i, e2: wgsl.v2i) => vec2b(e1.x === e2.x, e1.y === e2.y),\n vec2u: (e1: wgsl.v2u, e2: wgsl.v2u) => vec2b(e1.x === e2.x, e1.y === e2.y),\n 'vec2<bool>': (e1: wgsl.v2b, e2: wgsl.v2b) =>\n vec2b(e1.x === e2.x, e1.y === e2.y),\n\n vec3f: (e1: wgsl.v3f, e2: wgsl.v3f) =>\n vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),\n vec3h: (e1: wgsl.v3h, e2: wgsl.v3h) =>\n vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),\n vec3i: (e1: wgsl.v3i, e2: wgsl.v3i) =>\n vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),\n vec3u: (e1: wgsl.v3u, e2: wgsl.v3u) =>\n vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),\n 'vec3<bool>': (e1: wgsl.v3b, e2: wgsl.v3b) =>\n vec3b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z),\n\n vec4f: (e1: wgsl.v4f, e2: wgsl.v4f) =>\n vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),\n vec4h: (e1: wgsl.v4h, e2: wgsl.v4h) =>\n vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),\n vec4i: (e1: wgsl.v4i, e2: wgsl.v4i) =>\n vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),\n vec4u: (e1: wgsl.v4u, e2: wgsl.v4u) =>\n vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),\n 'vec4<bool>': (e1: wgsl.v4b, e2: wgsl.v4b) =>\n vec4b(e1.x === e2.x, e1.y === e2.y, e1.z === e2.z, e1.w === e2.w),\n } as Record<\n VecKind,\n <T extends wgsl.AnyVecInstance>(\n e1: T,\n e2: T,\n ) => T extends wgsl.AnyVec2Instance ? wgsl.v2b\n : T extends wgsl.AnyVec3Instance ? wgsl.v3b\n : wgsl.v4b\n >,\n\n lt: {\n vec2f: (e1: wgsl.v2f, e2: wgsl.v2f) => vec2b(e1.x < e2.x, e1.y < e2.y),\n vec2h: (e1: wgsl.v2h, e2: wgsl.v2h) => vec2b(e1.x < e2.x, e1.y < e2.y),\n vec2i: (e1: wgsl.v2i, e2: wgsl.v2i) => vec2b(e1.x < e2.x, e1.y < e2.y),\n vec2u: (e1: wgsl.v2u, e2: wgsl.v2u) => vec2b(e1.x < e2.x, e1.y < e2.y),\n\n vec3f: (e1: wgsl.v3f, e2: wgsl.v3f) =>\n vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),\n vec3h: (e1: wgsl.v3h, e2: wgsl.v3h) =>\n vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),\n vec3i: (e1: wgsl.v3i, e2: wgsl.v3i) =>\n vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),\n vec3u: (e1: wgsl.v3u, e2: wgsl.v3u) =>\n vec3b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z),\n\n vec4f: (e1: wgsl.v4f, e2: wgsl.v4f) =>\n vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w),\n vec4h: (e1: wgsl.v4h, e2: wgsl.v4h) =>\n vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w),\n vec4i: (e1: wgsl.v4i, e2: wgsl.v4i) =>\n vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w),\n vec4u: (e1: wgsl.v4u, e2: wgsl.v4u) =>\n vec4b(e1.x < e2.x, e1.y < e2.y, e1.z < e2.z, e1.w < e2.w),\n } as Record<\n VecKind,\n <T extends wgsl.AnyNumericVecInstance>(\n e1: T,\n e2: T,\n ) => T extends wgsl.AnyVec2Instance ? wgsl.v2b\n : T extends wgsl.AnyVec3Instance ? wgsl.v3b\n : wgsl.v4b\n >,\n\n or: {\n 'vec2<bool>': (e1: wgsl.v2b, e2: wgsl.v2b) =>\n vec2b(e1.x || e2.x, e1.y || e2.y),\n 'vec3<bool>': (e1: wgsl.v3b, e2: wgsl.v3b) =>\n vec3b(e1.x || e2.x, e1.y || e2.y, e1.z || e2.z),\n 'vec4<bool>': (e1: wgsl.v4b, e2: wgsl.v4b) =>\n vec4b(e1.x || e2.x, e1.y || e2.y, e1.z || e2.z, e1.w || e2.w),\n } as Record<\n VecKind,\n <T extends wgsl.AnyBooleanVecInstance>(e1: T, e2: T) => T\n >,\n\n all: {\n 'vec2<bool>': (e: wgsl.v2b) => e.x && e.y,\n 'vec3<bool>': (e: wgsl.v3b) => e.x && e.y && e.z,\n 'vec4<bool>': (e: wgsl.v4b) => e.x && e.y && e.z && e.w,\n } as Record<VecKind, (v: wgsl.AnyBooleanVecInstance) => boolean>,\n\n abs: {\n vec2f: unary2f(Math.abs),\n vec2h: unary2h(Math.abs),\n vec2i: unary2i(Math.abs),\n vec2u: unary2u(Math.abs),\n\n vec3f: unary3f(Math.abs),\n vec3h: unary3h(Math.abs),\n vec3i: unary3i(Math.abs),\n vec3u: unary3u(Math.abs),\n\n vec4f: unary4f(Math.abs),\n vec4h: unary4h(Math.abs),\n vec4i: unary4i(Math.abs),\n vec4u: unary4u(Math.abs),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n atan2: {\n vec2f: binaryComponentWise2f(Math.atan2),\n vec2h: binaryComponentWise2h(Math.atan2),\n\n vec3f: binaryComponentWise3f(Math.atan2),\n vec3h: binaryComponentWise3h(Math.atan2),\n\n vec4f: binaryComponentWise4f(Math.atan2),\n vec4h: binaryComponentWise4h(Math.atan2),\n } as Record<VecKind, <T extends vBase>(a: T, b: T) => T>,\n\n acos: {\n vec2f: unary2f(Math.acos),\n vec2h: unary2h(Math.acos),\n vec2i: unary2i(Math.acos),\n vec2u: unary2u(Math.acos),\n\n vec3f: unary3f(Math.acos),\n vec3h: unary3h(Math.acos),\n vec3i: unary3i(Math.acos),\n vec3u: unary3u(Math.acos),\n\n vec4f: unary4f(Math.acos),\n vec4h: unary4h(Math.acos),\n vec4i: unary4i(Math.acos),\n vec4u: unary4u(Math.acos),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n acosh: {\n vec2f: unary2f(Math.acosh),\n vec2h: unary2h(Math.acosh),\n\n vec3f: unary3f(Math.acosh),\n vec3h: unary3h(Math.acosh),\n\n vec4f: unary4f(Math.acosh),\n vec4h: unary4h(Math.acosh),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n asin: {\n vec2f: unary2f(Math.asin),\n vec2h: unary2h(Math.asin),\n vec2i: unary2i(Math.asin),\n vec2u: unary2u(Math.asin),\n\n vec3f: unary3f(Math.asin),\n vec3h: unary3h(Math.asin),\n vec3i: unary3i(Math.asin),\n vec3u: unary3u(Math.asin),\n\n vec4f: unary4f(Math.asin),\n vec4h: unary4h(Math.asin),\n vec4i: unary4i(Math.asin),\n vec4u: unary4u(Math.asin),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n ceil: {\n vec2f: unary2f(Math.ceil),\n vec2h: unary2h(Math.ceil),\n\n vec3f: unary3f(Math.ceil),\n vec3h: unary3h(Math.ceil),\n\n vec4f: unary4f(Math.ceil),\n vec4h: unary4h(Math.ceil),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n clamp: {\n vec2f: (v: wgsl.v2f, low: wgsl.v2f, high: wgsl.v2f) =>\n vec2f(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),\n vec2h: (v: wgsl.v2h, low: wgsl.v2h, high: wgsl.v2h) =>\n vec2h(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),\n vec2i: (v: wgsl.v2i, low: wgsl.v2i, high: wgsl.v2i) =>\n vec2i(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),\n vec2u: (v: wgsl.v2u, low: wgsl.v2u, high: wgsl.v2u) =>\n vec2u(clamp(v.x, low.x, high.x), clamp(v.y, low.y, high.y)),\n\n vec3f: (v: wgsl.v3f, low: wgsl.v3f, high: wgsl.v3f) =>\n vec3f(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n ),\n vec3h: (v: wgsl.v3h, low: wgsl.v3h, high: wgsl.v3h) =>\n vec3h(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n ),\n vec3i: (v: wgsl.v3i, low: wgsl.v3i, high: wgsl.v3f) =>\n vec3i(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n ),\n vec3u: (v: wgsl.v3u, low: wgsl.v3u, high: wgsl.v3f) =>\n vec3u(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n ),\n\n vec4f: (v: wgsl.v4f, low: wgsl.v4f, high: wgsl.v4f) =>\n vec4f(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n clamp(v.w, low.w, high.w),\n ),\n vec4h: (v: wgsl.v4h, low: wgsl.v4h, high: wgsl.v4h) =>\n vec4h(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n clamp(v.w, low.w, high.w),\n ),\n vec4i: (v: wgsl.v4i, low: wgsl.v4i, high: wgsl.v4i) =>\n vec4i(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n clamp(v.w, low.w, high.w),\n ),\n vec4u: (v: wgsl.v4u, low: wgsl.v4u, high: wgsl.v4u) =>\n vec4u(\n clamp(v.x, low.x, high.x),\n clamp(v.y, low.y, high.y),\n clamp(v.z, low.z, high.z),\n clamp(v.w, low.w, high.w),\n ),\n } as Record<VecKind, <T extends vBase>(v: T, low: T, high: T) => T>,\n\n length: {\n vec2f: lengthVec2,\n vec2h: lengthVec2,\n\n vec3f: lengthVec3,\n vec3h: lengthVec3,\n\n vec4f: lengthVec4,\n vec4h: lengthVec4,\n } as Record<VecKind, (v: vBase) => number>,\n\n add: {\n vec2f: binaryComponentWise2f((a, b) => a + b),\n vec2h: binaryComponentWise2h((a, b) => a + b),\n vec2i: binaryComponentWise2i((a, b) => a + b),\n vec2u: binaryComponentWise2u((a, b) => a + b),\n\n vec3f: binaryComponentWise3f((a, b) => a + b),\n vec3h: binaryComponentWise3h((a, b) => a + b),\n vec3i: binaryComponentWise3i((a, b) => a + b),\n vec3u: binaryComponentWise3u((a, b) => a + b),\n\n vec4f: binaryComponentWise4f((a, b) => a + b),\n vec4h: binaryComponentWise4h((a, b) => a + b),\n vec4i: binaryComponentWise4i((a, b) => a + b),\n vec4u: binaryComponentWise4u((a, b) => a + b),\n\n mat2x2f: binaryComponentWise2x2f((a, b) => a + b),\n mat3x3f: binaryComponentWise3x3f((a, b) => a + b),\n mat4x4f: binaryComponentWise4x4f((a, b) => a + b),\n } as Record<\n VecKind | MatKind,\n <T extends vBase | mBase>(lhs: T, rhs: T) => T\n >,\n\n smoothstep: {\n vec2f: ternaryComponentWise2f(smoothstepScalar),\n vec2h: ternaryComponentWise2h(smoothstepScalar),\n vec3f: ternaryComponentWise3f(smoothstepScalar),\n vec3h: ternaryComponentWise3h(smoothstepScalar),\n vec4f: ternaryComponentWise4f(smoothstepScalar),\n vec4h: ternaryComponentWise4h(smoothstepScalar),\n } as Record<\n VecKind,\n <T extends vBase>(\n edge0: T,\n edge1: T,\n x: T,\n ) => T extends wgsl.AnyVec2Instance ? wgsl.v2f\n : T extends wgsl.AnyVec3Instance ? wgsl.v3f\n : T extends wgsl.AnyVec4Instance ? wgsl.v4f\n : wgsl.AnyVecInstance\n >,\n\n addMixed: {\n vec2f: (a: wgsl.v2f, b: number) => unary2f((e) => e + b)(a),\n vec2h: (a: wgsl.v2h, b: number) => unary2h((e) => e + b)(a),\n vec2i: (a: wgsl.v2i, b: number) => unary2i((e) => e + b)(a),\n vec2u: (a: wgsl.v2u, b: number) => unary2u((e) => e + b)(a),\n\n vec3f: (a: wgsl.v3f, b: number) => unary3f((e) => e + b)(a),\n vec3h: (a: wgsl.v3h, b: number) => unary3h((e) => e + b)(a),\n vec3i: (a: wgsl.v3i, b: number) => unary3i((e) => e + b)(a),\n vec3u: (a: wgsl.v3u, b: number) => unary3u((e) => e + b)(a),\n\n vec4f: (a: wgsl.v4f, b: number) => unary4f((e) => e + b)(a),\n vec4h: (a: wgsl.v4h, b: number) => unary4h((e) => e + b)(a),\n vec4i: (a: wgsl.v4i, b: number) => unary4i((e) => e + b)(a),\n vec4u: (a: wgsl.v4u, b: number) => unary4u((e) => e + b)(a),\n\n mat2x2f: (a: wgsl.m2x2f, b: number) => unary2x2f((e) => e + b)(a),\n mat3x3f: (a: wgsl.m3x3f, b: number) => unary3x3f((e) => e + b)(a),\n mat4x4f: (a: wgsl.m4x4f, b: number) => unary4x4f((e) => e + b)(a),\n } as Record<\n VecKind | MatKind,\n <T extends vBase | mBase>(lhs: T, rhs: number) => T\n >,\n\n mulSxV: {\n vec2f: (s: number, v: wgsl.v2f) => unary2f((e) => s * e)(v),\n vec2h: (s: number, v: wgsl.v2h) => unary2h((e) => s * e)(v),\n vec2i: (s: number, v: wgsl.v2i) => unary2i((e) => s * e)(v),\n vec2u: (s: number, v: wgsl.v2u) => unary2u((e) => s * e)(v),\n\n vec3f: (s: number, v: wgsl.v3f) => unary3f((e) => s * e)(v),\n vec3h: (s: number, v: wgsl.v3h) => unary3h((e) => s * e)(v),\n vec3i: (s: number, v: wgsl.v3i) => unary3i((e) => s * e)(v),\n vec3u: (s: number, v: wgsl.v3u) => unary3u((e) => s * e)(v),\n\n vec4f: (s: number, v: wgsl.v4f) => unary4f((e) => s * e)(v),\n vec4h: (s: number, v: wgsl.v4h) => unary4h((e) => s * e)(v),\n vec4i: (s: number, v: wgsl.v4i) => unary4i((e) => s * e)(v),\n vec4u: (s: number, v: wgsl.v4u) => unary4u((e) => s * e)(v),\n\n mat2x2f: (s: number, m: wgsl.m2x2f) => unary2x2f((e) => s * e)(m),\n mat3x3f: (s: number, m: wgsl.m3x3f) => unary3x3f((e) => s * e)(m),\n mat4x4f: (s: number, m: wgsl.m4x4f) => unary4x4f((e) => s * e)(m),\n } as Record<\n VecKind | MatKind,\n <T extends vBase | wgsl.AnyMatInstance>(s: number, v: T) => T\n >,\n\n mulVxV: {\n vec2f: binaryComponentWise2f((a, b) => a * b),\n vec2h: binaryComponentWise2h((a, b) => a * b),\n vec2i: binaryComponentWise2i((a, b) => a * b),\n vec2u: binaryComponentWise2u((a, b) => a * b),\n\n vec3f: binaryComponentWise3f((a, b) => a * b),\n vec3h: binaryComponentWise3h((a, b) => a * b),\n vec3i: binaryComponentWise3i((a, b) => a * b),\n vec3u: binaryComponentWise3u((a, b) => a * b),\n\n vec4f: binaryComponentWise4f((a, b) => a * b),\n vec4h: binaryComponentWise4h((a, b) => a * b),\n vec4i: binaryComponentWise4i((a, b) => a * b),\n vec4u: binaryComponentWise4u((a, b) => a * b),\n\n mat2x2f: (a: wgsl.m2x2f, b: wgsl.m2x2f) => {\n const a_ = a.columns;\n const b_ = b.columns;\n\n return mat2x2f(\n a_[0].x * b_[0].x + a_[1].x * b_[0].y,\n a_[0].y * b_[0].x + a_[1].y * b_[0].y,\n a_[0].x * b_[1].x + a_[1].x * b_[1].y,\n a_[0].y * b_[1].x + a_[1].y * b_[1].y,\n );\n },\n\n mat3x3f: (a: wgsl.m3x3f, b: wgsl.m3x3f) => {\n const a_ = a.columns;\n const b_ = b.columns;\n\n return mat3x3f(\n a_[0].x * b_[0].x + a_[1].x * b_[0].y + a_[2].x * b_[0].z,\n a_[0].y * b_[0].x + a_[1].y * b_[0].y + a_[2].y * b_[0].z,\n a_[0].z * b_[0].x + a_[1].z * b_[0].y + a_[2].z * b_[0].z,\n a_[0].x * b_[1].x + a_[1].x * b_[1].y + a_[2].x * b_[1].z,\n a_[0].y * b_[1].x + a_[1].y * b_[1].y + a_[2].y * b_[1].z,\n a_[0].z * b_[1].x + a_[1].z * b_[1].y + a_[2].z * b_[1].z,\n a_[0].x * b_[2].x + a_[1].x * b_[2].y + a_[2].x * b_[2].z,\n a_[0].y * b_[2].x + a_[1].y * b_[2].y + a_[2].y * b_[2].z,\n a_[0].z * b_[2].x + a_[1].z * b_[2].y + a_[2].z * b_[2].z,\n );\n },\n\n mat4x4f: (a: wgsl.m4x4f, b: wgsl.m4x4f) => {\n const a_ = a.columns;\n const b_ = b.columns;\n\n return mat4x4f(\n a_[0].x * b_[0].x +\n a_[1].x * b_[0].y +\n a_[2].x * b_[0].z +\n a_[3].x * b_[0].w,\n a_[0].y * b_[0].x +\n a_[1].y * b_[0].y +\n a_[2].y * b_[0].z +\n a_[3].y * b_[0].w,\n a_[0].z * b_[0].x +\n a_[1].z * b_[0].y +\n a_[2].z * b_[0].z +\n a_[3].z * b_[0].w,\n a_[0].w * b_[0].x +\n a_[1].w * b_[0].y +\n a_[2].w * b_[0].z +\n a_[3].w * b_[0].w,\n a_[0].x * b_[1].x +\n a_[1].x * b_[1].y +\n a_[2].x * b_[1].z +\n a_[3].x * b_[1].w,\n a_[0].y * b_[1].x +\n a_[1].y * b_[1].y +\n a_[2].y * b_[1].z +\n a_[3].y * b_[1].w,\n a_[0].z * b_[1].x +\n a_[1].z * b_[1].y +\n a_[2].z * b_[1].z +\n a_[3].z * b_[1].w,\n a_[0].w * b_[1].x +\n a_[1].w * b_[1].y +\n a_[2].w * b_[1].z +\n a_[3].w * b_[1].w,\n a_[0].x * b_[2].x +\n a_[1].x * b_[2].y +\n a_[2].x * b_[2].z +\n a_[3].x * b_[2].w,\n a_[0].y * b_[2].x +\n a_[1].y * b_[2].y +\n a_[2].y * b_[2].z +\n a_[3].y * b_[2].w,\n a_[0].z * b_[2].x +\n a_[1].z * b_[2].y +\n a_[2].z * b_[2].z +\n a_[3].z * b_[2].w,\n a_[0].w * b_[2].x +\n a_[1].w * b_[2].y +\n a_[2].w * b_[2].z +\n a_[3].w * b_[2].w,\n a_[0].x * b_[3].x +\n a_[1].x * b_[3].y +\n a_[2].x * b_[3].z +\n a_[3].x * b_[3].w,\n a_[0].y * b_[3].x +\n a_[1].y * b_[3].y +\n a_[2].y * b_[3].z +\n a_[3].y * b_[3].w,\n a_[0].z * b_[3].x +\n a_[1].z * b_[3].y +\n a_[2].z * b_[3].z +\n a_[3].z * b_[3].w,\n a_[0].w * b_[3].x +\n a_[1].w * b_[3].y +\n a_[2].w * b_[3].z +\n a_[3].w * b_[3].w,\n );\n },\n } as Record<\n VecKind | MatKind,\n <T extends vBase | wgsl.AnyMatInstance>(lhs: T, rhs: T) => T\n >,\n\n mulMxV: {\n mat2x2f: (m: wgsl.m2x2f, v: wgsl.v2f) => {\n const m_ = m.columns;\n return vec2f(\n m_[0].x * v.x + m_[1].x * v.y,\n m_[0].y * v.x + m_[1].y * v.y,\n );\n },\n\n mat3x3f: (m: wgsl.m3x3f, v: wgsl.v3f) => {\n const m_ = m.columns;\n return vec3f(\n m_[0].x * v.x + m_[1].x * v.y + m_[2].x * v.z,\n m_[0].y * v.x + m_[1].y * v.y + m_[2].y * v.z,\n m_[0].z * v.x + m_[1].z * v.y + m_[2].z * v.z,\n );\n },\n\n mat4x4f: (m: wgsl.m4x4f, v: wgsl.v4f) => {\n const m_ = m.columns;\n return vec4f(\n m_[0].x * v.x + m_[1].x * v.y + m_[2].x * v.z + m_[3].x * v.w,\n m_[0].y * v.x + m_[1].y * v.y + m_[2].y * v.z + m_[3].y * v.w,\n m_[0].z * v.x + m_[1].z * v.y + m_[2].z * v.z + m_[3].z * v.w,\n m_[0].w * v.x + m_[1].w * v.y + m_[2].w * v.z + m_[3].w * v.w,\n );\n },\n } as Record<\n MatKind,\n <T extends wgsl.AnyMatInstance>(\n m: T,\n v: wgsl.vBaseForMat<T>,\n ) => wgsl.vBaseForMat<T>\n >,\n\n mulVxM: {\n mat2x2f: (v: wgsl.v2f, m: wgsl.m2x2f) => {\n const m_ = m.columns;\n return vec2f(\n v.x * m_[0].x + v.y * m_[0].y,\n v.x * m_[1].x + v.y * m_[1].y,\n );\n },\n\n mat3x3f: (v: wgsl.v3f, m: wgsl.m3x3f) => {\n const m_ = m.columns;\n return vec3f(\n v.x * m_[0].x + v.y * m_[0].y + v.z * m_[0].z,\n v.x * m_[1].x + v.y * m_[1].y + v.z * m_[1].z,\n v.x * m_[2].x + v.y * m_[2].y + v.z * m_[2].z,\n );\n },\n\n mat4x4f: (v: wgsl.v4f, m: wgsl.m4x4f) => {\n const m_ = m.columns;\n return vec4f(\n v.x * m_[0].x + v.y * m_[0].y + v.z * m_[0].z + v.w * m_[0].w,\n v.x * m_[1].x + v.y * m_[1].y + v.z * m_[1].z + v.w * m_[1].w,\n v.x * m_[2].x + v.y * m_[2].y + v.z * m_[2].z + v.w * m_[2].w,\n v.x * m_[3].x + v.y * m_[3].y + v.z * m_[3].z + v.w * m_[3].w,\n );\n },\n } as Record<\n MatKind,\n <T extends wgsl.AnyMatInstance>(\n v: wgsl.vBaseForMat<T>,\n m: T,\n ) => wgsl.vBaseForMat<T>\n >,\n\n div: {\n vec2f: binaryComponentWise2f((a, b) => a / b),\n vec2h: binaryComponentWise2h((a, b) => a / b),\n vec2i: binaryComponentWise2i(divInteger),\n vec2u: binaryComponentWise2u(divInteger),\n\n vec3f: binaryComponentWise3f((a, b) => a / b),\n vec3h: binaryComponentWise3h((a, b) => a / b),\n vec3i: binaryComponentWise3i(divInteger),\n vec3u: binaryComponentWise3u(divInteger),\n\n vec4f: binaryComponentWise4f((a, b) => a / b),\n vec4h: binaryComponentWise4h((a, b) => a / b),\n vec4i: binaryComponentWise4i(divInteger),\n vec4u: binaryComponentWise4u(divInteger),\n } as Record<VecKind, <T extends vBase>(a: T, b: T) => T>,\n\n dot: {\n vec2f: dotVec2,\n vec2h: dotVec2,\n vec2i: dotVec2,\n vec2u: dotVec2,\n vec3f: dotVec3,\n vec3h: dotVec3,\n vec3i: dotVec3,\n vec3u: dotVec3,\n vec4f: dotVec4,\n vec4h: dotVec4,\n vec4i: dotVec4,\n vec4u: dotVec4,\n } as Record<VecKind, <T extends vBase>(lhs: T, rhs: T) => number>,\n\n normalize: {\n vec2f: (v: wgsl.v2f) => {\n const len = lengthVec2(v);\n return vec2f(v.x / len, v.y / len);\n },\n vec2h: (v: wgsl.v2h) => {\n const len = lengthVec2(v);\n return vec2h(v.x / len, v.y / len);\n },\n vec2i: (v: wgsl.v2i) => {\n const len = lengthVec2(v);\n return vec2i(v.x / len, v.y / len);\n },\n vec2u: (v: wgsl.v2u) => {\n const len = lengthVec2(v);\n return vec2u(v.x / len, v.y / len);\n },\n\n vec3f: (v: wgsl.v3f) => {\n const len = lengthVec3(v);\n return vec3f(v.x / len, v.y / len, v.z / len);\n },\n vec3h: (v: wgsl.v3h) => {\n const len = lengthVec3(v);\n return vec3h(v.x / len, v.y / len, v.z / len);\n },\n vec3i: (v: wgsl.v3i) => {\n const len = lengthVec3(v);\n return vec3i(v.x / len, v.y / len, v.z / len);\n },\n vec3u: (v: wgsl.v3u) => {\n const len = lengthVec3(v);\n return vec3u(v.x / len, v.y / len, v.z / len);\n },\n\n vec4f: (v: wgsl.v4f) => {\n const len = lengthVec4(v);\n return vec4f(v.x / len, v.y / len, v.z / len, v.w / len);\n },\n vec4h: (v: wgsl.v4h) => {\n const len = lengthVec4(v);\n return vec4h(v.x / len, v.y / len, v.z / len, v.w / len);\n },\n vec4i: (v: wgsl.v4i) => {\n const len = lengthVec4(v);\n return vec4i(v.x / len, v.y / len, v.z / len, v.w / len);\n },\n vec4u: (v: wgsl.v4u) => {\n const len = lengthVec4(v);\n return vec4u(v.x / len, v.y / len, v.z / len, v.w / len);\n },\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n cross: {\n vec3f: (a: wgsl.v3f, b: wgsl.v3f) => {\n return vec3f(\n a.y * b.z - a.z * b.y,\n a.z * b.x - a.x * b.z,\n a.x * b.y - a.y * b.x,\n );\n },\n vec3h: (a: wgsl.v3h, b: wgsl.v3h) => {\n return vec3h(\n a.y * b.z - a.z * b.y,\n a.z * b.x - a.x * b.z,\n a.x * b.y - a.y * b.x,\n );\n },\n } as Record<\n 'vec3f' | 'vec3h',\n <T extends wgsl.v3f | wgsl.v3h>(a: T, b: T) => T\n >,\n\n mod: {\n vec2f: binaryComponentWise2f((a, b) => a % b),\n vec2h: binaryComponentWise2h((a, b) => a % b),\n vec2i: binaryComponentWise2i((a, b) => a % b),\n vec2u: binaryComponentWise2u((a, b) => a % b),\n\n vec3f: binaryComponentWise3f((a, b) => a % b),\n vec3h: binaryComponentWise3h((a, b) => a % b),\n vec3i: binaryComponentWise3i((a, b) => a % b),\n vec3u: binaryComponentWise3u((a, b) => a % b),\n\n vec4f: binaryComponentWise4f((a, b) => a % b),\n vec4h: binaryComponentWise4h((a, b) => a % b),\n vec4i: binaryComponentWise4i((a, b) => a % b),\n vec4u: binaryComponentWise4u((a, b) => a % b),\n } as Record<VecKind, <T extends vBase>(a: T, b: T) => T>,\n\n floor: {\n vec2f: unary2f(Math.floor),\n vec2h: unary2h(Math.floor),\n\n vec3f: unary3f(Math.floor),\n vec3h: unary3h(Math.floor),\n\n vec4f: unary4f(Math.floor),\n vec4h: unary4h(Math.floor),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n max: {\n vec2f: binaryComponentWise2f(Math.max),\n vec2h: binaryComponentWise2h(Math.max),\n vec2i: binaryComponentWise2i(Math.max),\n vec2u: binaryComponentWise2u(Math.max),\n\n vec3f: binaryComponentWise3f(Math.max),\n vec3h: binaryComponentWise3h(Math.max),\n vec3i: binaryComponentWise3i(Math.max),\n vec3u: binaryComponentWise3u(Math.max),\n\n vec4f: binaryComponentWise4f(Math.max),\n vec4h: binaryComponentWise4h(Math.max),\n vec4i: binaryComponentWise4i(Math.max),\n vec4u: binaryComponentWise4u(Math.max),\n } as Record<VecKind, <T extends vBase>(a: T, b: T) => T>,\n\n min: {\n vec2f: binaryComponentWise2f(Math.min),\n vec2h: binaryComponentWise2h(Math.min),\n vec2i: binaryComponentWise2i(Math.min),\n vec2u: binaryComponentWise2u(Math.min),\n\n vec3f: binaryComponentWise3f(Math.min),\n vec3h: binaryComponentWise3h(Math.min),\n vec3i: binaryComponentWise3i(Math.min),\n vec3u: binaryComponentWise3u(Math.min),\n\n vec4f: binaryComponentWise4f(Math.min),\n vec4h: binaryComponentWise4h(Math.min),\n vec4i: binaryComponentWise4i(Math.min),\n vec4u: binaryComponentWise4u(Math.min),\n } as Record<VecKind, <T extends vBase>(a: T, b: T) => T>,\n\n pow: {\n vec2f: (base: wgsl.v2f, exponent: wgsl.v2f) =>\n vec2f(base.x ** exponent.x, base.y ** exponent.y),\n vec2h: (base: wgsl.v2h, exponent: wgsl.v2h) =>\n vec2h(base.x ** exponent.x, base.y ** exponent.y),\n\n vec3f: (base: wgsl.v3f, exponent: wgsl.v3f) =>\n vec3f(base.x ** exponent.x, base.y ** exponent.y, base.z ** exponent.z),\n vec3h: (base: wgsl.v3h, exponent: wgsl.v3h) =>\n vec3h(base.x ** exponent.x, base.y ** exponent.y, base.z ** exponent.z),\n\n vec4f: (base: wgsl.v4f, exponent: wgsl.v4f) =>\n vec4f(\n base.x ** exponent.x,\n base.y ** exponent.y,\n base.z ** exponent.z,\n base.w ** exponent.w,\n ),\n vec4h: (base: wgsl.v4h, exponent: wgsl.v4h) =>\n vec4h(\n base.x ** exponent.x,\n base.y ** exponent.y,\n base.z ** exponent.z,\n base.w ** exponent.w,\n ),\n } as Record<\n 'vec2f' | 'vec3f' | 'vec4f' | 'vec2h' | 'vec3h' | 'vec4h' | 'number',\n <T extends wgsl.AnyFloatVecInstance | number>(a: T, b: T) => T\n >,\n\n sign: {\n vec2f: unary2f(Math.sign),\n vec2h: unary2h(Math.sign),\n vec2i: unary2i(Math.sign),\n\n vec3f: unary3f(Math.sign),\n vec3h: unary3h(Math.sign),\n vec3i: unary3i(Math.sign),\n\n vec4f: unary4f(Math.sign),\n vec4h: unary4h(Math.sign),\n vec4i: unary4i(Math.sign),\n } as Record<VecKind, <T extends vBase>(e: T) => T>,\n\n sqrt: {\n vec2f: unary2f(Math.sqrt),\n vec2h: unary2h(Math.sqrt),\n\n vec3f: unary3f(Math.sqrt),\n vec3h: unary3h(Math.sqrt),\n\n vec4f: unary4f(Math.sqrt),\n vec4h: unary4h(Math.sqrt),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n mix: {\n vec2f: (e1: wgsl.v2f, e2: wgsl.v2f, e3: wgsl.v2f | number) => {\n if (typeof e3 === 'number') {\n return vec2f(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3);\n }\n return vec2f(\n e1.x * (1 - e3.x) + e2.x * e3.x,\n e1.y * (1 - e3.y) + e2.y * e3.y,\n );\n },\n vec2h: (e1: wgsl.v2h, e2: wgsl.v2h, e3: wgsl.v2h | number) => {\n if (typeof e3 === 'number') {\n return vec2h(e1.x * (1 - e3) + e2.x * e3, e1.y * (1 - e3) + e2.y * e3);\n }\n return vec2h(\n e1.x * (1 - e3.x) + e2.x * e3.x,\n e1.y * (1 - e3.y) + e2.y * e3.y,\n );\n },\n\n vec3f: (e1: wgsl.v3f, e2: wgsl.v3f, e3: wgsl.v3f | number) => {\n if (typeof e3 === 'number') {\n return vec3f(\n e1.x * (1 - e3) + e2.x * e3,\n e1.y * (1 - e3) + e2.y * e3,\n e1.z * (1 - e3) + e2.z * e3,\n );\n }\n return vec3f(\n e1.x * (1 - e3.x) + e2.x * e3.x,\n e1.y * (1 - e3.y) + e2.y * e3.y,\n e1.z * (1 - e3.z) + e2.z * e3.z,\n );\n },\n vec3h: (e1: wgsl.v3h, e2: wgsl.v3h, e3: wgsl.v3h | number) => {\n if (typeof e3 === 'number') {\n return vec3h(\n e1.x * (1 - e3) + e2.x * e3,\n e1.y * (1 - e3) + e2.y * e3,\n e1.z * (1 - e3) + e2.z * e3,\n );\n }\n return vec3h(\n e1.x * (1 - e3.x) + e2.x * e3.x,\n e1.y * (1 - e3.y) + e2.y * e3.y,\n e1.z * (1 - e3.z) + e2.z * e3.z,\n );\n },\n\n vec4f: (e1: wgsl.v4f, e2: wgsl.v4f, e3: wgsl.v4f | number) => {\n if (typeof e3 === 'number') {\n return vec4f(\n e1.x * (1 - e3) + e2.x * e3,\n e1.y * (1 - e3) + e2.y * e3,\n e1.z * (1 - e3) + e2.z * e3,\n e1.w * (1 - e3) + e2.w * e3,\n );\n }\n return vec4f(\n e1.x * (1 - e3.x) + e2.x * e3.x,\n e1.y * (1 - e3.y) + e2.y * e3.y,\n e1.z * (1 - e3.z) + e2.z * e3.z,\n e1.w * (1 - e3.w) + e2.w * e3.w,\n );\n },\n vec4h: (e1: wgsl.v4h, e2: wgsl.v4h, e3: wgsl.v4h | number) => {\n if (typeof e3 === 'number') {\n return vec4h(\n e1.x * (1 - e3) + e2.x * e3,\n e1.y * (1 - e3) + e2.y * e3,\n e1.z * (1 - e3) + e2.z * e3,\n e1.w * (1 - e3) + e2.w * e3,\n );\n }\n return vec4h(\n e1.x * (1 - e3.x) + e2.x * e3.x,\n e1.y * (1 - e3.y) + e2.y * e3.y,\n e1.z * (1 - e3.z) + e2.z * e3.z,\n e1.w * (1 - e3.w) + e2.w * e3.w,\n );\n },\n } as Record<\n 'vec2f' | 'vec3f' | 'vec4f' | 'vec2h' | 'vec3h' | 'vec4h',\n <T extends wgsl.v2f | wgsl.v3f | wgsl.v4f | wgsl.v2h | wgsl.v3h | wgsl.v4h>(\n a: T,\n b: T,\n c: T | number,\n ) => T\n >,\n\n sin: {\n vec2f: unary2f(Math.sin),\n vec2h: unary2h(Math.sin),\n\n vec3f: unary3f(Math.sin),\n vec3h: unary3h(Math.sin),\n\n vec4f: unary4f(Math.sin),\n vec4h: unary4h(Math.sin),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n cos: {\n vec2f: unary2f(Math.cos),\n vec2h: unary2h(Math.cos),\n\n vec3f: unary3f(Math.cos),\n vec3h: unary3h(Math.cos),\n\n vec4f: unary4f(Math.cos),\n vec4h: unary4h(Math.cos),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n cosh: {\n vec2f: unary2f(Math.cosh),\n vec2h: unary2h(Math.cosh),\n\n vec3f: unary3f(Math.cosh),\n vec3h: unary3h(Math.cosh),\n\n vec4f: unary4f(Math.cosh),\n vec4h: unary4h(Math.cosh),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n exp: {\n vec2f: unary2f(Math.exp),\n vec2h: unary2h(Math.exp),\n\n vec3f: unary3f(Math.exp),\n vec3h: unary3h(Math.exp),\n\n vec4f: unary4f(Math.exp),\n vec4h: unary4h(Math.exp),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n exp2: {\n vec2f: unary2f((val) => 2 ** val),\n vec2h: unary2h((val) => 2 ** val),\n\n vec3f: unary3f((val) => 2 ** val),\n vec3h: unary3h((val) => 2 ** val),\n\n vec4f: unary4f((val) => 2 ** val),\n vec4h: unary4h((val) => 2 ** val),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n log: {\n vec2f: unary2f(Math.log),\n vec2h: unary2h(Math.log),\n\n vec3f: unary3f(Math.log),\n vec3h: unary3h(Math.log),\n\n vec4f: unary4f(Math.log),\n vec4h: unary4h(Math.log),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n log2: {\n vec2f: unary2f(Math.log2),\n vec2h: unary2h(Math.log2),\n\n vec3f: unary3f(Math.log2),\n vec3h: unary3h(Math.log2),\n\n vec4f: unary4f(Math.log2),\n vec4h: unary4h(Math.log2),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n fract: {\n vec2f: unary2f((value) => value - Math.floor(value)),\n vec2h: unary2h((value) => value - Math.floor(value)),\n\n vec3f: unary3f((value) => value - Math.floor(value)),\n vec3h: unary3h((value) => value - Math.floor(value)),\n\n vec4f: unary4f((value) => value - Math.floor(value)),\n vec4h: unary4h((value) => value - Math.floor(value)),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n isCloseToZero: {\n vec2f: (v: wgsl.v2f, n: number) => Math.abs(v.x) <= n && Math.abs(v.y) <= n,\n vec2h: (v: wgsl.v2h, n: number) => Math.abs(v.x) <= n && Math.abs(v.y) <= n,\n\n vec3f: (v: wgsl.v3f, n: number) =>\n Math.abs(v.x) <= n && Math.abs(v.y) <= n && Math.abs(v.z) <= n,\n vec3h: (v: wgsl.v3h, n: number) =>\n Math.abs(v.x) <= n && Math.abs(v.y) <= n && Math.abs(v.z) <= n,\n\n vec4f: (v: wgsl.v4f, n: number) =>\n Math.abs(v.x) <= n &&\n Math.abs(v.y) <= n &&\n Math.abs(v.z) <= n &&\n Math.abs(v.w) <= n,\n vec4h: (v: wgsl.v4h, n: number) =>\n Math.abs(v.x) <= n &&\n Math.abs(v.y) <= n &&\n Math.abs(v.z) <= n &&\n Math.abs(v.w) <= n,\n } as Record<VecKind, <T extends vBase>(v: T, n: number) => boolean>,\n\n neg: {\n vec2f: unary2f((value) => -value),\n vec2h: unary2h((value) => -value),\n vec2i: unary2i((value) => -value),\n vec2u: unary2u((value) => -value),\n 'vec2<bool>': (e: wgsl.v2b) => vec2b(!e.x, !e.y),\n\n vec3f: unary3f((value) => -value),\n vec3h: unary3h((value) => -value),\n vec3i: unary3i((value) => -value),\n vec3u: unary3u((value) => -value),\n 'vec3<bool>': (e: wgsl.v3b) => vec3b(!e.x, !e.y, !e.z),\n\n vec4f: unary4f((value) => -value),\n vec4h: unary4h((value) => -value),\n vec4i: unary4i((value) => -value),\n vec4u: unary4u((value) => -value),\n 'vec4<bool>': (e: wgsl.v4b) => vec4b(!e.x, !e.y, !e.z, !e.w),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n\n select: {\n vec2f: (f: wgsl.v2f, t: wgsl.v2f, c: wgsl.v2b) =>\n vec2f(c.x ? t.x : f.x, c.y ? t.y : f.y),\n vec2h: (f: wgsl.v2h, t: wgsl.v2h, c: wgsl.v2b) =>\n vec2h(c.x ? t.x : f.x, c.y ? t.y : f.y),\n vec2i: (f: wgsl.v2i, t: wgsl.v2i, c: wgsl.v2b) =>\n vec2i(c.x ? t.x : f.x, c.y ? t.y : f.y),\n vec2u: (f: wgsl.v2u, t: wgsl.v2u, c: wgsl.v2b) =>\n vec2u(c.x ? t.x : f.x, c.y ? t.y : f.y),\n 'vec2<bool>': (f: wgsl.v2b, t: wgsl.v2b, c: wgsl.v2b) =>\n vec2b(c.x ? t.x : f.x, c.y ? t.y : f.y),\n\n vec3f: (f: wgsl.v3f, t: wgsl.v3f, c: wgsl.v3b) =>\n vec3f(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),\n vec3h: (f: wgsl.v3h, t: wgsl.v3h, c: wgsl.v3b) =>\n vec3h(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),\n vec3i: (f: wgsl.v3i, t: wgsl.v3i, c: wgsl.v3b) =>\n vec3i(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),\n vec3u: (f: wgsl.v3u, t: wgsl.v3u, c: wgsl.v3b) =>\n vec3u(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),\n 'vec3<bool>': (f: wgsl.v3b, t: wgsl.v3b, c: wgsl.v3b) =>\n vec3b(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z),\n\n vec4f: (f: wgsl.v4f, t: wgsl.v4f, c: wgsl.v4b) =>\n vec4f(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),\n vec4h: (f: wgsl.v4h, t: wgsl.v4h, c: wgsl.v4b) =>\n vec4h(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),\n vec4i: (f: wgsl.v4i, t: wgsl.v4i, c: wgsl.v4b) =>\n vec4i(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),\n vec4u: (f: wgsl.v4u, t: wgsl.v4u, c: wgsl.v4b) =>\n vec4u(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),\n 'vec4<bool>': (f: wgsl.v4b, t: wgsl.v4b, c: wgsl.v4b) =>\n vec4b(c.x ? t.x : f.x, c.y ? t.y : f.y, c.z ? t.z : f.z, c.w ? t.w : f.w),\n } as Record<\n VecKind,\n <T extends wgsl.AnyVecInstance>(\n f: T,\n t: T,\n c: T extends wgsl.AnyVec2Instance ? wgsl.v2b\n : T extends wgsl.AnyVec3Instance ? wgsl.v3b\n : wgsl.v4b,\n ) => T\n >,\n\n tanh: {\n vec2f: unary2f(Math.tanh),\n vec2h: unary2h(Math.tanh),\n\n vec3f: unary3f(Math.tanh),\n vec3h: unary3h(Math.tanh),\n\n vec4f: unary4f(Math.tanh),\n vec4h: unary4h(Math.tanh),\n } as Record<VecKind, <T extends vBase>(v: T) => T>,\n};\n"]}
@@ -0,0 +1,43 @@
1
+ var z="0.7.0";var o=Symbol(`typegpu:${z}:$internal`),st=Symbol(`typegpu:${z}:$wgslDataType`),Nn=Symbol(`typegpu:${z}:$gpuValueOf`),Ye=Symbol(`typegpu:${z}:$getNameForward`),it=Symbol(`typegpu:${z}:$providing`),at=Symbol(`typegpu:${z}:$repr`),Fn=Symbol(`typegpu:${z}:$gpuRepr`),Pn=Symbol(`typegpu:${z}:$reprPartial`),Rn=Symbol(`typegpu:${z}:$memIdent`),En=Symbol(`typegpu:${z}:$invalidStorageSchema`),Un=Symbol(`typegpu:${z}:$validUniformSchema`),Cn=Symbol(`typegpu:${z}:$validVertexSchema`),On=Symbol(`typegpu:${z}:$invalidSchemaReason`);var Ce=globalThis.process.env.NODE_ENV==="development",ot=globalThis.process.env.NODE_ENV==="test";Object.assign(globalThis,{__TYPEGPU_AUTONAME__:(e,t)=>Ut(e)&&e?.[o]&&!ie(e)?e.$name(t):e});var Re=globalThis,Gn=(Ce||ot)&&{get enabled(){return!!Re.__TYPEGPU_MEASURE_PERF__},record(e,t){let n=Re.__TYPEGPU_PERF_RECORDS__??=new Map,r=n.get(e);r||(r=[],n.set(e,r)),r.push(t)}}||void 0;function Et(e){return!!e?.[Ye]}function ie(e){return Et(e)?ie(e[Ye]):Ct(e)?.name}function ct(e,t){Ot(e,{name:t})}function Ut(e){return!!e?.$name}function Ct(e){return Re.__TYPEGPU_META__.get(e)}function Ot(e,t){Re.__TYPEGPU_META__??=new WeakMap;let n=Re.__TYPEGPU_META__;n.set(e,{...n.get(e),...t})}var He="Invariant failed";function gt(e,t){if(e)return;if(!Ce)throw new Error(He);let n=typeof t=="function"?t():t,r=n?`${He}: ${n}`:He;throw new Error(r)}var ut=class e extends Error{constructor(n,r){let s=r.map(y=>`- ${y}`);s.length>20&&(s=[...s.slice(0,11),"...",...s.slice(-10)]);super(`Resolution of the following tree failed:
2
+ ${s.join(`
3
+ `)}: ${n&&typeof n=="object"&&"message"in n?n.message:n}`);this.cause=n;this.trace=r;Object.setPrototypeOf(this,e.prototype)}appendToTrace(n){let r=[n,...this.trace];return new e(this.cause,r)}},yt=class e extends Error{constructor(n,r){let s=r.map(y=>`- ${y}`);s.length>20&&(s=[...s.slice(0,11),"...",...s.slice(-10)]);super(`Execution of the following tree failed:
4
+ ${s.join(`
5
+ `)}: ${n&&typeof n=="object"&&"message"in n?n.message:n}`);this.cause=n;this.trace=r;Object.setPrototypeOf(this,e.prototype)}appendToTrace(n){let r=[n,...this.trace];return new e(this.cause,r)}},ht=class e extends Error{constructor(n){super(`Missing value for '${n}'`);this.slot=n;Object.setPrototypeOf(this,e.prototype)}},lt=class e extends Error{constructor(t){super(`Buffer '${ie(t)??"<unnamed>"}' is not bindable as a uniform. Use .$usage('uniform') to allow it.`),Object.setPrototypeOf(this,e.prototype)}},xt=class e extends Error{constructor(t,n){super(`The function '${t??"<unnamed>"}' is missing links to the following external values: ${n}.`),Object.setPrototypeOf(this,e.prototype)}},dt=class e extends Error{constructor(t){super(`Missing bind groups for layouts: '${[...t].map(n=>ie(n)??"<unnamed>").join(", ")}'. Please provide it using pipeline.with(layout, bindGroup).(...)`),Object.setPrototypeOf(this,e.prototype)}},mt=class e extends Error{constructor(t){super(`Missing vertex buffers for layouts: '${[...t].map(n=>ie(n)??"<unnamed>").join(", ")}'. Please provide it using pipeline.with(layout, buffer).(...)`),Object.setPrototypeOf(this,e.prototype)}},wt=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}},pt=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}},vt=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function ft(e){return e?.resourceType==="slot"}function Tt(e){return e?.resourceType==="derived"}function bt(e){return e?.[it]!==void 0}function tr(e){return e?.resourceType==="accessor"}function sr(e){return!!e?.[st]}var ir={[o]:!0,type:"void"},Wt=["bool","f32","f16","i32","u32","u16","vec2f","vec2h","vec2i","vec2u","vec2<bool>","vec3f","vec3h","vec3i","vec3u","vec3<bool>","vec4f","vec4h","vec4i","vec4u","vec4<bool>","mat2x2f","mat3x3f","mat4x4f","struct","array","ptr","atomic","decorated","abstractInt","abstractFloat","void"];function p(e){let t=e;return!!t?.[o]&&typeof t.kind?.startsWith=="function"&&t.kind.startsWith("vec")}function Kt(e){let t=e;return!!t?.[o]&&typeof t.type?.startsWith=="function"&&t.type.startsWith?.("vec2")}function Lt(e){let t=e;return!!t?.[o]&&typeof t.type?.startsWith=="function"&&t.type.startsWith("vec3")}function jt(e){let t=e;return!!t?.[o]&&typeof t.type?.startsWith=="function"&&t.type.startsWith("vec4")}function zt(e){return Kt(e)||Lt(e)||jt(e)}function N(e){let t=e;return!!t?.[o]&&typeof t.kind?.startsWith=="function"&&t.kind.startsWith("mat")}function Gt(e){return e?.[o]&&e?.type==="mat2x2f"}function qt(e){return e?.[o]&&e?.type==="mat3x3f"}function Yt(e){return e?.[o]&&e?.type==="mat4x4f"}function ar(e){return Gt(e)||qt(e)||Yt(e)}function Ze(e){return p(e)&&["vec2f","vec3f","vec4f"].includes(e.kind)}function Vt(e){return e?.[o]&&Wt.includes(e?.type)}function or(e){return e?.[o]&&e?.type==="array"}function cr(e){return e?.[o]&&e?.type==="struct"}function ur(e){return e?.[o]&&e?.type==="ptr"}function yr(e){return e?.[o]&&e?.type==="atomic"}function hr(e){return e?.[o]&&e?.type==="@align"}function lr(e){return e?.[o]&&e?.type==="@size"}function xr(e){return e?.[o]&&e?.type==="@location"}function dr(e){return e?.[o]&&e?.type==="@interpolate"}function mr(e){return e?.[o]&&e?.type==="@builtin"}function St(e){return e?.[o]&&e?.type==="decorated"}function wr(e){return e?.[o]&&e.type==="void"}var Oe=class{type="normal"},_t=class{type="codegen"},Mt=class{constructor(t,n){this.buffers=t;this.vars=n}type="simulate"};function Ht(e){return typeof e?.["~resolve"]=="function"}function Tr(e){return typeof e=="number"||typeof e=="boolean"||typeof e=="string"||Ht(e)||Vt(e)||ft(e)||Tt(e)||bt(e)}function br(e){return!!e&&typeof e=="object"&&"getMappedRange"in e&&"mapAsync"in e}function zr(e){return e?.resourceType==="buffer-usage"}function Vr(e){return!!e?.[o]}var We=!1;function $r(e){if(We)return e();try{return We=!0,e()}finally{We=!1}}function Ir(){return We}var O;function Ar(e,t){if(gt(O===void 0||O===e,"Cannot nest context providers"),O===e)return t();O=e;try{return t()}finally{O=void 0}}function kr(){return O}var Zt=new Oe;function Br(){return O?.mode??Zt}function $t(){return O?.mode?.type==="codegen"}function i(e,t,n,r="keep"){let s=(...y)=>$t()?t(...y):e(...y);return ct(s,n),s.toString=()=>n,s[o]={jsImpl:e,gpuImpl:t,argConversionHint:r},s}function It(e){return e.type==="decorated"||e.type==="loose-decorated"?e.inner:e}var Ke=class{constructor(t,n){this.value=t;this.dataType=n}};function Cr(e){return e instanceof Ke}function a(e,t){return new Ke(e,It(t))}var jr={[o]:!0,type:"abstractInt"},Gr={[o]:!0,type:"abstractFloat"},Xt=i(e=>e===void 0?!1:typeof e=="boolean"?e:!!e,e=>a(`bool(${e?.value??""})`,F),"boolCast"),F=Object.assign(Xt,{type:"bool"}),Jt=i(e=>e===void 0?0:typeof e=="boolean"?e?1:0:(e&4294967295)>>>0,e=>a(`u32(${e?.value??""})`,P),"u32Cast"),P=Object.assign(Jt,{type:"u32"}),Qt=i(e=>e===void 0?0:typeof e=="boolean"?e?1:0:e|0,e=>a(`i32(${e?.value??""})`,R),"i32Cast"),qr={[o]:!0,type:"u16"},R=Object.assign(Qt,{type:"i32"}),en=i(e=>e===void 0?0:typeof e=="boolean"?e?1:0:Math.fround(e),e=>a(`f32(${e?.value??""})`,V),"f32Cast"),V=Object.assign(en,{type:"f32"}),At=new ArrayBuffer(4),tn=new Float32Array(At),nn=new Uint32Array(At);function rn(e){tn[0]=e;let t=nn[0],n=t>>>31&1,r=t>>>23&255,s=t&8388607;return r===255?n<<15|31744|(s?512:0):(r=r-127+15,r<=0?r<-10?n<<15:(s=(s|8388608)>>1-r,s=s+4096>>13,n<<15|s):r>=31||(s=s+4096,s&8388608&&(s=0,++r,r>=31))?n<<15|31744:n<<15|r<<10|s>>13)}function sn(e){let t=e&32768?-1:1,n=e>>10&31,r=e&1023;return n===0?r?t*r*2**-24:t*0:n===31?r?Number.NaN:t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t*(1+r/1024)*2**(n-15)}function an(e){return sn(rn(e))}var on=i(e=>e===void 0?0:typeof e=="boolean"?e?1:0:an(e),e=>a(`f16(${e?.value??""})`,E),"f16Cast"),E=Object.assign(on,{type:"f16"});var Ee=class extends Array{[o]=!0;"~resolve"(){return`${this.kind}(${this.join(", ")})`}toString(){return this["~resolve"]()}get xx(){return new this._Vec2(this[0],this[0])}get xy(){return new this._Vec2(this[0],this[1])}get xz(){return new this._Vec2(this[0],this[2])}get xw(){return new this._Vec2(this[0],this[3])}get yx(){return new this._Vec2(this[1],this[0])}get yy(){return new this._Vec2(this[1],this[1])}get yz(){return new this._Vec2(this[1],this[2])}get yw(){return new this._Vec2(this[1],this[3])}get zx(){return new this._Vec2(this[2],this[0])}get zy(){return new this._Vec2(this[2],this[1])}get zz(){return new this._Vec2(this[2],this[2])}get zw(){return new this._Vec2(this[2],this[3])}get wx(){return new this._Vec2(this[3],this[0])}get wy(){return new this._Vec2(this[3],this[1])}get wz(){return new this._Vec2(this[3],this[2])}get ww(){return new this._Vec2(this[3],this[3])}get xxx(){return new this._Vec3(this[0],this[0],this[0])}get xxy(){return new this._Vec3(this[0],this[0],this[1])}get xxz(){return new this._Vec3(this[0],this[0],this[2])}get xxw(){return new this._Vec3(this[0],this[0],this[3])}get xyx(){return new this._Vec3(this[0],this[1],this[0])}get xyy(){return new this._Vec3(this[0],this[1],this[1])}get xyz(){return new this._Vec3(this[0],this[1],this[2])}get xyw(){return new this._Vec3(this[0],this[1],this[3])}get xzx(){return new this._Vec3(this[0],this[2],this[0])}get xzy(){return new this._Vec3(this[0],this[2],this[1])}get xzz(){return new this._Vec3(this[0],this[2],this[2])}get xzw(){return new this._Vec3(this[0],this[2],this[3])}get xwx(){return new this._Vec3(this[0],this[3],this[0])}get xwy(){return new this._Vec3(this[0],this[3],this[1])}get xwz(){return new this._Vec3(this[0],this[3],this[2])}get xww(){return new this._Vec3(this[0],this[3],this[3])}get yxx(){return new this._Vec3(this[1],this[0],this[0])}get yxy(){return new this._Vec3(this[1],this[0],this[1])}get yxz(){return new this._Vec3(this[1],this[0],this[2])}get yxw(){return new this._Vec3(this[1],this[0],this[3])}get yyx(){return new this._Vec3(this[1],this[1],this[0])}get yyy(){return new this._Vec3(this[1],this[1],this[1])}get yyz(){return new this._Vec3(this[1],this[1],this[2])}get yyw(){return new this._Vec3(this[1],this[1],this[3])}get yzx(){return new this._Vec3(this[1],this[2],this[0])}get yzy(){return new this._Vec3(this[1],this[2],this[1])}get yzz(){return new this._Vec3(this[1],this[2],this[2])}get yzw(){return new this._Vec3(this[1],this[2],this[3])}get ywx(){return new this._Vec3(this[1],this[3],this[0])}get ywy(){return new this._Vec3(this[1],this[3],this[1])}get ywz(){return new this._Vec3(this[1],this[3],this[2])}get yww(){return new this._Vec3(this[1],this[3],this[3])}get zxx(){return new this._Vec3(this[2],this[0],this[0])}get zxy(){return new this._Vec3(this[2],this[0],this[1])}get zxz(){return new this._Vec3(this[2],this[0],this[2])}get zxw(){return new this._Vec3(this[2],this[0],this[3])}get zyx(){return new this._Vec3(this[2],this[1],this[0])}get zyy(){return new this._Vec3(this[2],this[1],this[1])}get zyz(){return new this._Vec3(this[2],this[1],this[2])}get zyw(){return new this._Vec3(this[2],this[1],this[3])}get zzx(){return new this._Vec3(this[2],this[2],this[0])}get zzy(){return new this._Vec3(this[2],this[2],this[1])}get zzz(){return new this._Vec3(this[2],this[2],this[2])}get zzw(){return new this._Vec3(this[2],this[2],this[3])}get zwx(){return new this._Vec3(this[2],this[3],this[0])}get zwy(){return new this._Vec3(this[2],this[3],this[1])}get zwz(){return new this._Vec3(this[2],this[3],this[2])}get zww(){return new this._Vec3(this[2],this[3],this[3])}get wxx(){return new this._Vec3(this[3],this[0],this[0])}get wxy(){return new this._Vec3(this[3],this[0],this[1])}get wxz(){return new this._Vec3(this[3],this[0],this[2])}get wxw(){return new this._Vec3(this[3],this[0],this[3])}get wyx(){return new this._Vec3(this[3],this[1],this[0])}get wyy(){return new this._Vec3(this[3],this[1],this[1])}get wyz(){return new this._Vec3(this[3],this[1],this[2])}get wyw(){return new this._Vec3(this[3],this[1],this[3])}get wzx(){return new this._Vec3(this[3],this[2],this[0])}get wzy(){return new this._Vec3(this[3],this[2],this[1])}get wzz(){return new this._Vec3(this[3],this[2],this[2])}get wzw(){return new this._Vec3(this[3],this[2],this[3])}get wwx(){return new this._Vec3(this[3],this[3],this[0])}get wwy(){return new this._Vec3(this[3],this[3],this[1])}get wwz(){return new this._Vec3(this[3],this[3],this[2])}get www(){return new this._Vec3(this[3],this[3],this[3])}get xxxx(){return new this._Vec4(this[0],this[0],this[0],this[0])}get xxxy(){return new this._Vec4(this[0],this[0],this[0],this[1])}get xxxz(){return new this._Vec4(this[0],this[0],this[0],this[2])}get xxxw(){return new this._Vec4(this[0],this[0],this[0],this[3])}get xxyx(){return new this._Vec4(this[0],this[0],this[1],this[0])}get xxyy(){return new this._Vec4(this[0],this[0],this[1],this[1])}get xxyz(){return new this._Vec4(this[0],this[0],this[1],this[2])}get xxyw(){return new this._Vec4(this[0],this[0],this[1],this[3])}get xxzx(){return new this._Vec4(this[0],this[0],this[2],this[0])}get xxzy(){return new this._Vec4(this[0],this[0],this[2],this[1])}get xxzz(){return new this._Vec4(this[0],this[0],this[2],this[2])}get xxzw(){return new this._Vec4(this[0],this[0],this[2],this[3])}get xxwx(){return new this._Vec4(this[0],this[0],this[3],this[0])}get xxwy(){return new this._Vec4(this[0],this[0],this[3],this[1])}get xxwz(){return new this._Vec4(this[0],this[0],this[3],this[2])}get xxww(){return new this._Vec4(this[0],this[0],this[3],this[3])}get xyxx(){return new this._Vec4(this[0],this[1],this[0],this[0])}get xyxy(){return new this._Vec4(this[0],this[1],this[0],this[1])}get xyxz(){return new this._Vec4(this[0],this[1],this[0],this[2])}get xyxw(){return new this._Vec4(this[0],this[1],this[0],this[3])}get xyyx(){return new this._Vec4(this[0],this[1],this[1],this[0])}get xyyy(){return new this._Vec4(this[0],this[1],this[1],this[1])}get xyyz(){return new this._Vec4(this[0],this[1],this[1],this[2])}get xyyw(){return new this._Vec4(this[0],this[1],this[1],this[3])}get xyzx(){return new this._Vec4(this[0],this[1],this[2],this[0])}get xyzy(){return new this._Vec4(this[0],this[1],this[2],this[1])}get xyzz(){return new this._Vec4(this[0],this[1],this[2],this[2])}get xyzw(){return new this._Vec4(this[0],this[1],this[2],this[3])}get xywx(){return new this._Vec4(this[0],this[1],this[3],this[0])}get xywy(){return new this._Vec4(this[0],this[1],this[3],this[1])}get xywz(){return new this._Vec4(this[0],this[1],this[3],this[2])}get xyww(){return new this._Vec4(this[0],this[1],this[3],this[3])}get xzxx(){return new this._Vec4(this[0],this[2],this[0],this[0])}get xzxy(){return new this._Vec4(this[0],this[2],this[0],this[1])}get xzxz(){return new this._Vec4(this[0],this[2],this[0],this[2])}get xzxw(){return new this._Vec4(this[0],this[2],this[0],this[3])}get xzyx(){return new this._Vec4(this[0],this[2],this[1],this[0])}get xzyy(){return new this._Vec4(this[0],this[2],this[1],this[1])}get xzyz(){return new this._Vec4(this[0],this[2],this[1],this[2])}get xzyw(){return new this._Vec4(this[0],this[2],this[1],this[3])}get xzzx(){return new this._Vec4(this[0],this[2],this[2],this[0])}get xzzy(){return new this._Vec4(this[0],this[2],this[2],this[1])}get xzzz(){return new this._Vec4(this[0],this[2],this[2],this[2])}get xzzw(){return new this._Vec4(this[0],this[2],this[2],this[3])}get xzwx(){return new this._Vec4(this[0],this[2],this[3],this[0])}get xzwy(){return new this._Vec4(this[0],this[2],this[3],this[1])}get xzwz(){return new this._Vec4(this[0],this[2],this[3],this[2])}get xzww(){return new this._Vec4(this[0],this[2],this[3],this[3])}get xwxx(){return new this._Vec4(this[0],this[3],this[0],this[0])}get xwxy(){return new this._Vec4(this[0],this[3],this[0],this[1])}get xwxz(){return new this._Vec4(this[0],this[3],this[0],this[2])}get xwxw(){return new this._Vec4(this[0],this[3],this[0],this[3])}get xwyx(){return new this._Vec4(this[0],this[3],this[1],this[0])}get xwyy(){return new this._Vec4(this[0],this[3],this[1],this[1])}get xwyz(){return new this._Vec4(this[0],this[3],this[1],this[2])}get xwyw(){return new this._Vec4(this[0],this[3],this[1],this[3])}get xwzx(){return new this._Vec4(this[0],this[3],this[2],this[0])}get xwzy(){return new this._Vec4(this[0],this[3],this[2],this[1])}get xwzz(){return new this._Vec4(this[0],this[3],this[2],this[2])}get xwzw(){return new this._Vec4(this[0],this[3],this[2],this[3])}get xwwx(){return new this._Vec4(this[0],this[3],this[3],this[0])}get xwwy(){return new this._Vec4(this[0],this[3],this[3],this[1])}get xwwz(){return new this._Vec4(this[0],this[3],this[3],this[2])}get xwww(){return new this._Vec4(this[0],this[3],this[3],this[3])}get yxxx(){return new this._Vec4(this[1],this[0],this[0],this[0])}get yxxy(){return new this._Vec4(this[1],this[0],this[0],this[1])}get yxxz(){return new this._Vec4(this[1],this[0],this[0],this[2])}get yxxw(){return new this._Vec4(this[1],this[0],this[0],this[3])}get yxyx(){return new this._Vec4(this[1],this[0],this[1],this[0])}get yxyy(){return new this._Vec4(this[1],this[0],this[1],this[1])}get yxyz(){return new this._Vec4(this[1],this[0],this[1],this[2])}get yxyw(){return new this._Vec4(this[1],this[0],this[1],this[3])}get yxzx(){return new this._Vec4(this[1],this[0],this[2],this[0])}get yxzy(){return new this._Vec4(this[1],this[0],this[2],this[1])}get yxzz(){return new this._Vec4(this[1],this[0],this[2],this[2])}get yxzw(){return new this._Vec4(this[1],this[0],this[2],this[3])}get yxwx(){return new this._Vec4(this[1],this[0],this[3],this[0])}get yxwy(){return new this._Vec4(this[1],this[0],this[3],this[1])}get yxwz(){return new this._Vec4(this[1],this[0],this[3],this[2])}get yxww(){return new this._Vec4(this[1],this[0],this[3],this[3])}get yyxx(){return new this._Vec4(this[1],this[1],this[0],this[0])}get yyxy(){return new this._Vec4(this[1],this[1],this[0],this[1])}get yyxz(){return new this._Vec4(this[1],this[1],this[0],this[2])}get yyxw(){return new this._Vec4(this[1],this[1],this[0],this[3])}get yyyx(){return new this._Vec4(this[1],this[1],this[1],this[0])}get yyyy(){return new this._Vec4(this[1],this[1],this[1],this[1])}get yyyz(){return new this._Vec4(this[1],this[1],this[1],this[2])}get yyyw(){return new this._Vec4(this[1],this[1],this[1],this[3])}get yyzx(){return new this._Vec4(this[1],this[1],this[2],this[0])}get yyzy(){return new this._Vec4(this[1],this[1],this[2],this[1])}get yyzz(){return new this._Vec4(this[1],this[1],this[2],this[2])}get yyzw(){return new this._Vec4(this[1],this[1],this[2],this[3])}get yywx(){return new this._Vec4(this[1],this[1],this[3],this[0])}get yywy(){return new this._Vec4(this[1],this[1],this[3],this[1])}get yywz(){return new this._Vec4(this[1],this[1],this[3],this[2])}get yyww(){return new this._Vec4(this[1],this[1],this[3],this[3])}get yzxx(){return new this._Vec4(this[1],this[2],this[0],this[0])}get yzxy(){return new this._Vec4(this[1],this[2],this[0],this[1])}get yzxz(){return new this._Vec4(this[1],this[2],this[0],this[2])}get yzxw(){return new this._Vec4(this[1],this[2],this[0],this[3])}get yzyx(){return new this._Vec4(this[1],this[2],this[1],this[0])}get yzyy(){return new this._Vec4(this[1],this[2],this[1],this[1])}get yzyz(){return new this._Vec4(this[1],this[2],this[1],this[2])}get yzyw(){return new this._Vec4(this[1],this[2],this[1],this[3])}get yzzx(){return new this._Vec4(this[1],this[2],this[2],this[0])}get yzzy(){return new this._Vec4(this[1],this[2],this[2],this[1])}get yzzz(){return new this._Vec4(this[1],this[2],this[2],this[2])}get yzzw(){return new this._Vec4(this[1],this[2],this[2],this[3])}get yzwx(){return new this._Vec4(this[1],this[2],this[3],this[0])}get yzwy(){return new this._Vec4(this[1],this[2],this[3],this[1])}get yzwz(){return new this._Vec4(this[1],this[2],this[3],this[2])}get yzww(){return new this._Vec4(this[1],this[2],this[3],this[3])}get ywxx(){return new this._Vec4(this[1],this[3],this[0],this[0])}get ywxy(){return new this._Vec4(this[1],this[3],this[0],this[1])}get ywxz(){return new this._Vec4(this[1],this[3],this[0],this[2])}get ywxw(){return new this._Vec4(this[1],this[3],this[0],this[3])}get ywyx(){return new this._Vec4(this[1],this[3],this[1],this[0])}get ywyy(){return new this._Vec4(this[1],this[3],this[1],this[1])}get ywyz(){return new this._Vec4(this[1],this[3],this[1],this[2])}get ywyw(){return new this._Vec4(this[1],this[3],this[1],this[3])}get ywzx(){return new this._Vec4(this[1],this[3],this[2],this[0])}get ywzy(){return new this._Vec4(this[1],this[3],this[2],this[1])}get ywzz(){return new this._Vec4(this[1],this[3],this[2],this[2])}get ywzw(){return new this._Vec4(this[1],this[3],this[2],this[3])}get ywwx(){return new this._Vec4(this[1],this[3],this[3],this[0])}get ywwy(){return new this._Vec4(this[1],this[3],this[3],this[1])}get ywwz(){return new this._Vec4(this[1],this[3],this[3],this[2])}get ywww(){return new this._Vec4(this[1],this[3],this[3],this[3])}get zxxx(){return new this._Vec4(this[2],this[0],this[0],this[0])}get zxxy(){return new this._Vec4(this[2],this[0],this[0],this[1])}get zxxz(){return new this._Vec4(this[2],this[0],this[0],this[2])}get zxxw(){return new this._Vec4(this[2],this[0],this[0],this[3])}get zxyx(){return new this._Vec4(this[2],this[0],this[1],this[0])}get zxyy(){return new this._Vec4(this[2],this[0],this[1],this[1])}get zxyz(){return new this._Vec4(this[2],this[0],this[1],this[2])}get zxyw(){return new this._Vec4(this[2],this[0],this[1],this[3])}get zxzx(){return new this._Vec4(this[2],this[0],this[2],this[0])}get zxzy(){return new this._Vec4(this[2],this[0],this[2],this[1])}get zxzz(){return new this._Vec4(this[2],this[0],this[2],this[2])}get zxzw(){return new this._Vec4(this[2],this[0],this[2],this[3])}get zxwx(){return new this._Vec4(this[2],this[0],this[3],this[0])}get zxwy(){return new this._Vec4(this[2],this[0],this[3],this[1])}get zxwz(){return new this._Vec4(this[2],this[0],this[3],this[2])}get zxww(){return new this._Vec4(this[2],this[0],this[3],this[3])}get zyxx(){return new this._Vec4(this[2],this[1],this[0],this[0])}get zyxy(){return new this._Vec4(this[2],this[1],this[0],this[1])}get zyxz(){return new this._Vec4(this[2],this[1],this[0],this[2])}get zyxw(){return new this._Vec4(this[2],this[1],this[0],this[3])}get zyyx(){return new this._Vec4(this[2],this[1],this[1],this[0])}get zyyy(){return new this._Vec4(this[2],this[1],this[1],this[1])}get zyyz(){return new this._Vec4(this[2],this[1],this[1],this[2])}get zyyw(){return new this._Vec4(this[2],this[1],this[1],this[3])}get zyzx(){return new this._Vec4(this[2],this[1],this[2],this[0])}get zyzy(){return new this._Vec4(this[2],this[1],this[2],this[1])}get zyzz(){return new this._Vec4(this[2],this[1],this[2],this[2])}get zyzw(){return new this._Vec4(this[2],this[1],this[2],this[3])}get zywx(){return new this._Vec4(this[2],this[1],this[3],this[0])}get zywy(){return new this._Vec4(this[2],this[1],this[3],this[1])}get zywz(){return new this._Vec4(this[2],this[1],this[3],this[2])}get zyww(){return new this._Vec4(this[2],this[1],this[3],this[3])}get zzxx(){return new this._Vec4(this[2],this[2],this[0],this[0])}get zzxy(){return new this._Vec4(this[2],this[2],this[0],this[1])}get zzxz(){return new this._Vec4(this[2],this[2],this[0],this[2])}get zzxw(){return new this._Vec4(this[2],this[2],this[0],this[3])}get zzyx(){return new this._Vec4(this[2],this[2],this[1],this[0])}get zzyy(){return new this._Vec4(this[2],this[2],this[1],this[1])}get zzyz(){return new this._Vec4(this[2],this[2],this[1],this[2])}get zzyw(){return new this._Vec4(this[2],this[2],this[1],this[3])}get zzzx(){return new this._Vec4(this[2],this[2],this[2],this[0])}get zzzy(){return new this._Vec4(this[2],this[2],this[2],this[1])}get zzzz(){return new this._Vec4(this[2],this[2],this[2],this[2])}get zzzw(){return new this._Vec4(this[2],this[2],this[2],this[3])}get zzwx(){return new this._Vec4(this[2],this[2],this[3],this[0])}get zzwy(){return new this._Vec4(this[2],this[2],this[3],this[1])}get zzwz(){return new this._Vec4(this[2],this[2],this[3],this[2])}get zzww(){return new this._Vec4(this[2],this[2],this[3],this[3])}get zwxx(){return new this._Vec4(this[2],this[3],this[0],this[0])}get zwxy(){return new this._Vec4(this[2],this[3],this[0],this[1])}get zwxz(){return new this._Vec4(this[2],this[3],this[0],this[2])}get zwxw(){return new this._Vec4(this[2],this[3],this[0],this[3])}get zwyx(){return new this._Vec4(this[2],this[3],this[1],this[0])}get zwyy(){return new this._Vec4(this[2],this[3],this[1],this[1])}get zwyz(){return new this._Vec4(this[2],this[3],this[1],this[2])}get zwyw(){return new this._Vec4(this[2],this[3],this[1],this[3])}get zwzx(){return new this._Vec4(this[2],this[3],this[2],this[0])}get zwzy(){return new this._Vec4(this[2],this[3],this[2],this[1])}get zwzz(){return new this._Vec4(this[2],this[3],this[2],this[2])}get zwzw(){return new this._Vec4(this[2],this[3],this[2],this[3])}get zwwx(){return new this._Vec4(this[2],this[3],this[3],this[0])}get zwwy(){return new this._Vec4(this[2],this[3],this[3],this[1])}get zwwz(){return new this._Vec4(this[2],this[3],this[3],this[2])}get zwww(){return new this._Vec4(this[2],this[3],this[3],this[3])}get wxxx(){return new this._Vec4(this[3],this[0],this[0],this[0])}get wxxy(){return new this._Vec4(this[3],this[0],this[0],this[1])}get wxxz(){return new this._Vec4(this[3],this[0],this[0],this[2])}get wxxw(){return new this._Vec4(this[3],this[0],this[0],this[3])}get wxyx(){return new this._Vec4(this[3],this[0],this[1],this[0])}get wxyy(){return new this._Vec4(this[3],this[0],this[1],this[1])}get wxyz(){return new this._Vec4(this[3],this[0],this[1],this[2])}get wxyw(){return new this._Vec4(this[3],this[0],this[1],this[3])}get wxzx(){return new this._Vec4(this[3],this[0],this[2],this[0])}get wxzy(){return new this._Vec4(this[3],this[0],this[2],this[1])}get wxzz(){return new this._Vec4(this[3],this[0],this[2],this[2])}get wxzw(){return new this._Vec4(this[3],this[0],this[2],this[3])}get wxwx(){return new this._Vec4(this[3],this[0],this[3],this[0])}get wxwy(){return new this._Vec4(this[3],this[0],this[3],this[1])}get wxwz(){return new this._Vec4(this[3],this[0],this[3],this[2])}get wxww(){return new this._Vec4(this[3],this[0],this[3],this[3])}get wyxx(){return new this._Vec4(this[3],this[1],this[0],this[0])}get wyxy(){return new this._Vec4(this[3],this[1],this[0],this[1])}get wyxz(){return new this._Vec4(this[3],this[1],this[0],this[2])}get wyxw(){return new this._Vec4(this[3],this[1],this[0],this[3])}get wyyx(){return new this._Vec4(this[3],this[1],this[1],this[0])}get wyyy(){return new this._Vec4(this[3],this[1],this[1],this[1])}get wyyz(){return new this._Vec4(this[3],this[1],this[1],this[2])}get wyyw(){return new this._Vec4(this[3],this[1],this[1],this[3])}get wyzx(){return new this._Vec4(this[3],this[1],this[2],this[0])}get wyzy(){return new this._Vec4(this[3],this[1],this[2],this[1])}get wyzz(){return new this._Vec4(this[3],this[1],this[2],this[2])}get wyzw(){return new this._Vec4(this[3],this[1],this[2],this[3])}get wywx(){return new this._Vec4(this[3],this[1],this[3],this[0])}get wywy(){return new this._Vec4(this[3],this[1],this[3],this[1])}get wywz(){return new this._Vec4(this[3],this[1],this[3],this[2])}get wyww(){return new this._Vec4(this[3],this[1],this[3],this[3])}get wzxx(){return new this._Vec4(this[3],this[2],this[0],this[0])}get wzxy(){return new this._Vec4(this[3],this[2],this[0],this[1])}get wzxz(){return new this._Vec4(this[3],this[2],this[0],this[2])}get wzxw(){return new this._Vec4(this[3],this[2],this[0],this[3])}get wzyx(){return new this._Vec4(this[3],this[2],this[1],this[0])}get wzyy(){return new this._Vec4(this[3],this[2],this[1],this[1])}get wzyz(){return new this._Vec4(this[3],this[2],this[1],this[2])}get wzyw(){return new this._Vec4(this[3],this[2],this[1],this[3])}get wzzx(){return new this._Vec4(this[3],this[2],this[2],this[0])}get wzzy(){return new this._Vec4(this[3],this[2],this[2],this[1])}get wzzz(){return new this._Vec4(this[3],this[2],this[2],this[2])}get wzzw(){return new this._Vec4(this[3],this[2],this[2],this[3])}get wzwx(){return new this._Vec4(this[3],this[2],this[3],this[0])}get wzwy(){return new this._Vec4(this[3],this[2],this[3],this[1])}get wzwz(){return new this._Vec4(this[3],this[2],this[3],this[2])}get wzww(){return new this._Vec4(this[3],this[2],this[3],this[3])}get wwxx(){return new this._Vec4(this[3],this[3],this[0],this[0])}get wwxy(){return new this._Vec4(this[3],this[3],this[0],this[1])}get wwxz(){return new this._Vec4(this[3],this[3],this[0],this[2])}get wwxw(){return new this._Vec4(this[3],this[3],this[0],this[3])}get wwyx(){return new this._Vec4(this[3],this[3],this[1],this[0])}get wwyy(){return new this._Vec4(this[3],this[3],this[1],this[1])}get wwyz(){return new this._Vec4(this[3],this[3],this[1],this[2])}get wwyw(){return new this._Vec4(this[3],this[3],this[1],this[3])}get wwzx(){return new this._Vec4(this[3],this[3],this[2],this[0])}get wwzy(){return new this._Vec4(this[3],this[3],this[2],this[1])}get wwzz(){return new this._Vec4(this[3],this[3],this[2],this[2])}get wwzw(){return new this._Vec4(this[3],this[3],this[2],this[3])}get wwwx(){return new this._Vec4(this[3],this[3],this[3],this[0])}get wwwy(){return new this._Vec4(this[3],this[3],this[3],this[1])}get wwwz(){return new this._Vec4(this[3],this[3],this[3],this[2])}get wwww(){return new this._Vec4(this[3],this[3],this[3],this[3])}},W=class extends Ee{e0;e1;constructor(t,n){super(2),this.e0=this.getElementSchema()(t),this.e1=this.getElementSchema()(n??t)}get 0(){return this.e0}get 1(){return this.e1}set 0(t){this.e0=this.getElementSchema()(t)}set 1(t){this.e1=this.getElementSchema()(t)}get x(){return this[0]}get y(){return this[1]}set x(t){this[0]=this.getElementSchema()(t)}set y(t){this[1]=this.getElementSchema()(t)}},K=class extends Ee{e0;e1;e2;constructor(t,n,r){super(3),this.e0=this.getElementSchema()(t),this.e1=this.getElementSchema()(n??t),this.e2=this.getElementSchema()(r??t)}get 0(){return this.e0}get 1(){return this.e1}get 2(){return this.e2}set 0(t){this.e0=this.getElementSchema()(t)}set 1(t){this.e1=this.getElementSchema()(t)}set 2(t){this.e2=this.getElementSchema()(t)}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(t){this[0]=this.getElementSchema()(t)}set y(t){this[1]=this.getElementSchema()(t)}set z(t){this[2]=this.getElementSchema()(t)}},L=class extends Ee{e0;e1;e2;e3;constructor(t,n,r,s){super(4),this.e0=this.getElementSchema()(t),this.e1=this.getElementSchema()(n??t),this.e2=this.getElementSchema()(r??t),this.e3=this.getElementSchema()(s??t)}get 0(){return this.e0}get 1(){return this.e1}get 2(){return this.e2}get 3(){return this.e3}set 0(t){this.e0=this.getElementSchema()(t)}set 1(t){this.e1=this.getElementSchema()(t)}set 2(t){this.e2=this.getElementSchema()(t)}set 3(t){this.e3=this.getElementSchema()(t)}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(t){this[0]=t}set y(t){this[1]=t}set z(t){this[2]=t}set w(t){this[3]=t}},ae=class e extends W{getElementSchema(){return V}get kind(){return"vec2f"}get _Vec2(){return e}get _Vec3(){return he}get _Vec4(){return we}},oe=class e extends W{getElementSchema(){return E}get kind(){return"vec2h"}get _Vec2(){return e}get _Vec3(){return le}get _Vec4(){return pe}},ce=class e extends W{getElementSchema(){return R}get kind(){return"vec2i"}get _Vec2(){return e}get _Vec3(){return xe}get _Vec4(){return ve}},ue=class e extends W{getElementSchema(){return P}get kind(){return"vec2u"}get _Vec2(){return e}get _Vec3(){return de}get _Vec4(){return ge}},ye=class e extends W{getElementSchema(){return F}get kind(){return"vec2<bool>"}get _Vec2(){return e}get _Vec3(){return me}get _Vec4(){return fe}},he=class e extends K{getElementSchema(){return V}get kind(){return"vec3f"}get _Vec2(){return ae}get _Vec3(){return e}get _Vec4(){return we}},le=class e extends K{getElementSchema(){return E}get kind(){return"vec3h"}get _Vec2(){return oe}get _Vec3(){return e}get _Vec4(){return pe}},xe=class e extends K{getElementSchema(){return R}get kind(){return"vec3i"}get _Vec2(){return ce}get _Vec3(){return e}get _Vec4(){return ve}},de=class e extends K{getElementSchema(){return P}get kind(){return"vec3u"}get _Vec2(){return ue}get _Vec3(){return e}get _Vec4(){return ge}},me=class e extends K{getElementSchema(){return F}get kind(){return"vec3<bool>"}get _Vec2(){return ye}get _Vec3(){return e}get _Vec4(){return fe}},we=class e extends L{getElementSchema(){return V}get kind(){return"vec4f"}get _Vec2(){return ae}get _Vec3(){return he}get _Vec4(){return e}},pe=class e extends L{getElementSchema(){return E}get kind(){return"vec4h"}get _Vec2(){return oe}get _Vec3(){return le}get _Vec4(){return e}},ve=class e extends L{getElementSchema(){return R}get kind(){return"vec4i"}get _Vec2(){return ce}get _Vec3(){return xe}get _Vec4(){return e}},ge=class e extends L{getElementSchema(){return P}get kind(){return"vec4u"}get _Vec2(){return ue}get _Vec3(){return de}get _Vec4(){return e}},fe=class e extends L{getElementSchema(){return F}get kind(){return"vec4<bool>"}get _Vec2(){return ye}get _Vec3(){return me}get _Vec4(){return e}};var f=b(ae),A=b(oe),j=b(ce),G=b(ue),S=b(ye),v=b(he),I=b(le),q=b(xe),Y=b(de),_=b(me),T=b(we),k=b(pe),H=b(ve),Z=b(ge),M=b(fe),Te={vec2f:f,vec2h:A,vec2i:j,vec2u:G,"vec2<bool>":S,vec3f:v,vec3h:I,vec3i:q,vec3u:Y,"vec3<bool>":_,vec4f:T,vec4h:k,vec4i:H,vec4u:Z,"vec4<bool>":M},cn={vec2f:V,vec2h:E,vec2i:R,vec2u:P,"vec2<bool>":F,vec3f:V,vec3h:E,vec3i:R,vec3u:P,"vec3<bool>":F,vec4f:V,vec4h:E,vec4i:R,vec4u:P,"vec4<bool>":F};function b(e){let{kind:t,length:n}=new e,r=i((...s)=>{let y=new Array(s.length),$=0;for(let Pe of s)if(typeof Pe=="number"||typeof Pe=="boolean")y[$++]=Pe;else for(let qe=0;qe<Pe.length;++qe)y[$++]=Pe[qe];if(y.length<=1||y.length===n)return new e(...y);throw new Error(`'${t}' constructor called with invalid number of arguments.`)},(...s)=>a(`${t}(${s.map(y=>y.value).join(", ")})`,Te[t]),t,(...s)=>s.map(y=>{let $=y.dataType;return St($)&&($=$.inner),zt($)?$:cn[t]}));return Object.assign(r,{type:t,[at]:void 0})}var Ue=class{};function rt(e){let t={[o]:!0,type:e.type,identity:ln[e.columns],translation:e.columns===4?xn:void 0,scaling:e.columns===4?dn:void 0,rotationX:e.columns===4?mn:void 0,rotationY:e.columns===4?wn:void 0,rotationZ:e.columns===4?pn:void 0},n=i((...r)=>{let s=[];for(let y of r)if(typeof y=="number")s.push(y);else for(let $=0;$<y.length;++$)s.push(y[$]);if(s.length!==0&&s.length!==e.columns*e.rows)throw new Error(`'${e.type}' constructor called with invalid number of arguments.`);for(let y=s.length;y<e.columns*e.rows;++y)s.push(0);return new e.MatImpl(...s)},(...r)=>a(`${t.type}(${r.map(s=>s.value).join(", ")})`,t),t.type);return Object.assign(n,t)}var Xe=class extends Ue{[o]=!0;columns;length=4;constructor(...t){super(),this.columns=[this.makeColumn(t[0],t[1]),this.makeColumn(t[2],t[3])]}get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[1].x}get 3(){return this.columns[1].y}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[1].x=t}set 3(t){this.columns[1].y=t}*[Symbol.iterator](){yield this[0],yield this[1],yield this[2],yield this[3]}"~resolve"(){return`${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`}},Je=class extends Xe{kind="mat2x2f";makeColumn(t,n){return f(t,n)}},Qe=class extends Ue{[o]=!0;columns;length=12;constructor(...t){super(),this.columns=[this.makeColumn(t[0],t[1],t[2]),this.makeColumn(t[3],t[4],t[5]),this.makeColumn(t[6],t[7],t[8])]}get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[0].z}get 3(){return 0}get 4(){return this.columns[1].x}get 5(){return this.columns[1].y}get 6(){return this.columns[1].z}get 7(){return 0}get 8(){return this.columns[2].x}get 9(){return this.columns[2].y}get 10(){return this.columns[2].z}get 11(){return 0}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[0].z=t}set 3(t){}set 4(t){this.columns[1].x=t}set 5(t){this.columns[1].y=t}set 6(t){this.columns[1].z=t}set 7(t){}set 8(t){this.columns[2].x=t}set 9(t){this.columns[2].y=t}set 10(t){this.columns[2].z=t}set 11(t){}*[Symbol.iterator](){for(let t=0;t<12;t++)yield this[t]}"~resolve"(){return`${this.kind}(${this[0]}, ${this[1]}, ${this[2]}, ${this[4]}, ${this[5]}, ${this[6]}, ${this[8]}, ${this[9]}, ${this[10]})`}},et=class extends Qe{kind="mat3x3f";makeColumn(t,n,r){return v(t,n,r)}},tt=class extends Ue{[o]=!0;columns;constructor(...t){super(),this.columns=[this.makeColumn(t[0],t[1],t[2],t[3]),this.makeColumn(t[4],t[5],t[6],t[7]),this.makeColumn(t[8],t[9],t[10],t[11]),this.makeColumn(t[12],t[13],t[14],t[15])]}length=16;get 0(){return this.columns[0].x}get 1(){return this.columns[0].y}get 2(){return this.columns[0].z}get 3(){return this.columns[0].w}get 4(){return this.columns[1].x}get 5(){return this.columns[1].y}get 6(){return this.columns[1].z}get 7(){return this.columns[1].w}get 8(){return this.columns[2].x}get 9(){return this.columns[2].y}get 10(){return this.columns[2].z}get 11(){return this.columns[2].w}get 12(){return this.columns[3].x}get 13(){return this.columns[3].y}get 14(){return this.columns[3].z}get 15(){return this.columns[3].w}set 0(t){this.columns[0].x=t}set 1(t){this.columns[0].y=t}set 2(t){this.columns[0].z=t}set 3(t){this.columns[0].w=t}set 4(t){this.columns[1].x=t}set 5(t){this.columns[1].y=t}set 6(t){this.columns[1].z=t}set 7(t){this.columns[1].w=t}set 8(t){this.columns[2].x=t}set 9(t){this.columns[2].y=t}set 10(t){this.columns[2].z=t}set 11(t){this.columns[2].w=t}set 12(t){this.columns[3].x=t}set 13(t){this.columns[3].y=t}set 14(t){this.columns[3].z=t}set 15(t){this.columns[3].w=t}*[Symbol.iterator](){for(let t=0;t<16;t++)yield this[t]}"~resolve"(){return`${this.kind}(${Array.from({length:this.length}).map((t,n)=>this[n]).join(", ")})`}},nt=class extends tt{kind="mat4x4f";makeColumn(t,n,r,s){return T(t,n,r,s)}},un=i(()=>be(1,0,0,1),()=>({value:`mat4x4f(
6
+ 1.0, 0.0,
7
+ 0.0, 1.0
8
+ )`,dataType:be}),"identity2"),yn=i(()=>ze(1,0,0,0,1,0,0,0,1),()=>({value:`mat4x4f(
9
+ 1.0, 0.0, 0.0,
10
+ 0.0, 1.0, 0.0,
11
+ 0.0, 0.0, 1.0,
12
+ )`,dataType:ze}),"identity3"),hn=i(()=>g(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),()=>({value:`mat4x4f(
13
+ 1.0, 0.0, 0.0, 0.0,
14
+ 0.0, 1.0, 0.0, 0.0,
15
+ 0.0, 0.0, 1.0, 0.0,
16
+ 0.0, 0.0, 0.0, 1.0
17
+ )`,dataType:g}),"identity4"),ln={2:un,3:yn,4:hn},xn=i(e=>g(1,0,0,0,0,1,0,0,0,0,1,0,e.x,e.y,e.z,1),e=>({value:`mat4x4f(
18
+ 1, 0, 0, 0,
19
+ 0, 1, 0, 0,
20
+ 0, 0, 1, 0,
21
+ ${e.value}.x, ${e.value}.y, ${e.value}.z, 1
22
+ )`,dataType:g}),"translation4"),dn=i(e=>g(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1),e=>({value:`mat4x4f(
23
+ ${e.value}.x, 0, 0, 0,
24
+ 0, ${e.value}.y, 0, 0,
25
+ 0, 0, ${e.value}.z, 0,
26
+ 0, 0, 0, 1
27
+ )`,dataType:g}),"scaling4"),mn=i(e=>g(1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1),e=>a(`mat4x4f(
28
+ 1, 0, 0, 0,
29
+ 0, cos(${e.value}), sin(${e.value}), 0,
30
+ 0, -sin(${e.value}), cos(${e.value}), 0,
31
+ 0, 0, 0, 1
32
+ )`,g),"rotationX4"),wn=i(e=>g(Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1),e=>a(`mat4x4f(
33
+ cos(${e.value}), 0, -sin(${e.value}), 0,
34
+ 0, 1, 0, 0,
35
+ sin(${e.value}), 0, cos(${e.value}), 0,
36
+ 0, 0, 0, 1
37
+ )`,g),"rotationY4"),pn=i(e=>g(Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1,0,0,0,0,1),e=>a(`mat4x4f(
38
+ cos(${e.value}), sin(${e.value}), 0, 0,
39
+ -sin(${e.value}), cos(${e.value}), 0, 0,
40
+ 0, 0, 1, 0,
41
+ 0, 0, 0, 1
42
+ )`,g),"rotationZ4"),be=rt({type:"mat2x2f",rows:2,columns:2,MatImpl:Je}),ze=rt({type:"mat3x3f",rows:3,columns:3,MatImpl:et}),g=rt({type:"mat4x4f",rows:4,columns:4,MatImpl:nt});function us(e){return e.kind==="mat3x3f"?[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]]:Array.from({length:e.length}).map((t,n)=>e[n])}var U=(e,t,n)=>{if(e===t)return 0;let r=u((n-e)/(t-e),0,1);return r*r*(3-2*r)},u=(e,t,n)=>Math.min(Math.max(t,e),n),X=(e,t)=>t===0?e:Math.trunc(e/t);var Ve=e=>Math.sqrt(e.x**2+e.y**2),Se=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),_e=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),Le=(e,t)=>e.x*t.x+e.y*t.y,je=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,Ge=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,x=e=>t=>f(e(t.x),e(t.y)),d=e=>t=>A(e(t.x),e(t.y)),J=e=>t=>j(e(t.x),e(t.y)),Me=e=>t=>G(e(t.x),e(t.y)),l=e=>t=>v(e(t.x),e(t.y),e(t.z)),m=e=>t=>I(e(t.x),e(t.y),e(t.z)),Q=e=>t=>q(e(t.x),e(t.y),e(t.z)),$e=e=>t=>Y(e(t.x),e(t.y),e(t.z)),h=e=>t=>T(e(t.x),e(t.y),e(t.z),e(t.w)),w=e=>t=>k(e(t.x),e(t.y),e(t.z),e(t.w)),ee=e=>t=>H(e(t.x),e(t.y),e(t.z),e(t.w)),Ie=e=>t=>Z(e(t.x),e(t.y),e(t.z),e(t.w)),kt=e=>t=>{let n=t.columns;return be(x(e)(n[0]),x(e)(n[1]))},Bt=e=>t=>{let n=t.columns;return ze(l(e)(n[0]),l(e)(n[1]),l(e)(n[2]))},Dt=e=>t=>{let n=t.columns;return g(h(e)(n[0]),h(e)(n[1]),h(e)(n[2]),h(e)(n[3]))},C=e=>(t,n)=>f(e(t.x,n.x),e(t.y,n.y)),te=e=>(t,n)=>A(e(t.x,n.x),e(t.y,n.y)),Ae=e=>(t,n)=>j(e(t.x,n.x),e(t.y,n.y)),ke=e=>(t,n)=>G(e(t.x,n.x),e(t.y,n.y)),D=e=>(t,n)=>v(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ne=e=>(t,n)=>I(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),Be=e=>(t,n)=>q(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),De=e=>(t,n)=>Y(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),B=e=>(t,n)=>T(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),re=e=>(t,n)=>k(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),Ne=e=>(t,n)=>H(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),Fe=e=>(t,n)=>Z(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),vn=e=>(t,n)=>{let r=t.columns,s=n.columns;return be(C(e)(r[0],s[0]),C(e)(r[1],s[1]))},gn=e=>(t,n)=>{let r=t.columns,s=n.columns;return ze(D(e)(r[0],s[0]),D(e)(r[1],s[1]),D(e)(r[2],s[2]))},fn=e=>(t,n)=>{let r=t.columns,s=n.columns;return g(B(e)(r[0],s[0]),B(e)(r[1],s[1]),B(e)(r[2],s[2]),B(e)(r[3],s[3]))},Tn=e=>(t,n,r)=>f(e(t.x,n.x,r.x),e(t.y,n.y,r.y)),bn=e=>(t,n,r)=>A(e(t.x,n.x,r.x),e(t.y,n.y,r.y)),zn=e=>(t,n,r)=>v(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z)),Vn=e=>(t,n,r)=>I(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z)),Sn=e=>(t,n,r)=>T(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z),e(t.w,n.w,r.w)),_n=e=>(t,n,r)=>k(e(t.x,n.x,r.x),e(t.y,n.y,r.y),e(t.z,n.z,r.z),e(t.w,n.w,r.w)),c={eq:{vec2f:(e,t)=>S(e.x===t.x,e.y===t.y),vec2h:(e,t)=>S(e.x===t.x,e.y===t.y),vec2i:(e,t)=>S(e.x===t.x,e.y===t.y),vec2u:(e,t)=>S(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>S(e.x===t.x,e.y===t.y),vec3f:(e,t)=>_(e.x===t.x,e.y===t.y,e.z===t.z),vec3h:(e,t)=>_(e.x===t.x,e.y===t.y,e.z===t.z),vec3i:(e,t)=>_(e.x===t.x,e.y===t.y,e.z===t.z),vec3u:(e,t)=>_(e.x===t.x,e.y===t.y,e.z===t.z),"vec3<bool>":(e,t)=>_(e.x===t.x,e.y===t.y,e.z===t.z),vec4f:(e,t)=>M(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>M(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>M(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>M(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>M(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>S(e.x<t.x,e.y<t.y),vec2h:(e,t)=>S(e.x<t.x,e.y<t.y),vec2i:(e,t)=>S(e.x<t.x,e.y<t.y),vec2u:(e,t)=>S(e.x<t.x,e.y<t.y),vec3f:(e,t)=>_(e.x<t.x,e.y<t.y,e.z<t.z),vec3h:(e,t)=>_(e.x<t.x,e.y<t.y,e.z<t.z),vec3i:(e,t)=>_(e.x<t.x,e.y<t.y,e.z<t.z),vec3u:(e,t)=>_(e.x<t.x,e.y<t.y,e.z<t.z),vec4f:(e,t)=>M(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>M(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>M(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>M(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},or:{"vec2<bool>":(e,t)=>S(e.x||t.x,e.y||t.y),"vec3<bool>":(e,t)=>_(e.x||t.x,e.y||t.y,e.z||t.z),"vec4<bool>":(e,t)=>M(e.x||t.x,e.y||t.y,e.z||t.z,e.w||t.w)},all:{"vec2<bool>":e=>e.x&&e.y,"vec3<bool>":e=>e.x&&e.y&&e.z,"vec4<bool>":e=>e.x&&e.y&&e.z&&e.w},abs:{vec2f:x(Math.abs),vec2h:d(Math.abs),vec2i:J(Math.abs),vec2u:Me(Math.abs),vec3f:l(Math.abs),vec3h:m(Math.abs),vec3i:Q(Math.abs),vec3u:$e(Math.abs),vec4f:h(Math.abs),vec4h:w(Math.abs),vec4i:ee(Math.abs),vec4u:Ie(Math.abs)},atan2:{vec2f:C(Math.atan2),vec2h:te(Math.atan2),vec3f:D(Math.atan2),vec3h:ne(Math.atan2),vec4f:B(Math.atan2),vec4h:re(Math.atan2)},acos:{vec2f:x(Math.acos),vec2h:d(Math.acos),vec2i:J(Math.acos),vec2u:Me(Math.acos),vec3f:l(Math.acos),vec3h:m(Math.acos),vec3i:Q(Math.acos),vec3u:$e(Math.acos),vec4f:h(Math.acos),vec4h:w(Math.acos),vec4i:ee(Math.acos),vec4u:Ie(Math.acos)},acosh:{vec2f:x(Math.acosh),vec2h:d(Math.acosh),vec3f:l(Math.acosh),vec3h:m(Math.acosh),vec4f:h(Math.acosh),vec4h:w(Math.acosh)},asin:{vec2f:x(Math.asin),vec2h:d(Math.asin),vec2i:J(Math.asin),vec2u:Me(Math.asin),vec3f:l(Math.asin),vec3h:m(Math.asin),vec3i:Q(Math.asin),vec3u:$e(Math.asin),vec4f:h(Math.asin),vec4h:w(Math.asin),vec4i:ee(Math.asin),vec4u:Ie(Math.asin)},ceil:{vec2f:x(Math.ceil),vec2h:d(Math.ceil),vec3f:l(Math.ceil),vec3h:m(Math.ceil),vec4f:h(Math.ceil),vec4h:w(Math.ceil)},clamp:{vec2f:(e,t,n)=>f(u(e.x,t.x,n.x),u(e.y,t.y,n.y)),vec2h:(e,t,n)=>A(u(e.x,t.x,n.x),u(e.y,t.y,n.y)),vec2i:(e,t,n)=>j(u(e.x,t.x,n.x),u(e.y,t.y,n.y)),vec2u:(e,t,n)=>G(u(e.x,t.x,n.x),u(e.y,t.y,n.y)),vec3f:(e,t,n)=>v(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z)),vec3h:(e,t,n)=>I(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z)),vec3i:(e,t,n)=>q(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z)),vec3u:(e,t,n)=>Y(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z)),vec4f:(e,t,n)=>T(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z),u(e.w,t.w,n.w)),vec4h:(e,t,n)=>k(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z),u(e.w,t.w,n.w)),vec4i:(e,t,n)=>H(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z),u(e.w,t.w,n.w)),vec4u:(e,t,n)=>Z(u(e.x,t.x,n.x),u(e.y,t.y,n.y),u(e.z,t.z,n.z),u(e.w,t.w,n.w))},length:{vec2f:Ve,vec2h:Ve,vec3f:Se,vec3h:Se,vec4f:_e,vec4h:_e},add:{vec2f:C((e,t)=>e+t),vec2h:te((e,t)=>e+t),vec2i:Ae((e,t)=>e+t),vec2u:ke((e,t)=>e+t),vec3f:D((e,t)=>e+t),vec3h:ne((e,t)=>e+t),vec3i:Be((e,t)=>e+t),vec3u:De((e,t)=>e+t),vec4f:B((e,t)=>e+t),vec4h:re((e,t)=>e+t),vec4i:Ne((e,t)=>e+t),vec4u:Fe((e,t)=>e+t),mat2x2f:vn((e,t)=>e+t),mat3x3f:gn((e,t)=>e+t),mat4x4f:fn((e,t)=>e+t)},smoothstep:{vec2f:Tn(U),vec2h:bn(U),vec3f:zn(U),vec3h:Vn(U),vec4f:Sn(U),vec4h:_n(U)},addMixed:{vec2f:(e,t)=>x(n=>n+t)(e),vec2h:(e,t)=>d(n=>n+t)(e),vec2i:(e,t)=>J(n=>n+t)(e),vec2u:(e,t)=>Me(n=>n+t)(e),vec3f:(e,t)=>l(n=>n+t)(e),vec3h:(e,t)=>m(n=>n+t)(e),vec3i:(e,t)=>Q(n=>n+t)(e),vec3u:(e,t)=>$e(n=>n+t)(e),vec4f:(e,t)=>h(n=>n+t)(e),vec4h:(e,t)=>w(n=>n+t)(e),vec4i:(e,t)=>ee(n=>n+t)(e),vec4u:(e,t)=>Ie(n=>n+t)(e),mat2x2f:(e,t)=>kt(n=>n+t)(e),mat3x3f:(e,t)=>Bt(n=>n+t)(e),mat4x4f:(e,t)=>Dt(n=>n+t)(e)},mulSxV:{vec2f:(e,t)=>x(n=>e*n)(t),vec2h:(e,t)=>d(n=>e*n)(t),vec2i:(e,t)=>J(n=>e*n)(t),vec2u:(e,t)=>Me(n=>e*n)(t),vec3f:(e,t)=>l(n=>e*n)(t),vec3h:(e,t)=>m(n=>e*n)(t),vec3i:(e,t)=>Q(n=>e*n)(t),vec3u:(e,t)=>$e(n=>e*n)(t),vec4f:(e,t)=>h(n=>e*n)(t),vec4h:(e,t)=>w(n=>e*n)(t),vec4i:(e,t)=>ee(n=>e*n)(t),vec4u:(e,t)=>Ie(n=>e*n)(t),mat2x2f:(e,t)=>kt(n=>e*n)(t),mat3x3f:(e,t)=>Bt(n=>e*n)(t),mat4x4f:(e,t)=>Dt(n=>e*n)(t)},mulVxV:{vec2f:C((e,t)=>e*t),vec2h:te((e,t)=>e*t),vec2i:Ae((e,t)=>e*t),vec2u:ke((e,t)=>e*t),vec3f:D((e,t)=>e*t),vec3h:ne((e,t)=>e*t),vec3i:Be((e,t)=>e*t),vec3u:De((e,t)=>e*t),vec4f:B((e,t)=>e*t),vec4h:re((e,t)=>e*t),vec4i:Ne((e,t)=>e*t),vec4u:Fe((e,t)=>e*t),mat2x2f:(e,t)=>{let n=e.columns,r=t.columns;return be(n[0].x*r[0].x+n[1].x*r[0].y,n[0].y*r[0].x+n[1].y*r[0].y,n[0].x*r[1].x+n[1].x*r[1].y,n[0].y*r[1].x+n[1].y*r[1].y)},mat3x3f:(e,t)=>{let n=e.columns,r=t.columns;return ze(n[0].x*r[0].x+n[1].x*r[0].y+n[2].x*r[0].z,n[0].y*r[0].x+n[1].y*r[0].y+n[2].y*r[0].z,n[0].z*r[0].x+n[1].z*r[0].y+n[2].z*r[0].z,n[0].x*r[1].x+n[1].x*r[1].y+n[2].x*r[1].z,n[0].y*r[1].x+n[1].y*r[1].y+n[2].y*r[1].z,n[0].z*r[1].x+n[1].z*r[1].y+n[2].z*r[1].z,n[0].x*r[2].x+n[1].x*r[2].y+n[2].x*r[2].z,n[0].y*r[2].x+n[1].y*r[2].y+n[2].y*r[2].z,n[0].z*r[2].x+n[1].z*r[2].y+n[2].z*r[2].z)},mat4x4f:(e,t)=>{let n=e.columns,r=t.columns;return g(n[0].x*r[0].x+n[1].x*r[0].y+n[2].x*r[0].z+n[3].x*r[0].w,n[0].y*r[0].x+n[1].y*r[0].y+n[2].y*r[0].z+n[3].y*r[0].w,n[0].z*r[0].x+n[1].z*r[0].y+n[2].z*r[0].z+n[3].z*r[0].w,n[0].w*r[0].x+n[1].w*r[0].y+n[2].w*r[0].z+n[3].w*r[0].w,n[0].x*r[1].x+n[1].x*r[1].y+n[2].x*r[1].z+n[3].x*r[1].w,n[0].y*r[1].x+n[1].y*r[1].y+n[2].y*r[1].z+n[3].y*r[1].w,n[0].z*r[1].x+n[1].z*r[1].y+n[2].z*r[1].z+n[3].z*r[1].w,n[0].w*r[1].x+n[1].w*r[1].y+n[2].w*r[1].z+n[3].w*r[1].w,n[0].x*r[2].x+n[1].x*r[2].y+n[2].x*r[2].z+n[3].x*r[2].w,n[0].y*r[2].x+n[1].y*r[2].y+n[2].y*r[2].z+n[3].y*r[2].w,n[0].z*r[2].x+n[1].z*r[2].y+n[2].z*r[2].z+n[3].z*r[2].w,n[0].w*r[2].x+n[1].w*r[2].y+n[2].w*r[2].z+n[3].w*r[2].w,n[0].x*r[3].x+n[1].x*r[3].y+n[2].x*r[3].z+n[3].x*r[3].w,n[0].y*r[3].x+n[1].y*r[3].y+n[2].y*r[3].z+n[3].y*r[3].w,n[0].z*r[3].x+n[1].z*r[3].y+n[2].z*r[3].z+n[3].z*r[3].w,n[0].w*r[3].x+n[1].w*r[3].y+n[2].w*r[3].z+n[3].w*r[3].w)}},mulMxV:{mat2x2f:(e,t)=>{let n=e.columns;return f(n[0].x*t.x+n[1].x*t.y,n[0].y*t.x+n[1].y*t.y)},mat3x3f:(e,t)=>{let n=e.columns;return v(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z)},mat4x4f:(e,t)=>{let n=e.columns;return T(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z+n[3].x*t.w,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z+n[3].y*t.w,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z+n[3].z*t.w,n[0].w*t.x+n[1].w*t.y+n[2].w*t.z+n[3].w*t.w)}},mulVxM:{mat2x2f:(e,t)=>{let n=t.columns;return f(e.x*n[0].x+e.y*n[0].y,e.x*n[1].x+e.y*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return v(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return T(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z+e.w*n[0].w,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z+e.w*n[1].w,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z+e.w*n[2].w,e.x*n[3].x+e.y*n[3].y+e.z*n[3].z+e.w*n[3].w)}},div:{vec2f:C((e,t)=>e/t),vec2h:te((e,t)=>e/t),vec2i:Ae(X),vec2u:ke(X),vec3f:D((e,t)=>e/t),vec3h:ne((e,t)=>e/t),vec3i:Be(X),vec3u:De(X),vec4f:B((e,t)=>e/t),vec4h:re((e,t)=>e/t),vec4i:Ne(X),vec4u:Fe(X)},dot:{vec2f:Le,vec2h:Le,vec2i:Le,vec2u:Le,vec3f:je,vec3h:je,vec3i:je,vec3u:je,vec4f:Ge,vec4h:Ge,vec4i:Ge,vec4u:Ge},normalize:{vec2f:e=>{let t=Ve(e);return f(e.x/t,e.y/t)},vec2h:e=>{let t=Ve(e);return A(e.x/t,e.y/t)},vec2i:e=>{let t=Ve(e);return j(e.x/t,e.y/t)},vec2u:e=>{let t=Ve(e);return G(e.x/t,e.y/t)},vec3f:e=>{let t=Se(e);return v(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=Se(e);return I(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=Se(e);return q(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=Se(e);return Y(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=_e(e);return T(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=_e(e);return k(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=_e(e);return H(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=_e(e);return Z(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>v(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),vec3h:(e,t)=>I(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)},mod:{vec2f:C((e,t)=>e%t),vec2h:te((e,t)=>e%t),vec2i:Ae((e,t)=>e%t),vec2u:ke((e,t)=>e%t),vec3f:D((e,t)=>e%t),vec3h:ne((e,t)=>e%t),vec3i:Be((e,t)=>e%t),vec3u:De((e,t)=>e%t),vec4f:B((e,t)=>e%t),vec4h:re((e,t)=>e%t),vec4i:Ne((e,t)=>e%t),vec4u:Fe((e,t)=>e%t)},floor:{vec2f:x(Math.floor),vec2h:d(Math.floor),vec3f:l(Math.floor),vec3h:m(Math.floor),vec4f:h(Math.floor),vec4h:w(Math.floor)},max:{vec2f:C(Math.max),vec2h:te(Math.max),vec2i:Ae(Math.max),vec2u:ke(Math.max),vec3f:D(Math.max),vec3h:ne(Math.max),vec3i:Be(Math.max),vec3u:De(Math.max),vec4f:B(Math.max),vec4h:re(Math.max),vec4i:Ne(Math.max),vec4u:Fe(Math.max)},min:{vec2f:C(Math.min),vec2h:te(Math.min),vec2i:Ae(Math.min),vec2u:ke(Math.min),vec3f:D(Math.min),vec3h:ne(Math.min),vec3i:Be(Math.min),vec3u:De(Math.min),vec4f:B(Math.min),vec4h:re(Math.min),vec4i:Ne(Math.min),vec4u:Fe(Math.min)},pow:{vec2f:(e,t)=>f(e.x**t.x,e.y**t.y),vec2h:(e,t)=>A(e.x**t.x,e.y**t.y),vec3f:(e,t)=>v(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>I(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>T(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w),vec4h:(e,t)=>k(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w)},sign:{vec2f:x(Math.sign),vec2h:d(Math.sign),vec2i:J(Math.sign),vec3f:l(Math.sign),vec3h:m(Math.sign),vec3i:Q(Math.sign),vec4f:h(Math.sign),vec4h:w(Math.sign),vec4i:ee(Math.sign)},sqrt:{vec2f:x(Math.sqrt),vec2h:d(Math.sqrt),vec3f:l(Math.sqrt),vec3h:m(Math.sqrt),vec4f:h(Math.sqrt),vec4h:w(Math.sqrt)},mix:{vec2f:(e,t,n)=>typeof n=="number"?f(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):f(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec2h:(e,t,n)=>typeof n=="number"?A(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):A(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec3f:(e,t,n)=>typeof n=="number"?v(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):v(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec3h:(e,t,n)=>typeof n=="number"?I(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):I(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec4f:(e,t,n)=>typeof n=="number"?T(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):T(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?k(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):k(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w)},sin:{vec2f:x(Math.sin),vec2h:d(Math.sin),vec3f:l(Math.sin),vec3h:m(Math.sin),vec4f:h(Math.sin),vec4h:w(Math.sin)},cos:{vec2f:x(Math.cos),vec2h:d(Math.cos),vec3f:l(Math.cos),vec3h:m(Math.cos),vec4f:h(Math.cos),vec4h:w(Math.cos)},cosh:{vec2f:x(Math.cosh),vec2h:d(Math.cosh),vec3f:l(Math.cosh),vec3h:m(Math.cosh),vec4f:h(Math.cosh),vec4h:w(Math.cosh)},exp:{vec2f:x(Math.exp),vec2h:d(Math.exp),vec3f:l(Math.exp),vec3h:m(Math.exp),vec4f:h(Math.exp),vec4h:w(Math.exp)},exp2:{vec2f:x(e=>2**e),vec2h:d(e=>2**e),vec3f:l(e=>2**e),vec3h:m(e=>2**e),vec4f:h(e=>2**e),vec4h:w(e=>2**e)},log:{vec2f:x(Math.log),vec2h:d(Math.log),vec3f:l(Math.log),vec3h:m(Math.log),vec4f:h(Math.log),vec4h:w(Math.log)},log2:{vec2f:x(Math.log2),vec2h:d(Math.log2),vec3f:l(Math.log2),vec3h:m(Math.log2),vec4f:h(Math.log2),vec4h:w(Math.log2)},fract:{vec2f:x(e=>e-Math.floor(e)),vec2h:d(e=>e-Math.floor(e)),vec3f:l(e=>e-Math.floor(e)),vec3h:m(e=>e-Math.floor(e)),vec4f:h(e=>e-Math.floor(e)),vec4h:w(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec2h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec3f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec3h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec4f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t,vec4h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t},neg:{vec2f:x(e=>-e),vec2h:d(e=>-e),vec2i:J(e=>-e),vec2u:Me(e=>-e),"vec2<bool>":e=>S(!e.x,!e.y),vec3f:l(e=>-e),vec3h:m(e=>-e),vec3i:Q(e=>-e),vec3u:$e(e=>-e),"vec3<bool>":e=>_(!e.x,!e.y,!e.z),vec4f:h(e=>-e),vec4h:w(e=>-e),vec4i:ee(e=>-e),vec4u:Ie(e=>-e),"vec4<bool>":e=>M(!e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,t,n)=>f(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>A(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>j(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>G(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>S(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>v(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>I(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>q(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>Y(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),"vec3<bool>":(e,t,n)=>_(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec4f:(e,t,n)=>T(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4h:(e,t,n)=>k(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4i:(e,t,n)=>H(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4u:(e,t,n)=>Z(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),"vec4<bool>":(e,t,n)=>M(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w)},tanh:{vec2f:x(Math.tanh),vec2h:d(Math.tanh),vec3f:l(Math.tanh),vec3h:m(Math.tanh),vec4f:h(Math.tanh),vec4h:w(Math.tanh)}};function se(e){return Mn(e.dataType)}function Mn(e){let t=e?.type;return!!e?.[o]&&(t==="abstractInt"||t==="abstractFloat"||t==="f32"||t==="f16"||t==="i32"||t==="u32")}function Nt(e,t){if(typeof e=="number"&&typeof t=="number")return e+t;if(typeof e=="number"&&p(t))return c.addMixed[t.kind](t,e);if(p(e)&&typeof t=="number")return c.addMixed[e.kind](e,t);if(p(e)&&p(t)||N(e)&&N(t))return c.add[e.kind](e,t);throw new Error("Add/Sub called with invalid arguments.")}var Vs=i(Nt,(e,t)=>a(`(${e.value} + ${t.value})`,se(e)?t.dataType:e.dataType),"unify");function $n(e,t){return Nt(e,Pt(-1,t))}var Ft=i($n,(e,t)=>a(`(${e.value} - ${t.value})`,se(e)?t.dataType:e.dataType),"sub","unify");function In(e,t){if(typeof e=="number"&&typeof t=="number")return e*t;if(typeof e=="number"&&(p(t)||N(t)))return c.mulSxV[t.kind](e,t);if((p(e)||N(e))&&typeof t=="number")return c.mulSxV[e.kind](t,e);if(p(e)&&p(t))return c.mulVxV[e.kind](e,t);if(Ze(e)&&N(t))return c.mulVxM[t.kind](e,t);if(N(e)&&Ze(t))return c.mulMxV[e.kind](e,t);if(N(e)&&N(t))return c.mulVxV[e.kind](e,t);throw new Error("Mul called with invalid arguments.")}var Pt=i(In,(e,t)=>{let n=se(e)?t.dataType:se(t)||e.dataType.type.startsWith("vec")?e.dataType:t.dataType.type.startsWith("vec")?t.dataType:e.dataType;return a(`(${e.value} * ${t.value})`,n)},"mul"),Ss=i((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e/t;if(typeof e=="number"&&p(t)){let n=Te[t.kind];return c.div[t.kind](n(e),t)}if(p(e)&&typeof t=="number"){let n=Te[e.kind];return c.div[e.kind](e,n(t))}if(p(e)&&p(t))return c.div[e.kind](e,t);throw new Error("Div called with invalid arguments.")},(e,t)=>se(e)&&se(t)?a(`(f32(${e.value}) / ${t.value})`,V):a(`(${e.value} / ${t.value})`,e.dataType),"div"),_s=i(e=>typeof e=="number"?Math.abs(e):c.abs[e.kind](e),e=>a(`abs(${e.value})`,e.dataType),"abs"),Ms=i((e,t)=>typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):c.atan2[e.kind](e,t),(e,t)=>a(`atan2(${e.value}, ${t.value})`,e.dataType),"atan2"),$s=i(e=>typeof e=="number"?Math.acos(e):c.acos[e.kind](e),e=>a(`acos(${e.value})`,e.dataType),"acos"),Is=i(e=>typeof e=="number"?Math.acosh(e):c.acosh[e.kind](e),e=>a(`acosh(${e.value})`,e.dataType),"acosh"),As=i(e=>typeof e=="number"?Math.asin(e):c.asin[e.kind](e),e=>a(`asin(${e.value})`,e.dataType),"asin"),ks=i(e=>typeof e=="number"?Math.ceil(e):c.ceil[e.kind](e),e=>a(`ceil(${e.value})`,e.dataType),"ceil"),Bs=i((e,t,n)=>typeof e=="number"?Math.min(Math.max(t,e),n):c.clamp[e.kind](e,t,n),(e,t,n)=>a(`clamp(${e.value}, ${t.value}, ${n.value})`,e.dataType),"clamp"),Ds=i(e=>typeof e=="number"?Math.cos(e):c.cos[e.kind](e),e=>a(`cos(${e.value})`,e.dataType),"cos"),Ns=i(e=>typeof e=="number"?Math.cosh(e):c.cosh[e.kind](e),e=>a(`cosh(${e.value})`,e.dataType),"cosh"),Fs=i((e,t)=>c.cross[e.kind](e,t),(e,t)=>a(`cross(${e.value}, ${t.value})`,e.dataType),"cross"),An=i((e,t)=>c.dot[e.kind](e,t),(e,t)=>a(`dot(${e.value}, ${t.value})`,V),"dot"),Ps=i(e=>c.normalize[e.kind](e),e=>a(`normalize(${e.value})`,e.dataType),"normalize"),Rs=i(e=>typeof e=="number"?Math.floor(e):c.floor[e.kind](e),e=>a(`floor(${e.value})`,e.dataType),"floor"),Es=i(e=>typeof e=="number"?e-Math.floor(e):c.fract[e.kind](e),e=>a(`fract(${e.value})`,e.dataType),"fract"),kn=i(e=>typeof e=="number"?Math.abs(e):c.length[e.kind](e),e=>a(`length(${e.value})`,V),"length"),Us=i(e=>typeof e=="number"?Math.log(e):c.log[e.kind](e),e=>a(`log(${e.value})`,e.dataType),"log"),Cs=i(e=>typeof e=="number"?Math.log2(e):c.log2[e.kind](e),e=>a(`log2(${e.value})`,e.dataType),"log2"),Os=i((e,t)=>typeof e=="number"?Math.max(e,t):c.max[e.kind](e,t),(e,t)=>a(`max(${e.value}, ${t.value})`,e.dataType),"max","unify"),Ws=i((e,t)=>typeof e=="number"?Math.min(e,t):c.min[e.kind](e,t),(e,t)=>a(`min(${e.value}, ${t.value})`,e.dataType),"min","unify"),Ks=i(e=>typeof e=="number"?Math.sign(e):c.sign[e.kind](e),e=>a(`sign(${e.value})`,e.dataType),"sign"),Ls=i(e=>typeof e=="number"?Math.sin(e):c.sin[e.kind](e),e=>a(`sin(${e.value})`,e.dataType),"sin"),js=i((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e%t;if(typeof e=="number"&&p(t)){let n=Te[t.kind];return c.mod[t.kind](n(e),t)}if(p(e)&&typeof t=="number"){let n=Te[e.kind];return c.mod[e.kind](e,n(t))}if(p(e)&&p(t))return c.mod[e.kind](e,t);throw new Error("Mod called with invalid arguments, expected types: number or vector.")},(e,t)=>{let n=se(e)?t.dataType:e.dataType;return a(`(${e.value} % ${t.value})`,n)},"mod"),Gs=i(e=>typeof e=="number"?Math.exp(e):c.exp[e.kind](e),e=>a(`exp(${e.value})`,e.dataType),"exp"),qs=i(e=>typeof e=="number"?2**e:c.exp2[e.kind](e),e=>a(`exp2(${e.value})`,e.dataType),"exp2"),Ys=i((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e**t;if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t)return c.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")},(e,t)=>a(`pow(${e.value}, ${t.value})`,e.dataType),"pow"),Hs=i((e,t,n)=>{if(typeof e=="number"){if(typeof n!="number"||typeof t!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-n)+t*n}if(typeof e=="number"||typeof t=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return c.mix[e.kind](e,t,n)},(e,t,n)=>a(`mix(${e.value}, ${t.value}, ${n.value})`,e.dataType),"mix"),Zs=i((e,t)=>Ft(e,Pt(2*An(t,e),t)),(e,t)=>a(`reflect(${e.value}, ${t.value})`,e.dataType),"reflect"),Xs=i((e,t)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t):kn(Ft(e,t)),(e,t)=>a(`distance(${e.value}, ${t.value})`,V),"distance"),Js=i(e=>typeof e=="number"?-e:c.neg[e.kind](e),e=>a(`-(${e.value})`,e.dataType),"neg"),Qs=i(e=>typeof e=="number"?Math.sqrt(e):c.sqrt[e.kind](e),e=>a(`sqrt(${e.value})`,e.dataType),"sqrt"),ei=i(e=>typeof e=="number"?Math.tanh(e):c.tanh[e.kind](e),e=>a(`tanh(${e.value})`,e.dataType),"tanh"),ti=i((e,t,n)=>typeof n=="number"?U(e,t,n):c.smoothstep[n.kind](e,t,n),(e,t,n)=>a(`smoothstep(${e.value}, ${t.value}, ${n.value})`,n.dataType),"smoothstep");function si(e){return{[o]:!0,type:"ptr",inner:e,addressSpace:"function",access:"read-write"}}function ii(e){return{[o]:!0,type:"ptr",inner:e,addressSpace:"private",access:"read-write"}}function ai(e){return{[o]:!0,type:"ptr",inner:e,addressSpace:"workgroup",access:"read-write"}}function oi(e,t="read"){return{[o]:!0,type:"ptr",inner:e,addressSpace:"storage",access:t}}function ci(e){return{[o]:!0,type:"ptr",inner:e,addressSpace:"uniform",access:"read"}}function ui(e){return{[o]:!0,type:"ptr",inner:e,addressSpace:"handle",access:"read"}}export{o as a,st as b,Nn as c,Ye as d,it as e,at as f,Fn as g,Ce as h,Gn as i,ie as j,ct as k,Ut as l,Ct as m,gt as n,ut as o,yt as p,ht as q,lt as r,xt as s,dt as t,mt as u,wt as v,pt as w,vt as x,ft as y,Tt as z,bt as A,tr as B,sr as C,ir as D,p as E,Kt as F,Lt as G,jt as H,zt as I,N as J,Gt as K,qt as L,ar as M,Vt as N,or as O,cr as P,ur as Q,yr as R,hr as S,lr as T,xr as U,dr as V,mr as W,St as X,wr as Y,Oe as Z,_t as _,Mt as $,Ht as aa,Tr as ba,br as ca,zr as da,Vr as ea,$r as fa,Ir as ga,Ar as ha,kr as ia,Zt as ja,Br as ka,$t as la,i as ma,It as na,Cr as oa,a as pa,jr as qa,Gr as ra,F as sa,P as ta,qr as ua,R as va,V as wa,E as xa,Ee as ya,f as za,A as Aa,j as Ba,G as Ca,S as Da,v as Ea,I as Fa,q as Ga,Y as Ha,_ as Ia,T as Ja,k as Ka,H as La,Z as Ma,M as Na,cn as Oa,Ue as Pa,un as Qa,yn as Ra,hn as Sa,xn as Ta,dn as Ua,mn as Va,wn as Wa,pn as Xa,be as Ya,ze as Za,g as _a,us as $a,c as ab,se as bb,Mn as cb,Vs as db,Ft as eb,Pt as fb,Ss as gb,_s as hb,Ms as ib,$s as jb,Is as kb,As as lb,ks as mb,Bs as nb,Ds as ob,Ns as pb,Fs as qb,An as rb,Ps as sb,Rs as tb,Es as ub,kn as vb,Us as wb,Cs as xb,Os as yb,Ws as zb,Ks as Ab,Ls as Bb,js as Cb,Gs as Db,qs as Eb,Ys as Fb,Hs as Gb,Zs as Hb,Xs as Ib,Js as Jb,Qs as Kb,ei as Lb,ti as Mb,si as Nb,ii as Ob,ai as Pb,oi as Qb,ci as Rb,ui as Sb};
43
+ //# sourceMappingURL=chunk-IH2QU6TV.js.map