---@meta
---@diagnostic disable: lowercase-global

--[[ enums.lua ]]

---@alias ac.FogAlgorithm
---| 'ac.FogAlgorithm.Original' @Value: 0.
---| 'ac.FogAlgorithm.New' @Value: 1.
ac.FogAlgorithm = {
  Original = 0, ---Value: 0.
  New = 1, ---Value: 1.
}

---@alias ac.ShadowsState
---| 'ac.ShadowsState.Off' @Value: 0.
---| 'ac.ShadowsState.On' @Value: 1.
---| 'ac.ShadowsState.EverythingShadowed' @Value: 2.
ac.ShadowsState = {
  Off = 0, ---Value: 0.
  On = 1, ---Value: 1.
  EverythingShadowed = 2, ---Value: 2.
}

---@alias ac.TextureState
---| 'ac.TextureState.Empty' @Value: 0.
---| 'ac.TextureState.Loading' @Value: 1.
---| 'ac.TextureState.Failed' @Value: 2.
---| 'ac.TextureState.Ready' @Value: 3.
ac.TextureState = {
  Empty = 0, ---Value: 0.
  Loading = 1, ---Value: 1.
  Failed = 2, ---Value: 2.
  Ready = 3, ---Value: 3.
}

---@alias ac.WeatherType
---| 'ac.WeatherType.LightThunderstorm' @Value: 0.
---| 'ac.WeatherType.Thunderstorm' @Value: 1.
---| 'ac.WeatherType.HeavyThunderstorm' @Value: 2.
---| 'ac.WeatherType.LightDrizzle' @Value: 3.
---| 'ac.WeatherType.Drizzle' @Value: 4.
---| 'ac.WeatherType.HeavyDrizzle' @Value: 5.
---| 'ac.WeatherType.LightRain' @Value: 6.
---| 'ac.WeatherType.Rain' @Value: 7.
---| 'ac.WeatherType.HeavyRain' @Value: 8.
---| 'ac.WeatherType.LightSnow' @Value: 9.
---| 'ac.WeatherType.Snow' @Value: 10.
---| 'ac.WeatherType.HeavySnow' @Value: 11.
---| 'ac.WeatherType.LightSleet' @Value: 12.
---| 'ac.WeatherType.Sleet' @Value: 13.
---| 'ac.WeatherType.HeavySleet' @Value: 14.
---| 'ac.WeatherType.Clear' @Value: 15.
---| 'ac.WeatherType.FewClouds' @Value: 16.
---| 'ac.WeatherType.ScatteredClouds' @Value: 17.
---| 'ac.WeatherType.BrokenClouds' @Value: 18.
---| 'ac.WeatherType.OvercastClouds' @Value: 19.
---| 'ac.WeatherType.Fog' @Value: 20.
---| 'ac.WeatherType.Mist' @Value: 21.
---| 'ac.WeatherType.Smoke' @Value: 22.
---| 'ac.WeatherType.Haze' @Value: 23.
---| 'ac.WeatherType.Sand' @Value: 24.
---| 'ac.WeatherType.Dust' @Value: 25.
---| 'ac.WeatherType.Squalls' @Value: 26.
---| 'ac.WeatherType.Tornado' @Value: 27.
---| 'ac.WeatherType.Hurricane' @Value: 28.
---| 'ac.WeatherType.Cold' @Value: 29.
---| 'ac.WeatherType.Hot' @Value: 30.
---| 'ac.WeatherType.Windy' @Value: 31.
---| 'ac.WeatherType.Hail' @Value: 32.
ac.WeatherType = {
  LightThunderstorm = 0, ---Value: 0.
  Thunderstorm = 1, ---Value: 1.
  HeavyThunderstorm = 2, ---Value: 2.
  LightDrizzle = 3, ---Value: 3.
  Drizzle = 4, ---Value: 4.
  HeavyDrizzle = 5, ---Value: 5.
  LightRain = 6, ---Value: 6.
  Rain = 7, ---Value: 7.
  HeavyRain = 8, ---Value: 8.
  LightSnow = 9, ---Value: 9.
  Snow = 10, ---Value: 10.
  HeavySnow = 11, ---Value: 11.
  LightSleet = 12, ---Value: 12.
  Sleet = 13, ---Value: 13.
  HeavySleet = 14, ---Value: 14.
  Clear = 15, ---Value: 15.
  FewClouds = 16, ---Value: 16.
  ScatteredClouds = 17, ---Value: 17.
  BrokenClouds = 18, ---Value: 18.
  OvercastClouds = 19, ---Value: 19.
  Fog = 20, ---Value: 20.
  Mist = 21, ---Value: 21.
  Smoke = 22, ---Value: 22.
  Haze = 23, ---Value: 23.
  Sand = 24, ---Value: 24.
  Dust = 25, ---Value: 25.
  Squalls = 26, ---Value: 26.
  Tornado = 27, ---Value: 27.
  Hurricane = 28, ---Value: 28.
  Cold = 29, ---Value: 29.
  Hot = 30, ---Value: 30.
  Windy = 31, ---Value: 31.
  Hail = 32, ---Value: 32.
}

---@alias ac.TonemapFunction
---| 'ac.TonemapFunction.Linear' @Simple linear mapping.
---| 'ac.TonemapFunction.LinearClamped' @Linear mapping (LDR clamp).
---| 'ac.TonemapFunction.Sensitometric' @Simple simulation of response of film, CCD, etc., recommended.
---| 'ac.TonemapFunction.Reinhard' @Reinhard.
---| 'ac.TonemapFunction.ReinhardLum' @Saturation retention type Reinhard tone map function.
---| 'ac.TonemapFunction.Log' @Tone map function for the logarithmic space.
---| 'ac.TonemapFunction.LogLum' @Saturation retention type logarithmic space tone map function.
ac.TonemapFunction = {
  Linear = 0, ---Simple linear mapping.
  LinearClamped = 1, ---Linear mapping (LDR clamp).
  Sensitometric = 2, ---Simple simulation of response of film, CCD, etc., recommended.
  Reinhard = 3, ---Reinhard.
  ReinhardLum = 4, ---Saturation retention type Reinhard tone map function.
  Log = 5, ---Tone map function for the logarithmic space.
  LogLum = 6, ---Saturation retention type logarithmic space tone map function.
}

---@alias ac.FolderId
---| 'ac.FolderId.AppData' @Value: 0.
---| 'ac.FolderId.Documents' @Value: 1.
---| 'ac.FolderId.Root' @Value: 4.
---| 'ac.FolderId.Cfg' @Value: 5.
---| 'ac.FolderId.Setups' @Value: 6.
---| 'ac.FolderId.Logs' @Value: 7.
---| 'ac.FolderId.Screenshots' @Value: 8.
---| 'ac.FolderId.Replays' @Value: 9.
---| 'ac.FolderId.ReplaysTemp' @Value: 10.
---| 'ac.FolderId.UserSetups' @Value: 11.
---| 'ac.FolderId.PPFilters' @Value: 12.
---| 'ac.FolderId.ContentCars' @Value: 13.
---| 'ac.FolderId.ContentDrivers' @Value: 14.
---| 'ac.FolderId.ContentTracks' @Value: 15.
---| 'ac.FolderId.ExtRoot' @Value: 16.
---| 'ac.FolderId.ExtCfgSys' @Value: 17.
---| 'ac.FolderId.ExtCfgUser' @Value: 18.
---| 'ac.FolderId.ExtTextures' @Value: 21.
---| 'ac.FolderId.ACApps' @Value: 23.
---| 'ac.FolderId.ACAppsPython' @Value: 24.
---| 'ac.FolderId.ExtCfgState' @Value: 25.
---| 'ac.FolderId.ContentFonts' @Value: 26.
---| 'ac.FolderId.RaceResults' @Value: 27.
ac.FolderId = {
  AppData = 0, ---Value: 0.
  Documents = 1, ---Value: 1.
  Root = 4, ---Value: 4.
  Cfg = 5, ---Value: 5.
  Setups = 6, ---Value: 6.
  Logs = 7, ---Value: 7.
  Screenshots = 8, ---Value: 8.
  Replays = 9, ---Value: 9.
  ReplaysTemp = 10, ---Value: 10.
  UserSetups = 11, ---Value: 11.
  PPFilters = 12, ---Value: 12.
  ContentCars = 13, ---Value: 13.
  ContentDrivers = 14, ---Value: 14.
  ContentTracks = 15, ---Value: 15.
  ExtRoot = 16, ---Value: 16.
  ExtCfgSys = 17, ---Value: 17.
  ExtCfgUser = 18, ---Value: 18.
  ExtTextures = 21, ---Value: 21.
  ACApps = 23, ---Value: 23.
  ACAppsPython = 24, ---Value: 24.
  ExtCfgState = 25, ---Value: 25.
  ContentFonts = 26, ---Value: 26.
  RaceResults = 27, ---Value: 27.
}

---@alias ac.HolidayType
---| 'ac.HolidayType.None' @Value: 0.
---| 'ac.HolidayType.NewYear' @Value: 1.
---| 'ac.HolidayType.Christmas' @Value: 2.
---| 'ac.HolidayType.VictoryDay' @Value: 3.
---| 'ac.HolidayType.IndependenceDay' @Value: 4.
---| 'ac.HolidayType.Halloween' @Value: 5.
---| 'ac.HolidayType.JapanFestival' @Value: 6.
---| 'ac.HolidayType.ChineseNewYear' @Value: 7.
---| 'ac.HolidayType.EidAlAdha' @Value: 8.
---| 'ac.HolidayType.GuyFawkesNight' @Value: 9.
ac.HolidayType = {
  None = 0, ---Value: 0.
  NewYear = 1, ---Value: 1.
  Christmas = 2, ---Value: 2.
  VictoryDay = 3, ---Value: 3.
  IndependenceDay = 4, ---Value: 4.
  Halloween = 5, ---Value: 5.
  JapanFestival = 6, ---Value: 6.
  ChineseNewYear = 7, ---Value: 7.
  EidAlAdha = 8, ---Value: 8.
  GuyFawkesNight = 9, ---Value: 9.
}

---@alias ac.SkyRegion
---| 'ac.SkyRegion.None' @Value: 0.
---| 'ac.SkyRegion.Sun' @Value: 1.
---| 'ac.SkyRegion.Opposite' @Value: 2.
---| 'ac.SkyRegion.All' @Value: 3.
ac.SkyRegion = {
  None = 0, ---Value: 0.
  Sun = 1, ---Value: 1.
  Opposite = 2, ---Value: 2.
  All = 3, ---Value: 3.
}

---@alias ac.AudioChannel
---| 'ac.AudioChannel.Main' @Value: 'main'.
---| 'ac.AudioChannel.Rain' @Value: 'rain'.
ac.AudioChannel = {
  Main = 'main', ---Value: 'main'.
  Rain = 'rain', ---Value: 'rain'.
}

--[[ common/common.lua ]]

---Path to a folder with currently running script.
---@type string
__dirname = nil

---Main CSP namespace.
ac = {}

---FFI-accelerated list, acts like a regular list (consequent items, size and capacity, automatically growing, etc.)
---Doesn’t store nil values to act more like a Lua table.
---
---For slightly better performance it might be benefitial to preallocate memory with `list:reserve(expectedSizeOrABitMore)`.
---@class ac.GenericList
local _ac_genericList = {}

---Number of items in the list.
---@return integer
function _ac_genericList:size() end

---Size of list in bytes (not capacity, for that use `list:capacityBytes()`).
---@return integer
function _ac_genericList:sizeBytes() end

---Checks if list is empty.
---@return boolean
function _ac_genericList:isEmpty() end

---Capacity of the list.
---@return integer
function _ac_genericList:capacity() end

---Size of list in bytes (capacity).
---@return integer
function _ac_genericList:capacityBytes() end

---Makes sure list can fit `newSize` of elements without reallocating memory.
---@param newSize integer
---@return integer
function _ac_genericList:reserve(newSize) end

---If capacity is greater than current size, reallocates a smaller bit of memory and moves data there.
function _ac_genericList:shrinkToFit() end

---Removes all elements.
function _ac_genericList:clear() end

--[[ common/class.lua ]]

---@alias ClassDefinition {__name: string}
---@alias ClassMixin {included: fun(classDefinition: ClassDefinition)}

---A base class. Note: all classes are inheriting from this one even if they’re not using
---`ClassBase` as a parent class explicitly.
ClassBase = {}

---Checks if object is an instance of a class created by `class()` function.
---@param obj any|nil @Any table, vector, nil, anything.
---@return boolean @True if type of `obj` is `ClassBase` or any class inheriting from it.
function ClassBase.isInstanceOf(obj) end

---Checks if ClassBase is a subsclass of a class created by `class()` function. It wouldn’t be, function is here just for
---keeping things even.
---@param classDefinition ClassDefinition @Class created by `class()` function.
---@return boolean @Always false.
function ClassBase:isSubclassOf(classDefinition) end

---Creates a new class. Pretty much the same as calling `class()` (all classes are inheriting from `ClassBase` anyway).
---@return ClassDefinition @New class definition
function ClassBase:subclass(...) end

---Adds a mixin to all subsequently created classes. Use it early in case you want to add a method or some data to all of your objects.
---If `mixin` has a property `included`, it would be called each time new class is created with a reference to the newly created class.
---@param mixin ClassMixin
function ClassBase:include(mixin) end

---Define this function and it would be called each time a new class without a parent (or `ClassBase` for parent) is created.
---@param classDefinition ClassDefinition
function ClassBase:subclassed(classDefinition) end

---A base class for objects with pooling. Note: all classes created with `class.Pool` flag are inheriting from this one even if they’re not using
---`ClassPool` as a parent class explicitly.
ClassPool = {}

---Checks if object is an instance of a class with pooling active.
---@param obj any|nil @Any table, vector, nil, anything.
---@return boolean @True if type of `obj` is `ClassPool` or any class inheriting from it.
function ClassPool.isInstanceOf(obj) end

---Checks if ClassPool is a subsclass of a class created by `class()` function. It wouldn’t be unless you’re passing `ClassBase`, function is here just for
---keeping things even.
---@param classDefinition ClassBase @Class created by `class()` function.
---@return boolean @True if you’ve passed ClassBase here.
function ClassPool:isSubclassOf(classDefinition) end

---Creates a new class with pooling. Pretty much the same as calling `class(class.Pool, ...)` (all classes with `class.Pool` are 
---inheriting from `ClassPool` anyway).
---@return ClassDefinition @New class definition
function ClassPool:subclass(...) end

---Adds a mixin to subsequently created classes with pooling. Use it early in case you want to add a method or some data to all of your objects that use pooling.
---If `mixin` has a property `included`, it would be called each time new class with pooling is created with a reference to the newly created class.
---@param mixin ClassMixin
function ClassPool:include(mixin) end

---Define this function and it would be called each time a new pooling class without a parent (or `ClassPool` for parent) is created.
---@param classDefinition ClassDefinition
function ClassPool:subclassed(classDefinition) end

---A base class. Note: all classes are inheriting from this one even if they’re not using
---`ClassBase` as a parent class explicitly. You might still want to put it in EmmyDoc comment to get hints for functions like `YourClass.isInstanceOf()`.
---@class ClassBase
local _classBase = {}

---Checks if object is an instance of this class. Can be used either as `obj:isInstanceOf(YourClass)` or, as a safer alternative,
---`YourClass.isInstanceOf(obj)` — this one would work even if `obj` is nil, a number, a vector, anything like that. And in all of those
---cases, of course, it would return `false`.
---@param classDefinition ClassDefinition @Used with `obj:isInstanceOf(YourClass)` variant.
---@return boolean @True if argument is an instance of this class.
---@overload fun(): boolean
function _classBase:isInstanceOf(classDefinition) end

---Class method. Checks if class itself is a child class of a different class (or a child of a child, etc). 
---Can be used as `YourClass:isInstanceOf(YourOtherClass)`.
---@param classDefinition ClassDefinition @Class created by `class()` function.
---@return boolean @True if this class is a child of another class (or a child of a child, etc).
function _classBase:isSubclassOf(classDefinition) end

---Class method. Includes mixin, adding new methods to a preexising class. If mixin has a property `included`, it will be called
---with an argument referencing a class mixin is being added to. Can be used as `YourClass:include({ newMethod = function(self, arg) end })`.
---@param mixin ClassMixin @Any mixin.
function _classBase:include(mixin) end

---Class method. Creates a new child class.
---@return ClassDefinition @New class definition
function _classBase:subclass(...) end

---Class method. Called when a new child class is created using this class as a parent one. Redefine this function for
---your class if you need some advanced processing, like adding new methods to a child class.
---@param classDefinition ClassDefinition @New class definition
function _classBase:subclassed(classDefinition) end

---A base class for objects with pooling. Doesn’t add anything, but you can add it as a parent class
---so that `recycled()` would be documented.
---@class ClassPool : ClassBase
local _classPool = {}

---Called when object is about to get recycled.
---@return boolean @Return false if this object should not be recycled and instead destroyed as usual.
function _classPool:recycled() end

---Create a new class. Example:
---
---```
---local MyClass = class('MyClass')        -- class declaration
---
---function MyClass:initialize(arg1, arg2) -- constructor
---  self.myField = arg1 + arg2            -- field
---end
---
---function MyClass:doMyThing()            -- method
---  print(self.myField)
---end
---
---local instance = MyClass(1, 2)          -- creating instance of a class
---instance:doMyThing()                    -- calling a method
---```
---
---Whole thing is very similar to [middleclass](https://github.com/kikito/middleclass), but it’s a different
---implementation that should be somewhat faster. Main differences:
---
---1. Class name is stored in `YourClass.__name` instead of `YourClass.name`.
---
---2. There is no `.static` subtable, all static fields and methods are instead stored in main class
---   table and thus are available as instance fields and methods as well (that’s why `YourClass.name` was
---   renamed to `YourClass.__name`, to avoid possible confusion with a common field name). It’s a bit
---   messier, especially with class methods such as `:subclass()`, but it has some advantages as well:
---   objects creation is faster, and it’s more EmmyLua-friendly (both of which is what it’s all about).
---
---3. Overloaded `__tostring`, `__len` and `__call` are inherited, but not other operators.
---
---4. Method `YourClass.allocate()` works differently here and is used to create a simple table which will be
---   passed to `setmetatable()`. This can help with performance if objects are created often.
---
---Everything else should work the same, including inheritance and mixins. As for performance, some simple
---tests show up to 30% faster objects creation and 40% less memory used for objects with two fields when
---using `YourClass.allocate()` method instead of `YourClass:initialize()` (that alone gives about 15% increase in speed
---when creating an object with two fields):
---
---```
---function YourClass.allocate(arg1, arg2)  -- notice . instead of :
---  return { myField = arg1 + arg2 }     -- also notice, methods are not available at this stage
---end
---```
---
---Other differences (new features rather than something breaking compatibility) and important notes:
---
---1. Function `class()` takes string for class name, another class to act like a parent,
---   allocate and initialize functions and flags. Everything is optional and can go in any order (with one caveat:
---   allocate function should go before initialize function unless you’re using `class.Pool`). Generally there is no
---   benefit in passing allocate and initialize functions here though.
---
---2. With flag `class.NoInitialize` constructor would not look for `YourClass:initialize()` method to call at all,
---   instead using only `YourClass.allocate()`. Might speed things up a bit further.
---
---3. If you’re creating new instances really often, there is a `class.Pool` flag. It would disable the use of
---   `YourClass.allocate()`, but instead allow to reuse unused objects by using `class.recycle(object)`. Recycled objects
---   would end up in a pool of objects to be reused next time an instance would need to be created. Of course, it
---   introduces a whole new type of errors (imagine storing a reference to a recycled item somewhere not knowing it was
---   recycled and now represents something else entirely), so please be careful.
---
---   Note 1: Method `class.recycle()` can be used with nils or non-recycle, no need to have extra checks before calling it.
--- 
---   Note 2: Instances of child classes won’t end up in parent class pool. For such arrangements, consider adding pooling
---           flag to all of child classes where appropriate.
---
---4. Before recycling, method `YourClass:recycled()` will be called. Good time to recycle any inner elements. Also,
---   return `false` from it and object would not be recycled at all.
---
---5. To check type, `YourClass.isInstanceOf(item)` can also be used. Notice that it’s a static method, no “:” here.
---
---All classes are considered children classes of `ClassBase`, that one is mostly for EmmyLua to pick up methods like 
---`YourClass.isInstanceOf(object)`. If you’re creating your own class and want to use such methods, just add `: ClassBase`
---to its EmmyLua annotation. And objects with pooling are children of `ClassPool` which is a child of `ClassBase`. Note: 
---to speed things up, those classes aren’t fully real, but you can access them and their methods and even call things like
---`ClassBase:include()`. Please read documentation for those functions before using them though, just to check.
---@param name string @Class name.
---@param parentClass ClassBase @Parent class.
---@param flags 'class.NoInitialize'|'class.Pool'|'class.Minimal' @Flags.
---@overload fun(name: string, flags: 'class.NoInitialize'|'class.Pool'|'class.Minimal')      @Regular parent-less class with some flags
---@overload fun(name: string, allocateFn: 'function()\n  return {}\nend, class.NoInitialize')    @Inline allocate function for slightly faster creation
---@overload fun(name: string, initializeFn: 'function (self)\n  \nend, class.Pool')              @With pooling for best memory reuse
---@overload fun(allocateFn: 'function()\n  return {}\nend, class.NoInitialize + class.Minimal')  @Most minimal version
---@return ClassDefinition @New class definition
function class(name, parentClass, flags) end

class = {}

---Skip initialization function completely. Might slightly speed up object creation.
class.NoInitialize = 1

---Reuse recycled objects instead of creating new ones. Disables `.allocate()` and switches to `:initialize()`,
---but performance gain from not having to allocate new tables is worth it. Don’t forget to recycle unused elements
---with `class.recycle(item)`.
class.Pool = 2

---Minimal version of a class, skips creation of all static methods and default to-string operators.
---
---To use with either pooling or no-initialize setup, pass two flags separated by a comma, or just sum them together
---(would work only if values are powers of two and you’re not summing together the same flag twice). Or, use
---`bit.bor(flag1, flag2)`, courtesy of LuaJIT and its BitOp extension.
class.Minimal = 4

---Recycle an item to its pool, to speed up creation and reduce work for GC. Requires class to be created with
---`class.Pool` flag.
---
---This method has protection from double recycling, recycling nils or non-recycleable items, so don’t worry about it.
---@param item ClassPool|nil
function class.recycle(item) end

---A trick to get `class()` to work with EmmyLua annotations nicely. Call `class.emmy(YourClass, YourClass.initialize)`
---or `class.emmy(YourClass, YourClass.allocate)` (whatever you’re using) and it would give you a constructor function.
---Then, use it for local reference or as a return value from module. For best results add annotations to function you’re
---passing here, such as return value or argument types.
---
---In reality is simply returns the class back and ignores second argument, but because of this definition EmmyLua thinks
---it got the constructor.
---@generic T1
---@generic T2
---@param classFn T1
---@param constructorFn T2
---@return T1|T2
function class.emmy(classFn, constructorFn) return constructorFn end

--[[ csp.lua ]]

---Displays value in Lua Debug app, great for tracking state of your values live.
---@param key string
---@param value string? @Default value: "<nil>".
function ac.debug(key, value) end

---Stops functions like `ac.log()` from logging things into CSP log file, in case you need to log a lot. With it, you
---can use Lua Debug app to see latest log entries.
---@param value boolean? @Default value: true.
function ac.setLogSilent(value) end

---Prints message to a CSP log and to Lua App Debug log. To speed things up and only use Lua Debug app, call `ac.setLogSilent()`.
---@param value string
function ac.log(value) end

---Prints message to a CSP log and to Lua App Debug log. To speed things up and only use Lua Debug app, call `ac.setLogSilent()`.
---@param value string
function ac.warn(value) end

---Prints message to a CSP log and to Lua App Debug log. To speed things up and only use Lua Debug app, call `ac.setLogSilent()`.
---@param value string
function ac.error(value) end

---Simple helper to measure time and analyze performance. Call `ac.perfBegin('someKey')` to start counting time and
---`ac.perfEnd('someKey')` to stop. Measured time will be shown in Lua App Debug app in CSP (moving average across all
---perfBegin/perfEnd calls). Note: keys on perfBegin() and perfEnd() should match.
---@param value string
function ac.perfBegin(value) end

---Simple helper to measure time and analyze performance. Call `ac.perfBegin('someKey')` to start counting time and
---`ac.perfEnd('someKey')` to stop. Measured time will be shown in Lua App Debug app in CSP (moving average across all
---perfBegin/perfEnd calls). Note: keys on perfBegin() and perfEnd() should match.
---@param value string
function ac.perfEnd(value) end

---Unlike `ac.perfBegin('someKey')/ac.perfEnd('someKey')`, `ac.perfFrameBegin(0)/ac.perfFrameEnd(0)` will accumulate time
---between calls as frame progresses and then use the whole sum for moving average. This makes it suitable for measuring
---how much time in a frame repeatedly ran bit of code takes. To keep performance as high as possible (considering that
---it could be ran in a loop), it uses integer keys instead of strings.
---@param value integer
function ac.perfFrameBegin(value) end

---Unlike `ac.perfBegin('someKey')/ac.perfEnd('someKey')`, `ac.perfFrameBegin(0)/ac.perfFrameEnd(0)` will accumulate time
---between calls as frame progresses and then use the whole sum for moving average. This makes it suitable for measuring
---how much time in a frame repeatedly ran bit of code takes. To keep performance as high as possible (considering that
---it could be ran in a loop), it uses integer keys instead of strings.
---@param value integer
function ac.perfFrameEnd(value) end

---Returns directory of the script.
---@return string
function ac.dirname() end

---@return string
function ac.getPatchVersion() end

---// Increments with every CSP build.
---@return integer
function ac.getPatchVersionCode() end

---@param folderID ac.FolderId
---@return string
function ac.getFolder(folderID) end

---@return string
function ac.getTrackId() end

---@return string
function ac.getTrackLayout() end

---@return vec3
function ac.getCameraPosition() end

---@return vec3
function ac.getCameraUp() end

---@return vec3
function ac.getCameraSide() end

---@return vec3
function ac.getCameraForward() end

---@return vec3
function ac.getCameraDirection() end

---// Value in degrees.
---@return number
function ac.getCameraFOV() end

---@param r vec3 @Destination.
function ac.getCameraPositionTo(r) end

---@param r vec3 @Destination.
function ac.getCameraUpTo(r) end

---@param r vec3 @Destination.
function ac.getCameraSideTo(r) end

---@param r vec3 @Destination.
function ac.getCameraForwardTo(r) end

---@param r vec3 @Destination.
function ac.getCameraDirectionTo(r) end

---// Value in degrees.
---@return number
function ac.getSunAngle() end

---// Value in degrees.
---@return number
function ac.getSunPitchAngle() end

---// Value in degrees.
---@return number
function ac.getSunHeadingAngle() end

---@return number
function ac.getSoundSpeedMs() end

---// Returns true if camera is focused on interior (interior audio is playing).
---@return boolean
function ac.isInteriorView() end

---@return boolean
function ac.isInReplayMode() end

---Turns time in milliseconds into common lap time presentation, like 00:00.123. If minutes exceed 60,
---hours will also be added.
---@param time number
---@return string
function ac.lapTimeToString(time) end

---Returns audio volume for given channel, value from 0 to 1. If channel is not recognized, returns -1.
---@param key ac.AudioChannel @Values: 'main', 'rain'.
---@return number @Value from 0 to 1.
function ac.getAudioVolume(key) end

---Consider using `ac.getCar(carIndex).speedKmh` instead.
---@param carIndex integer
---@return number
function ac.getCarSpeedKmh(carIndex) end

---Returns approximate Y coordinate of ground, calculated by using depth from reflection cubemap. Does not have a performance impact (that value
---will be calculated anyway for CSP to run.
---@return number
function ac.getGroundYApproximation() end

---Returns current delta time associated with UI (so values are non-zero if sim or replay are paused).
---@return number @Seconds.
function ac.getDeltaT() end

---Returns current delta time associated with simulation (so values are zero if sim or replay are paused).
---@return number @Seconds.
function ac.getGameDeltaT() end

---Returns current time multiplier.
---@return number
function ac.getConditionsTimeScale() end

---// Value is in m/s.
---@return vec3
function ac.getWindVelocity() end

---// Value is in m/s.
---@param r vec3 @Destination.
function ac.getWindVelocityTo(r) end

---// Can be used to access files in data.acd and, for example, read car specs.
---@param value string
---@return string
function ac.readDataFile(value) end

---@return boolean
function ac.isWeatherFxActive() end

---// X for lattitude, Y for longitude.
---@return vec2
function ac.getTrackCoordinatesDeg() end

---// X for base offset, Y for summer time offset.
---@return vec2
function ac.getTrackTimezoneBaseDst() end

---@param carIndex integer
---@param programIndex integer? @Default value: -1.
---@return string
function ac.getMGUKDeliveryName(carIndex, programIndex) end

---@param carIndex integer
---@param compoundIndex integer? @Default value: -1.
---@return string
function ac.getTyresName(carIndex, compoundIndex) end

---@param carIndex integer
---@return string
function ac.getDriverName(carIndex) end

---@param carIndex integer
---@return string
function ac.getDriverNationCode(carIndex) end

---@param carIndex integer
---@return string
function ac.getDriverNationality(carIndex) end

---@param carIndex integer
---@return string
function ac.getDriverTeam(carIndex) end

---// Refers to AI spline.
---@return boolean
function ac.hasTrackSpline() end

---@param v vec3
---@return number
function ac.worldCoordinateToTrackProgress(v) end

---@param v number
---@return vec3
function ac.trackProgressToWorldCoordinate(v) end

---@param v number
---@param r vec3
function ac.trackProgressToWorldCoordinateTo(v, r) end

---Converts world coordinates into track coordinates. Track coordinates:
---- X for normalized position (0 — right in the middle, -1 — left side of the track, 1 — right size);
---- Y for height above track in meters;
---- Z for track progress.
---@param v vec3
---@return vec3
function ac.worldCoordinateToTrack(v) end

---Converts track coordinates into world coordinates. Track coordinates:
---- X for normalized position (0 — right in the middle, -1 — left side of the track, 1 — right size);
---- Y for height above track in meters;
---- Z for track progress.
---@param v vec3
---@return vec3
function ac.trackCoordinateToWorld(v) end

---// Checks visibility with frustum culling.
---@param pos vec3
---@param radius number
---@return boolean
function ac.isVisibleInMainCamera(pos, radius) end

---@param msg string
---@param description string
function ac.setSystemMessage(msg, description) end

---@param joystick integer
---@param button integer
---@return boolean
function ac.isJoystickButtonPressed(joystick, button) end

---@param joystick integer
---@param axis integer
---@return number
function ac.getJoystickAxisValue(joystick, axis) end

---@param joystick integer
---@param axis integer
---@return number
function ac.isJoystickAxisValue(joystick, axis) end

---@param joystick integer
---@param dpad integer
---@return integer
function ac.getJoystickDpadValue(joystick, dpad) end

---@param joystick integer
---@param dpad integer
---@return integer
function ac.isJoystickDpadValue(joystick, dpad) end

---@param text string
function ac.setClipboadText(text) end

---Given name, returns a path like …/assettocorsa/content/tracks/<current>/data/<name>, taking into account layout as well.
---@param name string
---@return string
function ac.getTrackDataFilename(name) end

---Use `ac.getSim()` instead.
---@deprecated
---@return ac.StateSim
function ac.getSimState() end

---Use `ac.getUI()` instead.
---@deprecated
---@return ac.StateUi
function ac.getUiState() end

---Use `ac.getCar()` instead. Here, index starts with 1! With `ac.getCar()` index starts with 0.
---Also, make sure to check result for nil if you�re accessing a car that might not be there, otherwise
---script would crash.
---@deprecated
---@param index integer @1-based index.
---@return ac.StateCar
function ac.getCarState(index) end

---New version with shorter name.
---@return ac.StateSim
function ac.getSim() end

---New version with fixed name.
---@return ac.StateUi
function ac.getUI() end

---Index starts with 0. Make sure to check result for nil if you�re accessing a car that might not be there, otherwise script would crash.
---@param index integer @0-based index.
---@return ac.StateCar
function ac.getCar(index) end


---@class ac.StateWheel : ClassBase
---@field tyreRadius number
---@field tyreWidth number
---@field rimRadius number
---@field tyreDirty number
---@field tyreWear number
---@field tyrePressure number
---@field tyreTemperature number
---@field tyreTemperatureIMO vec3
---@field discTemperature number
---@field angularSpeed number
---@field loadK number
---@field slip number
---@field slipAngle number
---@field slipRatio number
---@field ndSlip number
---@field suspensionDamage number
---@field suspensionTravel number
---@field contactNormal vec3
---@field contactPoint vec3
---@field pos vec3
---@field look vec3
---@field up vec3
---@field outside vec3
---@field isBlown boolean

---@class ac.StateCar : ClassBase
---@field mass number @Car mass in kg.
---@field maxFuel number @Maximum amount of fuel in liters.
---@field exposureOutside number @Outboard exposure from car.ini.
---@field exposureInside number @Onboard exposure from car.ini.
---@field shakeMultiplier number @SHAKE_MUL value from car.ini.
---@field aabbCenter vec3 @Center of AABB (calculated from LOD D or collider mesh).
---@field aabbSize vec3 @Size of AABB in meters (calculated from LOD D or collider mesh).
---@field index integer @0-based (0 for first car).
---@field gearCount integer @Physics-only (see `ac.CarState.physicsAvailable`).
---@field turboCount integer @Physics-only (see `ac.CarState.physicsAvailable`).
---@field tractionType integer @0 for rwd, 1 for fwd, 2 for awd, 3 for new awd, -1 for N/A. Physics-only (see `ac.CarState.physicsAvailable`).
---@field enginePosition integer @0 for unspecified, 1 for front, 2 for rear, 3 for mid. Physics-only (see `ac.CarState.physicsAvailable`).
---@field hShifter boolean
---@field adjustableTurbo boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field brakesCockpitBias boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field extrapolatedMovement boolean @If set to false and you’re adding objects moving close to cars, use ac.CarState.timestamp to estimate dt in such a way that it would match car physics time.
---@field brakesBiasLimitDown number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field brakesBiasLimitUp number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field brakesBiasStep number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field timestamp number @Time of last physics state record, in milliseconds (counting from the same point as ac.SimState.time).
---@field transform mat4x4
---@field pos vec3
---@field velocity vec3
---@field acceleration vec3 @G-forces, X for sideways relative to car, Z for forwards/backwards.
---@field angularVelocity vec3
---@field localAngularVelocity vec3
---@field up vec3 @Vector facing upwards (normalized).
---@field look vec3 @Vector facing forward (normalized).
---@field side vec3 @Vector facing sideways (normalized).
---@field gas number @Throttle, from 0 to 1.
---@field brake number @Brake, from 0 to 1.
---@field clutch number @Clutch, from 0 to 1 (1 for pedal fully depressed).
---@field steer number
---@field handbrake number @Handbrake, from 0 to 1.
---@field gear integer @Current gear, 0 for neutral, -1 for reverse.
---@field fuel number @Remaining fuel in liters.
---@field rpm number @RPM.
---@field rpmLimiter number @RPM limiter threshold, if exists.
---@field speedKmh number @Current speed in km/h.
---@field turboBoost number
---@field finalForceFeedback number
---@field drivetrainSpeed number
---@field waterTemperature number
---@field cgHeight number
---@field wheelsOutside integer @Number of wheels outside of allowed area.
---@field engineLifeLeft number @Engine life left (1000 for new engine, breaks at 0).
---@field damage number[] @5 items, starts with 0.
---@field gearboxDamage number @Gearbox damage (0 for new gearbox, 1 for non-functional).
---@field nodeIndex integer @Car index if 0 is nearest to camera, 1 is second nearest and so on.
---@field visibleIndex integer @Car index if 0 is nearest to camera and visible in main camera, 1 is second nearest visible and so on. Cars outside of main camera would have 255 here.
---@field distanceToCamera number @Distance to camera in meters.
---@field splinePosition number @Position of car along the track, 0 for starting line, 1 for finishing line.
---@field collisionDepth number @How deep is current collision, in meters (generally it’s better to use change of car speed to estimate collision intensity though, depth is much less predictable).
---@field collidedWith integer @0 for track, non-zero for cars.
---@field wheels ac.StateWheel[] @4 items, starts with 0.
---@field isAIControlled boolean @True if car is controlled by AI (or that autopilot thing).
---@field isInPitlane boolean
---@field isRetired boolean
---@field gearGrinding boolean
---@field headlightsActive boolean
---@field brakeLightsActive boolean
---@field flashingLightsActive boolean
---@field hornActive boolean
---@field focused boolean
---@field focusedOnInterior boolean
---@field specialHideLabels boolean
---@field hazardLights boolean
---@field turningLeftLights boolean
---@field turningRightLights boolean
---@field turningLeftOnly boolean
---@field turningRightOnly boolean
---@field lowBeams boolean
---@field extraA boolean
---@field extraB boolean
---@field extraC boolean
---@field extraD boolean
---@field extraE boolean
---@field extraF boolean
---@field kersCharging boolean
---@field kersCharge number
---@field kersInput number
---@field kersCurrentKJ number
---@field kersMaxKJ number
---@field kersLoad number
---@field distanceDrivenTotalKm number
---@field distanceDrivenSessionKm number
---@field poweredWheelsSpeed number
---@field batteryVoltage number
---@field oilPressure number
---@field oilTemperature number
---@field exhaustTemperature number
---@field wiperMode integer
---@field wiperProgress number
---@field bodyWetness number
---@field compass number
---@field lapTimeMs integer
---@field bestLapTimeMs integer
---@field previousLapTimeMs integer
---@field lapCount integer
---@field racePosition integer @Position of a car in the race, 1 for first, 2 for second, etc.
---@field estimatedLapTimeMs integer
---@field performanceMeter number
---@field performanceMeterSpeedDifferenceMs number
---@field sessionLapCount integer
---@field compoundIndex integer @Index of currently selected tyre compounds.
---@field physicsAvailable boolean @Cars in replays, or remote cars online do not have regular physics component running, so some data will be missing. Such fields are marked as physics-only in comments.
---@field speedLimiterInAction boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field absInAction boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field tractionControlInAction boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field hasUserBrakeBias boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field hasEngineBrakeSettings boolean
---@field hasCockpitMGUHMode boolean
---@field hasCockpitERSDelivery boolean
---@field hasCockpitERSRecovery boolean
---@field drsPresent boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field drsAvailable boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field drsActive boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field kersPresent boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field kersHasButtonOverride boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field kersButtonPressed boolean @Physics-only (see `ac.CarState.physicsAvailable`).
---@field mguhChargingBatteries boolean
---@field mgukDelivery integer @Starts with 0.
---@field mgukDeliveryCount integer
---@field mgukRecovery integer @From 0 to 10 (for 100%).
---@field tractionControlMode integer @0 for disabled TC. Physics-only (see `ac.CarState.physicsAvailable`).
---@field absMode integer @0 for disabled ABS. Physics-only (see `ac.CarState.physicsAvailable`).
---@field brakeSettingsCount integer
---@field engineBrakeSettingsCount integer
---@field currentEngineBrakeSetting integer
---@field speedLimiter number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field differentialPreload number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field awdFrontShare number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field drivetrainTorque number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field drivetrainPower number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field brakeBias number @Physics-only (see `ac.CarState.physicsAvailable`).
---@field turboBoosts number[] @Physics-only (see `ac.CarState.physicsAvailable`). 8 items, starts with 0.
---@field turboWastegates number[] @Physics-only (see `ac.CarState.physicsAvailable`). 8 items, starts with 0.
---@field tractionControl2 number
---@field fuelMap number
---@field ffbFinal number
---@field ffbPure number

---@class ac.StateSim : ClassBase
---@field windowWidth integer @Width of AC window in pixels (set in AC video settings). Might not be the same as UI screen size if scaling is used.
---@field windowHeight integer @Height of AC window in pixels (set in AC video settings). Might not be the same as UI screen size if scaling is used.
---@field msaaSamples integer @1 for MSAA disabled, 2 for MSAA 2x, 4 for 4x, 8 for 8x.
---@field worldDetailLevel integer @0 for very low, 5 for very high. Set in AC video settings.
---@field isFullscreen boolean @A value from AC video settings, does not change live.
---@field isVSyncActive boolean @A value from AC video settings, does not change live.
---@field isPostProcessingActive boolean @True if YEBIS post-processing is active.
---@field isVRConnected boolean @True if AC runs in either Oculus or OpenVR mode and initialization went successfully.
---@field time number @Game time in milliseconds (counting from the start of the simulation).
---@field cameraPosition vec3
---@field cameraLook vec3
---@field cameraUp vec3
---@field carsCount integer
---@field focusedCar integer @0-based index, or -1 if there is no focused car (for example, with track camera or with free camera far from other cars).
---@field dt number
---@field isFreeCameraOutside boolean
---@field isReplayActive boolean
---@field isReplayOnlyMode boolean
---@field isOnlineRace boolean
---@field isFocusedOnInterior boolean
---@field isSessionStarted boolean
---@field controlsWithShifter boolean
---@field virtualMirrorActive boolean
---@field ambientTemperature number
---@field roadTemperature number
---@field windSpeedKmh number
---@field windVelocityKmh vec2
---@field windDirectionDeg number
---@field rainIntensity number
---@field rainWetness number
---@field rainWater number
---@field timeTotalSeconds number
---@field timeHours integer
---@field timeMinutes integer
---@field timeSeconds integer
---@field raceFlagType integer
---@field raceSessionType integer
---@field timeToSessionStart number
---@field sessionTimeLeft number
---@field currentSessionIndex integer
---@field sessionsCoint integer
---@field trackLengthM number
---@field speedLimitKmh number
---@field fps number
---@field fpsCapped number
---@field physicsLate number
---@field cpuOccupancy integer
---@field cpuTime number
---@field cameraMode integer
---@field driveableCameraMode integer
---@field carCameraMode integer
---@field audioMasterVolume number
---@field whiteReferencePoint number

---@class ac.StateUi : ClassBase
---@field windowSize vec2 @Size of AC UI window (affected by UI scale).
---@field mousePos vec2 @Mouse position within an AC UI window (affected by UI scale).
---@field dt number @Time between frames in seconds (not affected by pausing or replay speed modifier).
---@field mouseWheel number @Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
---@field isMouseLeftKeyClicked boolean @Left mouse button was just pressed.
---@field isMouseRightKeyClicked boolean @Right mouse button was just pressed.
---@field isMouseLeftKeyDown boolean @Left mouse button is currently held.
---@field isMouseRightKeyDown boolean @Right mouse button is currently held.
---@field ctrlDown boolean @Keyboard modifier pressed: Control.
---@field shiftDown boolean @Keyboard modifier pressed: Shift.
---@field altDown boolean @Keyboard modifier pressed: Alt.
---@field superDown boolean @Keyboard modifier pressed: Cmd/Super/Windows.
---@field wantCaptureMouse boolean
---@field wantCaptureKeyboard boolean
---@field framerate number @UI framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames.
---@field metricsRenderVertices integer @Vertices output during last call to Render().
---@field metricsRenderIndices integer @Indices output during last call to Render() = number of triangles * 3.
---@field metricsRenderWindows integer @Number of visible windows.
---@field metricsActiveWindows integer @Number of active windows.
---@field metricsRenderCommands integer @Number of draw calls.
---@field mouseDelta vec2 @Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.

--[[ common/common.lua ]]

---For better compatibility, acts like `ac.log()`.
function print(v) end

---Not doing anything anymore, kept for compatibility.
---@deprecated
function ac.skipSaneChecks() end

---Calls a function in a safe way, catching errors. If any errors were to occur, `catch` would be
---called with an error message as an argument. In either case (with and without error), if provided,
---`finally` will be called.
---@generic T
---@param fn fun(): T
---@param catch fun(err: string)
---@param finally fun()
---@return T|nil
function try(fn, catch, finally) end

---Calls a function and then calls `dispose` function. Note: `dispose` function will be called even if
---there would be an error in `fn` function. But error would not be contained and will propagate.
---@generic T
---@param fn fun(): T
---@param dispose fun()
---@return T|nil
function using(fn, dispose) end

---Stores value in session shared Lua/Python storage. This is not a long-term storage, more of a way for
---different scripts to exchange data. Note: if you need to exchange a lot of data between Lua scripts,
---consider using ac.connect instead.
---@param key string
---@param value string|number
function ac.store(key, value) end

---Reads value from session shared Lua/Python storage. This is not a long-term storage, more of a way for
---different scripts to exchange data. Note: if you need to exchange a lot of data between Lua scripts,
---consider using ac.connect instead.
---@param key string
---@return nil|string|number
function ac.load(key) end

---For easy import of scripts from subdirectories. Provide it a name of a directory relative
---to main script folder and it would add that directory to paths it searches for.
---@param dir string
function package.add(dir) end

--[[ common/ac_primitive_vec2.lua ]]

---Creates new vector. It’s usually faster to create a new item with `vec2(x, y)` directly, but the way LuaJIT works,
---that call only works with two numbers. If you only provide a single number, rest will be set to 0. This call, however, supports
---various calls (which also makes it slightly slower).
---@overload fun(value: vec2): vec2
---@overload fun(tableOfTwo: number[]): vec2
---@overload fun(value: number): vec2
---@param x number
---@param y number
---@return vec2
function vec2.new(x, y) end

---Checks if value is vec2 or not.
---@param p any
---@return boolean
function vec2.isvec2(p) end

---Temporary vector. For most cases though, it might be better to define those locally and use those. Less chance of collision.
---@return vec2
function vec2.tmp() end

---Two-dimensional vector. All operators are overloaded. Note: creating a lot of new vectors can create extra work for garbage collector reducing overall effectiveness.
---Where possible, instead of using mathematical operators consider using methods altering state of already existing vectors. So, instead of:
---```
---someVec = vec2()
---…
---someVec = math.normalize(vec1 + vec2) * 10
---```
---Consider rewriting it like:
---```
---someVec = vec2()
---…
---someVec:set(vec1):add(vec2):normalize():scale(10)
---```
---@param x number 
---@param y number 
---@return vec2
function vec2(x, y) end

---Two-dimensional vector. All operators are overloaded. Note: creating a lot of new vectors can create extra work for garbage collector reducing overall effectiveness.
---Where possible, instead of using mathematical operators consider using methods altering state of already existing vectors. So, instead of:
---```
---someVec = vec2()
---…
---someVec = math.normalize(vec1 + vec2) * 10
---```
---Consider rewriting it like:
---```
---someVec = vec2()
---…
---someVec:set(vec1):add(vec2):normalize():scale(10)
---```
---@class vec2
---@field x number
---@field y number
local vec2 = nil

---Makes a copy of a vector.
---@return vec2
function vec2:clone() end

---Unpacks vec2 into rgb and number.
---@return rgb, number
function vec2:unpack() end

---Turns vec2 into a table with two values.
---@return number[]
function vec2:table() end

---Returns reference to vec2 class.
function vec2:type() end

---@param x vec2|number
---@param y number?
---@return vec2 @Returns itself.
function vec2:set(x, y) end

---@param vec vec2
---@param scale number
---@return vec2 @Returns itself.
function vec2:setScaled(vec, scale) end

---@param value1 vec2
---@param value2 vec2
---@param mix number
---@return vec2 @Returns itself.
function vec2:setLerp(value1, value2, mix) end

---Copies its values to a different vector.
---@param out vec2
---@return vec2 @Returns itself.
function vec2:copyTo(out) end

---@param valueToAdd vec2|number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:add(valueToAdd, out) end

---@param valueToAdd vec2
---@param scale number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:addScaled(valueToAdd, scale, out) end

---@param valueToSubtract vec2|number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:sub(valueToSubtract, out) end

---@param valueToMultiplyBy vec2
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:mul(valueToMultiplyBy, out) end

---@param valueToDivideBy vec2
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:div(valueToDivideBy, out) end

---@param exponent vec2|number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:pow(exponent, out) end

---@param multiplier number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:scale(multiplier, out) end

---@param otherValue vec2|number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:min(otherValue, out) end

---@param otherValue vec2|number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:max(otherValue, out) end

---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:saturate(out) end

---@param min vec2
---@param max vec2
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:clamp(min, max, out) end

---@return number
function vec2:length() end

---@return number
function vec2:lengthSquared() end

---@param otherVector vec2
---@return number
function vec2:distance(otherVector) end

---@param otherVector vec2
---@return number
function vec2:distanceSquared(otherVector) end

---@param otherVector vec2
---@param distanceThreshold number
---@return boolean
function vec2:closerToThan(otherVector, distanceThreshold) end

---@param otherVector vec2
---@return number
function vec2:angle(otherVector) end

---@param otherVector vec2
---@return number
function vec2:dot(otherVector) end

---Normalizes itself (unless different `out` is provided).
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:normalize(out) end

---Rewrites own values with values of lerp of itself and other vector (unless different `out` is provided).
---@param otherVector vec2
---@param mix number
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:lerp(otherVector, mix, out) end

---Rewrites own values with values of projection of itself onto another vector (unless different `out` is provided).
---@param otherVector vec2
---@param out vec2|nil @Optional destination argument.
---@return vec2 @Returns itself or out value.
function vec2:project(otherVector, out) end

--[[ common/ac_primitive_vec3.lua ]]

---Creates new vector. It’s usually faster to create a new item with `vec3(x, y, z)` directly, but the way LuaJIT works,
---that call only works with three numbers. If you only provide a single number, rest will be set to 0. This call, however, supports
---various calls (which also makes it slightly slower).
---@overload fun(value: vec3): vec3
---@overload fun(tableOfThree: number[]): vec3
---@overload fun(value: number): vec3
---@param x number
---@param y number
---@param z number
---@return vec3
function vec3.new(x, y, z) end

---Checks if value is vec3 or not.
---@param p any
---@return boolean
function vec3.isvec3(p) end

---Temporary vector. For most cases though, it might be better to define those locally and use those. Less chance of collision.
---@return vec3
function vec3.tmp() end

---Three-dimensional vector. All operators are overloaded.
---Note: creating a lot of new vectors can create extra work for garbage collector reducing overall effectiveness.
---Where possible, instead of using mathematical operators consider using methods altering state of already existing vectors. So, instead of:
---```
---someVec = vec3()
---…
---someVec = math.normalize(vec1 + vec2) * 10
---```
---Consider rewriting it like:
---```
---someVec = vec3()
---…
---someVec:set(vec1):add(vec2):normalize():scale(10)
---```
---@param x number 
---@param y number 
---@param z number 
---@return vec3
function vec3(x, y, z) end

---Three-dimensional vector. All operators are overloaded.
---Note: creating a lot of new vectors can create extra work for garbage collector reducing overall effectiveness.
---Where possible, instead of using mathematical operators consider using methods altering state of already existing vectors. So, instead of:
---```
---someVec = vec3()
---…
---someVec = math.normalize(vec1 + vec2) * 10
---```
---Consider rewriting it like:
---```
---someVec = vec3()
---…
---someVec:set(vec1):add(vec2):normalize():scale(10)
---```
---@class vec3
---@field x number
---@field y number
---@field z number
local vec3 = nil

---Makes a copy of a vector.
---@return vec3
function vec3:clone() end

---Unpacks vec3 into rgb and number.
---@return rgb, number
function vec3:unpack() end

---Turns vec3 into a table with three values.
---@return number[]
function vec3:table() end

---Returns reference to vec3 class.
function vec3:type() end

---@param x vec3|number
---@param y number?
---@param z number?
---@return vec3 @Returns itself.
function vec3:set(x, y, z) end

---@param vec vec3
---@param scale number
---@return vec3 @Returns itself.
function vec3:setScaled(vec, scale) end

---@param value1 vec3
---@param value2 vec3
---@param mix number
---@return vec3 @Returns itself.
function vec3:setLerp(value1, value2, mix) end

---Sets itself to a normalized result of cross product of value1 and value2.
---@param value1 vec3
---@param value2 vec3
---@return vec3 @Returns itself.
function vec3:setCrossNormalized(value1, value2) end

---Copies its values to a different vector.
---@param out vec3
---@return vec3 @Returns itself.
function vec3:copyTo(out) end

---@param valueToAdd vec3|number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:add(valueToAdd, out) end

---@param valueToAdd vec3
---@param scale number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:addScaled(valueToAdd, scale, out) end

---@param valueToSubtract vec3|number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:sub(valueToSubtract, out) end

---@param valueToMultiplyBy vec3
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:mul(valueToMultiplyBy, out) end

---@param valueToDivideBy vec3
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:div(valueToDivideBy, out) end

---@param exponent vec3|number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:pow(exponent, out) end

---@param multiplier number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:scale(multiplier, out) end

---@param otherValue vec3|number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:min(otherValue, out) end

---@param otherValue vec3|number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:max(otherValue, out) end

---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:saturate(out) end

---@param min vec3
---@param max vec3
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:clamp(min, max, out) end

---@return number
function vec3:length() end

---@return number
function vec3:lengthSquared() end

---@param otherVector vec3
---@return number
function vec3:distance(otherVector) end

---@param otherVector vec3
---@return number
function vec3:distanceSquared(otherVector) end

---@param otherVector vec3
---@param distanceThreshold number
---@return boolean
function vec3:closerToThan(otherVector, distanceThreshold) end

---@param otherVector vec3
---@return number
function vec3:angle(otherVector) end

---@param otherVector vec3
---@return number
function vec3:dot(otherVector) end

---Normalizes itself (unless different `out` is provided).
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:normalize(out) end

---Rewrites own values with values of cross product of itself and other vector (unless different `out` is provided).
---@param otherVector vec3
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:cross(otherVector, out) end

---Rewrites own values with values of lerp of itself and other vector (unless different `out` is provided).
---@param otherVector vec3
---@param mix number
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:lerp(otherVector, mix, out) end

---Rewrites own values with values of projection of itself onto another vector (unless different `out` is provided).
---@param otherVector vec3
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:project(otherVector, out) end

---Rewrites own values with values of itself rotated with quaternion (unless different `out` is provided).
---@param quaternion quat
---@param out vec3|nil @Optional destination argument.
---@return vec3 @Returns itself or out value.
function vec3:rotate(quaternion, out) end

--[[ common/ac_primitive_vec4.lua ]]

---Creates new vector. It’s usually faster to create a new item with `vec4(x, y, z, w)` directly, but the way LuaJIT works,
---that call only works with four numbers. If you only provide a single number, rest will be set to 0. This call, however, supports
---various calls (which also makes it slightly slower).
---@overload fun(value: vec4): vec4
---@overload fun(tableOfFour: number[]): vec4
---@overload fun(value: number): vec4
---@param x number
---@param y number
---@param z number
---@param w number
---@return vec4
function vec4.new(x, y, z, w) end

---Checks if value is vec4 or not.
---@param p any
---@return boolean
function vec4.isvec4(p) end

---Temporary vector. For most cases though, it might be better to define those locally and use those. Less chance of collision.
---@return vec4
function vec4.tmp() end

---Four-dimensional vector. All operators are also overloaded.
---Note: creating a lot of new vectors can create extra work for garbage collector reducing overall effectiveness.
---Where possible, instead of using mathematical operators consider using methods altering state of already existing vectors. So, instead of:
---```
---someVec = vec4()
---…
---someVec = math.normalize(vec1 + vec2) * 10
---```
---Consider rewriting it like:
---```
---someVec = vec4()
---…
---someVec:set(vec1):add(vec2):normalize():scale(10)
---```
---@param x number 
---@param y number 
---@param z number 
---@param w number 
---@return vec4
function vec4(x, y, z, w) end

---Four-dimensional vector. All operators are also overloaded.
---Note: creating a lot of new vectors can create extra work for garbage collector reducing overall effectiveness.
---Where possible, instead of using mathematical operators consider using methods altering state of already existing vectors. So, instead of:
---```
---someVec = vec4()
---…
---someVec = math.normalize(vec1 + vec2) * 10
---```
---Consider rewriting it like:
---```
---someVec = vec4()
---…
---someVec:set(vec1):add(vec2):normalize():scale(10)
---```
---@class vec4
---@field x number
---@field y number
---@field z number
---@field w number
local vec4 = nil

---Makes a copy of a vector.
---@return vec4
function vec4:clone() end

---Unpacks vec4 into rgb and number.
---@return rgb, number
function vec4:unpack() end

---Turns vec4 into a table with four values.
---@return number[]
function vec4:table() end

---Returns reference to vec4 class.
function vec4:type() end

---@param x vec4|number
---@param y number?
---@param z number?
---@param w number?
---@return vec4 @Returns itself.
function vec4:set(x, y, z, w) end

---@param vec vec4
---@param scale number
---@return vec4 @Returns itself.
function vec4:setScaled(vec, scale) end

---@param value1 vec4
---@param value2 vec4
---@param mix number
---@return vec4 @Returns itself.
function vec4:setLerp(value1, value2, mix) end

---Sets itself to a normalized result of cross product of value1 and value2.
---@param value1 vec4
---@param value2 vec4
---@return vec4 @Returns itself.
function vec4:setCrossNormalized(value1, value2) end

---Copies its values to a different vector.
---@param out vec4
---@return vec4 @Returns itself.
function vec4:copyTo(out) end

---@param valueToAdd vec4|number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:add(valueToAdd, out) end

---@param valueToAdd vec4
---@param scale number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:addScaled(valueToAdd, scale, out) end

---@param valueToSubtract vec4|number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:sub(valueToSubtract, out) end

---@param valueToMultiplyBy vec4
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:mul(valueToMultiplyBy, out) end

---@param valueToDivideBy vec4
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:div(valueToDivideBy, out) end

---@param exponent vec4|number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:pow(exponent, out) end

---@param multiplier number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:scale(multiplier, out) end

---@param otherValue vec4|number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:min(otherValue, out) end

---@param otherValue vec4|number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:max(otherValue, out) end

---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:saturate(out) end

---@param min vec4
---@param max vec4
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:clamp(min, max, out) end

---@return number
function vec4:length() end

---@return number
function vec4:lengthSquared() end

---@param otherVector vec4
---@return number
function vec4:distance(otherVector) end

---@param otherVector vec4
---@return number
function vec4:distanceSquared(otherVector) end

---@param otherVector vec4
---@param distanceThreshold number
---@return boolean
function vec4:closerToThan(otherVector, distanceThreshold) end

---@param otherVector vec4
---@return number
function vec4:angle(otherVector) end

---@param otherVector vec4
---@return number
function vec4:dot(otherVector) end

---Normalizes itself (unless different `out` is provided).
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:normalize(out) end

---Rewrites own values with values of lerp of itself and other vector (unless different `out` is provided).
---@param otherVector vec4
---@param mix number
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:lerp(otherVector, mix, out) end

---Rewrites own values with values of projection of itself onto another vector (unless different `out` is provided).
---@param otherVector vec4
---@param out vec4|nil @Optional destination argument.
---@return vec4 @Returns itself or out value.
function vec4:project(otherVector, out) end

--[[ common/ac_primitive_rgb.lua ]]

---Creates new instance. It’s usually faster to create a new item with `rgb(r, g, b, mult)` directly, but the way LuaJIT works,
---that call only works with three numbers. If you only provide a single number, rest will be set to 0. This call, however, supports
---various calls (which also makes it slightly slower).
---@overload fun(color: rgb): rgb
---@overload fun(color: rgbm): rgb
---@overload fun(color: hsv): rgb
---@overload fun(color: vec4): rgb
---@overload fun(color: vec3): rgb
---@overload fun(tableOfThree: number[]): rgb
---@overload fun(color: number): rgb
---@param r number
---@param g number
---@param b number
---@return rgb
function rgb.new(r, g, b, m) end

---Checks if value is rgb or not.
---@param p any
---@return boolean
function rgb.isrgb(p) end

---Temporary vector. For most cases though, it might be better to define those locally and use those. Less chance of collision.
---@return rgb
function rgb.tmp() end

---Creates color from 0…255 values
---@param r number @From 0 to 255
---@param g number @From 0 to 255
---@param b number @From 0 to 255
---@return rgb
function rgb.from0255(r, g, b, a) end

---Predefined colors. Do not change them unless you want to have some extra fun debugging.
rgb.colors = {
  transparent = rgb(0, 0, 0),
  black = rgb(0, 0, 0),
  silver = rgb(0.75, 0.75, 0.75),
  gray = rgb(0.5, 0.5, 0.5),
  white = rgb(1, 1, 1),
  maroon = rgb(0.5, 0, 0),
  red = rgb(1, 0, 0),
  purple = rgb(0.5, 0, 0.5),
  fuchsia = rgb(1, 0, 1),
  green = rgb(0, 0.5, 0),
  lime = rgb(0, 1, 0),
  olive = rgb(0.5, 0.5, 0),
  yellow = rgb(1, 1, 0),
  navy = rgb(0, 0, 0.5),
  blue = rgb(0, 0, 1),
  teal = rgb(0, 0.5, 0.5),
  aqua = rgb(0, 1, 1),
}

---Three-channel color. All operators are overloaded. White is usually `rgb=1,1,1`.
---@param r number 
---@param g number 
---@param b number 
---@return rgb
function rgb(r, g, b) end

---Three-channel color. All operators are overloaded. White is usually `rgb=1,1,1`.
---@class rgb
---@field r number
---@field g number
---@field b number
local rgb = nil

---Makes a copy of a vector.
---@return rgb
function rgb:clone() end

---Unpacks rgb into three numbers.
---@return rgb, number
function rgb:unpack() end

---Turns rgb into a table with three numbers.
---@return number[]
function rgb:table() end

---Returns reference to rgb class.
function rgb:type() end

---@param r rgb|number
---@param g number?
---@param b number?
---@return rgb @Returns itself.
function rgb:set(r, g, b) end

---@param value1 rgb
---@param value2 rgb
---@param mix number
---@return rgb @Returns itself.
function rgb:setLerp(value1, value2, mix) end

---@param valueToAdd rgb|number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:add(valueToAdd, out) end

---@param valueToAdd rgb
---@param scale number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:addScaled(valueToAdd, scale, out) end

---@param valueToSubtract rgb|number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:sub(valueToSubtract, out) end

---@param valueToMultiplyBy rgb
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:mul(valueToMultiplyBy, out) end

---@param valueToDivideBy rgb
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:div(valueToDivideBy, out) end

---@param exponent rgb|number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:pow(exponent, out) end

---@param multiplier number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:scale(multiplier, out) end

---@param otherValue rgb|number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:min(otherValue, out) end

---@param otherValue rgb|number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:max(otherValue, out) end

---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:saturate(out) end

---@param min rgb
---@param max rgb
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:clamp(min, max, out) end

---Adjusts saturation using a very simple formula.
---@param saturation number
---@param out rgb|nil @Optional destination argument.
---@return rgb @Returns itself or out value.
function rgb:adjustSaturation(saturation, out) end

---Makes sure brightest value does not exceed 1.
---@return rgb @Returns itself.
function rgb:normalize() end

---Returns brightest value (aka V in HSV).
---@return number
function rgb:value() end

---Returns hue.
---@return number
function rgb:hue() end

---Returns saturation.
---@return number
function rgb:saturation() end

---Returns luminance value.
---@return number
function rgb:luminance() end

---Returns rgbm.
---@param mult number @Default value is 1.
---@return rgbm
function rgb:rgbm(mult) end

---Returns HSV color of rgb*mult.
---@return hsv
function rgb:hsv() end

---Returns rgb*mult turned to vec3.
---@return vec3
function rgb:vec3() end

--[[ common/ac_primitive_hsv.lua ]]

---Creates new instance. It’s usually faster to create a new item with `hsv(h, s, v)`.
---@param h number
---@param s number
---@param v number
---@return hsv
function hsv.new(h, s, v) end

---Checks if value is hsv or not.
---@param p any
---@return boolean
function hsv.ishsv(p) end

---Temporary vector. For most cases though, it might be better to define those locally and use those. Less chance of collision.
---@return hsv
function hsv.tmp() end

---HSV color (hue, saturation, value). Equality operator is overloaded.
---@param h number 
---@param s number 
---@param v number 
---@return hsv
function hsv(h, s, v) end

---HSV color (hue, saturation, value). Equality operator is overloaded.
---@class hsv
---@field h number
---@field s number
---@field v number
local hsv = nil

---Makes a copy of a vector.
---@return hsv
function hsv:clone() end

---Unpacks hsv into three numbers.
---@return rgb, number
function hsv:unpack() end

---Turns hsv into a table with three numbers.
---@return number[]
function hsv:table() end

---Returns reference to hsv class.
function hsv:type() end

---@param h number
---@param s number
---@param v number
---@return hsv @Returns itself.
function hsv:set(h, s, v) end

---Returns RGB color.
---@return rgb
function hsv:rgb() end

--[[ common/ac_primitive_rgbm.lua ]]

---Creates new instance. It’s usually faster to create a new item with `rgbm(r, g, b, mult)` directly, but the way LuaJIT works,
---that call only works with four numbers. If you only provide a single number, rest will be set to 0. This call, however, supports
---various calls (which also makes it slightly slower).
---@overload fun(color: rgbm): rgbm
---@overload fun(color: rgb): rgbm
---@overload fun(color: hsv): rgbm
---@overload fun(color: vec4): rgbm
---@overload fun(color: vec3): rgbm
---@overload fun(tableOfFour: number[]): rgbm
---@overload fun(hexColor: string): rgbm
---@overload fun(colorAlpha: number): rgbm
---@overload fun(color: number, alpha: number): rgbm
---@param r number
---@param g number
---@param b number
---@param m number? @Default value: 1.
---@return rgbm
function rgbm.new(r, g, b, m) end

---Checks if value is rgbm or not.
---@param p any
---@return boolean
function rgbm.isrgbm(p) end

---Temporary vector. For most cases though, it might be better to define those locally and use those. Less chance of collision.
---@return rgbm
function rgbm.tmp() end

---Creates color from 0…255 values
---@param r number @From 0 to 255
---@param g number @From 0 to 255
---@param b number @From 0 to 255
---@param a number? @From 0 to 1, default value: 1
---@return rgbm
function rgbm.from0255(r, g, b, a) end

---Predefined colors. Do not change them unless you want to have some extra fun debugging.
rgbm.colors = {
  transparent = rgbm(0, 0, 0, 0),
  black = rgbm(0, 0, 0, 1),
  silver = rgbm(0.75, 0.75, 0.75, 1),
  gray = rgbm(0.5, 0.5, 0.5, 1),
  white = rgbm(1, 1, 1, 1),
  maroon = rgbm(0.5, 0, 0, 1),
  red = rgbm(1, 0, 0, 1),
  purple = rgbm(0.5, 0, 0.5, 1),
  fuchsia = rgbm(1, 0, 1, 1),
  green = rgbm(0, 0.5, 0, 1),
  lime = rgbm(0, 1, 0, 1),
  olive = rgbm(0.5, 0.5, 0, 1),
  yellow = rgbm(1, 1, 0, 1),
  navy = rgbm(0, 0, 0.5, 1),
  blue = rgbm(0, 0, 1, 1),
  teal = rgbm(0, 0.5, 0.5, 1),
  aqua = rgbm(0, 1, 1, 1),
}

---Four-channel color. Fourth value, `mult`, can be used for alpha, for brightness, anything like that. All operators are also 
---overloaded. White is usually `rgb=1,1,1`.
---@param r number 
---@param g number 
---@param b number 
---@param mult number 
---@return rgbm
function rgbm(r, g, b, mult) end

---Four-channel color. Fourth value, `mult`, can be used for alpha, for brightness, anything like that. All operators are also 
---overloaded. White is usually `rgb=1,1,1`.
---@class rgbm
---@field r number
---@field g number
---@field b number
---@field rgb rgb
---@field mult number
local rgbm = nil

---Makes a copy of a vector.
---@return rgbm
function rgbm:clone() end

---Unpacks rgbm into rgb and number.
---@return rgb, number
function rgbm:unpack() end

---Turns rgbm into a table with four values.
---@return number[]
function rgbm:table() end

---Returns reference to rgbm class.
function rgbm:type() end

---@param rgb rgbm|rgb
---@param mult number?
---@return rgbm @Returns itself.
function rgbm:set(rgb, mult) end

---@param value1 rgbm
---@param value2 rgbm
---@param mix number
---@return rgbm @Returns itself.
function rgbm:setLerp(value1, value2, mix) end

---@param valueToAdd rgbm|number
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:add(valueToAdd, out) end

---@param valueToAdd rgbm
---@param scale number
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:addScaled(valueToAdd, scale, out) end

---@param valueToSubtract rgbm|number
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:sub(valueToSubtract, out) end

---@param valueToMultiplyBy rgbm
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:mul(valueToMultiplyBy, out) end

---@param valueToDivideBy rgbm
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:div(valueToDivideBy, out) end

---@param exponent rgbm|number
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:pow(exponent, out) end

---@param multiplier number
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:scale(multiplier, out) end

---@param otherValue rgbm|number
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:min(otherValue, out) end

---@param otherValue rgbm|number
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:max(otherValue, out) end

---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:saturate(out) end

---@param min rgbm
---@param max rgbm
---@param out rgbm|nil @Optional destination argument.
---@return rgbm @Returns itself or out value.
function rgbm:clamp(min, max, out) end

---Makes sure brightest value does not exceed 1.
---@return rgbm @Returns itself.
function rgbm:normalize() end

---Returns brightest value.
---@return number
function rgbm:value() end

---Returns luminance value.
---@return number
function rgbm:luminance() end

---Returns color (rgb*mult).
---@return rgb
function rgbm:color() end

---Returns HSV color of rgb*mult.
---@return hsv
function rgbm:hsv() end

---Returns rgb*mult turned to vec3.
---@return vec3
function rgbm:vec3() end

---Returns vec4, where X, Y and Z are RGB values and W is mult.
---@return vec4
function rgbm:vec4() end

--[[ common/ac_primitive_quat.lua ]]

---Creates new quaternion. It’s usually faster to create a new item with `quat(x, y, z, w)` directly, but the way LuaJIT works,
---that call only works with four numbers. If you only provide a single number, rest will be set to 0. This call, however, supports
---various calls (which also makes it slightly slower).
---@overload fun(value: quat): quat
---@overload fun(tableOfFour: number[]): quat
---@overload fun(value: number): quat
---@param x number
---@param y number
---@param z number
---@param w number
---@return quat
function quat.new(x, y, z, w) end

---Checks if value is quat or not.
---@param p any
---@return boolean
function quat.isquat(p) end

---Creates a new quaternion.
---@param angle number @In radians.
---@param x vec3|number
---@param y number?
---@param z number?
---@return quat
function quat.fromAngleAxis(angle, x, y, z) end

---Creates a new quaternion.
---@param x vec3|number
---@param y number?
---@param z number?
---@return quat
function quat.fromDirection(x, y, z) end

---Creates a new quaternion.
---@param u quat
---@param v quat
---@return quat
function quat.between(u, v) end

---Temporary quaternion. For most cases though, it might be better to define those locally and use those. Less chance of collision.
---@return quat
function quat.tmp() end

---Quaternion. All operators are overloaded.
---@param x number 
---@param y number 
---@param z number 
---@param w number 
---@return quat
function quat(x, y, z, w) end

---Quaternion. All operators are overloaded.
---@class quat
---@field x number
---@field y number
---@field z number
---@field w number
local quat = nil

---Makes a copy of a quaternion.
---@return quat
function quat:clone() end

---Unpacks quat into rgb and number.
---@return rgb, number
function quat:unpack() end

---Turns quat into a table with four values.
---@return number[]
function quat:table() end

---Returns reference to quat class.
function quat:type() end

---@param x quat|number
---@param y number?
---@param z number?
---@param w number?
---@return quat @Returns itself.
function quat:set(x, y, z, w) end

---@param angle number @In radians.
---@param x vec3|number
---@param y number?
---@param z number?
---@return quat @Returns itself.
function quat:setAngleAxis(angle, x, y, z) end

---@return number @Angle in radians.
---@return number @Axis, X.
---@return number @Axis, Y.
---@return number @Axis, Z.
function quat:getAngleAxis() end

---@param u quat
---@param v quat
---@return quat @Returns itself.
function quat:setBetween(u, v) end

---@param x vec3|number
---@param y number?
---@param z number?
---@return quat @Returns itself.
function quat:setDirection(x, y, z) end

---@param valueToAdd quat|number
---@param out quat|nil @Optional destination argument.
---@return quat @Returns itself or out value.
function quat:add(valueToAdd, out) end

---@param valueToSubtract quat|number
---@param out quat|nil @Optional destination argument.
---@return quat @Returns itself or out value.
function quat:sub(valueToSubtract, out) end

---@param valueToMultiplyBy quat
---@param out quat|nil @Optional destination argument.
---@return quat @Returns itself or out value.
function quat:mul(valueToMultiplyBy, out) end

---@param multiplier number
---@param out quat|nil @Optional destination argument.
---@return quat @Returns itself or out value.
function quat:scale(multiplier, out) end

---@return number
function quat:length() end

---Normalizes itself (unless different `out` is provided).
---@param out quat|nil @Optional destination argument.
---@return quat @Returns itself or out value.
function quat:normalize(out) end

---Rewrites own values with values of lerp of itself and other quaternion (unless different `out` is provided).
---@param otherVector quat
---@param mix number
---@param out quat|nil @Optional destination argument.
---@return quat @Returns itself or out value.
function quat:lerp(otherVector, mix, out) end

---Rewrites own values with values of slerp of itself and other quaternion (unless different `out` is provided).
---@param otherVector quat
---@param mix number
---@param out quat|nil @Optional destination argument.
---@return quat @Returns itself or out value.
function quat:slerp(otherVector, mix, out) end

--[[ common/ac_smoothing.lua ]]

---Call it once every frame at the beginning, it would affect all instances of `smoothing`.
---@param dt number @Time passed since last frame, in seconds.
function smoothing.setDT(dt) end

---Strange thing which is only kept for backwards compatibility. Holds a value, numerical or a vector, and
---updates it every frame slowly moving it towards target value. For new projects, I would recommend to use
---something else.
---
---It doesn’t even use lag parameter, but instead some strange “smooth” thing…
---@param initialValue number 
---@param smoothingIntensity number "Default value: 100."
---@return smoothing
function smoothing(initialValue, smoothingIntensity) end

---Strange thing which is only kept for backwards compatibility. Holds a value, numerical or a vector, and
---updates it every frame slowly moving it towards target value. For new projects, I would recommend to use
---something else.
---
---It doesn’t even use lag parameter, but instead some strange “smooth” thing…
---@class smoothing
---@field val number|vec2|vec3|vec4
---@field lastValue number|vec2|vec3|vec4
---@field smooth number
local smoothing = nil

---Updates value, moving it closer to `newValue`.
---@param newValue number|vec2|vec3|vec4 @Target value to move to.
function smoothing:update(newValue) end

---Updates value, moving it closer to `newValue`, but only if `newValue` is different from the one used in
---`:updateIfNew()` last time. And for vectors it compares not by value, but by reference. Makes me wonder what was I
---thinking about.
---@param newValue number|vec2|vec3|vec4 @Target value to move to.
function smoothing:updateIfNew(newValue) end

--[[ common/ac_matrices.lua ]]

---@param row1 vec3 
---@param row2 vec3 
---@param row3 vec3 
---@return mat3x3
function mat3x3(row1, row2, row3) end

---@class mat3x3
---@field row1 vec3
---@field row2 vec3
---@field row3 vec3
local mat3x3 = nil

---@param value mat3x3
---@return mat3x3
function mat3x3:set(value) end

---@param row1 vec4 
---@param row2 vec4 
---@param row3 vec4 
---@param row4 vec4 
---@return mat4x4
function mat4x4(row1, row2, row3, row4) end

---@class mat4x4
---@field row1 vec4
---@field row2 vec4
---@field row3 vec4
---@field row4 vec4
---@field position vec3
---@field look vec3
---@field side vec3
---@field up vec3
local mat4x4 = nil

---@param value mat4x4
---@return mat4x4
function mat4x4:set(value) end

--[[ common/math.lua ]]

---Takes value with even 0…1 distribution and remaps it to recreate a distribution
---similar to Gaussian’s one (with k≈0.52, default value). Lower to make bell more
---compact, use a value above 1 to get some sort of inverse distibution.
---@param x number @Value to adjust.
---@param k number @Bell curvature parameter.
---@return number
function math.gaussianAdjustment(x, k) end

---Builds a list of points (vec2) arranged in a circle with poisson distribution.
---@param size integer @Number of points.
---@return vec2[]
function math.poissonSamplerCircle(size) end

---Clamps a number value between `min` and `max`.
---@param value number
---@param min number
---@param max number
---@return number
function math.clampN(value, min, max) end

---Clamps a number value between 0 and 1.
---@param value number
---@return number
function math.saturateN(value) end

---Clamps a copy of a vector between `min` and `max`. To avoid making copies, use `vec:clamp(min, max)`.
---@generic T
---@param value T
---@param min any
---@param max any
---@return T
function math.clampV(value, min, max) end

---Clamps a copy of a vector between 0 and 1. To avoid making copies, use `vec:saturate()`.
---@generic T
---@param value T
---@return T
function math.saturateV(value) end

---Clamps value between `min` and `max`, returning `min` if `x` is below `min` or `max` if `x` is above `max`. Universal version, so might be slower.
---Also, if given a vector or a color, would make a copy of it.
---@generic T
---@param x T
---@param min any
---@param max any
---@return T
function math.clamp(x, min, max) end

---Clamps value between 0 and 1, returning 0 if `x` is below 0 or 1 if `x` is above 1. Universal version, so might be slower.
---Also, if given a vector or a color, would make a copy of it.
---@generic T
---@param x T
---@return T
function math.saturate(x) end

---Returns a sing of a value, or 0 if value is 0.
---@param x number
---@return integer
function math.sign(x) end

---Linear interpolation between `x` and `y` using `mix` (x * (1 - mix) + y * mix).
---@param x number
---@param y number
---@param mix number
---@return number
function math.lerp(x, y, mix) end

---Returns 0 if value is less than v0, returns 1 if it’s more than v1, linear interpolation in-between.
---@param value number
---@param min number
---@param max number
---@return number
function math.lerpInvSat(value, min, max) end

---Smoothstep operation. More about it in [wiki](https://en.wikipedia.org/wiki/Smoothstep).
---@param x number
---@return number
function math.smoothstep(x) end

---Like a smoothstep operation, but even smoother.
---@param x number
---@return number
function math.smootherstep(x) end

---Creates a copy of a vector and normalizes it. Consider avoiding making a copy with `vec:normalize()`.
---@generic T
---@param x T
---@return T
function math.normalize(x) end

---Creates a copy of a vector and runs a cross product on it. Consider avoiding making a copy with `vec:cross(otherVec)`.
---@param x vec3
---@return vec3
function math.cross(x, y) end

---Calculates dot product of two vectors.
---@param x vec2|vec3|vec4
---@return number
function math.dot(x, y) end

---Calculates angle between vectors in radians.
---@param x vec2|vec3|vec4
---@return number @Radians.
function math.angle(x, y) end

---Calculates distance between vectors.
---@param x vec2|vec3|vec4
---@return number
function math.distance(x, y) end

---Calculates squared distance between vectors (slightly faster without taking a square root).
---@param x vec2|vec3|vec4
---@return number
function math.distanceSquared(x, y) end

---Creates a copy of a vector and projects it onto a different vector. Consider avoiding making a copy with `vec:project(otherVec)`.
---@generic T
---@param x T
---@return T
function math.project(x, y) end

---Converts degrees to radians.
---@param x number @Degrees.
---@return number @Radians.
function math.radians(x) end

---Converts radians to degrees.
---@param x number @Radians.
---@return number @Degrees.
function math.degress(x) end

---Checks if value is NaN.
---@param x number
---@return boolean
function math.isNaN(x) end

---@type number
math.NaN = 0/0

---@param lag number
---@param dt number
---@return number
function math.lagMult(lag, dt) end

---@param value number
---@param target number
---@param lag number
---@param dt number
---@return number
function math.applyLag(value, target, lag, dt) end

--[[ common/string.lua ]]

---Splits string using separator.
---@param self string @String to split.
---@param separator string @Separator.
---@param limit integer? @Limit for pieces of string. Once reached, remaining string is put as a list piece.
---@return string[]
function string.split(self, separator, limit) end

---Trims string from whitespaces at beginning and end.
---@param self string
---@return string
function string.trim(self) end

--[[ common/table.lua ]]

---Checks if table is an array or not. Arrays are tables that only have consequtive numeric keys.
---@param t table|any[]
---@return boolean
function table.isArray(t) end

---Cleares table without deallocating space using a fast LuaJIT call. Can work
---with both array and non-array tables.
---@param t table
function table.clear(t) end

---Returns the total number of elements in a given Lua table (i.e. from both the array and hash parts combined).
---@param t table
function table.nkeys(t) end

---Clones table using a fast LuaJIT call.
---@param t table
function table.clone(t) end

---Removes first item by value, returns true if any item was removed. Can work
---with both array and non-array tables.
---@generic T
---@param t table<any, T>
---@param item T
---@return boolean
function table.removeItem(t, item) end

---Returns an element from table with a given key. If there is no such element, calls callback
---and uses its return value to add a new element and return that. Can work
---with both array and non-array tables.
---@generic T
---@generic TCallbackData
---@param t table<any, T>
---@param key any
---@param callback fun(callbackData: TCallbackData): T
---@param callbackData TCallbackData
---@return T
function table.getOrCreate(t, key, callback, callbackData) end

---Returns true if table contains an item. Can work with both array and non-array tables.
---@generic T
---@param t table<any, T>
---@param item T
---@return boolean
function table.contains(t, item) end

---Returns a random item from a table. Optional callback works like a filter. Can work
---with both array and non-array tables. Alternatively, optional callback can provide a number
---for a weight of an item.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param filteringCallback fun(item: T, key: TKey, callbackData: TCallbackData): boolean
---@param filteringCallbackData TCallbackData
---@return T
function table.random(t, filteringCallback, filteringCallbackData) end

---Returns a key of a given element, or nil if there is no such element in a table. Can work
---with both array and non-array tables.
---@generic T
---@generic TKey
---@param t table<TKey, T>
---@param item T
---@return TKey|nil
function table.indexOf(t, item) end

---Joins elements of a table to a string, works with both arrays and non-array tables. Optinal
---toStringCallback parameter can be used for a custom item serialization. All parameters but
---`t` (for actual table) are optional and can be skipped.
---
---Note: it wouldn’t work as fast as `table.concat`, but it would call a `tostring()` (or custom
---serializer callback) for each element.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param itemsJoin string @Default value: ','.
---@param keyValueJoin string @Default value: '='.
---@param toStringCallback fun(item: T, key: TKey, callbackData: TCallbackData): string
---@param toStringCallbackData TCallbackData
---@overload fun(t: table, itemsJoin: string, toStringCallback: fun(item: any, key: any, callbackData: any), toStringCallbackData: any)
---@overload fun(t: table, toStringCallback: fun(item: any, key: any, callbackData: any), toStringCallbackData: any)
---@return TKey|nil
function table.join(t, itemsJoin, keyValueJoin, toStringCallback, toStringCallbackData) end

---Slices array, basically acts like slicing thing in Python.
---@generic T
---@param t T[]
---@param from integer @Starting index.
---@param to integer? @Ending index.
---@param step integer? @Step.
---@return T[]
function table.slice(t, from, to, step) end

---Flips table from back to front, requires an array.
---@generic T
---@param t T[]
---@return T[]
function table.reverse(t) end

---Calls callback function for each of table elements, creates a new table containing all the resulting values.
---Can work with both array and non-array tables. For non-array tables, new table is going to be an array unless
---callback function would return a key as a second return value.
---
---If callback returns two values, second would be used as a key to create a table-like table (not an array-like one).
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): any @Mapping callback.
---@param callbackData TCallbackData
---@return table
function table.map(t, callback, callbackData) end

---Creates a new table from all elements for which filtering callback returns true. Can work with both
---array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): any @Filtering callback.
---@param callbackData TCallbackData
---@return table<TKey, T>
function table.filter(t, callback, callbackData) end

---Returns true if callback returns non-false value for every element of the table. Can work with both
---array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): boolean
---@param callbackData TCallbackData
---@return boolean
function table.every(t, callback, callbackData) end

---Returns true if callback returns non-false value for at least a single element of the table. Can work
---with both array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): boolean
---@param callbackData TCallbackData
---@return boolean
function table.some(t, callback, callbackData) end

---Counts number of elements for which callback returns non-false value. Can work
---with both array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): boolean
---@param callbackData TCallbackData
---@return integer
function table.count(t, callback, callbackData) end

---Calls callback for each element, returns sum of returned values. Can work
---with both array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): boolean
---@param callbackData TCallbackData
---@return integer
function table.sum(t, callback, callbackData) end

---Returns first element and its key for which callback returns a non-false value. Can work
---with both array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): boolean
---@param callbackData TCallbackData
---@return T, TKey
function table.findFirst(t, callback, callbackData) end

---Returns an element and its key for which callback would return the highest numerical value. Can work
---with both array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): number
---@param callbackData TCallbackData
---@return T, TKey
function table.maxEntry(t, callback, callbackData) end

---Returns an element and its key for which callback would return the lowest numerical value. Can work
---with both array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, index: TKey, callbackData: TCallbackData): number
---@param callbackData TCallbackData
---@return T, TKey
function table.minEntry(t, callback, callbackData) end

---Runs callback for each item in a table. Can work with both array and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, key: TKey, callbackData: TCallbackData)
---@param callbackData TCallbackData
---@return table
function table.forEach(t, callback, callbackData) end

---Creates a new table with unique elements from original table only. Optionally, a callback
---can be used to provide a key which uniqueness will be checked. Can work with both array
---and non-array tables.
---@generic T
---@generic TKey
---@generic TCallbackData
---@param t table<TKey, T>
---@param callback fun(item: T, key: TKey, callbackData: TCallbackData): any
---@param callbackData TCallbackData
---@return table<TKey, T>
function table.distinct(t, callback, callbackData) end

---Merges tables into one big table. Requires tables to be arrays.
---@vararg table
---@return table
function table.chain(...) end

---Flattens table similar to JavaScript function with the same name. Requires an array.
---@param t any[]
---@param maxLevel integer? @Default value: 1.
---@return any[]
function table.flatten(t, maxLevel) end

---Creates a new table running in steps from `startingIndex` to `endingIndex`, including `endingIndex`.
---@generic T
---@generic TCallbackData
---@param endingIndex integer?
---@param startingIndex integer
---@param step integer?
---@param callback fun(index: integer, callbackData: TCallbackData): T
---@param callbackData TCallbackData
---@return T[]
---@overload fun(endingIndex: integer, callback: fun(index: integer, callbackData: any), callbackData: any)
---@overload fun(endingIndex: integer, startingIndex: integer, callback: fun(index: integer, callbackData: any), callbackData: any)
function table.range(endingIndex, startingIndex, step, callback, callbackData) end

--[[ common/timer.lua ]]

---Runs callback after certain time. Returns cancellation ID.
---Note: all callbacks will be ran before `update()` call,
---and they would only ran when script runs. So if your script is executed each frame and AC runs at 60 FPS, smallest interval
---would be 0.016 s, and anything lower that you’d set would still act like 0.016 s. Also, intervals would only be called once
---per frame.
---@param callback fun()
---@param delay number @Delay time in seconds.
---@param uniqueKey any? @Unique key: if set, timer wouldn’t be added unless there is no more active timers with such ID.
---@return integer
function setTimeout(callback, delay, uniqueKey) end

---Repeteadly runs callback after certain time. Returns cancellation ID.
---Note: all callbacks will be ran before `update()` call,
---and they would only ran when script runs. So if your script is executed each frame and AC runs at 60 FPS, smallest interval
---would be 0.016 s, and anything lower that you’d set would still act like 0.016 s. Also, intervals would only be called once
---per frame.
---@param callback fun()
---@param period number @Period time in seconds.
---@param uniqueKey any? @Unique key: if set, timer wouldn’t be added unless there is no more active timers with such ID.
---@return integer
function setInterval(callback, period, uniqueKey) end

---Stops timeout.
---@param cancellationID integer @Value earlier retuned by `setTimeout()`.
---@return boolean @True if timeout with such ID has been found and stopped.
function clearTimeout(cancellationID) end

---Stops interval.
---@param cancellationID integer @Value earlier retuned by `setInterval()`.
---@return boolean @True if interval with such ID has been found and stopped.
function clearInterval(cancellationID) end

--[[ common/ac_extras_connect.lua ]]

---Creates a new connectivity structure to quickly exchange data between different Lua scripts within a session.
---@param layout string @Elements of a C-like structure, should follow LuaJIT rules. For example: `"vec3 pos; int someValue; rgb someColor; double floatingPointNumber;"`
---@param keepLive boolean|'true'|'false' @Set to true to keep structure even if any references were removed or script was unloaded.
---@return any
function ac.connect(layout, keepLive) end

--[[ common/ac_extras_hashspace.lua ]]

---@class ac.HashSpaceItem
local HashSpaceItem = class('HashSpaceItem')

---Returns ID associated with an item.
---@return integer
function HashSpaceItem:id() end

---Moves an item to a position.
---@param pos vec3
function HashSpaceItem:update(pos) end

---Removes item from its space.
function HashSpaceItem:dispose() end

---Simple structure meant to speed up collision detection by arranging items in a grid using hashmap.
---@param cellSize number @Should be about twice as large as your largest entity.
---@return ac.HashSpace
function ac.HashSpace(cellSize) end

---Simple structure meant to speed up collision detection by arranging items in a grid using hashmap.
---@class ac.HashSpace
local _ac_HashSpace = nil

---Iterates items around given position.
---@generic T
---@param pos vec3
---@param callback fun(id: integer, callbackData: T)
---@param callbackData T
function _ac_HashSpace:iterate(pos, callback, callbackData) end

---Checks if there are any items around given position.
---@param pos vec3
---@return boolean
function _ac_HashSpace:anyAround(pos) end

---Count amount of items around given position.
---@param pos vec3
---@return integer
function _ac_HashSpace:count(pos) end

---Returns raw pointers for given position for manual iteration. Be careful!
---@param pos vec3
---@return any, any
function _ac_HashSpace:rawPointers(pos) end

---Adds a new dynamic item to the grid. Each item gets a new ID.
---@return ac.HashSpaceItem
function _ac_HashSpace:add() end

---Adds a fixed item to the grid, with predetermined ID. Avoid mixing dynamic and fixed items in the same grid.
function _ac_HashSpace:addFixed(id, pos) end

--[[ common/ac_extras_numlut.lua ]]

---Meant to quickly interpolate between tables of values, some of them could be colors set in HSV. Example:
---```
---local lut = ac.Lut([[
--- -100 |  0.00,   350,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04
---  -90 |  1.00,    10,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04
---  -20 |  1.00,    10,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04
---]], { 2 })
---assert(lut:calculate(-95)[1] == 1)
---```
---@param data string @String with LUT data, in a format similar to AC LUT formats. Please note: rows must be ordered for efficient binary search.
---@param hsvColumns integer[] @1-based indices of columns storing HSV data. Such columns, of course, will be interpolated differently (for example, mixing hues 350 and 20 would produce 10).
---@return ac.Lut
function ac.Lut(data, hsvColumns) end

---Meant to quickly interpolate between tables of values, some of them could be colors set in HSV. Example:
---```
---local lut = ac.Lut([[
--- -100 |  0.00,   350,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04
---  -90 |  1.00,    10,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04
---  -20 |  1.00,    10,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04
---]], { 2 })
---assert(lut:calculate(-95)[1] == 1)
---```
---@class ac.Lut
---@explicit-contructor ac.Lut
local _ac_Lut = nil

---Interpolate for a given input, return a newly created table. Note: consider using `:calculateTo()` instead to avoid re-creating tables, it would work much more efficiently.
---@param input number
---@return number[]
function _ac_Lut:calculate(input) end

---Interpolate for a given input, write result to a given table.
---@param output number[]
---@param input number
---@return number[] @Same table as was provided in arguments.
function _ac_Lut:calculateTo(output, input) end

---@type ac.Lut
ac.LutCpp = ac.Lut

---Meant to quickly interpolate between tables of values, some of them could be colors set in HSV. Example:
---```
---local lutJit = ac.LutJit:new{ data = {
---  { input = -100, output = {  0.00,   350,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04 } },
---  { input =  -90, output = {  1.00,    10,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04 } },
---  { input =  -20, output = {  1.00,    10,  0.37,  1.00,  3.00,  1.00,  1.00,  3.60,500.00,  0.04 } },
---  }, hsvRows = { 2 }}
---assert(lutJit:calculate(-95)[1] == 1)
---```
---Obsolete. Use `ac.Lut` instead, with faster C++ implementation.
---@class ac.LutJit
---@deprecated
ac.LutJit = {}

---Creates new ac.LuaJit instance. Deprecated, use `ac.Lut` instead.
---@deprecated
---@param data any
---@param hsvRows integer[] @ 1-based indices of columns (not rows) storing HSV values in them.
---@return table
function ac.LutJit:new(o, data, hsvRows) end

---Computes a new value. Deprecated, use `ac.Lut` instead.
---@deprecated
---@param input number
---@return number[]
function ac.LutJit:calculate(input) end

---Computes a new value to a preexisting HSV value. Deprecated, use `ac.Lut` instead.
---@deprecated
---@param output number[]
---@param input number
---@return number[] @Same table as was provided in arguments.
function ac.LutJit:calculateTo(output, input) end

--[[ common/ac_trackconfig.lua ]]

---@class ac.TrackConfigProvider
local _ac_TrackConfigProvider = {}

---@param section string
---@param key string
---@param def boolean|'true'|'false'
---@return boolean
function _ac_TrackConfigProvider.bool(section, key, def) end

---@param section string
---@param key string
---@param def number
---@return number
function _ac_TrackConfigProvider.number(section, key, def) end

---@param section string
---@param key string
---@param def string
---@return string
function _ac_TrackConfigProvider.string(section, key, def) end

---@param section string
---@param key string
---@param def rgb
---@return rgb
function _ac_TrackConfigProvider.rgb(section, key, def) end

---@param section string
---@param key string
---@param def rgbm
---@return rgbm
function _ac_TrackConfigProvider.rgbm(section, key, def) end

---@param section string
---@param key string
---@param def vec2
---@return vec2
function _ac_TrackConfigProvider.vec2(section, key, def) end
---@param section string
---@param key string
---@param def vec3
---@return vec3
function _ac_TrackConfigProvider.vec3(section, key, def) end

---@param section string
---@param key string
---@param def vec4
---@return vec4
function _ac_TrackConfigProvider.vec4(section, key, def) end

---@generic T
---@param section string
---@param key string
---@param def T
---@return T
---@overload fun(): ac.TrackConfigProvider
function ac.getTrackConfig(section, key, def) end

--[[ common/ac_reftypes.lua ]]

---Stores a boolean value and can be used as a reference to it.
---@param value boolean "Stored value."
---@return refbool
function refbool(value) end

---Stores a boolean value and can be used as a reference to it.
---@class refbool
---@field value boolean @Stored value.
local refbool = nil

---@return boolean
function refbool.isrefbool(x) end

---For easier use with UI controls.
---@param newValue boolean|'true'|'false'
---@return refbool
function refbool:set(newValue) end

---Stores a numerical value and can be used as a reference to it.
---@param value number "Stored value."
---@return refnumber
function refnumber(value) end

---Stores a numerical value and can be used as a reference to it.
---@class refnumber
---@field value number @Stored value.
local refnumber = nil

---@return boolean
function refnumber.isrefnumber(x) end

---For easier use with UI controls.
---@param newValue number
---@return refnumber
function refnumber:set(newValue) end

--[[ common/ac_general_utils.lua ]]

---Estimates lap time and sector times for main car using AC function originally used by Time Attack mode. Could be
---helpful in creating custom time attack modes. Uses “ideal_line.ai” from “track folder/data”, so might not work
---well with mods. If that file is missing, returns nil.
---@return {lapTimeMs: integer, sectorTimesMs: integer[]}|nil @Returns table with times in milliseconds, or `nil` if  “ideal_lane.ai” is missing.
function ac.evaluateLapTime() end

--[[ common/stringify.lua ]]

---Serialize Lua value (table, number, string, etc.) in a Lua format (similar to how `JSON.stringify` in JavaScript
---generates a thing with JavaScript syntax). Most of Lua entities are supported, including array-like tables, table
---tables and mixed ones. CSP API things, such as vectors or colors, are also supported. For things like threads,
---functions or unknown cdata types instead a placeholder object will be created.
---
---Circular references also result in creating similar objects, for example: `t = {1, 2, 3, t}` would result in
---`{ 1, 2, 3, { type = "circular reference" } }`.
---
---If any table in given data would have a `__stringify()` function, it would be called as a method (so first argument
---would be the table with `__stringify` itself). If that function would return a string, that string will be used
---instead of regular table serialization. The idea is for classes to define a method like this and output a line of code
---which could be used to create a new instance like this on deserialization. Note: for such like to use a custom function
---like a class constructor, you would either need to register that function with a certain name or provide a table referring
---to it on deserialization. That’s because although deserialization uses `load()` function to parse and run data as Lua code,
---it wouldn’t allow code to access existing functions by default.
---@param obj table|number|string|boolean|nil @Object o serialize.
---@param compact boolean|'true'|'false' @If true, resulting string would not have spaces and line breaks, slightly faster and a lot more compact.
---@param depthLimit integer @Limits how deep serialization would go. Default value: 20.
---@return string @String with input data presented in Lua syntax.
function stringify(obj, compact, depthLimit) end

---Parse a string with Lua syntax into a Lua object (table, number, string, vector, etc.), can support custom objects as well.
---Only functions from `namespace` can be used (as well as vectors and functions registered earlier with `stringify.register()`),
---so if you’re using custom classes, make sure to either register them earlier or pass them in `namespace` table. Alternatively,
---you can just pass `_G` as `namespace`, but it might be pretty unsecure, so maybe don’t do it.
---
---Would raise an error if failed to parse or if any of initializers would raise an error.
---@param serialized string @Serialized data.
---@param namespace table<string, function>|nil @Namespace table. Serialized data would be evaluated as Lua code and would have access to it.
---@return table|number|string|boolean|nil
function stringify.parse(serialized, namespace) end

---Parse a string with Lua syntax into a Lua object (table, number, string, vector, etc.), can support custom objects as well.
---Only functions from `namespace` can be used (as well as vectors and functions registered earlier with `stringify.register()`),
---so if you’re using custom classes, make sure to either register them earlier or pass them in `namespace` table. Alternatively,
---you can just pass `_G` as `namespace`, but it might be pretty unsecure, so maybe don’t do it.
---
---Returns fallback value if failed to parse, or if `serialized` is empty or not set, or if any of initializers would raise an error.
---@generic T
---@param serialized string @Serialized data.
---@param namespace table<string, function>|nil @Namespace table. Serialized data would be evaluated as Lua code and would have access to it.
---@param fallback T|nil @Value to return if parsing failed.
---@return T
function stringify.tryParse(serialized, namespace, fallback) end

---Registers a new initializer function with a given name.
---@param name string @Name of an initializer (how serialized data would refer to it).
---@param fn function @Initializer function (returning value for serialized data to use).
---@overload fun(class: ClassDefinition)
function stringify.register(name, fn) end

---Serialization substep. Works similar to `stringify()` itself, but instead of returning string simply adds new terms to
---`out` table. Use it in custom `__stringify` methods for serializing child items if you need the best performance.
---@param out string[] @Output table with words to concatenate later (without any joining string).
---@param ptr integer @Position within `out` table to write next word into. At the very start, when table is empty, it would be 1.
---@param obj any @Item to serialize.
---@param lineBreak string|nil @Line break with some spaces for aligning child items, or `nil` if compact stringify mode is used. One tab is two spaces.
---@param depthLimit integer @Limits how many steps down serialization can go. If 0 or below, no tables would be serialized.
---@return integer @Updated `ptr` value (if one item was added to `out`, should increase by 1).
function stringify.substep(out, ptr, obj, lineBreak, depthLimit) end

---A small helper to add as a parent class for EmmyLua to work better.
---@class ClassStringifiable : ClassBase
local _classStringifiable = {}

---Serialize instance of class. Can either return a `string`, or construct it into `out` table and return a new position in it. String itself should be a like of
---Lua code which would reconstruct the object on deserialization. Don’t forget to either register referred function with `stringify.register()` or provide
---a reference to it in `namespace` table with `stringify.parse()`.
---
---Note: to serialize sub-objects, such as constructor arguments, you can use `stringify()` or `stringify.substep()` if you’re using an approach with
---manually constructing `out` table. Alternatively for basic types you can use `string.format()`: “%q” would give you a string in Lua format, so you can use it
---like so:
---```
---function MyClass:__serialize()
---  return string.format('MyClass(%q, %s)', self.stringName, self.numericalCounter)
---end
---```
---@param out string[] @Output table with words to concatenate later (without any joining string).
---@param ptr integer @Position within `out` table to write next word into. At the very start, when table is empty, it would be 1.
---@param obj any @Item to serialize.
---@param lineBreak string|nil @Line break with some spaces for aligning child items, or `nil` if compact stringify mode is used. One tab is two spaces.
---@param depthLimit integer @Limits how many steps down serialization can go. If 0 or below, no tables would be serialized.
---@return integer @Updated `ptr` value (if one item was added to `out`, should increase by 1).
---@overload fun(): string @Simpler version which should work well in 98% of times. Use a more detailed one only if you have a ton of objects and need to improve performance.
function _classStringifiable:__stringify(out, ptr, obj, lineBreak, depthLimit) end

--[[ enums.lua ]]

---@alias render.BlendMode
---| 'render.BlendMode.Opaque' @Value: 0.
---| 'render.BlendMode.AlphaBlend' @Value: 1.
---| 'render.BlendMode.AlphaTest' @Value: 2.
---| 'render.BlendMode.BlendAdd' @Value: 4.
---| 'render.BlendMode.BlendMultiply' @Value: 5.
render.BlendMode = {
  Opaque = 0, ---Value: 0.
  AlphaBlend = 1, ---Value: 1.
  AlphaTest = 2, ---Value: 2.
  BlendAdd = 4, ---Value: 4.
  BlendMultiply = 5, ---Value: 5.
}

---@alias render.CullMode
---| 'render.CullMode.Front' @Value: 0.
---| 'render.CullMode.Back' @Value: 1.
---| 'render.CullMode.None' @Value: 2.
---| 'render.CullMode.Wireframe' @Value: 4.
---| 'render.CullMode.WireframeAntialised' @Value: 7.
---| 'render.CullMode.ShadowsDouble' @Value: 9.
---| 'render.CullMode.ShadowsSingle' @Value: 10.
render.CullMode = {
  Front = 0, ---Value: 0.
  Back = 1, ---Value: 1.
  None = 2, ---Value: 2.
  Wireframe = 4, ---Value: 4.
  WireframeAntialised = 7, ---Value: 7.
  ShadowsDouble = 9, ---Value: 9.
  ShadowsSingle = 10, ---Value: 10.
}

---@alias render.DepthMode
---| 'render.DepthMode.Normal' @Value: 0.
---| 'render.DepthMode.ReadOnly' @Value: 1.
---| 'render.DepthMode.Off' @Value: 2.
---| 'render.DepthMode.LessEqual' @Value: 3.
---| 'render.DepthMode.ReadOnlyLessEqual' @Value: 4.
render.DepthMode = {
  Normal = 0, ---Value: 0.
  ReadOnly = 1, ---Value: 1.
  Off = 2, ---Value: 2.
  LessEqual = 3, ---Value: 3.
  ReadOnlyLessEqual = 4, ---Value: 4.
}

---@alias render.GLPrimitiveType
---| 'render.GLPrimitiveType.Lines' @Value: 0.
---| 'render.GLPrimitiveType.LinesStrip' @Value: 1.
---| 'render.GLPrimitiveType.Triangles' @Value: 2.
---| 'render.GLPrimitiveType.Quads' @Value: 3.
render.GLPrimitiveType = {
  Lines = 0, ---Value: 0.
  LinesStrip = 1, ---Value: 1.
  Triangles = 2, ---Value: 2.
  Quads = 3, ---Value: 3.
}

---@alias render.FontAlign
---| 'render.FontAlign.Left' @Value: 0.
---| 'render.FontAlign.Right' @Value: 1.
---| 'render.FontAlign.Center' @Value: 2.
render.FontAlign = {
  Left = 0, ---Value: 0.
  Right = 1, ---Value: 1.
  Center = 2, ---Value: 2.
}

---@alias ac.LightType
---| 'ac.LightType.Regular' @Value: 1.
---| 'ac.LightType.Line' @Value: 2.
ac.LightType = {
  Regular = 1, ---Value: 1.
  Line = 2, ---Value: 2.
}

---@alias ui.CornerFlags
---| 'ui.CornerFlags.None' @Value: 0.
---| 'ui.CornerFlags.TopLeft' @Value: 1.
---| 'ui.CornerFlags.TopRight' @Value: 2.
---| 'ui.CornerFlags.BottomLeft' @Value: 4.
---| 'ui.CornerFlags.BottomRight' @Value: 8.
---| 'ui.CornerFlags.Top' @Value: 3.
---| 'ui.CornerFlags.Bottom' @Value: 12.
---| 'ui.CornerFlags.Left' @Value: 5.
---| 'ui.CornerFlags.Right' @Value: 10.
---| 'ui.CornerFlags.All' @Value: 15.
ui.CornerFlags = {
  None = 0, ---Value: 0.
  TopLeft = 1, ---Value: 1.
  TopRight = 2, ---Value: 2.
  BottomLeft = 4, ---Value: 4.
  BottomRight = 8, ---Value: 8.
  Top = 3, ---Value: 3.
  Bottom = 12, ---Value: 12.
  Left = 5, ---Value: 5.
  Right = 10, ---Value: 10.
  All = 15, ---Value: 15.
}

---@alias ui.Direction
---| 'ui.Direction.None' @Value: 1.
---| 'ui.Direction.Left' @Value: 0.
---| 'ui.Direction.Right' @Value: 1.
---| 'ui.Direction.Up' @Value: 2.
---| 'ui.Direction.Down' @Value: 3.
ui.Direction = {
  None = 1, ---Value: 1.
  Left = 0, ---Value: 0.
  Right = 1, ---Value: 1.
  Up = 2, ---Value: 2.
  Down = 3, ---Value: 3.
}

---@alias ui.HoveredFlags
---| 'ui.HoveredFlags.None' @Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
---| 'ui.HoveredFlags.ChildWindows' @`ac.windowHovered()` only: Return true if any children of the window is hovered.
---| 'ui.HoveredFlags.RootWindow' @`ac.windowHovered()` only: Test from root window (top most parent of the current hierarchy).
---| 'ui.HoveredFlags.AnyWindow' @`ac.windowHovered()` only: Return true if any window is hovered.
---| 'ui.HoveredFlags.AllowWhenBlockedByPopup' @Return true even if a popup window is normally blocking access to this item/window.
---| 'ui.HoveredFlags.AllowWhenBlockedByActiveItem' @Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
---| 'ui.HoveredFlags.AllowWhenOverlapped' @Return true even if the position is obstructed or overlapped by another window.
---| 'ui.HoveredFlags.AllowWhenDisabled' @Return true even if the item is disabled.
---| 'ui.HoveredFlags.RectOnly' @Combination of flags: AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped (use `bit.bor(ui.HoveredFlags.RectOnly, …)` to combine it with other flags safely).
---| 'ui.HoveredFlags.RootAndChildWindows' @Combination of flags: RootWindow | ChildWindows (use `bit.bor(ui.HoveredFlags.RootAndChildWindows, …)` to combine it with other flags safely).
ui.HoveredFlags = {
  None = 0, ---Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
  ChildWindows = 1, ---`ac.windowHovered()` only: Return true if any children of the window is hovered.
  RootWindow = 2, ---`ac.windowHovered()` only: Test from root window (top most parent of the current hierarchy).
  AnyWindow = 4, ---`ac.windowHovered()` only: Return true if any window is hovered.
  AllowWhenBlockedByPopup = 8, ---Return true even if a popup window is normally blocking access to this item/window.
  AllowWhenBlockedByActiveItem = 32, ---Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
  AllowWhenOverlapped = 64, ---Return true even if the position is obstructed or overlapped by another window.
  AllowWhenDisabled = 128, ---Return true even if the item is disabled.
  RectOnly = 104, ---Combination of flags: AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped (use `bit.bor(ui.HoveredFlags.RectOnly, …)` to combine it with other flags safely).
  RootAndChildWindows = 3, ---Combination of flags: RootWindow | ChildWindows (use `bit.bor(ui.HoveredFlags.RootAndChildWindows, …)` to combine it with other flags safely).
}

---@alias ui.MouseButton
---| 'ui.MouseButton.Left' @Value: 0.
---| 'ui.MouseButton.Right' @Value: 1.
---| 'ui.MouseButton.Middle' @Value: 2.
---| 'ui.MouseButton.Extra1' @Value: 3.
---| 'ui.MouseButton.Extra2' @Value: 4.
ui.MouseButton = {
  Left = 0, ---Value: 0.
  Right = 1, ---Value: 1.
  Middle = 2, ---Value: 2.
  Extra1 = 3, ---Value: 3.
  Extra2 = 4, ---Value: 4.
}

---@alias ui.Font
---| 'ui.Font.Small' @Value: 1.
---| 'ui.Font.Tiny' @Value: 2.
---| 'ui.Font.Monospace' @Value: 3.
---| 'ui.Font.Main' @Value: 4.
---| 'ui.Font.Italic' @Value: 5.
---| 'ui.Font.Title' @Value: 6.
---| 'ui.Font.Huge' @Value: 7.
ui.Font = {
  Small = 1, ---Value: 1.
  Tiny = 2, ---Value: 2.
  Monospace = 3, ---Value: 3.
  Main = 4, ---Value: 4.
  Italic = 5, ---Value: 5.
  Title = 6, ---Value: 6.
  Huge = 7, ---Value: 7.
}

---@alias ui.Alignment
---| 'ui.Alignment.Start' @Value: 1.
---| 'ui.Alignment.Center' @Value: 0.
---| 'ui.Alignment.End' @Value: 1.
ui.Alignment = {
  Start = 1, ---Value: 1.
  Center = 0, ---Value: 0.
  End = 1, ---Value: 1.
}

---Special codes for keys with certain UI roles.
---@alias ui.Key
---| 'ui.Key.Tab' @Value: 0.
---| 'ui.Key.Left' @Value: 1.
---| 'ui.Key.Right' @Value: 2.
---| 'ui.Key.Up' @Value: 3.
---| 'ui.Key.Down' @Value: 4.
---| 'ui.Key.PageUp' @Value: 5.
---| 'ui.Key.PageDown' @Value: 6.
---| 'ui.Key.Home' @Value: 7.
---| 'ui.Key.End' @Value: 8.
---| 'ui.Key.Insert' @Value: 9.
---| 'ui.Key.Delete' @Value: 10.
---| 'ui.Key.Backspace' @Value: 11.
---| 'ui.Key.Space' @Value: 12.
---| 'ui.Key.Enter' @Value: 13.
---| 'ui.Key.Escape' @Value: 14.
---| 'ui.Key.KeyPadEnter' @Value: 15.
---| 'ui.Key.A' @Value: 16.
---| 'ui.Key.C' @Value: 17.
---| 'ui.Key.D' @Value: 18.
---| 'ui.Key.S' @Value: 19.
---| 'ui.Key.V' @Value: 20.
---| 'ui.Key.W' @Value: 21.
---| 'ui.Key.X' @Value: 22.
---| 'ui.Key.Y' @Value: 23.
---| 'ui.Key.Z' @Value: 24.
ui.Key = {
  Tab = 0, ---Value: 0.
  Left = 1, ---Value: 1.
  Right = 2, ---Value: 2.
  Up = 3, ---Value: 3.
  Down = 4, ---Value: 4.
  PageUp = 5, ---Value: 5.
  PageDown = 6, ---Value: 6.
  Home = 7, ---Value: 7.
  End = 8, ---Value: 8.
  Insert = 9, ---Value: 9.
  Delete = 10, ---Value: 10.
  Backspace = 11, ---Value: 11.
  Space = 12, ---Value: 12.
  Enter = 13, ---Value: 13.
  Escape = 14, ---Value: 14.
  KeyPadEnter = 15, ---Value: 15.
  A = 16, ---Value: 16.
  C = 17, ---Value: 17.
  D = 18, ---Value: 18.
  S = 19, ---Value: 19.
  V = 20, ---Value: 20.
  W = 21, ---Value: 21.
  X = 22, ---Value: 22.
  Y = 23, ---Value: 23.
  Z = 24, ---Value: 24.
}

---Key indices, pretty much mirrors all those “VK_…” key tables.
---@alias ui.KeyIndex
---| 'ui.KeyIndex.LeftButton' @Value: 1.
---| 'ui.KeyIndex.RightButton' @Value: 2.
---| 'ui.KeyIndex.MiddleButton' @Not contiguous with LeftButton and RightButton.
---| 'ui.KeyIndex.XButton1' @Not contiguous with LeftButton and RightButton.
---| 'ui.KeyIndex.XButton2' @Not contiguous with LeftButton and RightButton.
---| 'ui.KeyIndex.Tab' @Value: 9.
---| 'ui.KeyIndex.Return' @Value: 13.
---| 'ui.KeyIndex.Shift' @Value: 16.
---| 'ui.KeyIndex.Control' @Value: 17.
---| 'ui.KeyIndex.Menu' @Aka Alt button.
---| 'ui.KeyIndex.Escape' @Value: 27.
---| 'ui.KeyIndex.Accept' @Value: 30.
---| 'ui.KeyIndex.Space' @Value: 32.
---| 'ui.KeyIndex.End' @Value: 35.
---| 'ui.KeyIndex.Home' @Value: 36.
---| 'ui.KeyIndex.Left' @Arrow ←.
---| 'ui.KeyIndex.Up' @Arrow ↑.
---| 'ui.KeyIndex.Right' @Arrow →.
---| 'ui.KeyIndex.Down' @Arrow ↓.
---| 'ui.KeyIndex.Insert' @Value: 45.
---| 'ui.KeyIndex.Delete' @Value: 46.
---| 'ui.KeyIndex.LeftWin' @Value: 91.
---| 'ui.KeyIndex.RightWin' @Value: 92.
---| 'ui.KeyIndex.NumPad0' @Value: 96.
---| 'ui.KeyIndex.NumPad1' @Value: 97.
---| 'ui.KeyIndex.NumPad2' @Value: 98.
---| 'ui.KeyIndex.NumPad3' @Value: 99.
---| 'ui.KeyIndex.NumPad4' @Value: 100.
---| 'ui.KeyIndex.NumPad5' @Value: 101.
---| 'ui.KeyIndex.NumPad6' @Value: 102.
---| 'ui.KeyIndex.NumPad7' @Value: 103.
---| 'ui.KeyIndex.NumPad8' @Value: 104.
---| 'ui.KeyIndex.NumPad9' @Value: 105.
---| 'ui.KeyIndex.Multiply' @Value: 106.
---| 'ui.KeyIndex.Add' @Value: 107.
---| 'ui.KeyIndex.Separator' @Value: 108.
---| 'ui.KeyIndex.Subtract' @Value: 109.
---| 'ui.KeyIndex.Decimal' @Value: 110.
---| 'ui.KeyIndex.Divide' @Value: 111.
---| 'ui.KeyIndex.F1' @Value: 112.
---| 'ui.KeyIndex.F2' @Value: 113.
---| 'ui.KeyIndex.F3' @Value: 114.
---| 'ui.KeyIndex.F4' @Value: 115.
---| 'ui.KeyIndex.F5' @Value: 116.
---| 'ui.KeyIndex.F6' @Value: 117.
---| 'ui.KeyIndex.F7' @Value: 118.
---| 'ui.KeyIndex.F8' @Value: 119.
---| 'ui.KeyIndex.F9' @Value: 120.
---| 'ui.KeyIndex.F10' @Value: 121.
---| 'ui.KeyIndex.F11' @Value: 122.
---| 'ui.KeyIndex.F12' @Value: 123.
---| 'ui.KeyIndex.NumLock' @Value: 144.
---| 'ui.KeyIndex.Scroll' @Value: 145.
---| 'ui.KeyIndex.OemNecEqual' @“.
---| 'ui.KeyIndex.LeftShift' @Value: 160.
---| 'ui.KeyIndex.RightShift' @Value: 161.
---| 'ui.KeyIndex.LeftControl' @Value: 162.
---| 'ui.KeyIndex.RightControl' @Value: 163.
---| 'ui.KeyIndex.LeftMenu' @Aka left Alt button.
---| 'ui.KeyIndex.RightMenu' @Aka right Alt button.
---| 'ui.KeyIndex.Oem1' @“;:” for US.
---| 'ui.KeyIndex.D0' @Digit 0.
---| 'ui.KeyIndex.D1' @Digit 1.
---| 'ui.KeyIndex.D2' @Digit 2.
---| 'ui.KeyIndex.D3' @Digit 3.
---| 'ui.KeyIndex.D4' @Digit 4.
---| 'ui.KeyIndex.D5' @Digit 5.
---| 'ui.KeyIndex.D6' @Digit 6.
---| 'ui.KeyIndex.D7' @Digit 7.
---| 'ui.KeyIndex.D8' @Digit 8.
---| 'ui.KeyIndex.D9' @Digit 9.
---| 'ui.KeyIndex.A' @Letter A.
---| 'ui.KeyIndex.B' @Letter B.
---| 'ui.KeyIndex.C' @Letter C.
---| 'ui.KeyIndex.D' @Letter D.
---| 'ui.KeyIndex.E' @Letter E.
---| 'ui.KeyIndex.F' @Letter F.
---| 'ui.KeyIndex.G' @Letter G.
---| 'ui.KeyIndex.H' @Letter H.
---| 'ui.KeyIndex.I' @Letter I.
---| 'ui.KeyIndex.J' @Letter J.
---| 'ui.KeyIndex.K' @Letter K.
---| 'ui.KeyIndex.L' @Letter L.
---| 'ui.KeyIndex.M' @Letter M.
---| 'ui.KeyIndex.N' @Letter N.
---| 'ui.KeyIndex.O' @Letter O.
---| 'ui.KeyIndex.P' @Letter P.
---| 'ui.KeyIndex.Q' @Letter Q.
---| 'ui.KeyIndex.R' @Letter R.
---| 'ui.KeyIndex.S' @Letter S.
---| 'ui.KeyIndex.T' @Letter T.
---| 'ui.KeyIndex.U' @Letter U.
---| 'ui.KeyIndex.V' @Letter V.
---| 'ui.KeyIndex.W' @Letter W.
---| 'ui.KeyIndex.X' @Letter X.
---| 'ui.KeyIndex.Y' @Letter Y.
---| 'ui.KeyIndex.Z' @Letter Z.
ui.KeyIndex = {
  LeftButton = 1, ---Value: 1.
  RightButton = 2, ---Value: 2.
  Cancel = 3, ---Value: 3.
  MiddleButton = 4, ---Not contiguous with LeftButton and RightButton.
  XButton1 = 5, ---Not contiguous with LeftButton and RightButton.
  XButton2 = 6, ---Not contiguous with LeftButton and RightButton.
  Back = 8, ---Value: 8.
  Tab = 9, ---Value: 9.
  Clear = 12, ---Value: 12.
  Return = 13, ---Value: 13.
  Shift = 16, ---Value: 16.
  Control = 17, ---Value: 17.
  Menu = 18, ---Aka Alt button.
  Pause = 19, ---Value: 19.
  Capital = 20, ---Value: 20.
  Kana = 21, ---Value: 21.
  Hangeul = 21, ---Old name - should be here for compatibility.
  Hangul = 21, ---Value: 21.
  Junja = 23, ---Value: 23.
  Final = 24, ---Value: 24.
  Hanja = 25, ---Value: 25.
  Kanji = 25, ---Value: 25.
  Escape = 27, ---Value: 27.
  Convert = 28, ---Value: 28.
  NonConvert = 29, ---Value: 29.
  Accept = 30, ---Value: 30.
  ModeChange = 31, ---Value: 31.
  Space = 32, ---Value: 32.
  Prior = 33, ---Value: 33.
  Next = 34, ---Value: 34.
  End = 35, ---Value: 35.
  Home = 36, ---Value: 36.
  Left = 37, ---Arrow ←.
  Up = 38, ---Arrow ↑.
  Right = 39, ---Arrow →.
  Down = 40, ---Arrow ↓.
  Select = 41, ---Value: 41.
  Print = 42, ---Value: 42.
  Execute = 43, ---Value: 43.
  Snapshot = 44, ---Value: 44.
  Insert = 45, ---Value: 45.
  Delete = 46, ---Value: 46.
  Help = 47, ---Value: 47.
  LeftWin = 91, ---Value: 91.
  RightWin = 92, ---Value: 92.
  Apps = 93, ---Value: 93.
  Sleep = 95, ---Value: 95.
  NumPad0 = 96, ---Value: 96.
  NumPad1 = 97, ---Value: 97.
  NumPad2 = 98, ---Value: 98.
  NumPad3 = 99, ---Value: 99.
  NumPad4 = 100, ---Value: 100.
  NumPad5 = 101, ---Value: 101.
  NumPad6 = 102, ---Value: 102.
  NumPad7 = 103, ---Value: 103.
  NumPad8 = 104, ---Value: 104.
  NumPad9 = 105, ---Value: 105.
  Multiply = 106, ---Value: 106.
  Add = 107, ---Value: 107.
  Separator = 108, ---Value: 108.
  Subtract = 109, ---Value: 109.
  Decimal = 110, ---Value: 110.
  Divide = 111, ---Value: 111.
  F1 = 112, ---Value: 112.
  F2 = 113, ---Value: 113.
  F3 = 114, ---Value: 114.
  F4 = 115, ---Value: 115.
  F5 = 116, ---Value: 116.
  F6 = 117, ---Value: 117.
  F7 = 118, ---Value: 118.
  F8 = 119, ---Value: 119.
  F9 = 120, ---Value: 120.
  F10 = 121, ---Value: 121.
  F11 = 122, ---Value: 122.
  F12 = 123, ---Value: 123.
  F13 = 124, ---Value: 124.
  F14 = 125, ---Value: 125.
  F15 = 126, ---Value: 126.
  F16 = 127, ---Value: 127.
  F17 = 128, ---Value: 128.
  F18 = 129, ---Value: 129.
  F19 = 130, ---Value: 130.
  F20 = 131, ---Value: 131.
  F21 = 132, ---Value: 132.
  F22 = 133, ---Value: 133.
  F23 = 134, ---Value: 134.
  F24 = 135, ---Value: 135.
  NavigationView = 136, ---Reserved.
  NavigationMenu = 137, ---Reserved.
  NavigationUp = 138, ---Reserved.
  NavigationDown = 139, ---Reserved.
  NavigationLeft = 140, ---Reserved.
  NavigationRight = 141, ---Reserved.
  NavigationAccept = 142, ---Reserved.
  NavigationCancel = 143, ---Reserved.
  NumLock = 144, ---Value: 144.
  Scroll = 145, ---Value: 145.
  OemNecEqual = 146, ---“.
  OemFjJisho = 146, ---“Dictionary” key.
  OemFjMasshou = 147, ---“Unregister word” key.
  OemFjTouroku = 148, ---“Register word” key.
  OemFjLoya = 149, ---“Left OYAYUBI” key.
  OemFjRoya = 150, ---“Right OYAYUBI” key.
  LeftShift = 160, ---Value: 160.
  RightShift = 161, ---Value: 161.
  LeftControl = 162, ---Value: 162.
  RightControl = 163, ---Value: 163.
  LeftMenu = 164, ---Aka left Alt button.
  RightMenu = 165, ---Aka right Alt button.
  BrowserBack = 166, ---Value: 166.
  BrowserForward = 167, ---Value: 167.
  BrowserRefresh = 168, ---Value: 168.
  BrowserStop = 169, ---Value: 169.
  BrowserSearch = 170, ---Value: 170.
  BrowserFavorites = 171, ---Value: 171.
  BrowserHome = 172, ---Value: 172.
  VolumeMute = 173, ---Value: 173.
  VolumeDown = 174, ---Value: 174.
  VolumeUp = 175, ---Value: 175.
  MediaNextTrack = 176, ---Value: 176.
  MediaPrevTrack = 177, ---Value: 177.
  MediaStop = 178, ---Value: 178.
  MediaPlayPause = 179, ---Value: 179.
  LaunchMail = 180, ---Value: 180.
  LaunchMediaSelect = 181, ---Value: 181.
  LaunchApp1 = 182, ---Value: 182.
  LaunchApp2 = 183, ---Value: 183.
  Oem1 = 186, ---“;:” for US.
  OemPlus = 187, ---“+” any country.
  OemComma = 188, ---“,” any country.
  OemMinus = 189, ---“-” any country.
  OemPeriod = 190, ---“.” any country.
  Oem2 = 191, ---“/?” for US.
  Oem3 = 192, ---“`~” for US.
  GamepadA = 195, ---Reserved.
  GamepadB = 196, ---Reserved.
  GamepadX = 197, ---Reserved.
  GamepadY = 198, ---Reserved.
  GamepadRightShoulder = 199, ---Reserved.
  GamepadLeftShoulder = 200, ---Reserved.
  GamepadLeftTrigger = 201, ---Reserved.
  GamepadRightTrigger = 202, ---Reserved.
  GamepadDpadUp = 203, ---Reserved.
  GamepadDpadDown = 204, ---Reserved.
  GamepadDpadLeft = 205, ---Reserved.
  GamepadDpadRight = 206, ---Reserved.
  GamepadMenu = 207, ---Reserved.
  GamepadView = 208, ---Reserved.
  GamepadLeftThumbstickButton = 209, ---Reserved.
  GamepadRightThumbstickButton = 210, ---Reserved.
  GamepadLeftThumbstickUp = 211, ---Reserved.
  GamepadLeftThumbstickDown = 212, ---Reserved.
  GamepadLeftThumbstickRight = 213, ---Reserved.
  GamepadLeftThumbstickLeft = 214, ---Reserved.
  GamepadRightThumbstickUp = 215, ---Reserved.
  GamepadRightThumbstickDown = 216, ---Reserved.
  GamepadRightThumbstickRight = 217, ---Reserved.
  GamepadRightThumbstickLeft = 218, ---Reserved.
  D0 = 48, ---Digit 0.
  D1 = 49, ---Digit 1.
  D2 = 50, ---Digit 2.
  D3 = 51, ---Digit 3.
  D4 = 52, ---Digit 4.
  D5 = 53, ---Digit 5.
  D6 = 54, ---Digit 6.
  D7 = 55, ---Digit 7.
  D8 = 56, ---Digit 8.
  D9 = 57, ---Digit 9.
  A = 65, ---Letter A.
  B = 66, ---Letter B.
  C = 67, ---Letter C.
  D = 68, ---Letter D.
  E = 69, ---Letter E.
  F = 70, ---Letter F.
  G = 71, ---Letter G.
  H = 72, ---Letter H.
  I = 73, ---Letter I.
  J = 74, ---Letter J.
  K = 75, ---Letter K.
  L = 76, ---Letter L.
  M = 77, ---Letter M.
  N = 78, ---Letter N.
  O = 79, ---Letter O.
  P = 80, ---Letter P.
  Q = 81, ---Letter Q.
  R = 82, ---Letter R.
  S = 83, ---Letter S.
  T = 84, ---Letter T.
  U = 85, ---Letter U.
  V = 86, ---Letter V.
  W = 87, ---Letter W.
  X = 88, ---Letter X.
  Y = 89, ---Letter Y.
  Z = 90, ---Letter Z.
}

---@alias ui.StyleVar
---| 'ui.StyleVar.Alpha' @Value: 0.
---| 'ui.StyleVar.WindowPadding' @Value: 1.
---| 'ui.StyleVar.WindowRounding' @Value: 2.
---| 'ui.StyleVar.WindowBorderSize' @Value: 3.
---| 'ui.StyleVar.WindowMinSize' @Value: 4.
---| 'ui.StyleVar.WindowTitleAlign' @Value: 5.
---| 'ui.StyleVar.ChildRounding' @Value: 6.
---| 'ui.StyleVar.ChildBorderSize' @Value: 7.
---| 'ui.StyleVar.PopupRounding' @Value: 8.
---| 'ui.StyleVar.PopupBorderSize' @Value: 9.
---| 'ui.StyleVar.FramePadding' @Value: 10.
---| 'ui.StyleVar.FrameRounding' @Value: 11.
---| 'ui.StyleVar.FrameBorderSize' @Value: 12.
---| 'ui.StyleVar.ItemSpacing' @Value: 13.
---| 'ui.StyleVar.ItemInnerSpacing' @Value: 14.
---| 'ui.StyleVar.IndentSpacing' @Value: 15.
---| 'ui.StyleVar.ScrollbarSize' @Value: 16.
---| 'ui.StyleVar.ScrollbarRounding' @Value: 17.
---| 'ui.StyleVar.GrabMinSize' @Value: 18.
---| 'ui.StyleVar.GrabRounding' @Value: 19.
---| 'ui.StyleVar.TabRounding' @Value: 20.
---| 'ui.StyleVar.ButtonTextAlign' @Value: 21.
---| 'ui.StyleVar.SelectableTextAlign' @Value: 22.
---| 'ui.StyleVar.SelectablePadding' @Value: 23.
ui.StyleVar = {
  Alpha = 0, ---Value: 0.
  WindowPadding = 1, ---Value: 1.
  WindowRounding = 2, ---Value: 2.
  WindowBorderSize = 3, ---Value: 3.
  WindowMinSize = 4, ---Value: 4.
  WindowTitleAlign = 5, ---Value: 5.
  ChildRounding = 6, ---Value: 6.
  ChildBorderSize = 7, ---Value: 7.
  PopupRounding = 8, ---Value: 8.
  PopupBorderSize = 9, ---Value: 9.
  FramePadding = 10, ---Value: 10.
  FrameRounding = 11, ---Value: 11.
  FrameBorderSize = 12, ---Value: 12.
  ItemSpacing = 13, ---Value: 13.
  ItemInnerSpacing = 14, ---Value: 14.
  IndentSpacing = 15, ---Value: 15.
  ScrollbarSize = 16, ---Value: 16.
  ScrollbarRounding = 17, ---Value: 17.
  GrabMinSize = 18, ---Value: 18.
  GrabRounding = 19, ---Value: 19.
  TabRounding = 20, ---Value: 20.
  ButtonTextAlign = 21, ---Value: 21.
  SelectableTextAlign = 22, ---Value: 22.
  SelectablePadding = 23, ---Value: 23.
}

---@alias ui.StyleColor
---| 'ui.StyleColor.Text' @Value: 0.
---| 'ui.StyleColor.TextDisabled' @Value: 1.
---| 'ui.StyleColor.WindowBg' @Value: 2.
---| 'ui.StyleColor.ChildBg' @Value: 3.
---| 'ui.StyleColor.PopupBg' @Value: 4.
---| 'ui.StyleColor.Border' @Value: 5.
---| 'ui.StyleColor.BorderShadow' @Value: 6.
---| 'ui.StyleColor.FrameBg' @Value: 7.
---| 'ui.StyleColor.FrameBgHovered' @Value: 8.
---| 'ui.StyleColor.FrameBgActive' @Value: 9.
---| 'ui.StyleColor.TitleBg' @Value: 10.
---| 'ui.StyleColor.TitleBgActive' @Value: 11.
---| 'ui.StyleColor.TitleBgCollapsed' @Value: 12.
---| 'ui.StyleColor.MenuBarBg' @Value: 13.
---| 'ui.StyleColor.ScrollbarBg' @Value: 14.
---| 'ui.StyleColor.ScrollbarGrab' @Value: 15.
---| 'ui.StyleColor.ScrollbarGrabHovered' @Value: 16.
---| 'ui.StyleColor.ScrollbarGrabActive' @Value: 17.
---| 'ui.StyleColor.CheckMark' @Value: 18.
---| 'ui.StyleColor.SliderGrab' @Value: 19.
---| 'ui.StyleColor.SliderGrabActive' @Value: 20.
---| 'ui.StyleColor.Button' @Value: 21.
---| 'ui.StyleColor.ButtonHovered' @Value: 22.
---| 'ui.StyleColor.ButtonActive' @Value: 23.
---| 'ui.StyleColor.Header' @Value: 24.
---| 'ui.StyleColor.HeaderHovered' @Value: 25.
---| 'ui.StyleColor.HeaderActive' @Value: 26.
---| 'ui.StyleColor.Separator' @Value: 27.
---| 'ui.StyleColor.SeparatorHovered' @Value: 28.
---| 'ui.StyleColor.SeparatorActive' @Value: 29.
---| 'ui.StyleColor.ResizeGrip' @Value: 30.
---| 'ui.StyleColor.ResizeGripHovered' @Value: 31.
---| 'ui.StyleColor.ResizeGripActive' @Value: 32.
---| 'ui.StyleColor.Tab' @Value: 33.
---| 'ui.StyleColor.TabHovered' @Value: 34.
---| 'ui.StyleColor.TabActive' @Value: 35.
---| 'ui.StyleColor.TabUnfocused' @Value: 36.
---| 'ui.StyleColor.TabUnfocusedActive' @Value: 37.
---| 'ui.StyleColor.PlotLines' @Value: 38.
---| 'ui.StyleColor.PlotLinesHovered' @Value: 39.
---| 'ui.StyleColor.PlotHistogram' @Value: 40.
---| 'ui.StyleColor.PlotHistogramHovered' @Value: 41.
---| 'ui.StyleColor.TextSelectedBg' @Value: 42.
---| 'ui.StyleColor.DragDropTarget' @Value: 43.
---| 'ui.StyleColor.NavHighlight' @Value: 44.
---| 'ui.StyleColor.NavWindowingHighlight' @Value: 45.
---| 'ui.StyleColor.NavWindowingDimBg' @Value: 46.
---| 'ui.StyleColor.ModalWindowDimBg' @Value: 47.
---| 'ui.StyleColor.TextHovered' @Value: 48.
---| 'ui.StyleColor.TextActive' @Value: 49.
ui.StyleColor = {
  Text = 0, ---Value: 0.
  TextDisabled = 1, ---Value: 1.
  WindowBg = 2, ---Value: 2.
  ChildBg = 3, ---Value: 3.
  PopupBg = 4, ---Value: 4.
  Border = 5, ---Value: 5.
  BorderShadow = 6, ---Value: 6.
  FrameBg = 7, ---Value: 7.
  FrameBgHovered = 8, ---Value: 8.
  FrameBgActive = 9, ---Value: 9.
  TitleBg = 10, ---Value: 10.
  TitleBgActive = 11, ---Value: 11.
  TitleBgCollapsed = 12, ---Value: 12.
  MenuBarBg = 13, ---Value: 13.
  ScrollbarBg = 14, ---Value: 14.
  ScrollbarGrab = 15, ---Value: 15.
  ScrollbarGrabHovered = 16, ---Value: 16.
  ScrollbarGrabActive = 17, ---Value: 17.
  CheckMark = 18, ---Value: 18.
  SliderGrab = 19, ---Value: 19.
  SliderGrabActive = 20, ---Value: 20.
  Button = 21, ---Value: 21.
  ButtonHovered = 22, ---Value: 22.
  ButtonActive = 23, ---Value: 23.
  Header = 24, ---Value: 24.
  HeaderHovered = 25, ---Value: 25.
  HeaderActive = 26, ---Value: 26.
  Separator = 27, ---Value: 27.
  SeparatorHovered = 28, ---Value: 28.
  SeparatorActive = 29, ---Value: 29.
  ResizeGrip = 30, ---Value: 30.
  ResizeGripHovered = 31, ---Value: 31.
  ResizeGripActive = 32, ---Value: 32.
  Tab = 33, ---Value: 33.
  TabHovered = 34, ---Value: 34.
  TabActive = 35, ---Value: 35.
  TabUnfocused = 36, ---Value: 36.
  TabUnfocusedActive = 37, ---Value: 37.
  PlotLines = 38, ---Value: 38.
  PlotLinesHovered = 39, ---Value: 39.
  PlotHistogram = 40, ---Value: 40.
  PlotHistogramHovered = 41, ---Value: 41.
  TextSelectedBg = 42, ---Value: 42.
  DragDropTarget = 43, ---Value: 43.
  NavHighlight = 44, ---Value: 44.
  NavWindowingHighlight = 45, ---Value: 45.
  NavWindowingDimBg = 46, ---Value: 46.
  ModalWindowDimBg = 47, ---Value: 47.
  TextHovered = 48, ---Value: 48.
  TextActive = 49, ---Value: 49.
}

---@alias ui.Icons
---| 'ui.Icons.Apps' @Value: 'APPS'.
---| 'ui.Icons.ArrowDown' @Value: 'ARROW_DOWN'.
---| 'ui.Icons.ArrowLeft' @Value: 'ARROW_LEFT'.
---| 'ui.Icons.ArrowRight' @Value: 'ARROW_RIGHT'.
---| 'ui.Icons.ArrowUp' @Value: 'ARROW_UP'.
---| 'ui.Icons.Ballast' @Value: 'BALLAST'.
---| 'ui.Icons.Ban' @Value: 'BAN'.
---| 'ui.Icons.Befriend' @Value: 'BEFRIEND'.
---| 'ui.Icons.Bell' @Value: 'BELL'.
---| 'ui.Icons.Bluetooth' @Value: 'BLUETOOTH'.
---| 'ui.Icons.Bug' @Value: 'BUG'.
---| 'ui.Icons.Bulb' @Value: 'BULB'.
---| 'ui.Icons.CallBluetooth' @Value: 'CALL_BLUETOOTH'.
---| 'ui.Icons.Call' @Value: 'CALL'.
---| 'ui.Icons.Camera' @Value: 'CAMERA'.
---| 'ui.Icons.Cancel' @Value: 'CANCEL'.
---| 'ui.Icons.CarFront' @Value: 'CAR_FRONT'.
---| 'ui.Icons.Clip' @Value: 'CLIP'.
---| 'ui.Icons.Clock' @Value: 'CLOCK'.
---| 'ui.Icons.Compass' @Value: 'COMPASS'.
---| 'ui.Icons.Confirm' @Value: 'CONFIRM'.
---| 'ui.Icons.Copy' @Value: 'COPY'.
---| 'ui.Icons.Crosshair' @Value: 'CROSSHAIR'.
---| 'ui.Icons.Delete' @Value: 'DELETE'.
---| 'ui.Icons.Down' @Value: 'DOWN'.
---| 'ui.Icons.Download' @Value: 'DOWNLOAD'.
---| 'ui.Icons.Earth' @Value: 'EARTH'.
---| 'ui.Icons.Edit' @Value: 'EDIT'.
---| 'ui.Icons.Eye' @Value: 'EYE'.
---| 'ui.Icons.File' @Value: 'FILE'.
---| 'ui.Icons.Finish' @Value: 'FINISH'.
---| 'ui.Icons.Fm' @Value: 'FM'.
---| 'ui.Icons.Folder' @Value: 'FOLDER'.
---| 'ui.Icons.Fuel' @Value: 'FUEL'.
---| 'ui.Icons.Global' @Value: 'GLOBAL'.
---| 'ui.Icons.GlowThick' @Value: 'GLOW_THICK'.
---| 'ui.Icons.Glow' @Value: 'GLOW'.
---| 'ui.Icons.Gps' @Value: 'GPS'.
---| 'ui.Icons.Group' @Value: 'GROUP'.
---| 'ui.Icons.Hammer' @Value: 'HAMMER'.
---| 'ui.Icons.Hide' @Value: 'HIDE'.
---| 'ui.Icons.Horizontal' @Value: 'HORIZONTAL'.
---| 'ui.Icons.Info' @Value: 'INFO'.
---| 'ui.Icons.Key' @Value: 'KEY'.
---| 'ui.Icons.Kick' @Value: 'KICK'.
---| 'ui.Icons.Leave' @Value: 'LEAVE'.
---| 'ui.Icons.Loading' @Value: 'LOADING'.
---| 'ui.Icons.Location' @Value: 'LOCATION'.
---| 'ui.Icons.Map' @Value: 'MAP'.
---| 'ui.Icons.Menu' @Value: 'MENU'.
---| 'ui.Icons.Minus' @Value: 'MINUS'.
---| 'ui.Icons.Monitor' @Value: 'MONITOR'.
---| 'ui.Icons.Music' @Value: 'MUSIC'.
---| 'ui.Icons.Navigation' @Value: 'NAVIGATION'.
---| 'ui.Icons.Palette' @Value: 'PALETTE'.
---| 'ui.Icons.Pin' @Value: 'PIN'.
---| 'ui.Icons.PitStop' @Value: 'PIT_STOP'.
---| 'ui.Icons.Plus' @Value: 'PLUS'.
---| 'ui.Icons.Preview' @Value: 'PREVIEW'.
---| 'ui.Icons.Python' @Value: 'PYTHON'.
---| 'ui.Icons.Referee' @Value: 'REFEREE'.
---| 'ui.Icons.Repair' @Value: 'REPAIR'.
---| 'ui.Icons.RestartWarning' @Value: 'RESTART_WARNING'.
---| 'ui.Icons.Restart' @Value: 'RESTART'.
---| 'ui.Icons.Restrictor' @Value: 'RESTRICTOR'.
---| 'ui.Icons.Road' @Value: 'ROAD'.
---| 'ui.Icons.Rubber' @Value: 'RUBBER'.
---| 'ui.Icons.SatelliteDishLow' @Value: 'SATELLITE_DISH_LOW'.
---| 'ui.Icons.SatelliteDishNone' @Value: 'SATELLITE_DISH_NONE'.
---| 'ui.Icons.SatelliteDish' @Value: 'SATELLITE_DISH'.
---| 'ui.Icons.Save' @Value: 'SAVE'.
---| 'ui.Icons.Sea' @Value: 'SEA'.
---| 'ui.Icons.Send' @Value: 'SEND'.
---| 'ui.Icons.Settings' @Value: 'SETTINGS'.
---| 'ui.Icons.Skip' @Value: 'SKIP'.
---| 'ui.Icons.Sleep' @Value: 'SLEEP'.
---| 'ui.Icons.SlowMotion' @Value: 'SLOW_MOTION'.
---| 'ui.Icons.Smile' @Value: 'SMILE'.
---| 'ui.Icons.Spotify' @Value: 'SPOTIFY'.
---| 'ui.Icons.StarEmpty' @Value: 'STAR_EMPTY'.
---| 'ui.Icons.StarFull' @Value: 'STAR_FULL'.
---| 'ui.Icons.StarHalf' @Value: 'STAR_HALF'.
---| 'ui.Icons.Start' @Value: 'START'.
---| 'ui.Icons.Stay' @Value: 'STAY'.
---| 'ui.Icons.Tag' @Value: 'TAG'.
---| 'ui.Icons.Target' @Value: 'TARGET'.
---| 'ui.Icons.Teleport' @Value: 'TELEPORT'.
---| 'ui.Icons.Thermometer' @Value: 'THERMOMETER'.
---| 'ui.Icons.Undo' @Value: 'UNDO'.
---| 'ui.Icons.Up' @Value: 'UP'.
---| 'ui.Icons.VideoCamera' @Value: 'VIDEO_CAMERA'.
---| 'ui.Icons.Warning' @Value: 'WARNING'.
---| 'ui.Icons.WeatherClear' @Value: 'WEATHER_CLEAR'.
---| 'ui.Icons.WeatherCold' @Value: 'WEATHER_COLD'.
---| 'ui.Icons.WeatherDrizzle' @Value: 'WEATHER_DRIZZLE'.
---| 'ui.Icons.WeatherFewClouds' @Value: 'WEATHER_FEW_CLOUDS'.
---| 'ui.Icons.WeatherFog' @Value: 'WEATHER_FOG'.
---| 'ui.Icons.WeatherHail' @Value: 'WEATHER_HAIL'.
---| 'ui.Icons.WeatherHot' @Value: 'WEATHER_HOT'.
---| 'ui.Icons.WeatherHurricane' @Value: 'WEATHER_HURRICANE'.
---| 'ui.Icons.WeatherOvercast' @Value: 'WEATHER_OVERCAST'.
---| 'ui.Icons.WeatherRainLight' @Value: 'WEATHER_RAIN_LIGHT'.
---| 'ui.Icons.WeatherRain' @Value: 'WEATHER_RAIN'.
---| 'ui.Icons.WeatherSleet' @Value: 'WEATHER_SLEET'.
---| 'ui.Icons.WeatherSnowLight' @Value: 'WEATHER_SNOW_LIGHT'.
---| 'ui.Icons.WeatherSnow' @Value: 'WEATHER_SNOW'.
---| 'ui.Icons.WeatherStormLight' @Value: 'WEATHER_STORM_LIGHT'.
---| 'ui.Icons.WeatherStorm' @Value: 'WEATHER_STORM'.
---| 'ui.Icons.WeatherTornado' @Value: 'WEATHER_TORNADO'.
---| 'ui.Icons.WeatherWarm' @Value: 'WEATHER_WARM'.
---| 'ui.Icons.WeatherWindySun' @Value: 'WEATHER_WINDY_SUN'.
---| 'ui.Icons.WeatherWindy' @Value: 'WEATHER_WINDY'.
---| 'ui.Icons.YoutubeSolid' @Value: 'YOUTUBE_SOLID'.
---| 'ui.Icons.Youtube' @Value: 'YOUTUBE'.
ui.Icons = {
  Apps = 'APPS', ---Value: 'APPS'.
  ArrowDown = 'ARROW_DOWN', ---Value: 'ARROW_DOWN'.
  ArrowLeft = 'ARROW_LEFT', ---Value: 'ARROW_LEFT'.
  ArrowRight = 'ARROW_RIGHT', ---Value: 'ARROW_RIGHT'.
  ArrowUp = 'ARROW_UP', ---Value: 'ARROW_UP'.
  Ballast = 'BALLAST', ---Value: 'BALLAST'.
  Ban = 'BAN', ---Value: 'BAN'.
  Befriend = 'BEFRIEND', ---Value: 'BEFRIEND'.
  Bell = 'BELL', ---Value: 'BELL'.
  Bluetooth = 'BLUETOOTH', ---Value: 'BLUETOOTH'.
  Bug = 'BUG', ---Value: 'BUG'.
  Bulb = 'BULB', ---Value: 'BULB'.
  CallBluetooth = 'CALL_BLUETOOTH', ---Value: 'CALL_BLUETOOTH'.
  Call = 'CALL', ---Value: 'CALL'.
  Camera = 'CAMERA', ---Value: 'CAMERA'.
  Cancel = 'CANCEL', ---Value: 'CANCEL'.
  CarFront = 'CAR_FRONT', ---Value: 'CAR_FRONT'.
  Clip = 'CLIP', ---Value: 'CLIP'.
  Clock = 'CLOCK', ---Value: 'CLOCK'.
  Compass = 'COMPASS', ---Value: 'COMPASS'.
  Confirm = 'CONFIRM', ---Value: 'CONFIRM'.
  Copy = 'COPY', ---Value: 'COPY'.
  Crosshair = 'CROSSHAIR', ---Value: 'CROSSHAIR'.
  Delete = 'DELETE', ---Value: 'DELETE'.
  Down = 'DOWN', ---Value: 'DOWN'.
  Download = 'DOWNLOAD', ---Value: 'DOWNLOAD'.
  Earth = 'EARTH', ---Value: 'EARTH'.
  Edit = 'EDIT', ---Value: 'EDIT'.
  Eye = 'EYE', ---Value: 'EYE'.
  File = 'FILE', ---Value: 'FILE'.
  Finish = 'FINISH', ---Value: 'FINISH'.
  Fm = 'FM', ---Value: 'FM'.
  Folder = 'FOLDER', ---Value: 'FOLDER'.
  Fuel = 'FUEL', ---Value: 'FUEL'.
  Global = 'GLOBAL', ---Value: 'GLOBAL'.
  GlowThick = 'GLOW_THICK', ---Value: 'GLOW_THICK'.
  Glow = 'GLOW', ---Value: 'GLOW'.
  Gps = 'GPS', ---Value: 'GPS'.
  Group = 'GROUP', ---Value: 'GROUP'.
  Hammer = 'HAMMER', ---Value: 'HAMMER'.
  Hide = 'HIDE', ---Value: 'HIDE'.
  Horizontal = 'HORIZONTAL', ---Value: 'HORIZONTAL'.
  Info = 'INFO', ---Value: 'INFO'.
  Key = 'KEY', ---Value: 'KEY'.
  Kick = 'KICK', ---Value: 'KICK'.
  Leave = 'LEAVE', ---Value: 'LEAVE'.
  Loading = 'LOADING', ---Value: 'LOADING'.
  Location = 'LOCATION', ---Value: 'LOCATION'.
  Map = 'MAP', ---Value: 'MAP'.
  Menu = 'MENU', ---Value: 'MENU'.
  Minus = 'MINUS', ---Value: 'MINUS'.
  Monitor = 'MONITOR', ---Value: 'MONITOR'.
  Music = 'MUSIC', ---Value: 'MUSIC'.
  Navigation = 'NAVIGATION', ---Value: 'NAVIGATION'.
  Palette = 'PALETTE', ---Value: 'PALETTE'.
  Pin = 'PIN', ---Value: 'PIN'.
  PitStop = 'PIT_STOP', ---Value: 'PIT_STOP'.
  Plus = 'PLUS', ---Value: 'PLUS'.
  Preview = 'PREVIEW', ---Value: 'PREVIEW'.
  Python = 'PYTHON', ---Value: 'PYTHON'.
  Referee = 'REFEREE', ---Value: 'REFEREE'.
  Repair = 'REPAIR', ---Value: 'REPAIR'.
  RestartWarning = 'RESTART_WARNING', ---Value: 'RESTART_WARNING'.
  Restart = 'RESTART', ---Value: 'RESTART'.
  Restrictor = 'RESTRICTOR', ---Value: 'RESTRICTOR'.
  Road = 'ROAD', ---Value: 'ROAD'.
  Rubber = 'RUBBER', ---Value: 'RUBBER'.
  SatelliteDishLow = 'SATELLITE_DISH_LOW', ---Value: 'SATELLITE_DISH_LOW'.
  SatelliteDishNone = 'SATELLITE_DISH_NONE', ---Value: 'SATELLITE_DISH_NONE'.
  SatelliteDish = 'SATELLITE_DISH', ---Value: 'SATELLITE_DISH'.
  Save = 'SAVE', ---Value: 'SAVE'.
  Sea = 'SEA', ---Value: 'SEA'.
  Send = 'SEND', ---Value: 'SEND'.
  Settings = 'SETTINGS', ---Value: 'SETTINGS'.
  Skip = 'SKIP', ---Value: 'SKIP'.
  Sleep = 'SLEEP', ---Value: 'SLEEP'.
  SlowMotion = 'SLOW_MOTION', ---Value: 'SLOW_MOTION'.
  Smile = 'SMILE', ---Value: 'SMILE'.
  Spotify = 'SPOTIFY', ---Value: 'SPOTIFY'.
  StarEmpty = 'STAR_EMPTY', ---Value: 'STAR_EMPTY'.
  StarFull = 'STAR_FULL', ---Value: 'STAR_FULL'.
  StarHalf = 'STAR_HALF', ---Value: 'STAR_HALF'.
  Start = 'START', ---Value: 'START'.
  Stay = 'STAY', ---Value: 'STAY'.
  Tag = 'TAG', ---Value: 'TAG'.
  Target = 'TARGET', ---Value: 'TARGET'.
  Teleport = 'TELEPORT', ---Value: 'TELEPORT'.
  Thermometer = 'THERMOMETER', ---Value: 'THERMOMETER'.
  Undo = 'UNDO', ---Value: 'UNDO'.
  Up = 'UP', ---Value: 'UP'.
  VideoCamera = 'VIDEO_CAMERA', ---Value: 'VIDEO_CAMERA'.
  Warning = 'WARNING', ---Value: 'WARNING'.
  WeatherClear = 'WEATHER_CLEAR', ---Value: 'WEATHER_CLEAR'.
  WeatherCold = 'WEATHER_COLD', ---Value: 'WEATHER_COLD'.
  WeatherDrizzle = 'WEATHER_DRIZZLE', ---Value: 'WEATHER_DRIZZLE'.
  WeatherFewClouds = 'WEATHER_FEW_CLOUDS', ---Value: 'WEATHER_FEW_CLOUDS'.
  WeatherFog = 'WEATHER_FOG', ---Value: 'WEATHER_FOG'.
  WeatherHail = 'WEATHER_HAIL', ---Value: 'WEATHER_HAIL'.
  WeatherHot = 'WEATHER_HOT', ---Value: 'WEATHER_HOT'.
  WeatherHurricane = 'WEATHER_HURRICANE', ---Value: 'WEATHER_HURRICANE'.
  WeatherOvercast = 'WEATHER_OVERCAST', ---Value: 'WEATHER_OVERCAST'.
  WeatherRainLight = 'WEATHER_RAIN_LIGHT', ---Value: 'WEATHER_RAIN_LIGHT'.
  WeatherRain = 'WEATHER_RAIN', ---Value: 'WEATHER_RAIN'.
  WeatherSleet = 'WEATHER_SLEET', ---Value: 'WEATHER_SLEET'.
  WeatherSnowLight = 'WEATHER_SNOW_LIGHT', ---Value: 'WEATHER_SNOW_LIGHT'.
  WeatherSnow = 'WEATHER_SNOW', ---Value: 'WEATHER_SNOW'.
  WeatherStormLight = 'WEATHER_STORM_LIGHT', ---Value: 'WEATHER_STORM_LIGHT'.
  WeatherStorm = 'WEATHER_STORM', ---Value: 'WEATHER_STORM'.
  WeatherTornado = 'WEATHER_TORNADO', ---Value: 'WEATHER_TORNADO'.
  WeatherWarm = 'WEATHER_WARM', ---Value: 'WEATHER_WARM'.
  WeatherWindySun = 'WEATHER_WINDY_SUN', ---Value: 'WEATHER_WINDY_SUN'.
  WeatherWindy = 'WEATHER_WINDY', ---Value: 'WEATHER_WINDY'.
  YoutubeSolid = 'YOUTUBE_SOLID', ---Value: 'YOUTUBE_SOLID'.
  Youtube = 'YOUTUBE', ---Value: 'YOUTUBE'.
}

---@alias ui.ButtonFlags
---| 'ui.ButtonFlags.None' @No special options.
---| 'ui.ButtonFlags.Repeat' @Hold to repeat.
---| 'ui.ButtonFlags.PressedOnClickRelease' @Return true on click + release on same item.
---| 'ui.ButtonFlags.PressedOnClick' @Return true on click (default requires click+release).
---| 'ui.ButtonFlags.PressedOnRelease' @Return true on release (default requires click+release).
---| 'ui.ButtonFlags.PressedOnDoubleClick' @Return true on double-click (default requires click+release).
---| 'ui.ButtonFlags.FlattenChildren' @Allow interactions even if a child window is overlapping.
---| 'ui.ButtonFlags.AllowItemOverlap' @Require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap().
---| 'ui.ButtonFlags.DontClosePopups' @Disable automatically closing parent popup on press.
---| 'ui.ButtonFlags.Disabled' @Disable interactions.
---| 'ui.ButtonFlags.NoKeyModifiers' @Disable interaction if a key modifier is held.
---| 'ui.ButtonFlags.PressedOnDragDropHold' @Press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers).
---| 'ui.ButtonFlags.NoNavFocus' @Don’t override navigation focus when activated.
---| 'ui.ButtonFlags.NoHoveredOnNav' @Don’t report as hovered when navigated on.
---| 'ui.ButtonFlags.Active' @Button is correctly active (checked).
---| 'ui.ButtonFlags.Activable' @If not set, _Active would make background brighter.
ui.ButtonFlags = {
  None = 0x0, ---No special options.
  Repeat = 0x1, ---Hold to repeat.
  PressedOnClickRelease = 0x2, ---Return true on click + release on same item.
  PressedOnClick = 0x4, ---Return true on click (default requires click+release).
  PressedOnRelease = 0x8, ---Return true on release (default requires click+release).
  PressedOnDoubleClick = 0x10, ---Return true on double-click (default requires click+release).
  FlattenChildren = 0x20, ---Allow interactions even if a child window is overlapping.
  AllowItemOverlap = 0x40, ---Require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap().
  DontClosePopups = 0x80, ---Disable automatically closing parent popup on press.
  Disabled = 0x100, ---Disable interactions.
  NoKeyModifiers = 0x400, ---Disable interaction if a key modifier is held.
  PressedOnDragDropHold = 0x1000, ---Press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers).
  NoNavFocus = 0x2000, ---Don’t override navigation focus when activated.
  NoHoveredOnNav = 0x4000, ---Don’t report as hovered when navigated on.
  Active = 0x100000, ---Button is correctly active (checked).
  Activable = 0x200000, ---If not set, _Active would make background brighter.
}

---@alias ui.WindowFlags
---| 'ui.WindowFlags.None' @No special options.
---| 'ui.WindowFlags.NoTitleBar' @Disable title-bar.
---| 'ui.WindowFlags.NoResize' @Disable user resizing with the lower-right grip.
---| 'ui.WindowFlags.NoMove' @Disable user moving the window.
---| 'ui.WindowFlags.NoScrollbar' @Disable scrollbars (window can still scroll with mouse or programmatically).
---| 'ui.WindowFlags.NoScrollWithMouse' @Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
---| 'ui.WindowFlags.NoCollapse' @Disable user collapsing window by double-clicking on it.
---| 'ui.WindowFlags.AlwaysAutoResize' @Resize every window to its content every frame.
---| 'ui.WindowFlags.NoBackground' @Disable drawing background and outside border.
---| 'ui.WindowFlags.NoSavedSettings' @Never load/save settings in .ini file.
---| 'ui.WindowFlags.NoMouseInputs' @Disable catching mouse, hovering test with pass through.
---| 'ui.WindowFlags.MenuBar' @Has a menu-bar.
---| 'ui.WindowFlags.HorizontalScrollbar' @Allow horizontal scrollbar to appear (off by default).
---| 'ui.WindowFlags.NoFocusOnAppearing' @Disable taking focus when transitioning from hidden to visible state.
---| 'ui.WindowFlags.NoBringToFrontOnFocus' @Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus).
---| 'ui.WindowFlags.AlwaysVerticalScrollbar' @Always show vertical scrollbar (even if ContentSize.y < Size.y).
---| 'ui.WindowFlags.AlwaysHorizontalScrollbar' @Always show horizontal scrollbar (even if ContentSize.x < Size.x).
---| 'ui.WindowFlags.AlwaysUseWindowPadding' @Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient).
---| 'ui.WindowFlags.NoNavInputs' @No gamepad/keyboard navigation within the window.
---| 'ui.WindowFlags.NoNavFocus' @No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB).
---| 'ui.WindowFlags.UnsavedDocument' @Append “*” to title without affecting the ID, as a convenience to avoid using the “###” operator.
---| 'ui.WindowFlags.NoNav' @Combination of flags: NoNavInputs | NoNavFocus (use `bit.bor(ui.WindowFlags.NoNav, …)` to combine it with other flags safely).
---| 'ui.WindowFlags.NoDecoration' @Combination of flags: NoTitleBar | NoResize | NoScrollbar | NoCollapse (use `bit.bor(ui.WindowFlags.NoDecoration, …)` to combine it with other flags safely).
---| 'ui.WindowFlags.NoInputs' @Combination of flags: NoMouseInputs | NoNavInputs | NoNavFocus (use `bit.bor(ui.WindowFlags.NoInputs, …)` to combine it with other flags safely).
ui.WindowFlags = {
  None = 0x0, ---No special options.
  NoTitleBar = 0x1, ---Disable title-bar.
  NoResize = 0x2, ---Disable user resizing with the lower-right grip.
  NoMove = 0x4, ---Disable user moving the window.
  NoScrollbar = 0x8, ---Disable scrollbars (window can still scroll with mouse or programmatically).
  NoScrollWithMouse = 0x10, ---Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
  NoCollapse = 0x20, ---Disable user collapsing window by double-clicking on it.
  AlwaysAutoResize = 0x40, ---Resize every window to its content every frame.
  NoBackground = 0x80, ---Disable drawing background and outside border.
  NoSavedSettings = 0x100, ---Never load/save settings in .ini file.
  NoMouseInputs = 0x200, ---Disable catching mouse, hovering test with pass through.
  MenuBar = 0x400, ---Has a menu-bar.
  HorizontalScrollbar = 0x800, ---Allow horizontal scrollbar to appear (off by default).
  NoFocusOnAppearing = 0x1000, ---Disable taking focus when transitioning from hidden to visible state.
  NoBringToFrontOnFocus = 0x2000, ---Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus).
  AlwaysVerticalScrollbar = 0x4000, ---Always show vertical scrollbar (even if ContentSize.y < Size.y).
  AlwaysHorizontalScrollbar = 0x8000, ---Always show horizontal scrollbar (even if ContentSize.x < Size.x).
  AlwaysUseWindowPadding = 0x10000, ---Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient).
  NoNavInputs = 0x40000, ---No gamepad/keyboard navigation within the window.
  NoNavFocus = 0x80000, ---No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB).
  UnsavedDocument = 0x100000, ---Append “*” to title without affecting the ID, as a convenience to avoid using the “###” operator.
  NoNav = 0xc0000, ---Combination of flags: NoNavInputs | NoNavFocus (use `bit.bor(ui.WindowFlags.NoNav, …)` to combine it with other flags safely).
  NoDecoration = 0x2b, ---Combination of flags: NoTitleBar | NoResize | NoScrollbar | NoCollapse (use `bit.bor(ui.WindowFlags.NoDecoration, …)` to combine it with other flags safely).
  NoInputs = 0xc0200, ---Combination of flags: NoMouseInputs | NoNavInputs | NoNavFocus (use `bit.bor(ui.WindowFlags.NoInputs, …)` to combine it with other flags safely).
}

---@alias ui.ComboFlags
---| 'ui.ComboFlags.None' @No special options.
---| 'ui.ComboFlags.PopupAlignLeft' @Align the popup toward the left by default.
---| 'ui.ComboFlags.HeightSmall' @Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo().
---| 'ui.ComboFlags.HeightRegular' @Max ~8 items visible (default).
---| 'ui.ComboFlags.HeightLarge' @Max ~20 items visible.
---| 'ui.ComboFlags.HeightLargest' @As many fitting items as possible.
---| 'ui.ComboFlags.NoArrowButton' @Display on the preview box without the square arrow button.
---| 'ui.ComboFlags.NoPreview' @Display only a square arrow button.
---| 'ui.ComboFlags.GoUp' @Dropdown goes up.
---| 'ui.ComboFlags.HeightChubby' @Height between regular and large.
ui.ComboFlags = {
  None = 0x0, ---No special options.
  PopupAlignLeft = 0x1, ---Align the popup toward the left by default.
  HeightSmall = 0x2, ---Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo().
  HeightRegular = 0x4, ---Max ~8 items visible (default).
  HeightLarge = 0x8, ---Max ~20 items visible.
  HeightLargest = 0x10, ---As many fitting items as possible.
  NoArrowButton = 0x20, ---Display on the preview box without the square arrow button.
  NoPreview = 0x40, ---Display only a square arrow button.
  GoUp = 0x80, ---Dropdown goes up.
  HeightChubby = 0x100, ---Height between regular and large.
}

---@alias ui.InputTextFlags
---| 'ui.InputTextFlags.None' @No special options.
---| 'ui.InputTextFlags.CharsDecimal' @Allow “0123456789.+-*/”.
---| 'ui.InputTextFlags.CharsHexadecimal' @Allow “0123456789ABCDEFabcdef”.
---| 'ui.InputTextFlags.CharsUppercase' @Turn a…z into A…Z.
---| 'ui.InputTextFlags.CharsNoBlank' @Filter out spaces, tabs.
---| 'ui.InputTextFlags.AutoSelectAll' @Select entire text when first taking mouse focus.
---| 'ui.InputTextFlags.EnterReturnsTrue' @Return `true` when Enter is pressed (as opposed to every time the value was modified).
---| 'ui.InputTextFlags.AllowTabInput' @Pressing TAB input a '\t' character into the text field.
---| 'ui.InputTextFlags.CtrlEnterForNewLine' @In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
---| 'ui.InputTextFlags.NoHorizontalScroll' @Disable following the cursor horizontally.
---| 'ui.InputTextFlags.AlwaysInsertMode' @Insert mode.
---| 'ui.InputTextFlags.ReadOnly' @Read-only mode.
---| 'ui.InputTextFlags.Password' @Password mode, display all characters as “*”.
---| 'ui.InputTextFlags.NoUndoRedo' @Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
---| 'ui.InputTextFlags.CharsScientific' @Allow “0123456789.+-*/eE” (Scientific notation input).
---| 'ui.InputTextFlags.Placeholder' @Show label as a placeholder.
---| 'ui.InputTextFlags.ClearButton' @Add button erasing text.
ui.InputTextFlags = {
  None = 0x0, ---No special options.
  CharsDecimal = 0x1, ---Allow “0123456789.+-*/”.
  CharsHexadecimal = 0x2, ---Allow “0123456789ABCDEFabcdef”.
  CharsUppercase = 0x4, ---Turn a…z into A…Z.
  CharsNoBlank = 0x8, ---Filter out spaces, tabs.
  AutoSelectAll = 0x10, ---Select entire text when first taking mouse focus.
  EnterReturnsTrue = 0x20, ---Return `true` when Enter is pressed (as opposed to every time the value was modified).
  AllowTabInput = 0x400, ---Pressing TAB input a '\t' character into the text field.
  CtrlEnterForNewLine = 0x800, ---In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
  NoHorizontalScroll = 0x1000, ---Disable following the cursor horizontally.
  AlwaysInsertMode = 0x2000, ---Insert mode.
  ReadOnly = 0x4000, ---Read-only mode.
  Password = 0x8000, ---Password mode, display all characters as “*”.
  NoUndoRedo = 0x10000, ---Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
  CharsScientific = 0x20000, ---Allow “0123456789.+-*/eE” (Scientific notation input).
  Placeholder = 0x400000, ---Show label as a placeholder.
  ClearButton = 0x800000, ---Add button erasing text.
}

---@alias ui.SelectableFlags
---| 'ui.SelectableFlags.None' @No special options.
---| 'ui.SelectableFlags.DontClosePopups' @Clicking this don’t close parent popup window.
---| 'ui.SelectableFlags.SpanAllColumns' @Selectable frame can span all columns (text will still fit in current column).
---| 'ui.SelectableFlags.AllowDoubleClick' @Generate press events on double clicks too.
---| 'ui.SelectableFlags.Disabled' @Cannot be selected, display grayed out text.
ui.SelectableFlags = {
  None = 0x0, ---No special options.
  DontClosePopups = 0x1, ---Clicking this don’t close parent popup window.
  SpanAllColumns = 0x2, ---Selectable frame can span all columns (text will still fit in current column).
  AllowDoubleClick = 0x4, ---Generate press events on double clicks too.
  Disabled = 0x8, ---Cannot be selected, display grayed out text.
}

---@alias ui.TabBarFlags
---| 'ui.TabBarFlags.None' @No special options.
---| 'ui.TabBarFlags.Reorderable' @Allow manually dragging tabs to re-order them + New tabs are appended at the end of list.
---| 'ui.TabBarFlags.AutoSelectNewTabs' @Automatically select new tabs when they appear.
---| 'ui.TabBarFlags.TabListPopupButton' @Disable buttons to open the tab list popup.
---| 'ui.TabBarFlags.NoCloseWithMiddleMouseButton' @Disable behavior of closing tabs (that are submitted with p_open !
---| 'ui.TabBarFlags.NoTabListScrollingButtons' @Disable scrolling buttons (apply when fitting policy is FittingPolicyScroll).
---| 'ui.TabBarFlags.NoTooltip' @Disable tooltips when hovering a tab.
---| 'ui.TabBarFlags.FittingPolicyResizeDown' @Resize tabs when they don’t fit.
---| 'ui.TabBarFlags.FittingPolicyScroll' @Add scroll buttons when tabs don’t fit.
ui.TabBarFlags = {
  None = 0x0, ---No special options.
  Reorderable = 0x1, ---Allow manually dragging tabs to re-order them + New tabs are appended at the end of list.
  AutoSelectNewTabs = 0x2, ---Automatically select new tabs when they appear.
  TabListPopupButton = 0x4, ---Disable buttons to open the tab list popup.
  NoCloseWithMiddleMouseButton = 0x8, ---Disable behavior of closing tabs (that are submitted with p_open !
  NoTabListScrollingButtons = 0x10, ---Disable scrolling buttons (apply when fitting policy is FittingPolicyScroll).
  NoTooltip = 0x20, ---Disable tooltips when hovering a tab.
  FittingPolicyResizeDown = 0x40, ---Resize tabs when they don’t fit.
  FittingPolicyScroll = 0x80, ---Add scroll buttons when tabs don’t fit.
}

---@alias ui.TabItemFlags
---| 'ui.TabItemFlags.None' @Value: 0.
---| 'ui.TabItemFlags.UnsavedDocument' @Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it without flicker.
---| 'ui.TabItemFlags.SetSelected' @Trigger flag to programmatically make the tab selected when calling BeginTabItem().
---| 'ui.TabItemFlags.NoCloseWithMiddleMouseButton' @Disable behavior of closing tabs (that are submitted with p_open !
ui.TabItemFlags = {
  None = 0, ---Value: 0.
  UnsavedDocument = 1, ---Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it without flicker.
  SetSelected = 2, ---Trigger flag to programmatically make the tab selected when calling BeginTabItem().
  NoCloseWithMiddleMouseButton = 4, ---Disable behavior of closing tabs (that are submitted with p_open !
}

---@alias ui.TreeNodeFlags
---| 'ui.TreeNodeFlags.None' @No special options.
---| 'ui.TreeNodeFlags.Selected' @Draw as selected.
---| 'ui.TreeNodeFlags.Framed' @Full colored frame (e.g. for CollapsingHeader).
---| 'ui.TreeNodeFlags.AllowItemOverlap' @Hit testing to allow subsequent widgets to overlap this one.
---| 'ui.TreeNodeFlags.NoTreePushOnOpen' @Don’t do a TreePush() when open (e.g. for CollapsingHeader).
---| 'ui.TreeNodeFlags.NoAutoOpenOnLog' @Don’t automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes).
---| 'ui.TreeNodeFlags.DefaultOpen' @Default node to be open.
---| 'ui.TreeNodeFlags.OpenOnDoubleClick' @Need double-click to open node.
---| 'ui.TreeNodeFlags.OpenOnArrow' @Only open when clicking on the arrow part. If OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.
---| 'ui.TreeNodeFlags.Leaf' @No collapsing, no arrow (use as a convenience for leaf nodes).
---| 'ui.TreeNodeFlags.Bullet' @Display a bullet instead of arrow.
---| 'ui.TreeNodeFlags.FramePadding' @Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().
---| 'ui.TreeNodeFlags.CollapsingHeader' @Combination of flags: Framed | NoTreePushOnOpen | NoAutoOpenOnLog (use `bit.bor(ui.TreeNodeFlags.CollapsingHeader, …)` to combine it with other flags safely).
---| 'ui.TreeNodeFlags.NoArrow' @Value: 0x4000.
---| 'ui.TreeNodeFlags.Animated' @Value: 0xf0000000.
ui.TreeNodeFlags = {
  None = 0x0, ---No special options.
  Selected = 0x1, ---Draw as selected.
  Framed = 0x2, ---Full colored frame (e.g. for CollapsingHeader).
  AllowItemOverlap = 0x4, ---Hit testing to allow subsequent widgets to overlap this one.
  NoTreePushOnOpen = 0x8, ---Don’t do a TreePush() when open (e.g. for CollapsingHeader).
  NoAutoOpenOnLog = 0x10, ---Don’t automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes).
  DefaultOpen = 0x20, ---Default node to be open.
  OpenOnDoubleClick = 0x40, ---Need double-click to open node.
  OpenOnArrow = 0x80, ---Only open when clicking on the arrow part. If OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.
  Leaf = 0x100, ---No collapsing, no arrow (use as a convenience for leaf nodes).
  Bullet = 0x200, ---Display a bullet instead of arrow.
  FramePadding = 0x400, ---Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().
  CollapsingHeader = 0x1a, ---Combination of flags: Framed | NoTreePushOnOpen | NoAutoOpenOnLog (use `bit.bor(ui.TreeNodeFlags.CollapsingHeader, …)` to combine it with other flags safely).
  NoArrow = 0x4000, ---Value: 0x4000.
  Animated = 0xf0000000, ---Value: 0xf0000000.
}

---@alias ui.ColorPickerFlags
---| 'ui.ColorPickerFlags.None' @Value: 0.
---| 'ui.ColorPickerFlags.NoAlpha' @Ignore Alpha component (will only read 3 components from the input pointer).
---| 'ui.ColorPickerFlags.NoPicker' @Disable picker when clicking on colored square.
---| 'ui.ColorPickerFlags.NoOptions' @Disable toggling options menu when right-clicking on inputs/small preview.
---| 'ui.ColorPickerFlags.NoSmallPreview' @Disable colored square preview next to the inputs. (e.g. to show only the inputs).
---| 'ui.ColorPickerFlags.NoInputs' @Disable inputs sliders/text widgets (e.g. to show only the small preview colored square).
---| 'ui.ColorPickerFlags.NoTooltip' @Disable tooltip when hovering the preview.
---| 'ui.ColorPickerFlags.NoLabel' @Disable display of inline text label (the label is still forwarded to the tooltip and picker).
---| 'ui.ColorPickerFlags.NoSidePreview' @Disable bigger color preview on right side of the picker, use small colored square preview instead.
---| 'ui.ColorPickerFlags.NoDragDrop' @Disable drag and drop target. ColorButton: disable drag and drop source.
---| 'ui.ColorPickerFlags.AlphaBar' @Show vertical alpha bar/gradient in picker.
---| 'ui.ColorPickerFlags.AlphaPreview' @Display preview as a transparent color over a checkerboard, instead of opaque.
---| 'ui.ColorPickerFlags.AlphaPreviewHalf' @Display half opaque / half checkerboard, instead of opaque.
---| 'ui.ColorPickerFlags.DisplayRGB' @Override _display_ type among RGB/HSV/Hex. select any combination using one or more of RGB/HSV/Hex.
---| 'ui.ColorPickerFlags.DisplayHSV' @Value: 2097152.
---| 'ui.ColorPickerFlags.DisplayHex' @Value: 4194304.
---| 'ui.ColorPickerFlags.UInt8' @Display values formatted as 0..255.
---| 'ui.ColorPickerFlags.Float' @Display values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.
---| 'ui.ColorPickerFlags.PickerHueBar' @Bar for Hue, rectangle for Sat/Value.
---| 'ui.ColorPickerFlags.PickerHueWheel' @Wheel for Hue, triangle for Sat/Value.
ui.ColorPickerFlags = {
  None = 0, ---Value: 0.
  NoAlpha = 2, ---Ignore Alpha component (will only read 3 components from the input pointer).
  NoPicker = 4, ---Disable picker when clicking on colored square.
  NoOptions = 8, ---Disable toggling options menu when right-clicking on inputs/small preview.
  NoSmallPreview = 16, ---Disable colored square preview next to the inputs. (e.g. to show only the inputs).
  NoInputs = 32, ---Disable inputs sliders/text widgets (e.g. to show only the small preview colored square).
  NoTooltip = 64, ---Disable tooltip when hovering the preview.
  NoLabel = 128, ---Disable display of inline text label (the label is still forwarded to the tooltip and picker).
  NoSidePreview = 256, ---Disable bigger color preview on right side of the picker, use small colored square preview instead.
  NoDragDrop = 512, ---Disable drag and drop target. ColorButton: disable drag and drop source.
  AlphaBar = 65536, ---Show vertical alpha bar/gradient in picker.
  AlphaPreview = 131072, ---Display preview as a transparent color over a checkerboard, instead of opaque.
  AlphaPreviewHalf = 262144, ---Display half opaque / half checkerboard, instead of opaque.
  DisplayRGB = 1048576, ---Override _display_ type among RGB/HSV/Hex. select any combination using one or more of RGB/HSV/Hex.
  DisplayHSV = 2097152, ---Value: 2097152.
  DisplayHex = 4194304, ---Value: 4194304.
  UInt8 = 8388608, ---Display values formatted as 0..255.
  Float = 16777216, ---Display values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.
  PickerHueBar = 33554432, ---Bar for Hue, rectangle for Sat/Value.
  PickerHueWheel = 67108864, ---Wheel for Hue, triangle for Sat/Value.
}

---@alias ui.DWriteFont.Weight
---| 'ui.DWriteFont.Weight.Thin' @- Thin (100).
---| 'ui.DWriteFont.Weight.UltraLight' @- Ultra-light (200).
---| 'ui.DWriteFont.Weight.Light' @- Light (300).
---| 'ui.DWriteFont.Weight.SemiLight' @- Semi-light (350).
---| 'ui.DWriteFont.Weight.Regular' @- Regular (400).
---| 'ui.DWriteFont.Weight.Medium' @- Medium (500).
---| 'ui.DWriteFont.Weight.SemiBold' @- Semi-bold (600).
---| 'ui.DWriteFont.Weight.Bold' @- Bold (700).
---| 'ui.DWriteFont.Weight.UltraBold' @- Ultra-bold (800).
---| 'ui.DWriteFont.Weight.Black' @- Black (900).
---| 'ui.DWriteFont.Weight.UltraBlack' @- Ultra-black (950).
ui.DWriteFont.Weight = {
  Thin = 'Thin', ---- Thin (100).
  UltraLight = 'UltraLight', ---- Ultra-light (200).
  Light = 'Light', ---- Light (300).
  SemiLight = 'SemiLight', ---- Semi-light (350).
  Regular = 'Regular', ---- Regular (400).
  Medium = 'Medium', ---- Medium (500).
  SemiBold = 'SemiBold', ---- Semi-bold (600).
  Bold = 'Bold', ---- Bold (700).
  UltraBold = 'UltraBold', ---- Ultra-bold (800).
  Black = 'Black', ---- Black (900).
  UltraBlack = 'UltraBlack', ---- Ultra-black (950).
}

---@alias ui.DWriteFont.Style
---| 'ui.DWriteFont.Style.Normal' @- Charachers are upright in most fonts.
---| 'ui.DWriteFont.Style.Italic' @- In italic style, characters are truly slanted and appear as they were designed.
---| 'ui.DWriteFont.Style.Oblique' @- With oblique style characters are artificially slanted.
ui.DWriteFont.Style = {
  Normal = 'Normal', ---- Charachers are upright in most fonts.
  Italic = 'Italic', ---- In italic style, characters are truly slanted and appear as they were designed.
  Oblique = 'Oblique', ---- With oblique style characters are artificially slanted.
}

---@alias ui.DWriteFont.Stretch
---| 'ui.DWriteFont.Stretch.UltraCondensed' @Value: 'UltraCondensed'.
---| 'ui.DWriteFont.Stretch.ExtraCondensed' @Value: 'ExtraCondensed'.
---| 'ui.DWriteFont.Stretch.Condensed' @Value: 'Condensed'.
---| 'ui.DWriteFont.Stretch.SemiCondensed' @Value: 'SemiCondensed'.
---| 'ui.DWriteFont.Stretch.Medium' @Value: 'Medium'.
---| 'ui.DWriteFont.Stretch.SemiExpanded' @Value: 'SemiExpanded'.
---| 'ui.DWriteFont.Stretch.Expanded' @Value: 'Expanded'.
---| 'ui.DWriteFont.Stretch.ExtraExpanded' @Value: 'ExtraExpanded'.
---| 'ui.DWriteFont.Stretch.UltraExpanded' @Value: 'UltraExpanded'.
ui.DWriteFont.Stretch = {
  UltraCondensed = 'UltraCondensed', ---Value: 'UltraCondensed'.
  ExtraCondensed = 'ExtraCondensed', ---Value: 'ExtraCondensed'.
  Condensed = 'Condensed', ---Value: 'Condensed'.
  SemiCondensed = 'SemiCondensed', ---Value: 'SemiCondensed'.
  Medium = 'Medium', ---Value: 'Medium'.
  SemiExpanded = 'SemiExpanded', ---Value: 'SemiExpanded'.
  Expanded = 'Expanded', ---Value: 'Expanded'.
  ExtraExpanded = 'ExtraExpanded', ---Value: 'ExtraExpanded'.
  UltraExpanded = 'UltraExpanded', ---Value: 'UltraExpanded'.
}

--[[ csp.lua ]]

---@param conditionInput string
---@param value number
function ac.setTrackConditionInput(conditionInput, value) end

---Loads FMOD soundbank. After soundbank is loaded, new audio events can be created which would refer to
---events in the soundbank. If soundbank is missing, new audio events can still be created, but they won’t be
---valid. If second parameter is missing, “GUIDs.txt” in the same folder as soundbank will be loaded. Returns
---true if both files were found properly. Also, if used before audio engine is initialized, it would postpone
---loading until that happens (function returns straight away, and you can create new audio events straight
---away, but they would only become valid after audio initialization is complete).
---@param soundbank string @Path to “.bank” file, could be absolute or relative to Lua script folder.
---@param guids string @Path to “.txt” file with GUIDs, if missing, “GUIDs.txt” from soundbank folder will be used.
---@return boolean @Returns `true` if both files were found. .
function ac.loadSoundbank(soundbank, guids) end

---Checks if audio engine is initialized and ready to work. Until then, all created audio events would return `false`
---in their `:isValid()` methods, it doesn’t mean that there is a problem with soundbank (yet).
---@return boolean
function ac.isAudioReady() end

---@param center vec3
---@param radius number
---@return boolean
function render.isVisible(center, radius) end

---@param mode render.BlendMode
function render.setBlendMode(mode) end

---@param mode render.CullMode
function render.setCullMode(mode) end

---@param mode render.DepthMode
function render.setDepthMode(mode) end

---@param color rgbm
function render.glSetColor(color) end

---@param primitiveType render.GLPrimitiveType
function render.glBegin(primitiveType) end

---@param v vec3
function render.glVertex(v) end

---@param v vec3
---@param uv vec2
function render.glVertexTextured(v, uv) end

---@param filename string
function render.glTexture(filename) end

function render.glEnd() end

---Draws a simple circle othrogonal to `dir` direction using an optimized shader.
---@param pos vec3
---@param dir vec3
---@param radius number
---@param color rgbm? @Default value: rgbm.colors.white.
---@param borderColor rgbm? @Optional different color to use close to the border. Default value: nullptr.
function render.circle(pos, dir, radius, color, borderColor) end

---Draws a simple rectangle othrogonal to `dir` direction using an optimized shader.
---@param pos vec3
---@param dir vec3
---@param width number
---@param height number
---@param color rgbm? @Default value: rgbm.colors.white.
function render.rectangle(pos, dir, width, height, color) end

---@param pos vec3
---@param text string
---@param color rgbm? @Default value: rgbm.colors.white.
---@param scale number? @Default value: 1.
---@param align render.FontAlign? @Default value: AC::FontAlign::center.
function render.debugText(pos, text, color, scale, align) end

---@param center vec3
---@param radius number
---@param color rgbm? @Default value: rgbm(3, 0, 0, 1).
function render.debugSphere(center, radius, color) end

---@param center vec3
---@param size number
---@param color rgbm? @Default value: rgbm(3, 0, 0, 1).
function render.debugCross(center, size, color) end

---@param center vec3
---@param size number
---@param color rgbm? @Default value: rgbm(3, 0, 0, 1).
function render.debugPoint(center, size, color) end

---@param center vec3
---@param dir vec3
---@param color rgbm? @Default value: rgbm(3, 0, 0, 1).
---@param size number? @Default value: 1.
function render.debugPlane(center, dir, color, size) end

---@param from vec3
---@param to vec3
---@param color rgbm? @Default value: rgbm(3, 0, 0, 1).
function render.debugLine(from, to, color) end

---@param from vec3
---@param to vec3
---@param size number? @Default value: -1.
---@param color rgbm? @Default value: rgbm(3, 0, 0, 1).
function render.debugArrow(from, to, size, color) end

---@param pos vec3
---@param dir vec3
---@param length number? @Default value: -1.
---@return ray
function render.createRay(pos, dir, length) end

---@return ray
function render.createMouseRay() end

---@param onscreenPoint vec2
---@return ray
function render.createPointRay(onscreenPoint) end

---@return boolean
function render.isPositioningHelperBusy() end

---It’s safer to use `ui.toolWindow()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param windowID string
---@param pos vec2
---@param size vec2
---@param noPadding boolean|'true'|'false'
function ui.beginToolWindow(windowID, pos, size, noPadding) end

function ui.endToolWindow() end

---It’s safer to use `ui.transparentWindow()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param windowID string
---@param pos vec2
---@param size vec2
---@param noPadding boolean|'true'|'false'
function ui.beginTransparentWindow(windowID, pos, size, noPadding) end

function ui.endTransparentWindow() end

---@param text string
function ui.text(text) end

---@param text string
---@param alignment vec2
---@param size vec2? @Default value: vec2().
function ui.textAligned(text, alignment, size) end

---@param text string
function ui.textWrapped(text) end

---@param text string
---@param color rgbm
function ui.textColored(text, color) end

---@param iconID ui.Icons
---@param size vec2
---@param tintCol rgbm? @Default value: rgbm.colors.white.
function ui.icon24(iconID, size, tintCol) end

---@param iconID string
---@param size vec2
---@param tintCol rgbm? @Default value: rgbm.colors.white.
function ui.icon32(iconID, size, tintCol) end

---@param iconID string
---@param size vec2
---@param tintCol rgbm? @Default value: rgbm.colors.white.
function ui.icon64(iconID, size, tintCol) end

---@param iconID string
---@param size vec2
---@param tintCol rgbm? @Default value: rgbm.colors.white.
function ui.flag(iconID, size, tintCol) end

---@return vec2
function ui.getCursor() end

---@param v vec2
function ui.setCursor(v) end

---@param v vec2
function ui.offsetCursor(v) end

---@return number
function ui.getCursorX() end

---@param v number
function ui.setCursorX(v) end

---@return number
function ui.getCursorY() end

---@param v number
function ui.setCursorY(v) end

---@param v number
function ui.offsetCursorX(v) end

---@param v number
function ui.offsetCursorY(v) end

---@param offsetFromStart number? @Default value: 0.
---@param spacing number? @Default value: -1.
function ui.sameLine(offsetFromStart, spacing) end

function ui.newLine() end

---Lock horizontal starting position and capture group bounding box into one “item” (so you can use `ui.itemHovered()` or layout primitives such as `ui.sameLine()` on whole group, etc.).
function ui.beginGroup() end

---Unlock horizontal starting position and capture the whole group bounding box into one “item” (so you can use `ui.itemHovered()` or layout primitives such as `ui.sameLine()` on whole group, etc.).
function ui.endGroup() end

---@return number
function ui.availableSpaceX() end

---@return number
function ui.availableSpaceY() end

---@return vec2
function ui.availableSpace() end

---@param filename string
---@param p1 vec2
---@param p2 vec2
---@param color rgbm? @Default value: rgbm.colors.white.
---@param uv1 vec2? @Default value: vec2().
---@param uv2 vec2? @Default value: vec2(1, 1).
---@param keepAspectRatio boolean? @Default value: false.
function ui.drawImage(filename, p1, p2, color, uv1, uv2, keepAspectRatio) end

---@param filename string
---@param p1 vec2
---@param p2 vec2
---@param color rgbm? @Default value: rgbm.colors.white.
---@param uv1 vec2? @Default value: vec2().
---@param uv2 vec2? @Default value: vec2(1, 1).
---@param rounding number? @Default value: 1.
---@param corners ui.CornerFlags? @Default value: ImDrawCornerFlags_All.
function ui.drawImageRounded(filename, p1, p2, color, uv1, uv2, rounding, corners) end

---@param filename string
---@param p1 vec2
---@param p2 vec2
---@param p3 vec2
---@param p4 vec2
---@param color rgbm? @Default value: rgbm.colors.white.
---@param uv1 vec2? @Default value: vec2().
---@param uv2 vec2? @Default value: vec2(1, 0).
---@param uv3 vec2? @Default value: vec2(1, 1).
---@param uv4 vec2? @Default value: vec2(0, 1).
function ui.drawImageQuad(filename, p1, p2, p3, p4, color, uv1, uv2, uv3, uv4) end

---@param p1 vec2
---@param p2 vec2
---@param p3 vec2
---@param p4 vec2
---@param color rgbm? @Default value: rgbm.colors.white.
function ui.drawQuadFilled(p1, p2, p3, p4, color) end

---@param p1 vec2
---@param p2 vec2
---@param p3 vec2
---@param p4 vec2
---@param color rgbm? @Default value: rgbm.colors.white.
function ui.drawQuad(p1, p2, p3, p4, color) end

---@param texBrightness number? @Default value: 1.
---@param texOffset number? @Default value: 0.
---@param alphaMult number? @Default value: 1.
---@param alphaOffset number? @Default value: 0.
function ui.setShadingOffset(texBrightness, texOffset, alphaMult, alphaOffset) end

---@param filename string
function ui.beginTextureShade(filename) end

---@param p1 vec2
---@param p2 vec2
---@param uv1 vec2? @Default value: vec2().
---@param uv2 vec2? @Default value: vec2(1, 1).
---@param clamp boolean? @Default value: true.
function ui.endTextureShade(p1, p2, uv1, uv2, clamp) end

function ui.beginGradientShade() end

---@param p1 vec2
---@param p2 vec2
---@param col1 rgbm? @Default value: rgbm.colors.white.
---@param col2 rgbm? @Default value: rgbm.colors.white.
function ui.endGradientShade(p1, p2, col1, col2) end

---@param p1 vec2
---@param p2 vec2
---@param intersectWithExisting boolean? @Default value: true.
function ui.pushClipRect(p1, p2, intersectWithExisting) end

function ui.popClipRect() end

---@param p1 vec2
---@param p2 vec2
---@param color rgbm
---@param rounding number? @Default value: 0.
---@param roundingFlags integer? @Default value: 15.
---@param thickness number? @Default value: 1.
function ui.drawRect(p1, p2, color, rounding, roundingFlags, thickness) end

---@param p1 vec2
---@param p2 vec2
---@param color rgbm
---@param rounding number? @Default value: 0.
---@param roundingFlags integer? @Default value: 15.
function ui.drawRectFilled(p1, p2, color, rounding, roundingFlags) end

---To quickly draw series of lines and arcs, add points with `ui.PathLineTo()` and `ui.pathArcTo()`, and then finish with `ui.pathStroke()`.
---@param p1 vec2
---@param p2 vec2
---@param color rgbm
---@param thickness number? @Default value: 1.
function ui.drawLine(p1, p2, color, thickness) end

---To quickly draw series of lines and arcs, add points with `ui.PathLineTo()` and `ui.pathArcTo()`, and then finish with `ui.pathStroke()`.
---@param p1 vec2
---@param p2 vec2
---@param p3 vec2
---@param p4 vec2
---@param color rgbm
---@param thickness number? @Default value: 1.
function ui.drawBezierCurve(p1, p2, p3, p4, color, thickness) end

---@param p1 vec2
---@param radius number
---@param color rgbm
---@param numSegments integer? @Default value: 12.
---@param thickness number? @Default value: 1.
function ui.drawCircle(p1, radius, color, numSegments, thickness) end

---@param p1 vec2
---@param radius number
---@param color rgbm
---@param numSegments integer? @Default value: 12.
function ui.drawCircleFilled(p1, radius, color, numSegments) end

---@param p1 vec2
---@param radius vec2
---@param color rgbm
---@param numSegments integer? @Default value: 12.
function ui.drawEllipseFilled(p1, radius, color, numSegments) end

---@param p1 vec2
---@param p2 vec2
---@param p3 vec2
---@param color rgbm
---@param thickness number? @Default value: 1.
function ui.drawTriangle(p1, p2, p3, color, thickness) end

---@param p1 vec2
---@param p2 vec2
---@param p3 vec2
---@param color rgbm
function ui.drawTriangleFilled(p1, p2, p3, color) end

function ac.pathClear() end

---@param pos vec2
function ac.pathLineTo(pos) end

---@param pos vec2
function ac.pathLineToMergeDuplicate(pos) end

---@param color rgbm
function ac.pathFillConvex(color) end

---@param color rgbm
---@param closed boolean|'true'|'false'
---@param thickness number? @Default value: 1.
function ac.pathStroke(color, closed, thickness) end

---@param center vec2
---@param radius number
---@param angleMin number
---@param angleMax number
---@param numSegments integer? @Default value: 10.
function ac.pathArcTo(center, radius, angleMin, angleMax, numSegments) end

---@param center vec2
---@param radius vec2
---@param angleMin number
---@param angleMax number
---@param numSegments integer? @Default value: 10.
function ac.pathUnevenArcTo(center, radius, angleMin, angleMax, numSegments) end

---Uses precomputed angles for a 12 steps circle.
---@param center vec2
---@param radius number
---@param angleMinOf_12 integer
---@param angleMaxOf_12 integer
function ac.pathArcToFast(center, radius, angleMinOf_12, angleMaxOf_12) end

---@param p1 vec2
---@param p2 vec2
---@param p3 vec2
---@param numSegments integer? @Default value: 0.
function ac.pathBezierCurveTo(p1, p2, p3, numSegments) end

---@param rectMin vec2
---@param rectMax vec2
---@param rounding number? @Default value: 0.
---@param roundingCorners ui.CornerFlags? @Default value: ImDrawCornerFlags_All.
function ac.pathRect(rectMin, rectMax, rounding, roundingCorners) end

---Adds a rect to a glowing layer used for styling. All shapes in there are going to be blurred, so just drop something around active element to highlight it.
---@param p1 vec2
---@param p2 vec2
---@param color rgbm
---@param noClip boolean? @Default value: false.
function ui.glowRectFilled(p1, p2, color, noClip) end

---Adds a circle to a glowing layer used for styling. All shapes in there are going to be blurred, so just drop something around active element to highlight it.
---@param p1 vec2
---@param radius number
---@param color rgbm
---@param noClip boolean? @Default value: false.
function ui.glowCircleFilled(p1, radius, color, noClip) end

---Adds an ellipse to a glowing layer used for styling. All shapes in there are going to be blurred, so just drop something around active element to highlight it.
---@param p1 vec2
---@param radius vec2
---@param color rgbm
---@param noClip boolean? @Default value: false.
function ui.glowEllipseFilled(p1, radius, color, noClip) end

function ui.beginTextureSaturationAdjustment() end

---@param value number
function ui.endTextureSaturationAdjustment(value) end

function ui.beginOutline() end

---@param color rgbm
---@param scale number? @Default value: 1.
function ui.endOutline(color, scale) end

function ui.beginSharpening() end

---@param sharpening number? @Default value: 1.
function ui.endSharpening(sharpening) end

function ui.beginRotation() end

---@param deg number
function ui.endRotation(deg) end

---@param deg number
---@param pivot vec2
---@param offset vec2? @Default value: vec2().
function ui.endPivotRotation(deg, pivot, offset) end

function ui.beginScale() end

---@param scale vec2
function ui.endScale(scale) end

function ui.beginTransformMatrix() end

---@param mat mat3x3
function ui.endTransformMatrix(mat) end

---@param count integer? @Default value: 1.
function ui.popStyleVar(count) end

---@param varID ui.StyleColor
---@param value rgbm
function ui.pushStyleColor(varID, value) end

---@param count integer? @Default value: 1.
function ui.popStyleColor(count) end

---@param fontType ui.Font
function ui.pushFont(fontType) end

function ui.popFont() end

---@param itemWidth number
function ui.pushItemWidth(itemWidth) end

function ui.popItemWidth() end

---@param size vec2
---@return boolean
function ui.areaVisible(size) end

---@param p1 vec2
---@param p2 vec2
---@return boolean
function ui.rectVisible(p1, p2) end

---@param p1 vec2
---@param p2 vec2
---@return boolean
function ui.rectHovered(p1, p2) end

---Make last item the default focused item of a window.
function ui.setItemDefaultFocus() end

---Focus keyboard on the next widget. Use positive `offset` to access sub components of a multiple component widget. Use `-1` to access previous widget.
---@param offset integer? @Default value: 0.
function ui.setKeyboardFocusHere(offset) end

---@return number
function ui.getScrollX() end

---@return number
function ui.getScrollY() end

---@return number
function ui.getScrollMaxX() end

---@return number
function ui.getScrollMaxY() end

---@param scrollX number
---@param relative boolean? @Default value: false.
function ui.setScrollX(scrollX, relative) end

---@param scrollY number
---@param relative boolean? @Default value: false.
function ui.setScrollY(scrollY, relative) end

---Adjust scrolling amount to make last item visible. When using to make a default/current item visible, consider using ac.setItemDefaultFocus() instead.
---@param centerXRatio number? @Default value: 0.5.
function ui.setScrollHereX(centerXRatio) end

---Adjust scrolling amount to make last item visible. When using to make a default/current item visible, consider using ac.setItemDefaultFocus() instead.
---@param centerYRatio number? @Default value: 0.5.
function ui.setScrollHereY(centerYRatio) end

---@param flags ui.HoveredFlags? @Default value: ImGuiHoveredFlags_None.
---@return boolean
function ui.windowHovered(flags) end

---@return boolean
function ui.mouseBusy() end

---@param mouseButton ui.MouseButton? @Default value: ui.MouseButton.Left.
---@return boolean
function ui.mouseClicked(mouseButton) end

---@param mouseButton ui.MouseButton? @Default value: ui.MouseButton.Left.
---@return boolean
function ui.mouseDown(mouseButton) end

---@param mouseButton ui.MouseButton? @Default value: ui.MouseButton.Left.
---@return boolean
function ui.mouseDoubleClicked(mouseButton) end

---Returns mouse cursor position on a screen.
---@return vec2 @Mouse cursor position in pixels, or (-1, -1) if mouse is not available.
function ui.mousePos() end

---Returns mouse cursor position relative to current app/window.
---@return vec2 @Mouse cursor position in pixels, or (-1, -1) if mouse is not available.
function ui.mouseLocalPos() end

---Returns position of current window in screen-space/texture-space (`ui.beginChild()` returns a new window).
---@return vec2
function ui.windowPos() end

---Returns size of current window.
---@return vec2
function ui.windowSize() end

---Size of contents/scrollable client area (calculated from the extents reach of the cursor) from previous frame. Does not include window decoration or window padding.
---@return vec2
function ui.windowContentSize() end

---Size of contents/scrollable client area explicitly request by the user via `ui.setNextWindowContentSize()`.
---@return vec2
function ui.windowContentExplicitSize() end

---Set next window content size (scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. Set an axis to 0 to leave it automatic. Call before `ui.beginChild()`.
---@param size vec2
function ui.setNextWindowContentSize(size) end

---Is key being held.
---@param keyIndex ui.KeyIndex
---@return boolean
function ui.keyboardButtonDown(keyIndex) end

---Was key pressed (went from `not down` to `down`). If `with_repeat` is true, uses configured repeat delay and rate.
---@param keyIndex ui.KeyIndex
---@param withRepeat boolean? @Default value: true.
---@return boolean
function ui.keyboardButtonPressed(keyIndex, withRepeat) end

---Was key released (went from `down` to `not down`).
---@param keyIndex ui.KeyIndex
---@return boolean
function ui.keyboardButtonReleased(keyIndex) end

---Provides access to few buttons with certain UI roles.
---@param keyCode ui.Key
---@return boolean
function ui.keyPressed(keyCode) end

---Returns true if Ctrl is pressed, but Shift, Alt and Super/Win are depressed.
---@return boolean
function ui.hotkeyCtrl() end

---Returns true if Alt is pressed, but Ctrl, Shift and Super/Win are depressed.
---@return boolean
function ui.hotkeyAlt() end

---Returns true if Shift is pressed, but Ctrl, Alt and Super/Win are depressed.
---@return boolean
function ui.hotkeyShift() end

---@param text string
---@param letter vec2
---@param marginOffset number? @Default value: 0.
---@param color rgbm? @Default value: rgbm.colors.white.
---@param lineSpace number? @Default value: 0.
function ui.acText(text, letter, marginOffset, color, lineSpace) end

---@param name string
function ui.pushACFont(name) end

function ui.popACFont() end

---Adds new TTF font to the stack to be used for drawing DWrite text later. Fonts are taken from “content/fonts” and “extension/fonts”, but scripts
---can also use their own TTF files. To do so, use `"Font Name:path/to/file.ttf"` or `"Font Name:path/to/directory"`, path can be absolute, relative
---to script folder or AC root folder. Font name can also use styling attributes, such as `Weight=Thin`, `Style=Italic` or `Stretch=Condensed`, listed
---at the end after a “;” like so:
---```
---ui.pushDWriteFont('My Font:myfont.ttf;Weight=Bold;Style=Oblique;Stretch=Expanded')
---```
---To make things simpler, you can also use `ac.DWriteFont` helper, it provides nice methods to set attributes.
---@param name string? @Font name, or `"name:path.ttf"`, with optional styling attributes. You can use `ac.DWriteFont` helper here. Default value: "Segoe UI".
function ui.pushDWriteFont(name) end

---Removes latest TTF font from the stack.
function ui.popDWriteFont() end

---Draws some text using TTF font with DirectWrite library. Make sure to set a font first using `ui.pushDWriteFont()`.
---@param text string
---@param fontSize number? @Default value: 14.
---@param color rgbm? @Default value: rgbm.colors.white.
function ui.dwriteText(text, fontSize, color) end

---Draws wrapped text using TTF font with DirectWrite library. Make sure to set a font first using `ui.pushDWriteFont()`.
---@param text string
---@param fontSize number? @Default value: 14.
---@param color rgbm? @Default value: rgbm.colors.white.
function ui.dwriteTextWrapped(text, fontSize, color) end

---Draws some aligned text using TTF font with DirectWrite library. Make sure to set a font first using `ui.pushDWriteFont()`.
---@param text string
---@param fontSize number? @Default value: 14.
---@param horizontalAligment ui.Alignment? @Ac.Alignment.Start for left, ac.Alignment.Center for middle, ac.Alignment.End for right. Default value: alignment::center.
---@param verticalAlignment ui.Alignment? @Ac.Alignment.Start for top, ac.Alignment.Center for middle, ac.Alignment.End for bottom. Default value: alignment::center.
---@param size vec2? @Set to 0 to use remaining space, set to negative value to use it as margin (positive) from remaining space. Default value: vec2().
---@param allowWordWrapping boolean? @Default value: false.
---@param color rgbm? @Default value: rgbm.colors.white.
function ui.dwriteTextAligned(text, fontSize, horizontalAligment, verticalAlignment, size, allowWordWrapping, color) end

function ui.popID() end

---@return boolean
function ui.anyItemHovered() end

---@return boolean
function ui.anyItemActive() end

---@return boolean
function ui.anyItemFocused() end

---@return boolean
function ui.itemVisible() end

---@return boolean
function ui.itemActive() end

---@return boolean
function ui.itemActivated() end

---@return boolean
function ui.itemFocused() end

---@return integer
function ui.getLastID() end

---@return integer
function ui.getActiveID() end

---@return integer
function ui.getFocusID() end

---@return integer
function ui.getHoveredID() end

function ui.clearActiveID() end

---@param id integer
function ui.activateItem(id) end

---@param columns integer? @Default value: 1.
---@param border boolean? @Default value: true.
---@param id string? @Default value: nullptr.
function ui.columns(columns, border, id) end

function ui.nextColumn() end

---@param columnIndex integer
---@param width number
function ui.setColumnWidth(columnIndex, width) end

---@param label string
---@param size vec2? @Default value: vec2().
---@param flags ui.ButtonFlags? @Default value: ImGuiButtonFlags_None.
---@return boolean
function ui.button(label, size, flags) end

---Button without frame padding to easily embed within text.
---@param label string
---@return boolean
function ui.smallButton(label) end

---Button behavior without the visuals, frequently useful to build custom behaviors using the public API (along with `ui.itemActive()`, `ui.itemHovered()`, etc.).
---@param label string
---@param size vec2? @Default value: vec2().
---@return boolean
function ui.invisibleButton(label, size) end

---Square button with an arrow shape.
---@param strID string
---@param dir ui.Direction
---@param size vec2? @Default value: vec2().
---@param flags ui.ButtonFlags? @Default value: ImGuiButtonFlags_None.
---@return boolean
function ui.arrowButton(strID, dir, size, flags) end

---Draw a small circle and keep the cursor on the same line.
function ui.bullet() end

---Separator, generally horizontal. Inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
function ui.separator() end

---@param label string
---@param checked refbool
---@return boolean
function ui.checkbox(label, checked) end

---@param label string
---@param checked refbool
---@return boolean
function ui.radioButton(label, checked) end

---@param label string
---@param color rgbm
---@param flags ui.ColorPickerFlags? @Default value: ImGuiColorEditFlags_None.
---@param size vec2? @Default value: vec2().
---@return boolean
function ui.colorButton(label, color, flags, size) end

---@param fraction number
---@param size vec2? @Default value: vec2().
---@param overlay string? @Default value: nullptr.
function ui.progressBar(fraction, size, overlay) end

---@param width number
function ui.setNextItemWidth(width) end

---It’s safer to use `ui.combo()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param label string
---@param previewValue string
---@param flags ui.ComboFlags? @Default value: ImGuiComboFlags_None.
---@return boolean
function ui.beginCombo(label, previewValue, flags) end

---@param label string
---@param selected refbool
---@param flags ui.SelectableFlags? @Default value: ImGuiSelectableFlags_None.
---@param size vec2? @Default value: vec2().
---@return boolean
function ui.selectable(label, selected, flags, size) end

function ui.endCombo() end

---It’s safer to use `ui.childWindow()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param id string
---@param size vec2? @Default value: vec2().
---@param border boolean? @Default value: false.
---@param flags ui.WindowFlags? @Default value: ImGuiWindowFlags_NoBackground.
---@return boolean
function ui.beginChild(id, size, border, flags) end

function ui.endChild() end

---It’s safer to use `ui.tabBar()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param id string
---@param flags ui.TabBarFlags? @Default value: ImGuiTabBarFlags_None.
---@return boolean
function ui.beginTabBar(id, flags) end

function ui.endTabBar() end

---It’s safer to use `ui.tabBarItem()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param label string
---@param flags ui.TabItemFlags? @Default value: ImGuiTabItemFlags_None.
---@return boolean
function ui.beginTabItem(label, flags) end

function ui.endTabItem() end

---It’s safer to use `ui.treeNode()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param label string
---@param flags ui.TreeNodeFlags? @Default value: ImGuiTreeNodeFlags_Framed.
---@return boolean
function ui.beginTreeNode(label, flags) end

function ui.endTreeNode() end

---It’s safer to use `ui.itemPopup()`: a wrapper that would ensure UI wouldn’t break even if Lua script would crash midway for any reason.
---@param id string
---@param mouse integer? @Default value: 1.
---@return boolean
function ui.beginPopupContextItem(id, mouse) end

function ui.endPopup() end

---@param text string
function ui.header(text) end

---@param text string
function ui.bulletText(text) end

---@param tooltip string
function ui.setTooltip(tooltip) end

---@return boolean
function ui.itemHovered() end

---@return boolean
function physics.allowed() end

---@param pos vec3
---@param dir vec3
---@param length number
---@param point vec3
---@param normal vec3
---@return number
function physics.raycastTrack(pos, dir, length, point, normal) end

---@param key string
---@return string
function web.encryptKey(key) end


--[[ ac_track_script.lua ]]

---Track condition evaluator. Given expression, which might refer to some existing condition, condition input or a complex expression of those,
---computes the resulting value.
---@param expression string @Expression similar to ones config have as CONDITION=… value.
---@param offset number @Condition offset. Default value: 0.
---@param defaultValue number @Default value in case referenced condition is missing or parsing failed. Default value: 0.
---@return ac.TrackCondition
function ac.TrackCondition(expression, offset, defaultValue) end

---Track condition evaluator. Given expression, which might refer to some existing condition, condition input or a complex expression of those,
---computes the resulting value.
---@class ac.TrackCondition
local _ac_TrackCondition = nil

---@return number
function _ac_TrackCondition:get() end

---@return rgb
function _ac_TrackCondition:getColor() end

---@return boolean
function _ac_TrackCondition:isDynamic() end

---Finds a car at a given place in a race, for creating leaderboards. Returns nil if couldn’t find a car.
---@param place integer @Starts with 1 for first place.
---@return ac.StateCar|nil
function ac.findCarAtPlace(place) end

---@type ac.StateSim
sim = nil

---@class ScriptData
---@single-instance
script = {}

---For `[SCRIPTABLE_DISPLAY_...]` called when display updates. For `[SCRIPT_...]` called when sim updates.
---@param dt number @Time passed since last `update()` call, in seconds.
function script.update(dt) end

---Only for `[SCRIPT_...]`. Called when rendering transparent objects (which are rendered after opaque objects). Draw any of your own debug shapes here.
function script.draw3D() end

---Only for `[SCRIPT_...]`. Called at the beginning of a frame, before all rendering starts. If you want to move things, `script.update()` might be a better option.
---This one is only if you’d find that `script.update()` happens a bit too early for you.
---@param dt number @How much time has passed since last call, in seconds.
---@param gameDT number @How much time has passed in simulation (slower with slow-mo replays, 0 when paused), in seconds.
function script.frameBegin(dt, gameDT) end

---Only for `[SCRIPT_...]`. Called when replay starts. If you have any race-only things happening, like maybe a safe car animation, that would be the good
---time to hide them.
---
---(Some API to record things into replay and play them back will be added later, hopefully.)
function script.onReplayStart() end

---Only for `[SCRIPT_...]`. Called when replay stops. If you have any race-only things happening, like maybe a safe car animation, that would be the good
---time to show them back (if you hid them in `script.onReplayStart()`).
---
---(Some API to record things into replay and play them back will be added later, hopefully.)
function script.onReplayStop() end

--[[ common/ac_audio.lua ]]

---Audio event is a audio emitter which uses a certain event from one of loaded FMOD soundbanks.
---@param eventName string @Event name, for example, `'/cars/lada_revolution/door'` (leading “/” or “event:” prefix are optional).
---@param reverbResponse boolean|'true'|'false' @Set to true if audio event should be affected by reverb in tunnels and such.
---@return ac.AudioEvent
function ac.AudioEvent(eventName, reverbResponse) end

---Audio event is a audio emitter which uses a certain event from one of loaded FMOD soundbanks.
---@class ac.AudioEvent
---@field volume number @Audio volume, from 0 to 1 (can go above too, but clipping might occur). Default value: 1.
---@field pitch number @Audio pitch. Default value: 1.
---@field cameraInteriorMultiplier number @Multiplier for audio volume with interior camera. Default value: 0.25.
---@field cameraExteriorMultiplier number @Multiplier for audio volume with exterior (chase or free, for example) camera. Default value: 1.
---@field cameraTrackMultiplier number @Multiplier for audio volume with track camera (those replay cameras with low FOV). Default value: 1.
---@field inAutoLoopMode number @If set to `true`, aduio event would automatically start when in range of camera and volume is above 0. Default value: false.
local _ac_AudioEvent = nil

---Sets audio event orientation.
---@param pos vec3 @Position. If you’re working on a car script, position is relative to car position.
---@param dir vec3|nil @Direction. If missing, forwards vector is used.
---@param up vec3|nil @Vector directed up for full 3D orientation.
---@param vel vec3|nil @Velocity of audio source. If missing, sound is stationary. If you’re working on a car script, velocity is relative to car velocity.
function _ac_AudioEvent:setPosition(pos, dir, up, vel) end

---Deprecated, now all events are alive until `:dispose()` is called.
---@deprecated
function _ac_AudioEvent:keepAlive() end

---Set value of an audio event parameter.
---@param name string
---@param value number
function _ac_AudioEvent:setParam(name, value) end

---Returns `true` if event is loaded successfully. If event does not load, make sure soundbank is loaded first, and that event name is correct.
---@return boolean
function _ac_AudioEvent:isValid() end

---Returns `true` if audio event is playing.
---@return boolean
function _ac_AudioEvent:isPlaying() end

---Returns `true` if audio event is paused.
---@return boolean
function _ac_AudioEvent:isPaused() end

---Return `true` if audio event is within hearing range of current listener. Could be a good way to pause some expensive processing
---for distant audio events. Although in general comparing distance with a threshold on Lua side with vectors might be faster (without
---going Lua→CSP→FMOD and back).
---@return boolean
function _ac_AudioEvent:isWithinRange() end

function _ac_AudioEvent:resume() end

---If condition is `true`, start an audio event if it’s stopped, resume it if it’s paused. If condition is false, stop audio event.
---@param condition boolean|'true'|'false'
function _ac_AudioEvent:resumeIf() end

---Stop audio event.
function _ac_AudioEvent:stop() end

---Start audio event.
function _ac_AudioEvent:start() end

---If you need to move audio event often, accessing its matrix directly might be the best way. But you have to be extra careful in
---making sure matrix is always normalized (vectors `side`, `up` and `look` should be othrogonal with lengths of 1), otherwise
---audio might sound strange, with rapid changes in volume.
---@return mat4x4
function _ac_AudioEvent:getTransformationRaw() end

---Stop and remove audio event.
function _ac_AudioEvent:dispose() end

--[[ common/ac_light.lua ]]

---Light source on the scene. Starts working immediattely after creation. Use `:dispose()` to remove it.
---@param lightType ac.LightType
---@param position vec3
---@return ac.LightSource
function ac.LightSource(lightType, position) end

---Light source on the scene. Starts working immediattely after creation. Use `:dispose()` to remove it.
---@class ac.LightSource
---@field lightType ac.LightType @Type of light source.
---@field position vec3 @Light position.
---@field color rgb @Light color, go above 1 to make it brighter.
---@field specularMultiplier number @Specular multiplier. Lights with it set to 0 might be a bit faster to render, especially line lights.
---@field diffuseConcentration number @Diffuse concentration. If set to 1, surfaces facing perpendicular from light source would not get lit. If lower, they’d get more and more lit, and with 0 they’d get fully lit.
---@field singleFrequency number @Increase for single-frequency effect where only surfaces with colors matching that of light source would get illuminated.
---@field range number @Range in meters.
---@field rangeGradientOffset number @Point in range at which light would start to fade, from 0 to 1. Generally lights look better with it set to 0, but if you’re trying to keep range low and light bright, sometimes it helps to be able to increase it.
---@field fadeAt number @Distance in meters at which light fades (at that distance, it would have half of its original intensity).
---@field fadeSmooth number @Distance range in which light fades. Light starts fading at `fadeAt - fadeSmooth/2` and is fully gone at `fadeAt + fadeSmooth/2`.
---@field direction vec3 @Light direction.
---@field spot number @Spot angle in degrees, if set to 0, light works like a point light. Can misbehave if set above 350° (it can be above 180°, but keep in mind, anything above 170° wouldn’t really get any dynamic shadows).
---@field spotSharpness number @Spot sharpness. At 1, edges of spotlight are fully sharp. At 0, only point that is lit to 100% is the one in the center of light spot cone.
---@field linePos vec3 @For line lights, this is a secondary position (first is `position`).
---@field lineColor rgb @For line lights, this is a secondary color (first is `color`).
---@field volumetricLight boolean @Enable volumetric light effect (requires ExtraFX to work).
---@field skipLightMap boolean @Exclude light from bounced light effect of ExtraFX (the one where light bounces from horizontal surfaces around).
---@field affectsCars boolean @If set to `false`, light would not affect cars, can speed things up slightly.
---@field showInReflections boolean @If set to `false`, light would not appear in reflection cubemap speeding things up.
---@field longSpecular number @Controls long specular effect of ExtraFX (requires SSLR), which produces extra long going outside of light range speculars on wet surfaces.
---@field shadows boolean @Use dynamic shadows.
---@field shadowsStatic boolean @Static dynamic shadows exclude any dynamic objects, so they need a much lower refresh rate.
---@field shadowsHalfResolution boolean @Half-resolution dynamic shadows for extra blurriness.
---@field shadowsSpot number @If your spotlight is too wide and you can’t reduce it, alternatively you can use a lower spot angle for shadows alone. Wouldn’t look that great though sometimes.
---@field shadowsRange number @Range of shadows, by default matches range of light source. Because those are exponential shadow maps, adjusting it might help with visual quality.
---@field shadowsBoost number @Intensity boost for exponential shadow maps.
---@field shadowsExponentialFactor number @Exponential factor for exponential shadow maps.
---@field shadowsClipPlane number @Anything closer than this value would not appear in shadow maps (works like a clipping plane perpendicular to light direction).
---@field shadowsClipSphere number @Anything closer than this value would not appear in shadow maps (works like a clipping sphere around light position).
---@field shadowsCullMode render.CullMode @Culling mode for shadows. With exponential shadow maps it’s better not to do any culling, but just in case.
---@field shadowsOffset vec3 @Offset for shadow map camera position relative to light position. Might not look that pretty, so use with caution.
local _ac_LightSource = nil

---Doesn’t do anything, kept for compatibility.
---@deprecated
function _ac_LightSource:keepAlive() end

---Removes light from the scene.
function _ac_LightSource:dispose() end

--[[ common/ac_render.lua ]]

---Render namespace for drawing custom shapes and other stuff like that.
render = {}

--[[ common/ac_ray.lua ]]

---Ray for simple geometric raycasting. Do not create ray manually, instead use `render.createRay(pos, dir, length)` or `render.createMouseRay()`.
---Do not alter position and direction directly, or, if you do, do not cast it against lines or triangles, it stores some other precomputed values
---for faster and more accurate raycasting.
---@class ray
---@field pos vec3 @Ray origin.
---@field dir vec3 @Ray direction.
---@field length number @Ray length (used for physics raycasting, shorter rays are faster).
local ray = nil

---Ray/AABB intersection.
---@param min vec3 @AABB min corner.
---@param max vec3 @AABB max corner.
---@return boolean @True if there was an intersection.
function ray:aabb(min, max) end

---Ray/thick line intersection.
---@param from vec3 @Line, starting point.
---@param to vec3 @Line, finishing point.
---@param width number @Line width.
---@return number @Intersection distance, or -1 if there was no intersection.
function ray:line(from, to, width) end

---Ray/triangle intersection.
---@param p1 vec3 @Triangle, point A.
---@param p2 vec3 @Triangle, point B.
---@param p3 vec3 @Triangle, point C.
---@return number @Intersection distance, or -1 if there was no intersection.
function ray:triangle(p1, p2, p3) end

---Ray/sphere intersection.
---@param center vec3 @Sphere, center.
---@param radius number @Sphere, radius.
---@return number @Intersection distance, or -1 if there was no intersection.
function ray:sphere(center, radius) end

---Ray/track intersection.
---@return number @Intersection distance, or -1 if there was no intersection.
function ray:track() end

---Ray/scene intersection (both with track and cars).
---@return number @Intersection distance, or -1 if there was no intersection.
function ray:scene() end

---Ray/cars intersection.
---@return number @Intersection distance, or -1 if there was no intersection.
function ray:cars() end

---Ray/physics meshes intersection.
---@param outPosition vec3 @Optional vec3 to which contact point will be written.
---@param outNormal vec3 @Optional vec3 to which contact normal will be written.
---@return number @Intersection distance, or -1 if there was no intersection.
function ray:physics(outPosition, outNormal) end

---Distance between ray and a point.
---@param p vec3 @Point.
---@return number @Distance.
function ray:distance(p) end

--[[ common/ac_positioning_helper.lua ]]

---@return render.PositioningHelper
function render.PositioningHelper() end

---@class render.PositioningHelper
local _render_PositioningHelper = nil

---@param pos vec3
---@param forceInactive boolean|'true'|'false' @Prevents PositioningHelper from moving.
---@return boolean
function _render_PositioningHelper:render(pos, forceInactive) end

---@param pos vec3
---@param look vec3
---@param forceInactive boolean|'true'|'false' @Prevents PositioningHelper from moving.
---@return boolean
function _render_PositioningHelper:renderAligned(pos, look, forceInactive) end

---@param pos vec3
---@param look vec3
---@param up vec3
---@param forceInactive boolean|'true'|'false' @Prevents PositioningHelper from moving.
---@return boolean
function _render_PositioningHelper:renderFullyAligned(pos, look, up, forceInactive) end

---@return boolean
function _render_PositioningHelper:anyHighlight() end

---@return boolean
function _render_PositioningHelper:movingInScreenSpace() end

--[[ common/ac_ui.lua ]]

---Very simple thing for smooth UI animations. Call it with a number for its initial state and it would
---return you a function. Each frame, call this function with your new target value and it would give you
---a smoothly changing numerical value. Unlike functions like `math.applyLag()`, this one is a bit more
---complicated, taking into account velocity as well.
---@param initialValue number @Initial value with which animation will start.
---@return fun(target: number): number
function ui.SmoothInterpolation(initialValue) end

---Another simple helper for easily creating elements fading in and out. Just pass it a draw callback and
---and initial state (should it be visible or not), and then call returned function every frame passing it
---a boolean to specify if item should be visible or not. Example:
---```
---local timeLeft = 120
---
---local function drawTimeLeft()
---  ui.text(string.format('Time left: %02.0f', math.max(0, timeLeft)))
---  -- keep in mind: when timer would reach 0, block would still be visible for a bit while fading out, so
---  -- that’s why there is that `math.max()` call
---end
---
---local fadingTimer = ui.FadingElement(drawTimeLeft)
---
---function script.update(dt)
---  timeLeft = timeLeft - dt
---  fadingTimer(timeLeft > 0 and timeLeft < 60)  -- only show timer if time left is below 60 seconds
---end
---```
---@param drawCallback fun() @Draw callback. Would only be called if alpha is above 0.2%, so there is no overhead if element is hidden.
---@param initialState boolean|'true'|'false' @Should element be visible from the start. Default value: false.
---@return fun(state: boolean)
function ui.FadingElement(drawCallback, initialState) end

---@param name string @Name of the font, should be the name you can see when, for example, opening font with Windows Font Viewer (and not the name of the file).
---@param dir string|nil @Optionally, path to a directory with TTF files in it. If provided, instead of looking for font in “content/fonts” and “extension/fonts”, CSP will scan given folder. Alternatively you can also use a path to a file here too, if you know for sure which file it’ll be (with TTF, different styles often go in different files).
---@return ui.DWriteFont
ui.DWriteFont = function (name, dir) end

---DirectWrite font name builder. Instead of using it, you can simply provide a string, but this thing might be a nicer way. You can chain its methods too:
---```
---local MyFavouriteFont = ui.DWriteFont('Best Font', './data'):weight(ui.DWriteFont.Weight.Bold):style(ui.DWriteFont.Style.Italic):stretch(ui.DWriteFont.Stretch.Condensed)
---…
---ui.pushFont(MyFavouriteFont)  -- you could also just put font here, but if defined once and reused, it would generate less garbage for GC to clean up.
---ui.dwriteText('Hello world!', 14)
---ui.popFont()
---```
---@class ui.DWriteFont
local _uiDWriteFont = {}

---Set font weight. Bold styles can be emulated even if there isn’t such font face, although quality of real font face would be better.
---@param weight ui.DWriteFont.Weight
function _uiDWriteFont:weight(weight)
  self._weight = weight
  self._fullName = nil
  return self
end

---Set font style. Italic style can be emulated even if there isn’t such font face, although quality of real font face would be better.
---@param style ui.DWriteFont.Style
function _uiDWriteFont:style(style)
  self._style = style
  self._fullName = nil
  return self
end

---Set font stretch.
---@param stretch ui.DWriteFont.Stretch
function _uiDWriteFont:stretch(stretch)
  self._stretch = stretch
  self._fullName = nil
  return self
end

---Disable font size rounding. Please use carefully: if you would to animate font size, it would quickly generate way too many atlases
---and increase both VRAM consumption and drawing time. If you need to animate font size, consider instead using `ui.beginScale()`/`ui.endScale()`.
function _uiDWriteFont:allowRealSizes()
  self._allowRealSizes = true
  self._fullName = nil
  return self
end

--[[ common/ac_ui.lua ]]

---UI namespace for creating custom widgets or drawing dynamic textures using IMGUI.
ui = {}

---Push style variable.
---@param varID ui.StyleVar
---@param value number|vec2
function ui.pushStyleVar(varID, value) end

---Push ID (use it if you, for example, have a list of buttons created in a loop).
---@param value number|string
function ui.pushID(value) end

---Text input control. Returns updated string (which would be the input string unless it changed, so no)
---copying there. Second return value would change to `true` when text has changed. Example:
---```
---myText = ui.inputText('Enter something:', myText)
---```
---@param label string
---@param str string
---@param flags ui.InputTextFlags
---@return string
---@return boolean
function ui.inputText(label, str, flags) end

---Color picker control. Returns true if color has changed (as usual with Lua, colors are passed)
---by reference so update value would be put in place of old one automatically.
---@param label string
---@param color rgb|rgbm
---@param flags ui.ColorPickerFlags
---@return boolean
function ui.colorPicker(label, color, flags) end

---Show popup message.
---@param icon ui.Icons
---@param message string
---@param undoCallback fun() @If provided, there’ll be an undo button which, when clicked, will call this callback.
function ui.toast(icon, message, undoCallback) end

---Draw a window with transparent background.
---@generic T
---@param id string @Window ID, has to be unique within your script.
---@param pos vec2 @Window position.
---@param size vec2 @Window size.
---@param content fun(): T @Window content callback.
---@return T
function ui.transparentWindow(id, pos, size, content) end

---Draw a window with semi-transparent background.
---@generic T
---@param id string @Window ID, has to be unique within your script.
---@param pos vec2 @Window position.
---@param size vec2 @Window size.
---@param content fun(): T @Window content callback.
---@return T
function ui.toolWindow(id, pos, size, content) end

---Draw a child window: perfect for clipping content, for scrolling lists, etc. Think of it more like
---a HTML div with overflow set to either scrolling or hidden, for example.
---@generic T
---@param id string @Window ID, has to be unique within given context (like, two sub-windows of the same window should have different IDs).
---@param size vec2 @Window size.
---@param border boolean|'true'|'false' @Window border.
---@param flags ui.WindowFlags @Window flags.
---@param content fun(): T @Window content callback.
---@return T
function ui.childWindow(id, size, border, flags, content) end

---Draw a tree node element: a collapsible block with content inside it (which might include other tree
---nodes). Great for grouping things together. Note: if you need to have a tree node with changing label,
---use label like “your changing label###someUniqueID” for it to work properly. Everything after “###” will
---count as ID and not be shown. Same trick applies to other controls as well, such as tabs, buttons, etc.
---@generic T
---@param label string @Tree node label (which also acts like its ID).
---@param flags ui.TreeNodeFlags @Tree node flags.
---@param content fun(): T @Tree node content callback (called only if tree node is expanded).
---@return T
function ui.treeNode(label, flags, content) end

---Draw a section with tabs. Inside, use `ui.tabItem()` to draw actual tabs like so:
---```
---ui.tabBar('someTabBarID', function ()
---  ui.tabItem('Tab 1', function () --[[ Contents of Tab 1 ]] end)
---  ui.tabItem('Tab 2', function () --[[ Contents of Tab 2 ]] end)
---end)
---```
---@generic T
---@param id string @Tab bar ID.
---@param flags ui.TabBarFlags @Tab bar flags.
---@param content fun(): T @Individual tabs callback.
---@return T
function ui.tabBar(id, flags, content) end

---Draw a new tab in a tab bar. Note: if you need to have a tab with changing label,
---use label like “your changing label###someUniqueID” for it to work properly. Everything after “###” will
---count as ID and not be shown. Same trick applies to other controls as well, such as tree nodes, buttons, etc.
---```
---ui.tabBar('someTabBarID', function ()
---  ui.tabItem('Tab 1', function () --[[ Contents of Tab 1 ]] end)
---  ui.tabItem('Tab 2', function () --[[ Contents of Tab 2 ]] end)
---end)
---```
---@generic T
---@param label string @Tab label.
---@param flags ui.TabItemFlags @Tab flags.
---@param content fun(): T @Tab content callback (called only if tab is selected).
---@return T
function ui.tabItem(label, flags, content) end

---Adds context menu to previously drawn item which would open when certain mouse button would be pressed. Once it happens,
---content callback will be called each frame to draw contents of said menu.
---```
---ui.itemPopup(ui.MouseButton.Right, function ()
---  if ui.selectable('Item 1') then --[[ Item 1 was clicked ]] end
---  if ui.selectable('Item 2') then --[[ Item 2 was clicked ]] end
---  ui.separator()
---  if ui.selectable('Item 3') then --[[ Item 3 was clicked ]] end
---  -- Other types of controls would also work
---end)
---```
---@generic T
---@param id string @Context menu ID.
---@param mouseButton ui.MouseButton @Mouse button
---@param content fun(): T @Menu content callback (called only if menu is opened).
---@return T
---@overload fun(id: string, content: fun())
---@overload fun(mouseButton: ui.MouseButton, content: fun())
---@overload fun(content: fun())
function ui.itemPopup(id, mouseButton, content) end

---Adds a dropdown list (aka combo box). Items are drawn in content callback function, or alternatively
---it can work with a list of strings and an ID of a selected item, returning either ID of selected item and
---boolean with `true` value if it was changed, or if ID is a refnumber, it would just return a boolean value
---for whatever it was changed or not.
---@generic T
---@param label string @Label of the element.
---@param previewValue string? @Preview value.
---@param flags ui.ComboFlags? @Combo box flags.
---@param content fun(): T @Combo box items callback.
---@return T
---@overload fun(label: string, selectedIndex: integer, flags: ui.ComboFlags, content: string[]): integer, boolean
---@overload fun(label: string, selectedIndex: refnumber, flags: ui.ComboFlags, content: string[]): boolean
function ui.combo(label, previewValue, flags, content) end

---Adds a slider. For value, either pass `refnumber` and slider would return a single boolean with `true` value
---if it was moved (and storing updated value in passed `refnumber`), or pass a regular number and then
---slider would return number and then a boolean. Example:
---```
----- With refnumber:
---local ref = refnumber(currentValue)
---if ui.slider('Test', ref) then currentValue = ref.value end
---
----- Without refnumber:
---local value, changed = ui.slider('Test', currentValue)
---if changed then currentValue = value end
---
----- Or, of course, if you don’t need to know if it changed:
---currentValue = ui.slider('Test', currentValue)
---```
---I personally prefer to hide slider label and instead use its format string to show what’s it for. IMGUI would
---not show symbols after “##”, but use them for ID calculation.
---```
---currentValue = ui.slider('##someSliderID', currentValue, 0, 100, 'Quantity: %.0f')
---```
---By the way, a bit of clarification: “##” would do
---that, but “###” would result in ID where only symbols going after “###” are taken into account. Helps if you
---have a control which label is constantly changing. For example, a tab showing a number of elements or current time.
---
---To enter value with keyboard, hold Ctrl and click on it.
---@param label string @Slider label.
---@param value refnumber @Current slider value.
---@param min number @Default value: 0.
---@param max number @Default value: 1.
---@param format string|'%.3f' @C-style format string. Default value: '%.3f'.
---@param power number @Power for non-linear slider. Default value: 1 (linear).
---@return boolean @True if slider has moved.
---@overload fun(label: string, value: number, min: number, max: number, format: string, power: number): number, boolean
function ui.slider(label, value, min, max, format, power) end

--[[ common/ac_storage.lua ]]

---@class ac.StoredValue
local _ac_StoredValue = {}

---@return string|number|boolean|vec2|vec3|vec4|rgb|rgbm
function _ac_StoredValue:get() end

---@param value string|number|boolean|vec2|vec3|vec4|rgb|rgbm
function _ac_StoredValue:set(value) end

---Storage function. Easiest way to use is to pass it a table with default values — it would give you a table back
---which would load values on reads and save values on writes. Values have to be either strings, numbers, booleans,
---vectors or colors. Example:
---```
---local storedValues = ac.storage{
---  someKey = 15,
---  someStringValue = 20
---}
---storedValues.someKey = 20
---```
---Alternatively, you can use it as a function which would take a key and default value and return you an
---`ac.StoredValue` wrapper with methods `:get()` and `:set(newValue)`:
---```
---local stored = ac.storage('someKey', 15)
---stored:get()
---stored:set(20)
---```
---Or, just access it directly in `localStorage` style of JavaScript. Similar to JavaScript, this way you can only store
---strings:
---```
---ac.storage.key = 'value'
---ac.debug('loaded', ac.storage.key)
---```
---Data will be saved in “Documents\Assetto Corsa\cfg\extension\state\lua”, in corresponding subfolder. Actual writing
---will happen a few seconds after new value was pushed, and only if value was changed, so feel free to use this function
---to write things often.
---@generic T
---@param layout T
---@return T
---@overload fun(key: string, value: string|number|boolean|vec2|vec3|vec4|rgb|rgbm): ac.StoredValue
function ac.storage(layout) end

--[[ common/ac_scene.lua ]]

---Reference to one or several objects in scene. Works similar to those jQuery things which would refer to one or
---several of webpage elements. Use methods like `ac.findNodes()` to get one. Once you have a reference to some nodes,
---you can load additional KN5s, create new nodes and such in it.
---Note: it might be beneficial in general to prefer methods like `ac.findNodes()` and `ac.findMeshes()` over `ac.findAny()`.
---Should be fewer surprises this way.
---@class ac.SceneReference
local _ac_SceneReference = nil

---Dispose any resources associated with this ac.SceneReference and empty it out. Use it if you need to remove a previously
---created node or a loaded KN5.
function _ac_SceneReference:dispose() end

---Set material property. Be careful to match the type (you need the same amount of numeric values). If you’re using boolean,-
---resulting value will be either 1 or 0.
---@param property string|"'ksEmissive'"
---@param value number|vec2|vec3|rgb|vec4|rgbm|boolean
function _ac_SceneReference:setMaterialProperty(property, value) end

---Set material texture. Three possible uses:
---
---1. Pass color to create a new solid color texture:
---  ```
---  meshes:setMaterialTexture('txDiffuse', rgbm(1, 0, 0, 1)) -- for red color
---  ```
---2. Pass filename to load a new texture. Be careful, it would load texture syncronously unless it
---  was loaded before:
---  ```
---  meshes:setMaterialTexture('txDiffuse', 'filename.dds')
---  ```
---3. Pass a table with parameters to draw a texture in a style of scriptable displays. Be careful as to
---  not call it too often, make sure to limit refresh rate unless you really need a quick update. If you’re
---  working on a track script, might also be useful to check if camera is close enough with something like
---  ac.getSim().cameraPosition:closerToThan(display coordinates, some distance)
---  ```
---  meshes:setMaterialTexture('txDiffuse', {
---    textureSize = vec2(1024, 1024), -- although optional, I recommend to set it: skin could replace texture by one with different resolution
---    background = rgbm(1, 0, 0, 1),  -- set to nil (or remove) to reuse original texture as background, set to skip background preparation completely
---    region = {                      -- if not set, whole texture will be repainted
---        from = vec2(200, 300),
---        size = vec2(400, 400)
---    },
---    callback = function (dt)
---      display.rect{ pos = …, size = …, … }
---    end
---  })
---  ```
---@param texture string|"'txDiffuse'"|"'txNormal'"|"'txEmissive'"|"'txMaps'" @Name of a texture slot.
---@param value {callback: fun(dt: number), textureSize: vec2, region: {from: vec2, size: vec2}, background: rgbm|boolean|nil}|"{\n  callback = function (dt)  end,\n  textureSize = vec2(512, 512),\n  region = {\n    from = vec2(0, 0),\n    size = vec2(512, 512)\n  },\n  background = nil\n}"
---@overload fun(texture: string, value: string)
---@overload fun(texture: string, value: rgbm)
function _ac_SceneReference:setMaterialTexture(texture, value) end

---Ensures all materials are unique, allowing to alter their textures and material properties without affecting the rest of the scene. Only
---ensures uniqueness relative to the rest of the scene. For example, if it refers to two meshes using the same material, they’ll continue
---to share material, but it would be their own material, separate from the scene.
function _ac_SceneReference:ensureUniqueMaterials() end

---CSP keeps track of previous world position of each node to do its motion blur. This call would clear that value, so teleported, for
---example, objects wouldn’t have motion blur artifacts for a frame.
function _ac_SceneReference:clearMotion() end

---Number of elements in this reference.
function _ac_SceneReference:size() end

---If reference is empty or not.
function _ac_SceneReference:empty() end

---Find any children that match filter and return a new reference to them.
---@param filter string @Node/mesh filter.
---@return ac.SceneReference
function _ac_SceneReference:findAny(filter) end

---Find any child nodes that match filter and return a new reference to them.
---@param filter string @Node filter.
---@return ac.SceneReference
function _ac_SceneReference:findNodes(filter) end

---Find any child meshes that match filter and return a new reference to them.
---@param filter string @Mesh filter.
---@return ac.SceneReference
function _ac_SceneReference:findMeshes(filter) end

---Find any child skinned meshes that match filter and return a new reference to them.
---@param filter string @Mesh filter.
---@return ac.SceneReference
function _ac_SceneReference:findSkinnedMeshes(filter) end

---Create a new node with a given name and attach it as a child.
---@param name string
---@return ac.SceneReference @Newly created node or nil if failed
function _ac_SceneReference:createNode(name) end

---Create a new bounding sphere node with a given name and attach it as a child. Using those might help with performance: children
---would skip bounding frustum test, and whole node would not get traversed during rendering if it’s not in frustum.
---
---Note: for it to work properly, it’s better to attach it to AC cars node, as that one does expect those bounding sphere nodes
---to be inside of it. You can find it with `ac.findNodes('carsRoot:yes')`.
---@param name string
---@return ac.SceneReference @Can return nil if failed
function _ac_SceneReference:createBoundingSphereNode(name, radius) end

---Load KN5 model and attach it as a child.
---
---Node: The way it actually works, KN5 would be loaded in a pool and then copied here (with sharing
---of resources such as vertex buffers). This generally helps with performance.
---@param filename string @KN5 filename relative to script folder or AC root folder.
---@return ac.SceneReference @Can return nil if failed
function _ac_SceneReference:loadKN5(filename) end

---Load KN5 LOD model and attach it as a child. Parameter `mainFilename` should refer to the parent KN5.
---
---Node: The way it actually works, KN5 would be loaded in a pool and then copied here (with sharing
---of resources such as vertex buffers). This generally helps with performance. Parent KN5 would be
---loaded as well, but not shown, and instead kept in a pool.
---@param filename string @KN5 filename relative to script folder or AC root folder.
---@return ac.SceneReference @Can return nil if failed
function _ac_SceneReference:loadKN5LOD(filename, mainFilename) end

---@param visible boolean|'true'|'false'
function _ac_SceneReference:setVisible(visible) end

---@param shadows boolean|'true'|'false'
function _ac_SceneReference:setShadows(shadows) end

---@param transparent boolean|'true'|'false'
function _ac_SceneReference:setTransparent(transparent) end

---Sets position of a node (or nodes).
---@param pos vec3
function _ac_SceneReference:setPosition(pos) end

---Sets orientation of a node (or nodes). If vector `up` is not provided, facing up vector will be used.
---@param look vec3
---@param up vec3|nil
function _ac_SceneReference:setOrientation(look, up) end

---Rotates node relative to some axis.
---@param axis vec3
---@param angleRad number
function _ac_SceneReference:rotate(axis, angleRad) end

---Returns position of a first node.
---@return vec3
function _ac_SceneReference:getPosition() end

---Returns direction a first node is looking towards.
---@return vec3
function _ac_SceneReference:getLook() end

---Returns direction upwards of a first node.
---@return vec3
function _ac_SceneReference:getUp() end

---If you need to move something often, accessing its matrix directly might be the best way. Be careful though, if there
---are no nodes in the list, it would return nil.
---@return mat4x4
function _ac_SceneReference:getTransformationRaw() end

---Casts a ray prepared by something like `render.createRay(pos, dir, length)` or `render.createMouseRay()`.
---
---If you need to access a mesh that was hit, set second argument to true:
---```
---local hitDistance, hitMesh = mesh:raycast(ac.createRay(pos, dir), true)
---if hitDistance ~= -1 then
---  print(hitMesh:name())
---end
---```
---Alternatively, reuse your own scene reference for better performance if you need to cast
---a lot of rays:
---```
---local hitMesh = ac.emptySceneReference()
---local hitDistance = mesh:raycast(ac.createRay(pos, dir), hitMesh)
---if hitDistance ~= -1 then
---  print(hitMesh:name())
---end
---```
---@param ray ray
---@param outNodeRef ac.SceneReference|boolean|nil
---@param outPosRef vec3|nil
---@param outNormalRef vec3|nil
---@param outUVRef vec2|nil
---@return number @Distance
---@return ac.SceneReference|nil
function _ac_SceneReference:raycast(ray, outNodeRef, outPosRef, outNormalRef, outUVRef) end

---Get name of an element.
---@param index integer|nil @1-based index of an element to get a name of. Default value: 1.
---@return string
function _ac_SceneReference:name(index) end

---Get material name of an element.
---@param index integer|nil @1-based index of an element to get a material name of. Default value: 1.
---@return string
function _ac_SceneReference:materialName(index) end

---Get shader name of an element.
---@param index integer|nil @1-based index of an element to get a shader name of. Default value: 1.
---@return string
function _ac_SceneReference:shaderName(index) end

---Get bounding sphere of an element. Works only with meshes or skinned meshes, nodes will return nil.
---@param index integer|nil @1-based index of an element to get a bounding sphere of. Default value: 1.
---@param outVec vec3|nil @Optional vector to use for bounding sphere position, to avoid creating new vector.
---@return vec3|nil @Center of bounding sphere in parent node coordinates, or nil if there is no bounding sphere (if it’s not a mesh or a skinned mesh).
---@return number|nil @Radius of bounding sphere, or nil if there is no bounding sphere (if it’s not a mesh or a skinned mesh).
function _ac_SceneReference:boundingSphere(index, outVec) end

---Change parent of nodes in current reference.
---@param parentSceneRef ac.SceneReference|nil @Set to nil to disconnect node from a scene.
function _ac_SceneReference:setParent(parentSceneRef) end

---Finds materials in another scene reference that have the same names as materials in a given scene reference,
---and copies them over, so after that both references would share materials. Example use case: if you have LOD A and
---LOD B and LOD A got unique materials (because there are multiple objects sharing same KN5 model), with this function
---it’s possible to sync together materials from LOD A and LOD B by running `lodB:setMaterialsFrom(lodA)`. And because
---materials would not be actually copied, but instead shared, any consequent change of material properly in LOD A would
---be mirrored in LOD B.
---@return boolean @Returns false if no assignment occured (if there were no meshes in one of scene references, for example).
function _ac_SceneReference:setMaterialsFrom(materialSceneRef) end

---Creates a new scene reference with just a single item from the original scene reference.
---Indices are 1-based. By default it would create a new scene reference, if you need to access
---a lot of objects fast, provide your own:
---```
---  local meshes = ac.findMeshes('shader:ksTree')
---  local ref = ac.emptySceneReference()
---  for i = 1, #meshes do
---    meshes:at(i, ref)
---    print(ref:name())  -- note: for this particular case, it would be more optimal to use meshes:name(i) instead
---  end
---```
---@param index integer @1-based index.
---@param outNodeRef ac.SceneReference|nil
---@return ac.SceneReference
function _ac_SceneReference:at(index, outNodeRef) end

---Create new fake shadow node. Uses the same shading as track fake shadows.
---@param params {points: vec3[], opacity: number, squaredness: vec2}|"{ points = {  }, opacity = 1, squaredness = vec2() }" "@Params for newly created node."
---@return ac.SceneReference
function _ac_SceneReference:createFakeShadow(params) end

---Sets fake shadow points if current reference was created with `sceneReference:createFakeShadow()`.
---@param points vec3[] @Four corners.
---@param corners number[] @Four numbers for corner intensity.
function _ac_SceneReference:setFakeShadowPoints(points, corners) end

---Sets fake shadow squaredness if current reference was created with `sceneReference:createFakeShadow()`.
---@param squaredness vec2 @X is squaredness along one axis, Y is along another.
function _ac_SceneReference:setFakeShadowSquaredness(squaredness) end

---Sets fake shadow opacity if current reference was created with `sceneReference:createFakeShadow()`.
---@param opacity number @Value from 0 to 1.
function _ac_SceneReference:setFakeShadowOpacity(opacity) end

---@return ac.SceneReference
function ac.emptySceneReference() end

---@param s string @Node/mesh filter.
---@return ac.SceneReference
function ac.findAny(s) end

---@param s string @Node filter.
---@return ac.SceneReference
function ac.findNodes(s) end

---@param s string @Mesh filter.
---@return ac.SceneReference
function ac.findMeshes(s) end

---@param s string @Mesh filter.
---@return ac.SceneReference
function ac.findSkinnedMeshes(s) end

--[[ common/ac_display.lua ]]

---Display namespace with helper functions for creating dynamic textures.
display = {}

---Draw a rectangle.
---@param params {pos: vec2, size: vec2, color: rgbm}|"{ pos = vec2(), size = vec2(), color = rgbm.colors.white }" "Properties:\n- `pos`: Coordinates of the top left corner in pixels.\n- `size`: Size in pixels.\n- `color`: Rectangle color."
function display.rect(params) end

---Draw an image.
---
---If you’re drawing a lot of different images, consider combining them into a single atlas and using
---`uvStart`/`uvEnd` to specify the region.
---@param params {image: string, pos: vec2, size: vec2, color: rgbm, uvStart: vec2, uvEnd: vec2}|"{\n  image = '',\n  pos = vec2(),\n  size = vec2(),\n  color = rgbm.colors.white,\n  uvStart = vec2(0, 0),\n  uvEnd = vec2(1, 1)\n}" "Properties:\n- `image`: Path to image to draw.\n- `pos`: Coordinates of the top left corner in pixels.\n- `size`: Size in pixels.\n- `color`: Image will be multiplied by this color.\n- `uvStart`: UV coordinates of the top left corner.\n- `uvEnd`: UV coordinates of the bottom right corner."
function display.image(params) end

---Draw text using AC font.
---@param params {text: string, pos: vec2, letter: vec2, font: string, color: rgbm, alignment: number, width: number, spacing: number}|"{\n  text = '',\n  pos = vec2(),\n  letter = vec2(20, 40),\n  font = 'aria',\n  color = rgbm.colors.white,\n  alignment = 0,\n  width = 200,\n  spacing = 0\n}" "Properties:\n- `text`: Text to draw.\n- `pos`: Coordinates of the top left corner in pixels.\n- `letter`: Size of each letter.\n- `font`: AC font to draw text with, either from “content/fonts” or from a folder with a script (can refer to a subfolder).\n- `color`: Text color.\n- `alignment`: 0 for left, 0.5 for center, 1 for middle, could be anything in-between. Set `width` as well so it would know in what area to align text.\n- `width`: Required for non-left alignment.\n- `spacing`: Additional offset between characters, could be either positive or negative."
function display.text(params) end

--[[ common/ac_physics.lua ]]

---Physics namespace. Note: functions here are accessible only if track has expicitly allowed it with its
---extended CSP physics.
---
---To allow scriptable physics, add to surfaces.ini:
---```ini
---[_SCRIPTING_PHYSICS]
---ALLOW_TRACK_SCRIPTS=1    ; choose ones that you need
---ALLOW_DISPLAY_SCRIPTS=1
---ALLOW_NEW_MODE_SCRIPTS=1
---ALLOW_TOOLS=1
---```
---
---And to activate extended physics, use:
---```ini
---[SURFACE_0]
---WAV_PITCH=extended-0
---```
physics = {}

---Represents a physics rigid body. Requires double precision physics engine to work.
---@class physics.RigidBody
local _physics_RigidBody = nil

---Removes rigid body from the world.
function _physics_RigidBody:dispose() end

---Sets collision callback for semidynamic rigid bodies.
---@param callback fun()
function _physics_RigidBody:onCollision(callback) end

---@param transform mat4x4
---@param estimateVelocity boolean|'true'|'false'
function _physics_RigidBody:setTransformation(transform, estimateVelocity) end

---@param velocity vec3
function _physics_RigidBody:setVelocity(velocity) end

---@param velocity vec3
function _physics_RigidBody:setAngularVelocity(velocity) end

---@param linear number
---@param angular number
function _physics_RigidBody:setDamping(linear, angular) end

---@param mass number
function _physics_RigidBody:setMass(mass) end

---@param value boolean|'true'|'false'
---@param switchBackOnContact boolean|'true'|'false'
function _physics_RigidBody:setSemiDynamic(value, switchBackOnContact) end

---@return boolean
function _physics_RigidBody:isSemiDynamic() end

---Stops rigidbody, collider is still working.
---@param value boolean|'true'|'false'
function _physics_RigidBody:setEnabled(value) end

---@return boolean
function _physics_RigidBody:isEnabled() end

---Stops rigidbody and removes collider from the world.
---@param value boolean|'true'|'false'
function _physics_RigidBody:setInWorld(value) end

---@return boolean
function _physics_RigidBody:isInWorld() end

---@return number
function _physics_RigidBody:getSpeedKmh() end

---@return number
function _physics_RigidBody:getAngularSpeed() end

---@return vec3
function _physics_RigidBody:getVelocity() end

---@return vec3
function _physics_RigidBody:getAngularVelocity() end

---@return integer @Wraps to 0 after 255.
function _physics_RigidBody:getLastHitIndex() end

---@return vec3
function _physics_RigidBody:getLastHitPos() end

---@param force vec3
---@param forceLocal boolean|'true'|'false'
---@param pos vec3
---@param posLocal boolean|'true'|'false'
function _physics_RigidBody:addForce(force, forceLocal, pos, posLocal) end

---@param pos vec3
---@return vec3
function _physics_RigidBody:localPosToWorld(pos) end

---@param dir vec3
---@return vec3
function _physics_RigidBody:localDirToWorld(dir) end

---@param pos vec3
---@return vec3
function _physics_RigidBody:worldPosToLocal(pos) end

---@param dir vec3
---@return vec3
function _physics_RigidBody:worldDirToLocal(dir) end

---@param point vec3
---@param pointLocal boolean|'true'|'false'
---@param velocityLocal boolean|'true'|'false'
---@return vec3
function _physics_RigidBody:pointVelocity(point, pointLocal, velocityLocal) end

---@return mat4x4
function _physics_RigidBody:getTransformation() end

---Represents a physics rigid body. Requires double precision physics engine to work.
---@param filename string @Collider KN5 filename.
---@param mass number @Mass in kg, can be changed later.
---@param cog vec3 @Center of gravity in collider model, can’t be changed later.
---@param semiDynamic boolean|'true'|'false' @Semi-dynamic from the start. Default value: false.
---@param startsInWorld boolean|'true'|'false' @Add to world from the start. Default value: true.
---@return physics.RigidBody
function physics.RigidBody(filename, mass, cog, semiDynamic, startsInWorld) end

--[[ common/ac_web.lua ]]

---Web module
web = {}

---Sends a GET HTTP request
---@param url string @URL.
---@param headers table<string, string>? @Optional headers.
---@param callback fun(err: string, response: WebResponse)
---@overload fun(url: string, callback: fun(err: string, response: WebResponse))
function web.get(url, headers, callback) end

---Sends a POST HTTP request
---@param url string @URL.
---@param headers table<string, string>? @Optional headers.
---@param data string? @Optional data.
---@param callback fun(err: string, response: WebResponse)
---@overload fun(url: string, data: string, callback: fun(err: string, response: WebResponse))
---@overload fun(url: string, callback: fun(err: string, response: WebResponse))
function web.post(url, headers, data, callback) end

---@class WebResponse
---@field status integer
---@field headers table<string, string>
---@field body string
local WebResponse = nil

--[[ common/io.lua ]]

---Returns true if file exists.
---@param filename string
---@return boolean
function io.exists(filename) end

---Loads file as a string.
---@param filename string
---@param fallback string|nil
---@return string
function io.load(filename, fallback) end

---Saves string to a file.
---@param filename string
---@param data string
---@return string
function io.save(filename, data) end